functions.inc.php: reindent (as per inline vim settings) and add in flash_error calls when validating an email address (I suspect the strings need changing as per translation issues)

git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@426 a1433add-5e2c-0410-b055-b7f2511e0802
postfixadmin-2.3
David Goodwin 17 years ago
parent e15068af3a
commit 544c7ebe82

@ -260,11 +260,8 @@ function check_email ($email)
$ce_email = preg_replace("/#/", '@', $ce_email);
}
if (
isset($CONF['emailcheck_resolve_domain'])
&& 'YES'==$CONF['emailcheck_resolve_domain']
&& 'WINDOWS'!=(strtoupper(substr(php_uname('s'), 0, 7)))
) {
if (isset($CONF['emailcheck_resolve_domain']) && 'YES' == $CONF['emailcheck_resolve_domain'] && 'WINDOWS'!=(strtoupper(substr(php_uname('s'), 0, 7))))
{
// Perform non-domain-part sanity checks
if (!preg_match ('/^[-!#$%&\'*+\\.\/0-9=?A-Z^_{|}~]+' . '@' . '[^@]+$/i', trim ($ce_email)))
@ -290,20 +287,21 @@ function check_email ($email)
}
if (checkdnsrr($domain,'A')) return true;
if (checkdnsrr($domain,'MX')) return true;
}
# TODO: different error message for non-existing domains (instead of "email is invalid")
flash_error("Invalid domain, and/or not discoverable in DNS");
return false;
}
else {
flash_error("emailcheck_resolve_domain is enabled, but function (checkdnsrr) missing!");
}
}
if (preg_match ('/^[-!#$%&\'*+\\.\/0-9=?A-Z^_{|}~]+' . '@' . '([-0-9A-Z]+\.)+' . '([0-9A-Z]){2,6}$/i', trim ($ce_email)))
{
return true;
}
else
{
flash_error("Invalid email address, fails regexp check");
return false;
}
}

Loading…
Cancel
Save