]> git.mxchange.org Git - friendica.git/blobdiff - mod/photos.php
Merge commit 'mike/master'
[friendica.git] / mod / photos.php
index 1a1ebaac1933cbdd78bd9a162e3b5b42814c047d..d4835ba5ea65edb515a35087c08483f8ac3419e9 100644 (file)
@@ -268,6 +268,13 @@ foreach($_FILES AS $key => $val) {
                                intval($page_owner_uid)
                        );
                }
+
+               /* Don't make the item visible if the only change was the album name */
+
+               $visibility = 0;
+               if($p[0]['desc'] !== $desc || strlen($rawtags))
+                       $visibility = 1;
+               
                if(! $item_id) {
 
                        // Create item container
@@ -297,6 +304,7 @@ foreach($_FILES AS $key => $val) {
                        $arr['deny_cid']      = $p[0]['deny_cid'];
                        $arr['deny_gid']      = $p[0]['deny_gid'];
                        $arr['last-child']    = 1;
+                       $arr['visible']       = $visibility;
                        $arr['body']          = '[url=' . $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $p[0]['resource-id'] . ']' 
                                                . '[img]' . $a->get_baseurl() . '/photo/' . $p[0]['resource-id'] . '-' . $p[0]['scale'] . '.jpg' . '[/img]' 
                                                . '[/url]';
@@ -823,7 +831,7 @@ function photos_content(&$a) {
                        $a->set_pager_itemspage(20);
                }
 
-               $r = q("SELECT `resource-id`, `id`, `filename`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = %d AND `album` = '%s' 
+               $r = q("SELECT `resource-id`, `id`, `filename`, max(`scale`) AS `scale`, `desc` FROM `photo` WHERE `uid` = %d AND `album` = '%s' 
                        $sql_extra GROUP BY `resource-id` ORDER BY `created` DESC LIMIT %d , %d",
                        intval($owner_uid),
                        dbesc($album),
@@ -865,7 +873,8 @@ function photos_content(&$a) {
                                        '$photolink' => $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $rr['resource-id'],
                                        '$phototitle' => t('View Photo'),
                                        '$imgsrc' => $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['scale'] . '.jpg',
-                                       '$imgalt' => $rr['filename']
+                                       '$imgalt' => $rr['filename'],
+                                       '$desc'=> $rr['desc']
                                ));
 
                }
@@ -1040,7 +1049,8 @@ 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' => '', 
+                                                       '$jsreload' => $return_url,
                                                        '$type' => 'wall-comment',
                                                        '$id' => $link_item['id'],
                                                        '$parent' => $link_item['id'],
@@ -1079,7 +1089,8 @@ 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' => '',
+                                                       '$jsreload' => $return_url,
                                                        '$type' => 'wall-comment',
                                                        '$id' => $link_item['id'],
                                                        '$parent' => $link_item['id'],
@@ -1107,7 +1118,8 @@ function photos_content(&$a) {
 
                                                if($item['last-child']) {
                                                        $comment = replace_macros($cmnt_tpl,array(
-                                                               '$return_path' => $return_url,
+                                                               '$return_path' => '',
+                                                               '$jsreload' => $return_url,
                                                                '$type' => 'wall-comment',
                                                                '$id' => $item['item_id'],
                                                                '$parent' => $item['parent'],