summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/all.php6
-rw-r--r--actions/allrss.php6
-rw-r--r--actions/twitapistatuses.php4
-rw-r--r--classes/User.php12
4 files changed, 9 insertions, 19 deletions
diff --git a/actions/all.php b/actions/all.php
index 0f8cf587c..944fec6d4 100644
--- a/actions/all.php
+++ b/actions/all.php
@@ -78,12 +78,8 @@ class AllAction extends StreamAction {
$page = 1;
}
- $notice = $user->noticesWithFriends(($page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
+ list($cnt, $notice) = $user->noticesWithFriends(($page-1)*NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1);
- # XXX: revisit constant scope
-
- $cnt = $notice->find();
-
if ($cnt > 0) {
common_element_start('ul', array('id' => 'notices'));
for ($i = 0; $i < min($cnt, NOTICES_PER_PAGE); $i++) {
diff --git a/actions/allrss.php b/actions/allrss.php
index b6701cfdc..088d04037 100644
--- a/actions/allrss.php
+++ b/actions/allrss.php
@@ -43,12 +43,8 @@ class AllrssAction extends Rss10Action {
$user = $this->user;
- $notice = $user->noticesWithFriends(0, $limit);
+ list($cnt, $notice) = $user->noticesWithFriends(0, $limit);
- # XXX: revisit constant scope
-
- $cnt = $notice->find();
-
while ($notice->fetch()) {
$notices[] = clone($notice);
}
diff --git a/actions/twitapistatuses.php b/actions/twitapistatuses.php
index 56a8199b7..1480b7a5a 100644
--- a/actions/twitapistatuses.php
+++ b/actions/twitapistatuses.php
@@ -223,9 +223,7 @@ class TwitapistatusesAction extends TwitterapiAction {
$link = common_local_url('all', array('nickname' => $user->nickname));
$subtitle = sprintf(_("Updates from %s and friends on %s!"), $user->nickname, $sitename);
- $notice->$user->noticesWithFriends(($page-1)*20, $count);
-
- $cnt = $notice->find();
+ list($cnt, $notice) = $user->noticesWithFriends(($page-1)*20, $count);
switch($apidata['content-type']) {
case 'xml':
diff --git a/classes/User.php b/classes/User.php
index b6689761e..7da483653 100644
--- a/classes/User.php
+++ b/classes/User.php
@@ -133,12 +133,12 @@ class User extends DB_DataObject
$notice = new Notice();
- $notice->query('SELECT notice.* ' .
- 'FROM notice JOIN subscription on notice.profile_id = subscription.subscribed ' .
- 'WHERE subscription.subscriber = ' . $this->id . ' ' .
- 'ORDER BY created DESC, notice.id DESC ' .
- 'LIMIT ' . $offset . ', ' . $limit);
+ $cnt = $notice->query('SELECT notice.* ' .
+ 'FROM notice JOIN subscription on notice.profile_id = subscription.subscribed ' .
+ 'WHERE subscription.subscriber = ' . $this->id . ' ' .
+ 'ORDER BY created DESC, notice.id DESC ' .
+ 'LIMIT ' . $offset . ', ' . $limit);
- return $notice;
+ return array($cnt, $notice);
}
}