]> git.mxchange.org Git - friendica.git/blobdiff - mod/photos.php
tweaks to author collapsing
[friendica.git] / mod / photos.php
index 854c6ee1418f2f81e62c12f6ab4f6d8ea04d5786..061542c758ebda931ff6d37e55b1eb7c2ab73fc8 100644 (file)
@@ -310,6 +310,7 @@ foreach($_FILES AS $key => $val) {
                        $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]';
@@ -909,6 +910,32 @@ function photos_content(&$a) {
                        return;
                }
 
+               $prevlink = '';
+               $nextlink = '';
+
+               $prvnxt = q("SELECT `resource-id` FROM `photo` WHERE `album` = '%s' AND `uid` = %d AND `scale` = 0 
+                       $sql_extra ORDER BY `created` DESC ",
+                       dbesc($ph[0]['album']),
+                       intval($owner_uid)
+               ); 
+
+               if(count($prvnxt)) {
+                       for($z = 0; $z < count($prvnxt); $z++) {
+                               if($prvnxt[$z]['resource-id'] == $ph[0]['resource-id']) {
+                                       $prv = $z - 1;
+                                       $nxt = $z + 1;
+                                       if($prv < 0)
+                                               $prv = count($prvnxt) - 1;
+                                       if($nxt >= count($prvnxt))
+                                               $nxt = 0;
+                                       break;
+                               }
+                       }
+                       $prevlink = $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $prvnxt[$prv]['resource-id'] ;
+                       $nextlink = $a->get_baseurl() . '/photos/' . $a->data['user']['nickname'] . '/image/' . $prvnxt[$nxt]['resource-id'] ;
+               }
+
+
                if(count($ph) == 1)
                        $hires = $lores = $ph[0];
                if(count($ph) > 1) {
@@ -938,11 +965,18 @@ function photos_content(&$a) {
                        $o .= '</div>';
                }
 
+               if($prevlink)
+                       $o .= '<div id="photo-prev-link"><a href="' . $prevlink .'">' . t('<< Prev') . '</a></div>' ;
 
-               $o .= '<a href="' . $a->get_baseurl() . '/photo/' 
+               $o .= '<div id="photo-photo"><a href="' . $a->get_baseurl() . '/photo/' 
                        . $hires['resource-id'] . '-' . $hires['scale'] . '.jpg" title="' 
                        . t('View Full Size') . '" ><img src="' . $a->get_baseurl() . '/photo/' 
-                       . $lores['resource-id'] . '-' . $lores['scale'] . '.jpg' . '" /></a>';
+                       . $lores['resource-id'] . '-' . $lores['scale'] . '.jpg' . '" /></a></div>';
+
+               if($nextlink)
+                       $o .= '<div id="photo-next-link"><a href="' . $nextlink .'">' . t('Next >>') . '</a></div>';
+
+               $o .= '<div id="photo-photo-end"></div>';
 
 
                // Do we have an item for this photo?
@@ -1040,7 +1074,7 @@ function photos_content(&$a) {
                        $tpl = load_view_file('view/photo_item.tpl');
                        $return_url = $a->cmd;
 
-                       $like_tpl = load_view_file('view/like.tpl');
+                       $like_tpl = load_view_file('view/like_noshare.tpl');
 
                        $likebuttons = '';
 
@@ -1049,6 +1083,7 @@ function photos_content(&$a) {
                                        '$id' => $item['id'],
                                        '$likethis' => t("I like this \x28toggle\x29"),
                                        '$nolike' => t("I don't like this \x28toggle\x29"),
+                                       '$share' => t('Share'),
                                        '$wait' => t('Please wait') 
                                ));
                        }