-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
41 lines (33 loc) · 1.31 KB
/
index.php
File metadata and controls
41 lines (33 loc) · 1.31 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
<?php
function v ($mixed) {
echo "<pre>";
print_r($mixed);
echo "</pre>";
}
$method = $_SERVER['REQUEST_METHOD'];
include_once "includes/logic/basics.php";
if ( !isset($configuration) )
die( "Reading configuration data failed" );
define("PAGES_FOLDER", "includes/pages/");
define("VIEW_FOLDER", "includes/views/");
$page_components = explode("/", trim($_SERVER['PATH_INFO'], "/"));
$requested_page = $page_components[0];
$requested_subpage = (count($page_components) > 1 ) ? $page_components[1] : "";
$page = "home";
if ( $requested_page && file_exists(PAGES_FOLDER . $requested_page . ".php") )
$page = $requested_page;
include_once PAGES_FOLDER . $page . ".php";
if ( is_callable(strtolower($method)) )
$configuration['display'] = call_user_func( strtolower($method) );
else {
die( /**/ "An unknown error occurred" /**/ );
}
if ( isset($configuration['display']['includes']) && $configuration['display']['includes'] ) {
for ( $i = 0; $i < count($configuration['display']['includes']); $i++ ) {
$file = VIEW_FOLDER . $configuration['display']['includes'][$i] . ".php";
if ( file_exists($file) ) {
include_once $file;
}
}
}
?>