isCsrfValidationException example

if ($this->Request()->isXmlHttpRequest() || !$this->container->initialized('db')) {
            $this->View()->loadTemplate($templateModule . '/error/exception.tpl');
        } elseif (isset($_ENV['SHELL']) || PHP_SAPI === 'cli') {
            $this->View()->loadTemplate($templateModule . '/error/cli.tpl');
        } elseif (empty($_SERVER['SERVER_NAME'])) {
            $this->View()->loadTemplate($templateModule . '/error/ajax.tpl');
        } else {
            $this->View()->loadTemplate($templateModule . '/error/index.tpl');
        }

        if ($this->isCsrfValidationException()) {
            $backUrl = htmlspecialchars($_SERVER['HTTP_REFERER']);
            if (!empty($backUrl)) {
                $this->View()->assign('backUrl', $backUrl);
            }
            $this->View()->assign('isCsrfException', 'true');
        }
    }

    /** * Controller action that handles all error rendering * either by itself or by delegating specific scenarios to other actions * * @return void */
Home | Imprint | This part of the site doesn't use cookies.