X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapilistmemberships.php;h=bf7f0e84d81a4e72a288f448ab06de45d95adfde;hb=2c5460eb0e140655c30639c5bc909ddb80732a91;hp=3d235c5d9379746cd13cd083a0b79c7892ff7efc;hpb=59043dca7fb6f974b11797c4d0f20e5b78b0611d;p=quix0rs-gnu-social.git diff --git a/actions/apilistmemberships.php b/actions/apilistmemberships.php index 3d235c5d93..bf7f0e84d8 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.')); } } @@ -124,11 +115,10 @@ class ApiListMembershipsAction extends ApiBareAuthAction function getLists() { - $profile = $this->user->getProfile(); - $fn = array($profile, 'getOtherTags'); + $fn = array($this->target, 'getOtherTags'); # 20 lists list($this->lists, $this->next_cursor, $this->prev_cursor) = - Profile_list::getAtCursor($fn, array($this->auth_user), $this->cursor, 20); + Profile_list::getAtCursor($fn, array($this->scoped), $this->cursor, 20); } }