diff options
author | Zach Copley <zach@status.net> | 2010-01-21 11:37:20 -0800 |
---|---|---|
committer | Zach Copley <zach@status.net> | 2010-01-21 11:37:20 -0800 |
commit | 308442407ee7814a7691a4d364068b995b28aef3 (patch) | |
tree | 71a43d6aaa57aa0d1350173e0a470ceead1c4e73 /actions | |
parent | 383703d170c59baf0cae32b612e04b4d292d1880 (diff) |
- Moved checking for group aliases and redirection to prepare()
- phpcs cleanup
- add @macno to the list of authors
Diffstat (limited to 'actions')
-rw-r--r-- | actions/apigroupshow.php | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/actions/apigroupshow.php b/actions/apigroupshow.php index 852428144..ef9cbf0e7 100644 --- a/actions/apigroupshow.php +++ b/actions/apigroupshow.php @@ -45,6 +45,7 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php'; * @author Evan Prodromou <evan@status.net> * @author Jeffery To <jeffery.to@gmail.com> * @author Zach Copley <zach@status.net> + * @author Michele <macno@macno.org> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ @@ -68,6 +69,24 @@ class ApiGroupShowAction extends ApiPrivateAuthAction $this->group = $this->getTargetGroup($this->arg('id')); + if (empty($this->group)) { + $alias = Group_alias::staticGet( + 'alias', + common_canonical_nickname($this->arg('id')) + ); + if (!empty($alias)) { + $args = array('id' => $alias->group_id, 'format' => $this->format); + common_redirect(common_local_url('ApiGroupShow', $args), 301); + } else { + $this->clientError( + _('Group not found!'), + 404, + $this->format + ); + } + return; + } + return true; } @@ -85,21 +104,6 @@ class ApiGroupShowAction extends ApiPrivateAuthAction { parent::handle($args); - if (!$this->group) { - $alias = Group_alias::staticGet('alias', common_canonical_nickname($this->arg('id'))); - if ($alias) { - $args = array('id' => $alias->group_id, 'format'=>$this->format); - common_redirect(common_local_url('ApiGroupShow', $args), 301); - } else { - $this->clientError( - _('Group not found!'), - 404, - $this->format - ); - } - return; - } - switch($this->format) { case 'xml': $this->showSingleXmlGroup($this->group); @@ -111,7 +115,6 @@ class ApiGroupShowAction extends ApiPrivateAuthAction $this->clientError(_('API method not found.'), 404, $this->format); break; } - } /** |