diff options
Diffstat (limited to 'system')
-rw-r--r-- | system/codeigniter/CodeIgniter.php | 15 | ||||
-rw-r--r-- | system/codeigniter/Common.php | 2 | ||||
-rw-r--r-- | system/drivers/DB_active_record.php | 2 | ||||
-rw-r--r-- | system/drivers/DB_driver.php | 2 | ||||
-rw-r--r-- | system/helpers/date_helper.php | 2 | ||||
-rw-r--r-- | system/helpers/text_helper.php | 2 | ||||
-rw-r--r-- | system/libraries/Email.php | 4 | ||||
-rw-r--r-- | system/libraries/Image_lib.php | 2 | ||||
-rw-r--r-- | system/libraries/Log.php | 6 | ||||
-rw-r--r-- | system/libraries/Output.php | 2 | ||||
-rw-r--r-- | system/libraries/Pagination.php | 2 | ||||
-rw-r--r-- | system/libraries/Router.php | 14 | ||||
-rw-r--r-- | system/libraries/Session.php | 2 | ||||
-rw-r--r-- | system/libraries/Trackback.php | 4 | ||||
-rw-r--r-- | system/libraries/URI.php | 4 | ||||
-rw-r--r-- | system/libraries/Validation.php | 8 |
16 files changed, 44 insertions, 29 deletions
diff --git a/system/codeigniter/CodeIgniter.php b/system/codeigniter/CodeIgniter.php index 1f7850ecf..5c3d19b76 100644 --- a/system/codeigniter/CodeIgniter.php +++ b/system/codeigniter/CodeIgniter.php @@ -192,13 +192,20 @@ else { $method = 'index'; } - - if ( ! method_exists($CI, $method)) + + if (method_exists($CI, '_remap')) { - show_404(); + $CI->_remap($method); } + else + { + if ( ! method_exists($CI, $method)) + { + show_404(); + } - $CI->$method(); + $CI->$method(); + } } /* diff --git a/system/codeigniter/Common.php b/system/codeigniter/Common.php index d5bec77fe..1b190e201 100644 --- a/system/codeigniter/Common.php +++ b/system/codeigniter/Common.php @@ -175,7 +175,7 @@ function log_message($level = 'error', $message, $php_error = FALSE) $config['log_threshold'], $config['log_date_format'] ); - } + } $LOG->write_log($level, $message, $php_error); } diff --git a/system/drivers/DB_active_record.php b/system/drivers/DB_active_record.php index f1995c807..1320af9ed 100644 --- a/system/drivers/DB_active_record.php +++ b/system/drivers/DB_active_record.php @@ -790,7 +790,7 @@ class CI_DB_active_record extends CI_DB_driver { } } - if (ctype_digit($this->ar_limit)) + if (is_numeric($this->ar_limit)) { $sql .= "\n"; $sql = $this->_limit($sql, $this->ar_limit, $this->ar_offset); diff --git a/system/drivers/DB_driver.php b/system/drivers/DB_driver.php index 0c2084ad8..5fcb04a00 100644 --- a/system/drivers/DB_driver.php +++ b/system/drivers/DB_driver.php @@ -352,7 +352,7 @@ class CI_DB_driver { */ function escape($str) { - if ( ! ctype_digit($str)) // bug fix to ensure that numbers are not treated as strings. + if ( ! is_numeric($str)) // bug fix to ensure that numbers are not treated as strings. { switch (gettype($str)) { diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index c8205bb7d..ab3a31867 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -223,7 +223,7 @@ function days_in_month($month = 0, $year = '') return 0; } - if ( ! ctype_digit($year) OR strlen($year) != 4) + if ( ! is_numeric($year) OR strlen($year) != 4) { $year = date('Y'); } diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php index 15b5573bf..e4f816eb1 100644 --- a/system/helpers/text_helper.php +++ b/system/helpers/text_helper.php @@ -333,7 +333,7 @@ function highlight_phrase($str, $phrase, $tag_open = '<strong>', $tag_close = '< */ function word_wrap($str, $chars = '76') { - if ( ! ctype_digit($chars)) + if ( ! is_numeric($chars)) $chars = 76; $str = preg_replace("/(\r\n|\r|\n)/", "\n", $str); diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 96dc0014d..abc77a54d 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -275,7 +275,7 @@ class CI_Email { */ function bcc($bcc, $limit = '') { - if ($limit != '' && ctype_digit($limit)) + if ($limit != '' && is_numeric($limit)) { $this->bcc_batch_mode = true; $this->bcc_batch_size = $limit; @@ -475,7 +475,7 @@ class CI_Email { */ function set_priority($n = 3) { - if ( ! ctype_digit($n)) + if ( ! is_numeric($n)) { $this->priority = 3; return; diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index 854f0484b..18e3253f7 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -291,7 +291,7 @@ class CI_Image_lib { // Set the quality $this->quality = trim(str_replace("%", "", $this->quality)); - if ($this->quality == '' OR $this->quality == 0 OR ! ctype_digit($this->quality)) + if ($this->quality == '' OR $this->quality == 0 OR ! is_numeric($this->quality)) $this->quality = 90; // Set the x/y coordinates diff --git a/system/libraries/Log.php b/system/libraries/Log.php index de5a9b836..6c78316f1 100644 --- a/system/libraries/Log.php +++ b/system/libraries/Log.php @@ -43,13 +43,13 @@ class CI_Log { function CI_Log($path = '', $threshold = 4, $date_fmt = '') { $this->log_path = ($path != '') ? $path : BASEPATH.'logs/'; - + if ( ! is_dir($this->log_path) OR ! is_writable($this->log_path)) { $this->_enabled = FALSE; } - if (ctype_digit($threshold)) + if (is_numeric($threshold)) { $this->_threshold = $threshold; } @@ -77,7 +77,7 @@ class CI_Log { function write_log($level = 'error', $msg, $php_error = FALSE) { if ($this->_enabled === FALSE) - { + { return FALSE; } diff --git a/system/libraries/Output.php b/system/libraries/Output.php index 73f03863e..7a03cf9c7 100644 --- a/system/libraries/Output.php +++ b/system/libraries/Output.php @@ -78,7 +78,7 @@ class CI_Output { */ function cache($time) { - $this->cache_expiration = ( ! ctype_digit($time)) ? 0 : $time; + $this->cache_expiration = ( ! is_numeric($time)) ? 0 : $time; } // -------------------------------------------------------------------- diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php index 0bbb577a3..9d558f00a 100644 --- a/system/libraries/Pagination.php +++ b/system/libraries/Pagination.php @@ -128,7 +128,7 @@ class CI_Pagination { $this->cur_page = $obj->uri->segment($this->uri_segment); } - if ( ! ctype_digit($this->cur_page)) + if ( ! is_numeric($this->cur_page)) { $this->cur_page = 0; } diff --git a/system/libraries/Router.php b/system/libraries/Router.php index 2219f5739..1c67113f6 100644 --- a/system/libraries/Router.php +++ b/system/libraries/Router.php @@ -219,15 +219,23 @@ class CI_Router { { return $segments; } - + // Is the controller in a sub-folder? if (is_dir(APPPATH.'controllers/'.$segments['0'])) - { + { // Set the directory and remove it from the segment array $this->set_directory($segments['0']); $segments = array_slice($segments, 1); - if (count($segments) == 0) + if (count($segments) > 0) + { + // Does the requested controller exist in the sub-folder? + if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$segments['0'].EXT)) + { + show_404(); + } + } + else { $this->set_class($this->default_controller); $this->set_method('index'); diff --git a/system/libraries/Session.php b/system/libraries/Session.php index 4f08cf692..94efee55c 100644 --- a/system/libraries/Session.php +++ b/system/libraries/Session.php @@ -99,7 +99,7 @@ class CI_Session { */ $expiration = $this->object->config->item('sess_expiration'); - if (ctype_digit($expiration)) + if (is_numeric($expiration)) { if ($expiration > 0) { diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index 583c6d28d..8f9680d44 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -368,7 +368,7 @@ class CI_Trackback { $tb_array = explode('/', $url); $tb_end = $tb_array[count($tb_array)-1]; - if ( ! ctype_digit($tb_end)) + if ( ! is_numeric($tb_end)) { $tb_end = $tb_array[count($tb_array)-2]; } @@ -386,7 +386,7 @@ class CI_Trackback { $tb_array = explode('/', $url); $tb_id = $tb_array[count($tb_array)-1]; - if ( ! ctype_digit($tb_id)) + if ( ! is_numeric($tb_id)) { $tb_id = $tb_array[count($tb_array)-2]; } diff --git a/system/libraries/URI.php b/system/libraries/URI.php index c5fd4625b..ba6279e88 100644 --- a/system/libraries/URI.php +++ b/system/libraries/URI.php @@ -88,7 +88,7 @@ class CI_URI { */ function uri_to_assoc($n = 3, $default = array()) { - if ( ! ctype_digit($n)) + if ( ! is_numeric($n)) { return $default; } @@ -110,7 +110,7 @@ class CI_URI { { $retval[$val] = FALSE; } - return $default; + return $retval; } $segments = array_slice($this->segment_array(), ($n - 1)); diff --git a/system/libraries/Validation.php b/system/libraries/Validation.php index 30faa85ed..44f49ff62 100644 --- a/system/libraries/Validation.php +++ b/system/libraries/Validation.php @@ -404,7 +404,7 @@ class CI_Validation { */ function min_length($str, $val) { - if ( ! ctype_digit($val)) + if ( ! is_numeric($val)) { return FALSE; } @@ -423,7 +423,7 @@ class CI_Validation { */ function max_length($str, $val) { - if ( ! ctype_digit($val)) + if ( ! is_numeric($val)) { return FALSE; } @@ -442,7 +442,7 @@ class CI_Validation { */ function exact_length($str, $val) { - if ( ! ctype_digit($val)) + if ( ! is_numeric($val)) { return FALSE; } @@ -517,7 +517,7 @@ class CI_Validation { */ function numeric($str) { - return ( ! ctype_digit($str)) ? FALSE : TRUE; + return ( ! is_numeric($str)) ? FALSE : TRUE; } // -------------------------------------------------------------------- |