|
|
|
@ -75,9 +75,10 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
|
|
|
|
|
$fDomain = escape_string ($_POST['fDomain']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!preg_match ('/@/',$fGoto)) {
|
|
|
|
|
$fGoto = $fGoto . "@" . escape_string ($_POST['fDomain']);
|
|
|
|
|
}
|
|
|
|
|
# TODO: Doesn't work with multiple aliases - fix or discard...
|
|
|
|
|
# if(!preg_match ('/@/',$fGoto)) {
|
|
|
|
|
# $fGoto = $fGoto . "@" . escape_string ($_POST['fDomain']);
|
|
|
|
|
# }
|
|
|
|
|
|
|
|
|
|
if(!(authentication_has_role('global-admin') ||
|
|
|
|
|
check_owner ($SESSID_USERNAME, $fDomain) ))
|
|
|
|
@ -105,7 +106,42 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
|
|
|
|
|
$pCreate_alias_address_text = $PALANG['pCreate_alias_address_text_error1'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (empty($fGoto) || !check_email ($fGoto)) {
|
|
|
|
|
// Begin check alias email
|
|
|
|
|
$goto = preg_replace ('/\\\r\\\n/', ',', $fGoto);
|
|
|
|
|
$goto = preg_replace ('/\r\n/', ',', $goto);
|
|
|
|
|
$goto = preg_replace ('/,[\s]+/i', ',', $goto);
|
|
|
|
|
$goto = preg_replace ('/[\s]+,/i', ',', $goto);
|
|
|
|
|
$goto = preg_replace ('/,*$|^,*/', '', $goto);
|
|
|
|
|
$goto = preg_replace ('/,,*/', ',', $goto);
|
|
|
|
|
|
|
|
|
|
if (empty ($goto) && !authentication_has_role('global-admin')) {
|
|
|
|
|
$error = 1;
|
|
|
|
|
$tGoto = $_POST['fGoto'];
|
|
|
|
|
$tMessage = $PALANG['pEdit_alias_goto_text_error1'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$new_aliases = array();
|
|
|
|
|
if ($error != 1) {
|
|
|
|
|
$new_aliases = explode(',', $goto);
|
|
|
|
|
}
|
|
|
|
|
$new_aliases = array_unique($new_aliases);
|
|
|
|
|
|
|
|
|
|
foreach($new_aliases as $address) {
|
|
|
|
|
if (in_array($address, $CONF['default_aliases'])) continue;
|
|
|
|
|
if (empty($address)) continue; # TODO: should never happen - remove after 2.2 release
|
|
|
|
|
if (!check_email($address)) {
|
|
|
|
|
$error = 1;
|
|
|
|
|
$tGoto = $goto;
|
|
|
|
|
if (!empty($tMessage)) $tMessage .= "<br />";
|
|
|
|
|
$tMessage .= $PALANG['pEdit_alias_goto_text_error2'] . "$address</span>";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$goto = implode(',', $new_aliases);
|
|
|
|
|
$fGoto = escape_string($goto);
|
|
|
|
|
// End check alias mail
|
|
|
|
|
|
|
|
|
|
if (empty($fGoto)) {
|
|
|
|
|
$error = 1;
|
|
|
|
|
$tAddress = escape_string ($_POST['fAddress']);
|
|
|
|
|
$tGoto = $fGoto;
|
|
|
|
@ -150,6 +186,11 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
|
|
|
|
|
$tDomain = $fDomain;
|
|
|
|
|
$tMessage = $PALANG['pCreate_alias_result_success'] . "<br />($fAddress -> $fGoto)<br />\n";
|
|
|
|
|
}
|
|
|
|
|
} else { # on error
|
|
|
|
|
$tAddress = htmlentities($_POST['fAddress']);
|
|
|
|
|
$tGoto = htmlentities($_POST['fGoto']);
|
|
|
|
|
$tDomain = htmlentities($_POST['fDomain']);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|