-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.php
84 lines (68 loc) · 1.7 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
header("Access-Control-Allow-Origin: *");
require_once 'system/Magic.php';
$seturi = new Magic();
$uri = str_replace("?", "/?", $_SERVER["REQUEST_URI"]);
if (isset($uri)) {
$getUri = $uri;
$expUri = [];
$aes = explode("/", $getUri);
if ($seturi->namaApss != "") {
$aes = explode($seturi->namaApss, $getUri);
}
foreach($aes as $key => $val){
if($key != 0){
if ($seturi->namaApss != "") {
$expUri = explode("/", $val);
}else{
$expUri[] = $val;
}
}
}
if (isset($expUri[0]) && $expUri[0] != "") {
$getClass = str_replace("-", "_", $expUri[0]);
unset($expUri[0]);
}
if (isset($expUri[1])) {
if ($expUri[1] != "") {
$getFunction = $expUri[1];
}
unset($expUri[1]);
}
if (isset($expUri)) {
$getParams = $expUri;
}
}
if (file_exists('application/modules/'.$getClass.'/controller/'.$getClass.'.php')) {
include_once 'application/modules/'.$getClass.'/controller/'.$getClass.'.php';
$x = $getClass;
$a = new $x();
$b = $getFunction;
$c = $getParams;
$ckdbn = new Settings;
if ($ckdbn->host != "" && $ckdbn->user != "") {
$loadApps = new DB();
$loadAppsCek = $loadApps->cekDatbase();
if ($loadAppsCek == 'dibuat' || $loadAppsCek == 'tersedia') {
if (is_callable(array($a, $b))) {
call_user_func_array(array($a, $b), $c);
# code...
}else{
include_once 'system/404.php';
}
}else{
include_once 'system/error.php';
}
}else{
try {
$response = call_user_func_array(array($a, $b), $c);
if (false === $response) {
throw new \RuntimeException("call_user_func_array failed");
}
} catch (\Exception $e) {
include_once 'system/404.php';
}
}
}else{
include_once 'system/404.php';
}