blob: a11c5c1f2810e993a3a23be68885a256f0114faa [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 */
45 define('ENVIRONMENT', '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
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:
69 exit('The application environment is not set correctly.');
Phil Sturgeon05fa6112011-04-06 22:57:43 +010070}
joelcoxcee80752011-01-15 23:09:47 +010071
72/*
73 *---------------------------------------------------------------
Derek Jones0c1e4052010-03-02 14:31:31 -060074 * SYSTEM FOLDER NAME
75 *---------------------------------------------------------------
76 *
77 * This variable must contain the name of your "system" folder.
Derek Jones4b9c6292011-07-01 17:40:48 -050078 * Include the path if the folder is not in the same directory
Derek Jones0c1e4052010-03-02 14:31:31 -060079 * as this file.
Derek Jones0c1e4052010-03-02 14:31:31 -060080 */
Phil Sturgeond88b3152011-02-02 21:19:25 +000081 $system_path = 'system';
Derek Allard2067d1a2008-11-13 22:59:24 +000082
83/*
Derek Jones0c1e4052010-03-02 14:31:31 -060084 *---------------------------------------------------------------
85 * APPLICATION FOLDER NAME
86 *---------------------------------------------------------------
87 *
88 * If you want this front controller to use a different "application"
Barry Mienydd671972010-10-04 16:33:58 +020089 * folder then the default one you can set its name here. The folder
Andrey Andreev282592c2012-01-08 01:01:55 +020090 * can also be renamed or relocated anywhere on your server. If
Derek Jones0c1e4052010-03-02 14:31:31 -060091 * you do, use a full server path. For more info please see the user guide:
92 * http://codeigniter.com/user_guide/general/managing_apps.html
93 *
94 * NO TRAILING SLASH!
Derek Jones0c1e4052010-03-02 14:31:31 -060095 */
Phil Sturgeond88b3152011-02-02 21:19:25 +000096 $application_folder = 'application';
Andrey Andreev282592c2012-01-08 01:01:55 +020097
Joe Cianflone8eef9c72011-08-21 10:39:06 -040098/*
99 *---------------------------------------------------------------
100 * VIEW FOLDER NAME
101 *---------------------------------------------------------------
Andrey Andreev282592c2012-01-08 01:01:55 +0200102 *
103 * If you want to move the view folder out of the application
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400104 * folder set the path to the folder here. The folder can be renamed
Andrey Andreev282592c2012-01-08 01:01:55 +0200105 * and relocated anywhere on your server. If blank, it will default
106 * to the standard location inside your application folder. If you
107 * do move this, use the full server path to this folder.
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400108 *
109 * NO TRAILING SLASH!
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400110 */
Andrey Andreev282592c2012-01-08 01:01:55 +0200111 $view_folder = '';
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400112
Derek Allard2067d1a2008-11-13 22:59:24 +0000113
114/*
Derek Jones0c1e4052010-03-02 14:31:31 -0600115 * --------------------------------------------------------------------
116 * DEFAULT CONTROLLER
117 * --------------------------------------------------------------------
118 *
119 * Normally you will set your default controller in the routes.php file.
Barry Mienydd671972010-10-04 16:33:58 +0200120 * You can, however, force a custom routing by hard-coding a
Andrey Andreev282592c2012-01-08 01:01:55 +0200121 * specific controller class/function here. For most applications, you
Barry Mienydd671972010-10-04 16:33:58 +0200122 * WILL NOT set your routing here, but it's an option for those
Derek Jones0c1e4052010-03-02 14:31:31 -0600123 * special instances where you might want to override the standard
124 * routing in a specific front controller that shares a common CI installation.
125 *
Andrey Andreev282592c2012-01-08 01:01:55 +0200126 * IMPORTANT: If you set the routing here, NO OTHER controller will be
Derek Jones0c1e4052010-03-02 14:31:31 -0600127 * callable. In essence, this preference limits your application to ONE
Andrey Andreev282592c2012-01-08 01:01:55 +0200128 * specific controller. Leave the function name blank if you need
Derek Jones0c1e4052010-03-02 14:31:31 -0600129 * to call functions dynamically via the URI.
130 *
131 * Un-comment the $routing array below to use this feature
Derek Jones0c1e4052010-03-02 14:31:31 -0600132 */
Derek Jones4b9c6292011-07-01 17:40:48 -0500133 // The directory name, relative to the "controllers" folder. Leave blank
Barry Mienydd671972010-10-04 16:33:58 +0200134 // if your controller is not in a sub-folder within the "controllers" folder
Derek Jones0c1e4052010-03-02 14:31:31 -0600135 // $routing['directory'] = '';
Barry Mienydd671972010-10-04 16:33:58 +0200136
Derek Jones4b9c6292011-07-01 17:40:48 -0500137 // The controller class file name. Example: Mycontroller
Derek Jones0c1e4052010-03-02 14:31:31 -0600138 // $routing['controller'] = '';
Barry Mienydd671972010-10-04 16:33:58 +0200139
140 // The controller function you wish to be called.
Derek Jones0c1e4052010-03-02 14:31:31 -0600141 // $routing['function'] = '';
Derek Allard2067d1a2008-11-13 22:59:24 +0000142
143
144/*
Derek Jones0c1e4052010-03-02 14:31:31 -0600145 * -------------------------------------------------------------------
Derek Jones4b9c6292011-07-01 17:40:48 -0500146 * CUSTOM CONFIG VALUES
Derek Jones0c1e4052010-03-02 14:31:31 -0600147 * -------------------------------------------------------------------
148 *
149 * The $assign_to_config array below will be passed dynamically to the
Barry Mienydd671972010-10-04 16:33:58 +0200150 * config class when initialized. This allows you to set custom config
151 * items or override any default config values found in the config.php file.
Derek Jones0c1e4052010-03-02 14:31:31 -0600152 * This can be handy as it permits you to share one application between
Barry Mienydd671972010-10-04 16:33:58 +0200153 * multiple front controller files, with each file containing different
Derek Jones0c1e4052010-03-02 14:31:31 -0600154 * config values.
155 *
156 * Un-comment the $assign_to_config array below to use this feature
Derek Jones0c1e4052010-03-02 14:31:31 -0600157 */
158 // $assign_to_config['name_of_config_item'] = 'value of config item';
159
160
161
162// --------------------------------------------------------------------
Derek Jones4b9c6292011-07-01 17:40:48 -0500163// END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE
Derek Jones0c1e4052010-03-02 14:31:31 -0600164// --------------------------------------------------------------------
165
joelcoxbf2b9122011-01-16 15:24:43 +0100166/*
167 * ---------------------------------------------------------------
Derek Jones4b9c6292011-07-01 17:40:48 -0500168 * Resolve the system path for increased reliability
Derek Jones0c1e4052010-03-02 14:31:31 -0600169 * ---------------------------------------------------------------
170 */
Phil Sturgeon01d1a5b2011-02-07 10:54:06 +0000171
172 // Set the current directory correctly for CLI requests
173 if (defined('STDIN'))
174 {
175 chdir(dirname(__FILE__));
176 }
177
Greg Aker0846d742010-04-08 11:47:33 -0500178 if (realpath($system_path) !== FALSE)
Derek Allard2067d1a2008-11-13 22:59:24 +0000179 {
Derek Jones0c1e4052010-03-02 14:31:31 -0600180 $system_path = realpath($system_path).'/';
Derek Allard2067d1a2008-11-13 22:59:24 +0000181 }
Barry Mienydd671972010-10-04 16:33:58 +0200182
Derek Jones0c1e4052010-03-02 14:31:31 -0600183 // ensure there's a trailing slash
184 $system_path = rtrim($system_path, '/').'/';
Derek Allard2067d1a2008-11-13 22:59:24 +0000185
Derek Joneseba35082010-03-22 10:43:56 -0500186 // Is the system path correct?
Derek Jones0c1e4052010-03-02 14:31:31 -0600187 if ( ! is_dir($system_path))
Derek Allard2067d1a2008-11-13 22:59:24 +0000188 {
Andrey Andreev282592c2012-01-08 01:01:55 +0200189 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 +0000190 }
191
Derek Jones0c1e4052010-03-02 14:31:31 -0600192/*
193 * -------------------------------------------------------------------
Derek Jones4b9c6292011-07-01 17:40:48 -0500194 * Now that we know the path, set the main path constants
Derek Jones0c1e4052010-03-02 14:31:31 -0600195 * -------------------------------------------------------------------
Barry Mienydd671972010-10-04 16:33:58 +0200196 */
Derek Jones0c1e4052010-03-02 14:31:31 -0600197 // The name of THIS file
198 define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
199
200 // The PHP file extension
Greg Aker3a746652011-04-19 10:59:47 -0500201 // this global constant is deprecated.
Derek Jones0c1e4052010-03-02 14:31:31 -0600202 define('EXT', '.php');
203
Barry Mienydd671972010-10-04 16:33:58 +0200204 // Path to the system folder
Andrey Andreev282592c2012-01-08 01:01:55 +0200205 define('BASEPATH', str_replace('\\', '/', $system_path));
Barry Mienydd671972010-10-04 16:33:58 +0200206
Derek Jones0c1e4052010-03-02 14:31:31 -0600207 // Path to the front controller (this file)
208 define('FCPATH', str_replace(SELF, '', __FILE__));
Barry Mienydd671972010-10-04 16:33:58 +0200209
Derek Jones0c1e4052010-03-02 14:31:31 -0600210 // Name of the "system folder"
Barry Mienydd671972010-10-04 16:33:58 +0200211 define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/'));
Derek Jones0c1e4052010-03-02 14:31:31 -0600212
Derek Jones0c1e4052010-03-02 14:31:31 -0600213 // The path to the "application" folder
214 if (is_dir($application_folder))
215 {
216 define('APPPATH', $application_folder.'/');
217 }
218 else
Barry Mienydd671972010-10-04 16:33:58 +0200219 {
Derek Jones0c1e4052010-03-02 14:31:31 -0600220 if ( ! is_dir(BASEPATH.$application_folder.'/'))
221 {
Kevin Cuppd63e4012012-02-05 14:14:32 -0500222 header('HTTP/1.1 503 Service Unavailable.', TRUE, '503');
Andrey Andreev282592c2012-01-08 01:01:55 +0200223 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 -0600224 }
Barry Mienydd671972010-10-04 16:33:58 +0200225
Derek Jones0c1e4052010-03-02 14:31:31 -0600226 define('APPPATH', BASEPATH.$application_folder.'/');
227 }
Andrey Andreev282592c2012-01-08 01:01:55 +0200228
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400229 // The path to the "views" folder
Andrey Andreev282592c2012-01-08 01:01:55 +0200230 if (is_dir($view_folder))
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400231 {
232 define ('VIEWPATH', $view_folder .'/');
233 }
Andrey Andreev282592c2012-01-08 01:01:55 +0200234 else
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400235 {
236 if ( ! is_dir(APPPATH.'views/'))
237 {
Kevin Cuppd63e4012012-02-05 14:14:32 -0500238 header('HTTP/1.1 503 Service Unavailable.', TRUE, '503');
Andrey Andreev282592c2012-01-08 01:01:55 +0200239 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 -0400240 }
Andrey Andreev282592c2012-01-08 01:01:55 +0200241
242 define ('VIEWPATH', APPPATH.'views/' );
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400243 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000244
245/*
Derek Jones0c1e4052010-03-02 14:31:31 -0600246 * --------------------------------------------------------------------
247 * LOAD THE BOOTSTRAP FILE
248 * --------------------------------------------------------------------
249 *
250 * And away we go...
Derek Jones0c1e4052010-03-02 14:31:31 -0600251 */
Greg Aker3a746652011-04-19 10:59:47 -0500252require_once BASEPATH.'core/CodeIgniter.php';
Derek Jones3b890ba2010-02-17 18:13:15 -0600253
Derek Allard2067d1a2008-11-13 22:59:24 +0000254/* End of file index.php */
Andrey Andreev282592c2012-01-08 01:01:55 +0200255/* Location: ./index.php */