Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 1 | <?php |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 2 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 3 | /* |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 4 | *--------------------------------------------------------------- |
joelcox | cee8075 | 2011-01-15 23:09:47 +0100 | [diff] [blame] | 5 | * APPLICATION ENVIRONMENT |
| 6 | *--------------------------------------------------------------- |
| 7 | * |
| 8 | * You can load different configurations depending on your |
joelcox | bf2b912 | 2011-01-16 15:24:43 +0100 | [diff] [blame] | 9 | * current environment. Setting the environment also influences |
Phil Sturgeon | d88b315 | 2011-02-02 21:19:25 +0000 | [diff] [blame] | 10 | * things like logging and error reporting. |
| 11 | * |
| 12 | * This can be set to anything, but default usage is: |
| 13 | * |
Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 14 | * development |
| 15 | * testing |
| 16 | * production |
Phil Sturgeon | d88b315 | 2011-02-02 21:19:25 +0000 | [diff] [blame] | 17 | * |
| 18 | * NOTE: If you change these, also change the error_reporting() code below |
joelcox | cee8075 | 2011-01-15 23:09:47 +0100 | [diff] [blame] | 19 | * |
| 20 | */ |
| 21 | define('ENVIRONMENT', 'development'); |
Phil Sturgeon | d88b315 | 2011-02-02 21:19:25 +0000 | [diff] [blame] | 22 | /* |
| 23 | *--------------------------------------------------------------- |
| 24 | * ERROR REPORTING |
| 25 | *--------------------------------------------------------------- |
| 26 | * |
| 27 | * Different environments will require different levels of error reporting. |
| 28 | * By default development will show errors but testing and live will hide them. |
| 29 | */ |
| 30 | |
Phil Sturgeon | 05fa611 | 2011-04-06 22:57:43 +0100 | [diff] [blame] | 31 | if (defined('ENVIRONMENT')) |
| 32 | { |
Phil Sturgeon | d88b315 | 2011-02-02 21:19:25 +0000 | [diff] [blame] | 33 | switch (ENVIRONMENT) |
| 34 | { |
| 35 | case 'development': |
Dan Horrigan | 0e95b8b | 2011-08-21 09:34:02 -0400 | [diff] [blame] | 36 | error_reporting(-1); |
Timothy Warren | 233b671 | 2011-10-13 11:56:44 -0300 | [diff] [blame^] | 37 | define('SHOW_ERROR_BACKTRACE', TRUE); |
Phil Sturgeon | d88b315 | 2011-02-02 21:19:25 +0000 | [diff] [blame] | 38 | break; |
Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 39 | |
Phil Sturgeon | d88b315 | 2011-02-02 21:19:25 +0000 | [diff] [blame] | 40 | case 'testing': |
| 41 | case 'production': |
| 42 | error_reporting(0); |
| 43 | break; |
| 44 | |
| 45 | default: |
| 46 | exit('The application environment is not set correctly.'); |
| 47 | } |
Phil Sturgeon | 05fa611 | 2011-04-06 22:57:43 +0100 | [diff] [blame] | 48 | } |
joelcox | cee8075 | 2011-01-15 23:09:47 +0100 | [diff] [blame] | 49 | |
| 50 | /* |
| 51 | *--------------------------------------------------------------- |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 52 | * SYSTEM FOLDER NAME |
| 53 | *--------------------------------------------------------------- |
| 54 | * |
| 55 | * This variable must contain the name of your "system" folder. |
Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 56 | * Include the path if the folder is not in the same directory |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 57 | * as this file. |
| 58 | * |
| 59 | */ |
Phil Sturgeon | d88b315 | 2011-02-02 21:19:25 +0000 | [diff] [blame] | 60 | $system_path = 'system'; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 61 | |
| 62 | /* |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 63 | *--------------------------------------------------------------- |
| 64 | * APPLICATION FOLDER NAME |
| 65 | *--------------------------------------------------------------- |
| 66 | * |
| 67 | * If you want this front controller to use a different "application" |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 68 | * folder then the default one you can set its name here. The folder |
Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 69 | * can also be renamed or relocated anywhere on your server. If |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 70 | * you do, use a full server path. For more info please see the user guide: |
| 71 | * http://codeigniter.com/user_guide/general/managing_apps.html |
| 72 | * |
| 73 | * NO TRAILING SLASH! |
| 74 | * |
| 75 | */ |
Phil Sturgeon | d88b315 | 2011-02-02 21:19:25 +0000 | [diff] [blame] | 76 | $application_folder = 'application'; |
Joe Cianflone | 8eef9c7 | 2011-08-21 10:39:06 -0400 | [diff] [blame] | 77 | |
| 78 | /* |
| 79 | *--------------------------------------------------------------- |
| 80 | * VIEW FOLDER NAME |
| 81 | *--------------------------------------------------------------- |
| 82 | * |
| 83 | * If you want to move the view folder out of the application |
| 84 | * folder set the path to the folder here. The folder can be renamed |
| 85 | * and relocated anywhere on your server. If blank, it will default |
| 86 | * to the standard location inside your application folder. If you |
| 87 | * do move this, use the full server path to this folder |
| 88 | * |
| 89 | * NO TRAILING SLASH! |
| 90 | * |
| 91 | */ |
| 92 | $view_folder = ''; |
| 93 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 94 | |
| 95 | /* |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 96 | * -------------------------------------------------------------------- |
| 97 | * DEFAULT CONTROLLER |
| 98 | * -------------------------------------------------------------------- |
| 99 | * |
| 100 | * Normally you will set your default controller in the routes.php file. |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 101 | * You can, however, force a custom routing by hard-coding a |
Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 102 | * specific controller class/function here. For most applications, you |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 103 | * 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] | 104 | * special instances where you might want to override the standard |
| 105 | * routing in a specific front controller that shares a common CI installation. |
| 106 | * |
Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 107 | * IMPORTANT: If you set the routing here, NO OTHER controller will be |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 108 | * callable. In essence, this preference limits your application to ONE |
Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 109 | * specific controller. Leave the function name blank if you need |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 110 | * to call functions dynamically via the URI. |
| 111 | * |
| 112 | * Un-comment the $routing array below to use this feature |
| 113 | * |
| 114 | */ |
Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 115 | // The directory name, relative to the "controllers" folder. Leave blank |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 116 | // 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] | 117 | // $routing['directory'] = ''; |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 118 | |
Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 119 | // The controller class file name. Example: Mycontroller |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 120 | // $routing['controller'] = ''; |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 121 | |
| 122 | // The controller function you wish to be called. |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 123 | // $routing['function'] = ''; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 124 | |
| 125 | |
| 126 | /* |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 127 | * ------------------------------------------------------------------- |
Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 128 | * CUSTOM CONFIG VALUES |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 129 | * ------------------------------------------------------------------- |
| 130 | * |
| 131 | * The $assign_to_config array below will be passed dynamically to the |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 132 | * config class when initialized. This allows you to set custom config |
| 133 | * 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] | 134 | * 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] | 135 | * multiple front controller files, with each file containing different |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 136 | * config values. |
| 137 | * |
| 138 | * Un-comment the $assign_to_config array below to use this feature |
| 139 | * |
| 140 | */ |
| 141 | // $assign_to_config['name_of_config_item'] = 'value of config item'; |
| 142 | |
| 143 | |
| 144 | |
| 145 | // -------------------------------------------------------------------- |
Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 146 | // END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 147 | // -------------------------------------------------------------------- |
| 148 | |
joelcox | bf2b912 | 2011-01-16 15:24:43 +0100 | [diff] [blame] | 149 | /* |
| 150 | * --------------------------------------------------------------- |
Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 151 | * Resolve the system path for increased reliability |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 152 | * --------------------------------------------------------------- |
| 153 | */ |
Phil Sturgeon | 01d1a5b | 2011-02-07 10:54:06 +0000 | [diff] [blame] | 154 | |
| 155 | // Set the current directory correctly for CLI requests |
| 156 | if (defined('STDIN')) |
| 157 | { |
| 158 | chdir(dirname(__FILE__)); |
| 159 | } |
| 160 | |
Greg Aker | 0846d74 | 2010-04-08 11:47:33 -0500 | [diff] [blame] | 161 | if (realpath($system_path) !== FALSE) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 162 | { |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 163 | $system_path = realpath($system_path).'/'; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 164 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 165 | |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 166 | // ensure there's a trailing slash |
| 167 | $system_path = rtrim($system_path, '/').'/'; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 168 | |
Derek Jones | eba3508 | 2010-03-22 10:43:56 -0500 | [diff] [blame] | 169 | // Is the system path correct? |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 170 | if ( ! is_dir($system_path)) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 171 | { |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 172 | exit("Your system folder path does not appear to be set correctly. Please open the following file and correct this: ".pathinfo(__FILE__, PATHINFO_BASENAME)); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 173 | } |
| 174 | |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 175 | /* |
| 176 | * ------------------------------------------------------------------- |
Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 177 | * Now that we know the path, set the main path constants |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 178 | * ------------------------------------------------------------------- |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 179 | */ |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 180 | // The name of THIS file |
| 181 | define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME)); |
| 182 | |
| 183 | // The PHP file extension |
Greg Aker | 3a74665 | 2011-04-19 10:59:47 -0500 | [diff] [blame] | 184 | // this global constant is deprecated. |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 185 | define('EXT', '.php'); |
| 186 | |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 187 | // Path to the system folder |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 188 | define('BASEPATH', str_replace("\\", "/", $system_path)); |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 189 | |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 190 | // Path to the front controller (this file) |
| 191 | define('FCPATH', str_replace(SELF, '', __FILE__)); |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 192 | |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 193 | // Name of the "system folder" |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 194 | define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/')); |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 195 | |
| 196 | |
| 197 | // The path to the "application" folder |
| 198 | if (is_dir($application_folder)) |
| 199 | { |
| 200 | define('APPPATH', $application_folder.'/'); |
| 201 | } |
| 202 | else |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 203 | { |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 204 | if ( ! is_dir(BASEPATH.$application_folder.'/')) |
| 205 | { |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 206 | exit("Your application folder path does not appear to be set correctly. Please open the following file and correct this: ".SELF); |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 207 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 208 | |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 209 | define('APPPATH', BASEPATH.$application_folder.'/'); |
| 210 | } |
Joe Cianflone | 8eef9c7 | 2011-08-21 10:39:06 -0400 | [diff] [blame] | 211 | |
| 212 | // The path to the "views" folder |
| 213 | if (is_dir($view_folder)) |
| 214 | { |
| 215 | define ('VIEWPATH', $view_folder .'/'); |
| 216 | } |
| 217 | else |
| 218 | { |
| 219 | if ( ! is_dir(APPPATH.'views/')) |
| 220 | { |
| 221 | exit("Your view folder path does not appear to be set correctly. Please open the following file and correct this: ".SELF); |
| 222 | } |
| 223 | |
| 224 | define ('VIEWPATH', APPPATH.'views/' ); |
| 225 | } |
| 226 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 227 | |
| 228 | /* |
Derek Jones | 0c1e405 | 2010-03-02 14:31:31 -0600 | [diff] [blame] | 229 | * -------------------------------------------------------------------- |
| 230 | * LOAD THE BOOTSTRAP FILE |
| 231 | * -------------------------------------------------------------------- |
| 232 | * |
| 233 | * And away we go... |
| 234 | * |
| 235 | */ |
Greg Aker | 3a74665 | 2011-04-19 10:59:47 -0500 | [diff] [blame] | 236 | require_once BASEPATH.'core/CodeIgniter.php'; |
Derek Jones | 3b890ba | 2010-02-17 18:13:15 -0600 | [diff] [blame] | 237 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 238 | /* End of file index.php */ |
Derek Jones | a3ffbbb | 2008-05-11 18:18:29 +0000 | [diff] [blame] | 239 | /* Location: ./index.php */ |