summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-03-10 15:11:34 +0100
committerAndrey Andreev <narf@bofh.bg>2012-03-10 15:11:34 +0100
commit1ae651655888383a4d7f97fbf6e97a7ac00a9630 (patch)
tree26bdd60797f2b4f385033671501dce31b6808588 /system
parent52a31ba3acc5f5be16692ac25c70780775e548e0 (diff)
Remove PHP 5.1.6-specific code
Diffstat (limited to 'system')
-rwxr-xr-xsystem/core/Input.php31
-rwxr-xr-xsystem/core/URI.php4
2 files changed, 2 insertions, 33 deletions
diff --git a/system/core/Input.php b/system/core/Input.php
index 54b7e0923..901b4147e 100755
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -366,36 +366,7 @@ class CI_Input {
*/
public function valid_ip($ip)
{
- // if php version >= 5.2, use filter_var to check validate ip.
- if (function_exists('filter_var'))
- {
- return (bool) filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
- }
-
- $ip_segments = explode('.', $ip);
-
- // Always 4 segments needed
- if (count($ip_segments) !== 4)
- {
- return FALSE;
- }
- // IP can not start with 0
- if ($ip_segments[0][0] == '0')
- {
- return FALSE;
- }
- // Check each segment
- foreach ($ip_segments as $segment)
- {
- // IP segments must be digits and can not be
- // longer than 3 digits or greater then 255
- if ($segment == '' OR preg_match('/[^0-9]/', $segment) OR $segment > 255 OR strlen($segment) > 3)
- {
- return FALSE;
- }
- }
-
- return TRUE;
+ return (bool) filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
}
// --------------------------------------------------------------------
diff --git a/system/core/URI.php b/system/core/URI.php
index db5b8e44b..4a2e87c2a 100755
--- a/system/core/URI.php
+++ b/system/core/URI.php
@@ -444,9 +444,7 @@ class CI_URI {
return array();
}
- return function_exists('array_fill_keys')
- ? array_fill_keys($default, FALSE)
- : array_combine($default, array_fill(0, count($default), FALSE));
+ return array_fill_keys($default, FALSE);
}
$segments = array_slice($this->$segment_array(), ($n - 1));