[Web] break loop if rspamd_map is valid

This commit is contained in:
FreddleSpl0it 2024-04-04 16:29:58 +02:00
parent 9decfa9c31
commit 7660ca89ae
No known key found for this signature in database
GPG Key ID: 00E14E7634F4BEC5

View File

@ -145,16 +145,21 @@ function rspamd_maps($_action, $_data = null) {
$maps = (array)$_data['map']; $maps = (array)$_data['map'];
$valid_maps = array(); $valid_maps = array();
foreach ($maps as $map) { foreach ($maps as $map) {
$is_valid = false;
foreach ($RSPAMD_MAPS as $rspamd_map_type) { foreach ($RSPAMD_MAPS as $rspamd_map_type) {
if (!in_array($map, $rspamd_map_type)) { if (in_array($map, $rspamd_map_type)) {
$is_valid = true;
break;
}
}
if ($is_valid) {
array_push($valid_maps, $map);
} else {
$_SESSION['return'][] = array( $_SESSION['return'][] = array(
'type' => 'danger', 'type' => 'danger',
'log' => array(__FUNCTION__, $_action, '-'), 'log' => array(__FUNCTION__, $_action, '-'),
'msg' => array('global_map_invalid', $map) 'msg' => array('global_map_invalid', $map)
); );
} else {
array_push($valid_maps, $map);
}
} }
} }
foreach ($valid_maps as $map) { foreach ($valid_maps as $map) {