From d9c6c919e887eecdd09377b1c233236189650b1e Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 5 Aug 2018 15:55:57 +0200 Subject: [PATCH] Fix missing $prv and $nxt variables in mod/photos --- mod/photos.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mod/photos.php b/mod/photos.php index 04d4138fc6..c2b00c7345 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1260,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; @@ -1274,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' : ''); + } } }