blob: 0a08fdd44149ab763c3db05cea964ead86dcc354 (
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
|
<?php /* Copyright (c) 2024 Freya Murphy */
class Error_model extends Model {
function __construct($load) {
parent::__construct($load);
}
private function get_msg(&$data) {
if (!array_key_exists('code', $_GET)) {
http_response_code(500);
$data['msg'] = ucfirst(lang('error'));
$data['title'] = '500';
} else {
$code = $_GET['code'];
http_response_code($code);
$data['title'] = $code;
$msg = ucfirst(lang('error_' . $code, FALSE));
if (!$msg) {
$msg = ucfirst(lang('error'));
}
$data['msg'] = $msg;
}
}
public function get_data(): ?array {
$data = parent::get_data();
$this->get_msg($data);
return $data;
}
}
?>
|