]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/avatarbynickname.php
Merge branch 'master' of /var/www/trunk
[quix0rs-gnu-social.git] / actions / avatarbynickname.php
index 4aeb4112ae801749c0bff957242d7af5f71944a5..9bbdecefac8c9f498cda453dfeb4662cec276d17 100644 (file)
@@ -1,5 +1,16 @@
 <?php
-/*
+/**
+ * Retrieve user avatar by nickname action class.
+ *
+ * PHP version 5
+ *
+ * @category Action
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @author   Robin Millette <millette@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link     http://laconi.ca/
+ *
  * Laconica - a distributed open-source microblogging tool
  * Copyright (C) 2008, Controlez-Vous, Inc.
  *
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-if (!defined('LACONICA')) { exit(1); }
+if (!defined('LACONICA')) {
+    exit(1);
+}
 
-class AvatarbynicknameAction extends Action {
+/**
+ * Retrieve user avatar by nickname action class.
+ *
+ * @category Action
+ * @package  Laconica
+ * @author   Evan Prodromou <evan@controlyourself.ca>
+ * @author   Robin Millette <millette@controlyourself.ca>
+ * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
+ * @link     http://laconi.ca/
+ */
+class AvatarbynicknameAction extends Action
+{
+    /**
+     * Class handler.
+     *
+     * @param array $args query arguments
+     * 
+     * @return boolean false if nickname or user isn't found
+     */
     function handle($args)
     {
         parent::handle($args);
         $nickname = $this->trimmed('nickname');
         if (!$nickname) {
-            $this->client_error(_('No nickname.'));
+            $this->clientError(_('No nickname.'));
             return;
         }
         $size = $this->trimmed('size');
         if (!$size) {
-            $this->client_error(_('No size.'));
+            $this->clientError(_('No size.'));
             return;
         }
         $size = strtolower($size);
         if (!in_array($size, array('original', '96', '48', '24'))) {
-            $this->client_error(_('Invalid size.'));
+            $this->clientError(_('Invalid size.'));
             return;
         }
 
         $user = User::staticGet('nickname', $nickname);
         if (!$user) {
-            $this->client_error(_('No such user.'));
+            $this->clientError(_('No such user.'));
             return;
         }
         $profile = $user->getProfile();
         if (!$profile) {
-            $this->client_error(_('User has no profile.'));
+            $this->clientError(_('User has no profile.'));
             return;
         }
         if ($size == 'original') {
@@ -66,4 +97,10 @@ class AvatarbynicknameAction extends Action {
         }
         common_redirect($url, 302);
     }
+
+    function isReadOnly()
+    {
+        return true;
+    }
 }
+