-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
62 lines (48 loc) · 1.42 KB
/
index.php
File metadata and controls
62 lines (48 loc) · 1.42 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
<?php
define('CURRENT_TS',time());
require_once('inc/init.inc.php');
$strRoute = strtolower((isset($_GET['route'])) ? $_GET['route'] : 'home');
$aryRoutes = explode('/',$strRoute);
$aryQS = array();
//echo '<pre><tt>';
//var_dump($aryRoutes);
// KNOWN ROUTES ARE SET UP SO THAT THERE NEED NOT BE A BUNCH OF FILE SYSTEM CALLS
$aryKnownRoutes = array(
'home',
'about-us',
'downloads',
);
$strRoute = FALSE;
while (count($aryRoutes)>0) {
$strRoute = implode('/',$aryRoutes);
if (in_array($strRoute,$aryKnownRoutes)) {
break;
}
$strRoute .= '/default';
if (in_array($strRoute,$aryKnownRoutes)) {
break;
}
$thisQS = array_pop($aryRoutes);
if ($thisQS != '') { // Needed for if they have the trailing slash
array_unshift($aryQS,$thisQS);
}
}
//var_dump($strRoute,$aryQS);
//die();
if ($strRoute===FALSE || !is_file(PAGES_PATH.$strRoute.'.php')) {
header("HTTP/1.0 404 Not Found");
if (preg_match('/\.(jpg|gif|png|js|css|ico)$/i',$_GET['route'])) {
die ('ERROR 404: File Not Found');
}
$strRoute = 'errors/404';
}
if (!is_file(PAGES_PATH.$strRoute.'.php')) {
die ('ERROR: File Not Found [Missing 404 Directive]');
}
$strParentTemplate = FALSE;
require_once(PAGES_PATH.$strRoute.'.php');
$intLooper = 20;
while ((--$intLooper>0) && $strParentTemplate) {
require_once(TEMPLATES_PATH.$strParentTemplate.'.phtml');
}
// EOF: ~/index.php