X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fsilence.php;h=dccaf70a37521ae57db85472761d93d5c5bb1b8f;hb=9e89a177c76741f7e696f09d778bd8b151f84d3f;hp=206e5ba878fcf797f30f51acef55b9d8e1d0dce5;hpb=6a1afda259c5223449f679a64f932e36df5ebe39;p=quix0rs-gnu-social.git diff --git a/actions/silence.php b/actions/silence.php index 206e5ba878..dccaf70a37 100644 --- a/actions/silence.php +++ b/actions/silence.php @@ -27,9 +27,7 @@ * @link http://status.net/ */ -if (!defined('STATUSNET')) { - exit(1); -} +if (!defined('GNUSOCIAL')) { exit(1); } /** * Silence a user. @@ -40,50 +38,13 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl.html AGPLv3 * @link http://status.net/ */ - class SilenceAction extends ProfileFormAction { - /** - * Check parameters - * - * @param array $args action arguments (URL, GET, POST) - * - * @return boolean success flag - */ - - function prepare($args) - { - if (!parent::prepare($args)) { - return false; - } - - $cur = common_current_user(); - - assert(!empty($cur)); // checked by parent - - if (!$cur->hasRight(Right::SILENCEUSER)) { - $this->clientError(_("You cannot silence users on this site.")); - return false; - } - - assert(!empty($this->profile)); // checked by parent - - if ($this->profile->isSilenced()) { - $this->clientError(_("User is already silenced.")); - return false; - } - - return true; - } - - /** - * Silence a user. - * - * @return void - */ - function handlePost() { - $this->profile->silence(); + assert($this->scoped instanceof Profile); + assert($this->profile instanceof Profile); + + $this->profile->silenceAs($this->scoped); } }