[Web] break loop if rspamd_map is valid
This commit is contained in:
parent
9decfa9c31
commit
7660ca89ae
@ -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) {
|
||||||
|
Loading…
Reference in New Issue
Block a user