aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrub <rub@piwigo.org>2007-10-01 22:07:47 +0000
committerrub <rub@piwigo.org>2007-10-01 22:07:47 +0000
commitf7196c793a77f7a89713d10a31fd130e7604a4fb (patch)
tree752ddc42a577d2586673735e1461c5c4acb9ffce
parentf8e8bdf05bee2444f003bc5dbb001343e1459e73 (diff)
Resolved 0000759: email unique for each user
git-svn-id: http://piwigo.org/svn/trunk@2115 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r--include/functions_user.inc.php43
-rw-r--r--language/en_UK.iso-8859-1/common.lang.php1
-rw-r--r--language/en_UK.iso-8859-1/install.lang.php8
-rw-r--r--language/fr_FR.iso-8859-1/common.lang.php1
-rw-r--r--language/fr_FR.iso-8859-1/install.lang.php3
-rw-r--r--plugins/c13y_upgrade/initialize.inc.php20
-rw-r--r--plugins/c13y_upgrade/language/en_UK.iso-8859-1/plugin.lang.php3
-rw-r--r--plugins/c13y_upgrade/language/fr_FR.iso-8859-1/plugin.lang.php2
8 files changed, 60 insertions, 21 deletions
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index 1c4500328..925eeb2b0 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -24,46 +24,65 @@
// | USA. |
// +-----------------------------------------------------------------------+
-// validate_mail_address verifies whether the given mail address has the
-// right format. ie someone@domain.com "someone" can contain ".", "-" or
-// even "_". Exactly as "domain". The extension doesn't have to be
-// "com". The mail address can also be empty.
+// validate_mail_address:
+// o verifies whether the given mail address has the
+// right format. ie someone@domain.com "someone" can contain ".", "-" or
+// even "_". Exactly as "domain". The extension doesn't have to be
+// "com". The mail address can also be empty.
+// o check if address could be empty
+// 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($mail_address)
{
- global $lang, $conf;
+ global $conf;
if (empty($mail_address) and
!($conf['obligatory_user_mail_address'] and in_array(script_basename(), array('register', 'profile'))))
{
return '';
}
+
$regex = '/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)*\.[a-z]+$/';
if ( !preg_match( $regex, $mail_address ) )
{
- return $lang['reg_err_mail_address'];
+ return l10n('reg_err_mail_address');
+ }
+
+ if (defined("PHPWG_INSTALLED") and !empty($mail_address))
+ {
+ $query = '
+select count(*)
+from '.USERS_TABLE.'
+where upper('.$conf['user_fields']['email'].') = upper(\''.$mail_address.'\')
+;';
+ list($count) = mysql_fetch_array(pwg_query($query));
+ if ($count != 0)
+ {
+ return l10n('reg_err_mail_address_dbl');
+ }
}
}
function register_user($login, $password, $mail_address, $errors = array())
{
- global $lang, $conf;
+ global $conf;
if ($login == '')
{
- array_push($errors, $lang['reg_err_login1']);
+ array_push($errors, l10n('reg_err_login1'));
}
if (ereg("^.* $", $login))
{
- array_push($errors, $lang['reg_err_login2']);
+ array_push($errors, l10n('reg_err_login2'));
}
if (ereg("^ .*$", $login))
{
- array_push($errors, $lang['reg_err_login3']);
+ array_push($errors, l10n('reg_err_login3'));
}
if (get_userid($login))
{
- array_push($errors, $lang['reg_err_login5']);
+ array_push($errors, l10n('reg_err_login5'));
}
$mail_error = validate_mail_address($mail_address);
if ('' != $mail_error)
diff --git a/language/en_UK.iso-8859-1/common.lang.php b/language/en_UK.iso-8859-1/common.lang.php
index ed5ada707..a6dc8f0c8 100644
--- a/language/en_UK.iso-8859-1/common.lang.php
+++ b/language/en_UK.iso-8859-1/common.lang.php
@@ -637,4 +637,5 @@ $lang['guest_must_be_guest'] = 'Bad status for user "guest", using default statu
$lang['add new elements to caddie'] = 'add new elements to caddie';
// --------- Starting below: New or revised $lang ---- from Butterfly (1.8)
$lang['Administrator, webmaster and special user cannot use this method'] = 'Administrator, webmaster and special user cannot use this method';
+$lang['reg_err_mail_address_dbl'] = 'a user use already this mail address';
?>
diff --git a/language/en_UK.iso-8859-1/install.lang.php b/language/en_UK.iso-8859-1/install.lang.php
index 880021612..d0e6f1139 100644
--- a/language/en_UK.iso-8859-1/install.lang.php
+++ b/language/en_UK.iso-8859-1/install.lang.php
@@ -4,8 +4,7 @@
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
-// | branch : BSF (Best So Far)
-// | file : $RCSfile$
+// | file : $Id$
// | last update : $Date$
// | last modifier : $Author$
// | revision : $Revision$
@@ -32,9 +31,6 @@ $lang['step1_title'] = 'Database configuration';
$lang['step2_title'] = 'Admin configuration';
$lang['Start_Install'] = 'Start Install';
$lang['reg_err_mail_address'] = 'mail address must be like xxx@yyy.eee (example : jack@altern.org)';
-$lang['mail_webmaster'] = 'Webmaster mail adress';
-$lang['mail_webmaster_info'] = 'Visitors will be able to contact site administrator with this mail';
-$lang['reg_err_mail_address'] = 'e-mail address refused, it must be like name@server.com';
$lang['install_webmaster'] = 'Webmaster login';
$lang['install_webmaster_info'] = 'It will be shown to the visitors. It is necessary for website administration';
@@ -72,6 +68,6 @@ Once this file deleted , follow this instructions :
<li>go to the identification page : [ <a href="identification.php">identification</a> ] and use the login/password given for webmaster</li>
<li>this login will enable you to access to the administration panel and to the instructions in order to place pictures in your directories</li>
</ul>';
-$lang['conf_mail_webmaster'] = 'Webmaster mail adress';
+$lang['conf_mail_webmaster'] = 'Webmaster mail address';
$lang['conf_mail_webmaster_info'] = 'Visitors will be able to contact site administrator with this mail';
?> \ No newline at end of file
diff --git a/language/fr_FR.iso-8859-1/common.lang.php b/language/fr_FR.iso-8859-1/common.lang.php
index 5eb37eb9e..a1a22e4d5 100644
--- a/language/fr_FR.iso-8859-1/common.lang.php
+++ b/language/fr_FR.iso-8859-1/common.lang.php
@@ -636,4 +636,5 @@ $lang['Picture uploaded by %s'] = 'Image téléchargée par %s';
$lang['guest_must_be_guest'] = 'Statut de l\'utilisateur "guest" non conforme, utilisation du statut par défaut. Veuillez prévenir le webmestre.';
// --------- Starting below: New or revised $lang ---- from Butterfly (1.8)
$lang['Administrator, webmaster and special user cannot use this method'] = 'Administrateur, webmestre et utilisateur spécial ne peuvent pas utiliser cette méthode';
+$lang['reg_err_mail_address_dbl'] = 'un utilisateur utilise déjà cette adresse e-mail';
?>
diff --git a/language/fr_FR.iso-8859-1/install.lang.php b/language/fr_FR.iso-8859-1/install.lang.php
index 7e90538f3..5f43b1eec 100644
--- a/language/fr_FR.iso-8859-1/install.lang.php
+++ b/language/fr_FR.iso-8859-1/install.lang.php
@@ -4,8 +4,7 @@
// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
// +-----------------------------------------------------------------------+
-// | branch : BSF (Best So Far)
-// | file : $RCSfile$
+// | file : $Id$
// | last update : $Date$
// | last modifier : $Author$
// | revision : $Revision$
diff --git a/plugins/c13y_upgrade/initialize.inc.php b/plugins/c13y_upgrade/initialize.inc.php
index 996b80f4a..aa8428b31 100644
--- a/plugins/c13y_upgrade/initialize.inc.php
+++ b/plugins/c13y_upgrade/initialize.inc.php
@@ -39,6 +39,26 @@ function c13y_upgrade($c13y_array)
$result = array();
+ /* Check user with same e-mail */
+ $query = '
+select count(*)
+from '.USERS_TABLE.'
+group by upper('.$conf['user_fields']['email'].')
+having count(*) > 1
+limit 0,1
+;';
+
+ if (mysql_fetch_array(pwg_query($query)))
+ {
+ $result[] = get_c13y(
+ l10n('c13y_exif_dbl_email_user'),
+ null,
+ null,
+ l10n('c13y_exif_correction_dbl_email_user'));
+ }
+
+
+ /* Check if this plugin must deactivate */
if (count($result) === 0)
{
$deactivate_msg_link =
diff --git a/plugins/c13y_upgrade/language/en_UK.iso-8859-1/plugin.lang.php b/plugins/c13y_upgrade/language/en_UK.iso-8859-1/plugin.lang.php
index a77b6d259..d8db86284 100644
--- a/plugins/c13y_upgrade/language/en_UK.iso-8859-1/plugin.lang.php
+++ b/plugins/c13y_upgrade/language/en_UK.iso-8859-1/plugin.lang.php
@@ -27,5 +27,6 @@
// --------- Starting below: New or revised $lang ---- from Butterfly (1.8)
$lang['c13y_upgrade_no_anomaly'] = 'No anomaly detected after application upgrade';
$lang['c13y_upgrade_deactivate'] = 'You can deactivate "Check upgrades" plugin';
-
+$lang['c13y_exif_dbl_email_user'] = 'Users with same email address';
+$lang['c13y_exif_correction_dbl_email_user'] = 'Delete duplicate users';
?>
diff --git a/plugins/c13y_upgrade/language/fr_FR.iso-8859-1/plugin.lang.php b/plugins/c13y_upgrade/language/fr_FR.iso-8859-1/plugin.lang.php
index aea3e9351..454168e2c 100644
--- a/plugins/c13y_upgrade/language/fr_FR.iso-8859-1/plugin.lang.php
+++ b/plugins/c13y_upgrade/language/fr_FR.iso-8859-1/plugin.lang.php
@@ -27,5 +27,7 @@
// --------- Starting below: New or revised $lang ---- from Butterfly (1.8)
$lang['c13y_upgrade_no_anomaly'] = 'Pas d\'anomalie détectée après la mise à jour de l\'application';
$lang['c13y_upgrade_deactivate'] = 'Vous pouvez désactiver le plugin "Check upgrades"';
+$lang['c13y_exif_dbl_email_user'] = 'Utilisateurs avec la même adresse email';
+$lang['c13y_exif_correction_dbl_email_user'] = 'Supprimez les utilisateurs en double';
?>