X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapilistmemberships.php;h=c1aa017deab1d1c35ada2db868df4210ff264092;hb=d6b28c64830f632bb2f4b6f3c9369b9e56ad217a;hp=635f970e871fb717e9d00b17942f7f968de21ff0;hpb=ad86eb78d3dc395b438d1543a36eca509f53e9d4;p=quix0rs-gnu-social.git diff --git a/actions/apilistmemberships.php b/actions/apilistmemberships.php index 635f970e87..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) @@ -43,7 +41,6 @@ require_once INSTALLDIR . '/lib/apibareauth.php'; * @link http://status.net/ * @see ApiBareAuthAction */ - class ApiListMembershipsAction extends ApiBareAuthAction { var $lists = array(); @@ -60,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)) { - $this->clientError(_('No such user.'), 404, $this->format); - return; + 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->target = $user->getProfile(); $this->getLists(); @@ -83,14 +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': @@ -100,12 +94,8 @@ class ApiListMembershipsAction extends ApiBareAuthAction $this->showJsonLists($this->lists, $this->next_cursor, $this->prev_cursor); break; default: - $this->clientError( - _('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.')); } } @@ -118,15 +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