diff options
Diffstat (limited to 'system')
-rwxr-xr-x | system/core/CodeIgniter.php | 8 | ||||
-rw-r--r-- | system/core/Common.php | 1 | ||||
-rwxr-xr-x | system/core/Input.php | 1 | ||||
-rwxr-xr-x | system/core/Security.php | 64 | ||||
-rw-r--r-- | system/database/DB_driver.php | 51 | ||||
-rw-r--r-- | system/database/drivers/mysql/mysql_result.php | 6 | ||||
-rw-r--r-- | system/database/drivers/mysqli/mysqli_driver.php | 19 | ||||
-rw-r--r-- | system/database/drivers/mysqli/mysqli_result.php | 6 | ||||
-rw-r--r-- | system/database/drivers/pdo/pdo_driver.php | 2 | ||||
-rw-r--r-- | system/helpers/date_helper.php | 2 | ||||
-rwxr-xr-x | system/helpers/url_helper.php | 10 | ||||
-rw-r--r-- | system/libraries/Email.php | 21 | ||||
-rw-r--r-- | system/libraries/Form_validation.php | 17 | ||||
-rw-r--r-- | system/libraries/Image_lib.php | 38 | ||||
-rw-r--r-- | system/libraries/Log.php | 8 | ||||
-rw-r--r-- | system/libraries/Migration.php | 36 | ||||
-rw-r--r-- | system/libraries/Pagination.php | 97 | ||||
-rw-r--r-- | system/libraries/Upload.php | 4 | ||||
-rw-r--r-- | system/libraries/Xmlrpc.php | 6 |
19 files changed, 250 insertions, 147 deletions
diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index 4d76a5587..97527e5ca 100755 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -106,9 +106,13 @@ * Set a liberal script execution time limit * ------------------------------------------------------ */ - if (function_exists("set_time_limit") == TRUE AND @ini_get("safe_mode") == 0) + if (function_exists("set_time_limit") AND @ini_get("safe_mode") == 0) { - @set_time_limit(300); + // Do not override the Time Limit value if running from Command Line + if(php_sapi_name() != 'cli') + { + @set_time_limit(300); + } } /* diff --git a/system/core/Common.php b/system/core/Common.php index e43bb8db3..b0921fe0c 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -419,6 +419,7 @@ if ( ! function_exists('set_status_header')) 415 => 'Unsupported Media Type', 416 => 'Requested Range Not Satisfiable', 417 => 'Expectation Failed', + 422 => 'Unprocessable Entity', 500 => 'Internal Server Error', 501 => 'Not Implemented', diff --git a/system/core/Input.php b/system/core/Input.php index 946d9296f..3cbbe787f 100755 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -740,7 +740,6 @@ class CI_Input { } } -// END Input class /* End of file Input.php */ /* Location: ./system/core/Input.php */ diff --git a/system/core/Security.php b/system/core/Security.php index ee4f0a08d..ce3f7d3cc 100755 --- a/system/core/Security.php +++ b/system/core/Security.php @@ -95,7 +95,8 @@ class CI_Security { '-moz-binding' => '[removed]', '<!--' => '<!--', '-->' => '-->', - '<![CDATA[' => '<![CDATA[' + '<![CDATA[' => '<![CDATA[', + '<comment>' => '<comment>' ); /** @@ -498,15 +499,7 @@ class CI_Security { { if ($this->_xss_hash == '') { - if (phpversion() >= 4.2) - { - mt_srand(); - } - else - { - mt_srand(hexdec(substr(md5(microtime()), -8)) & 0x7fffffff); - } - + mt_srand(); $this->_xss_hash = md5(time() + mt_rand(0, 1999999999)); } @@ -520,6 +513,12 @@ class CI_Security { * * This function is a replacement for html_entity_decode() * + * The reason we are not using html_entity_decode() by itself is because + * while it is not technically correct to leave out the semicolon + * at the end of an entity most browsers will still interpret the entity + * correctly. html_entity_decode() does not convert entities without + * semicolons, so we are left with our own little solution here. Bummer. + * * @param string * @param string * @return string @@ -536,11 +535,6 @@ class CI_Security { $charset = config_item('charset'); } - // The reason we are not using html_entity_decode() by itself is because - // while it is not technically correct to leave out the semicolon - // at the end of an entity most browsers will still interpret the entity - // correctly. html_entity_decode() does not convert entities without - // semicolons, so we are left with our own little solution here. Bummer. $str = html_entity_decode($str, ENT_COMPAT, $charset); $str = preg_replace('~&#x(0*[0-9a-f]{2,5})~ei', 'chr(hexdec("\\1"))', $str); return preg_replace('~&#([0-9]{2,4})~e', 'chr(\\1)', $str); @@ -637,25 +631,45 @@ class CI_Security { protected function _remove_evil_attributes($str, $is_image) { // All javascript event handlers (e.g. onload, onclick, onmouseover), style, and xmlns - $evil_attributes = array('on\w*', 'style', 'xmlns'); + $evil_attributes = array('on\w*', 'style', 'xmlns', 'formaction'); if ($is_image === TRUE) { /* - * Adobe Photoshop puts XML metadata into JFIF images, + * Adobe Photoshop puts XML metadata into JFIF images, * including namespacing, so we have to allow this for images. */ unset($evil_attributes[array_search('xmlns', $evil_attributes)]); } - + do { - $str = preg_replace( - "#<(/?[^><]+?)([^A-Za-z\-])(".implode('|', $evil_attributes).")(\s*=\s*)([\"][^>]*?[\"]|[\'][^>]*?[\']|[^>]*?)([\s><])([><]*)#i", - "<$1$6", - $str, -1, $count - ); - } while ($count); + $count = 0; + $attribs = array(); + + // find occurrences of illegal attribute strings without quotes + preg_match_all("/(".implode('|', $evil_attributes).")\s*=\s*([^\s]*)/is", $str, $matches, PREG_SET_ORDER); + + foreach ($matches as $attr) + { + $attribs[] = preg_quote($attr[0], '/'); + } + + // find occurrences of illegal attribute strings with quotes (042 and 047 are octal quotes) + preg_match_all("/(".implode('|', $evil_attributes).")\s*=\s*(\042|\047)([^\\2]*?)(\\2)/is", $str, $matches, PREG_SET_ORDER); + + foreach ($matches as $attr) + { + $attribs[] = preg_quote($attr[0], '/'); + } + // replace illegal attribute strings that are inside an html tag + if (count($attribs) > 0) + { + $str = preg_replace("/<(\/?[^><]+?)([^A-Za-z\-])(".implode('|', $attribs).")([\s><])([><]*)/i", '<$1$2$4$5', $str, -1, $count); + } + + } while ($count); + return $str; } @@ -877,4 +891,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/database/DB_driver.php b/system/database/DB_driver.php index dd1b5677a..9d92f2f87 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -126,16 +126,43 @@ class CI_DB_driver { // Connect to the database and set the connection ID $this->conn_id = ($this->pconnect == FALSE) ? $this->db_connect() : $this->db_pconnect(); - // No connection resource? Throw an error + // No connection resource? Check if there is a failover else throw an error if ( ! $this->conn_id) { - log_message('error', 'Unable to connect to the database'); + // Check if there is a failover set + if ( ! empty($this->failover) && is_array($this->failover)) + { + // Go over all the failovers + foreach ($this->failover as $failover) + { + // Replace the current settings with those of the failover + foreach ($failover as $key => $val) + { + $this->$key = $val; + } - if ($this->db_debug) + // Try to connect + $this->conn_id = ($this->pconnect == FALSE) ? $this->db_connect() : $this->db_pconnect(); + + // If a connection is made break the foreach loop + if ($this->conn_id) + { + break; + } + } + } + + // We still don't have a connection? + if ( ! $this->conn_id) { - $this->display_error('db_unable_to_connect'); + log_message('error', 'Unable to connect to the database'); + + if ($this->db_debug) + { + $this->display_error('db_unable_to_connect'); + } + return FALSE; } - return FALSE; } // ---------------------------------------------------------------- @@ -522,6 +549,7 @@ class CI_DB_driver { } $this->trans_begin($test_mode); + $this->_trans_depth += 1; } // -------------------------------------------------------------------- @@ -545,6 +573,10 @@ class CI_DB_driver { $this->_trans_depth -= 1; return TRUE; } + else + { + $this->_trans_depth = 0; + } // The query() function will set this flag to FALSE in the event that a query failed if ($this->_trans_status === FALSE) @@ -1032,7 +1064,14 @@ class CI_DB_driver { { $args = (func_num_args() > 1) ? array_splice(func_get_args(), 1) : null; - return call_user_func_array($function, $args); + if (is_null($args)) + { + return call_user_func($function); + } + else + { + return call_user_func_array($function, $args); + } } } diff --git a/system/database/drivers/mysql/mysql_result.php b/system/database/drivers/mysql/mysql_result.php index 66f782df0..29297b6a4 100644 --- a/system/database/drivers/mysql/mysql_result.php +++ b/system/database/drivers/mysql/mysql_result.php @@ -98,10 +98,10 @@ class CI_DB_mysql_result extends CI_DB_result { $retval = array(); while ($field = mysql_fetch_object($this->result_id)) { - preg_match('/([a-zA-Z]+)(\((\d+)\))?/i', $field->Type, $matches); + preg_match('/([a-zA-Z]+)(\(\d+\))?/', $field->Type, $matches); - $type = $matches[1]; - $length = isset($matches[3]) ? (int) $matches[3] : NULL; + $type = (array_key_exists(1, $matches)) ? $matches[1] : NULL; + $length = (array_key_exists(2, $matches)) ? preg_replace('/[^\d]/', '', $matches[2]) : NULL; $F = new stdClass(); $F->name = $field->Field; diff --git a/system/database/drivers/mysqli/mysqli_driver.php b/system/database/drivers/mysqli/mysqli_driver.php index 4af08c8a9..fb5953bd7 100644 --- a/system/database/drivers/mysqli/mysqli_driver.php +++ b/system/database/drivers/mysqli/mysqli_driver.php @@ -574,6 +574,25 @@ class CI_DB_mysqli_driver extends CI_DB { // -------------------------------------------------------------------- + + /** + * Replace statement + * + * Generates a platform-specific replace string from the supplied data + * + * @access public + * @param string the table name + * @param array the insert keys + * @param array the insert values + * @return string + */ + function _replace($table, $keys, $values) + { + return "REPLACE INTO ".$table." (".implode(', ', $keys).") VALUES (".implode(', ', $values).")"; + } + + // -------------------------------------------------------------------- + /** * Update statement * diff --git a/system/database/drivers/mysqli/mysqli_result.php b/system/database/drivers/mysqli/mysqli_result.php index bfe500e19..163788b6c 100644 --- a/system/database/drivers/mysqli/mysqli_result.php +++ b/system/database/drivers/mysqli/mysqli_result.php @@ -98,10 +98,10 @@ class CI_DB_mysqli_result extends CI_DB_result { $retval = array(); while ($field = mysqli_fetch_object($this->result_id)) { - preg_match('/([a-zA-Z]+)(\((\d+)\))?/i', $field->Type, $matches); + preg_match('/([a-zA-Z]+)(\(\d+\))?/', $field->Type, $matches); - $type = $matches[1]; - $length = isset($matches[3]) ? (int) $matches[3] : NULL; + $type = (array_key_exists(1, $matches)) ? $matches[1] : NULL; + $length = (array_key_exists(2, $matches)) ? preg_replace('/[^\d]/', '', $matches[2]) : NULL; $F = new stdClass(); $F->name = $field->Field; diff --git a/system/database/drivers/pdo/pdo_driver.php b/system/database/drivers/pdo/pdo_driver.php index a66a16e90..18a508b15 100644 --- a/system/database/drivers/pdo/pdo_driver.php +++ b/system/database/drivers/pdo/pdo_driver.php @@ -255,7 +255,7 @@ class CI_DB_pdo_driver extends CI_DB { // Reset the transaction failure flag. // If the $test_mode flag is set to TRUE transactions will be rolled back // even if the queries produce a successful result. - $this->_trans_failure = ($test_mode === TRUE) ? TRUE : FALSE; + $this->_trans_failure = (bool) ($test_mode === TRUE); return $this->conn_id->beginTransaction(); } diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php index 447bf55ac..8c92fdc89 100644 --- a/system/helpers/date_helper.php +++ b/system/helpers/date_helper.php @@ -132,7 +132,7 @@ if ( ! function_exists('standard_date')) 'DATE_COOKIE' => '%l, %d-%M-%y %H:%i:%s UTC', 'DATE_ISO8601' => '%Y-%m-%dT%H:%i:%s%Q', 'DATE_RFC822' => '%D, %d %M %y %H:%i:%s %O', - 'DATE_RFC850' => '%l, %d-%M-%y %H:%m:%i UTC', + 'DATE_RFC850' => '%l, %d-%M-%y %H:%i:%s UTC', 'DATE_RFC1036' => '%D, %d %M %y %H:%i:%s %O', 'DATE_RFC1123' => '%D, %d %M %Y %H:%i:%s %O', 'DATE_RSS' => '%D, %d %M %Y %H:%i:%s %O', diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index bfed96c6e..5d9afe457 100755 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -393,7 +393,7 @@ if ( ! function_exists('auto_link')) { if ($type != 'email') { - if (preg_match_all("#(^|\s|\()((http(s?)://)|(www\.))(\w+[^\s\)\<]+)#i", $str, $matches)) + if (preg_match_all("#(^|\s|\(|\b)((http(s?)://)|(www\.))(\w+[^\s\)\<]+)#i", $str, $matches)) { $pop = ($popup == TRUE) ? " target=\"_blank\" " : ""; @@ -544,13 +544,19 @@ if ( ! function_exists('url_title')) */ if ( ! function_exists('redirect')) { - function redirect($uri = '', $method = 'location', $http_response_code = 302) + function redirect($uri = '', $method = 'auto', $http_response_code = 302) { if ( ! preg_match('#^https?://#i', $uri)) { $uri = site_url($uri); } + // IIS environment likely? Use 'refresh' for better compatibility + if (DIRECTORY_SEPARATOR != '/' && $method == 'auto') + { + $method = 'refresh'; + } + switch($method) { case 'refresh' : header("Refresh:0;url=".$uri); diff --git a/system/libraries/Email.php b/system/libraries/Email.php index 6739db33b..631b62e86 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -418,11 +418,11 @@ class CI_Email { * @param string * @return void */ - public function attach($filename, $disposition = 'attachment') + public function attach($filename, $disposition = '', $newname = NULL) { - $this->_attach_name[] = $filename; + $this->_attach_name[] = array($filename, $newname); $this->_attach_type[] = $this->_mime_types(pathinfo($filename, PATHINFO_EXTENSION)); - $this->_attach_disp[] = $disposition; // Can also be 'inline' Not sure if it matters + $this->_attach_disp[] = empty($disposition) ? 'attachment' : $disposition; // Can also be 'inline' Not sure if it matters return $this; } @@ -1151,8 +1151,9 @@ class CI_Email { for ($i=0; $i < count($this->_attach_name); $i++) { - $filename = $this->_attach_name[$i]; - $basename = basename($filename); + $filename = $this->_attach_name[$i][0]; + $basename = ( is_null($this->_attach_name[$i][1]) ? basename($filename) : $this->_attach_name[$i][1] ); + $ctype = $this->_attach_type[$i]; if ( ! file_exists($filename)) @@ -1692,12 +1693,7 @@ class CI_Email { */ protected function _smtp_connect() { - $ssl = NULL; - - if ($this->smtp_crypto == 'ssl') - { - $ssl = 'ssl://'; - } + $ssl = ($this->smtp_crypto == 'ssl') ? 'ssl://' : NULL; $this->_smtp_connect = fsockopen($ssl.$this->smtp_host, $this->smtp_port, @@ -1717,6 +1713,7 @@ class CI_Email { { $this->_send_command('hello'); $this->_send_command('starttls'); + $crypto = stream_socket_enable_crypto($this->_smtp_connect, TRUE, STREAM_CRYPTO_METHOD_TLS_CLIENT); if ($crypto !== TRUE) @@ -2112,4 +2109,4 @@ class CI_Email { // END CI_Email class /* End of file Email.php */ -/* Location: ./system/libraries/Email.php */ +/* Location: ./system/libraries/Email.php */
\ No newline at end of file diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index 5663da981..918f6904c 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -5,9 +5,9 @@ * An open source application development framework for PHP 5.1.6 or newer * * NOTICE OF LICENSE - * + * * Licensed under the Open Software License version 3.0 - * + * * This source file is subject to the Open Software License (OSL 3.0) that is * bundled with this package in the files license.txt / license.rst. It is * also available through the world wide web at this URL: @@ -949,7 +949,7 @@ class CI_Form_validation { return ($str !== $field) ? FALSE : TRUE; } - + // -------------------------------------------------------------------- /** @@ -962,10 +962,13 @@ class CI_Form_validation { */ public function is_unique($str, $field) { - list($table, $field)=explode('.', $field); - $query = $this->CI->db->limit(1)->get_where($table, array($field => $str)); - - return $query->num_rows() === 0; + list($table, $field) = explode('.', $field); + if (isset($this->CI->db)) + { + $query = $this->CI->db->limit(1)->get_where($table, array($field => $str)); + return $query->num_rows() === 0; + } + return FALSE; } // -------------------------------------------------------------------- diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php index beb463b32..2ed488c7e 100644 --- a/system/libraries/Image_lib.php +++ b/system/libraries/Image_lib.php @@ -5,9 +5,9 @@ * An open source application development framework for PHP 5.1.6 or newer * * NOTICE OF LICENSE - * + * * Licensed under the Open Software License version 3.0 - * + * * This source file is subject to the Open Software License (OSL 3.0) that is * bundled with this package in the files license.txt / license.rst. It is * also available through the world wide web at this URL: @@ -116,15 +116,37 @@ class CI_Image_lib { */ function clear() { - $props = array('source_folder', 'dest_folder', 'source_image', 'full_src_path', 'full_dst_path', 'new_image', 'image_type', 'size_str', 'quality', 'orig_width', 'orig_height', 'rotation_angle', 'x_axis', 'y_axis', 'create_fnc', 'copy_fnc', 'wm_overlay_path', 'wm_use_truetype', 'dynamic_output', 'wm_font_size', 'wm_text', 'wm_vrt_alignment', 'wm_hor_alignment', 'wm_padding', 'wm_hor_offset', 'wm_vrt_offset', 'wm_font_color', 'wm_use_drop_shadow', 'wm_shadow_color', 'wm_shadow_distance', 'wm_opacity'); + $props = array('library_path', 'source_image', 'new_image', 'width', 'height', 'rotation_angle', 'x_axis', 'y_axis', 'wm_text', 'wm_overlay_path', 'wm_font_path', 'wm_shadow_color', 'source_folder', 'dest_folder', 'mime_type', 'orig_width', 'orig_height', 'image_type', 'size_str', 'full_src_path', 'full_dst_path'); foreach ($props as $val) { $this->$val = ''; } - // special consideration for master_dim - $this->master_dim = 'auto'; + $this->image_library = 'gd2'; + $this->dynamic_output = FALSE; + $this->quality = '90'; + $this->create_thumb = FALSE; + $this->thumb_marker = '_thumb'; + $this->maintain_ratio = TRUE; + $this->master_dim = 'auto'; + $this->wm_type = 'text'; + $this->wm_x_transp = 4; + $this->wm_y_transp = 4; + $this->wm_font_size = 17; + $this->wm_vrt_alignment = 'B'; + $this->wm_hor_alignment = 'C'; + $this->wm_padding = 0; + $this->wm_hor_offset = 0; + $this->wm_vrt_offset = 0; + $this->wm_font_color = '#ffffff'; + $this->wm_shadow_distance = 2; + $this->wm_opacity = 50; + $this->create_fnc = 'imagecreatetruecolor'; + $this->copy_fnc = 'imagecopyresampled'; + $this->error_msg = array(); + $this->wm_use_drop_shadow = FALSE; + $this->wm_use_truetype = FALSE; } // -------------------------------------------------------------------- @@ -158,7 +180,7 @@ class CI_Image_lib { if ($this->source_image == '') { $this->set_error('imglib_source_image_required'); - return FALSE; + return FALSE; } /* @@ -201,7 +223,7 @@ class CI_Image_lib { // Set the Image Properties if ( ! $this->get_image_properties($this->source_folder.$this->source_image)) { - return FALSE; + return FALSE; } /* @@ -411,7 +433,7 @@ class CI_Image_lib { if ($this->rotation_angle == '' OR ! in_array($this->rotation_angle, $degs)) { $this->set_error('imglib_rotation_angle_required'); - return FALSE; + return FALSE; } // Reassign the width and height diff --git a/system/libraries/Log.php b/system/libraries/Log.php index 6ea905f73..46c5b6ed2 100644 --- a/system/libraries/Log.php +++ b/system/libraries/Log.php @@ -111,6 +111,7 @@ class CI_Log { if ( ! file_exists($filepath)) { + $newfile = TRUE; $message .= "<"."?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?".">\n\n"; } @@ -126,7 +127,10 @@ class CI_Log { flock($fp, LOCK_UN); fclose($fp); - @chmod($filepath, FILE_WRITE_MODE); + if (isset($newfile) AND $newfile === TRUE) + { + @chmod($filepath, FILE_WRITE_MODE); + } return TRUE; } @@ -134,4 +138,4 @@ class CI_Log { // END Log Class /* End of file Log.php */ -/* Location: ./system/libraries/Log.php */
\ No newline at end of file +/* Location: ./system/libraries/Log.php */ diff --git a/system/libraries/Migration.php b/system/libraries/Migration.php index b7edf7195..94961b568 100644 --- a/system/libraries/Migration.php +++ b/system/libraries/Migration.php @@ -5,9 +5,9 @@ * An open source application development framework for PHP 5.1.6 or newer * * NOTICE OF LICENSE - * + * * Licensed under the Open Software License version 3.0 - * + * * This source file is subject to the Open Software License (OSL 3.0) that is * bundled with this package in the files license.txt / license.rst. It is * also available through the world wide web at this URL: @@ -46,7 +46,7 @@ class CI_Migration { protected $_migration_version = 0; protected $_migration_table = 'migrations'; protected $_migration_auto_latest = FALSE; - + protected $_error_string = ''; public function __construct($config = array()) @@ -71,7 +71,7 @@ class CI_Migration { } // If not set, set it - $this->_migration_path == '' AND $this->_migration_path = APPPATH . 'migrations/'; + $this->_migration_path == '' AND $this->_migration_path = APPPATH.'migrations/'; // Add trailing slash if not set $this->_migration_path = rtrim($this->_migration_path, '/').'/'; @@ -85,7 +85,7 @@ class CI_Migration { // Make sure the migration table name was set. if (empty($this->_migration_table)) { - show_error('Migrations configuration file (migration.php) must have "migration_table" set.'); + show_error('Migrations configuration file (migration.php) must have "migration_table" set.'); } // If the migrations table is missing, make it @@ -99,9 +99,9 @@ class CI_Migration { $this->db->insert($this->_migration_table, array('version' => 0)); } - + // Do we auto migrate to the latest migration? - if ( $this->_migration_auto_latest == TRUE ) + if ($this->_migration_auto_latest == TRUE) { if ( ! $this->latest() ) { @@ -140,7 +140,7 @@ class CI_Migration { // Moving Down $step = -1; } - + $method = $step === 1 ? 'up' : 'down'; $migrations = array(); @@ -148,7 +148,7 @@ class CI_Migration { // But first let's make sure that everything is the way it should be for ($i = $start; $i != $stop; $i += $step) { - $f = glob(sprintf($this->_migration_path . '%03d_*.php', $i)); + $f = glob(sprintf($this->_migration_path.'%03d_*.php', $i)); // Only one migration per step is permitted if (count($f) > 1) @@ -189,7 +189,7 @@ class CI_Migration { } include $f[0]; - $class = 'Migration_' . ucfirst($match[1]); + $class = 'Migration_'.ucfirst($match[1]); if ( ! class_exists($class)) { @@ -212,7 +212,7 @@ class CI_Migration { } } - log_message('debug', 'Current migration: ' . $current_version); + log_message('debug', 'Current migration: '.$current_version); $version = $i + ($step == 1 ? -1 : 0); @@ -222,13 +222,13 @@ class CI_Migration { return TRUE; } - log_message('debug', 'Migrating from ' . $method . ' to version ' . $version); + log_message('debug', 'Migrating from '.$method.' to version '.$version); // Loop through the migrations foreach ($migrations AS $migration) { // Run the migration class - $class = 'Migration_' . ucfirst(strtolower($migration)); + $class = 'Migration_'.ucfirst(strtolower($migration)); call_user_func(array(new $class, $method)); $current_version += $step; @@ -252,12 +252,12 @@ class CI_Migration { { if ( ! $migrations = $this->find_migrations()) { - $this->_error_string = $this->line->lang('migration_none_found'); + $this->_error_string = $this->lang->line('migration_none_found'); return false; } $last_migration = basename(end($migrations)); - + // Calculate the last migration step from existing migration // filenames and procceed to the standard version migration return $this->version((int) substr($last_migration, 0, 3)); @@ -300,9 +300,9 @@ class CI_Migration { protected function find_migrations() { // Load all *_*.php files in the migrations path - $files = glob($this->_migration_path . '*_*.php'); + $files = glob($this->_migration_path.'*_*.php'); $file_count = count($files); - + for ($i = 0; $i < $file_count; $i++) { // Mark wrongly formatted files as false for later filtering @@ -312,7 +312,7 @@ class CI_Migration { $files[$i] = FALSE; } } - + sort($files); return $files; diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php index 7398c292d..eea953ae4 100644 --- a/system/libraries/Pagination.php +++ b/system/libraries/Pagination.php @@ -5,9 +5,9 @@ * An open source application development framework for PHP 5.1.6 or newer * * NOTICE OF LICENSE - * + * * Licensed under the Open Software License version 3.0 - * + * * This source file is subject to the Open Software License (OSL 3.0) that is * bundled with this package in the files license.txt / license.rst. It is * also available through the world wide web at this URL: @@ -38,39 +38,38 @@ */ class CI_Pagination { - var $base_url = ''; // The page we are linking to - var $prefix = ''; // A custom prefix added to the path. - var $suffix = ''; // A custom suffix added to the path. - - var $total_rows = 0; // Total number of items (database results) - var $per_page = 10; // Max number of items you want shown per page - var $num_links = 2; // Number of "digit" links to show before/after the currently viewed page - var $cur_page = 0; // The current page being viewed - var $use_page_numbers = FALSE; // Use page number for segment instead of offset - var $first_link = '‹ First'; - var $next_link = '>'; - var $prev_link = '<'; - var $last_link = 'Last ›'; - var $uri_segment = 3; - var $full_tag_open = ''; - var $full_tag_close = ''; - var $first_tag_open = ''; - var $first_tag_close = ' '; - var $last_tag_open = ' '; - var $last_tag_close = ''; - var $first_url = ''; // Alternative URL for the First Page. - var $cur_tag_open = ' <strong>'; - var $cur_tag_close = '</strong>'; - var $next_tag_open = ' '; - var $next_tag_close = ' '; - var $prev_tag_open = ' '; - var $prev_tag_close = ''; - var $num_tag_open = ' '; - var $num_tag_close = ''; - var $page_query_string = FALSE; - var $query_string_segment = 'per_page'; - var $display_pages = TRUE; - var $anchor_class = ''; + protected $base_url = ''; // The page we are linking to + protected $prefix = ''; // A custom prefix added to the path. + protected $suffix = ''; // A custom suffix added to the path. + protected $total_rows = 0; // Total number of items (database results) + protected $per_page = 10; // Max number of items you want shown per page + protected $num_links = 2; // Number of "digit" links to show before/after the currently viewed page + protected $cur_page = 0; // The current page being viewed + protected $use_page_numbers = FALSE; // Use page number for segment instead of offset + protected $first_link = '‹ First'; + protected $next_link = '>'; + protected $prev_link = '<'; + protected $last_link = 'Last ›'; + protected $uri_segment = 3; + protected $full_tag_open = ''; + protected $full_tag_close = ''; + protected $first_tag_open = ''; + protected $first_tag_close = ' '; + protected $last_tag_open = ' '; + protected $last_tag_close = ''; + protected $first_url = ''; // Alternative URL for the First Page. + protected $cur_tag_open = ' <strong>'; + protected $cur_tag_close = '</strong>'; + protected $next_tag_open = ' '; + protected $next_tag_close = ' '; + protected $prev_tag_open = ' '; + protected $prev_tag_close = ''; + protected $num_tag_open = ' '; + protected $num_tag_close = ''; + protected $page_query_string = FALSE; + protected $query_string_segment = 'per_page'; + protected $display_pages = TRUE; + protected $anchor_class = ''; /** * Constructor @@ -80,16 +79,7 @@ class CI_Pagination { */ public function __construct($params = array()) { - if (count($params) > 0) - { - $this->initialize($params); - } - - if ($this->anchor_class != '') - { - $this->anchor_class = 'class="'.$this->anchor_class.'" '; - } - + $this->initialize($params); log_message('debug', "Pagination Class Initialized"); } @@ -102,7 +92,7 @@ class CI_Pagination { * @param array initialization parameters * @return void */ - function initialize($params = array()) + public function initialize($params = array()) { if (count($params) > 0) { @@ -114,6 +104,11 @@ class CI_Pagination { } } } + + if ($this->anchor_class != '') + { + $this->anchor_class = 'class="'.$this->anchor_class.'" '; + } } // -------------------------------------------------------------------- @@ -124,7 +119,7 @@ class CI_Pagination { * @access public * @return string */ - function create_links() + public function create_links() { // If our item count or per-page total is zero there is no need to continue. if ($this->total_rows == 0 OR $this->per_page == 0) @@ -167,7 +162,7 @@ class CI_Pagination { $this->cur_page = (int) $this->cur_page; } } - + // Set current page to 1 if using page numbers instead of offset if ($this->use_page_numbers AND $this->cur_page == 0) { @@ -204,7 +199,7 @@ class CI_Pagination { } $uri_page_number = $this->cur_page; - + if ( ! $this->use_page_numbers) { $this->cur_page = floor(($this->cur_page/$this->per_page) + 1); @@ -298,11 +293,11 @@ class CI_Pagination { if ($this->last_link !== FALSE AND ($this->cur_page + $this->num_links) < $num_pages) { $i = ($this->use_page_numbers) ? $num_pages : ($num_pages * $this->per_page) - $this->per_page; - + $output .= $this->last_tag_open.'<a '.$this->anchor_class.'href="'.$this->base_url.$this->prefix.$i.$this->suffix.'">'.$this->last_link.'</a>'.$this->last_tag_close; } - // Kill double slashes. Note: Sometimes we can end up with a double slash + // Kill double slashes. Note: Sometimes we can end up with a double slash // in the penultimate link so we'll kill all double slashes. $output = preg_replace("#([^:])//+#", "\\1/", $output); diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index 56062befb..66e91c5b6 100644 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -1033,7 +1033,7 @@ class CI_Upload { protected function _file_mime_type($file) { // Use if the Fileinfo extension, if available (only versions above 5.3 support the FILEINFO_MIME_TYPE flag) - if (is_php('5.3') && function_exists('finfo_file')) + if ( (float) substr(phpversion(), 0, 3) >= 5.3 && function_exists('finfo_file')) { $finfo = new finfo(FILEINFO_MIME_TYPE); if ($finfo !== FALSE) // This is possible, if there is no magic MIME database file found on the system @@ -1086,4 +1086,4 @@ class CI_Upload { // END Upload Class /* End of file Upload.php */ -/* Location: ./system/libraries/Upload.php */ +/* Location: ./system/libraries/Upload.php */
\ No newline at end of file diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php index 2f66ef09a..7b1e3fa6e 100644 --- a/system/libraries/Xmlrpc.php +++ b/system/libraries/Xmlrpc.php @@ -1416,14 +1416,14 @@ class XML_RPC_Values extends CI_Xmlrpc { if ($utc == 1) { - $t = strftime("%Y%m%dT%H:%M:%S", $time); + $t = strftime("%Y%m%dT%H:%i:%s", $time); } else { if (function_exists('gmstrftime')) - $t = gmstrftime("%Y%m%dT%H:%M:%S", $time); + $t = gmstrftime("%Y%m%dT%H:%i:%s", $time); else - $t = strftime("%Y%m%dT%H:%M:%S", $time - date('Z')); + $t = strftime("%Y%m%dT%H:%i:%s", $time - date('Z')); } return $t; } |