xssbook2/web/_model/apps/error.php

36 lines
689 B
PHP
Raw Normal View History

<?php /* Copyright (c) 2024 Freya Murphy */
2024-03-30 16:14:42 +00:00
class Error_model extends Model {
function __construct($load) {
parent::__construct($load);
}
private function get_msg(&$data) {
if (!array_key_exists('code', $_GET)) {
$data['msg'] = lang('error');
$data['title'] = '500';
} else {
$code = $_GET['code'];
$data['title'] = $code;
switch ($code) {
case '404':
$data['msg'] = lang('error_404');
break;
case '500':
$data['msg'] = lang('error_500');
break;
default:
$data['msg'] = lang('error');
break;
}
}
}
2024-03-30 16:14:42 +00:00
public function get_data(): array {
$data = parent::get_data();
$this->get_msg($data);
return $data;
}
}
?>