From 7a1b8f471ca133b6ca99cd4e440e6614a7c18537 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Tue, 11 Apr 2017 05:11:57 +0200 Subject: Methods "error403" and "error404" has been added to the "Application" class; several files has been changed. --- core/namespace/Application.php | 19 +++++++++++++++++-- core/namespace/Router.php | 2 +- 2 files changed, 18 insertions(+), 3 deletions(-) (limited to 'core') diff --git a/core/namespace/Application.php b/core/namespace/Application.php index 329d56d..17cd020 100644 --- a/core/namespace/Application.php +++ b/core/namespace/Application.php @@ -137,11 +137,26 @@ class Application { } #=============================================================================== - # Exit application with + # Exit application with a custom HTTP status code #=============================================================================== public static function exit($code = 500) { http_response_code($code); - $code === 404 AND require_once ROOT.'404.php'; + exit(); + } + + #=============================================================================== + # Exit application with the 403 error page + #=============================================================================== + public static function error403() { + require_once ROOT.'403.php'; + exit(); + } + + #=============================================================================== + # Exit application with the 404 error page + #=============================================================================== + public static function error404() { + require_once ROOT.'404.php'; exit(); } } diff --git a/core/namespace/Router.php b/core/namespace/Router.php index f0e7e2a..b6221d1 100644 --- a/core/namespace/Router.php +++ b/core/namespace/Router.php @@ -57,7 +57,7 @@ class Router { } if($route_found === FALSE) { - require_once ROOT.'404.php'; + Application::error404(); } } } -- cgit v1.2.3