S2OJ/web/index.php

30 lines
834 B
PHP
Raw Permalink Normal View History

2016-07-18 16:39:37 +00:00
<?php
2023-02-06 10:29:52 +00:00
setlocale(LC_ALL, 'zh_CN.UTF-8', 'C.UTF-8');
2022-10-08 11:58:22 +00:00
require_once $_SERVER['DOCUMENT_ROOT'] . '/app/vendor/autoload.php';
require $_SERVER['DOCUMENT_ROOT'] . '/app/libs/uoj-lib.php';
2016-07-18 16:39:37 +00:00
require UOJContext::documentRoot().'/app/route.php';
require UOJContext::documentRoot().'/app/controllers/subdomain/blog/route.php';
require UOJContext::documentRoot().'/app/controllers/subdomain/api/route.php';
2016-07-18 16:39:37 +00:00
include UOJContext::documentRoot().'/app/controllers'.call_user_func(function() {
$route = Route::dispatch();
$q_pos = strpos($route['action'], '?');
if ($q_pos === false) {
$path = $route['action'];
} else {
parse_str(substr($route['action'], $q_pos + 1), $vars);
$_GET += $vars;
$path = substr($route['action'], 0, $q_pos);
}
if (isset($route['onload'])) {
call_user_func($route['onload']);
}
return $path;
});