diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 0b9c92a1..c1f35c87 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -289,7 +289,7 @@ function mod_search($type, $search_query_escaped, $page_no = 1) { } if ($type == 'bans') { - $query = 'SELECT ``bans``.*, `username` FROM ``bans`` LEFT JOIN ``mods`` ON `mod` = ``mods``.`id` WHERE ' . $sql_like . ' ORDER BY (`expires` IS NOT NULL AND `expires` < UNIX_TIMESTAMP()), `created` DESC'; + $query = 'SELECT ``bans``.*, `username` FROM ``bans`` LEFT JOIN ``mods`` ON `creator` = ``mods``.`id` WHERE ' . $sql_like . ' ORDER BY (`expires` IS NOT NULL AND `expires` < UNIX_TIMESTAMP()), `created` DESC'; $sql_table = 'bans'; if (!hasPermission($config['mod']['view_banlist'])) error($config['error']['noaccess']); @@ -317,8 +317,9 @@ function mod_search($type, $search_query_escaped, $page_no = 1) { if ($type == 'bans') { foreach ($results as &$ban) { - if (filter_var($ban['ip'], FILTER_VALIDATE_IP) !== false) - $ban['real_ip'] = true; + $ban['mask'] = Bans::range_to_string(array($ban['ipstart'], $ban['ipend'])); + if (filter_var($ban['mask'], FILTER_VALIDATE_IP) !== false) + $ban['single_addr'] = true; } } diff --git a/templates/mod/ban_list.html b/templates/mod/ban_list.html index 83674544..b41cef28 100644 --- a/templates/mod/ban_list.html +++ b/templates/mod/ban_list.html @@ -46,7 +46,7 @@ {% if ban.expires == 0 %} - {% else %} - {{ (ban.expires - ban.set + time()) | until }} + {{ (ban.expires - ban.created + time()) | until }} {% endif %} diff --git a/templates/mod/search_results.html b/templates/mod/search_results.html index 0c87f75f..0d3c2a10 100644 --- a/templates/mod/search_results.html +++ b/templates/mod/search_results.html @@ -56,10 +56,10 @@ {% for ban in results %} - {% if ban.real_ip %} - {{ ban.ip }} + {% if ban.single_addr %} + {{ ban.mask }} {% else %} - {{ ban.ip|e }} + {{ ban.mask|e }} {% endif %} @@ -77,15 +77,15 @@ {% endif %} - - {{ ban.set|ago }} ago + + {{ ban.created|ago }} ago {% if ban.expires == 0 %} - {% else %} - {{ (ban.expires - ban.set + time()) | until }} + {{ (ban.expires - ban.created + time()) | until }} {% endif %} @@ -116,7 +116,7 @@ {% endif %} {% endif %} - {% elseif ban.mod == -1 %} + {% elseif ban.creator == -1 %} system {% else %} {% trans 'deleted?' %}