X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapilistmember.php;h=92cbc9a3d291c27c2ad1acaeaa4db07ddf96e8c5;hb=c075b9f73068066897f2d42cdbcf1be1bf812380;hp=18d6ea370b73d7bdd90074331ee6da80cd06db72;hpb=e75c9988ebe33822e493ac225859bc593ff9b855;p=quix0rs-gnu-social.git diff --git a/actions/apilistmember.php b/actions/apilistmember.php index 18d6ea370b..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 * @@ -42,7 +40,6 @@ require_once INSTALLDIR . '/lib/apibareauth.php'; * @link http://status.net/ * @see ApiBareAuthAction */ - class ApiListMemberAction extends ApiBareAuthAction { /** @@ -59,22 +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)) { - $this->clientError(_('Not found'), 404, $this->format); - return false; + // TRANS: Client error displayed when referring to a non-existing list. + $this->clientError(_('List not found.'), 404); } - if (empty($this->user)) { - $this->clientError(_('No such user'), 404, $this->format); - return false; + if (!($this->target instanceof Profile)) { + // TRANS: Client error displayed when referring to a non-existing user. + $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( - _('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,12 +104,8 @@ class ApiListMemberAction extends ApiBareAuthAction $this->showSingleJsonUser($user); 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); } return true; }