diff --git a/inc/functions.php b/inc/functions.php index 85146834..b61f5bb7 100755 --- a/inc/functions.php +++ b/inc/functions.php @@ -2409,6 +2409,13 @@ function diceRoller($post) { function less_ip($ip) { $ipv6 = (strstr($ip, ':') !== false); + $has_range = (strstr($ip, '/') !== false); + + if ($has_range) { + $ip_a = explode('/', $ip); + $ip = $ip_a[0]; + $range = $ip_a[1]; + } $in_addr = inet_pton($ip); @@ -2420,7 +2427,7 @@ function less_ip($ip) { } $final = inet_ntop($in_addr & $mask); - return str_replace(array(':0', '.0'), array(':x', '.x'), $final); + return str_replace(array(':0', '.0'), array(':x', '.x'), $final) . (isset($range) ? '/'.$range : ''); } function less_hostmask($hostmask) { diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 913a9f54..3cdf1374 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -892,7 +892,7 @@ function mod_page_ip_less($b, $id) { Bans::delete($_POST['ban_id'], true); - header('Location: ?/IP/' . $ip . '#bans', true, $config['redirect_http']); + header('Location: ?/IP_less/' . $b . '/' . $id . '#bans', true, $config['redirect_http']); return; } @@ -911,7 +911,7 @@ function mod_page_ip_less($b, $id) { modLog("Added a note for {$ip}"); - header('Location: ?/IP/' . $ip . '#notes', true, $config['redirect_http']); + header('Location: ?/IP_less/' . $b . '/' . $id . '#notes', true, $config['redirect_http']); return; } @@ -926,7 +926,7 @@ function mod_page_ip_less($b, $id) { $query = prepare(sprintf('SELECT * FROM ``posts_%s`` WHERE `ip` = :ip ORDER BY `sticky` DESC, `id` DESC LIMIT :limit', $b)); $query->bindValue(':ip', $ip); - $query->bindValue(':limit', $config['mod']['ip_recentposts'], PDO::PARAM_INT); + $query->bindValue(':limit', $config['mod']['ip_less_recentposts'], PDO::PARAM_INT); $query->execute() or error(db_error($query)); while ($post = $query->fetch(PDO::FETCH_ASSOC)) { diff --git a/templates/mod/view_ip_less.html b/templates/mod/view_ip_less.html index a93ee6a3..a5e5e70c 100644 --- a/templates/mod/view_ip_less.html +++ b/templates/mod/view_ip_less.html @@ -103,7 +103,7 @@