diff options
Diffstat (limited to 'system')
-rw-r--r-- | system/core/Hooks.php | 8 | ||||
-rw-r--r-- | system/core/Lang.php | 2 | ||||
-rw-r--r-- | system/database/DB_driver.php | 48 | ||||
-rw-r--r-- | system/libraries/Cache/drivers/Cache_memcached.php | 2 | ||||
-rw-r--r-- | system/libraries/Form_validation.php | 13 |
5 files changed, 32 insertions, 41 deletions
diff --git a/system/core/Hooks.php b/system/core/Hooks.php index 57e4a99a6..4ec7698d7 100644 --- a/system/core/Hooks.php +++ b/system/core/Hooks.php @@ -99,14 +99,14 @@ class CI_Hooks { } // Grab the "hooks" definition file. - if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/hooks.php')) + if (file_exists(APPPATH.'config/hooks.php')) { - include(APPPATH.'config/'.ENVIRONMENT.'/hooks.php'); + include(APPPATH.'config/hooks.php'); } - if (file_exists(APPPATH.'config/hooks.php')) + if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/hooks.php')) { - include(APPPATH.'config/hooks.php'); + include(APPPATH.'config/'.ENVIRONMENT.'/hooks.php'); } // If there are no hooks, we're done. diff --git a/system/core/Lang.php b/system/core/Lang.php index c0cd34a3d..9aaf944ce 100644 --- a/system/core/Lang.php +++ b/system/core/Lang.php @@ -106,7 +106,7 @@ class CI_Lang { $langfile .= '.php'; - if (empty($idiom) OR ! ctype_alpha($idiom)) + if (empty($idiom) OR ! preg_match('/^[a-z_-]$/i', $idiom)) { $config =& get_config(); $idiom = empty($config['language']) ? 'english' : $config['language']; diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index fdd99167f..5ea1fb8e1 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -456,9 +456,23 @@ abstract class CI_DB_driver { // -------------------------------------------------------------------- /** + * DB connect + * + * This is just a dummy method that all drivers will override. + * + * @return mixed + */ + public function db_connect() + { + return TRUE; + } + + // -------------------------------------------------------------------- + + /** * Persistent database connection * - * @return resource + * @return mixed */ public function db_pconnect() { @@ -1034,7 +1048,7 @@ abstract class CI_DB_driver { /** * Escape String * - * @param string|string[] $str + * @param string|string[] $str Input string * @param bool $like Whether or not the string will be used in a LIKE condition * @return string */ @@ -1102,10 +1116,10 @@ abstract class CI_DB_driver { * Retrieves the primary key. It assumes that the row in the first * position is the primary key * - * @param string the table name - * @return mixed + * @param string $table Table name + * @return string */ - public function primary($table = '') + public function primary($table) { $fields = $this->list_fields($table); return is_array($fields) ? current($fields) : FALSE; @@ -1146,7 +1160,7 @@ abstract class CI_DB_driver { * Returns an array of table names * * @param string $constrain_by_prefix = FALSE - * @return mixed + * @return array */ public function list_tables($constrain_by_prefix = FALSE) { @@ -1214,9 +1228,9 @@ abstract class CI_DB_driver { * Fetch Field Names * * @param string the table name - * @return mixed + * @return array */ - public function list_fields($table = '') + public function list_fields($table) { // Is there a cached result? if (isset($this->data_cache['field_names'][$table])) @@ -1224,11 +1238,6 @@ abstract class CI_DB_driver { return $this->data_cache['field_names'][$table]; } - if ($table === '') - { - return ($this->db_debug) ? $this->display_error('db_field_param_missing') : FALSE; - } - if (FALSE === ($sql = $this->_list_columns($table))) { return ($this->db_debug) ? $this->display_error('db_unsupported_function') : FALSE; @@ -1282,18 +1291,13 @@ abstract class CI_DB_driver { /** * Returns an object with field data * - * @param string the table name - * @return object + * @param string $table the table name + * @return array */ - public function field_data($table = '') + public function field_data($table) { - if ($table === '') - { - return ($this->db_debug) ? $this->display_error('db_field_param_missing') : FALSE; - } - $query = $this->query($this->_field_data($this->protect_identifiers($table, TRUE, NULL, FALSE))); - return $query->field_data(); + return ($query) ? $query->field_data() : FALSE; } // -------------------------------------------------------------------- diff --git a/system/libraries/Cache/drivers/Cache_memcached.php b/system/libraries/Cache/drivers/Cache_memcached.php index 73d3b2319..99fbfb4fb 100644 --- a/system/libraries/Cache/drivers/Cache_memcached.php +++ b/system/libraries/Cache/drivers/Cache_memcached.php @@ -245,7 +245,7 @@ class CI_Cache_memcached extends CI_Driver { foreach ($this->_memcache_conf as $cache_server) { isset($cache_server['hostname']) OR $cache_server['hostname'] = $defaults['host']; - isset($cache_server['port']) OR $cache_server['port'] = $defaults['host']; + isset($cache_server['port']) OR $cache_server['port'] = $defaults['port']; isset($cache_server['weight']) OR $cache_server['weight'] = $defaults['weight']; if (get_class($this->_memcached) === 'Memcache') diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index 66bd460ac..1ff0fe540 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -1558,19 +1558,6 @@ class CI_Form_validation { // -------------------------------------------------------------------- /** - * XSS Clean - * - * @param string - * @return string - */ - public function xss_clean($str) - { - return $this->CI->security->xss_clean($str); - } - - // -------------------------------------------------------------------- - - /** * Convert PHP tags to entities * * @param string |