diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/display.php | 3 | ||||
-rw-r--r-- | mod/item.php | 5 | ||||
-rw-r--r-- | mod/message.php | 43 | ||||
-rw-r--r-- | mod/network.php | 1 | ||||
-rw-r--r-- | mod/photos.php | 2 | ||||
-rw-r--r-- | mod/profile.php | 1 |
6 files changed, 45 insertions, 10 deletions
diff --git a/mod/display.php b/mod/display.php index 3215ae90a..03003f3c0 100644 --- a/mod/display.php +++ b/mod/display.php @@ -153,7 +153,7 @@ function display_content(&$a) { } if($item['last-child']) { $comment = replace_macros($cmnt_tpl,array( - '$return_path' => $_SESSION['return_url'], + '$return_path' => '', // $_SESSION['return_url'], '$type' => 'wall-comment', '$id' => $item['item_id'], '$parent' => $item['parent'], @@ -272,6 +272,7 @@ function display_content(&$a) { '$owner_url' => $owner_url, '$owner_photo' => $owner_photo, '$owner_name' => $owner_name, + '$plink' => get_plink($item), '$drop' => $drop, '$vote' => $likebuttons, '$like' => $like, diff --git a/mod/item.php b/mod/item.php index 2cc2b9eb2..21dfb4560 100644 --- a/mod/item.php +++ b/mod/item.php @@ -429,10 +429,11 @@ function item_post(&$a) { } } - $r = q("UPDATE `item` SET `parent` = %d, `parent-uri` = '%s', `changed` = '%s', `last-child` = 1, `visible` = 1 + $r = q("UPDATE `item` SET `parent` = %d, `parent-uri` = '%s', `plink` = '%s', `changed` = '%s', `last-child` = 1, `visible` = 1 WHERE `id` = %d LIMIT 1", intval($parent), dbesc(($parent == $post_id) ? $uri : $parent_item['uri']), + dbesc($a->get_baseurl() . '/display/' . $user['nickname'] . '/' . $post_id), dbesc(datetime_convert()), intval($post_id) ); @@ -544,7 +545,7 @@ function item_content(&$a) { // generate a resource-id and therefore aren't intimately linked to the item. if(strlen($item['resource-id'])) { - $q("DELETE FROM `photo` WHERE `resource-id` = '%s' AND `uid` = %d ", + q("DELETE FROM `photo` WHERE `resource-id` = '%s' AND `uid` = %d ", dbesc($item['resource-id']), intval($item['uid']) ); diff --git a/mod/message.php b/mod/message.php index 7615f22be..ef3be2c5e 100644 --- a/mod/message.php +++ b/mod/message.php @@ -2,11 +2,6 @@ require_once('include/acl_selectors.php'); -function message_init(&$a) { - - -} - function message_post(&$a) { if(! local_user()) { @@ -69,6 +64,43 @@ function message_post(&$a) { if(count($r)) $post_id = $r[0]['id']; + /** + * + * 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' + WHERE `resource-id` = '%s' AND `album` = '%s' AND `uid` = %d ", + dbesc('<' . $recipient . '>'), + dbesc($image_uri), + dbesc( t('Wall Photos')), + intval(local_user()) + ); + } + } + } + + + + + $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); if($post_id) { @@ -80,7 +112,6 @@ function message_post(&$a) { notice( t('Message could not be sent.') . EOL ); } return; - } function message_content(&$a) { diff --git a/mod/network.php b/mod/network.php index f09b302e9..3658c601e 100644 --- a/mod/network.php +++ b/mod/network.php @@ -425,6 +425,7 @@ function network_content(&$a, $update = 0) { '$owner_url' => $owner_url, '$owner_photo' => $owner_photo, '$owner_name' => $owner_name, + '$plink' => get_plink($item), '$drop' => $drop, '$vote' => $likebuttons, '$like' => $like, diff --git a/mod/photos.php b/mod/photos.php index 9acde458d..a44eb5a5f 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1048,7 +1048,7 @@ function photos_content(&$a) { if($can_post || can_write_wall($a,$owner_uid)) { if($link_item['last-child']) { $o .= replace_macros($cmnt_tpl,array( - '$return_path' => $return_url, + '$return_path' => '', // $return_url, '$type' => 'wall-comment', '$id' => $link_item['id'], '$parent' => $link_item['id'], diff --git a/mod/profile.php b/mod/profile.php index 57abc479d..0723d64fb 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -371,6 +371,7 @@ function profile_content(&$a, $update = 0) { '$lock' => $lock, '$location' => $location, '$indent' => $indent, + '$plink' => get_plink($item), '$drop' => $drop, '$like' => $like, '$vote' => $likebuttons, |