1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2025-02-08 07:28:19 +01:00

Merge /srv/http

This commit is contained in:
8chan 2014-10-12 23:34:50 +00:00
commit 784ddc93d2
3 changed files with 12 additions and 5 deletions

View File

@ -2409,6 +2409,13 @@ function diceRoller($post) {
function less_ip($ip) { function less_ip($ip) {
$ipv6 = (strstr($ip, ':') !== false); $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); $in_addr = inet_pton($ip);
@ -2420,7 +2427,7 @@ function less_ip($ip) {
} }
$final = inet_ntop($in_addr & $mask); $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) { function less_hostmask($hostmask) {

View File

@ -892,7 +892,7 @@ function mod_page_ip_less($b, $id) {
Bans::delete($_POST['ban_id'], true); 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; return;
} }
@ -911,7 +911,7 @@ function mod_page_ip_less($b, $id) {
modLog("Added a note for <a href=\"?/IP/{$ip}\">{$ip}</a>"); modLog("Added a note for <a href=\"?/IP/{$ip}\">{$ip}</a>");
header('Location: ?/IP/' . $ip . '#notes', true, $config['redirect_http']); header('Location: ?/IP_less/' . $b . '/' . $id . '#notes', true, $config['redirect_http']);
return; 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 = prepare(sprintf('SELECT * FROM ``posts_%s`` WHERE `ip` = :ip ORDER BY `sticky` DESC, `id` DESC LIMIT :limit', $b));
$query->bindValue(':ip', $ip); $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)); $query->execute() or error(db_error($query));
while ($post = $query->fetch(PDO::FETCH_ASSOC)) { while ($post = $query->fetch(PDO::FETCH_ASSOC)) {

View File

@ -103,7 +103,7 @@
</tr> </tr>
<tr> <tr>
<th>{% trans 'IP' %}</th> <th>{% trans 'IP' %}</th>
<td>{{ ban.mask }}</td> <td>{{ ban.mask|less_ip }}</td>
</tr> </tr>
<tr> <tr>
<th>{% trans 'Reason' %}</th> <th>{% trans 'Reason' %}</th>