summaryrefslogtreecommitdiffstats
path: root/system/core/Config.php
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@server-speed.net>2011-04-10 10:39:31 +0200
committerFlorian Pritz <bluewind@server-speed.net>2011-04-10 10:39:31 +0200
commit1bdc9c8903eb2db33fdb8174d61e15100dfbbca8 (patch)
treeb0c645ad99e04f34817fc4e6385792111db42274 /system/core/Config.php
parent413d0cdac49257089a0790f6ac92973a36a6b69f (diff)
update to CI 2.0.2
Signed-off-by: Florian Pritz <bluewind@server-speed.net>
Diffstat (limited to 'system/core/Config.php')
-rwxr-xr-xsystem/core/Config.php30
1 files changed, 23 insertions, 7 deletions
diff --git a/system/core/Config.php b/system/core/Config.php
index bfb60fa44..863c5ef4b 100755
--- a/system/core/Config.php
+++ b/system/core/Config.php
@@ -51,7 +51,7 @@ class CI_Config {
// Set the base_url automatically if none was provided
if ($this->config['base_url'] == '')
{
- if(isset($_SERVER['HTTP_HOST']))
+ if (isset($_SERVER['HTTP_HOST']))
{
$base_url = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off' ? 'https' : 'http';
$base_url .= '://'. $_SERVER['HTTP_HOST'];
@@ -74,24 +74,40 @@ class CI_Config {
*
* @access public
* @param string the config file name
+ * @param boolean if configuration values should be loaded into their own section
+ * @param boolean true if errors should just return false, false if an error message should be displayed
* @return boolean if the file was loaded correctly
*/
function load($file = '', $use_sections = FALSE, $fail_gracefully = FALSE)
{
$file = ($file == '') ? 'config' : str_replace(EXT, '', $file);
+ $found = FALSE;
$loaded = FALSE;
- foreach($this->_config_paths as $path)
+ foreach ($this->_config_paths as $path)
{
- $file_path = $path.'config/'.$file.EXT;
+ $check_locations = defined('ENVIRONMENT')
+ ? array(ENVIRONMENT.'/'.$file, $file)
+ : array($file);
- if (in_array($file_path, $this->is_loaded, TRUE))
+ foreach ($check_locations as $location)
{
- $loaded = TRUE;
- continue;
+ $file_path = $path.'config/'.$location.EXT;
+
+ if (in_array($file_path, $this->is_loaded, TRUE))
+ {
+ $loaded = TRUE;
+ continue 2;
+ }
+
+ if (file_exists($file_path))
+ {
+ $found = TRUE;
+ break;
+ }
}
- if ( ! file_exists($path.'config/'.$file.EXT))
+ if ($found === FALSE)
{
continue;
}