protected function admin($uri)
{
if ($uri === '') {
$uri = 'index';
} else {
$uri = str_replace(['\\', '../'], ['/', '/'], $uri);
}
$file = __DIR__ . '/../../../../admin/' . $uri . (substr($uri, -1) === '/' ? 'index' : '') . '.php';
$this->debug("request admin page: {$file}");
if (!is_file($file)) {
$this->response->status(404);
$this->response->end('page not found');
return;
}
ob_start();
include $file;
$html = ob_get_clean();
$this->response->end($html);
}