diff options
Diffstat (limited to 'system')
-rwxr-xr-x | system/core/CodeIgniter.php | 9 | ||||
-rw-r--r-- | system/core/Common.php | 200 | ||||
-rwxr-xr-x | system/core/Hooks.php | 11 | ||||
-rw-r--r-- | system/core/Loader.php | 9 | ||||
-rwxr-xr-x | system/core/Output.php | 10 | ||||
-rwxr-xr-x | system/core/Router.php | 9 | ||||
-rw-r--r-- | system/helpers/download_helper.php | 9 | ||||
-rw-r--r-- | system/helpers/file_helper.php | 9 | ||||
-rw-r--r-- | system/helpers/html_helper.php | 9 | ||||
-rw-r--r-- | system/helpers/smiley_helper.php | 9 | ||||
-rw-r--r-- | system/helpers/text_helper.php | 9 | ||||
-rw-r--r-- | system/libraries/Upload.php | 15 | ||||
-rw-r--r-- | system/libraries/User_agent.php | 13 |
13 files changed, 186 insertions, 135 deletions
diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index 04f346c7c..97527e5ca 100755 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -59,7 +59,14 @@ * Load the framework constants * ------------------------------------------------------ */ - load_environ_config('constants', TRUE); + if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/constants.php')) + { + require(APPPATH.'config/'.ENVIRONMENT.'/constants.php'); + } + else + { + require(APPPATH.'config/constants.php'); + } /* * ------------------------------------------------------ diff --git a/system/core/Common.php b/system/core/Common.php index 9e05f3db4..b0921fe0c 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -47,6 +47,7 @@ * Since there are a few places where we conditionally test for PHP > 5 * we'll set a static variable. * +* @access public * @param string * @return bool TRUE if the current version is $version or higher */ @@ -75,6 +76,7 @@ if ( ! function_exists('is_php')) * the file, based on the read-only attribute. is_writable() is also unreliable * on Unix servers if safe_mode is on. * + * @access private * @return void */ if ( ! function_exists('is_really_writable')) @@ -116,17 +118,18 @@ if ( ! function_exists('is_really_writable')) // ------------------------------------------------------------------------ /** - * Class registry - * - * This function acts as a singleton. If the requested class does not - * exist it is instantiated and set to a static variable. If it has - * previously been instantiated the variable is returned. - * - * @param string the class name being requested - * @param string the directory where the class should be found - * @param string the class name prefix - * @return object - */ +* Class registry +* +* This function acts as a singleton. If the requested class does not +* exist it is instantiated and set to a static variable. If it has +* previously been instantiated the variable is returned. +* +* @access public +* @param string the class name being requested +* @param string the directory where the class should be found +* @param string the class name prefix +* @return object +*/ if ( ! function_exists('load_class')) { function &load_class($class, $directory = 'libraries', $prefix = 'CI_') @@ -188,11 +191,12 @@ if ( ! function_exists('load_class')) // -------------------------------------------------------------------- /** - * Keeps track of which libraries have been loaded. This function is - * called by the load_class() function above - * - * @return array - */ +* Keeps track of which libraries have been loaded. This function is +* called by the load_class() function above +* +* @access public +* @return array +*/ if ( ! function_exists('is_loaded')) { function is_loaded($class = '') @@ -211,13 +215,14 @@ if ( ! function_exists('is_loaded')) // ------------------------------------------------------------------------ /** - * Loads the main config.php file - * - * This function lets us grab the config file even if the Config class - * hasn't been instantiated yet - * - * @return array - */ +* Loads the main config.php file +* +* This function lets us grab the config file even if the Config class +* hasn't been instantiated yet +* +* @access private +* @return array +*/ if ( ! function_exists('get_config')) { function &get_config($replace = array()) @@ -268,10 +273,11 @@ if ( ! function_exists('get_config')) // ------------------------------------------------------------------------ /** - * Returns the specified config item - * - * @return mixed - */ +* Returns the specified config item +* +* @access public +* @return mixed +*/ if ( ! function_exists('config_item')) { function config_item($item) @@ -296,16 +302,17 @@ if ( ! function_exists('config_item')) // ------------------------------------------------------------------------ /** - * Error Handler - * - * This function lets us invoke the exception class and - * display errors using the standard error template located - * in application/errors/errors.php - * This function will send the error page directly to the - * browser and exit. - * - * @return void - */ +* Error Handler +* +* This function lets us invoke the exception class and +* display errors using the standard error template located +* in application/errors/errors.php +* This function will send the error page directly to the +* browser and exit. +* +* @access public +* @return void +*/ if ( ! function_exists('show_error')) { function show_error($message, $status_code = 500, $heading = 'An Error Was Encountered') @@ -319,14 +326,15 @@ if ( ! function_exists('show_error')) // ------------------------------------------------------------------------ /** - * 404 Page Handler - * - * This function is similar to the show_error() function above - * However, instead of the standard error template it displays - * 404 errors. - * - * @return void - */ +* 404 Page Handler +* +* This function is similar to the show_error() function above +* However, instead of the standard error template it displays +* 404 errors. +* +* @access public +* @return void +*/ if ( ! function_exists('show_404')) { function show_404($page = '', $log_error = TRUE) @@ -340,13 +348,14 @@ if ( ! function_exists('show_404')) // ------------------------------------------------------------------------ /** - * Error Logging Interface - * - * We use this as a simple mechanism to access the logging - * class and send messages to be logged. - * - * @return void - */ +* Error Logging Interface +* +* We use this as a simple mechanism to access the logging +* class and send messages to be logged. +* +* @access public +* @return void +*/ if ( ! function_exists('log_message')) { function log_message($level = 'error', $message, $php_error = FALSE) @@ -368,6 +377,7 @@ if ( ! function_exists('log_message')) /** * Set HTTP Status Header * + * @access public * @param int the status code * @param string * @return void @@ -454,18 +464,19 @@ if ( ! function_exists('set_status_header')) // -------------------------------------------------------------------- /** - * Exception Handler - * - * This is the custom exception handler that is declaired at the top - * of Codeigniter.php. The main reason we use this is to permit - * PHP errors to be logged in our own log files since the user may - * not have access to server logs. Since this function - * effectively intercepts PHP errors, however, we also need - * to display errors based on the current error_reporting level. - * We do that with the use of a PHP error template. - * - * @return void - */ +* Exception Handler +* +* This is the custom exception handler that is declaired at the top +* of Codeigniter.php. The main reason we use this is to permit +* PHP errors to be logged in our own log files since the user may +* not have access to server logs. Since this function +* effectively intercepts PHP errors, however, we also need +* to display errors based on the current error_reporting level. +* We do that with the use of a PHP error template. +* +* @access private +* @return void +*/ if ( ! function_exists('_exception_handler')) { function _exception_handler($severity, $message, $filepath, $line) @@ -507,6 +518,7 @@ if ( ! function_exists('_exception_handler')) * This prevents sandwiching null characters * between ascii characters, like Java\0script. * + * @access public * @param string * @return string */ @@ -540,11 +552,12 @@ if ( ! function_exists('remove_invisible_characters')) // ------------------------------------------------------------------------ /** - * Returns HTML escaped variable - * - * @param mixed - * @return mixed - */ +* Returns HTML escaped variable +* +* @access public +* @param mixed +* @return mixed +*/ if ( ! function_exists('html_escape')) { function html_escape($var) @@ -553,57 +566,12 @@ if ( ! function_exists('html_escape')) { return array_map('html_escape', $var); } - - return htmlspecialchars($var, ENT_QUOTES, config_item('charset')); - } -} - -// ------------------------------------------------------------------------ - -/** - * Load Environmental config directory files. - * - * In several places we check to see if the environment is loaded up and if the file - * that is being requested lives in said environment. Otherwise load up the file from - * the main CI config dir. - * - * @todo Optimize a bit to lessen the file system hits if the file has been loaded. - * @param string filename without extension. eg: 'config' or 'hooks' - * @param boolean whether or not to do a `require_once()` or a simple `include()` - * @return void - */ - if ( ! function_exists('load_environ_config')) - { - function load_environ_config($file, $require=FALSE) - { - if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/'.$file.'.php')) - { - if ($require) - { - require_once(APPPATH.'config/'.ENVIRONMENT.'/'.$file.'.php'); - } - else - { - include(APPPATH.'config/'.ENVIRONMENT.'/'.$file.'.php'); - } - - return; - } - - if ($require) - { - require_once(APPPATH.'config/'.$file.'.php'); - } else { - include(APPPATH.'config/'.$file.'.php'); + return htmlspecialchars($var, ENT_QUOTES, config_item('charset')); } - - return; } - } - -// ------------------------------------------------------------------------ +} /* End of file Common.php */ /* Location: ./system/core/Common.php */
\ No newline at end of file diff --git a/system/core/Hooks.php b/system/core/Hooks.php index 6a36ce963..aa251a389 100755 --- a/system/core/Hooks.php +++ b/system/core/Hooks.php @@ -91,7 +91,16 @@ class CI_Hooks { // Grab the "hooks" definition file. // If there are no hooks, we're done. - load_environ_config('hooks'); + + if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/hooks.php')) + { + include(APPPATH.'config/'.ENVIRONMENT.'/hooks.php'); + } + elseif (is_file(APPPATH.'config/hooks.php')) + { + include(APPPATH.'config/hooks.php'); + } + if ( ! isset($hook) OR ! is_array($hook)) { diff --git a/system/core/Loader.php b/system/core/Loader.php index 83d134ef4..d42dbbf38 100644 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -1139,7 +1139,14 @@ class CI_Loader { */ protected function _ci_autoloader() { - load_environ_config('autoload'); + if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/autoload.php')) + { + include(APPPATH.'config/'.ENVIRONMENT.'/autoload.php'); + } + else + { + include(APPPATH.'config/autoload.php'); + } if ( ! isset($autoload)) { diff --git a/system/core/Output.php b/system/core/Output.php index 4d1036ceb..9727a184f 100755 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -106,7 +106,15 @@ class CI_Output { $this->_zlib_oc = @ini_get('zlib.output_compression'); // Get mime types for later - load_environ_config('mimes'); + if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/mimes.php')) + { + include APPPATH.'config/'.ENVIRONMENT.'/mimes.php'; + } + else + { + include APPPATH.'config/mimes.php'; + } + $this->mime_types = $mimes; diff --git a/system/core/Router.php b/system/core/Router.php index 5388a9289..748678d67 100755 --- a/system/core/Router.php +++ b/system/core/Router.php @@ -141,7 +141,14 @@ class CI_Router { } // Load the routes.php file. - load_environ_config('routes'); + if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/routes.php')) + { + include(APPPATH.'config/'.ENVIRONMENT.'/routes.php'); + } + elseif (is_file(APPPATH.'config/routes.php')) + { + include(APPPATH.'config/routes.php'); + } $this->routes = ( ! isset($route) OR ! is_array($route)) ? array() : $route; unset($route); diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index 3173c9840..5f5d1aaf7 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -70,7 +70,14 @@ if ( ! function_exists('force_download')) $extension = end($x); // Load the mime types - load_environ_config('mimes'); + if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php')) + { + include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'); + } + elseif (is_file(APPPATH.'config/mimes.php')) + { + include(APPPATH.'config/mimes.php'); + } // Set a default mime if we can't find it if ( ! isset($mimes[$extension])) diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php index b4edcdea4..5b5085381 100644 --- a/system/helpers/file_helper.php +++ b/system/helpers/file_helper.php @@ -364,7 +364,14 @@ if ( ! function_exists('get_mime_by_extension')) if ( ! is_array($mimes)) { - load_environ_config('mimes'); + if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php')) + { + include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'); + } + elseif (is_file(APPPATH.'config/mimes.php')) + { + include(APPPATH.'config/mimes.php'); + } if ( ! is_array($mimes)) { diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index fa805f14f..b6bb402a8 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -275,7 +275,14 @@ if ( ! function_exists('doctype')) if ( ! is_array($_doctypes)) { - load_environ_config('doctypes'); + if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/doctypes.php')) + { + include(APPPATH.'config/'.ENVIRONMENT.'/doctypes.php'); + } + elseif (is_file(APPPATH.'config/doctypes.php')) + { + include(APPPATH.'config/doctypes.php'); + } if ( ! is_array($_doctypes)) { diff --git a/system/helpers/smiley_helper.php b/system/helpers/smiley_helper.php index e04d5d611..38e2965fc 100644 --- a/system/helpers/smiley_helper.php +++ b/system/helpers/smiley_helper.php @@ -241,7 +241,14 @@ if ( ! function_exists('_get_smiley_array')) { function _get_smiley_array() { - load_environ_config('smileys'); + if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/smileys.php')) + { + include(APPPATH.'config/'.ENVIRONMENT.'/smileys.php'); + } + elseif (file_exists(APPPATH.'config/smileys.php')) + { + include(APPPATH.'config/smileys.php'); + } if (isset($smileys) AND is_array($smileys)) { diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php index 7a4a68995..38b46e248 100644 --- a/system/helpers/text_helper.php +++ b/system/helpers/text_helper.php @@ -378,7 +378,14 @@ if ( ! function_exists('convert_accented_characters')) { function convert_accented_characters($str) { - load_environ_config('foreign_chars'); + if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php')) + { + include(APPPATH.'config/'.ENVIRONMENT.'/foreign_chars.php'); + } + elseif (is_file(APPPATH.'config/foreign_chars.php')) + { + include(APPPATH.'config/foreign_chars.php'); + } if ( ! isset($foreign_characters)) { diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index 5108afa1b..826bcceb8 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -952,12 +952,17 @@ class CI_Upload { { global $mimes; - if (count($this->mimes) === 0) + if (count($this->mimes) == 0) { - load_environ_config('mimes'); - - // Return FALSE if we still have no mimes after trying to load them up. - if (count($this->mimes) === 0) + if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php')) + { + include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'); + } + elseif (is_file(APPPATH.'config/mimes.php')) + { + include(APPPATH.'config//mimes.php'); + } + else { return FALSE; } diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php index 5288525cb..c31ff2646 100644 --- a/system/libraries/User_agent.php +++ b/system/libraries/User_agent.php @@ -94,10 +94,15 @@ class CI_User_agent { */ protected function _load_agent_file() { - load_environ_config('user_agents'); - - // Return FALSE if we still have no mimes after trying to load them up. - if (count($this->mimes) === 0) + if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/user_agents.php')) + { + include(APPPATH.'config/'.ENVIRONMENT.'/user_agents.php'); + } + elseif (is_file(APPPATH.'config/user_agents.php')) + { + include(APPPATH.'config/user_agents.php'); + } + else { return FALSE; } |