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