mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-19 00:29:21 +01:00
checkEmail(): add debug using dedicated LSlog_logger
This commit is contained in:
parent
da9c0e344b
commit
a1a23d1600
1 changed files with 6 additions and 2 deletions
|
@ -402,10 +402,11 @@ function LSdebugDefined() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkEmail($value,$domain=NULL,$checkDns=true) {
|
function checkEmail($value,$domain=NULL,$checkDns=true) {
|
||||||
|
$log = LSlog :: get_logger('checkEmail');
|
||||||
$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\-]+))$/';
|
$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\-]+))$/';
|
||||||
|
|
||||||
if (!preg_match($regex, $value)) {
|
if (!preg_match($regex, $value)) {
|
||||||
LSdebug('checkEmail : regex fail');
|
$log -> debug("'$value': regex fail");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -415,11 +416,13 @@ function LSdebugDefined() {
|
||||||
if ($domain) {
|
if ($domain) {
|
||||||
if(is_array($domain)) {
|
if(is_array($domain)) {
|
||||||
if (!in_array($nd,$domain)) {
|
if (!in_array($nd,$domain)) {
|
||||||
|
$log -> debug("'$value': domain '$nd' not authorized. Allowed domains: '".implode("', '", $domain)."'");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if($nd!=$domain) {
|
if($nd!=$domain) {
|
||||||
|
$log -> debug("'$value': domain '$nd' not authorized. Allowed domains: '$domain'");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -427,11 +430,12 @@ function LSdebugDefined() {
|
||||||
|
|
||||||
if ($checkDns && function_exists('checkdnsrr')) {
|
if ($checkDns && function_exists('checkdnsrr')) {
|
||||||
if (!(checkdnsrr($nd, 'MX') || checkdnsrr($nd, 'A'))) {
|
if (!(checkdnsrr($nd, 'MX') || checkdnsrr($nd, 'A'))) {
|
||||||
LSdebug('checkEmail : DNS fail');
|
$log -> debug("'$value': DNS check fail");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$log -> debug("'$value': validated");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue