X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapigroupmembership.php;h=0e01f92f001dd1db76da5874b4feedba0bdb41f7;hb=3251ef3b518ef9db55fbab0693d8b0f654dcda58;hp=b7f3064b5ad8490fbb3ceaa5e9dd304cef0311ce;hpb=99194e03fa50b61f99164674afc949b4bbefd44a;p=quix0rs-gnu-social.git diff --git a/actions/apigroupmembership.php b/actions/apigroupmembership.php index b7f3064b5a..0e01f92f00 100644 --- a/actions/apigroupmembership.php +++ b/actions/apigroupmembership.php @@ -35,8 +35,6 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR . '/lib/apiprivateauth.php'; - /** * List 20 newest members of the group specified by name or ID. * @@ -49,7 +47,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 +58,17 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - - function prepare($args) + protected function prepare(array $args=array()) { 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->profiles = $this->getProfiles(); return true; @@ -79,19 +79,11 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction * * Show the members of the group * - * @param array $args $_REQUEST data (unused) - * * @return void */ - - function handle($args) + protected function handle() { - parent::handle($args); - - if (empty($this->group)) { - $this->clientError(_('Group not found.'), 404, $this->format); - return false; - } + parent::handle(); // XXX: RSS and Atom @@ -103,12 +95,8 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction $this->showJsonUsers($this->profiles); break; default: - $this->clientError( - _('API method not found.'), - 404, - $this->format - ); - break; + // TRANS: Client error displayed when coming across a non-supported API method. + $this->clientError(_('API method not found.'), 404); } } @@ -117,7 +105,6 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction * * @return array $profiles list of profiles */ - function getProfiles() { $profiles = array(); @@ -143,7 +130,6 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction * * @return boolean true */ - function isReadOnly($args) { return true; @@ -154,7 +140,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 +158,6 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction * * @return string etag */ - function etag() { if (!empty($this->profiles) && (count($this->profiles) > 0)) { @@ -194,5 +178,4 @@ class ApiGroupMembershipAction extends ApiPrivateAuthAction return null; } - }