forked from jerray/Cybery-Reader
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
executable file
·41 lines (32 loc) · 796 Bytes
/
index.php
File metadata and controls
executable file
·41 lines (32 loc) · 796 Bytes
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
<?php
include('inc/common.inc.php');
include('config/routes.inc.php');
$app_reg = str_replace('/', '\/', APP_DIR);
$uri = preg_replace('/^'.$app_reg.'/', '', $_SERVER['REQUEST_URI']);
foreach($routes as $pattern => $config)
{
if(preg_match($pattern, $uri))
{
if(file_exists($config[1]))
{
include($config[1]);
$action_file_name = basename($config[1]);
$action_class_name = substr($action_file_name, 0, strpos($action_file_name, '.'));
if(class_exists($action_class_name)){
$act = new $action_class_name();
if(method_exists($act, 'execute')){
$act->execute(null);
die();
}else{
die('action class invalid');
}
}else{
die('action class not exist');
}
}else{
die('action file not exist');
}
}
}
header('location:home/');
?>