| 775 |
lars |
1 |
<?php
|
|
|
2 |
/**
|
|
|
3 |
* CodeIgniter
|
|
|
4 |
*
|
|
|
5 |
* An open source application development framework for PHP
|
|
|
6 |
*
|
|
|
7 |
* This content is released under the MIT License (MIT)
|
|
|
8 |
*
|
|
|
9 |
* Copyright (c) 2014 - 2016, British Columbia Institute of Technology
|
|
|
10 |
*
|
|
|
11 |
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
12 |
* of this software and associated documentation files (the "Software"), to deal
|
|
|
13 |
* in the Software without restriction, including without limitation the rights
|
|
|
14 |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
15 |
* copies of the Software, and to permit persons to whom the Software is
|
|
|
16 |
* furnished to do so, subject to the following conditions:
|
|
|
17 |
*
|
|
|
18 |
* The above copyright notice and this permission notice shall be included in
|
|
|
19 |
* all copies or substantial portions of the Software.
|
|
|
20 |
*
|
|
|
21 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
22 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
23 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
24 |
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
25 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
26 |
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
27 |
* THE SOFTWARE.
|
|
|
28 |
*
|
|
|
29 |
* @package CodeIgniter
|
|
|
30 |
* @author EllisLab Dev Team
|
|
|
31 |
* @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/)
|
|
|
32 |
* @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/)
|
|
|
33 |
* @license http://opensource.org/licenses/MIT MIT License
|
|
|
34 |
* @link https://codeigniter.com
|
|
|
35 |
* @since Version 1.0.0
|
|
|
36 |
* @filesource
|
|
|
37 |
*/
|
|
|
38 |
|
|
|
39 |
/*
|
|
|
40 |
*---------------------------------------------------------------
|
|
|
41 |
* APPLICATION ENVIRONMENT
|
|
|
42 |
*---------------------------------------------------------------
|
|
|
43 |
*
|
|
|
44 |
* You can load different configurations depending on your
|
|
|
45 |
* current environment. Setting the environment also influences
|
|
|
46 |
* things like logging and error reporting.
|
|
|
47 |
*
|
|
|
48 |
* This can be set to anything, but default usage is:
|
|
|
49 |
*
|
|
|
50 |
* development
|
|
|
51 |
* testing
|
|
|
52 |
* production
|
|
|
53 |
*
|
|
|
54 |
* NOTE: If you change these, also change the error_reporting() code below
|
|
|
55 |
*/
|
|
|
56 |
define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'testing');
|
|
|
57 |
|
|
|
58 |
/*
|
|
|
59 |
*---------------------------------------------------------------
|
|
|
60 |
* ERROR REPORTING
|
|
|
61 |
*---------------------------------------------------------------
|
|
|
62 |
*
|
|
|
63 |
* Different environments will require different levels of error reporting.
|
|
|
64 |
* By default development will show errors but testing and live will hide them.
|
|
|
65 |
*/
|
|
|
66 |
switch (ENVIRONMENT)
|
|
|
67 |
{
|
|
|
68 |
case 'development':
|
|
|
69 |
error_reporting(-1);
|
|
|
70 |
ini_set('display_errors', 1);
|
|
|
71 |
break;
|
|
|
72 |
|
|
|
73 |
case 'testing':
|
|
|
74 |
ini_set('display_errors', 1);
|
|
|
75 |
if (version_compare(PHP_VERSION, '5.3', '>='))
|
|
|
76 |
{
|
|
|
77 |
error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_USER_DEPRECATED);
|
|
|
78 |
}
|
|
|
79 |
else
|
|
|
80 |
{
|
|
|
81 |
error_reporting(E_ALL & ~E_STRICT & ~E_USER_NOTICE);
|
|
|
82 |
}
|
|
|
83 |
break;
|
|
|
84 |
case 'production':
|
|
|
85 |
ini_set('display_errors', 0);
|
|
|
86 |
if (version_compare(PHP_VERSION, '5.3', '>='))
|
|
|
87 |
{
|
|
|
88 |
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
|
|
|
89 |
}
|
|
|
90 |
else
|
|
|
91 |
{
|
|
|
92 |
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
|
|
|
93 |
}
|
|
|
94 |
break;
|
|
|
95 |
|
|
|
96 |
default:
|
|
|
97 |
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
|
|
|
98 |
echo 'The application environment is not set correctly.';
|
|
|
99 |
exit(1); // EXIT_ERROR
|
|
|
100 |
}
|
|
|
101 |
|
|
|
102 |
/*
|
|
|
103 |
*---------------------------------------------------------------
|
|
|
104 |
* SYSTEM DIRECTORY NAME
|
|
|
105 |
*---------------------------------------------------------------
|
|
|
106 |
*
|
|
|
107 |
* This variable must contain the name of your "system" directory.
|
|
|
108 |
* Set the path if it is not in the same directory as this file.
|
|
|
109 |
*/
|
|
|
110 |
$system_path = '/var/www/starfleethq/ci/system';
|
|
|
111 |
|
|
|
112 |
/*
|
|
|
113 |
*---------------------------------------------------------------
|
|
|
114 |
* APPLICATION DIRECTORY NAME
|
|
|
115 |
*---------------------------------------------------------------
|
|
|
116 |
*
|
|
|
117 |
* If you want this front controller to use a different "application"
|
|
|
118 |
* directory than the default one you can set its name here. The directory
|
|
|
119 |
* can also be renamed or relocated anywhere on your server. If you do,
|
|
|
120 |
* use an absolute (full) server path.
|
|
|
121 |
* For more info please see the user guide:
|
|
|
122 |
*
|
|
|
123 |
* https://codeigniter.com/user_guide/general/managing_apps.html
|
|
|
124 |
*
|
|
|
125 |
* NO TRAILING SLASH!
|
|
|
126 |
*/
|
|
|
127 |
$application_folder = '/var/www/starfleethq/ci/backend';
|
|
|
128 |
|
|
|
129 |
/*
|
|
|
130 |
*---------------------------------------------------------------
|
|
|
131 |
* VIEW DIRECTORY NAME
|
|
|
132 |
*---------------------------------------------------------------
|
|
|
133 |
*
|
|
|
134 |
* If you want to move the view directory out of the application
|
|
|
135 |
* directory, set the path to it here. The directory can be renamed
|
|
|
136 |
* and relocated anywhere on your server. If blank, it will default
|
|
|
137 |
* to the standard location inside your application directory.
|
|
|
138 |
* If you do move this, use an absolute (full) server path.
|
|
|
139 |
*
|
|
|
140 |
* NO TRAILING SLASH!
|
|
|
141 |
*/
|
|
|
142 |
$view_folder = '';
|
|
|
143 |
|
|
|
144 |
|
|
|
145 |
/*
|
|
|
146 |
* --------------------------------------------------------------------
|
|
|
147 |
* DEFAULT CONTROLLER
|
|
|
148 |
* --------------------------------------------------------------------
|
|
|
149 |
*
|
|
|
150 |
* Normally you will set your default controller in the routes.php file.
|
|
|
151 |
* You can, however, force a custom routing by hard-coding a
|
|
|
152 |
* specific controller class/function here. For most applications, you
|
|
|
153 |
* WILL NOT set your routing here, but it's an option for those
|
|
|
154 |
* special instances where you might want to override the standard
|
|
|
155 |
* routing in a specific front controller that shares a common CI installation.
|
|
|
156 |
*
|
|
|
157 |
* IMPORTANT: If you set the routing here, NO OTHER controller will be
|
|
|
158 |
* callable. In essence, this preference limits your application to ONE
|
|
|
159 |
* specific controller. Leave the function name blank if you need
|
|
|
160 |
* to call functions dynamically via the URI.
|
|
|
161 |
*
|
|
|
162 |
* Un-comment the $routing array below to use this feature
|
|
|
163 |
*/
|
|
|
164 |
// The directory name, relative to the "controllers" directory. Leave blank
|
|
|
165 |
// if your controller is not in a sub-directory within the "controllers" one
|
|
|
166 |
// $routing['directory'] = '';
|
|
|
167 |
|
|
|
168 |
// The controller class file name. Example: mycontroller
|
|
|
169 |
// $routing['controller'] = '';
|
|
|
170 |
|
|
|
171 |
// The controller function you wish to be called.
|
|
|
172 |
// $routing['function'] = '';
|
|
|
173 |
|
|
|
174 |
|
|
|
175 |
/*
|
|
|
176 |
* -------------------------------------------------------------------
|
|
|
177 |
* CUSTOM CONFIG VALUES
|
|
|
178 |
* -------------------------------------------------------------------
|
|
|
179 |
*
|
|
|
180 |
* The $assign_to_config array below will be passed dynamically to the
|
|
|
181 |
* config class when initialized. This allows you to set custom config
|
|
|
182 |
* items or override any default config values found in the config.php file.
|
|
|
183 |
* This can be handy as it permits you to share one application between
|
|
|
184 |
* multiple front controller files, with each file containing different
|
|
|
185 |
* config values.
|
|
|
186 |
*
|
|
|
187 |
* Un-comment the $assign_to_config array below to use this feature
|
|
|
188 |
*/
|
|
|
189 |
// $assign_to_config['name_of_config_item'] = 'value of config item';
|
|
|
190 |
|
|
|
191 |
|
|
|
192 |
|
|
|
193 |
// --------------------------------------------------------------------
|
|
|
194 |
// END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE
|
|
|
195 |
// --------------------------------------------------------------------
|
|
|
196 |
|
|
|
197 |
/*
|
|
|
198 |
* ---------------------------------------------------------------
|
|
|
199 |
* Resolve the system path for increased reliability
|
|
|
200 |
* ---------------------------------------------------------------
|
|
|
201 |
*/
|
|
|
202 |
|
|
|
203 |
// Set the current directory correctly for CLI requests
|
|
|
204 |
if (defined('STDIN'))
|
|
|
205 |
{
|
|
|
206 |
chdir(dirname(__FILE__));
|
|
|
207 |
}
|
|
|
208 |
|
|
|
209 |
if (($_temp = realpath($system_path)) !== FALSE)
|
|
|
210 |
{
|
|
|
211 |
$system_path = $_temp.DIRECTORY_SEPARATOR;
|
|
|
212 |
}
|
|
|
213 |
else
|
|
|
214 |
{
|
|
|
215 |
// Ensure there's a trailing slash
|
|
|
216 |
$system_path = strtr(
|
|
|
217 |
rtrim($system_path, '/\\'),
|
|
|
218 |
'/\\',
|
|
|
219 |
DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
|
|
|
220 |
).DIRECTORY_SEPARATOR;
|
|
|
221 |
}
|
|
|
222 |
|
|
|
223 |
// Is the system path correct?
|
|
|
224 |
if ( ! is_dir($system_path))
|
|
|
225 |
{
|
|
|
226 |
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
|
|
|
227 |
echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.pathinfo(__FILE__, PATHINFO_BASENAME);
|
|
|
228 |
exit(3); // EXIT_CONFIG
|
|
|
229 |
}
|
|
|
230 |
|
|
|
231 |
/*
|
|
|
232 |
* -------------------------------------------------------------------
|
|
|
233 |
* Now that we know the path, set the main path constants
|
|
|
234 |
* -------------------------------------------------------------------
|
|
|
235 |
*/
|
|
|
236 |
// The name of THIS file
|
|
|
237 |
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
|
|
|
238 |
|
|
|
239 |
// Path to the system directory
|
|
|
240 |
define('BASEPATH', $system_path);
|
|
|
241 |
|
|
|
242 |
// Path to the front controller (this file) directory
|
|
|
243 |
define('FCPATH', dirname(__FILE__).DIRECTORY_SEPARATOR);
|
|
|
244 |
|
|
|
245 |
// Name of the "system" directory
|
|
|
246 |
define('SYSDIR', basename(BASEPATH));
|
|
|
247 |
|
|
|
248 |
// The path to the "application" directory
|
|
|
249 |
if (is_dir($application_folder))
|
|
|
250 |
{
|
|
|
251 |
if (($_temp = realpath($application_folder)) !== FALSE)
|
|
|
252 |
{
|
|
|
253 |
$application_folder = $_temp;
|
|
|
254 |
}
|
|
|
255 |
else
|
|
|
256 |
{
|
|
|
257 |
$application_folder = strtr(
|
|
|
258 |
rtrim($application_folder, '/\\'),
|
|
|
259 |
'/\\',
|
|
|
260 |
DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
|
|
|
261 |
);
|
|
|
262 |
}
|
|
|
263 |
}
|
|
|
264 |
elseif (is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR))
|
|
|
265 |
{
|
|
|
266 |
$application_folder = BASEPATH.strtr(
|
|
|
267 |
trim($application_folder, '/\\'),
|
|
|
268 |
'/\\',
|
|
|
269 |
DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
|
|
|
270 |
);
|
|
|
271 |
}
|
|
|
272 |
else
|
|
|
273 |
{
|
|
|
274 |
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
|
|
|
275 |
echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
|
|
|
276 |
exit(3); // EXIT_CONFIG
|
|
|
277 |
}
|
|
|
278 |
|
|
|
279 |
define('APPPATH', $application_folder.DIRECTORY_SEPARATOR);
|
|
|
280 |
|
|
|
281 |
// The path to the "views" directory
|
|
|
282 |
if ( ! isset($view_folder[0]) && is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR))
|
|
|
283 |
{
|
|
|
284 |
$view_folder = APPPATH.'views';
|
|
|
285 |
}
|
|
|
286 |
elseif (is_dir($view_folder))
|
|
|
287 |
{
|
|
|
288 |
if (($_temp = realpath($view_folder)) !== FALSE)
|
|
|
289 |
{
|
|
|
290 |
$view_folder = $_temp;
|
|
|
291 |
}
|
|
|
292 |
else
|
|
|
293 |
{
|
|
|
294 |
$view_folder = strtr(
|
|
|
295 |
rtrim($view_folder, '/\\'),
|
|
|
296 |
'/\\',
|
|
|
297 |
DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
|
|
|
298 |
);
|
|
|
299 |
}
|
|
|
300 |
}
|
|
|
301 |
elseif (is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR))
|
|
|
302 |
{
|
|
|
303 |
$view_folder = APPPATH.strtr(
|
|
|
304 |
trim($view_folder, '/\\'),
|
|
|
305 |
'/\\',
|
|
|
306 |
DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
|
|
|
307 |
);
|
|
|
308 |
}
|
|
|
309 |
else
|
|
|
310 |
{
|
|
|
311 |
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
|
|
|
312 |
echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
|
|
|
313 |
exit(3); // EXIT_CONFIG
|
|
|
314 |
}
|
|
|
315 |
|
|
|
316 |
define('VIEWPATH', $view_folder.DIRECTORY_SEPARATOR);
|
|
|
317 |
|
|
|
318 |
/*
|
|
|
319 |
* --------------------------------------------------------------------
|
|
|
320 |
* LOAD THE BOOTSTRAP FILE
|
|
|
321 |
* --------------------------------------------------------------------
|
|
|
322 |
*
|
|
|
323 |
* And away we go...
|
|
|
324 |
*/
|
|
|
325 |
require_once BASEPATH.'core/CodeIgniter.php';
|