From b9ac6ec263630abd3ac025fc000a52250e44c658 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Mon, 23 Mar 2015 18:35:51 +0100 Subject: Allow help plugin to append a link to the error page for more information about CSRF protection --- plugins/help/help.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'plugins/help/help.php') diff --git a/plugins/help/help.php b/plugins/help/help.php index d71cd0ec6..5387c9f35 100644 --- a/plugins/help/help.php +++ b/plugins/help/help.php @@ -34,6 +34,7 @@ class help extends rcube_plugin $this->register_action('license', array($this, 'action')); $this->add_hook('startup', array($this, 'startup')); + $this->add_hook('error_page', array($this, 'error_page')); } function startup($args) @@ -140,6 +141,16 @@ class help extends rcube_plugin return $rcmail->output->frame($attrib); } + function error_page($args) + { + $rcmail = rcmail::get_instance(); + + if ($args['code'] == 403 && $rcmail->request_status == rcube::REQUEST_ERROR_URL && ($url = $rcmail->config->get('help_csrf_info'))) { + $args['text'] .= '

' . html::a(array('href' => $url, 'target' => '_blank'), $this->gettext('csrfinfo')) . '

'; + } + + return $args; + } private function resolve_language($path) { -- cgit v1.2.3