|
6 | 6 | * |
7 | 7 | * This content is released under the MIT License (MIT) |
8 | 8 | * |
9 | | - * Copyright (c) 2014 - 2015, British Columbia Institute of Technology |
| 9 | + * Copyright (c) 2014 - 2017, British Columbia Institute of Technology |
10 | 10 | * |
11 | 11 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
12 | 12 | * of this software and associated documentation files (the "Software"), to deal |
|
28 | 28 | * |
29 | 29 | * @package CodeIgniter |
30 | 30 | * @author EllisLab Dev Team |
31 | | - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) |
32 | | - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) |
| 31 | + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) |
| 32 | + * @copyright Copyright (c) 2014 - 2017, British Columbia Institute of Technology (http://bcit.ca/) |
33 | 33 | * @license http://opensource.org/licenses/MIT MIT License |
34 | | - * @link http://codeigniter.com |
| 34 | + * @link https://codeigniter.com |
35 | 35 | * @since Version 1.0.0 |
36 | 36 | * @filesource |
37 | 37 | */ |
|
91 | 91 |
|
92 | 92 | /* |
93 | 93 | *--------------------------------------------------------------- |
94 | | - * SYSTEM FOLDER NAME |
| 94 | + * SYSTEM DIRECTORY NAME |
95 | 95 | *--------------------------------------------------------------- |
96 | 96 | * |
97 | | - * This variable must contain the name of your "system" folder. |
98 | | - * Include the path if the folder is not in the same directory |
99 | | - * as this file. |
| 97 | + * This variable must contain the name of your "system" directory. |
| 98 | + * Set the path if it is not in the same directory as this file. |
100 | 99 | */ |
101 | 100 | $system_path = 'system'; |
102 | 101 |
|
103 | 102 | /* |
104 | 103 | *--------------------------------------------------------------- |
105 | | - * APPLICATION FOLDER NAME |
| 104 | + * APPLICATION DIRECTORY NAME |
106 | 105 | *--------------------------------------------------------------- |
107 | 106 | * |
108 | 107 | * If you want this front controller to use a different "application" |
109 | | - * folder than the default one you can set its name here. The folder |
110 | | - * can also be renamed or relocated anywhere on your server. If |
111 | | - * you do, use a full server path. For more info please see the user guide: |
112 | | - * http://codeigniter.com/user_guide/general/managing_apps.html |
| 108 | + * directory than the default one you can set its name here. The directory |
| 109 | + * can also be renamed or relocated anywhere on your server. If you do, |
| 110 | + * use an absolute (full) server path. |
| 111 | + * For more info please see the user guide: |
| 112 | + * |
| 113 | + * https://codeigniter.com/user_guide/general/managing_apps.html |
113 | 114 | * |
114 | 115 | * NO TRAILING SLASH! |
115 | 116 | */ |
116 | 117 | $application_folder = 'application'; |
117 | 118 |
|
118 | 119 | /* |
119 | 120 | *--------------------------------------------------------------- |
120 | | - * VIEW FOLDER NAME |
| 121 | + * VIEW DIRECTORY NAME |
121 | 122 | *--------------------------------------------------------------- |
122 | 123 | * |
123 | | - * If you want to move the view folder out of the application |
124 | | - * folder set the path to the folder here. The folder can be renamed |
| 124 | + * If you want to move the view directory out of the application |
| 125 | + * directory, set the path to it here. The directory can be renamed |
125 | 126 | * and relocated anywhere on your server. If blank, it will default |
126 | | - * to the standard location inside your application folder. If you |
127 | | - * do move this, use the full server path to this folder. |
| 127 | + * to the standard location inside your application directory. |
| 128 | + * If you do move this, use an absolute (full) server path. |
128 | 129 | * |
129 | 130 | * NO TRAILING SLASH! |
130 | 131 | */ |
|
150 | 151 | * |
151 | 152 | * Un-comment the $routing array below to use this feature |
152 | 153 | */ |
153 | | - // The directory name, relative to the "controllers" folder. Leave blank |
154 | | - // if your controller is not in a sub-folder within the "controllers" folder |
| 154 | + // The directory name, relative to the "controllers" directory. Leave blank |
| 155 | + // if your controller is not in a sub-directory within the "controllers" one |
155 | 156 | // $routing['directory'] = ''; |
156 | 157 |
|
157 | 158 | // The controller class file name. Example: mycontroller |
|
197 | 198 |
|
198 | 199 | if (($_temp = realpath($system_path)) !== FALSE) |
199 | 200 | { |
200 | | - $system_path = $_temp.'/'; |
| 201 | + $system_path = $_temp.DIRECTORY_SEPARATOR; |
201 | 202 | } |
202 | 203 | else |
203 | 204 | { |
204 | 205 | // Ensure there's a trailing slash |
205 | | - $system_path = rtrim($system_path, '/').'/'; |
| 206 | + $system_path = strtr( |
| 207 | + rtrim($system_path, '/\\'), |
| 208 | + '/\\', |
| 209 | + DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR |
| 210 | + ).DIRECTORY_SEPARATOR; |
206 | 211 | } |
207 | 212 |
|
208 | 213 | // Is the system path correct? |
|
221 | 226 | // The name of THIS file |
222 | 227 | define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME)); |
223 | 228 |
|
224 | | - // Path to the system folder |
225 | | - define('BASEPATH', str_replace('\\', '/', $system_path)); |
| 229 | + // Path to the system directory |
| 230 | + define('BASEPATH', $system_path); |
226 | 231 |
|
227 | | - // Path to the front controller (this file) |
228 | | - define('FCPATH', dirname(__FILE__).'/'); |
| 232 | + // Path to the front controller (this file) directory |
| 233 | + define('FCPATH', dirname(__FILE__).DIRECTORY_SEPARATOR); |
229 | 234 |
|
230 | | - // Name of the "system folder" |
231 | | - define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/')); |
| 235 | + // Name of the "system" directory |
| 236 | + define('SYSDIR', basename(BASEPATH)); |
232 | 237 |
|
233 | | - // The path to the "application" folder |
| 238 | + // The path to the "application" directory |
234 | 239 | if (is_dir($application_folder)) |
235 | 240 | { |
236 | 241 | if (($_temp = realpath($application_folder)) !== FALSE) |
237 | 242 | { |
238 | 243 | $application_folder = $_temp; |
239 | 244 | } |
240 | | - |
241 | | - define('APPPATH', $application_folder.DIRECTORY_SEPARATOR); |
| 245 | + else |
| 246 | + { |
| 247 | + $application_folder = strtr( |
| 248 | + rtrim($application_folder, '/\\'), |
| 249 | + '/\\', |
| 250 | + DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR |
| 251 | + ); |
| 252 | + } |
| 253 | + } |
| 254 | + elseif (is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR)) |
| 255 | + { |
| 256 | + $application_folder = BASEPATH.strtr( |
| 257 | + trim($application_folder, '/\\'), |
| 258 | + '/\\', |
| 259 | + DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR |
| 260 | + ); |
242 | 261 | } |
243 | 262 | else |
244 | 263 | { |
245 | | - if ( ! is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR)) |
246 | | - { |
247 | | - header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); |
248 | | - echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF; |
249 | | - exit(3); // EXIT_CONFIG |
250 | | - } |
251 | | - |
252 | | - define('APPPATH', BASEPATH.$application_folder.DIRECTORY_SEPARATOR); |
| 264 | + header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); |
| 265 | + echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF; |
| 266 | + exit(3); // EXIT_CONFIG |
253 | 267 | } |
254 | 268 |
|
255 | | - // The path to the "views" folder |
256 | | - if ( ! is_dir($view_folder)) |
| 269 | + define('APPPATH', $application_folder.DIRECTORY_SEPARATOR); |
| 270 | + |
| 271 | + // The path to the "views" directory |
| 272 | + if ( ! isset($view_folder[0]) && is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR)) |
257 | 273 | { |
258 | | - if ( ! empty($view_folder) && is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR)) |
259 | | - { |
260 | | - $view_folder = APPPATH.$view_folder; |
261 | | - } |
262 | | - elseif ( ! is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR)) |
| 274 | + $view_folder = APPPATH.'views'; |
| 275 | + } |
| 276 | + elseif (is_dir($view_folder)) |
| 277 | + { |
| 278 | + if (($_temp = realpath($view_folder)) !== FALSE) |
263 | 279 | { |
264 | | - header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); |
265 | | - echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF; |
266 | | - exit(3); // EXIT_CONFIG |
| 280 | + $view_folder = $_temp; |
267 | 281 | } |
268 | 282 | else |
269 | 283 | { |
270 | | - $view_folder = APPPATH.'views'; |
| 284 | + $view_folder = strtr( |
| 285 | + rtrim($view_folder, '/\\'), |
| 286 | + '/\\', |
| 287 | + DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR |
| 288 | + ); |
271 | 289 | } |
272 | 290 | } |
273 | | - |
274 | | - if (($_temp = realpath($view_folder)) !== FALSE) |
| 291 | + elseif (is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR)) |
275 | 292 | { |
276 | | - $view_folder = $_temp.DIRECTORY_SEPARATOR; |
| 293 | + $view_folder = APPPATH.strtr( |
| 294 | + trim($view_folder, '/\\'), |
| 295 | + '/\\', |
| 296 | + DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR |
| 297 | + ); |
277 | 298 | } |
278 | 299 | else |
279 | 300 | { |
280 | | - $view_folder = rtrim($view_folder, '/\\').DIRECTORY_SEPARATOR; |
| 301 | + header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); |
| 302 | + echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF; |
| 303 | + exit(3); // EXIT_CONFIG |
281 | 304 | } |
282 | 305 |
|
283 | | - define('VIEWPATH', $view_folder); |
| 306 | + define('VIEWPATH', $view_folder.DIRECTORY_SEPARATOR); |
284 | 307 |
|
285 | 308 | /* |
286 | 309 | * -------------------------------------------------------------------- |
|
0 commit comments