]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/popularnoticesection.php
Merge commit 'refs/merge-requests/11' of git://gitorious.org/statusnet/gnu-social...
[quix0rs-gnu-social.git] / lib / popularnoticesection.php
index f6f27c6878e973a6df406520b433200bb3d6f0bc..2000d302d48fa95b12b46dcea5d48d60758fe244 100644 (file)
@@ -22,7 +22,7 @@
  * @category  Widget
  * @package   StatusNet
  * @author    Evan Prodromou <evan@status.net>
- * @copyright 2009 StatusNet, Inc.
+ * @copyright 2009,2011 StatusNet, Inc.
  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link      http://status.net/
  */
@@ -45,15 +45,18 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
  */
 class PopularNoticeSection extends NoticeSection
 {
+    protected $viewer;
+
+    function __construct($out, $viewer)
+    {
+        parent::__construct($out);
+        $this->viewer = $viewer;
+    }
+
     function getNotices()
     {
-        $pop = new Popularity();
-        if (!empty($this->out->tag)) {
-            $pop->tag = $this->out->tag;
-        }
-        $pop->limit = NOTICES_PER_SECTION;
-        $pop->expiry = 1200;
-        return $pop->getNotices();
+        $stream = new PopularNoticeStream($this->viewer);
+        return $stream->getNotices(0, NOTICES_PER_SECTION + 1);
     }
 
     function title()
@@ -69,6 +72,12 @@ class PopularNoticeSection extends NoticeSection
 
     function moreUrl()
     {
-        return common_local_url('favorited');
+        if (common_config('singleuser', 'enabled')) {
+            $user = User::singleUser();
+            common_local_url('showfavorites', array('nickname' =>
+                                                    $user->nickname));
+        } else {
+            return common_local_url('favorited');
+        }
     }
 }