]> git.mxchange.org Git - friendica.git/blobdiff - mod/photos.php
Merge pull request #5620 from annando/fix-remove
[friendica.git] / mod / photos.php
index fb66cef1dbe2579ee1499064c950682ad18627b8..b908234ab74631db72204a0f989bfa652945db84 100644 (file)
@@ -123,7 +123,10 @@ function photos_init(App $a) {
                }
 
                $a->page['aside'] .= $vcard_widget;
-               $a->page['aside'] .= $photo_albums_widget;
+
+               if (!empty($photo_albums_widget)) {
+                       $a->page['aside'] .= $photo_albums_widget;
+               }
 
                $tpl = get_markup_template("photos_head.tpl");
 
@@ -147,7 +150,7 @@ function photos_post(App $a)
        $visitor   = 0;
 
        $page_owner_uid = $a->data['user']['uid'];
-       $community_page = $a->data['user']['page-flags'] == PAGE_COMMUNITY;
+       $community_page = $a->data['user']['page-flags'] == Contact::PAGE_COMMUNITY;
 
        if (local_user() && (local_user() == $page_owner_uid)) {
                $can_post = true;
@@ -900,7 +903,7 @@ function photos_post(App $a)
                Worker::add(PRIORITY_HIGH, "Notifier", 'wall-new', $item_id);
        }
 
-       Addon::callHooks('photo_post_end', intval($item_id));
+       Addon::callHooks('photo_post_end', $item_id);
 
        // addon uploaders should call "killme()" [e.g. exit] within the photo_post_end hook
        // if they do not wish to be redirected
@@ -964,7 +967,7 @@ function photos_content(App $a)
 
        $owner_uid = $a->data['user']['uid'];
 
-       $community_page = (($a->data['user']['page-flags'] == PAGE_COMMUNITY) ? true : false);
+       $community_page = (($a->data['user']['page-flags'] == Contact::PAGE_COMMUNITY) ? true : false);
 
        if (local_user() && (local_user() == $owner_uid)) {
                $can_post = true;
@@ -1050,7 +1053,7 @@ function photos_content(App $a)
                $albumselect = '';
 
                $albumselect .= '<option value="" ' . (!$selname ? ' selected="selected" ' : '') . '>&lt;current year&gt;</option>';
-               if (count($a->data['albums'])) {
+               if (!empty($a->data['albums'])) {
                        foreach ($a->data['albums'] as $album) {
                                if (($album['album'] === '') || ($album['album'] === 'Contact Photos') || ($album['album'] === L10n::t('Contact Photos'))) {
                                        continue;
@@ -1257,6 +1260,8 @@ function photos_content(App $a)
                        );
 
                        if (DBA::isResult($prvnxt)) {
+                               $prv = null;
+                               $nxt = null;
                                foreach ($prvnxt as $z => $entry) {
                                        if ($entry['resource-id'] == $ph[0]['resource-id']) {
                                                $prv = $z - 1;
@@ -1271,8 +1276,12 @@ function photos_content(App $a)
                                        }
                                }
                                $edit_suffix = ((($cmd === 'edit') && $can_post) ? '/edit' : '');
-                               $prevlink = 'photos/' . $a->data['user']['nickname'] . '/image/' . $prvnxt[$prv]['resource-id'] . $edit_suffix . ($order_field === 'posted' ? '?f=&order=posted' : '');
-                               $nextlink = 'photos/' . $a->data['user']['nickname'] . '/image/' . $prvnxt[$nxt]['resource-id'] . $edit_suffix . ($order_field === 'posted' ? '?f=&order=posted' : '');
+                               if (!is_null($prv)) {
+                                       $prevlink = 'photos/' . $a->data['user']['nickname'] . '/image/' . $prvnxt[$prv]['resource-id'] . $edit_suffix . ($order_field === 'posted' ? '?f=&order=posted' : '');
+                               }
+                               if (!is_null($nxt)) {
+                                       $nextlink = 'photos/' . $a->data['user']['nickname'] . '/image/' . $prvnxt[$nxt]['resource-id'] . $edit_suffix . ($order_field === 'posted' ? '?f=&order=posted' : '');
+                               }
                        }
                }