function mod_bans($page_no = 1) { global $config; if ($page_no < 1) { error($config['error']['404']); } if (!hasPermission($config['mod']['view_banlist'])) { error($config['error']['noaccess']); } if (isset($_POST['unban'])) { if (!hasPermission($config['mod']['unban'])) { error($config['error']['noaccess']); } $unban = array(); foreach ($_POST as $name => $unused) { if (preg_match('/^ban_(\\d+)$/', $name, $match)) { $unban[] = $match[1]; } } if (isset($config['mod']['unban_limit']) && $config['mod']['unban_limit'] && count($unban) > $config['mod']['unban_limit']) { error(sprintf($config['error']['toomanyunban'], $config['mod']['unban_limit'], count($unban))); } foreach ($unban as $id) { Bans::delete($id, true); } header('Location: ?/bans', true, $config['redirect_http']); return; } $bans = Bans::list_all(($page_no - 1) * $config['mod']['banlist_page'], $config['mod']['banlist_page']); if (empty($bans) && $page_no > 1) { error($config['error']['404']); } foreach ($bans as &$ban) { if (filter_var($ban['mask'], FILTER_VALIDATE_IP) !== false) { $ban['single_addr'] = true; } } mod_page(_('Ban list'), 'mod/ban_list.html', array('bans' => $bans, 'count' => Bans::count(), 'token' => make_secure_link_token('bans'))); }