blob: 236c740c6ed6d2ca7dfc7462cf99df46f0ae8f35 [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
darwinel871754a2014-02-11 17:34:57 +010021 * @copyright Copyright (c) 2008 - 2014, 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':
64 ini_set('display_errors', 0);
Andrey Andreevd40d94c2014-10-06 03:19:17 +030065 if (version_compare(PHP_VERSION, '5.3', '>='))
66 {
67 error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
68 }
69 else
70 {
71 error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
72 }
Root35ac46d2012-05-25 18:51:48 -040073 break;
74
75 default:
Andrey Andreevcbb654d2012-07-10 11:36:32 +030076 header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
Daniel Hunsaker3b5b7f42013-02-22 19:17:56 -070077 echo 'The application environment is not set correctly.';
Andrey Andreev7cf682a2014-03-13 14:55:45 +020078 exit(1); // EXIT_ERROR
Phil Sturgeon05fa6112011-04-06 22:57:43 +010079}
joelcoxcee80752011-01-15 23:09:47 +010080
81/*
82 *---------------------------------------------------------------
Derek Jones0c1e4052010-03-02 14:31:31 -060083 * SYSTEM FOLDER NAME
84 *---------------------------------------------------------------
85 *
86 * This variable must contain the name of your "system" folder.
vlakoffc941d852013-08-06 14:44:40 +020087 * Include the path if the folder is not in the same directory
Derek Jones0c1e4052010-03-02 14:31:31 -060088 * as this file.
Derek Jones0c1e4052010-03-02 14:31:31 -060089 */
Phil Sturgeond88b3152011-02-02 21:19:25 +000090 $system_path = 'system';
Derek Allard2067d1a2008-11-13 22:59:24 +000091
92/*
Derek Jones0c1e4052010-03-02 14:31:31 -060093 *---------------------------------------------------------------
94 * APPLICATION FOLDER NAME
95 *---------------------------------------------------------------
96 *
97 * If you want this front controller to use a different "application"
Adam Carmichaele90b8302013-01-04 01:04:29 +110098 * folder than the default one you can set its name here. The folder
Andrey Andreev282592c2012-01-08 01:01:55 +020099 * can also be renamed or relocated anywhere on your server. If
Derek Jones0c1e4052010-03-02 14:31:31 -0600100 * you do, use a full server path. For more info please see the user guide:
101 * http://codeigniter.com/user_guide/general/managing_apps.html
102 *
103 * NO TRAILING SLASH!
Derek Jones0c1e4052010-03-02 14:31:31 -0600104 */
Phil Sturgeond88b3152011-02-02 21:19:25 +0000105 $application_folder = 'application';
Andrey Andreev282592c2012-01-08 01:01:55 +0200106
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400107/*
108 *---------------------------------------------------------------
109 * VIEW FOLDER NAME
110 *---------------------------------------------------------------
Andrey Andreev282592c2012-01-08 01:01:55 +0200111 *
112 * If you want to move the view folder out of the application
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400113 * folder set the path to the folder here. The folder can be renamed
Andrey Andreev282592c2012-01-08 01:01:55 +0200114 * and relocated anywhere on your server. If blank, it will default
115 * to the standard location inside your application folder. If you
116 * do move this, use the full server path to this folder.
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400117 *
118 * NO TRAILING SLASH!
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400119 */
Andrey Andreev282592c2012-01-08 01:01:55 +0200120 $view_folder = '';
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400121
Derek Allard2067d1a2008-11-13 22:59:24 +0000122
123/*
Derek Jones0c1e4052010-03-02 14:31:31 -0600124 * --------------------------------------------------------------------
125 * DEFAULT CONTROLLER
126 * --------------------------------------------------------------------
127 *
128 * Normally you will set your default controller in the routes.php file.
Barry Mienydd671972010-10-04 16:33:58 +0200129 * You can, however, force a custom routing by hard-coding a
Andrey Andreev282592c2012-01-08 01:01:55 +0200130 * specific controller class/function here. For most applications, you
Barry Mienydd671972010-10-04 16:33:58 +0200131 * WILL NOT set your routing here, but it's an option for those
Derek Jones0c1e4052010-03-02 14:31:31 -0600132 * special instances where you might want to override the standard
133 * routing in a specific front controller that shares a common CI installation.
134 *
Andrey Andreev282592c2012-01-08 01:01:55 +0200135 * IMPORTANT: If you set the routing here, NO OTHER controller will be
Derek Jones0c1e4052010-03-02 14:31:31 -0600136 * callable. In essence, this preference limits your application to ONE
Andrey Andreev282592c2012-01-08 01:01:55 +0200137 * specific controller. Leave the function name blank if you need
Derek Jones0c1e4052010-03-02 14:31:31 -0600138 * to call functions dynamically via the URI.
139 *
140 * Un-comment the $routing array below to use this feature
Derek Jones0c1e4052010-03-02 14:31:31 -0600141 */
Derek Jones4b9c6292011-07-01 17:40:48 -0500142 // The directory name, relative to the "controllers" folder. Leave blank
Barry Mienydd671972010-10-04 16:33:58 +0200143 // if your controller is not in a sub-folder within the "controllers" folder
Derek Jones0c1e4052010-03-02 14:31:31 -0600144 // $routing['directory'] = '';
Barry Mienydd671972010-10-04 16:33:58 +0200145
vlakoffe40e56f2012-07-15 12:57:38 +0200146 // The controller class file name. Example: mycontroller
Derek Jones0c1e4052010-03-02 14:31:31 -0600147 // $routing['controller'] = '';
Barry Mienydd671972010-10-04 16:33:58 +0200148
149 // The controller function you wish to be called.
Derek Jones0c1e4052010-03-02 14:31:31 -0600150 // $routing['function'] = '';
Derek Allard2067d1a2008-11-13 22:59:24 +0000151
152
153/*
Derek Jones0c1e4052010-03-02 14:31:31 -0600154 * -------------------------------------------------------------------
Derek Jones4b9c6292011-07-01 17:40:48 -0500155 * CUSTOM CONFIG VALUES
Derek Jones0c1e4052010-03-02 14:31:31 -0600156 * -------------------------------------------------------------------
157 *
158 * The $assign_to_config array below will be passed dynamically to the
Barry Mienydd671972010-10-04 16:33:58 +0200159 * config class when initialized. This allows you to set custom config
160 * items or override any default config values found in the config.php file.
Derek Jones0c1e4052010-03-02 14:31:31 -0600161 * This can be handy as it permits you to share one application between
Barry Mienydd671972010-10-04 16:33:58 +0200162 * multiple front controller files, with each file containing different
Derek Jones0c1e4052010-03-02 14:31:31 -0600163 * config values.
164 *
165 * Un-comment the $assign_to_config array below to use this feature
Derek Jones0c1e4052010-03-02 14:31:31 -0600166 */
167 // $assign_to_config['name_of_config_item'] = 'value of config item';
168
169
170
171// --------------------------------------------------------------------
Derek Jones4b9c6292011-07-01 17:40:48 -0500172// END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE
Derek Jones0c1e4052010-03-02 14:31:31 -0600173// --------------------------------------------------------------------
174
joelcoxbf2b9122011-01-16 15:24:43 +0100175/*
176 * ---------------------------------------------------------------
Derek Jones4b9c6292011-07-01 17:40:48 -0500177 * Resolve the system path for increased reliability
Derek Jones0c1e4052010-03-02 14:31:31 -0600178 * ---------------------------------------------------------------
179 */
Phil Sturgeon01d1a5b2011-02-07 10:54:06 +0000180
181 // Set the current directory correctly for CLI requests
182 if (defined('STDIN'))
183 {
184 chdir(dirname(__FILE__));
185 }
186
Andrey Andreev806ca602012-06-12 12:51:27 +0300187 if (($_temp = realpath($system_path)) !== FALSE)
Derek Allard2067d1a2008-11-13 22:59:24 +0000188 {
Andrey Andreev806ca602012-06-12 12:51:27 +0300189 $system_path = $_temp.'/';
Derek Allard2067d1a2008-11-13 22:59:24 +0000190 }
Andrey Andreev079fbfc2012-06-12 02:26:58 +0300191 else
192 {
193 // Ensure there's a trailing slash
194 $system_path = rtrim($system_path, '/').'/';
195 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000196
Derek Joneseba35082010-03-22 10:43:56 -0500197 // Is the system path correct?
Derek Jones0c1e4052010-03-02 14:31:31 -0600198 if ( ! is_dir($system_path))
Derek Allard2067d1a2008-11-13 22:59:24 +0000199 {
Andrey Andreev806ca602012-06-12 12:51:27 +0300200 header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
Daniel Hunsaker3b5b7f42013-02-22 19:17:56 -0700201 echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: '.pathinfo(__FILE__, PATHINFO_BASENAME);
Andrey Andreev7cf682a2014-03-13 14:55:45 +0200202 exit(3); // EXIT_CONFIG
Derek Allard2067d1a2008-11-13 22:59:24 +0000203 }
204
Derek Jones0c1e4052010-03-02 14:31:31 -0600205/*
206 * -------------------------------------------------------------------
Derek Jones4b9c6292011-07-01 17:40:48 -0500207 * Now that we know the path, set the main path constants
Derek Jones0c1e4052010-03-02 14:31:31 -0600208 * -------------------------------------------------------------------
Barry Mienydd671972010-10-04 16:33:58 +0200209 */
Derek Jones0c1e4052010-03-02 14:31:31 -0600210 // The name of THIS file
211 define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
212
Barry Mienydd671972010-10-04 16:33:58 +0200213 // Path to the system folder
Andrey Andreev282592c2012-01-08 01:01:55 +0200214 define('BASEPATH', str_replace('\\', '/', $system_path));
Barry Mienydd671972010-10-04 16:33:58 +0200215
Derek Jones0c1e4052010-03-02 14:31:31 -0600216 // Path to the front controller (this file)
217 define('FCPATH', str_replace(SELF, '', __FILE__));
Barry Mienydd671972010-10-04 16:33:58 +0200218
Derek Jones0c1e4052010-03-02 14:31:31 -0600219 // Name of the "system folder"
Barry Mienydd671972010-10-04 16:33:58 +0200220 define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/'));
Derek Jones0c1e4052010-03-02 14:31:31 -0600221
Derek Jones0c1e4052010-03-02 14:31:31 -0600222 // The path to the "application" folder
223 if (is_dir($application_folder))
224 {
Andrey Andreevcce91802012-06-12 13:25:31 +0300225 if (($_temp = realpath($application_folder)) !== FALSE)
Andrey Andreev079fbfc2012-06-12 02:26:58 +0300226 {
Andrey Andreev806ca602012-06-12 12:51:27 +0300227 $application_folder = $_temp;
Andrey Andreev079fbfc2012-06-12 02:26:58 +0300228 }
229
Andrey Andreev9f417d02013-10-14 12:24:36 +0300230 define('APPPATH', $application_folder.DIRECTORY_SEPARATOR);
Derek Jones0c1e4052010-03-02 14:31:31 -0600231 }
232 else
Barry Mienydd671972010-10-04 16:33:58 +0200233 {
Andrey Andreev9f417d02013-10-14 12:24:36 +0300234 if ( ! is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR))
Derek Jones0c1e4052010-03-02 14:31:31 -0600235 {
Andrey Andreev806ca602012-06-12 12:51:27 +0300236 header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
Daniel Hunsaker3b5b7f42013-02-22 19:17:56 -0700237 echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
Andrey Andreev7cf682a2014-03-13 14:55:45 +0200238 exit(3); // EXIT_CONFIG
Derek Jones0c1e4052010-03-02 14:31:31 -0600239 }
Barry Mienydd671972010-10-04 16:33:58 +0200240
Andrey Andreev9f417d02013-10-14 12:24:36 +0300241 define('APPPATH', BASEPATH.$application_folder.DIRECTORY_SEPARATOR);
Derek Jones0c1e4052010-03-02 14:31:31 -0600242 }
Andrey Andreev282592c2012-01-08 01:01:55 +0200243
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400244 // The path to the "views" folder
Andrey Andreev079fbfc2012-06-12 02:26:58 +0300245 if ( ! is_dir($view_folder))
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400246 {
Andrey Andreev9f417d02013-10-14 12:24:36 +0300247 if ( ! empty($view_folder) && is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR))
Andrey Andreev079fbfc2012-06-12 02:26:58 +0300248 {
249 $view_folder = APPPATH.$view_folder;
250 }
Andrey Andreev9f417d02013-10-14 12:24:36 +0300251 elseif ( ! is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR))
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400252 {
Andrey Andreev806ca602012-06-12 12:51:27 +0300253 header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
Daniel Hunsaker3b5b7f42013-02-22 19:17:56 -0700254 echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
Andrey Andreev7cf682a2014-03-13 14:55:45 +0200255 exit(3); // EXIT_CONFIG
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400256 }
Andrey Andreev079fbfc2012-06-12 02:26:58 +0300257 else
258 {
259 $view_folder = APPPATH.'views';
260 }
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400261 }
Derek Allard2067d1a2008-11-13 22:59:24 +0000262
Andrey Andreev806ca602012-06-12 12:51:27 +0300263 if (($_temp = realpath($view_folder)) !== FALSE)
Andrey Andreev079fbfc2012-06-12 02:26:58 +0300264 {
Andrey Andreev9f417d02013-10-14 12:24:36 +0300265 $view_folder = $_temp.DIRECTORY_SEPARATOR;
Andrey Andreev079fbfc2012-06-12 02:26:58 +0300266 }
267 else
268 {
Andrey Andreev9f417d02013-10-14 12:24:36 +0300269 $view_folder = rtrim($view_folder, '/\\').DIRECTORY_SEPARATOR;
Andrey Andreev079fbfc2012-06-12 02:26:58 +0300270 }
271
Andrey Andreevcce91802012-06-12 13:25:31 +0300272 define('VIEWPATH', $view_folder);
Andrey Andreev079fbfc2012-06-12 02:26:58 +0300273
Derek Allard2067d1a2008-11-13 22:59:24 +0000274/*
Derek Jones0c1e4052010-03-02 14:31:31 -0600275 * --------------------------------------------------------------------
276 * LOAD THE BOOTSTRAP FILE
277 * --------------------------------------------------------------------
278 *
279 * And away we go...
Derek Jones0c1e4052010-03-02 14:31:31 -0600280 */
Greg Aker3a746652011-04-19 10:59:47 -0500281require_once BASEPATH.'core/CodeIgniter.php';
Derek Jones3b890ba2010-02-17 18:13:15 -0600282
Derek Allard2067d1a2008-11-13 22:59:24 +0000283/* End of file index.php */
Andrey Andreev20292312013-07-22 14:29:10 +0300284/* Location: ./index.php */