blob: 380d1017b9cd3b74a0d7fa49f2fd0f436d0297d2 [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
Greg Aker0defe5d2012-01-01 18:46:41 -060021 * @copyright Copyright (c) 2008 - 2012, 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');
Phil Sturgeond88b3152011-02-02 21:19:25 +000046/*
47 *---------------------------------------------------------------
48 * ERROR REPORTING
49 *---------------------------------------------------------------
50 *
51 * Different environments will require different levels of error reporting.
52 * By default development will show errors but testing and live will hide them.
53 */
54
Phil Sturgeon05fa6112011-04-06 22:57:43 +010055if (defined('ENVIRONMENT'))
56{
Phil Sturgeond88b3152011-02-02 21:19:25 +000057 switch (ENVIRONMENT)
58 {
59 case 'development':
Dan Horrigan0e95b8b2011-08-21 09:34:02 -040060 error_reporting(-1);
Phil Sturgeond88b3152011-02-02 21:19:25 +000061 break;
Phil Sturgeond88b3152011-02-02 21:19:25 +000062 case 'testing':
63 case 'production':
64 error_reporting(0);
65 break;
Phil Sturgeond88b3152011-02-02 21:19:25 +000066 default:
67 exit('The application environment is not set correctly.');
68 }
Phil Sturgeon05fa6112011-04-06 22:57:43 +010069}
joelcoxcee80752011-01-15 23:09:47 +010070
71/*
72 *---------------------------------------------------------------
Derek Jones0c1e4052010-03-02 14:31:31 -060073 * SYSTEM FOLDER NAME
74 *---------------------------------------------------------------
75 *
76 * This variable must contain the name of your "system" folder.
Derek Jones4b9c6292011-07-01 17:40:48 -050077 * Include the path if the folder is not in the same directory
Derek Jones0c1e4052010-03-02 14:31:31 -060078 * as this file.
Derek Jones0c1e4052010-03-02 14:31:31 -060079 */
Phil Sturgeond88b3152011-02-02 21:19:25 +000080 $system_path = 'system';
Derek Allard2067d1a2008-11-13 22:59:24 +000081
82/*
Derek Jones0c1e4052010-03-02 14:31:31 -060083 *---------------------------------------------------------------
84 * APPLICATION FOLDER NAME
85 *---------------------------------------------------------------
86 *
87 * If you want this front controller to use a different "application"
Barry Mienydd671972010-10-04 16:33:58 +020088 * folder then the default one you can set its name here. The folder
Andrey Andreev282592c2012-01-08 01:01:55 +020089 * can also be renamed or relocated anywhere on your server. If
Derek Jones0c1e4052010-03-02 14:31:31 -060090 * you do, use a full server path. For more info please see the user guide:
91 * http://codeigniter.com/user_guide/general/managing_apps.html
92 *
93 * NO TRAILING SLASH!
Derek Jones0c1e4052010-03-02 14:31:31 -060094 */
Phil Sturgeond88b3152011-02-02 21:19:25 +000095 $application_folder = 'application';
Andrey Andreev282592c2012-01-08 01:01:55 +020096
Joe Cianflone8eef9c72011-08-21 10:39:06 -040097/*
98 *---------------------------------------------------------------
99 * VIEW FOLDER NAME
100 *---------------------------------------------------------------
Andrey Andreev282592c2012-01-08 01:01:55 +0200101 *
102 * If you want to move the view folder out of the application
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400103 * folder set the path to the folder here. The folder can be renamed
Andrey Andreev282592c2012-01-08 01:01:55 +0200104 * and relocated anywhere on your server. If blank, it will default
105 * to the standard location inside your application folder. If you
106 * do move this, use the full server path to this folder.
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400107 *
108 * NO TRAILING SLASH!
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400109 */
Andrey Andreev282592c2012-01-08 01:01:55 +0200110 $view_folder = '';
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400111
Derek Allard2067d1a2008-11-13 22:59:24 +0000112
113/*
Derek Jones0c1e4052010-03-02 14:31:31 -0600114 * --------------------------------------------------------------------
115 * DEFAULT CONTROLLER
116 * --------------------------------------------------------------------
117 *
118 * Normally you will set your default controller in the routes.php file.
Barry Mienydd671972010-10-04 16:33:58 +0200119 * You can, however, force a custom routing by hard-coding a
Andrey Andreev282592c2012-01-08 01:01:55 +0200120 * specific controller class/function here. For most applications, you
Barry Mienydd671972010-10-04 16:33:58 +0200121 * WILL NOT set your routing here, but it's an option for those
Derek Jones0c1e4052010-03-02 14:31:31 -0600122 * special instances where you might want to override the standard
123 * routing in a specific front controller that shares a common CI installation.
124 *
Andrey Andreev282592c2012-01-08 01:01:55 +0200125 * IMPORTANT: If you set the routing here, NO OTHER controller will be
Derek Jones0c1e4052010-03-02 14:31:31 -0600126 * callable. In essence, this preference limits your application to ONE
Andrey Andreev282592c2012-01-08 01:01:55 +0200127 * specific controller. Leave the function name blank if you need
Derek Jones0c1e4052010-03-02 14:31:31 -0600128 * to call functions dynamically via the URI.
129 *
130 * Un-comment the $routing array below to use this feature
Derek Jones0c1e4052010-03-02 14:31:31 -0600131 */
Derek Jones4b9c6292011-07-01 17:40:48 -0500132 // The directory name, relative to the "controllers" folder. Leave blank
Barry Mienydd671972010-10-04 16:33:58 +0200133 // if your controller is not in a sub-folder within the "controllers" folder
Derek Jones0c1e4052010-03-02 14:31:31 -0600134 // $routing['directory'] = '';
Barry Mienydd671972010-10-04 16:33:58 +0200135
Derek Jones4b9c6292011-07-01 17:40:48 -0500136 // The controller class file name. Example: Mycontroller
Derek Jones0c1e4052010-03-02 14:31:31 -0600137 // $routing['controller'] = '';
Barry Mienydd671972010-10-04 16:33:58 +0200138
139 // The controller function you wish to be called.
Derek Jones0c1e4052010-03-02 14:31:31 -0600140 // $routing['function'] = '';
Derek Allard2067d1a2008-11-13 22:59:24 +0000141
142
143/*
Derek Jones0c1e4052010-03-02 14:31:31 -0600144 * -------------------------------------------------------------------
Derek Jones4b9c6292011-07-01 17:40:48 -0500145 * CUSTOM CONFIG VALUES
Derek Jones0c1e4052010-03-02 14:31:31 -0600146 * -------------------------------------------------------------------
147 *
148 * The $assign_to_config array below will be passed dynamically to the
Barry Mienydd671972010-10-04 16:33:58 +0200149 * config class when initialized. This allows you to set custom config
150 * items or override any default config values found in the config.php file.
Derek Jones0c1e4052010-03-02 14:31:31 -0600151 * This can be handy as it permits you to share one application between
Barry Mienydd671972010-10-04 16:33:58 +0200152 * multiple front controller files, with each file containing different
Derek Jones0c1e4052010-03-02 14:31:31 -0600153 * config values.
154 *
155 * Un-comment the $assign_to_config array below to use this feature
Derek Jones0c1e4052010-03-02 14:31:31 -0600156 */
157 // $assign_to_config['name_of_config_item'] = 'value of config item';
158
159
160
161// --------------------------------------------------------------------
Derek Jones4b9c6292011-07-01 17:40:48 -0500162// END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE
Derek Jones0c1e4052010-03-02 14:31:31 -0600163// --------------------------------------------------------------------
164
joelcoxbf2b9122011-01-16 15:24:43 +0100165/*
166 * ---------------------------------------------------------------
Derek Jones4b9c6292011-07-01 17:40:48 -0500167 * Resolve the system path for increased reliability
Derek Jones0c1e4052010-03-02 14:31:31 -0600168 * ---------------------------------------------------------------
169 */
Phil Sturgeon01d1a5b2011-02-07 10:54:06 +0000170
171 // Set the current directory correctly for CLI requests
172 if (defined('STDIN'))
173 {
174 chdir(dirname(__FILE__));
175 }
176
Andrey Andreev806ca602012-06-12 12:51:27 +0300177 if (($_temp = realpath($system_path)) !== FALSE)
Derek Allard2067d1a2008-11-13 22:59:24 +0000178 {
Andrey Andreev806ca602012-06-12 12:51:27 +0300179 $system_path = $_temp.'/';
Derek Allard2067d1a2008-11-13 22:59:24 +0000180 }
Andrey Andreev079fbfc2012-06-12 02:26:58 +0300181 else
182 {
183 // Ensure there's a trailing slash
184 $system_path = rtrim($system_path, '/').'/';
185 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000186
Derek Joneseba35082010-03-22 10:43:56 -0500187 // Is the system path correct?
Derek Jones0c1e4052010-03-02 14:31:31 -0600188 if ( ! is_dir($system_path))
Derek Allard2067d1a2008-11-13 22:59:24 +0000189 {
Andrey Andreev806ca602012-06-12 12:51:27 +0300190 header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
Andrey Andreev282592c2012-01-08 01:01:55 +0200191 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 Allard2067d1a2008-11-13 22:59:24 +0000192 }
193
Derek Jones0c1e4052010-03-02 14:31:31 -0600194/*
195 * -------------------------------------------------------------------
Derek Jones4b9c6292011-07-01 17:40:48 -0500196 * Now that we know the path, set the main path constants
Derek Jones0c1e4052010-03-02 14:31:31 -0600197 * -------------------------------------------------------------------
Barry Mienydd671972010-10-04 16:33:58 +0200198 */
Derek Jones0c1e4052010-03-02 14:31:31 -0600199 // The name of THIS file
200 define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
201
Barry Mienydd671972010-10-04 16:33:58 +0200202 // Path to the system folder
Andrey Andreev282592c2012-01-08 01:01:55 +0200203 define('BASEPATH', str_replace('\\', '/', $system_path));
Barry Mienydd671972010-10-04 16:33:58 +0200204
Derek Jones0c1e4052010-03-02 14:31:31 -0600205 // Path to the front controller (this file)
206 define('FCPATH', str_replace(SELF, '', __FILE__));
Barry Mienydd671972010-10-04 16:33:58 +0200207
Derek Jones0c1e4052010-03-02 14:31:31 -0600208 // Name of the "system folder"
Barry Mienydd671972010-10-04 16:33:58 +0200209 define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/'));
Derek Jones0c1e4052010-03-02 14:31:31 -0600210
Derek Jones0c1e4052010-03-02 14:31:31 -0600211 // The path to the "application" folder
212 if (is_dir($application_folder))
213 {
Andrey Andreev806ca602012-06-12 12:51:27 +0300214 if (($_temp = realpath($system_path)) !== FALSE)
Andrey Andreev079fbfc2012-06-12 02:26:58 +0300215 {
Andrey Andreev806ca602012-06-12 12:51:27 +0300216 $application_folder = $_temp;
Andrey Andreev079fbfc2012-06-12 02:26:58 +0300217 }
218
Derek Jones0c1e4052010-03-02 14:31:31 -0600219 define('APPPATH', $application_folder.'/');
220 }
221 else
Barry Mienydd671972010-10-04 16:33:58 +0200222 {
Derek Jones0c1e4052010-03-02 14:31:31 -0600223 if ( ! is_dir(BASEPATH.$application_folder.'/'))
224 {
Andrey Andreev806ca602012-06-12 12:51:27 +0300225 header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
Andrey Andreev282592c2012-01-08 01:01:55 +0200226 exit('Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF);
Derek Jones0c1e4052010-03-02 14:31:31 -0600227 }
Barry Mienydd671972010-10-04 16:33:58 +0200228
Derek Jones0c1e4052010-03-02 14:31:31 -0600229 define('APPPATH', BASEPATH.$application_folder.'/');
230 }
Andrey Andreev282592c2012-01-08 01:01:55 +0200231
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400232 // The path to the "views" folder
Andrey Andreev079fbfc2012-06-12 02:26:58 +0300233 if ( ! is_dir($view_folder))
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400234 {
Andrey Andreev079fbfc2012-06-12 02:26:58 +0300235 if ( ! empty($view_folder) && is_dir(APPPATH.$view_folder.'/'))
236 {
237 $view_folder = APPPATH.$view_folder;
238 }
239 elseif ( ! is_dir(APPPATH.'views/'))
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400240 {
Andrey Andreev806ca602012-06-12 12:51:27 +0300241 header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
Andrey Andreev282592c2012-01-08 01:01:55 +0200242 exit('Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF);
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400243 }
Andrey Andreev079fbfc2012-06-12 02:26:58 +0300244 else
245 {
246 $view_folder = APPPATH.'views';
247 }
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400248 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000249
Andrey Andreev806ca602012-06-12 12:51:27 +0300250 if (($_temp = realpath($view_folder)) !== FALSE)
Andrey Andreev079fbfc2012-06-12 02:26:58 +0300251 {
252 $view_folder = realpath($view_folder).'/';
253 }
254 else
255 {
256 $view_folder = rtrim($view_folder, '/').'/';
257 }
258
259 define ('VIEWPATH', $view_folder);
260
Derek Allard2067d1a2008-11-13 22:59:24 +0000261/*
Derek Jones0c1e4052010-03-02 14:31:31 -0600262 * --------------------------------------------------------------------
263 * LOAD THE BOOTSTRAP FILE
264 * --------------------------------------------------------------------
265 *
266 * And away we go...
Derek Jones0c1e4052010-03-02 14:31:31 -0600267 */
Greg Aker3a746652011-04-19 10:59:47 -0500268require_once BASEPATH.'core/CodeIgniter.php';
Derek Jones3b890ba2010-02-17 18:13:15 -0600269
Derek Allard2067d1a2008-11-13 22:59:24 +0000270/* End of file index.php */
Andrey Andreev079fbfc2012-06-12 02:26:58 +0300271/* Location: ./index.php */