-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
77 lines (55 loc) · 1.7 KB
/
index.php
File metadata and controls
77 lines (55 loc) · 1.7 KB
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
<?php
// check if installed or not
if(!file_exists('config.php')) {
header("Location: install.php");
}
require_once 'config.php';
require_once DIR . '/core/route/route.class.php';
require_once 'core/lib/addTinymce.php';
// *** route ***
//echo WWW;
$pageURL = 'http';
if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
//echo "<br>" . $pageURL;
$custom_routepath = "";
if (WWW . "/" != $pageURL && WWW . "/index.php" != $pageURL) {
//echo "custom page";
$custom_routepath = str_replace(WWW, '', $pageURL) . "/";
//echo "cutstom route is " . $custom_routepath;
} else {
//echo "regular page";
}
if(isset($_SERVER['PATH_INFO'])) {
$routepath = $_SERVER['PATH_INFO'];
$route = new Route();
$route->directRoute($routepath);
die();
} else if ($custom_routepath != "") {
$route = new Route();
$route->directRoute($custom_routepath);
die();
} else {
$content = $CORE->getSetting("homepage");
if(file_exists(DIR . "/components/$content/index.view.php")) {
require_once DIR . "/components/$content/$content.controller.php";
// create controller instance from string
$class = ucwords(strtolower($content)) . "Controller";
$controller = new $class(null);
$controller->component = $content;
if ($content == "homepage") {
$controller->viewdata->layout = $CORE->getSetting('custom_homepage_layout');
} else {
$controller->viewdata->layout = "Homepage";
}
$controller->index();
} else {
echo "Home page is broken :(";
}
}
?>