blob: a52a021ec62f0536529ff6082405aea95bee006e [file] [log] [blame]
Derek Allard2067d1a2008-11-13 22:59:24 +00001<?php
Derek Jonesf4a4bd82011-10-20 12:18:42 -05002/**
3 * CodeIgniter
4 *
Phil Sturgeon07c1ac82012-03-09 17:03:37 +00005 * An open source application development framework for PHP 5.2.4 or newer
Derek Jonesf4a4bd82011-10-20 12:18:42 -05006 *
7 * NOTICE OF LICENSE
Andrey Andreev282592c2012-01-08 01:01:55 +02008 *
Derek Jonesf4a4bd82011-10-20 12:18:42 -05009 * Licensed under the Open Software License version 3.0
Andrey Andreev282592c2012-01-08 01:01:55 +020010 *
Derek Jonesf4a4bd82011-10-20 12:18:42 -050011 * This source file is subject to the Open Software License (OSL 3.0) that is
12 * bundled with this package in the files license.txt / license.rst. It is
13 * also available through the world wide web at this URL:
14 * http://opensource.org/licenses/OSL-3.0
15 * If you did not receive a copy of the license and are unable to obtain it
16 * through the world wide web, please send an email to
17 * licensing@ellislab.com so we can send you a copy immediately.
18 *
19 * @package CodeIgniter
20 * @author EllisLab Dev Team
Andrey Andreev80500af2013-01-01 08:16:53 +020021 * @copyright Copyright (c) 2008 - 2013, EllisLab, Inc. (http://ellislab.com/)
Derek Jonesf4a4bd82011-10-20 12:18:42 -050022 * @license http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
23 * @link http://codeigniter.com
24 * @since Version 1.0
25 * @filesource
26 */
Derek Jones0c1e4052010-03-02 14:31:31 -060027
Derek Allard2067d1a2008-11-13 22:59:24 +000028/*
Derek Jones0c1e4052010-03-02 14:31:31 -060029 *---------------------------------------------------------------
joelcoxcee80752011-01-15 23:09:47 +010030 * APPLICATION ENVIRONMENT
31 *---------------------------------------------------------------
32 *
33 * You can load different configurations depending on your
joelcoxbf2b9122011-01-16 15:24:43 +010034 * current environment. Setting the environment also influences
Phil Sturgeond88b3152011-02-02 21:19:25 +000035 * things like logging and error reporting.
36 *
37 * This can be set to anything, but default usage is:
38 *
Derek Jones4b9c6292011-07-01 17:40:48 -050039 * development
40 * testing
41 * production
Phil Sturgeond88b3152011-02-02 21:19:25 +000042 *
43 * NOTE: If you change these, also change the error_reporting() code below
joelcoxcee80752011-01-15 23:09:47 +010044 */
Phil Sturgeondda21f62012-06-03 10:36:36 -050045 define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');
vlakofffe832492012-07-13 20:40:06 +020046
Phil Sturgeond88b3152011-02-02 21:19:25 +000047/*
48 *---------------------------------------------------------------
49 * ERROR REPORTING
50 *---------------------------------------------------------------
51 *
52 * Different environments will require different levels of error reporting.
53 * By default development will show errors but testing and live will hide them.
54 */
Root35ac46d2012-05-25 18:51:48 -040055switch (ENVIRONMENT)
Phil Sturgeon05fa6112011-04-06 22:57:43 +010056{
Root35ac46d2012-05-25 18:51:48 -040057 case 'development':
Gints Murans8d021e62012-05-30 21:15:08 +030058 error_reporting(-1);
Root35ac46d2012-05-25 18:51:48 -040059 ini_set('display_errors', 1);
60 break;
61
62 case 'testing':
63 case 'production':
Root3cc85022012-05-27 20:06:10 -040064 error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_STRICT);
Root35ac46d2012-05-25 18:51:48 -040065 ini_set('display_errors', 0);
66 break;
67
68 default:
Andrey Andreevcbb654d2012-07-10 11:36:32 +030069 header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
Daniel Hunsaker3b5b7f42013-02-22 19:17:56 -070070 echo 'The application environment is not set correctly.';
71 exit(1); // EXIT_* constants not yet defined; 1 is EXIT_FAILURE, a generic error.
Phil Sturgeon05fa6112011-04-06 22:57:43 +010072}
joelcoxcee80752011-01-15 23:09:47 +010073
74/*
75 *---------------------------------------------------------------
Derek Jones0c1e4052010-03-02 14:31:31 -060076 * SYSTEM FOLDER NAME
77 *---------------------------------------------------------------
78 *
79 * This variable must contain the name of your "system" folder.
Derek Jones4b9c6292011-07-01 17:40:48 -050080 * Include the path if the folder is not in the same directory
Derek Jones0c1e4052010-03-02 14:31:31 -060081 * as this file.
Derek Jones0c1e4052010-03-02 14:31:31 -060082 */
Phil Sturgeond88b3152011-02-02 21:19:25 +000083 $system_path = 'system';
Derek Allard2067d1a2008-11-13 22:59:24 +000084
85/*
Derek Jones0c1e4052010-03-02 14:31:31 -060086 *---------------------------------------------------------------
87 * APPLICATION FOLDER NAME
88 *---------------------------------------------------------------
89 *
90 * If you want this front controller to use a different "application"
Adam Carmichaele90b8302013-01-04 01:04:29 +110091 * folder than the default one you can set its name here. The folder
Andrey Andreev282592c2012-01-08 01:01:55 +020092 * can also be renamed or relocated anywhere on your server. If
Derek Jones0c1e4052010-03-02 14:31:31 -060093 * you do, use a full server path. For more info please see the user guide:
94 * http://codeigniter.com/user_guide/general/managing_apps.html
95 *
96 * NO TRAILING SLASH!
Derek Jones0c1e4052010-03-02 14:31:31 -060097 */
Phil Sturgeond88b3152011-02-02 21:19:25 +000098 $application_folder = 'application';
Andrey Andreev282592c2012-01-08 01:01:55 +020099
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400100/*
101 *---------------------------------------------------------------
102 * VIEW FOLDER NAME
103 *---------------------------------------------------------------
Andrey Andreev282592c2012-01-08 01:01:55 +0200104 *
105 * If you want to move the view folder out of the application
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400106 * folder set the path to the folder here. The folder can be renamed
Andrey Andreev282592c2012-01-08 01:01:55 +0200107 * and relocated anywhere on your server. If blank, it will default
108 * to the standard location inside your application folder. If you
109 * do move this, use the full server path to this folder.
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400110 *
111 * NO TRAILING SLASH!
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400112 */
Andrey Andreev282592c2012-01-08 01:01:55 +0200113 $view_folder = '';
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400114
Derek Allard2067d1a2008-11-13 22:59:24 +0000115
116/*
Derek Jones0c1e4052010-03-02 14:31:31 -0600117 * --------------------------------------------------------------------
118 * DEFAULT CONTROLLER
119 * --------------------------------------------------------------------
120 *
121 * Normally you will set your default controller in the routes.php file.
Barry Mienydd671972010-10-04 16:33:58 +0200122 * You can, however, force a custom routing by hard-coding a
Andrey Andreev282592c2012-01-08 01:01:55 +0200123 * specific controller class/function here. For most applications, you
Barry Mienydd671972010-10-04 16:33:58 +0200124 * WILL NOT set your routing here, but it's an option for those
Derek Jones0c1e4052010-03-02 14:31:31 -0600125 * special instances where you might want to override the standard
126 * routing in a specific front controller that shares a common CI installation.
127 *
Andrey Andreev282592c2012-01-08 01:01:55 +0200128 * IMPORTANT: If you set the routing here, NO OTHER controller will be
Derek Jones0c1e4052010-03-02 14:31:31 -0600129 * callable. In essence, this preference limits your application to ONE
Andrey Andreev282592c2012-01-08 01:01:55 +0200130 * specific controller. Leave the function name blank if you need
Derek Jones0c1e4052010-03-02 14:31:31 -0600131 * to call functions dynamically via the URI.
132 *
133 * Un-comment the $routing array below to use this feature
Derek Jones0c1e4052010-03-02 14:31:31 -0600134 */
Derek Jones4b9c6292011-07-01 17:40:48 -0500135 // The directory name, relative to the "controllers" folder. Leave blank
Barry Mienydd671972010-10-04 16:33:58 +0200136 // if your controller is not in a sub-folder within the "controllers" folder
Derek Jones0c1e4052010-03-02 14:31:31 -0600137 // $routing['directory'] = '';
Barry Mienydd671972010-10-04 16:33:58 +0200138
vlakoffe40e56f2012-07-15 12:57:38 +0200139 // The controller class file name. Example: mycontroller
Derek Jones0c1e4052010-03-02 14:31:31 -0600140 // $routing['controller'] = '';
Barry Mienydd671972010-10-04 16:33:58 +0200141
142 // The controller function you wish to be called.
Derek Jones0c1e4052010-03-02 14:31:31 -0600143 // $routing['function'] = '';
Derek Allard2067d1a2008-11-13 22:59:24 +0000144
145
146/*
Derek Jones0c1e4052010-03-02 14:31:31 -0600147 * -------------------------------------------------------------------
Derek Jones4b9c6292011-07-01 17:40:48 -0500148 * CUSTOM CONFIG VALUES
Derek Jones0c1e4052010-03-02 14:31:31 -0600149 * -------------------------------------------------------------------
150 *
151 * The $assign_to_config array below will be passed dynamically to the
Barry Mienydd671972010-10-04 16:33:58 +0200152 * config class when initialized. This allows you to set custom config
153 * items or override any default config values found in the config.php file.
Derek Jones0c1e4052010-03-02 14:31:31 -0600154 * This can be handy as it permits you to share one application between
Barry Mienydd671972010-10-04 16:33:58 +0200155 * multiple front controller files, with each file containing different
Derek Jones0c1e4052010-03-02 14:31:31 -0600156 * config values.
157 *
158 * Un-comment the $assign_to_config array below to use this feature
Derek Jones0c1e4052010-03-02 14:31:31 -0600159 */
160 // $assign_to_config['name_of_config_item'] = 'value of config item';
161
162
163
164// --------------------------------------------------------------------
Derek Jones4b9c6292011-07-01 17:40:48 -0500165// END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE
Derek Jones0c1e4052010-03-02 14:31:31 -0600166// --------------------------------------------------------------------
167
joelcoxbf2b9122011-01-16 15:24:43 +0100168/*
169 * ---------------------------------------------------------------
Derek Jones4b9c6292011-07-01 17:40:48 -0500170 * Resolve the system path for increased reliability
Derek Jones0c1e4052010-03-02 14:31:31 -0600171 * ---------------------------------------------------------------
172 */
Phil Sturgeon01d1a5b2011-02-07 10:54:06 +0000173
174 // Set the current directory correctly for CLI requests
175 if (defined('STDIN'))
176 {
177 chdir(dirname(__FILE__));
178 }
179
Andrey Andreev806ca602012-06-12 12:51:27 +0300180 if (($_temp = realpath($system_path)) !== FALSE)
Derek Allard2067d1a2008-11-13 22:59:24 +0000181 {
Andrey Andreev806ca602012-06-12 12:51:27 +0300182 $system_path = $_temp.'/';
Derek Allard2067d1a2008-11-13 22:59:24 +0000183 }
Andrey Andreev079fbfc2012-06-12 02:26:58 +0300184 else
185 {
186 // Ensure there's a trailing slash
187 $system_path = rtrim($system_path, '/').'/';
188 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000189
Derek Joneseba35082010-03-22 10:43:56 -0500190 // Is the system path correct?
Derek Jones0c1e4052010-03-02 14:31:31 -0600191 if ( ! is_dir($system_path))
Derek Allard2067d1a2008-11-13 22:59:24 +0000192 {
Andrey Andreev806ca602012-06-12 12:51:27 +0300193 header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
Daniel Hunsaker3b5b7f42013-02-22 19:17:56 -0700194 echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.pathinfo(__FILE__, PATHINFO_BASENAME);
195 exit(3); // EXIT_* constants not yet defined; 3 is EXIT_CONFIG.
Derek Allard2067d1a2008-11-13 22:59:24 +0000196 }
197
Derek Jones0c1e4052010-03-02 14:31:31 -0600198/*
199 * -------------------------------------------------------------------
Derek Jones4b9c6292011-07-01 17:40:48 -0500200 * Now that we know the path, set the main path constants
Derek Jones0c1e4052010-03-02 14:31:31 -0600201 * -------------------------------------------------------------------
Barry Mienydd671972010-10-04 16:33:58 +0200202 */
Derek Jones0c1e4052010-03-02 14:31:31 -0600203 // The name of THIS file
204 define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
205
Barry Mienydd671972010-10-04 16:33:58 +0200206 // Path to the system folder
Andrey Andreev282592c2012-01-08 01:01:55 +0200207 define('BASEPATH', str_replace('\\', '/', $system_path));
Barry Mienydd671972010-10-04 16:33:58 +0200208
Derek Jones0c1e4052010-03-02 14:31:31 -0600209 // Path to the front controller (this file)
210 define('FCPATH', str_replace(SELF, '', __FILE__));
Barry Mienydd671972010-10-04 16:33:58 +0200211
Derek Jones0c1e4052010-03-02 14:31:31 -0600212 // Name of the "system folder"
Barry Mienydd671972010-10-04 16:33:58 +0200213 define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/'));
Derek Jones0c1e4052010-03-02 14:31:31 -0600214
Derek Jones0c1e4052010-03-02 14:31:31 -0600215 // The path to the "application" folder
216 if (is_dir($application_folder))
217 {
Andrey Andreevcce91802012-06-12 13:25:31 +0300218 if (($_temp = realpath($application_folder)) !== FALSE)
Andrey Andreev079fbfc2012-06-12 02:26:58 +0300219 {
Andrey Andreev806ca602012-06-12 12:51:27 +0300220 $application_folder = $_temp;
Andrey Andreev079fbfc2012-06-12 02:26:58 +0300221 }
222
Derek Jones0c1e4052010-03-02 14:31:31 -0600223 define('APPPATH', $application_folder.'/');
224 }
225 else
Barry Mienydd671972010-10-04 16:33:58 +0200226 {
Derek Jones0c1e4052010-03-02 14:31:31 -0600227 if ( ! is_dir(BASEPATH.$application_folder.'/'))
228 {
Andrey Andreev806ca602012-06-12 12:51:27 +0300229 header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
Daniel Hunsaker3b5b7f42013-02-22 19:17:56 -0700230 echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
231 exit(3); // EXIT_* constants not yet defined; 3 is EXIT_CONFIG.
Derek Jones0c1e4052010-03-02 14:31:31 -0600232 }
Barry Mienydd671972010-10-04 16:33:58 +0200233
Derek Jones0c1e4052010-03-02 14:31:31 -0600234 define('APPPATH', BASEPATH.$application_folder.'/');
235 }
Andrey Andreev282592c2012-01-08 01:01:55 +0200236
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400237 // The path to the "views" folder
Andrey Andreev079fbfc2012-06-12 02:26:58 +0300238 if ( ! is_dir($view_folder))
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400239 {
Andrey Andreev079fbfc2012-06-12 02:26:58 +0300240 if ( ! empty($view_folder) && is_dir(APPPATH.$view_folder.'/'))
241 {
242 $view_folder = APPPATH.$view_folder;
243 }
244 elseif ( ! is_dir(APPPATH.'views/'))
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400245 {
Andrey Andreev806ca602012-06-12 12:51:27 +0300246 header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
Daniel Hunsaker3b5b7f42013-02-22 19:17:56 -0700247 echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
248 exit(3); // EXIT_* constants not yet defined; 3 is EXIT_CONFIG.
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400249 }
Andrey Andreev079fbfc2012-06-12 02:26:58 +0300250 else
251 {
252 $view_folder = APPPATH.'views';
253 }
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400254 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000255
Andrey Andreev806ca602012-06-12 12:51:27 +0300256 if (($_temp = realpath($view_folder)) !== FALSE)
Andrey Andreev079fbfc2012-06-12 02:26:58 +0300257 {
258 $view_folder = realpath($view_folder).'/';
259 }
260 else
261 {
262 $view_folder = rtrim($view_folder, '/').'/';
263 }
264
Andrey Andreevcce91802012-06-12 13:25:31 +0300265 define('VIEWPATH', $view_folder);
Andrey Andreev079fbfc2012-06-12 02:26:58 +0300266
Derek Allard2067d1a2008-11-13 22:59:24 +0000267/*
Derek Jones0c1e4052010-03-02 14:31:31 -0600268 * --------------------------------------------------------------------
269 * LOAD THE BOOTSTRAP FILE
270 * --------------------------------------------------------------------
271 *
272 * And away we go...
Derek Jones0c1e4052010-03-02 14:31:31 -0600273 */
Greg Aker3a746652011-04-19 10:59:47 -0500274require_once BASEPATH.'core/CodeIgniter.php';
Derek Jones3b890ba2010-02-17 18:13:15 -0600275
Derek Allard2067d1a2008-11-13 22:59:24 +0000276/* End of file index.php */
Andrey Andreev282592c2012-01-08 01:01:55 +0200277/* Location: ./index.php */