}
}
+
+ /**
+ *
+ * When a photo was uploaded into the message using the (profile wall) ajax
+ * uploader, The permissions are initially set to disallow anybody but the
+ * owner from seeing it. This is because the permissions may not yet have been
+ * set for the post. If it's private, the photo permissions should be set
+ * appropriately. But we didn't know the final permissions on the post until
+ * now. So now we'll look for links of uploaded messages that are in the
+ * post and set them to the same permissions as the post itself.
+ *
+ */
+
+ $match = null;
+
+ if(preg_match_all("/\[img\](.+?)\[\/img\]/",$body,$match)) {
+ $images = $match[1];
+ if(count($images)) {
+ foreach($images as $image) {
+ if(! stristr($image,$a->get_baseurl() . '/photo/'))
+ continue;
+ $image_uri = substr($image,strrpos($image,'/') + 1);
+ $image_uri = substr($image_uri,0, strpos($image_uri,'-'));
+ $r = q("UPDATE `photo` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s'
+ WHERE `resource-id` = '%s' AND `album` = '%s' ",
+ dbesc($str_contact_allow),
+ dbesc($str_group_allow),
+ dbesc($str_contact_deny),
+ dbesc($str_group_deny),
+ dbesc($image_uri),
+ dbesc( t('Wall Photos'))
+ );
+
+ }
+ }
+ }
+
+ /**
+ * Fold multi-line [code] sequences
+ */
+
+ $body = preg_replace('/\[\/code\]\s*\[code\]/m',"\n",$body);
+
+ /**
+ * Look for any tags and linkify them
+ */
+
$str_tags = '';
$inform = '';
}
}
if($profile) {
- $body = str_replace($name,'[url=' . $profile . ']' . $newname . '[/url]', $body);
+ $body = str_replace('@' . $name, '@' . '[url=' . $profile . ']' . $newname . '[/url]', $body);
$profile = str_replace(',','%2c',$profile);
if(strlen($str_tags))
$str_tags .= ',';
proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"$notify_type\" \"$post_id\" &",
array(),$foo));
- /**
- * Post to Facebook stream
- */
+ $datarray['id'] = $post_id;
- if((local_user()) && (local_user() == $profile_uid) && (! $private)) {
- $appid = get_config('system', 'facebook_appid' );
- $secret = get_config('system', 'facebook_secret' );
- if($appid && $secret) {
- $fb_post = get_pconfig($local_user(),'facebook','post');
- if($fb_post) {
- require_once('library/facebook.php');
- require_once('include/bbcode.php');
-
- $facebook = new Facebook(array(
- 'appId' => $appid,
- 'secret' => $secret,
- 'cookie' => true
- ));
- try {
- $statusUpdate = $facebook->api('/me/feed', 'post', array('message'=> bbcode($datarray['body']), 'cb' => ''));
- }
- catch (FacebookApiException $e) {
- notice( t('Facebook status update failed.') . EOL);
- }
- }
- }
- }
+ call_hooks('post_local_end', $datarray);
+
goaway($a->get_baseurl() . "/" . $_POST['return'] );
return; // NOTREACHED