diff --git a/trunk/includes/class/class.LSformRule_email.php b/trunk/includes/class/class.LSformRule_email.php index 40a292c4..b68d49d3 100644 --- a/trunk/includes/class/class.LSformRule_email.php +++ b/trunk/includes/class/class.LSformRule_email.php @@ -38,7 +38,7 @@ class LSformRule_email extends LSformRule { * @return boolean true si la valeur est valide, false sinon */ function validate($value,$option=array(),$formElement) { - return checkEmail($value,$option['param']['checkDomain']); + return checkEmail($value,$option['param']['domain'],$option['param']['checkDomain']); } } diff --git a/trunk/includes/functions.php b/trunk/includes/functions.php index 95d34945..b5c5961b 100644 --- a/trunk/includes/functions.php +++ b/trunk/includes/functions.php @@ -238,8 +238,11 @@ function LSdebug_print($return=false) { return $basedn; } - function checkEmail($value,$checkDns=true) { - $regex = '/^((\"[^\"\f\n\r\t\v\b]+\")|([\w\!\#\$\%\&\'\*\+\-\~\/\^\`\|\{\}]+(\.[\w\!\#\$\%\&\'\*\+\-\~\/\^\`\|\{\}]+)*))@((\[(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\])|(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9\-])+\.)+[A-Za-z\-]+))$/'; + function checkEmail($value,$domain=NULL,$checkDns=true) { + if (!$domain) { + $domain = '((\[(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\])|(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9\-])+\.)+[A-Za-z\-]+))'; + } + $regex = '/^((\"[^\"\f\n\r\t\v\b]+\")|([\w\!\#\$\%\&\'\*\+\-\~\/\^\`\|\{\}]+(\.[\w\!\#\$\%\&\'\*\+\-\~\/\^\`\|\{\}]+)*))@'.$domain.'$/'; if (!preg_match($regex, $value)) { LSdebug('checkEmail : regex fail'); diff --git a/trunk/templates/LSmail.tpl b/trunk/templates/LSmail.tpl index b2daad2f..b427f03f 100644 --- a/trunk/templates/LSmail.tpl +++ b/trunk/templates/LSmail.tpl @@ -2,9 +2,13 @@