. * * @category API * @package StatusNet * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ if (!defined('STATUSNET')) { exit(1); } require_once INSTALLDIR . '/lib/apiauth.php'; class ApiListSubscriberAction extends ApiBareAuthAction { var $list = null; function prepare($args) { parent::prepare($args); $this->user = $this->getTargetUser($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; } if (empty($this->user)) { $this->clientError(_('No such user'), 404, $this->format); return false; } return true; } function handle($args) { parent::handle($args); $arr = array('profile_tag_id' => $this->list->id, 'profile_id' => $this->user->id); $sub = Profile_tag_subscription::pkeyGet($arr); if(empty($sub)) { $this->clientError( _('The specified user is not a subscriber of this list'), 400, $this->format ); } $user = $this->twitterUserArray($this->user->getProfile(), 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, $this->format ); break; } } }