Fixes #351
This commit is contained in:
parent
3b6a6f677d
commit
db01b08926
@ -473,15 +473,8 @@ function mailbox($_action, $_type, $_data = null) {
|
||||
break;
|
||||
case 'alias_domain':
|
||||
$active = intval($_data['active']);
|
||||
$alias_domain = idn_to_ascii(strtolower(trim($_data['alias_domain'])));
|
||||
$alias_domains = array_map('trim', preg_split( "/( |,|;|\n)/", $_data['alias_domain']));
|
||||
$target_domain = idn_to_ascii(strtolower(trim($_data['target_domain'])));
|
||||
if (!is_valid_domain_name($alias_domain)) {
|
||||
$_SESSION['return'] = array(
|
||||
'type' => 'danger',
|
||||
'msg' => sprintf($lang['danger']['alias_domain_invalid'])
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (!is_valid_domain_name($target_domain)) {
|
||||
$_SESSION['return'] = array(
|
||||
'type' => 'danger',
|
||||
@ -496,6 +489,15 @@ function mailbox($_action, $_type, $_data = null) {
|
||||
);
|
||||
return false;
|
||||
}
|
||||
foreach ($alias_domains as $alias_domain) {
|
||||
$alias_domain = idn_to_ascii(strtolower(trim($alias_domain)));
|
||||
if (!is_valid_domain_name($alias_domain)) {
|
||||
$_SESSION['return'] = array(
|
||||
'type' => 'danger',
|
||||
'msg' => sprintf($lang['danger']['alias_domain_invalid'])
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if ($alias_domain == $target_domain) {
|
||||
$_SESSION['return'] = array(
|
||||
'type' => 'danger',
|
||||
@ -543,10 +545,6 @@ function mailbox($_action, $_type, $_data = null) {
|
||||
':target_domain' => $target_domain,
|
||||
':active' => $active
|
||||
));
|
||||
$_SESSION['return'] = array(
|
||||
'type' => 'success',
|
||||
'msg' => sprintf($lang['success']['aliasd_added'], htmlspecialchars($alias_domain))
|
||||
);
|
||||
}
|
||||
catch (PDOException $e) {
|
||||
mailbox('delete', 'alias_domain', array('alias_domain' => $alias_domain));
|
||||
@ -556,6 +554,11 @@ function mailbox($_action, $_type, $_data = null) {
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$_SESSION['return'] = array(
|
||||
'type' => 'success',
|
||||
'msg' => sprintf($lang['success']['aliasd_added'], htmlspecialchars(implode(', ', $alias_domains)))
|
||||
);
|
||||
break;
|
||||
case 'mailbox':
|
||||
$local_part = strtolower(trim($_data['local_part']));
|
||||
|
Loading…
Reference in New Issue
Block a user