forked from leftypol/leftypol
Merge branch 'config' into uniqueIpFix2
This commit is contained in:
commit
6cede4102c
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
require 'inc/lib/IP/Lifo/IP/IP.php';
|
||||
require 'inc/lib/IP/Lifo/IP/BC.php';
|
||||
require 'inc/lib/IP/Lifo/IP/CIDR.php';
|
||||
require_once 'inc/lib/IP/Lifo/IP/IP.php';
|
||||
require_once 'inc/lib/IP/Lifo/IP/BC.php';
|
||||
require_once 'inc/lib/IP/Lifo/IP/CIDR.php';
|
||||
|
||||
use Lifo\IP\CIDR;
|
||||
|
||||
|
|
|
@ -23,10 +23,13 @@ require_once 'inc/mod/auth.php';
|
|||
require_once 'inc/lock.php';
|
||||
require_once 'inc/queue.php';
|
||||
require_once 'inc/polyfill.php';
|
||||
require_once 'inc/lib/IP/Lifo/IP/IP.php';
|
||||
@include_once 'inc/lib/parsedown/Parsedown.php'; // fail silently, this isn't a critical piece of code
|
||||
|
||||
require_once 'inc/anti-bot.php'; // DELETE ME THIS IS FOR print_err function only!
|
||||
|
||||
use Lifo\IP\IP; // for expanding IPv6 address in DNSBL()
|
||||
|
||||
if (!extension_loaded('gettext')) {
|
||||
require_once 'inc/lib/gettext/gettext.inc';
|
||||
}
|
||||
|
@ -1753,9 +1756,6 @@ function buildJavascript() {
|
|||
function checkDNSBL() {
|
||||
global $config;
|
||||
|
||||
if (isIPv6())
|
||||
return; // No IPv6 support yet.
|
||||
|
||||
if (!isset($_SERVER['REMOTE_ADDR']))
|
||||
return; // Fix your web server configuration
|
||||
|
||||
|
@ -1765,7 +1765,11 @@ function checkDNSBL() {
|
|||
if (in_array($_SERVER['REMOTE_ADDR'], $config['dnsbl_exceptions']))
|
||||
return;
|
||||
|
||||
$ipaddr = ReverseIPOctets($_SERVER['REMOTE_ADDR']);
|
||||
if (isIPv6()) {
|
||||
$ipaddr = ReverseIPv6Octets($_SERVER['REMOTE_ADDR']);
|
||||
} else {
|
||||
$ipaddr = ReverseIPv4Octets($_SERVER['REMOTE_ADDR']);
|
||||
}
|
||||
|
||||
foreach ($config['dnsbl'] as $blacklist) {
|
||||
if (!is_array($blacklist))
|
||||
|
@ -1801,10 +1805,14 @@ function isIPv6() {
|
|||
return strstr($_SERVER['REMOTE_ADDR'], ':') !== false;
|
||||
}
|
||||
|
||||
function ReverseIPOctets($ip) {
|
||||
function ReverseIPv4Octets($ip) {
|
||||
return implode('.', array_reverse(explode('.', $ip)));
|
||||
}
|
||||
|
||||
function ReverseIPv6Octets($ip) {
|
||||
return strrev(implode(".", str_split(str_replace(':', '', IP::inet_expand($ip)))));
|
||||
}
|
||||
|
||||
function wordfilters(&$body) {
|
||||
global $config;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user