From 9ba661b02c492e89028e5c67b7edbfc0efefc9f1 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 4 Jun 2012 14:44:34 +0300 Subject: Revert/optimize some changes from ed944a3c70a0bad158cd5a6ca5ce1f2e717aff5d --- system/core/CodeIgniter.php | 2 +- system/core/Common.php | 5 ++--- system/core/Config.php | 2 +- system/core/Input.php | 8 ++++++-- system/core/Output.php | 6 +++--- system/core/Router.php | 6 +++--- system/core/Security.php | 2 +- system/core/URI.php | 2 +- system/core/Utf8.php | 2 +- 9 files changed, 19 insertions(+), 16 deletions(-) (limited to 'system') diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index 182f17ab3..b3e984d4d 100755 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -94,7 +94,7 @@ * Note: Since the config file data is cached it doesn't * hurt to load it here. */ - if (isset($assign_to_config['subclass_prefix']) && $assign_to_config['subclass_prefix'] !== '') + if ( ! empty($assign_to_config['subclass_prefix'])) { get_config(array('subclass_prefix' => $assign_to_config['subclass_prefix'])); } diff --git a/system/core/Common.php b/system/core/Common.php index a773c4f20..8af7d6323 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -436,12 +436,11 @@ if ( ! function_exists('set_status_header')) 505 => 'HTTP Version Not Supported' ); - if ($code === '' OR ! is_numeric($code)) + if ($code == '' OR ! is_numeric($code)) { show_error('Status codes must be numeric', 500); } - - if (isset($stati[$code]) && $text === '') + elseif (isset($stati[$code]) && $text === '') { $text = $stati[$code]; } diff --git a/system/core/Config.php b/system/core/Config.php index 0e5fa5265..3de1bcb96 100755 --- a/system/core/Config.php +++ b/system/core/Config.php @@ -189,7 +189,7 @@ class CI_Config { */ public function item($item, $index = '') { - if ($index === '') + if ($index == '') { return isset($this->config[$item]) ? $this->config[$item] : FALSE; } diff --git a/system/core/Input.php b/system/core/Input.php index 284b15697..73f46ba6a 100755 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -267,18 +267,22 @@ class CI_Input { { $prefix = config_item('cookie_prefix'); } - if ($domain === '' && config_item('cookie_domain') !== '') + + if ($domain == '' && config_item('cookie_domain') != '') { $domain = config_item('cookie_domain'); } + if ($path === '/' && config_item('cookie_path') !== '/') { $path = config_item('cookie_path'); } + if ($secure === FALSE && config_item('cookie_secure') !== FALSE) { $secure = config_item('cookie_secure'); } + if ($httponly === FALSE && config_item('cookie_httponly') !== FALSE) { $httponly = config_item('cookie_httponly'); @@ -324,7 +328,7 @@ class CI_Input { return $this->ip_address; } - if (config_item('proxy_ips') !== '' && $this->server('HTTP_X_FORWARDED_FOR') && $this->server('REMOTE_ADDR')) + if (config_item('proxy_ips') != '' && $this->server('HTTP_X_FORWARDED_FOR') && $this->server('REMOTE_ADDR')) { $proxies = preg_split('/[\s,]/', config_item('proxy_ips'), -1, PREG_SPLIT_NO_EMPTY); $proxies = is_array($proxies) ? $proxies : array($proxies); diff --git a/system/core/Output.php b/system/core/Output.php index 496948ab7..9b85b3ec4 100755 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -101,7 +101,7 @@ class CI_Output { */ public function __construct() { - $this->_zlib_oc = @ini_get('zlib.output_compression'); + $this->_zlib_oc = (bool) @ini_get('zlib.output_compression'); // Get mime types for later if (defined('ENVIRONMENT') && file_exists(APPPATH.'config/'.ENVIRONMENT.'/mimes.php')) @@ -160,7 +160,7 @@ class CI_Output { */ public function append_output($output) { - if ($this->final_output === '') + if ($this->final_output == '') { $this->final_output = $output; } @@ -505,7 +505,7 @@ class CI_Output { * * @param object config class * @param object uri class - * @return void + * @return bool */ public function _display_cache(&$CFG, &$URI) { diff --git a/system/core/Router.php b/system/core/Router.php index 93875bdd9..5bc053045 100755 --- a/system/core/Router.php +++ b/system/core/Router.php @@ -165,7 +165,7 @@ class CI_Router { $this->uri->_fetch_uri_string(); // Is there a URI string? If not, the default controller specified in the "routes" file will be shown. - if ($this->uri->uri_string === '') + if ($this->uri->uri_string == '') { return $this->_set_default_controller(); } @@ -483,14 +483,14 @@ class CI_Router { $this->set_directory($routing['directory']); } - if (isset($routing['controller']) && $routing['controller'] !== '') + if ( ! empty($routing['controller'])) { $this->set_class($routing['controller']); } if (isset($routing['function'])) { - $routing['function'] = ($routing['function'] === '') ? 'index' : $routing['function']; + $routing['function'] = ($routing['function'] == '') ? 'index' : $routing['function']; $this->set_method($routing['function']); } } diff --git a/system/core/Security.php b/system/core/Security.php index 9cbcd9248..4593a1090 100755 --- a/system/core/Security.php +++ b/system/core/Security.php @@ -847,4 +847,4 @@ class CI_Security { } /* End of file Security.php */ -/* Location: ./system/core/Security.php */ +/* Location: ./system/core/Security.php */ \ No newline at end of file diff --git a/system/core/URI.php b/system/core/URI.php index 0afb374c2..a575bc36e 100755 --- a/system/core/URI.php +++ b/system/core/URI.php @@ -111,7 +111,7 @@ class CI_URI { // Is there a PATH_INFO variable? // Note: some servers seem to have trouble with getenv() so we'll test it two ways - $path = (isset($_SERVER['PATH_INFO'])) ? $_SERVER['PATH_INFO'] : @getenv('PATH_INFO'); + $path = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : @getenv('PATH_INFO'); if (trim($path, '/') !== '' && $path !== '/'.SELF) { $this->_set_uri_string($path); diff --git a/system/core/Utf8.php b/system/core/Utf8.php index 2b5a1f5eb..0a7ec501c 100644 --- a/system/core/Utf8.php +++ b/system/core/Utf8.php @@ -54,7 +54,7 @@ class CI_Utf8 { if ( @preg_match('/./u', 'é') === 1 // PCRE must support UTF-8 && function_exists('iconv') // iconv must be installed - && @ini_get('mbstring.func_overload') !== 1 // Multibyte string function overloading cannot be enabled + && (bool) @ini_get('mbstring.func_overload') !== TRUE // Multibyte string function overloading cannot be enabled && $CFG->item('charset') === 'UTF-8' // Application charset must be UTF-8 ) { -- cgit v1.2.3-24-g4f1b