-
Notifications
You must be signed in to change notification settings - Fork 173
/
index.php
34 lines (24 loc) · 959 Bytes
/
index.php
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
<?php
require_once __DIR__ . '/default.php';
$request_uri = parse_url($_SERVER['REQUEST_URI']);
$request_uri = explode("/", $request_uri['path']);
$script_name = explode("/", dirname($_SERVER['SCRIPT_NAME']));
$app_dir = array();
foreach ($request_uri as $key => $value) {
if (isset($script_name[$key]) && $script_name[$key] == $value) {
$app_dir[] = $script_name[$key];
}
}
define('APP_DIR', rtrim(implode('/', $app_dir), "/"));
$https = false;
if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") {
$https = true;
}
define('BASE_URL', "http" . ($https ? "s" : "") . "://" . $_SERVER['HTTP_HOST'] . APP_DIR);
unset($config_file, $request_uri, $script_name, $app_dir, $https);
if (defined('ACCESS_USER') && defined('ACCESS_PASSWORD')) {
require_once __DIR__ . DIRECTORY_SEPARATOR . 'login.php';
Login::instance()->dispatch();
}
require_once __DIR__ . DIRECTORY_SEPARATOR . 'wiki.php';
Wiki::instance()->dispatch();