X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapilist.php;h=dc909e62a603bceca70929918ef3f7320997172f;hb=bdd15cfe6340df9fd387e817352bea5f16655d0a;hp=90cbfddb6984a9ad500dee70401caa57fc59bf3b;hpb=cb183359e23ae7a5cfb483fa06c6c4b7a8b05fff;p=quix0rs-gnu-social.git diff --git a/actions/apilist.php b/actions/apilist.php index 90cbfddb69..dc909e62a6 100644 --- a/actions/apilist.php +++ b/actions/apilist.php @@ -30,8 +30,6 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR . '/lib/apibareauth.php'; - class ApiListAction extends ApiBareAuthAction { /** @@ -61,7 +59,7 @@ class ApiListAction extends ApiBareAuthAction * * @return boolean success flag */ - function prepare($args) + protected function prepare(array $args=array()) { parent::prepare($args); @@ -78,8 +76,7 @@ class ApiListAction extends ApiBareAuthAction 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; @@ -90,9 +87,9 @@ class ApiListAction extends ApiBareAuthAction * * @return boolean success flag */ - function handle($args) + protected function handle() { - parent::handle($args); + parent::handle(); if($this->delete) { $this->handleDelete(); @@ -112,13 +109,8 @@ class ApiListAction extends ApiBareAuthAction $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); } } @@ -140,12 +132,8 @@ class ApiListAction extends ApiBareAuthAction 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); @@ -156,12 +144,8 @@ class ApiListAction extends ApiBareAuthAction $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) { @@ -172,13 +156,8 @@ class ApiListAction extends ApiBareAuthAction $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); } } @@ -190,12 +169,8 @@ class ApiListAction extends ApiBareAuthAction 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); @@ -209,13 +184,8 @@ class ApiListAction extends ApiBareAuthAction $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); } }