|
@ -2217,9 +2217,6 @@ function buildJavascript() { |
|
|
function checkDNSBL() { |
|
|
function checkDNSBL() { |
|
|
global $config; |
|
|
global $config; |
|
|
|
|
|
|
|
|
if (isIPv6()) |
|
|
|
|
|
return; // No IPv6 support yet. |
|
|
|
|
|
|
|
|
|
|
|
if (!isset($_SERVER['REMOTE_ADDR'])) |
|
|
if (!isset($_SERVER['REMOTE_ADDR'])) |
|
|
return; // Fix your web server configuration |
|
|
return; // Fix your web server configuration |
|
|
|
|
|
|
|
@ -2229,7 +2226,11 @@ function checkDNSBL() { |
|
|
if (in_array($_SERVER['REMOTE_ADDR'], $config['dnsbl_exceptions'])) |
|
|
if (in_array($_SERVER['REMOTE_ADDR'], $config['dnsbl_exceptions'])) |
|
|
return; |
|
|
return; |
|
|
|
|
|
|
|
|
$ipaddr = ReverseIPOctets($_SERVER['REMOTE_ADDR']); |
|
|
if (isIPv6()) { |
|
|
|
|
|
$ipaddr = ReverseIPv6Octets($_SERVER['REMOTE_ADDR']); |
|
|
|
|
|
} else { |
|
|
|
|
|
$ipaddr = ReverseIPv4Octets($_SERVER['REMOTE_ADDR']); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
foreach ($config['dnsbl'] as $blacklist) { |
|
|
foreach ($config['dnsbl'] as $blacklist) { |
|
|
if (!is_array($blacklist)) |
|
|
if (!is_array($blacklist)) |
|
@ -2265,10 +2266,30 @@ function isIPv6() { |
|
|
return strstr($_SERVER['REMOTE_ADDR'], ':') !== false; |
|
|
return strstr($_SERVER['REMOTE_ADDR'], ':') !== false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function ReverseIPOctets($ip) { |
|
|
function ReverseIPv4Octets($ip) { |
|
|
return implode('.', array_reverse(explode('.', $ip))); |
|
|
return implode('.', array_reverse(explode('.', $ip))); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function ReverseIPv6Octets($ip) { |
|
|
|
|
|
return strrev(implode(".", str_split(str_replace(':', '', inet_expand($ip))))); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// copypastad from lib/IP/Lifo/IP.php, TODO replace this with a proper include |
|
|
|
|
|
function inet_expand($ip) |
|
|
|
|
|
{ |
|
|
|
|
|
// strip possible cidr notation off |
|
|
|
|
|
if (($pos = strpos($ip, '/')) !== false) { |
|
|
|
|
|
$ip = substr($ip, 0, $pos); |
|
|
|
|
|
} |
|
|
|
|
|
$bytes = unpack('n*', inet_pton($ip)); |
|
|
|
|
|
if (count($bytes) > 2) { |
|
|
|
|
|
return implode(':', array_map(function ($b) { |
|
|
|
|
|
return sprintf("%04x", $b); |
|
|
|
|
|
}, $bytes)); |
|
|
|
|
|
} |
|
|
|
|
|
return $ip; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
function wordfilters(&$body) { |
|
|
function wordfilters(&$body) { |
|
|
global $config; |
|
|
global $config; |
|
|
|
|
|
|
|
|