123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- <?php
- if (!defined('STATUSNET')) {
- exit(1);
- }
- class ApiListMembershipsAction extends ApiBareAuthAction
- {
- var $lists = array();
- var $cursor = -1;
- var $next_cursor = 0;
- var $prev_cursor = 0;
-
- protected function prepare(array $args=array())
- {
- parent::prepare($args);
- $this->cursor = (int) $this->arg('cursor', -1);
- $user = $this->getTargetUser($this->arg('user'));
- if (!($user instanceof User)) {
-
- $this->clientError(_('No such user.'), 404);
- }
- $this->target = $user->getProfile();
- $this->getLists();
- return true;
- }
-
- protected function handle()
- {
- parent::handle();
- switch($this->format) {
- case 'xml':
- $this->showXmlLists($this->lists, $this->next_cursor, $this->prev_cursor);
- break;
- case 'json':
- $this->showJsonLists($this->lists, $this->next_cursor, $this->prev_cursor);
- break;
- default:
-
- $this->clientError(_('API method not found.'));
- }
- }
-
- function isReadOnly($args)
- {
- return true;
- }
- function getLists()
- {
- $fn = array($this->target, 'getOtherTags');
-
- list($this->lists, $this->next_cursor, $this->prev_cursor) =
- Profile_list::getAtCursor($fn, array($this->scoped), $this->cursor, 20);
- }
- }
|