X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fgallery.php;h=d0c55d634b0bc9d69f8f3f80c998c35363894b34;hb=1d67f33b3b62cc28d0a9845fb22776ce33adfdaa;hp=6d21b8310f49c2c53d0a4ba2124a2510f9378171;hpb=aeaf75138cf8be42d2e3935b708e1d24a97bd0a0;p=quix0rs-gnu-social.git diff --git a/lib/gallery.php b/lib/gallery.php index 6d21b8310f..d0c55d634b 100644 --- a/lib/gallery.php +++ b/lib/gallery.php @@ -68,15 +68,25 @@ class GalleryAction extends Action { $subs_count = $subs->find(); - common_element_start('div', $this->div_class()); - - $idx = 0; + if ($subs_count == 0) { + common_element('p', _t('Nobody to show!')); + return; + } + + common_element_start('ul', $this->div_class()); - while ($subs->fetch()) { + for ($idx = 0; $idx < min($subs_count, AVATARS_PER_PAGE); $idx++) { + + $result = $subs->fetch(); - $idx++; + if (!$result) { + common_debug('Ran out of subscribers too early.', __FILE__); + break; + } - $other = Profile::staticGet($subs->subscribed); + $other = Profile::staticGet($this->get_other($subs)); + + common_element_start('li'); common_element_start('a', array('title' => ($other->fullname) ? $other->fullname : @@ -97,14 +107,12 @@ class GalleryAction extends Action { common_element_end('a'); # XXX: subscribe form here - - if ($idx == AVATARS_PER_PAGE) { - break; - } + + common_element_end('li'); } - common_element_end('div'); - + common_element_end('ul'); + common_pagination($page > 1, $subs_count > AVATARS_PER_PAGE, $page, @@ -123,6 +131,10 @@ class GalleryAction extends Action { function define_subs(&$subs, &$profile) { return; } + + function get_other(&$subs) { + return NULL; + } function div_class() { return '';