diff options
-rw-r--r-- | 403.php | 16 | ||||
-rw-r--r-- | 404.php | 16 | ||||
-rw-r--r-- | core/namespace/Application.php | 14 |
3 files changed, 16 insertions, 30 deletions
@@ -2,19 +2,9 @@ #=============================================================================== # INCLUDE: Initialization #=============================================================================== -require_once 'core/application.php'; +require 'core/application.php'; #=============================================================================== -# Send HTTP status code +# Show "403 Forbidden" error page #=============================================================================== -http_response_code(403); - -#=============================================================================== -# Build document -#=============================================================================== -$MainTemplate = Template\Factory::build('main'); -$MainTemplate->set('NAME', '403 Forbidden'); -$MainTemplate->set('HEAD', ['NAME' => $MainTemplate->get('NAME')]); -$MainTemplate->set('HTML', Template\Factory::build('403')); - -echo $MainTemplate; +Application::error403(); @@ -2,19 +2,9 @@ #=============================================================================== # INCLUDE: Initialization #=============================================================================== -require_once 'core/application.php'; +require 'core/application.php'; #=============================================================================== -# Send HTTP status code +# Show "404 Not Found" error page #=============================================================================== -http_response_code(404); - -#=============================================================================== -# Build document -#=============================================================================== -$MainTemplate = Template\Factory::build('main'); -$MainTemplate->set('NAME', '404 Not Found'); -$MainTemplate->set('HEAD', ['NAME' => $MainTemplate->get('NAME')]); -$MainTemplate->set('HTML', Template\Factory::build('404')); - -echo $MainTemplate; +Application::error404(); diff --git a/core/namespace/Application.php b/core/namespace/Application.php index 93361dd..b88fa2c 100644 --- a/core/namespace/Application.php +++ b/core/namespace/Application.php @@ -238,15 +238,21 @@ class Application { # Exit application with the 403 error page #=============================================================================== public static function error403(): void { - require ROOT.'403.php'; - exit(); + $Template = Template\Factory::build('main'); + $Template->set('NAME', '403 Forbidden'); + $Template->set('HEAD', ['NAME' => $Template->get('NAME')]); + $Template->set('HTML', Template\Factory::build('403')); + self::exit($Template, 403); } #=============================================================================== # Exit application with the 404 error page #=============================================================================== public static function error404(): void { - require ROOT.'404.php'; - exit(); + $Template = Template\Factory::build('main'); + $Template->set('NAME', '404 Not Found'); + $Template->set('HEAD', ['NAME' => $Template->get('NAME')]); + $Template->set('HTML', Template\Factory::build('404')); + self::exit($Template, 404); } } |