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