xssbook2/web/_model/apps/error.php
2024-03-30 12:14:42 -04:00

35 lines
689 B
PHP

<?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)) {
$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;
}
}
}
public function get_data(): array {
$data = parent::get_data();
$this->get_msg($data);
return $data;
}
}
?>