Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 1 | <?php |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 2 | /** |
| 3 | * CodeIgniter |
| 4 | * |
Andrey Andreev | fe9309d | 2015-01-09 17:48:58 +0200 | [diff] [blame] | 5 | * An open source application development framework for PHP |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 6 | * |
Andrey Andreev | bdb96ca | 2014-10-28 00:13:31 +0200 | [diff] [blame] | 7 | * This content is released under the MIT License (MIT) |
Andrey Andreev | 282592c | 2012-01-08 01:01:55 +0200 | [diff] [blame] | 8 | * |
Andrey Andreev | fe9309d | 2015-01-09 17:48:58 +0200 | [diff] [blame] | 9 | * Copyright (c) 2014 - 2015, British Columbia Institute of Technology |
Andrey Andreev | 282592c | 2012-01-08 01:01:55 +0200 | [diff] [blame] | 10 | * |
Andrey Andreev | bdb96ca | 2014-10-28 00:13:31 +0200 | [diff] [blame] | 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: |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 17 | * |
Andrey Andreev | bdb96ca | 2014-10-28 00:13:31 +0200 | [diff] [blame] | 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 |
darwinel | 871754a | 2014-02-11 17:34:57 +0100 | [diff] [blame] | 31 | * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) |
Andrey Andreev | fe9309d | 2015-01-09 17:48:58 +0200 | [diff] [blame] | 32 | * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) |
Andrey Andreev | bdb96ca | 2014-10-28 00:13:31 +0200 | [diff] [blame] | 33 | * @license http://opensource.org/licenses/MIT MIT License |
Andrey Andreev | bd202c9 | 2016-01-11 12:50:18 +0200 | [diff] [blame^] | 34 | * @link https://codeigniter.com |
Andrey Andreev | bdb96ca | 2014-10-28 00:13:31 +0200 | [diff] [blame] | 35 | * @since Version 1.0.0 |
Derek Jones | f4a4bd8 | 2011-10-20 12:18:42 -0500 | [diff] [blame] | 36 | * @filesource |
| 37 | */ |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 38 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 39 | /* |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 40 | *--------------------------------------------------------------- |
joelcox | cee8075 | 2011-01-15 23:09:47 +0100 | [diff] [blame] | 41 | * APPLICATION ENVIRONMENT |
| 42 | *--------------------------------------------------------------- |
| 43 | * |
| 44 | * You can load different configurations depending on your |
joelcox | bf2b912 | 2011-01-16 15:24:43 +0100 | [diff] [blame] | 45 | * current environment. Setting the environment also influences |
Phil Sturgeon | d88b315 | 2011-02-02 21:19:25 +0000 | [diff] [blame] | 46 | * things like logging and error reporting. |
| 47 | * |
| 48 | * This can be set to anything, but default usage is: |
| 49 | * |
Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 50 | * development |
| 51 | * testing |
| 52 | * production |
Phil Sturgeon | d88b315 | 2011-02-02 21:19:25 +0000 | [diff] [blame] | 53 | * |
| 54 | * NOTE: If you change these, also change the error_reporting() code below |
joelcox | cee8075 | 2011-01-15 23:09:47 +0100 | [diff] [blame] | 55 | */ |
Phil Sturgeon | dda21f6 | 2012-06-03 10:36:36 -0500 | [diff] [blame] | 56 | define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development'); |
vlakoff | fe83249 | 2012-07-13 20:40:06 +0200 | [diff] [blame] | 57 | |
Phil Sturgeon | d88b315 | 2011-02-02 21:19:25 +0000 | [diff] [blame] | 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 | */ |
Root | 35ac46d | 2012-05-25 18:51:48 -0400 | [diff] [blame] | 66 | switch (ENVIRONMENT) |
Phil Sturgeon | 05fa611 | 2011-04-06 22:57:43 +0100 | [diff] [blame] | 67 | { |
Root | 35ac46d | 2012-05-25 18:51:48 -0400 | [diff] [blame] | 68 | case 'development': |
Gints Murans | 8d021e6 | 2012-05-30 21:15:08 +0300 | [diff] [blame] | 69 | error_reporting(-1); |
Root | 35ac46d | 2012-05-25 18:51:48 -0400 | [diff] [blame] | 70 | ini_set('display_errors', 1); |
| 71 | break; |
| 72 | |
| 73 | case 'testing': |
| 74 | case 'production': |
| 75 | ini_set('display_errors', 0); |
Andrey Andreev | d40d94c | 2014-10-06 03:19:17 +0300 | [diff] [blame] | 76 | if (version_compare(PHP_VERSION, '5.3', '>=')) |
| 77 | { |
| 78 | error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED); |
| 79 | } |
| 80 | else |
| 81 | { |
| 82 | error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE); |
| 83 | } |
Root | 35ac46d | 2012-05-25 18:51:48 -0400 | [diff] [blame] | 84 | break; |
| 85 | |
| 86 | default: |
Andrey Andreev | cbb654d | 2012-07-10 11:36:32 +0300 | [diff] [blame] | 87 | header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); |
Daniel Hunsaker | 3b5b7f4 | 2013-02-22 19:17:56 -0700 | [diff] [blame] | 88 | echo 'The application environment is not set correctly.'; |
Andrey Andreev | 7cf682a | 2014-03-13 14:55:45 +0200 | [diff] [blame] | 89 | exit(1); // EXIT_ERROR |
Phil Sturgeon | 05fa611 | 2011-04-06 22:57:43 +0100 | [diff] [blame] | 90 | } |
joelcox | cee8075 | 2011-01-15 23:09:47 +0100 | [diff] [blame] | 91 | |
| 92 | /* |
| 93 | *--------------------------------------------------------------- |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 94 | * SYSTEM FOLDER NAME |
| 95 | *--------------------------------------------------------------- |
| 96 | * |
| 97 | * This variable must contain the name of your "system" folder. |
vlakoff | c941d85 | 2013-08-06 14:44:40 +0200 | [diff] [blame] | 98 | * Include the path if the folder is not in the same directory |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 99 | * as this file. |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 100 | */ |
Phil Sturgeon | d88b315 | 2011-02-02 21:19:25 +0000 | [diff] [blame] | 101 | $system_path = 'system'; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 102 | |
| 103 | /* |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 104 | *--------------------------------------------------------------- |
| 105 | * APPLICATION FOLDER NAME |
| 106 | *--------------------------------------------------------------- |
| 107 | * |
| 108 | * If you want this front controller to use a different "application" |
Adam Carmichael | e90b830 | 2013-01-04 01:04:29 +1100 | [diff] [blame] | 109 | * folder than the default one you can set its name here. The folder |
Andrey Andreev | 282592c | 2012-01-08 01:01:55 +0200 | [diff] [blame] | 110 | * can also be renamed or relocated anywhere on your server. If |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 111 | * you do, use a full server path. For more info please see the user guide: |
Andrey Andreev | bd202c9 | 2016-01-11 12:50:18 +0200 | [diff] [blame^] | 112 | * https://codeigniter.com/user_guide/general/managing_apps.html |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 113 | * |
| 114 | * NO TRAILING SLASH! |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 115 | */ |
Phil Sturgeon | d88b315 | 2011-02-02 21:19:25 +0000 | [diff] [blame] | 116 | $application_folder = 'application'; |
Andrey Andreev | 282592c | 2012-01-08 01:01:55 +0200 | [diff] [blame] | 117 | |
Joe Cianflone | 8eef9c7 | 2011-08-21 10:39:06 -0400 | [diff] [blame] | 118 | /* |
| 119 | *--------------------------------------------------------------- |
| 120 | * VIEW FOLDER NAME |
| 121 | *--------------------------------------------------------------- |
Andrey Andreev | 282592c | 2012-01-08 01:01:55 +0200 | [diff] [blame] | 122 | * |
| 123 | * If you want to move the view folder out of the application |
Joe Cianflone | 8eef9c7 | 2011-08-21 10:39:06 -0400 | [diff] [blame] | 124 | * folder set the path to the folder here. The folder can be renamed |
Andrey Andreev | 282592c | 2012-01-08 01:01:55 +0200 | [diff] [blame] | 125 | * 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. |
Joe Cianflone | 8eef9c7 | 2011-08-21 10:39:06 -0400 | [diff] [blame] | 128 | * |
| 129 | * NO TRAILING SLASH! |
Joe Cianflone | 8eef9c7 | 2011-08-21 10:39:06 -0400 | [diff] [blame] | 130 | */ |
Andrey Andreev | 282592c | 2012-01-08 01:01:55 +0200 | [diff] [blame] | 131 | $view_folder = ''; |
Joe Cianflone | 8eef9c7 | 2011-08-21 10:39:06 -0400 | [diff] [blame] | 132 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 133 | |
| 134 | /* |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 135 | * -------------------------------------------------------------------- |
| 136 | * DEFAULT CONTROLLER |
| 137 | * -------------------------------------------------------------------- |
| 138 | * |
| 139 | * Normally you will set your default controller in the routes.php file. |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 140 | * You can, however, force a custom routing by hard-coding a |
Andrey Andreev | 282592c | 2012-01-08 01:01:55 +0200 | [diff] [blame] | 141 | * specific controller class/function here. For most applications, you |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 142 | * WILL NOT set your routing here, but it's an option for those |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 143 | * special instances where you might want to override the standard |
| 144 | * routing in a specific front controller that shares a common CI installation. |
| 145 | * |
Andrey Andreev | 282592c | 2012-01-08 01:01:55 +0200 | [diff] [blame] | 146 | * IMPORTANT: If you set the routing here, NO OTHER controller will be |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 147 | * callable. In essence, this preference limits your application to ONE |
Andrey Andreev | 282592c | 2012-01-08 01:01:55 +0200 | [diff] [blame] | 148 | * specific controller. Leave the function name blank if you need |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 149 | * to call functions dynamically via the URI. |
| 150 | * |
| 151 | * Un-comment the $routing array below to use this feature |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 152 | */ |
Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 153 | // The directory name, relative to the "controllers" folder. Leave blank |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 154 | // if your controller is not in a sub-folder within the "controllers" folder |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 155 | // $routing['directory'] = ''; |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 156 | |
vlakoff | e40e56f | 2012-07-15 12:57:38 +0200 | [diff] [blame] | 157 | // The controller class file name. Example: mycontroller |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 158 | // $routing['controller'] = ''; |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 159 | |
| 160 | // The controller function you wish to be called. |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 161 | // $routing['function'] = ''; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 162 | |
| 163 | |
| 164 | /* |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 165 | * ------------------------------------------------------------------- |
Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 166 | * CUSTOM CONFIG VALUES |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 167 | * ------------------------------------------------------------------- |
| 168 | * |
| 169 | * The $assign_to_config array below will be passed dynamically to the |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 170 | * config class when initialized. This allows you to set custom config |
| 171 | * items or override any default config values found in the config.php file. |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 172 | * This can be handy as it permits you to share one application between |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 173 | * multiple front controller files, with each file containing different |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 174 | * config values. |
| 175 | * |
| 176 | * Un-comment the $assign_to_config array below to use this feature |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 177 | */ |
| 178 | // $assign_to_config['name_of_config_item'] = 'value of config item'; |
| 179 | |
| 180 | |
| 181 | |
| 182 | // -------------------------------------------------------------------- |
Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 183 | // END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 184 | // -------------------------------------------------------------------- |
| 185 | |
joelcox | bf2b912 | 2011-01-16 15:24:43 +0100 | [diff] [blame] | 186 | /* |
| 187 | * --------------------------------------------------------------- |
Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 188 | * Resolve the system path for increased reliability |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 189 | * --------------------------------------------------------------- |
| 190 | */ |
Phil Sturgeon | 01d1a5b | 2011-02-07 10:54:06 +0000 | [diff] [blame] | 191 | |
| 192 | // Set the current directory correctly for CLI requests |
| 193 | if (defined('STDIN')) |
| 194 | { |
| 195 | chdir(dirname(__FILE__)); |
| 196 | } |
| 197 | |
Andrey Andreev | 806ca60 | 2012-06-12 12:51:27 +0300 | [diff] [blame] | 198 | if (($_temp = realpath($system_path)) !== FALSE) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 199 | { |
Andrey Andreev | 806ca60 | 2012-06-12 12:51:27 +0300 | [diff] [blame] | 200 | $system_path = $_temp.'/'; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 201 | } |
Andrey Andreev | 079fbfc | 2012-06-12 02:26:58 +0300 | [diff] [blame] | 202 | else |
| 203 | { |
| 204 | // Ensure there's a trailing slash |
| 205 | $system_path = rtrim($system_path, '/').'/'; |
| 206 | } |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 207 | |
Derek Jones | eba3508 | 2010-03-22 10:43:56 -0500 | [diff] [blame] | 208 | // Is the system path correct? |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 209 | if ( ! is_dir($system_path)) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 210 | { |
Andrey Andreev | 806ca60 | 2012-06-12 12:51:27 +0300 | [diff] [blame] | 211 | header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); |
Daniel Hunsaker | 3b5b7f4 | 2013-02-22 19:17:56 -0700 | [diff] [blame] | 212 | echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.pathinfo(__FILE__, PATHINFO_BASENAME); |
Andrey Andreev | 7cf682a | 2014-03-13 14:55:45 +0200 | [diff] [blame] | 213 | exit(3); // EXIT_CONFIG |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 214 | } |
| 215 | |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 216 | /* |
| 217 | * ------------------------------------------------------------------- |
Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 218 | * Now that we know the path, set the main path constants |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 219 | * ------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 220 | */ |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 221 | // The name of THIS file |
| 222 | define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME)); |
| 223 | |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 224 | // Path to the system folder |
Andrey Andreev | 282592c | 2012-01-08 01:01:55 +0200 | [diff] [blame] | 225 | define('BASEPATH', str_replace('\\', '/', $system_path)); |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 226 | |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 227 | // Path to the front controller (this file) |
Andrey Andreev | 514896e | 2015-02-05 16:03:25 +0200 | [diff] [blame] | 228 | define('FCPATH', dirname(__FILE__).'/'); |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 229 | |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 230 | // Name of the "system folder" |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 231 | define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/')); |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 232 | |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 233 | // The path to the "application" folder |
| 234 | if (is_dir($application_folder)) |
| 235 | { |
Andrey Andreev | cce9180 | 2012-06-12 13:25:31 +0300 | [diff] [blame] | 236 | if (($_temp = realpath($application_folder)) !== FALSE) |
Andrey Andreev | 079fbfc | 2012-06-12 02:26:58 +0300 | [diff] [blame] | 237 | { |
Andrey Andreev | 806ca60 | 2012-06-12 12:51:27 +0300 | [diff] [blame] | 238 | $application_folder = $_temp; |
Andrey Andreev | 079fbfc | 2012-06-12 02:26:58 +0300 | [diff] [blame] | 239 | } |
| 240 | |
Andrey Andreev | 9f417d0 | 2013-10-14 12:24:36 +0300 | [diff] [blame] | 241 | define('APPPATH', $application_folder.DIRECTORY_SEPARATOR); |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 242 | } |
| 243 | else |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 244 | { |
Andrey Andreev | 9f417d0 | 2013-10-14 12:24:36 +0300 | [diff] [blame] | 245 | if ( ! is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR)) |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 246 | { |
Andrey Andreev | 806ca60 | 2012-06-12 12:51:27 +0300 | [diff] [blame] | 247 | header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); |
Daniel Hunsaker | 3b5b7f4 | 2013-02-22 19:17:56 -0700 | [diff] [blame] | 248 | echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF; |
Andrey Andreev | 7cf682a | 2014-03-13 14:55:45 +0200 | [diff] [blame] | 249 | exit(3); // EXIT_CONFIG |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 250 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 251 | |
Andrey Andreev | 9f417d0 | 2013-10-14 12:24:36 +0300 | [diff] [blame] | 252 | define('APPPATH', BASEPATH.$application_folder.DIRECTORY_SEPARATOR); |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 253 | } |
Andrey Andreev | 282592c | 2012-01-08 01:01:55 +0200 | [diff] [blame] | 254 | |
Joe Cianflone | 8eef9c7 | 2011-08-21 10:39:06 -0400 | [diff] [blame] | 255 | // The path to the "views" folder |
Andrey Andreev | 079fbfc | 2012-06-12 02:26:58 +0300 | [diff] [blame] | 256 | if ( ! is_dir($view_folder)) |
Joe Cianflone | 8eef9c7 | 2011-08-21 10:39:06 -0400 | [diff] [blame] | 257 | { |
Andrey Andreev | 9f417d0 | 2013-10-14 12:24:36 +0300 | [diff] [blame] | 258 | if ( ! empty($view_folder) && is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR)) |
Andrey Andreev | 079fbfc | 2012-06-12 02:26:58 +0300 | [diff] [blame] | 259 | { |
| 260 | $view_folder = APPPATH.$view_folder; |
| 261 | } |
Andrey Andreev | 9f417d0 | 2013-10-14 12:24:36 +0300 | [diff] [blame] | 262 | elseif ( ! is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR)) |
Joe Cianflone | 8eef9c7 | 2011-08-21 10:39:06 -0400 | [diff] [blame] | 263 | { |
Andrey Andreev | 806ca60 | 2012-06-12 12:51:27 +0300 | [diff] [blame] | 264 | header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); |
Daniel Hunsaker | 3b5b7f4 | 2013-02-22 19:17:56 -0700 | [diff] [blame] | 265 | echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF; |
Andrey Andreev | 7cf682a | 2014-03-13 14:55:45 +0200 | [diff] [blame] | 266 | exit(3); // EXIT_CONFIG |
Joe Cianflone | 8eef9c7 | 2011-08-21 10:39:06 -0400 | [diff] [blame] | 267 | } |
Andrey Andreev | 079fbfc | 2012-06-12 02:26:58 +0300 | [diff] [blame] | 268 | else |
| 269 | { |
| 270 | $view_folder = APPPATH.'views'; |
| 271 | } |
Joe Cianflone | 8eef9c7 | 2011-08-21 10:39:06 -0400 | [diff] [blame] | 272 | } |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 273 | |
Andrey Andreev | 806ca60 | 2012-06-12 12:51:27 +0300 | [diff] [blame] | 274 | if (($_temp = realpath($view_folder)) !== FALSE) |
Andrey Andreev | 079fbfc | 2012-06-12 02:26:58 +0300 | [diff] [blame] | 275 | { |
Andrey Andreev | 9f417d0 | 2013-10-14 12:24:36 +0300 | [diff] [blame] | 276 | $view_folder = $_temp.DIRECTORY_SEPARATOR; |
Andrey Andreev | 079fbfc | 2012-06-12 02:26:58 +0300 | [diff] [blame] | 277 | } |
| 278 | else |
| 279 | { |
Andrey Andreev | 9f417d0 | 2013-10-14 12:24:36 +0300 | [diff] [blame] | 280 | $view_folder = rtrim($view_folder, '/\\').DIRECTORY_SEPARATOR; |
Andrey Andreev | 079fbfc | 2012-06-12 02:26:58 +0300 | [diff] [blame] | 281 | } |
| 282 | |
Andrey Andreev | cce9180 | 2012-06-12 13:25:31 +0300 | [diff] [blame] | 283 | define('VIEWPATH', $view_folder); |
Andrey Andreev | 079fbfc | 2012-06-12 02:26:58 +0300 | [diff] [blame] | 284 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 285 | /* |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 286 | * -------------------------------------------------------------------- |
| 287 | * LOAD THE BOOTSTRAP FILE |
| 288 | * -------------------------------------------------------------------- |
| 289 | * |
| 290 | * And away we go... |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 291 | */ |
Greg Aker | 3a74665 | 2011-04-19 10:59:47 -0500 | [diff] [blame] | 292 | require_once BASEPATH.'core/CodeIgniter.php'; |