forked from the-benchmarker/web-frameworks
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.php
More file actions
139 lines (113 loc) · 3.89 KB
/
config.php
File metadata and controls
139 lines (113 loc) · 3.89 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<?php
/*
|--------------------------------------------------------------------------
| Start Session
|--------------------------------------------------------------------------
*/
session_start();
/*
|--------------------------------------------------------------------------
| Register The Class Autoloader
|--------------------------------------------------------------------------
|
| Folders containing classes that need to be autoloaded should be added to
| the array variable $class_folders.
|
*/
// Add class folders to autoload
$class_folders[] = 'classes';
$class_folders[] = 'models';
$class_folders[] = 'controllers';
define('AUTOLOAD_CLASSES', $class_folders);
spl_autoload_register(function ($class_name) {
foreach (AUTOLOAD_CLASSES as $folder) {
if (file_exists('../' . $folder . '/' . $class_name . '.php') && is_readable('../' . $folder . '/' . $class_name . '.php')) {
require_once '../' . $folder . '/' . $class_name . '.php';
}
}
});
/*
|--------------------------------------------------------------------------
| Set The Environment
|--------------------------------------------------------------------------
|
| When working in a development environment, define 'ENVIRONMENT' as
| 'development'. When working in a production environment, define
| 'ENVIRONMENT' as 'production'. Error reporting is turned ON in development,
| and OFF in production environment.
|
*/
define('ENVIRONMENT', 'development');
switch (ENVIRONMENT) {
case 'development':
error_reporting(E_ALL);
break;
case 'production':
error_reporting(0);
break;
}
/*
|--------------------------------------------------------------------------
| Enforce SSL/HTTPS
|--------------------------------------------------------------------------
*/
define('ENFORCE_SSL', false);
/*
|--------------------------------------------------------------------------
| Set URI Whitelisted Characters
|--------------------------------------------------------------------------
*/
define('URI_WHITELISTED', '\w\/\-\?\=\&');
/*
|--------------------------------------------------------------------------
| Set $_POST Blacklisted Characters
| Backslash (\) is blacklisted by default.
|--------------------------------------------------------------------------
*/
define('POST_BLACKLISTED', '\<\>\{\}\[\]\_\;\*\=\+\"\&\#\%\\$');
/*
|--------------------------------------------------------------------------
| Set BASE_URL
|--------------------------------------------------------------------------
*/
if (ENFORCE_SSL == false) {
$http_protocol = 'http://';
} else {
$http_protocol = 'https://';
}
if (! empty(dirname($_SERVER['SCRIPT_NAME']))) {
$subfolder = dirname($_SERVER['SCRIPT_NAME']);
} else {
$subfolder = '';
}
define('BASE_URL', $http_protocol . $_SERVER['SERVER_NAME'] . $subfolder . '/');
/*
|--------------------------------------------------------------------------
| Number of subdirectories from hostname to index.php
|--------------------------------------------------------------------------
*/
define('SUB_DIR', substr_count($_SERVER['SCRIPT_NAME'], '/')-1);
/*
|--------------------------------------------------------------------------
| Set Homepage Controller@method
|--------------------------------------------------------------------------
*/
define('HOME_PAGE', 'AppController@index');
/*
|--------------------------------------------------------------------------
| Set Controller Suffix
|--------------------------------------------------------------------------
|
| If you are using 'ClassController' convention, set to 'Controller'.
|
*/
define('CONTROLLER_SUFFIX', 'Controller');
/*
|--------------------------------------------------------------------------
| Set Default Method
|--------------------------------------------------------------------------
|
| If the second URL string is empty, set this method as the default method.
|
*/
define('METHOD_DEFAULT', 'index');