X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fall.php;h=bd5b9f01e5f5dce8f642ea28300ee47d6d6734a1;hb=a034e13bf03fe06cf5d2500bd29506c71c67b6bb;hp=3d3d1c3563188b8c23e7cfc1e82f14f6b603b132;hpb=64ed01f0aff569da2fd4ed589df9ed4ee9852cb7;p=quix0rs-gnu-social.git diff --git a/actions/all.php b/actions/all.php index 3d3d1c3563..bd5b9f01e5 100644 --- a/actions/all.php +++ b/actions/all.php @@ -78,26 +78,24 @@ class AllAction extends StreamAction { $page = 1; } - $notice = $user->noticesWithFriends($page); - # XXX: revisit constant scope + $notice = $user->noticesWithFriends(($page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1); + + common_element_start('ul', array('id' => 'notices')); - $notice->limit((($page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE + 1); + $cnt = 0; - - if ($cnt > 0) { - common_element_start('ul', array('id' => 'notices')); - for ($i = 0; $i < min($cnt, NOTICES_PER_PAGE); $i++) { - if ($notice->fetch()) { - $this->show_notice($notice); - } else { - // shouldn't happen! - break; - } + while ($notice->fetch() && $cnt <= NOTICES_PER_PAGE) { + $cnt++; + + if ($cnt > NOTICES_PER_PAGE) { + break; } - common_element_end('ul'); + + $this->show_notice($notice); } + common_element_end('ul'); common_pagination($page > 1, $cnt > NOTICES_PER_PAGE, - $page, 'all', array('nickname' => $profile->nickname)); + $page, 'all', array('nickname' => $user->nickname)); } }