X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapigroupmembership.php;h=7ad8fb767ec5731c24a3ed8a1b0b9a3f37d518a9;hb=0e439117a75698629c5066d0241ab41dc07b5ee1;hp=ffd5c7c7d572ca0226ee9723026362475f839d80;hpb=cd29d3d646379aa9a1352035973c8e379cc7f42b;p=quix0rs-gnu-social.git diff --git a/actions/apigroupmembership.php b/actions/apigroupmembership.php index ffd5c7c7d5..7ad8fb767e 100644 --- a/actions/apigroupmembership.php +++ b/actions/apigroupmembership.php @@ -49,7 +49,6 @@ require_once INSTALLDIR . '/lib/apiprivateauth.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class ApiGroupMembershipAction extends ApiPrivateAuthAction { var $group = null; @@ -61,14 +60,18 @@ class ApiGroupMembershipAction 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)) { + // TRANS: Client error displayed trying to show group membership on a non-existing group. + $this->clientError(_('Group not found.'), 404, $this->format); + return false; + } + $this->profiles = $this->getProfiles(); return true; @@ -83,16 +86,10 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction * * @return void */ - function handle($args) { parent::handle($args); - if (empty($this->group)) { - $this->clientError(_('Group not found.'), 404, $this->format); - return false; - } - // XXX: RSS and Atom switch($this->format) { @@ -104,6 +101,7 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction break; default: $this->clientError( + // TRANS: Client error displayed when coming across a non-supported API method. _('API method not found.'), 404, $this->format @@ -117,7 +115,6 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction * * @return array $profiles list of profiles */ - function getProfiles() { $profiles = array(); @@ -143,7 +140,6 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction * * @return boolean true */ - function isReadOnly($args) { return true; @@ -154,7 +150,6 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction * * @return string datestamp of the lastest profile in the group */ - function lastModified() { if (!empty($this->profiles) && (count($this->profiles) > 0)) { @@ -173,7 +168,6 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction * * @return string etag */ - function etag() { if (!empty($this->profiles) && (count($this->profiles) > 0)) { @@ -183,6 +177,7 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction return '"' . implode( ':', array($this->arg('action'), + common_user_cache_hash($this->auth_user), common_language(), $this->group->id, strtotime($this->profiles[0]->created), @@ -193,5 +188,4 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction return null; } - }