-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
40 lines (36 loc) · 1 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
<?php
require_once 'settings.php';
require_once 'publicregistry.php';
require_once 'etc/etc.php';
if(!empty($_GET['url'])) {
$_GET['url'] = explode('/', $_GET['url']);
}
function __autoload($className) {
if(($path = getClass($className)) != null)
require_once $path;
}
function getClass($className) {
$className = strtolower($className);
if(file_exists(($path = ROOT . DS . 'lib' . DS . $className . '.php'))) {
return $path;
} else if(file_exists(($path = ROOT . DS . 'app' . DS . $className . '.php'))) {
return $path;
} else if(file_exists(($path = ROOT . DS . 'page' . DS . $className . '.php'))) {
return $path;
} else if(file_exists(($path = ROOT . DS . 'model' . DS . $className . '.php'))) {
return $path;
}
}
if(empty($_GET)) {
new DefaultPage();
} else if($_GET['url'][0] == 'index') {
new DefaultPage();
} else {
$page = ucfirst($_GET['url'][0]).'Page';
if(getClass($page) != null) {
new $page();
} else {
new ErrorPage();
}
}
?>