X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapigroupmembership.php;h=939d22d757fb5a2f2c19939bc1dd903352f30144;hb=20ca5027ccb30f094bc87189ef19ecdb59156137;hp=d221a64183473c086f9c14ede6a35fe122a905af;hpb=d9cde0ef80ee838a99035d44f0286b3cc902e332;p=quix0rs-gnu-social.git diff --git a/actions/apigroupmembership.php b/actions/apigroupmembership.php index d221a64183..939d22d757 100644 --- a/actions/apigroupmembership.php +++ b/actions/apigroupmembership.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/ */ @@ -48,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; @@ -60,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; @@ -82,7 +86,6 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction * * @return void */ - function handle($args) { parent::handle($args); @@ -98,7 +101,8 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction break; default: $this->clientError( - _('API method not found!'), + // TRANS: Client error displayed trying to execute an unknown API method showing group membership. + _('API method not found.'), 404, $this->format ); @@ -111,7 +115,6 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction * * @return array $profiles list of profiles */ - function getProfiles() { $profiles = array(); @@ -120,8 +123,7 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction ($this->page - 1) * $this->count, $this->count, $this->since_id, - $this->max_id, - $this->since + $this->max_id ); while ($profile->fetch()) { @@ -138,7 +140,6 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction * * @return boolean true */ - function isReadOnly($args) { return true; @@ -149,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)) { @@ -168,7 +168,6 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction * * @return string etag */ - function etag() { if (!empty($this->profiles) && (count($this->profiles) > 0)) { @@ -178,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), @@ -188,5 +188,4 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction return null; } - }