X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fapiblockdestroy.php;h=d5b291397083747ad8873d768633c9d8ffa3c946;hb=c04c91bb8974671ee093f444b3d180993bc4987c;hp=7ea201677e677fe2c2e0373153bc9a752db3ef7c;hpb=841da543015ec4f0e2efa143162c10a4398bc4d7;p=quix0rs-gnu-social.git diff --git a/actions/apiblockdestroy.php b/actions/apiblockdestroy.php index 7ea201677e..d5b2913970 100644 --- a/actions/apiblockdestroy.php +++ b/actions/apiblockdestroy.php @@ -32,8 +32,6 @@ if (!defined('STATUSNET')) { exit(1); } -require_once INSTALLDIR . '/lib/apiauth.php'; - /** * Un-blocks the user specified in the ID parameter for the authenticating user. * Returns the un-blocked user in the requested format when successful. @@ -45,9 +43,10 @@ require_once INSTALLDIR . '/lib/apiauth.php'; * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 * @link http://status.net/ */ - class ApiBlockDestroyAction extends ApiAuthAction { + protected $needPost = true; + var $other = null; /** @@ -56,14 +55,11 @@ class ApiBlockDestroyAction extends ApiAuthAction * @param array $args $_REQUEST args * * @return boolean success flag - * */ - - function prepare($args) + protected function prepare(array $args=array()) { parent::prepare($args); - $this->user = $this->auth_user; $this->other = $this->getTargetProfile($this->arg('id')); return true; @@ -74,27 +70,15 @@ class ApiBlockDestroyAction extends ApiAuthAction * * Save the new message * - * @param array $args $_REQUEST data (unused) - * * @return void */ - - function handle($args) + protected function handle() { - parent::handle($args); - - if ($_SERVER['REQUEST_METHOD'] != 'POST') { - $this->clientError( - _('This method requires a POST.'), - 400, - $this->format - ); - return; - } + parent::handle(); if (empty($this->user) || empty($this->other)) { - $this->clientError(_('No such user.'), 404, $this->format); - return; + // TRANS: Client error when user not found for an API action to remove a block for a user. + $this->clientError(_('No such user.'), 404); } if ($this->user->hasBlocked($this->other)) { @@ -111,10 +95,8 @@ class ApiBlockDestroyAction extends ApiAuthAction $this->showProfile($this->other, $this->format); $this->endDocument($this->format); } else { + // TRANS: Server error displayed when unblocking a user has failed. $this->serverError(_('Unblock user failed.')); } - } - } -