diff options
author | Nils Adermann <naderman@naderman.de> | 2014-06-09 17:55:25 +0200 |
---|---|---|
committer | Nils Adermann <naderman@naderman.de> | 2014-06-09 17:55:25 +0200 |
commit | b6232aa9b213fbf62f5ce351bc79220daf243cc6 (patch) | |
tree | 0e169650c4b0bb9476b5f0f917bff6952b574e4d /phpBB/includes/functions_user.php | |
parent | 0c5af536f1de55b6ee30ab9f193b6ea7637ac5b1 (diff) | |
parent | 92f43c5371f1f37bd6d77ade2fc5e2804b5cc49f (diff) | |
download | forums-b6232aa9b213fbf62f5ce351bc79220daf243cc6.tar forums-b6232aa9b213fbf62f5ce351bc79220daf243cc6.tar.gz forums-b6232aa9b213fbf62f5ce351bc79220daf243cc6.tar.bz2 forums-b6232aa9b213fbf62f5ce351bc79220daf243cc6.tar.xz forums-b6232aa9b213fbf62f5ce351bc79220daf243cc6.zip |
Merge remote-tracking branch 'github-nickvergessen/ticket/10073' into develop-ascraeus
* github-nickvergessen/ticket/10073: (36 commits)
[ticket/10073] Fix button descriptions
[ticket/10073] Do not check disable boxes by default
[ticket/10073] Store values with config_text in the ACP
[ticket/10073] Move config values to config_text
[ticket/10073] Fix request usage
[ticket/10073] Deduplicate template variable names
[ticket/10073] Get service from container
[ticket/10073] Fix more "Contact Us" strings
[ticket/10073] Move template code into the template
[ticket/10073] Make contact page available when board is disabled
[ticket/10073] Change name of the ACP module
[ticket/10073] Deduplicate posting buttons code in ACP
[ticket/10073] Use phpbb_validate_email to verify email address
[ticket/10073] Add tests for new validate_email()
[ticket/10073] Split email validation from email ban and taken checks
[ticket/10073] Deduplicate the if statement
[ticket/10073] Fallback to board_contact when contact page is disabled
[ticket/10073] Remove language string from rebase conflict
[ticket/10073] Add ACP module to add bbcode text for contact admin info
[ticket/10073] Add new configs to the schema
...
Diffstat (limited to 'phpBB/includes/functions_user.php')
-rw-r--r-- | phpBB/includes/functions_user.php | 45 |
1 files changed, 35 insertions, 10 deletions
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 3dcb32350e..fafe29f957 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1746,25 +1746,21 @@ function validate_password($password) } /** -* Check to see if email address is banned or already present in the DB +* Check to see if email address is a valid address and contains a MX record * * @param string $email The email to check -* @param string $allowed_email An allowed email, default being $user->data['user_email'] * * @return mixed Either false if validation succeeded or a string which will be used as the error message (with the variable name appended) */ -function validate_email($email, $allowed_email = false) +function phpbb_validate_email($email, $config = null) { - global $config, $db, $user; - - $email = strtolower($email); - $allowed_email = ($allowed_email === false) ? strtolower($user->data['user_email']) : strtolower($allowed_email); - - if ($allowed_email == $email) + if ($config === null) { - return false; + global $config; } + $email = strtolower($email); + if (!preg_match('/^' . get_preg_expression('email') . '$/i', $email)) { return 'EMAIL_INVALID'; @@ -1782,6 +1778,35 @@ function validate_email($email, $allowed_email = false) } } + return false; +} + +/** +* Check to see if email address is banned or already present in the DB +* +* @param string $email The email to check +* @param string $allowed_email An allowed email, default being $user->data['user_email'] +* +* @return mixed Either false if validation succeeded or a string which will be used as the error message (with the variable name appended) +*/ +function validate_user_email($email, $allowed_email = false) +{ + global $config, $db, $user; + + $email = strtolower($email); + $allowed_email = ($allowed_email === false) ? strtolower($user->data['user_email']) : strtolower($allowed_email); + + if ($allowed_email == $email) + { + return false; + } + + $validate_email = phpbb_validate_email($email, $config); + if ($validate_email) + { + return $validate_email; + } + if (($ban_reason = $user->check_ban(false, false, $email, true)) !== false) { return ($ban_reason === true) ? 'EMAIL_BANNED' : $ban_reason; |