changed check for NIS recipient
This commit is contained in:
parent
ea5ea0c1c5
commit
c74bbd6489
|
@ -399,7 +399,6 @@ function get_preg($argument, $regexp) {
|
||||||
case "telephone": // Allow letters, numbers, space, brackets, /-+.
|
case "telephone": // Allow letters, numbers, space, brackets, /-+.
|
||||||
$pregexpr = '/^(\\+)*([0-9a-zA-Z\\.\\ \\(\\)\\/-])*$/';
|
$pregexpr = '/^(\\+)*([0-9a-zA-Z\\.\\ \\(\\)\\/-])*$/';
|
||||||
break;
|
break;
|
||||||
case 'nis_recipient':
|
|
||||||
case "email":
|
case "email":
|
||||||
$pregexpr = '/^([0-9a-zA-Z+\\/\\._-])+[@]([0-9a-zA-Z-])+([.]([0-9a-zA-Z-])+)*$/';
|
$pregexpr = '/^([0-9a-zA-Z+\\/\\._-])+[@]([0-9a-zA-Z-])+([.]([0-9a-zA-Z-])+)*$/';
|
||||||
break;
|
break;
|
||||||
|
@ -460,6 +459,9 @@ function get_preg($argument, $regexp) {
|
||||||
case 'nis_alias':
|
case 'nis_alias':
|
||||||
$pregexpr = '/^([[:alnum:]@\\.\\ \\_-])+$/u';
|
$pregexpr = '/^([[:alnum:]@\\.\\ \\_-])+$/u';
|
||||||
break;
|
break;
|
||||||
|
case 'nis_recipient':
|
||||||
|
$pregexpr = '/^([[:alnum:]+@\\.\\ \\_-])+$/u';
|
||||||
|
break;
|
||||||
case 'country': // Allow all letters and space
|
case 'country': // Allow all letters and space
|
||||||
$pregexpr = '/^[[:alpha:]]([[:alpha:] ])+$/u';
|
$pregexpr = '/^[[:alpha:]]([[:alpha:] ])+$/u';
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -181,6 +181,7 @@ class nisMailAlias extends baseModule {
|
||||||
$this->attributes['cn'][] = $_POST['cn'];
|
$this->attributes['cn'][] = $_POST['cn'];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
$this->attributes['cn'][] = $_POST['cn'];
|
||||||
$message = $this->messages['alias'][0];
|
$message = $this->messages['alias'][0];
|
||||||
$message[] = $_POST['cn'];
|
$message[] = $_POST['cn'];
|
||||||
$errors[] = $message;
|
$errors[] = $message;
|
||||||
|
@ -191,7 +192,7 @@ class nisMailAlias extends baseModule {
|
||||||
if (isset($_POST['delRec' . $i])) continue;
|
if (isset($_POST['delRec' . $i])) continue;
|
||||||
if (isset($_POST['rfc822MailMember' . $i]) && ($_POST['rfc822MailMember' . $i] != "")) {
|
if (isset($_POST['rfc822MailMember' . $i]) && ($_POST['rfc822MailMember' . $i] != "")) {
|
||||||
// check if address has correct format
|
// check if address has correct format
|
||||||
if (!get_preg($_POST['rfc822MailMember' . $i], 'nis_recipient')) {
|
if (!get_preg($_POST['rfc822MailMember' . $i], 'nis_recipient') && !get_preg($_POST['rfc822MailMember' . $i], 'email')) {
|
||||||
$message = $this->messages['recipient'][0];
|
$message = $this->messages['recipient'][0];
|
||||||
$message[] = $_POST['rfc822MailMember' . $i];
|
$message[] = $_POST['rfc822MailMember' . $i];
|
||||||
$errors[] = $message;
|
$errors[] = $message;
|
||||||
|
@ -203,7 +204,7 @@ class nisMailAlias extends baseModule {
|
||||||
// check new recipient
|
// check new recipient
|
||||||
if (isset($_POST['rfc822MailMember']) && ($_POST['rfc822MailMember'] != "")) {
|
if (isset($_POST['rfc822MailMember']) && ($_POST['rfc822MailMember'] != "")) {
|
||||||
// check if address has correct format
|
// check if address has correct format
|
||||||
if (get_preg($_POST['rfc822MailMember'], 'nis_recipient')) {
|
if (get_preg($_POST['rfc822MailMember'], 'nis_recipient') || get_preg($_POST['rfc822MailMember'], 'email')) {
|
||||||
$this->attributes['rfc822MailMember'][] = $_POST['rfc822MailMember'];
|
$this->attributes['rfc822MailMember'][] = $_POST['rfc822MailMember'];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -261,7 +262,7 @@ class nisMailAlias extends baseModule {
|
||||||
$aliases = explode(',', $rawAccounts[$i][$ids['nisMailAlias_recipients']]);
|
$aliases = explode(',', $rawAccounts[$i][$ids['nisMailAlias_recipients']]);
|
||||||
// check format
|
// check format
|
||||||
for ($a = 0; $a < sizeof($aliases); $a++) {
|
for ($a = 0; $a < sizeof($aliases); $a++) {
|
||||||
if (get_preg($aliases[$a], 'nis_recipient')) {
|
if (get_preg($aliases[$a], 'nis_recipient') || get_preg($aliases[$a], 'email')) {
|
||||||
$partialAccounts[$i]['rfc822MailMember'][] = $aliases[$a];
|
$partialAccounts[$i]['rfc822MailMember'][] = $aliases[$a];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue