changed check for NIS recipient

This commit is contained in:
Roland Gruber 2011-04-19 17:47:41 +00:00
parent ea5ea0c1c5
commit c74bbd6489
2 changed files with 7 additions and 4 deletions

View File

@ -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;

View File

@ -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 {