diff options
Diffstat (limited to 'system/libraries')
-rw-r--r-- | system/libraries/Cache/Cache.php | 3 | ||||
-rw-r--r-- | system/libraries/Form_validation.php | 4 | ||||
-rw-r--r-- | system/libraries/User_agent.php | 19 |
3 files changed, 19 insertions, 7 deletions
diff --git a/system/libraries/Cache/Cache.php b/system/libraries/Cache/Cache.php index e1089f755..537897eaf 100644 --- a/system/libraries/Cache/Cache.php +++ b/system/libraries/Cache/Cache.php @@ -106,7 +106,7 @@ class CI_Cache extends CI_Driver_Library { isset($config['key_prefix']) && $this->key_prefix = $config['key_prefix']; - if (isset($config['backup']) && in_array('cache_'.$config['backup'], $this->valid_drivers)) + if (isset($config['backup']) && in_array($config['backup'], $this->valid_drivers)) { $this->_backup_driver = $config['backup']; } @@ -123,6 +123,7 @@ class CI_Cache extends CI_Driver_Library { else { // Backup is supported. Set it to primary. + log_message('debug', 'Cache adapter "'.$this->_adapter.'" is unavailable. Falling back to "'.$this->_backup_driver.'" backup adapter.'); $this->_adapter = $this->_backup_driver; } } diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index 40ba01202..8b9bfa897 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -583,7 +583,7 @@ class CI_Form_validation { // If the field is blank, but NOT required, no further tests are necessary $callback = FALSE; - if ( ! in_array('required', $rules) && $postdata === NULL) + if ( ! in_array('required', $rules) && ($postdata === NULL OR $postdata === '')) { // Before we bail out, does the rule contain a callback? if (preg_match('/(callback_\w+(\[.*?\])?)/', implode(' ', $rules), $match)) @@ -598,7 +598,7 @@ class CI_Form_validation { } // Isset Test. Typically this rule will only apply to checkboxes. - if ($postdata === NULL && $callback === FALSE) + if (($postdata === NULL OR $postdata === '') && $callback === FALSE) { if (in_array('isset', $rules, TRUE) OR in_array('required', $rules)) { diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php index 2f6f81909..50ac9be98 100644 --- a/system/libraries/User_agent.php +++ b/system/libraries/User_agent.php @@ -471,13 +471,24 @@ class CI_User_agent { */ public function is_referral() { - if (empty($_SERVER['HTTP_REFERER'])) + static $result; + + if ( ! isset($result)) { - return FALSE; + if (empty($_SERVER['HTTP_REFERER'])) + { + $result = FALSE; + } + else + { + $referer_host = @parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST); + $own_host = parse_url(config_item('base_url'), PHP_URL_HOST); + + $result = ($referer_host && $referer_host !== $own_host); + } } - $referer = parse_url($_SERVER['HTTP_REFERER']); - return ! (empty($referer['host']) && strpos(config_item('base_url'), $referer['host']) !== FALSE); + return $result; } // -------------------------------------------------------------------- |