', $name, '';
echo '
';
}
use App\Router;
use App\Utils\Error;
use Noodlehaus\Config;
$router = new Router();
$router->addRoute(['/', '/index.php', '/index'], 'App\Controllers\Home', 'GET');
$router->addRoute('/api', 'App\Controllers\Result', 'GET');
$router->addRoute('/hmac', 'App\Controllers\GenHmac', 'GET');
//$router->addRoute('/debug', 'App\Bin\ThumbShoter', 'GET');
$router->addRoute('/backend', 'App\Controllers\Backend', 'GET');
$router->addRoute('/logout', 'App\Controllers\Logout', 'GET');
$conf = (object)Config::load([__DIR__ . '/../datas/config.default.json', '?' . __DIR__ . '/../datas/config.json'])->all();
if (!file_exists(__DIR__ . '/../datas/config.json')) {
session_start();
$conf->webPage = true;
$_SESSION['login'] = 1;
$_SESSION['firstRun'] = 1;
$_SESSION['webPage'] = 1;
if ($_SERVER['REQUEST_URI'] !== '/backend?page=settings') {
header("Location:/backend?page=settings");
exit();
}
}
if ($conf->onlyLocalServer === true && $_SERVER['REMOTE_ADDR'] !== '127.0.0.1') {
$error = new Error();
$error->index((object)['status' => 404, 'message' => 'The page that you have requested could not be found.']);
exit();
}
if ($router->match()) {
$router->render($conf);
} else {
$error = new Error();
$error->index((object)['status' => 404, 'message' => 'The page that you have requested could not be found.']);
}