// not really much reason to use the while workaround for this with only a single pyramid level
This commit is contained in:
parent
38cb13aefe
commit
dcd2830b40
1 changed files with 23 additions and 25 deletions
|
@ -101,38 +101,36 @@ switch ($_GET['v'] ?? null) {
|
|||
|
||||
$notices = [];
|
||||
|
||||
while (!empty($_POST)) {
|
||||
if (!empty($_POST)) {
|
||||
if (!csrf_verify('ip_blacklist', $_POST['csrf'] ?? '')) {
|
||||
$notices[] = 'Verification failed.';
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
header(csrf_http_header('ip_blacklist'));
|
||||
|
||||
header(csrf_http_header('ip_blacklist'));
|
||||
if (!empty($_POST['blacklist']['remove']) && is_array($_POST['blacklist']['remove'])) {
|
||||
foreach ($_POST['blacklist']['remove'] as $cidr) {
|
||||
if (!ip_blacklist_remove($cidr)) {
|
||||
$notices[] = sprintf('Failed to remove "%s" from the blacklist.', $cidr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($_POST['blacklist']['remove']) && is_array($_POST['blacklist']['remove'])) {
|
||||
foreach ($_POST['blacklist']['remove'] as $cidr) {
|
||||
if (!ip_blacklist_remove($cidr)) {
|
||||
$notices[] = sprintf('Failed to remove "%s" from the blacklist.', $cidr);
|
||||
if (!empty($_POST['blacklist']['add']) && is_string($_POST['blacklist']['add'])) {
|
||||
$cidrs = explode("\n", $_POST['blacklist']['add']);
|
||||
|
||||
foreach ($cidrs as $cidr) {
|
||||
$cidr = trim($cidr);
|
||||
|
||||
if (empty($cidr)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!ip_blacklist_add($cidr)) {
|
||||
$notices[] = sprintf('Failed to add "%s" to the blacklist.', $cidr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($_POST['blacklist']['add']) && is_string($_POST['blacklist']['add'])) {
|
||||
$cidrs = explode("\n", $_POST['blacklist']['add']);
|
||||
|
||||
foreach ($cidrs as $cidr) {
|
||||
$cidr = trim($cidr);
|
||||
|
||||
if (empty($cidr)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!ip_blacklist_add($cidr)) {
|
||||
$notices[] = sprintf('Failed to add "%s" to the blacklist.', $cidr);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
echo tpl_render('manage.general.blacklist', [
|
||||
|
|
Loading…
Reference in a new issue