summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@prodromou.name>2008-05-18 14:59:40 -0400
committerEvan Prodromou <evan@prodromou.name>2008-05-18 14:59:40 -0400
commit3ea856c69e4ec78c830b39f00e1a92ff29c3905f (patch)
tree77e66bfccb41517b1c53dc33019bb3140d441cf3
parent74cab76cc8d6973abb6aa8bf30eec4ce6dac9faf (diff)
off-by-one error in notice stream
darcs-hash:20080518185940-84dde-fb7a3af877c67b5d7e9c59d32092c1392a0ecd58.gz
-rw-r--r--actions/all.php3
-rw-r--r--actions/public.php2
-rw-r--r--actions/showstream.php12
3 files changed, 9 insertions, 8 deletions
diff --git a/actions/all.php b/actions/all.php
index 92ae385ca..7cd1f5beb 100644
--- a/actions/all.php
+++ b/actions/all.php
@@ -38,7 +38,7 @@ class AllAction extends ShowstreamAction {
$page = $this->arg('page') || 1;
- $notice->limit((($page-1)*NOTICES_PER_PAGE) + 1, NOTICES_PER_PAGE);
+ $notice->limit((($page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE);
$notice->find();
@@ -48,6 +48,7 @@ class AllAction extends ShowstreamAction {
$this->show_notice($notice);
}
+ # XXX: show a link for the next page
common_element_end('div');
}
}
diff --git a/actions/public.php b/actions/public.php
index 5b1e50fa3..777612579 100644
--- a/actions/public.php
+++ b/actions/public.php
@@ -44,7 +44,7 @@ class PublicAction extends StreamAction {
# XXX: filter out private notifications
$notice->orderBy('created DESC');
- $notice->limit((($page-1)*NOTICES_PER_PAGE) + 1, NOTICES_PER_PAGE);
+ $notice->limit((($page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE);
$notice->find();
diff --git a/actions/showstream.php b/actions/showstream.php
index 81f5a3db3..861f58c29 100644
--- a/actions/showstream.php
+++ b/actions/showstream.php
@@ -190,15 +190,15 @@ class ShowstreamAction extends StreamAction {
// XXX: WORM cache this
$subs = DB_DataObject::factory('subscription');
$subs->subscriber = $profile->id;
- $subs_count = $subs->count();
+ $subs_count = $subs->count() || 0;
$subbed = DB_DataObject::factory('subscription');
$subbed->subscribed = $profile->id;
- $subbed_count = $subbed->count();
+ $subbed_count = $subbed->count() || 0;
$notices = DB_DataObject::factory('notice');
$notices->profile_id = $profile->id;
- $notice_count = $notices->count();
+ $notice_count = $notices->count() || 0;
# Other stats...?
common_element_start('dl', 'statistics');
@@ -220,7 +220,7 @@ class ShowstreamAction extends StreamAction {
$page = $this->arg('page') || 1;
- $notice->limit((($page-1)*NOTICES_PER_PAGE) + 1, NOTICES_PER_PAGE);
+ $notice->limit((($page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE);
$notice->find();
@@ -229,7 +229,7 @@ class ShowstreamAction extends StreamAction {
while ($notice->fetch()) {
$this->show_notice($notice);
}
-
+ # XXX: show a link for the next page
common_element_end('div');
}
@@ -237,7 +237,7 @@ class ShowstreamAction extends StreamAction {
$notice = DB_DataObject::factory('notice');
$notice->profile_id = $profile->id;
$notice->orderBy('created DESC');
- $notice->limit(1, 1);
+ $notice->limit(0, 1);
$notice->find();
while ($notice->fetch()) {