summaryrefslogtreecommitdiff
path: root/src/web/_controller/error.php
blob: 9efbb7e8874200d5dc4bcfb523240e07f633e1ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php /* Copyright (c) 2024 Freya Murphy */
class Error_controller extends Controller {

	private $error_model;

	function __construct()
	{
		$this->error_model = $this->load_model('error');
	}

	public function code(int $code): void
	{
		// funny 451 change
		if ($code == 404 && rand(0, 100) > 95) {
			$code = 451;
		}

		parent::index();
		$this->load_lang('error');

		$data = $this->error_model->get_data($code);
		$this->view('header', $data);
		$this->view('error/main', $data);
		$this->view('footer', $data);
	}

	public function index(): void
	{
		$this->code(500);
	}
}

?>