From a8e74efb015887a3e6d49a39505ce19c535ffe14 Mon Sep 17 00:00:00 2001 From: Sean Corbett Date: Sat, 4 Sep 2010 18:21:03 -0400 Subject: [PATCH] Added gallery links to previous / next pages. --- plugins/GNUsocialPhotos/actions/photos.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/plugins/GNUsocialPhotos/actions/photos.php b/plugins/GNUsocialPhotos/actions/photos.php index 83060dc573..368f806ff9 100644 --- a/plugins/GNUsocialPhotos/actions/photos.php +++ b/plugins/GNUsocialPhotos/actions/photos.php @@ -22,6 +22,7 @@ * @category Widget * @package GNU Social * @author Ian Denhardt + * @author Sean Corbett * @copyright 2010 Free Software Foundation, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 */ @@ -85,10 +86,23 @@ class PhotosAction extends Action } $pathparts = explode('/', $args[1]['nickname']); $username = $pathparts[0]; - $this->elementStart('ul', array('class' => 'photothumbs')); - $photos = GNUsocialPhoto::getGalleryPage(1, 0, 9); + + + $page = $_GET['pageid']; + if (!filter_var($page, FILTER_VALIDATE_INT)){ + $page = 1; + } + + if ($page > 1) { + $this->element('a', array('href' => 'photos?pageid=' . ($page-1)), 'Previous page'); + } + $this->element('a', array('href' => 'photos?pageid=' . ($page+1) ), 'Next page'); + + //TODO need to set album ID.. + $photos = GNUsocialPhoto::getGalleryPage($page, 0, 9); + $this->elementStart('ul', array('class' => 'photothumbs')); foreach ($photos as $photo) { $this->elementStart('li'); $this->elementStart('a', array('href' => $photo->uri)); -- 2.39.2