aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_user.inc.php
diff options
context:
space:
mode:
authorrub <rub@piwigo.org>2007-10-06 06:41:18 +0000
committerrub <rub@piwigo.org>2007-10-06 06:41:18 +0000
commit5132cc1f87025bd17d6bd90e5ac8ad73288bf482 (patch)
tree9c871884505b17b689546d00ae7bfb34df4de0b9 /include/functions_user.inc.php
parent924733b9f0678a8071abda29af74b88d27f06000 (diff)
Resolved 0000759: email unique for each user
Fix bug of last commit 2115 git-svn-id: http://piwigo.org/svn/trunk@2124 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/functions_user.inc.php')
-rw-r--r--include/functions_user.inc.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index 925eeb2b0..54fab06b5 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -33,12 +33,13 @@
// o check if address is not used by a other user
// If the mail address doesn't correspond, an error message is returned.
//
-function validate_mail_address($mail_address)
+function validate_mail_address($user_id, $mail_address)
{
global $conf;
if (empty($mail_address) and
- !($conf['obligatory_user_mail_address'] and in_array(script_basename(), array('register', 'profile'))))
+ !($conf['obligatory_user_mail_address'] and
+ in_array(script_basename(), array('register', 'profile'))))
{
return '';
}
@@ -55,6 +56,7 @@ function validate_mail_address($mail_address)
select count(*)
from '.USERS_TABLE.'
where upper('.$conf['user_fields']['email'].') = upper(\''.$mail_address.'\')
+'.(is_numeric($user_id) ? 'and '.$conf['user_fields']['id'].' != \''.$user_id.'\'' : '').'
;';
list($count) = mysql_fetch_array(pwg_query($query));
if ($count != 0)
@@ -84,7 +86,7 @@ function register_user($login, $password, $mail_address, $errors = array())
{
array_push($errors, l10n('reg_err_login5'));
}
- $mail_error = validate_mail_address($mail_address);
+ $mail_error = validate_mail_address(null, $mail_address);
if ('' != $mail_error)
{
array_push($errors, $mail_error);