X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapilistmemberships.php;h=c1aa017deab1d1c35ada2db868df4210ff264092;hb=6ae8633904ffab0fdadd5fe3b2de2f505117c56f;hp=3d235c5d9379746cd13cd083a0b79c7892ff7efc;hpb=9948523c33ea0d02681ff1e0cd4fcb839dc9df96;p=quix0rs-gnu-social.git diff --git a/actions/apilistmemberships.php b/actions/apilistmemberships.php index 3d235c5d93..c1aa017dea 100644 --- a/actions/apilistmemberships.php +++ b/actions/apilistmemberships.php @@ -30,8 +30,6 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR . '/lib/apibareauth.php'; - /** * Action handler for API method to list lists a user belongs to. * (people tags for a user) @@ -59,18 +57,18 @@ class ApiListMembershipsAction extends ApiBareAuthAction * @return boolean success flag * */ - function prepare($args) + protected function prepare(array $args=array()) { parent::prepare($args); $this->cursor = (int) $this->arg('cursor', -1); - $this->user = $this->getTargetUser($this->arg('user')); + $user = $this->getTargetUser($this->arg('user')); - if (empty($this->user)) { + if (!($user instanceof User)) { // TRANS: Client error displayed trying to perform an action related to a non-existing user. - $this->clientError(_('No such user.'), 404, $this->format); - return; + $this->clientError(_('No such user.'), 404); } + $this->target = $user->getProfile(); $this->getLists(); @@ -82,13 +80,11 @@ class ApiListMembershipsAction extends ApiBareAuthAction * * Show the lists * - * @param array $args $_REQUEST data (unused) - * * @return void */ - function handle($args) + protected function handle() { - parent::handle($args); + parent::handle(); switch($this->format) { case 'xml': @@ -98,13 +94,8 @@ class ApiListMembershipsAction extends ApiBareAuthAction $this->showJsonLists($this->lists, $this->next_cursor, $this->prev_cursor); break; default: - $this->clientError( - // TRANS: Client error displayed when coming across a non-supported API method. - _('API method not found.'), - 400, - $this->format - ); - break; + // TRANS: Client error displayed when coming across a non-supported API method. + $this->clientError(_('API method not found.')); } } @@ -117,14 +108,14 @@ class ApiListMembershipsAction extends ApiBareAuthAction * * @return boolean is read only action? */ - function isReadOnly($args) + function isReadOnly(array $args=array()) { return true; } function getLists() { - $profile = $this->user->getProfile(); + $profile = $this->target; $fn = array($profile, 'getOtherTags'); # 20 lists