blob: 2fffdc0b22c79deed33b9b639f836e2c573bd6f3 (
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
34
35
36
37
38
39
40
41
|
<?php
class RequestHandler extends request_handler {
/** @var web_tpl*/
protected $tpl;
public function __construct() {
global $__tpl;
$__tpl = new web_tpl();
$this->tpl = $__tpl;
$this->tpl->add_static('bootstrap.min.css');
$this->tpl->add_static('bootstrap.min.js');
$this->tpl->add_static('polyfills.js');
$this->tpl->add_static('app.js');
$this->tpl->add_static('app.css');
}
public function dispatch(string $act) {
global $config;
$this->tpl->set_global([
'__dev' => $config['is_dev'],
]);
return parent::dispatch($act);
}
protected function method_not_found(string $method, string $act)
{
global $config;
if ($act != '404' && $config['is_dev'])
debugError(get_called_class() . ": act {$method}_{$act} not found.");
if (!is_xhr_request())
$this->tpl->render_not_found();
else
ajax_error('unknown act "'.$act.'"', 404);
}
}
|