blob: 08e5d6df41a1b7c15e3b0906414002db348bf38c [file] [log] [blame]
Derek Allard2067d1a2008-11-13 22:59:24 +00001<?php
Derek Jonesf4a4bd82011-10-20 12:18:42 -05002/**
3 * CodeIgniter
4 *
5 * An open source application development framework for PHP 5.1.6 or newer
6 *
7 * NOTICE OF LICENSE
8 *
9 * Licensed under the Open Software License version 3.0
10 *
11 * 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
21 * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. (http://ellislab.com/)
22 * @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 */
46 define('ENVIRONMENT', 'development');
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 */
55
Phil Sturgeon05fa6112011-04-06 22:57:43 +010056if (defined('ENVIRONMENT'))
57{
Phil Sturgeond88b3152011-02-02 21:19:25 +000058 switch (ENVIRONMENT)
59 {
60 case 'development':
Dan Horrigan0e95b8b2011-08-21 09:34:02 -040061 error_reporting(-1);
Phil Sturgeond88b3152011-02-02 21:19:25 +000062 break;
Derek Jones4b9c6292011-07-01 17:40:48 -050063
Phil Sturgeond88b3152011-02-02 21:19:25 +000064 case 'testing':
65 case 'production':
66 error_reporting(0);
67 break;
68
69 default:
70 exit('The application environment is not set correctly.');
71 }
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.
82 *
83 */
Phil Sturgeond88b3152011-02-02 21:19:25 +000084 $system_path = 'system';
Derek Allard2067d1a2008-11-13 22:59:24 +000085
86/*
Derek Jones0c1e4052010-03-02 14:31:31 -060087 *---------------------------------------------------------------
88 * APPLICATION FOLDER NAME
89 *---------------------------------------------------------------
90 *
91 * If you want this front controller to use a different "application"
Barry Mienydd671972010-10-04 16:33:58 +020092 * folder then the default one you can set its name here. The folder
Derek Jones4b9c6292011-07-01 17:40:48 -050093 * can also be renamed or relocated anywhere on your server. If
Derek Jones0c1e4052010-03-02 14:31:31 -060094 * you do, use a full server path. For more info please see the user guide:
95 * http://codeigniter.com/user_guide/general/managing_apps.html
96 *
97 * NO TRAILING SLASH!
98 *
99 */
Phil Sturgeond88b3152011-02-02 21:19:25 +0000100 $application_folder = 'application';
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400101
102/*
103 *---------------------------------------------------------------
104 * VIEW FOLDER NAME
105 *---------------------------------------------------------------
106 *
107 * If you want to move the view folder out of the application
108 * folder set the path to the folder here. The folder can be renamed
109 * and relocated anywhere on your server. If blank, it will default
110 * to the standard location inside your application folder. If you
111 * do move this, use the full server path to this folder
112 *
113 * NO TRAILING SLASH!
114 *
115 */
116 $view_folder = '';
117
Derek Allard2067d1a2008-11-13 22:59:24 +0000118
119/*
Derek Jones0c1e4052010-03-02 14:31:31 -0600120 * --------------------------------------------------------------------
121 * DEFAULT CONTROLLER
122 * --------------------------------------------------------------------
123 *
124 * Normally you will set your default controller in the routes.php file.
Barry Mienydd671972010-10-04 16:33:58 +0200125 * You can, however, force a custom routing by hard-coding a
Derek Jones4b9c6292011-07-01 17:40:48 -0500126 * specific controller class/function here. For most applications, you
Barry Mienydd671972010-10-04 16:33:58 +0200127 * WILL NOT set your routing here, but it's an option for those
Derek Jones0c1e4052010-03-02 14:31:31 -0600128 * special instances where you might want to override the standard
129 * routing in a specific front controller that shares a common CI installation.
130 *
Derek Jones4b9c6292011-07-01 17:40:48 -0500131 * IMPORTANT: If you set the routing here, NO OTHER controller will be
Derek Jones0c1e4052010-03-02 14:31:31 -0600132 * callable. In essence, this preference limits your application to ONE
Derek Jones4b9c6292011-07-01 17:40:48 -0500133 * specific controller. Leave the function name blank if you need
Derek Jones0c1e4052010-03-02 14:31:31 -0600134 * to call functions dynamically via the URI.
135 *
136 * Un-comment the $routing array below to use this feature
137 *
138 */
Derek Jones4b9c6292011-07-01 17:40:48 -0500139 // The directory name, relative to the "controllers" folder. Leave blank
Barry Mienydd671972010-10-04 16:33:58 +0200140 // if your controller is not in a sub-folder within the "controllers" folder
Derek Jones0c1e4052010-03-02 14:31:31 -0600141 // $routing['directory'] = '';
Barry Mienydd671972010-10-04 16:33:58 +0200142
Derek Jones4b9c6292011-07-01 17:40:48 -0500143 // The controller class file name. Example: Mycontroller
Derek Jones0c1e4052010-03-02 14:31:31 -0600144 // $routing['controller'] = '';
Barry Mienydd671972010-10-04 16:33:58 +0200145
146 // The controller function you wish to be called.
Derek Jones0c1e4052010-03-02 14:31:31 -0600147 // $routing['function'] = '';
Derek Allard2067d1a2008-11-13 22:59:24 +0000148
149
150/*
Derek Jones0c1e4052010-03-02 14:31:31 -0600151 * -------------------------------------------------------------------
Derek Jones4b9c6292011-07-01 17:40:48 -0500152 * CUSTOM CONFIG VALUES
Derek Jones0c1e4052010-03-02 14:31:31 -0600153 * -------------------------------------------------------------------
154 *
155 * The $assign_to_config array below will be passed dynamically to the
Barry Mienydd671972010-10-04 16:33:58 +0200156 * config class when initialized. This allows you to set custom config
157 * items or override any default config values found in the config.php file.
Derek Jones0c1e4052010-03-02 14:31:31 -0600158 * This can be handy as it permits you to share one application between
Barry Mienydd671972010-10-04 16:33:58 +0200159 * multiple front controller files, with each file containing different
Derek Jones0c1e4052010-03-02 14:31:31 -0600160 * config values.
161 *
162 * Un-comment the $assign_to_config array below to use this feature
163 *
164 */
165 // $assign_to_config['name_of_config_item'] = 'value of config item';
166
167
168
169// --------------------------------------------------------------------
Derek Jones4b9c6292011-07-01 17:40:48 -0500170// END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE
Derek Jones0c1e4052010-03-02 14:31:31 -0600171// --------------------------------------------------------------------
172
joelcoxbf2b9122011-01-16 15:24:43 +0100173/*
174 * ---------------------------------------------------------------
Derek Jones4b9c6292011-07-01 17:40:48 -0500175 * Resolve the system path for increased reliability
Derek Jones0c1e4052010-03-02 14:31:31 -0600176 * ---------------------------------------------------------------
177 */
Phil Sturgeon01d1a5b2011-02-07 10:54:06 +0000178
179 // Set the current directory correctly for CLI requests
180 if (defined('STDIN'))
181 {
182 chdir(dirname(__FILE__));
183 }
184
Greg Aker0846d742010-04-08 11:47:33 -0500185 if (realpath($system_path) !== FALSE)
Derek Allard2067d1a2008-11-13 22:59:24 +0000186 {
Derek Jones0c1e4052010-03-02 14:31:31 -0600187 $system_path = realpath($system_path).'/';
Derek Allard2067d1a2008-11-13 22:59:24 +0000188 }
Barry Mienydd671972010-10-04 16:33:58 +0200189
Derek Jones0c1e4052010-03-02 14:31:31 -0600190 // ensure there's a trailing slash
191 $system_path = rtrim($system_path, '/').'/';
Derek Allard2067d1a2008-11-13 22:59:24 +0000192
Derek Joneseba35082010-03-22 10:43:56 -0500193 // Is the system path correct?
Derek Jones0c1e4052010-03-02 14:31:31 -0600194 if ( ! is_dir($system_path))
Derek Allard2067d1a2008-11-13 22:59:24 +0000195 {
Barry Mienydd671972010-10-04 16:33:58 +0200196 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 +0000197 }
198
Derek Jones0c1e4052010-03-02 14:31:31 -0600199/*
200 * -------------------------------------------------------------------
Derek Jones4b9c6292011-07-01 17:40:48 -0500201 * Now that we know the path, set the main path constants
Derek Jones0c1e4052010-03-02 14:31:31 -0600202 * -------------------------------------------------------------------
Barry Mienydd671972010-10-04 16:33:58 +0200203 */
Derek Jones0c1e4052010-03-02 14:31:31 -0600204 // The name of THIS file
205 define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
206
207 // The PHP file extension
Greg Aker3a746652011-04-19 10:59:47 -0500208 // this global constant is deprecated.
Derek Jones0c1e4052010-03-02 14:31:31 -0600209 define('EXT', '.php');
210
Barry Mienydd671972010-10-04 16:33:58 +0200211 // Path to the system folder
Derek Jones0c1e4052010-03-02 14:31:31 -0600212 define('BASEPATH', str_replace("\\", "/", $system_path));
Barry Mienydd671972010-10-04 16:33:58 +0200213
Derek Jones0c1e4052010-03-02 14:31:31 -0600214 // Path to the front controller (this file)
215 define('FCPATH', str_replace(SELF, '', __FILE__));
Barry Mienydd671972010-10-04 16:33:58 +0200216
Derek Jones0c1e4052010-03-02 14:31:31 -0600217 // Name of the "system folder"
Barry Mienydd671972010-10-04 16:33:58 +0200218 define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/'));
Derek Jones0c1e4052010-03-02 14:31:31 -0600219
220
221 // The path to the "application" folder
222 if (is_dir($application_folder))
223 {
224 define('APPPATH', $application_folder.'/');
225 }
226 else
Barry Mienydd671972010-10-04 16:33:58 +0200227 {
Derek Jones0c1e4052010-03-02 14:31:31 -0600228 if ( ! is_dir(BASEPATH.$application_folder.'/'))
229 {
Barry Mienydd671972010-10-04 16:33:58 +0200230 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 -0600231 }
Barry Mienydd671972010-10-04 16:33:58 +0200232
Derek Jones0c1e4052010-03-02 14:31:31 -0600233 define('APPPATH', BASEPATH.$application_folder.'/');
234 }
Joe Cianflone8eef9c72011-08-21 10:39:06 -0400235
236 // The path to the "views" folder
237 if (is_dir($view_folder))
238 {
239 define ('VIEWPATH', $view_folder .'/');
240 }
241 else
242 {
243 if ( ! is_dir(APPPATH.'views/'))
244 {
245 exit("Your view folder path does not appear to be set correctly. Please open the following file and correct this: ".SELF);
246 }
247
248 define ('VIEWPATH', APPPATH.'views/' );
249 }
250
Derek Allard2067d1a2008-11-13 22:59:24 +0000251
252/*
Derek Jones0c1e4052010-03-02 14:31:31 -0600253 * --------------------------------------------------------------------
254 * LOAD THE BOOTSTRAP FILE
255 * --------------------------------------------------------------------
256 *
257 * And away we go...
258 *
259 */
Greg Aker3a746652011-04-19 10:59:47 -0500260require_once BASEPATH.'core/CodeIgniter.php';
Derek Jones3b890ba2010-02-17 18:13:15 -0600261
Derek Allard2067d1a2008-11-13 22:59:24 +0000262/* End of file index.php */
Derek Jonesa3ffbbb2008-05-11 18:18:29 +0000263/* Location: ./index.php */