diff options
Diffstat (limited to 'system/libraries')
-rw-r--r-- | system/libraries/Driver.php | 19 | ||||
-rw-r--r-- | system/libraries/Form_validation.php | 13 | ||||
-rw-r--r-- | system/libraries/Javascript.php | 2 | ||||
-rw-r--r-- | system/libraries/Javascript/Jquery.php (renamed from system/libraries/javascript/Jquery.php) | 0 | ||||
-rw-r--r-- | system/libraries/Javascript/index.html (renamed from system/libraries/javascript/index.html) | 0 | ||||
-rw-r--r-- | system/libraries/Migration.php | 4 | ||||
-rw-r--r-- | system/libraries/Session/drivers/Session_cookie.php | 2 | ||||
-rw-r--r-- | system/libraries/Upload.php | 43 | ||||
-rw-r--r-- | system/libraries/User_agent.php | 13 |
9 files changed, 36 insertions, 60 deletions
diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php index 4b35dce73..382420db0 100644 --- a/system/libraries/Driver.php +++ b/system/libraries/Driver.php @@ -80,8 +80,7 @@ class CI_Driver_Library { public function load_driver($child) { // Get CodeIgniter instance and subclass prefix - $CI = get_instance(); - $prefix = (string) $CI->config->item('subclass_prefix'); + $prefix = config_item('subclass_prefix'); if ( ! isset($this->lib_name)) { @@ -102,11 +101,12 @@ class CI_Driver_Library { } // Get package paths and filename case variations to search + $CI = get_instance(); $paths = $CI->load->get_package_paths(TRUE); // Is there an extension? $class_name = $prefix.$child_name; - $found = class_exists($class_name); + $found = class_exists($class_name, FALSE); if ( ! $found) { // Check for subclass file @@ -126,8 +126,8 @@ class CI_Driver_Library { } // Include both sources and mark found - include($basepath); - include($file); + include_once($basepath); + include_once($file); $found = TRUE; break; } @@ -139,8 +139,7 @@ class CI_Driver_Library { { // Use standard class name $class_name = 'CI_'.$child_name; - $found = class_exists($class_name); - if ( ! $found) + if ( ! class_exists($class_name, FALSE)) { // Check package paths foreach ($paths as $path) @@ -150,7 +149,7 @@ class CI_Driver_Library { if (file_exists($file)) { // Include source - include($file); + include_once($file); break; } } @@ -158,9 +157,9 @@ class CI_Driver_Library { } // Did we finally find the class? - if ( ! class_exists($class_name)) + if ( ! class_exists($class_name, FALSE)) { - if (class_exists($child_name)) + if (class_exists($child_name, FALSE)) { $class_name = $child_name; } diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index bbd0b523e..1511d9add 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -1232,6 +1232,19 @@ class CI_Form_validation { // -------------------------------------------------------------------- /** + * Alpha-numeric w/ spaces + * + * @param string + * @return bool + */ + public function alpha_numeric_spaces($str) + { + return (bool) preg_match('/^[A-Z0-9 ]+$/i', $str); + } + + // -------------------------------------------------------------------- + + /** * Alpha-numeric with underscores and dashes * * @param string diff --git a/system/libraries/Javascript.php b/system/libraries/Javascript.php index 7f1d85511..773a58384 100644 --- a/system/libraries/Javascript.php +++ b/system/libraries/Javascript.php @@ -69,7 +69,7 @@ class CI_Javascript { $this->CI =& get_instance(); // load the requested js library - $this->CI->load->library('javascript/'.$js_library_driver, array('autoload' => $autoload)); + $this->CI->load->library('Javascript/'.$js_library_driver, array('autoload' => $autoload)); // make js to refer to current library $this->js =& $this->CI->$js_library_driver; diff --git a/system/libraries/javascript/Jquery.php b/system/libraries/Javascript/Jquery.php index b6e0434b2..b6e0434b2 100644 --- a/system/libraries/javascript/Jquery.php +++ b/system/libraries/Javascript/Jquery.php diff --git a/system/libraries/javascript/index.html b/system/libraries/Javascript/index.html index c942a79ce..c942a79ce 100644 --- a/system/libraries/javascript/index.html +++ b/system/libraries/Javascript/index.html diff --git a/system/libraries/Migration.php b/system/libraries/Migration.php index fd915c382..b673e9cb7 100644 --- a/system/libraries/Migration.php +++ b/system/libraries/Migration.php @@ -104,8 +104,8 @@ class CI_Migration { */ public function __construct($config = array()) { - # Only run this constructor on main library load - if (get_parent_class($this) !== FALSE) + // Only run this constructor on main library load + if ( ! in_array(get_class($this), array('CI_Migration', config_item('subclass_prefix').'Migration'), TRUE)) { return; } diff --git a/system/libraries/Session/drivers/Session_cookie.php b/system/libraries/Session/drivers/Session_cookie.php index 474641642..11bb32fe0 100644 --- a/system/libraries/Session/drivers/Session_cookie.php +++ b/system/libraries/Session/drivers/Session_cookie.php @@ -805,7 +805,7 @@ class CI_Session_cookie extends CI_Session_driver { { if (is_string($val)) { - $val= str_replace('{{slash}}', '\\', $val); + $val = str_replace('{{slash}}', '\\', $val); } } diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index 96bb17edc..814ea68a4 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -463,7 +463,8 @@ class CI_Upload { } // Sanitize the file name for security - $this->file_name = $this->clean_file_name($this->file_name); + $CI =& get_instance(); + $this->file_name = $CI->security->sanitize_filename($this->file_name); // Truncate the file name if it's too long if ($this->max_filename > 0) @@ -971,46 +972,6 @@ class CI_Upload { // -------------------------------------------------------------------- /** - * Clean the file name for security - * - * @param string $filename - * @return string - */ - public function clean_file_name($filename) - { - $bad = array( - '<!--', '-->', - "'", '"', - '<', '>', - '&', '$', - '=', - ';', - '?', - '/', - '!', - '#', - '%20', - '%22', - '%3c', // < - '%253c', // < - '%3e', // > - '%0e', // > - '%28', // ( - '%29', // ) - '%2528', // ( - '%26', // & - '%24', // $ - '%3f', // ? - '%3b', // ; - '%3d' // = - ); - - return stripslashes(str_replace($bad, '', $filename)); - } - - // -------------------------------------------------------------------- - - /** * Limit the File Name Length * * @param string $filename diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php index 3fe2e0519..2f6f81909 100644 --- a/system/libraries/User_agent.php +++ b/system/libraries/User_agent.php @@ -175,15 +175,18 @@ class CI_User_agent { */ protected function _load_agent_file() { - if (is_file(APPPATH.'config/'.ENVIRONMENT.'/user_agents.php')) + if (($found = file_exists(APPPATH.'config/user_agents.php'))) { - include(APPPATH.'config/'.ENVIRONMENT.'/user_agents.php'); + include(APPPATH.'config/user_agents.php'); } - elseif (is_file(APPPATH.'config/user_agents.php')) + + if (file_exists(APPPATH.'config/'.ENVIRONMENT.'/user_agents.php')) { - include(APPPATH.'config/user_agents.php'); + include(APPPATH.'config/'.ENVIRONMENT.'/user_agents.php'); + $found = TRUE; } - else + + if ($found !== TRUE) { return FALSE; } |