123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- <?php
- if (!defined('STATUSNET')) {
- exit(1);
- }
- class ApiListMemberAction extends ApiBareAuthAction
- {
-
- protected function prepare(array $args=array())
- {
- parent::prepare($args);
- $this->target = $this->getTargetProfile($this->arg('id'));
- $this->list = $this->getTargetList($this->arg('user'), $this->arg('list_id'));
- if (empty($this->list)) {
-
- $this->clientError(_('List not found.'), 404);
- }
- if (!($this->target instanceof Profile)) {
-
- $this->clientError(_('No such user.'), 404);
- }
- return true;
- }
-
- protected function handle()
- {
- parent::handle();
- $arr = array('tagger' => $this->list->tagger,
- 'tag' => $this->list->tag,
- 'tagged' => $this->target->id);
- $ptag = Profile_tag::pkeyGet($arr);
- if(empty($ptag)) {
-
- $this->clientError(_('The specified user is not a member of this list.'));
- }
- $user = $this->twitterUserArray($this->target, true);
- switch($this->format) {
- case 'xml':
- $this->showTwitterXmlUser($user, 'user', true);
- break;
- case 'json':
- $this->showSingleJsonUser($user);
- break;
- default:
-
- $this->clientError(_('API method not found.'), 404);
- }
- return true;
- }
- }
|