diff --git a/src/Config/config.security.php b/src/Config/config.security.php index 45f0d88..d35bfd1 100644 --- a/src/Config/config.security.php +++ b/src/Config/config.security.php @@ -47,8 +47,8 @@ return array( | 'csrf_exclude_uris' = Array of URIs which ignore CSRF checks */ 'csrf_protection' => true, - 'csrf_token_name' => 'csrf_test_name', - 'csrf_cookie_name' => 'csrf_cookie_name', + 'csrf_token_name' => 'fw_csrf_token', + 'csrf_cookie_name' => 'fw_csrf_cookie', 'csrf_expire' => 7200, 'csrf_regenerate' => TRUE, 'csrf_exclude_uris' => array(), diff --git a/src/FuzeWorks/Factory.php b/src/FuzeWorks/Factory.php index 5c013ae..e45e126 100644 --- a/src/FuzeWorks/Factory.php +++ b/src/FuzeWorks/Factory.php @@ -183,9 +183,9 @@ class Factory $this->language = new Language(); $this->utf8 = new Utf8(); $this->uri = new URI(); + $this->output = new Output(); $this->security = new Security(); $this->input = new Input(); - $this->output = new Output(); $this->router = new Router(); return true; diff --git a/src/FuzeWorks/Layout.php b/src/FuzeWorks/Layout.php index 5e1c1b1..b8d1aa0 100644 --- a/src/FuzeWorks/Layout.php +++ b/src/FuzeWorks/Layout.php @@ -166,6 +166,8 @@ class Layout $this->assigned_variables['serverName'] = $main_config->server_name; $this->assigned_variables['adminMail'] = $main_config->administrator_mail; $this->assigned_variables['contact'] = $contact_config->toArray(); + $this->assigned_variables['csrfTokenName'] = Factory::getInstance()->security->get_csrf_token_name(); + $this->assigned_variables['csrfHash'] = Factory::getInstance()->security->get_csrf_hash(); // Select an engine if one is not already selected if (is_null($this->current_engine)) { diff --git a/src/FuzeWorks/Logger.php b/src/FuzeWorks/Logger.php index 1d55f18..ee2f2ac 100644 --- a/src/FuzeWorks/Logger.php +++ b/src/FuzeWorks/Logger.php @@ -478,10 +478,11 @@ class Logger { /** * Calls an HTTP error, sends it as a header, and loads a template if required to do so. * - * @param int $errno HTTP error code - * @param bool $layout true to layout error on website + * @param int $errno HTTP error code + * @param string $message Additional message to the error + * @param bool $layout true to layout error on website */ - public static function http_error($errno = 500, $layout = true): bool + public static function http_error($errno = 500, $message = '', $layout = true): bool { $http_codes = array( 400 => 'Bad Request', @@ -536,10 +537,11 @@ class Logger { $factory = Factory::getInstance(); try { $factory->layout->reset(); + $factory->layout->assign('errorMessage', $message); $factory->layout->display($layout); } catch (LayoutException $exception) { // No error page could be found, just echo the result - $factory->output->set_output("