forked from leftypol/leftypol
Clean up duplicate code
This commit is contained in:
parent
132b7ace54
commit
bba5e1bff3
|
@ -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';
|
||||
}
|
||||
|
@ -1807,23 +1810,7 @@ function ReverseIPv4Octets($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;
|
||||
return strrev(implode(".", str_split(str_replace(':', '', IP::inet_expand($ip)))));
|
||||
}
|
||||
|
||||
function wordfilters(&$body) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user