diff options
author | Kyle Johnson <blyxx86@gmail.com> | 2012-10-05 11:51:31 +0200 |
---|---|---|
committer | Kyle Johnson <blyxx86@gmail.com> | 2012-10-05 11:51:31 +0200 |
commit | fad389699e2e851af09c1f4508646194c2f45660 (patch) | |
tree | 8a595af2bd1980e4a475f5db5f4ce9f7bc8cd170 /system/core | |
parent | ddb32da0e86510d7e68c5432a1657732a01b5d34 (diff) | |
parent | f20bca9e065751fc271cb650f9246073492eccea (diff) |
Fixed conflicts in changelog to reflect all changes.
Conflicts:
user_guide_src/source/changelog.rst
Diffstat (limited to 'system/core')
-rw-r--r-- | system/core/Common.php | 6 | ||||
-rw-r--r-- | system/core/Input.php | 20 |
2 files changed, 13 insertions, 13 deletions
diff --git a/system/core/Common.php b/system/core/Common.php index 57374b07d..e449dd2e0 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -488,13 +488,9 @@ if ( ! function_exists('set_status_header')) { header('Status: '.$code.' '.$text, TRUE); } - elseif ($server_protocol === 'HTTP/1.0') - { - header('HTTP/1.0 '.$code.' '.$text, TRUE, $code); - } else { - header('HTTP/1.1 '.$code.' '.$text, TRUE, $code); + header(($server_protocol ? $server_protocol : 'HTTP/1.1').' '.$code.' '.$text, TRUE, $code); } } } diff --git a/system/core/Input.php b/system/core/Input.php index 5b8e62389..657fce625 100644 --- a/system/core/Input.php +++ b/system/core/Input.php @@ -330,10 +330,10 @@ class CI_Input { if (config_item('proxy_ips') != '' && $this->server('HTTP_X_FORWARDED_FOR') && $this->server('REMOTE_ADDR')) { - $has_ranges = strpos($proxies, '/') !== false; + $has_ranges = strpos($proxies, '/') !== FALSE; $proxies = preg_split('/[\s,]/', config_item('proxy_ips'), -1, PREG_SPLIT_NO_EMPTY); $proxies = is_array($proxies) ? $proxies : array($proxies); - + if ($has_ranges) { $long_ip = ip2long($_SERVER['REMOTE_ADDR']); @@ -341,21 +341,25 @@ class CI_Input { // Go through each of the IP Addresses to check for and // test against range notation - foreach($proxies as $ip) + foreach ($proxies as $ip) { - list($address, $mask_length) = explode('/', $ip); + list($address, $mask_length) = explode('/', $ip, 2); // Generate the bitmask for a 32 bit IP Address - $bitmask = $bit_32 - (1 << (32 - (int)$mask_length)); - if (($long_ip & $bitmask) == $address) + $bitmask = $bit_32 - (1 << (32 - (int) $mask_length)); + if (($long_ip & $bitmask) === $address) { $this->ip_address = $_SERVER['HTTP_X_FORWARDED_FOR']; break; } } - } else { - $this->ip_address = in_array($_SERVER['REMOTE_ADDR'], $proxies) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; + } + else + { + $this->ip_address = in_array($_SERVER['REMOTE_ADDR'], $proxies) + ? $_SERVER['HTTP_X_FORWARDED_FOR'] + : $_SERVER['REMOTE_ADDR']; } } elseif ( ! $this->server('HTTP_CLIENT_IP') && $this->server('REMOTE_ADDR')) |