X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fpluginenable.php;h=711b1b2c56d273149f65c50c87651307d625082a;hb=77d780a59e45701839f77a7d15996c90a07b2bd5;hp=2dbb3e3956ce0cff6e711b19a7faf8beaca365cc;hpb=8ff45823bad2d2464be69c0f25162c3238f8f518;p=quix0rs-gnu-social.git diff --git a/actions/pluginenable.php b/actions/pluginenable.php index 2dbb3e3956..711b1b2c56 100644 --- a/actions/pluginenable.php +++ b/actions/pluginenable.php @@ -52,7 +52,6 @@ if (!defined('STATUSNET')) { * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3 * @link http://status.net/ */ - class PluginEnableAction extends Action { var $user; @@ -65,8 +64,7 @@ class PluginEnableAction extends Action * * @return boolean success flag */ - - function prepare($args) + function prepare(array $args=array()) { parent::prepare($args); @@ -75,8 +73,9 @@ class PluginEnableAction extends Action // Only allow POST requests if ($_SERVER['REQUEST_METHOD'] != 'POST') { + // TRANS: Client error displayed when trying to use another method than POST. + // TRANS: Do not translate POST. $this->clientError(_('This action only accepts POST requests.')); - return false; } // CSRF protection @@ -84,9 +83,9 @@ class PluginEnableAction extends Action $token = $this->trimmed('token'); if (!$token || $token != common_session_token()) { + // TRANS: Client error displayed when the session token does not match or is not given. $this->clientError(_('There was a problem with your session token.'. ' Try again, please.')); - return false; } // Only for logged-in users @@ -94,20 +93,20 @@ class PluginEnableAction extends Action $this->user = common_current_user(); if (empty($this->user)) { + // TRANS: Error message displayed when trying to perform an action that requires a logged in user. $this->clientError(_('Not logged in.')); - return false; } if (!AdminPanelAction::canAdmin('plugins')) { + // TRANS: Client error displayed when trying to enable or disable a plugin without access rights. $this->clientError(_('You cannot administer plugins.')); - return false; } $this->plugin = $this->arg('plugin'); $defaultPlugins = common_config('plugins', 'default'); if (!array_key_exists($this->plugin, $defaultPlugins)) { + // TRANS: Client error displayed when trying to enable or disable a non-existing plugin. $this->clientError(_('No such plugin.')); - return false; } return true; @@ -122,8 +121,7 @@ class PluginEnableAction extends Action * * @return void */ - - function handle($args) + function handle(array $args=array()) { $key = 'disable-' . $this->plugin; Config::save('plugins', $key, $this->overrideValue()); @@ -138,7 +136,7 @@ class PluginEnableAction extends Action $form = $this->successNextForm(); $form->show(); $this->elementEnd('body'); - $this->elementEnd('html'); + $this->endHTML(); } else { $url = common_local_url('pluginsadminpanel'); common_redirect($url, 303);