exit(1);
}
-require_once INSTALLDIR . '/lib/apibareauth.php';
-
/**
* Action handler for API method to list lists a user belongs to.
* (people tags for a user)
* @return boolean success flag
*
*/
- function prepare($args)
+ protected function prepare(array $args=array())
{
parent::prepare($args);
$this->cursor = (int) $this->arg('cursor', -1);
- $this->user = $this->getTargetUser($this->arg('user'));
+ $user = $this->getTargetUser($this->arg('user'));
- if (empty($this->user)) {
+ if (!($user instanceof User)) {
// TRANS: Client error displayed trying to perform an action related to a non-existing user.
- $this->clientError(_('No such user.'), 404, $this->format);
- return;
+ $this->clientError(_('No such user.'), 404);
}
+ $this->target = $user->getProfile();
$this->getLists();
*
* Show the lists
*
- * @param array $args $_REQUEST data (unused)
- *
* @return void
*/
- function handle($args)
+ protected function handle()
{
- parent::handle($args);
+ parent::handle();
switch($this->format) {
case 'xml':
$this->showJsonLists($this->lists, $this->next_cursor, $this->prev_cursor);
break;
default:
- $this->clientError(
- // TRANS: Client error displayed when coming across a non-supported API method.
- _('API method not found.'),
- 400,
- $this->format
- );
- break;
+ // TRANS: Client error displayed when coming across a non-supported API method.
+ $this->clientError(_('API method not found.'));
}
}
*
* @return boolean is read only action?
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return true;
}
function getLists()
{
- $profile = $this->user->getProfile();
+ $profile = $this->target;
$fn = array($profile, 'getOtherTags');
# 20 lists