]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/peopletagsbyuser.php
Added type-hints for StartInitializeRouter hooks.
[quix0rs-gnu-social.git] / actions / peopletagsbyuser.php
index 62c956ff931e5a0ef6bef9172bb55f5a971355ec..7a78a9fe8ff1ee5d3958b285d0a63189fdd5eb83 100644 (file)
@@ -22,7 +22,7 @@
  * @category  Personal
  * @package   StatusNet
  * @author    Shashi Gowda <connect2shashi@gmail.com>
- * @copyright 2008-2009 StatusNet, Inc.
+ * @copyright 2008-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/
  */
@@ -33,13 +33,13 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
 
 require_once INSTALLDIR.'/lib/peopletaglist.php';
 
-class PeopletagsbyuserAction extends OwnerDesignAction
+class PeopletagsbyuserAction extends Action
 {
     var $page = null;
     var $tagger = null;
     var $tags = null;
 
-    function isReadOnly($args)
+    function isReadOnly(array $args=array())
     {
         return true;
     }
@@ -68,7 +68,7 @@ class PeopletagsbyuserAction extends OwnerDesignAction
         }
     }
 
-    function prepare($args)
+    function prepare(array $args=array())
     {
         parent::prepare($args);
 
@@ -76,7 +76,12 @@ class PeopletagsbyuserAction extends OwnerDesignAction
             $this->args['public'] = $this->args['private'] = false;
         }
 
-        $nickname_arg = $this->arg('nickname');
+        if (common_config('singleuser', 'enabled')) {
+            $nickname_arg = User::singleUserNickname();
+        } else {
+            $nickname_arg = $this->arg('nickname');
+        }
+
         $nickname = common_canonical_nickname($nickname_arg);
 
         // Permanent redirect on non-canonical nickname
@@ -87,23 +92,20 @@ class PeopletagsbyuserAction extends OwnerDesignAction
                 $args['page'] = $this->arg['page'];
             }
             common_redirect(common_local_url('peopletagsbyuser', $args), 301);
-            return false;
         }
 
-        $this->user = User::staticGet('nickname', $nickname);
+        $this->user = User::getKV('nickname', $nickname);
 
         if (!$this->user) {
             // TRANS: Client error displayed trying to perform an action related to a non-existing user.
             $this->clientError(_('No such user.'), 404);
-            return false;
         }
 
         $this->tagger = $this->user->getProfile();
 
         if (!$this->tagger) {
-            // TRANS: Server error displayed when a user has no profile.
+            // TRANS: Error message displayed when referring to a user without a profile.
             $this->serverError(_('User has no profile.'));
-            return false;
         }
 
         $this->page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
@@ -114,7 +116,7 @@ class PeopletagsbyuserAction extends OwnerDesignAction
 
         $user = common_current_user();
         if ($this->arg('public')) {
-            $this->tags = $this->tagger->getLists(false, $offset, $limit);
+            $this->tags = $this->tagger->getLists(null, $offset, $limit);
         } else if ($this->arg('private')) {
             if (empty($user)) {
                 // TRANS: Error message displayed when trying to perform an action that requires a logged in user.
@@ -128,21 +130,20 @@ class PeopletagsbyuserAction extends OwnerDesignAction
                 $this->clientError(_('You cannot view others\' private lists'), 403);
             }
         } else {
-            $this->tags = $this->tagger->getLists(common_current_user(), $offset, $limit);
+            $this->tags = $this->tagger->getLists($this->scoped, $offset, $limit);
         }
         return true;
     }
 
-    function handle($args)
+    function handle(array $args=array())
     {
         parent::handle($args);
 
-               # Post from the tag dropdown; redirect to a GET
+        // Post from the tag dropdown; redirect to a GET
 
-               if ($_SERVER['REQUEST_METHOD'] == 'POST') {
-                   common_redirect(common_local_url('peopletagsbyuser', $this->getSelfUrlArgs()), 303);
-            return;
-               }
+        if ($_SERVER['REQUEST_METHOD'] == 'POST') {
+            common_redirect(common_local_url('peopletagsbyuser', $this->getSelfUrlArgs()), 303);
+        }
 
         $this->showPage();
     }
@@ -213,7 +214,7 @@ class PeopletagsbyuserAction extends OwnerDesignAction
                     '(http://en.wikipedia.org/wiki/Micro-blogging) service ' .
                     'based on the Free Software [StatusNet](http://status.net/) tool. ' .
                     'You can easily keep track of what they ' .
-                    'are doing by subscribing to the tag\'s timeline.' ), $this->tagger->nickname);
+                    'are doing by subscribing to the list\'s timeline.' ), $this->tagger->nickname);
         $this->elementStart('div', array('id' => 'anon_notice'));
         $this->raw(common_markup_to_html($notice));
         $this->elementEnd('div');