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