summaryrefslogtreecommitdiffstats
path: root/system/libraries
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-06-14 14:10:56 +0200
committerAndrey Andreev <narf@bofh.bg>2012-06-14 14:10:56 +0200
commit3dad2e714189b992248261c78d780b322b3c73da (patch)
tree59d13c94d06ea3183c33f384100f61e73f540c87 /system/libraries
parent19c83f6ec6dd29b2ecbeba87801d275f4e247678 (diff)
Replace strncmp() usage with strpos()
Diffstat (limited to 'system/libraries')
-rw-r--r--system/libraries/Email.php14
-rw-r--r--system/libraries/Javascript.php2
-rw-r--r--system/libraries/Xmlrpc.php2
-rw-r--r--system/libraries/Xmlrpcs.php2
4 files changed, 10 insertions, 10 deletions
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/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/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)
{