Fixed PHP Notices:
Undefined index: HTTP_X_FORWARDED_FOR Undefined index: HTTP_CLIENT_IP Undefined variable: proxy Also fixed the return value order to match calls to common_client_ip() in actions/api.php and lib/rssaction.php
This commit is contained in:
parent
20c536fdd4
commit
e670e4306b
@ -1410,20 +1410,21 @@ function common_client_ip()
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_SERVER['HTTP_X_FORWARDED_FOR']) {
|
if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER)) {
|
||||||
if ($_SERVER['HTTP_CLIENT_IP']) {
|
if (array_key_exists('HTTP_CLIENT_IP', $_SERVER)) {
|
||||||
$proxy = $_SERVER['HTTP_CLIENT_IP'];
|
$proxy = $_SERVER['HTTP_CLIENT_IP'];
|
||||||
} else {
|
} else {
|
||||||
$proxy = $_SERVER['REMOTE_ADDR'];
|
$proxy = $_SERVER['REMOTE_ADDR'];
|
||||||
}
|
}
|
||||||
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||||
} else {
|
} else {
|
||||||
if ($_SERVER['HTTP_CLIENT_IP']) {
|
$proxy = null;
|
||||||
|
if (array_key_exists('HTTP_CLIENT_IP', $_SERVER)) {
|
||||||
$ip = $_SERVER['HTTP_CLIENT_IP'];
|
$ip = $_SERVER['HTTP_CLIENT_IP'];
|
||||||
} else {
|
} else {
|
||||||
$ip = $_SERVER['REMOTE_ADDR'];
|
$ip = $_SERVER['REMOTE_ADDR'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return array($ip, $proxy);
|
return array($proxy, $ip);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user