This repository has been archived by the owner on Sep 13, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
70 lines (61 loc) · 1.72 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
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
<?php
/**
* dropFW : PHP Web Development Framework
* Copyright 2010, Pavan Kumar Sunkara
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2010
* @version 1.0.0
* @author Pavan Kumar Sunkara
* @license MIT
*/
define('DS', DIRECTORY_SEPARATOR);
define('HOST', 'http://'.$_SERVER['HTTP_HOST']);
define('ROOT', dirname(__FILE__).DS);
define('CORE', ROOT.'drop'.DS);
define('APP', ROOT.'app'.DS);
define('WWW', APP.'www'.DS);
/**
* Detects the correct URL excluding the base directory
* Works without the consideration of rewrite engine
* @author Pavan Kumar Sunkara
*/
if(array_key_exists('REDIRECT_STATUS',$_SERVER)) {
if((int) $_SERVER['REDIRECT_STATUS'] == 200) {
define('URL', $_SERVER['REDIRECT_QUERY_STRING']);
$subdirUrl = explode("/",$_SERVER['SCRIPT_NAME']);
array_pop($subdirUrl);
define('WEBROOT', implode("/",$subdirUrl));
$redirection = true;
}
} else {
define('URL', $_SERVER['PATH_INFO']);
define('WEBROOT',$_SERVER['SCRIPT_NAME']);
$redirection = false;
}
define('BASE', HOST.WEBROOT);
/**
* No need to go to dispatch if it is css or js or img or fonts
*/
$url = explode("/",URL);
array_shift($url);
/**
* Setting Cache to improve page speed
* Setting cache expiraiton to 1 year to improve hitrate
*/
header('Cache-Control: max-age=31104000, public');
if($url[0] == "css" || $url[0] == "js" || $url[0] == "img" || $url[0] == "fonts") {
readfile(WWW.implode("/", $url));
} else {
/**
* Include boot.php which loads all the files
*/
require_once CORE.'boot.php';
/**
* Include index.php which does the main dispatching and outputing
*/
require_once WWW.'index.php';
}
?>