summaryrefslogtreecommitdiffstats
path: root/index.php
diff options
context:
space:
mode:
authorPhil Sturgeon <email@philsturgeon.co.uk>2011-02-16 20:03:49 +0100
committerPhil Sturgeon <email@philsturgeon.co.uk>2011-02-16 20:03:49 +0100
commit33ed0f37b6b8f2223cd3362bf8fca28102ab67c6 (patch)
tree99c613720a2fd8541764bb6fc893e0da28fa269b /index.php
parent154da11c5bb4b7dc5c225f4fa018852ee45cc6eb (diff)
parentd8d1e24eee56d2466c91ecd72b3c8932eb3d0639 (diff)
Merged CodeIgniter Core changes and integrated rob1's secure cookie change into my secure cookie change.
Diffstat (limited to 'index.php')
-rw-r--r--index.php55
1 files changed, 45 insertions, 10 deletions
diff --git a/index.php b/index.php
index 5bb53d2f2..74e3ba32a 100644
--- a/index.php
+++ b/index.php
@@ -2,15 +2,46 @@
/*
*---------------------------------------------------------------
- * PHP ERROR REPORTING LEVEL
+ * APPLICATION ENVIRONMENT
*---------------------------------------------------------------
*
- * By default CI runs with error reporting set to ALL. For security
- * reasons you are encouraged to change this to 0 when your site goes live.
- * For more info visit: http://www.php.net/error_reporting
+ * You can load different configurations depending on your
+ * current environment. Setting the environment also influences
+ * things like logging and error reporting.
+ *
+ * This can be set to anything, but default usage is:
+ *
+ * development
+ * testing
+ * production
+ *
+ * NOTE: If you change these, also change the error_reporting() code below
*
*/
- error_reporting(E_ALL);
+ define('ENVIRONMENT', 'development');
+/*
+ *---------------------------------------------------------------
+ * ERROR REPORTING
+ *---------------------------------------------------------------
+ *
+ * Different environments will require different levels of error reporting.
+ * By default development will show errors but testing and live will hide them.
+ */
+
+ switch (ENVIRONMENT)
+ {
+ case 'development':
+ error_reporting(E_ALL);
+ break;
+
+ case 'testing':
+ case 'production':
+ error_reporting(0);
+ break;
+
+ default:
+ exit('The application environment is not set correctly.');
+ }
/*
*---------------------------------------------------------------
@@ -22,7 +53,7 @@
* as this file.
*
*/
- $system_path = "system";
+ $system_path = 'system';
/*
*---------------------------------------------------------------
@@ -38,7 +69,7 @@
* NO TRAILING SLASH!
*
*/
- $application_folder = "application";
+ $application_folder = 'application';
/*
* --------------------------------------------------------------------
@@ -94,14 +125,18 @@
// END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE
// --------------------------------------------------------------------
-
-
-
/*
* ---------------------------------------------------------------
* Resolve the system path for increased reliability
* ---------------------------------------------------------------
*/
+
+ // Set the current directory correctly for CLI requests
+ if (defined('STDIN'))
+ {
+ chdir(dirname(__FILE__));
+ }
+
if (realpath($system_path) !== FALSE)
{
$system_path = realpath($system_path).'/';