diff --git a/data/web/inc/functions.rspamd.inc.php b/data/web/inc/functions.rspamd.inc.php index ec86919c..c2444d99 100644 --- a/data/web/inc/functions.rspamd.inc.php +++ b/data/web/inc/functions.rspamd.inc.php @@ -145,17 +145,22 @@ function rspamd_maps($_action, $_data = null) { $maps = (array)$_data['map']; $valid_maps = array(); foreach ($maps as $map) { + $is_valid = false; foreach ($RSPAMD_MAPS as $rspamd_map_type) { - if (!in_array($map, $rspamd_map_type)) { - $_SESSION['return'][] = array( - 'type' => 'danger', - 'log' => array(__FUNCTION__, $_action, '-'), - 'msg' => array('global_map_invalid', $map) - ); - } else { - array_push($valid_maps, $map); + if (in_array($map, $rspamd_map_type)) { + $is_valid = true; + break; } } + if ($is_valid) { + array_push($valid_maps, $map); + } else { + $_SESSION['return'][] = array( + 'type' => 'danger', + 'log' => array(__FUNCTION__, $_action, '-'), + 'msg' => array('global_map_invalid', $map) + ); + } } foreach ($valid_maps as $map) { try {