Allow help plugin to append a link to the error page for more information about CSRF protection
| | |
| | | // Determine whether to open the help in a new window |
| | | $config['help_open_extwin'] = false; |
| | | |
| | | // URL to additional information about CSRF protection |
| | | $config['help_csrf_info'] = null; |
| | |
| | | $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) |
| | |
| | | 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'] .= '<p>' . html::a(array('href' => $url, 'target' => '_blank'), $this->gettext('csrfinfo')) . '</p>'; |
| | | } |
| | | |
| | | return $args; |
| | | } |
| | | |
| | | private function resolve_language($path) |
| | | { |
| | |
| | | $labels['help'] = 'Help'; |
| | | $labels['about'] = 'About'; |
| | | $labels['license'] = 'License'; |
| | | $labels['csrfinfo'] = 'Read more about CSRF and how we protect you'; |
| | | |
| | | ?> |