-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathindex.php
executable file
·37 lines (35 loc) · 1.12 KB
/
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
35
36
37
<?php
require "config.php";
require "core/gum.php";
gum::init();
$db = new db();
$theme_dir = file_get_contents("theme/default.txt");
$theme_config = include_once "theme/" . $theme_dir . "/config.php";
$uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
if (check::safe($uri)) {
gum::not_found("Access denied!");
}
foreach ($theme_config["router"] as $k => $v) {
if (preg_match("|" . $v["regexp"] . "|U", $uri)) {
preg_match_all("|" . $v["regexp"] . "|U", $uri, $matches);
if (isset($v["params"])) {
foreach ($v["params"] as $kk => $vv) {
$$vv = $matches[$kk + 1][0];
}
}
$theme_file_name=$v["file"];
$theme_file = "theme/" . $theme_dir . "/" . $v["file"] . ".php";
$file = $v["file"];
if (file::has($theme_file)) {
require "service/config.php";
$config = [];
foreach (config::get($db) as $v) {
$config[$v["key"]] = $v["value"];
}
include_once $theme_file;
} else {
gum::not_found();
}
break;
}
}