X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapigroupshow.php;h=471aa141f9c1684cfa814eddcfbe6e45a51b0e8c;hb=dd5721848f80f4126dc2794099ecae8c42c67e62;hp=95d6f95afa8a18be770d5d8a0d00225563638d16;hpb=420ae06faf033b799c677845045b50b259801dbd;p=quix0rs-gnu-social.git diff --git a/actions/apigroupshow.php b/actions/apigroupshow.php index 95d6f95afa..471aa141f9 100644 --- a/actions/apigroupshow.php +++ b/actions/apigroupshow.php @@ -26,6 +26,7 @@ * @author Jeffery To * @author Zach Copley * @copyright 2009 StatusNet, Inc. + * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ @@ -45,10 +46,10 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php'; * @author Evan Prodromou * @author Jeffery To * @author Zach Copley + * @author Michele * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class ApiGroupShowAction extends ApiPrivateAuthAction { var $group = null; @@ -59,15 +60,32 @@ class ApiGroupShowAction extends ApiPrivateAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - function prepare($args) { parent::prepare($args); $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( + // TRANS: Client error displayed when trying to show a group that could not be found. + _('Group not found.'), + 404, + $this->format + ); + } + return; + } + return true; } @@ -80,20 +98,10 @@ class ApiGroupShowAction extends ApiPrivateAuthAction * * @return void */ - function handle($args) { parent::handle($args); - if (empty($this->group)) { - $this->clientError( - _('Group not found!'), - 404, - $this->format - ); - return; - } - switch($this->format) { case 'xml': $this->showSingleXmlGroup($this->group); @@ -102,10 +110,10 @@ class ApiGroupShowAction extends ApiPrivateAuthAction $this->showSingleJsonGroup($this->group); break; default: + // TRANS: Client error displayed trying to execute an unknown API method showing a group. $this->clientError(_('API method not found.'), 404, $this->format); break; } - } /** @@ -113,7 +121,6 @@ class ApiGroupShowAction extends ApiPrivateAuthAction * * @return string datestamp of the latest notice in the stream */ - function lastModified() { if (!empty($this->group)) { @@ -131,7 +138,6 @@ class ApiGroupShowAction extends ApiPrivateAuthAction * * @return string etag */ - function etag() { if (!empty($this->group)) { @@ -139,6 +145,7 @@ class ApiGroupShowAction extends ApiPrivateAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), $this->group->id, strtotime($this->group->modified)) @@ -158,10 +165,8 @@ class ApiGroupShowAction extends ApiPrivateAuthAction * * @return boolean is read only action? */ - function isReadOnly($args) { return true; } - }