From: Evan Prodromou Date: Wed, 21 May 2008 19:06:40 +0000 (-0400) Subject: off-by-one error in subscriptions X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0f0d50f06a841e4faed475aa5f73f8bc08bb3a39;p=quix0rs-gnu-social.git off-by-one error in subscriptions darcs-hash:20080521190640-84dde-04fc00048b044474488e7774053674231c96e355.gz --- diff --git a/actions/showstream.php b/actions/showstream.php index bf9df04a34..984c2454b1 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -159,7 +159,14 @@ class ShowstreamAction extends StreamAction { global $config; # XXX: add a limit - $subs = $profile->getLink('id', 'subscription', 'subscriber'); + $subs = DB_DataObject::factory('subscription'); + $subs->subscriber = $profile->id; + + # We ask for an extra one to know if we need to do another page + + $subs->limit(0, SUBSCRIPTIONS); + + $subs_count = $subs->find(); common_element_start('div', 'subscriptions'); diff --git a/actions/subscribed.php b/actions/subscribed.php index 3218e07b86..e8df331ee6 100644 --- a/actions/subscribed.php +++ b/actions/subscribed.php @@ -49,7 +49,7 @@ class SubscribedAction extends Action { # We ask for an extra one to know if we need to do another page - $subs->limit((($page-1)*SUBSCRIPTIONS_PER_PAGE)+1, SUBSCRIPTIONS_PER_PAGE + 1); + $subs->limit((($page-1)*SUBSCRIPTIONS_PER_PAGE), SUBSCRIPTIONS_PER_PAGE + 1); $subs_count = $subs->find(); diff --git a/actions/subscriptions.php b/actions/subscriptions.php index f111d0be2e..3ec7a01220 100644 --- a/actions/subscriptions.php +++ b/actions/subscriptions.php @@ -45,7 +45,7 @@ class SubscriptionsAction extends Action { # We ask for an extra one to know if we need to do another page - $subs->limit((($page-1)*SUBSCRIPTIONS_PER_PAGE)+1, SUBSCRIPTIONS_PER_PAGE + 1); + $subs->limit((($page-1)*SUBSCRIPTIONS_PER_PAGE), SUBSCRIPTIONS_PER_PAGE + 1); $subs_count = $subs->find();