exit(1);
}
-require_once INSTALLDIR . '/lib/apibareauth.php';
-
class ApiListAction extends ApiBareAuthAction
{
/**
*
* @return boolean success flag
*/
- function prepare($args)
+ protected function prepare(array $args=array())
{
parent::prepare($args);
if (empty($this->list)) {
// TRANS: Client error displayed when referring to a non-existing list.
- $this->clientError(_('List not found.'), 404, $this->format);
- return false;
+ $this->clientError(_('List not found.'), 404);
}
return true;
*
* @return boolean success flag
*/
- function handle($args)
+ protected function handle()
{
- parent::handle($args);
+ parent::handle();
if($this->delete) {
$this->handleDelete();
$this->showSingleJsonList($this->list);
break;
default:
- $this->clientError(
- // TRANS: Client error displayed when coming across a non-supported API method.
- _('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);
}
}
function handlePut()
{
if($this->auth_user->id != $this->list->tagger) {
- $this->clientError(
- // TRANS: Client error displayed when trying to update another user's list.
- _('You cannot update lists that do not belong to you.'),
- 401,
- $this->format
- );
+ // TRANS: Client error displayed when trying to update another user's list.
+ $this->clientError(_('You cannot update lists that do not belong to you.'), 401);
}
$new_list = clone($this->list);
$result = $new_list->update($this->list);
if(!$result) {
- $this->clientError(
- // TRANS: Client error displayed when an unknown error occurs updating a list.
- _('An error occured.'),
- 503,
- $this->format
- );
+ // TRANS: Client error displayed when an unknown error occurs updating a list.
+ $this->clientError(_('An error occured.'), 503);
}
switch($this->format) {
$this->showSingleJsonList($new_list);
break;
default:
- $this->clientError(
- // TRANS: Client error displayed when coming across a non-supported API method.
- _('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);
}
}
function handleDelete()
{
if($this->auth_user->id != $this->list->tagger) {
- $this->clientError(
- // TRANS: Client error displayed when trying to delete another user's list.
- _('You cannot delete lists that do not belong to you.'),
- 401,
- $this->format
- );
+ // TRANS: Client error displayed when trying to delete another user's list.
+ $this->clientError(_('You cannot delete lists that do not belong to you.'), 401);
}
$record = clone($this->list);
$this->showSingleJsonList($record);
break;
default:
- $this->clientError(
- // TRANS: Client error displayed when coming across a non-supported API method.
- _('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 boolean is_read-only=false
*/
- function isReadOnly($args)
+ function isReadOnly(array $args=array())
{
return false;
}