summaryrefslogtreecommitdiffstats
path: root/system/libraries
diff options
context:
space:
mode:
Diffstat (limited to 'system/libraries')
-rw-r--r--system/libraries/Cache/drivers/Cache_file.php2
-rw-r--r--system/libraries/Calendar.php4
-rw-r--r--system/libraries/Email.php14
-rw-r--r--system/libraries/Form_validation.php46
-rw-r--r--system/libraries/Ftp.php2
-rw-r--r--system/libraries/Javascript.php2
-rw-r--r--system/libraries/Migration.php2
-rw-r--r--system/libraries/Pagination.php172
-rw-r--r--system/libraries/Profiler.php6
-rw-r--r--system/libraries/Upload.php16
-rw-r--r--system/libraries/Xmlrpc.php2
-rw-r--r--system/libraries/Xmlrpcs.php2
-rw-r--r--system/libraries/Zip.php2
13 files changed, 177 insertions, 95 deletions
diff --git a/system/libraries/Cache/drivers/Cache_file.php b/system/libraries/Cache/drivers/Cache_file.php
index 08231963e..37d77c268 100644
--- a/system/libraries/Cache/drivers/Cache_file.php
+++ b/system/libraries/Cache/drivers/Cache_file.php
@@ -73,7 +73,7 @@ class CI_Cache_file extends CI_Driver {
$data = unserialize(file_get_contents($this->_cache_path.$id));
- if (time() > $data['time'] + $data['ttl'])
+ if ($data['ttl'] > 0 && time() > $data['time'] + $data['ttl'])
{
unlink($this->_cache_path.$id);
return FALSE;
diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php
index 969a7610a..a49f171b9 100644
--- a/system/libraries/Calendar.php
+++ b/system/libraries/Calendar.php
@@ -155,7 +155,7 @@ class CI_Calendar {
public function generate($year = '', $month = '', $data = array())
{
// Set and validate the supplied month/year
- if ($year === '')
+ if (empty($year))
{
$year = date('Y', $this->local_time);
}
@@ -168,7 +168,7 @@ class CI_Calendar {
$year = '20'.$year;
}
- if ($month === '')
+ if (empty($month))
{
$month = date('m', $this->local_time);
}
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index 09f217530..dd5477e05 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -247,7 +247,7 @@ class CI_Email {
$name = $replyto;
}
- if (strncmp($name, '"', 1) !== 0)
+ if (strpos($name, '"') !== 0)
{
$name = '"'.$name.'"';
}
@@ -606,7 +606,7 @@ class CI_Email {
foreach ($this->_base_charsets as $charset)
{
- if (strncmp($charset, $this->charset, strlen($charset)) === 0)
+ if (strpos($charset, $this->charset) === 0)
{
$this->_encoding = '7bit';
}
@@ -651,7 +651,7 @@ class CI_Email {
protected function _set_date()
{
$timezone = date('Z');
- $operator = (strncmp($timezone, '-', 1) === 0) ? '-' : '+';
+ $operator = ($timezone[0] === '-') ? '-' : '+';
$timezone = abs($timezone);
$timezone = floor($timezone/3600) * 100 + ($timezone % 3600) / 60;
@@ -1481,7 +1481,7 @@ class CI_Email {
$this->_set_error_message($reply);
- if (strncmp($reply, '250', 3) !== 0)
+ if (strpos($reply, '250') !== 0)
{
$this->_set_error_message('lang:email_smtp_error', $reply);
return FALSE;
@@ -1637,7 +1637,7 @@ class CI_Email {
$reply = $this->_get_smtp_data();
- if (strncmp($reply, '334', 3) !== 0)
+ if (strpos($reply, '334') !== 0)
{
$this->_set_error_message('lang:email_failed_smtp_login', $reply);
return FALSE;
@@ -1647,7 +1647,7 @@ class CI_Email {
$reply = $this->_get_smtp_data();
- if (strncmp($reply, '334', 3) !== 0)
+ if (strpos($reply, '334') !== 0)
{
$this->_set_error_message('lang:email_smtp_auth_un', $reply);
return FALSE;
@@ -1657,7 +1657,7 @@ class CI_Email {
$reply = $this->_get_smtp_data();
- if (strncmp($reply, '235', 3) !== 0)
+ if (strpos($reply, '235') !== 0)
{
$this->_set_error_message('lang:email_smtp_auth_pw', $reply);
return FALSE;
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index 6cbe032c7..8e03e91f3 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -571,8 +571,7 @@ class CI_Form_validation {
{
foreach ($postdata as $key => $val)
{
- $this->_execute($row, $rules, $val, $cycles);
- $cycles++;
+ $this->_execute($row, $rules, $val, $key);
}
return;
@@ -649,7 +648,12 @@ class CI_Form_validation {
}
else
{
- $postdata = $this->_field_data[$row['field']]['postdata'];
+ // If we get an array field, but it's not expected - then it is most likely
+ // somebody messing with the form on the client side, so we'll just consider
+ // it an empty field
+ $postdata = is_array($this->_field_data[$row['field']]['postdata'])
+ ? NULL
+ : $this->_field_data[$row['field']]['postdata'];
}
// Is the rule a callback?
@@ -993,15 +997,19 @@ class CI_Form_validation {
* Minimum Length
*
* @param string
- * @param int
+ * @param string
* @return bool
*/
public function min_length($str, $val)
{
- if (preg_match('/[^0-9]/', $val))
+ if ( ! is_numeric($val))
{
return FALSE;
}
+ else
+ {
+ $val = (int) $val;
+ }
return (MB_ENABLED === TRUE)
? ($val <= mb_strlen($str))
@@ -1014,15 +1022,19 @@ class CI_Form_validation {
* Max Length
*
* @param string
- * @param int
+ * @param string
* @return bool
*/
public function max_length($str, $val)
{
- if (preg_match('/[^0-9]/', $val))
+ if ( ! is_numeric($val))
{
return FALSE;
}
+ else
+ {
+ $val = (int) $val;
+ }
return (MB_ENABLED === TRUE)
? ($val >= mb_strlen($str))
@@ -1035,15 +1047,19 @@ class CI_Form_validation {
* Exact Length
*
* @param string
- * @param int
+ * @param string
* @return bool
*/
public function exact_length($str, $val)
{
- if (preg_match('/[^0-9]/', $val))
+ if ( ! is_numeric($val))
{
return FALSE;
}
+ else
+ {
+ $val = (int) $val;
+ }
return (MB_ENABLED === TRUE)
? (mb_strlen($str) === $val)
@@ -1113,7 +1129,7 @@ class CI_Form_validation {
*/
public function alpha($str)
{
- return (bool) preg_match('/^[a-z]+$/i', $str);
+ return ctype_alpha($str);
}
// --------------------------------------------------------------------
@@ -1126,7 +1142,7 @@ class CI_Form_validation {
*/
public function alpha_numeric($str)
{
- return (bool) preg_match('/^[a-z0-9]+$/i', $str);
+ return ctype_alnum((string) $str);
}
// --------------------------------------------------------------------
@@ -1248,7 +1264,7 @@ class CI_Form_validation {
*/
public function is_natural($str)
{
- return (bool) preg_match('/^[0-9]+$/', $str);
+ return ctype_digit((string) $str);
}
// --------------------------------------------------------------------
@@ -1261,7 +1277,7 @@ class CI_Form_validation {
*/
public function is_natural_no_zero($str)
{
- return ($str !== 0 && preg_match('/^[0-9]+$/', $str));
+ return ($str != 0 && ctype_digit((string) $str));
}
// --------------------------------------------------------------------
@@ -1344,7 +1360,7 @@ class CI_Form_validation {
*/
public function strip_image_tags($str)
{
- return $this->CI->input->strip_image_tags($str);
+ return $this->CI->security->strip_image_tags($str);
}
// --------------------------------------------------------------------
@@ -1370,7 +1386,7 @@ class CI_Form_validation {
*/
public function encode_php_tags($str)
{
- return str_replace(array('<?php', '<?PHP', '<?', '?>'), array('&lt;?php', '&lt;?PHP', '&lt;?', '?&gt;'), $str);
+ return str_replace(array('<?', '?>'), array('&lt;?', '?&gt;'), $str);
}
// --------------------------------------------------------------------
diff --git a/system/libraries/Ftp.php b/system/libraries/Ftp.php
index 461e884fb..76f5e151a 100644
--- a/system/libraries/Ftp.php
+++ b/system/libraries/Ftp.php
@@ -445,7 +445,7 @@ class CI_FTP {
* Set file permissions
*
* @param string the file path
- * @param string the permissions
+ * @param int the permissions
* @return bool
*/
public function chmod($path, $perm)
diff --git a/system/libraries/Javascript.php b/system/libraries/Javascript.php
index 98fec61d3..5c8b09217 100644
--- a/system/libraries/Javascript.php
+++ b/system/libraries/Javascript.php
@@ -620,7 +620,7 @@ class CI_Javascript {
$this->_javascript_location = $this->CI->config->item('javascript_location');
}
- if ($relative === TRUE OR strncmp($external_file, 'http://', 7) === 0 OR strncmp($external_file, 'https://', 8) === 0)
+ if ($relative === TRUE OR strpos($external_file, 'http://') === 0 OR strpos($external_file, 'https://') === 0)
{
$str = $this->_open_script($external_file);
}
diff --git a/system/libraries/Migration.php b/system/libraries/Migration.php
index 4391b235d..3a1e7a0ad 100644
--- a/system/libraries/Migration.php
+++ b/system/libraries/Migration.php
@@ -179,7 +179,7 @@ class CI_Migration {
// We now prepare to actually DO the migrations
// But first let's make sure that everything is the way it should be
- for ($i = $start; $i !== $stop; $i += $step)
+ for ($i = $start; $i != $stop; $i += $step)
{
$f = glob(sprintf($this->_migration_path.'%03d_*.php', $i));
diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php
index cdec736ff..75745dd48 100644
--- a/system/libraries/Pagination.php
+++ b/system/libraries/Pagination.php
@@ -36,39 +36,40 @@
*/
class CI_Pagination {
- public $base_url = ''; // The page we are linking to
- public $prefix = ''; // A custom prefix added to the path.
- public $suffix = ''; // A custom suffix added to the path.
- public $total_rows = 0; // Total number of items (database results)
- public $per_page = 10; // Max number of items you want shown per page
- public $num_links = 2; // Number of "digit" links to show before/after the currently viewed page
- public $cur_page = 0; // The current page being viewed
- public $use_page_numbers = FALSE; // Use page number for segment instead of offset
- public $first_link = '&lsaquo; First';
- public $next_link = '&gt;';
- public $prev_link = '&lt;';
- public $last_link = 'Last &rsaquo;';
- public $uri_segment = 3;
- public $full_tag_open = '';
- public $full_tag_close = '';
- public $first_tag_open = '';
- public $first_tag_close = '&nbsp;';
- public $last_tag_open = '&nbsp;';
- public $last_tag_close = '';
- public $first_url = ''; // Alternative URL for the First Page.
- public $cur_tag_open = '&nbsp;<strong>';
- public $cur_tag_close = '</strong>';
- public $next_tag_open = '&nbsp;';
- public $next_tag_close = '&nbsp;';
- public $prev_tag_open = '&nbsp;';
- public $prev_tag_close = '';
- public $num_tag_open = '&nbsp;';
- public $num_tag_close = '';
- public $page_query_string = FALSE;
- public $query_string_segment = 'per_page';
- public $display_pages = TRUE;
- public $anchor_class = '';
- public $attr_rel = TRUE;
+ 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 = '&lsaquo; First';
+ protected $next_link = '&gt;';
+ protected $prev_link = '&lt;';
+ protected $last_link = 'Last &rsaquo;';
+ protected $uri_segment = 3;
+ protected $full_tag_open = '';
+ protected $full_tag_close = '';
+ protected $first_tag_open = '';
+ protected $first_tag_close = '&nbsp;';
+ protected $last_tag_open = '&nbsp;';
+ protected $last_tag_close = '';
+ protected $first_url = ''; // Alternative URL for the First Page.
+ protected $cur_tag_open = '&nbsp;<strong>';
+ protected $cur_tag_close = '</strong>';
+ protected $next_tag_open = '&nbsp;';
+ protected $next_tag_close = '&nbsp;';
+ protected $prev_tag_open = '&nbsp;';
+ protected $prev_tag_close = '';
+ protected $num_tag_open = '&nbsp;';
+ protected $num_tag_close = '';
+ protected $page_query_string = FALSE;
+ protected $query_string_segment = 'per_page';
+ protected $display_pages = TRUE;
+ protected $_attributes = '';
+ protected $_link_types = array();
+ protected $reuse_query_string = FALSE;
/**
* Constructor
@@ -92,15 +93,29 @@ class CI_Pagination {
*/
public function initialize($params = array())
{
+ $attributes = array();
+
+ if (isset($params['attributes']) && is_array($params['attributes']))
+ {
+ $attributes = $params['attributes'];
+ unset($params['attributes']);
+ }
+
+ // Deprecated legacy support for the anchor_class option
+ // Should be removed in CI 3.1+
+ if (isset($params['anchor_class']))
+ {
+ empty($params['anchor_class']) OR $attributes['class'] = $params['anchor_class'];
+ unset($params['anchor_class']);
+ }
+
+ $this->_parse_attributes($attributes);
+
if (count($params) > 0)
{
foreach ($params as $key => $val)
{
- if ($key === 'anchor_class')
- {
- $this->anchor_class = ($val) ? 'class="'.$val.'" ' : '';
- }
- elseif (isset($this->$key))
+ if (isset($this->$key))
{
$this->$key = $val;
}
@@ -208,29 +223,46 @@ class CI_Pagination {
// And here we go...
$output = '';
+ $query_string = '';
+
+ // Add anything in the query string back to the links
+ // Note: Nothing to do with query_string_segment or any other query string options
+ if ($this->reuse_query_string === TRUE)
+ {
+ $get = $CI->input->get();
+
+ // Unset the controll, method, old-school routing options
+ unset($get['c'], $get['m'], $get[$this->query_string_segment]);
+
+ // Put everything else onto the end
+ $query_string = (strpos($this->base_url, '&amp;') !== FALSE ? '&amp;' : '?') . http_build_query($get, '', '&amp;');
+
+ // Add this after the suffix to put it into more links easily
+ $this->suffix .= $query_string;
+ }
// Render the "First" link
if ($this->first_link !== FALSE && $this->cur_page > ($this->num_links + 1))
{
$first_url = ($this->first_url === '') ? $this->base_url : $this->first_url;
- $output .= $this->first_tag_open.'<a '.$this->anchor_class.'href="'.$first_url.'"'.$this->_attr_rel('start').'>'
+ $output .= $this->first_tag_open.'<a href="'.$first_url.'"'.$this->_attributes.$this->_attr_rel('start').'>'
.$this->first_link.'</a>'.$this->first_tag_close;
}
// Render the "previous" link
- if ($this->prev_link !== FALSE && $this->cur_page !== 1)
+ if ($this->prev_link !== FALSE && $this->cur_page !== 1)
{
$i = ($this->use_page_numbers) ? $uri_page_number - 1 : $uri_page_number - $this->per_page;
if ($i === $base_page && $this->first_url !== '')
{
- $output .= $this->prev_tag_open.'<a '.$this->anchor_class.'href="'.$this->first_url.'"'.$this->_attr_rel('prev').'>'
+ $output .= $this->prev_tag_open.'<a href="'.$this->first_url.$query_string.'"'.$this->_attributes.$this->_attr_rel('prev').'>'
.$this->prev_link.'</a>'.$this->prev_tag_close;
}
else
{
- $i = ($i === $base_page) ? '' : $this->prefix.$i.$this->suffix;
- $output .= $this->prev_tag_open.'<a '.$this->anchor_class.'href="'.$this->base_url.$i.'"'.$this->_attr_rel('prev').'>'
+ $append = ($i === $base_page) ? $query_string : $this->prefix.$i.$this->suffix;
+ $output .= $this->prev_tag_open.'<a href="'.$this->base_url.$append.'"'.$this->_attributes.$this->_attr_rel('prev').'>'
.$this->prev_link.'</a>'.$this->prev_tag_close;
}
@@ -243,7 +275,6 @@ class CI_Pagination {
for ($loop = $start -1; $loop <= $end; $loop++)
{
$i = ($this->use_page_numbers) ? $loop : ($loop * $this->per_page) - $this->per_page;
-
if ($i >= $base_page)
{
if ($this->cur_page === $loop)
@@ -253,17 +284,15 @@ class CI_Pagination {
else
{
$n = ($i === $base_page) ? '' : $i;
-
- if ($n === '' && $this->first_url !== '')
+ if ($n === '' && ! empty($this->first_url))
{
- $output .= $this->num_tag_open.'<a '.$this->anchor_class.'href="'.$this->first_url.'"'.$this->_attr_rel('start').'>'
+ $output .= $this->num_tag_open.'<a href="'.$this->first_url.$query_string.'"'.$this->_attributes.$this->_attr_rel('start').'>'
.$loop.'</a>'.$this->num_tag_close;
}
else
{
- $n = ($n === '') ? '' : $this->prefix.$n.$this->suffix;
-
- $output .= $this->num_tag_open.'<a '.$this->anchor_class.'href="'.$this->base_url.$n.'"'.$this->_attr_rel().'>'
+ $append = ($n === '') ? $query_string : $this->prefix.$n.$this->suffix;
+ $output .= $this->num_tag_open.'<a href="'.$this->base_url.$append.'"'.$this->_attributes.$this->_attr_rel('start').'>'
.$loop.'</a>'.$this->num_tag_close;
}
}
@@ -276,8 +305,8 @@ class CI_Pagination {
{
$i = ($this->use_page_numbers) ? $this->cur_page + 1 : $this->cur_page * $this->per_page;
- $output .= $this->next_tag_open.'<a '.$this->anchor_class.'href="'.$this->base_url.$this->prefix.$i.$this->suffix.'"'.$this->_attr_rel('next').'>'
- .$this->next_link.'</a>'.$this->next_tag_close;
+ $output .= $this->next_tag_open.'<a href="'.$this->base_url.$this->prefix.$i.$this->suffix.'"'.$this->_attributes
+ .$this->_attr_rel('next').'>'.$this->next_link.'</a>'.$this->next_tag_close;
}
// Render the "Last" link
@@ -285,7 +314,7 @@ class CI_Pagination {
{
$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->_attr_rel().'>'
+ $output .= $this->last_tag_open.'<a href="'.$this->base_url.$this->prefix.$i.$this->suffix.'"'.$this->_attributes.'>'
.$this->last_link.'</a>'.$this->last_tag_close;
}
@@ -300,23 +329,44 @@ class CI_Pagination {
// --------------------------------------------------------------------
/**
+ * Parse attributes
+ *
+ * @param array
+ * @return void
+ */
+ protected function _parse_attributes($attributes)
+ {
+ isset($attributes['rel']) OR $attributes['rel'] = TRUE;
+ $this->_link_types = ($attributes['rel'])
+ ? array('start' => 'start', 'prev' => 'prev', 'next' => 'next')
+ : array();
+ unset($attributes['rel']);
+
+ $this->_attributes = '';
+ foreach ($attributes as $key => $value)
+ {
+ $this->_attributes .= ' '.$key.'="'.$value.'"';
+ }
+ }
+
+ // --------------------------------------------------------------------
+
+ /**
* Add "rel" attribute
*
+ * @link http://www.w3.org/TR/html5/links.html#linkTypes
* @param string
* @return string
*/
- protected function _attr_rel($value = '')
+ protected function _attr_rel($type)
{
- if (empty($this->attr_rel) OR ($this->attr_rel === TRUE && empty($value)))
- {
- return '';
- }
- elseif ( ! is_bool($this->attr_rel))
+ if (isset($this->_link_types[$type]))
{
- $value = $this->attr_rel;
+ unset($this->_link_types[$type]);
+ return ' rel="'.$type.'"';
}
- return ' rel="'.$value.'"';
+ return '';
}
}
diff --git a/system/libraries/Profiler.php b/system/libraries/Profiler.php
index d96088c14..1e961f6df 100644
--- a/system/libraries/Profiler.php
+++ b/system/libraries/Profiler.php
@@ -116,6 +116,12 @@ class CI_Profiler {
*/
public function set_sections($config)
{
+ if (isset($config['query_toggle_count']))
+ {
+ $this->_query_toggle_count = (int) $config['query_toggle_count'];
+ unset($config['query_toggle_count']);
+ }
+
foreach ($config as $method => $enable)
{
if (in_array($method, $this->_available_sections))
diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php
index c96daaf15..d381440cd 100644
--- a/system/libraries/Upload.php
+++ b/system/libraries/Upload.php
@@ -59,6 +59,7 @@ class CI_Upload {
public $error_msg = array();
public $mimes = array();
public $remove_spaces = TRUE;
+ public $detect_mime = TRUE;
public $xss_clean = FALSE;
public $temp_prefix = 'temp_file_';
public $client_name = '';
@@ -116,6 +117,7 @@ class CI_Upload {
'image_size_str' => '',
'error_msg' => array(),
'remove_spaces' => TRUE,
+ 'detect_mime' => TRUE,
'xss_clean' => FALSE,
'temp_prefix' => 'temp_file_',
'client_name' => ''
@@ -209,7 +211,13 @@ class CI_Upload {
// Set the uploaded data as class variables
$this->file_temp = $_FILES[$field]['tmp_name'];
$this->file_size = $_FILES[$field]['size'];
- $this->_file_mime_type($_FILES[$field]);
+
+ // Skip MIME type detection?
+ if ($this->detect_mime !== FALSE)
+ {
+ $this->_file_mime_type($_FILES[$field]);
+ }
+
$this->file_type = preg_replace('/^(.+?);.*$/', '\\1', $this->file_type);
$this->file_type = strtolower(trim(stripslashes($this->file_type), '"'));
$this->file_name = $this->_prep_filename($_FILES[$field]['name']);
@@ -990,7 +998,7 @@ class CI_Upload {
*/
if (function_exists('finfo_file'))
{
- $finfo = finfo_open(FILEINFO_MIME);
+ $finfo = @finfo_open(FILEINFO_MIME);
if (is_resource($finfo)) // It is possible that a FALSE value is returned, if there is no magic MIME database file found on the system
{
$mime = @finfo_file($finfo, $file['tmp_name']);
@@ -1021,7 +1029,9 @@ class CI_Upload {
*/
if (DIRECTORY_SEPARATOR !== '\\')
{
- $cmd = 'file --brief --mime '.escapeshellarg($file['tmp_name']).' 2>&1';
+ $cmd = function_exists('escapeshellarg')
+ ? 'file --brief --mime '.escapeshellarg($file['tmp_name']).' 2>&1'
+ : 'file --brief --mime '.$file['tmp_name'].' 2>&1';
if (function_exists('exec'))
{
diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php
index 6f3542333..eac4ac118 100644
--- a/system/libraries/Xmlrpc.php
+++ b/system/libraries/Xmlrpc.php
@@ -778,7 +778,7 @@ class XML_RPC_Message extends CI_Xmlrpc
}
// Check for HTTP 200 Response
- if (strncmp($data, 'HTTP', 4) === 0 && ! preg_match('/^HTTP\/[0-9\.]+ 200 /', $data))
+ if (strpos($data, 'HTTP') === 0 && ! preg_match('/^HTTP\/[0-9\.]+ 200 /', $data))
{
$errstr = substr($data, 0, strpos($data, "\n")-1);
return new XML_RPC_Response(0, $this->xmlrpcerr['http_error'], $this->xmlrpcstr['http_error'].' ('.$errstr.')');
diff --git a/system/libraries/Xmlrpcs.php b/system/libraries/Xmlrpcs.php
index be930b0f9..e81f2ca9a 100644
--- a/system/libraries/Xmlrpcs.php
+++ b/system/libraries/Xmlrpcs.php
@@ -303,7 +303,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc
$methName = $m->method_name;
// Check to see if it is a system call
- $system_call = (strncmp($methName, 'system', 5) === 0);
+ $system_call = (strpos($methName, 'system') === 0);
if ($this->xss_clean === FALSE)
{
diff --git a/system/libraries/Zip.php b/system/libraries/Zip.php
index e0dc637ad..5c4c257f8 100644
--- a/system/libraries/Zip.php
+++ b/system/libraries/Zip.php
@@ -40,7 +40,7 @@
* @author EllisLab Dev Team
* @link http://codeigniter.com/user_guide/libraries/zip.html
*/
-class CI_Zip {
+class CI_Zip {
/**
* Zip data in string form