X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapilistmember.php;h=92cbc9a3d291c27c2ad1acaeaa4db07ddf96e8c5;hb=ad3b62cf2f857d53113692f5a12adce616f17829;hp=8e6a84c96d16167b426d373914d9f0cfedebf727;hpb=12588b1cf73fad7d0a76a29a46ec355150eaa54e;p=quix0rs-gnu-social.git diff --git a/actions/apilistmember.php b/actions/apilistmember.php index 8e6a84c96d..92cbc9a3d2 100644 --- a/actions/apilistmember.php +++ b/actions/apilistmember.php @@ -30,8 +30,6 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR . '/lib/apibareauth.php'; - /** * Action handler for Twitter list_memeber methods * @@ -58,23 +56,21 @@ class ApiListMemberAction extends ApiBareAuthAction * * @return boolean success flag */ - function prepare($args) + protected function prepare(array $args=array()) { parent::prepare($args); - $this->user = $this->getTargetUser($this->arg('id')); + $this->target = $this->getTargetProfile($this->arg('id')); $this->list = $this->getTargetList($this->arg('user'), $this->arg('list_id')); if (empty($this->list)) { // TRANS: Client error displayed when referring to a non-existing list. - $this->clientError(_('List not found.'), 404, $this->format); - return false; + $this->clientError(_('List not found.'), 404); } - if (empty($this->user)) { + if (!($this->target instanceof Profile)) { // TRANS: Client error displayed when referring to a non-existing user. - $this->clientError(_('No such user.'), 404, $this->format); - return false; + $this->clientError(_('No such user.'), 404); } return true; } @@ -84,25 +80,21 @@ class ApiListMemberAction extends ApiBareAuthAction * * @return boolean success flag */ - function handle($args) + protected function handle() { - parent::handle($args); + parent::handle(); $arr = array('tagger' => $this->list->tagger, 'tag' => $this->list->tag, - 'tagged' => $this->user->id); + 'tagged' => $this->target->id); $ptag = Profile_tag::pkeyGet($arr); if(empty($ptag)) { - $this->clientError( - // TRANS: Client error displayed when referring to a non-list member. - _('The specified user is not a member of this list.'), - 400, - $this->format - ); + // TRANS: Client error displayed when referring to a non-list member. + $this->clientError(_('The specified user is not a member of this list.')); } - $user = $this->twitterUserArray($this->user->getProfile(), true); + $user = $this->twitterUserArray($this->target, true); switch($this->format) { case 'xml': @@ -112,13 +104,8 @@ class ApiListMemberAction extends ApiBareAuthAction $this->showSingleJsonUser($user); break; default: - $this->clientError( - // TRANS: Client error displayed when coming across a non-supported API method. - _('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); } return true; }