]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
notices and counts
authorEvan Prodromou <evan@prodromou.name>
Tue, 22 Jul 2008 16:23:32 +0000 (12:23 -0400)
committerEvan Prodromou <evan@prodromou.name>
Tue, 22 Jul 2008 16:23:32 +0000 (12:23 -0400)
darcs-hash:20080722162332-84dde-75801a271f50789377aa7a3467223286c372ec6c.gz

actions/all.php
actions/allrss.php
actions/twitapistatuses.php
classes/User.php

index 0f8cf587cd8a27943ff1a68790a2aeedcf63dbce..944fec6d4b7c5958a7157e7a0e86a9157a0c8bb5 100644 (file)
@@ -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++) {
index b6701cfdc7e4d9f4bd87be81d90e6acdf2aca776..088d04037f3acdb221dffd3efed697506f717d78 100644 (file)
@@ -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);
                }
index 56a8199b78c042ccbe054b2347ace6690b42e8dc..1480b7a5a16eb027ac81edc954d1f92af2234cb9 100644 (file)
@@ -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': 
index b6689761eec4159faf62fbd15da775fe02a2f197..7da483653fa09542ea255562c59476a2950b6f33 100644 (file)
@@ -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);
        }
 }