diff options
author | Thomas Lange <code@nerdmind.de> | 2021-08-04 00:40:54 +0200 |
---|---|---|
committer | Thomas Lange <code@nerdmind.de> | 2021-08-04 00:45:48 +0200 |
commit | d1a68c763bdfa6ebbd71e2eee4ff870fed88be5f (patch) | |
tree | 0969653208b1c303be65286cb724af2a76238d91 /core | |
parent | 78dad732e1fd3d4a57f7fa5747624ce0be50d803 (diff) | |
download | blog-d1a68c763bdfa6ebbd71e2eee4ff870fed88be5f.tar.gz blog-d1a68c763bdfa6ebbd71e2eee4ff870fed88be5f.tar.xz blog-d1a68c763bdfa6ebbd71e2eee4ff870fed88be5f.zip |
Move error page logic into the Application class
Move the logic for generating the error pages into the Application class
to remove this ugly "require" call in the error403 and error404 methods.
Diffstat (limited to 'core')
-rw-r--r-- | core/namespace/Application.php | 14 |
1 files changed, 10 insertions, 4 deletions
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); } } |