From 5a2ba9c2e7605bb788bc406184547d22c6436867 Mon Sep 17 00:00:00 2001 From: Freya Murphy Date: Mon, 23 Dec 2024 11:13:27 -0500 Subject: v2.1.0, refactor w/ crimson --- src/web/_controller/error.php | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/web/_controller/error.php (limited to 'src/web/_controller/error.php') diff --git a/src/web/_controller/error.php b/src/web/_controller/error.php new file mode 100644 index 0000000..55034ba --- /dev/null +++ b/src/web/_controller/error.php @@ -0,0 +1,36 @@ +error_model = $this->load_model('error'); + } + + public function index(): void { + $this->code(404); + } + + public function code($code): void { + parent::index(); + + $code = intval($code); + if ($code == 404 && rand(0, 100) > 95) + $code = 451; + if (!is_valid_status_code($code)) + $code = 404; + $msg = status_code_msg($code); + + $data = $this->error_model->get_data(); + $data['title'] = $code; + $data['msg'] = $msg; + + $this->view('header', $data); + $this->view('error/main', $data); + $this->view('footer', $data); + } + +} + +?> -- cgit v1.2.3-freya