Changeset 2115


Ignore:
Timestamp:
Oct 2, 2007, 12:07:47 AM (17 years ago)
Author:
rub
Message:

Resolved 0000759: email unique for each user

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_user.inc.php

    r2084 r2115  
    2525// +-----------------------------------------------------------------------+
    2626
    27 // validate_mail_address verifies whether the given mail address has the
    28 // right format. ie someone@domain.com "someone" can contain ".", "-" or
    29 // even "_". Exactly as "domain". The extension doesn't have to be
    30 // "com". The mail address can also be empty.
     27// validate_mail_address:
     28//   o verifies whether the given mail address has the
     29//     right format. ie someone@domain.com "someone" can contain ".", "-" or
     30//     even "_". Exactly as "domain". The extension doesn't have to be
     31//     "com". The mail address can also be empty.
     32//   o check if address could be empty
     33//   o check if address is not used by a other user
    3134// If the mail address doesn't correspond, an error message is returned.
    32 function validate_mail_address( $mail_address )
    33 {
    34   global $lang, $conf;
     35//
     36function validate_mail_address($mail_address)
     37{
     38  global $conf;
    3539
    3640  if (empty($mail_address) and
     
    3943    return '';
    4044  }
     45
    4146  $regex = '/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)*\.[a-z]+$/';
    4247  if ( !preg_match( $regex, $mail_address ) )
    4348  {
    44     return $lang['reg_err_mail_address'];
     49    return l10n('reg_err_mail_address');
     50  }
     51 
     52  if (defined("PHPWG_INSTALLED") and !empty($mail_address))
     53  {
     54    $query = '
     55select count(*)
     56from '.USERS_TABLE.'
     57where upper('.$conf['user_fields']['email'].') = upper(\''.$mail_address.'\')
     58;';
     59    list($count) = mysql_fetch_array(pwg_query($query));
     60    if ($count != 0)
     61    {
     62      return l10n('reg_err_mail_address_dbl');
     63    }
    4564  }
    4665}
     
    4867function register_user($login, $password, $mail_address, $errors = array())
    4968{
    50   global $lang, $conf;
     69  global $conf;
    5170
    5271  if ($login == '')
    5372  {
    54     array_push($errors, $lang['reg_err_login1']);
     73    array_push($errors, l10n('reg_err_login1'));
    5574  }
    5675  if (ereg("^.* $", $login))
    5776  {
    58     array_push($errors, $lang['reg_err_login2']);
     77    array_push($errors, l10n('reg_err_login2'));
    5978  }
    6079  if (ereg("^ .*$", $login))
    6180  {
    62     array_push($errors, $lang['reg_err_login3']);
     81    array_push($errors, l10n('reg_err_login3'));
    6382  }
    6483  if (get_userid($login))
    6584  {
    66     array_push($errors, $lang['reg_err_login5']);
     85    array_push($errors, l10n('reg_err_login5'));
    6786  }
    6887  $mail_error = validate_mail_address($mail_address);
  • trunk/language/en_UK.iso-8859-1/common.lang.php

    r2114 r2115  
    638638// --------- Starting below: New or revised $lang ---- from Butterfly (1.8)
    639639$lang['Administrator, webmaster and special user cannot use this method'] = 'Administrator, webmaster and special user cannot use this method';
     640$lang['reg_err_mail_address_dbl'] = 'a user use already this mail address';
    640641?>
  • trunk/language/en_UK.iso-8859-1/install.lang.php

    r1900 r2115  
    55// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
    66// +-----------------------------------------------------------------------+
    7 // | branch        : BSF (Best So Far)
    8 // | file          : $RCSfile$
     7// | file          : $Id$
    98// | last update   : $Date$
    109// | last modifier : $Author$
     
    3332$lang['Start_Install'] = 'Start Install';
    3433$lang['reg_err_mail_address'] = 'mail address must be like xxx@yyy.eee (example : jack@altern.org)';
    35 $lang['mail_webmaster'] = 'Webmaster mail adress';
    36 $lang['mail_webmaster_info'] = 'Visitors will be able to contact site administrator with this mail';
    37 $lang['reg_err_mail_address'] = 'e-mail address refused, it must be like name@server.com';
    3834
    3935$lang['install_webmaster'] = 'Webmaster login';
     
    7369<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>
    7470</ul>';
    75 $lang['conf_mail_webmaster'] = 'Webmaster mail adress';
     71$lang['conf_mail_webmaster'] = 'Webmaster mail address';
    7672$lang['conf_mail_webmaster_info'] = 'Visitors will be able to contact site administrator with this mail';
    7773?>
  • trunk/language/fr_FR.iso-8859-1/common.lang.php

    r2055 r2115  
    637637// --------- Starting below: New or revised $lang ---- from Butterfly (1.8)
    638638$lang['Administrator, webmaster and special user cannot use this method'] = 'Administrateur, webmestre et utilisateur spécial ne peuvent pas utiliser cette méthode';
     639$lang['reg_err_mail_address_dbl'] = 'un utilisateur utilise déjà cette adresse e-mail';
    639640?>
  • trunk/language/fr_FR.iso-8859-1/install.lang.php

    r1900 r2115  
    55// | Copyright (C) 2003-2007 PhpWebGallery Team - http://phpwebgallery.net |
    66// +-----------------------------------------------------------------------+
    7 // | branch        : BSF (Best So Far)
    8 // | file          : $RCSfile$
     7// | file          : $Id$
    98// | last update   : $Date$
    109// | last modifier : $Author$
  • trunk/plugins/c13y_upgrade/initialize.inc.php

    r2104 r2115  
    4040  $result = array();
    4141
     42  /* Check user with same e-mail */
     43  $query = '
     44select count(*)
     45from '.USERS_TABLE.'
     46group by upper('.$conf['user_fields']['email'].')
     47having count(*) > 1
     48limit 0,1
     49;';
     50
     51  if (mysql_fetch_array(pwg_query($query)))
     52  {
     53    $result[] = get_c13y(
     54      l10n('c13y_exif_dbl_email_user'),
     55      null,
     56      null,
     57      l10n('c13y_exif_correction_dbl_email_user'));
     58  }
     59
     60
     61  /* Check if this plugin must deactivate */
    4262  if (count($result) === 0)
    4363  {
  • trunk/plugins/c13y_upgrade/language/en_UK.iso-8859-1/plugin.lang.php

    r2104 r2115  
    2828$lang['c13y_upgrade_no_anomaly'] = 'No anomaly detected after application upgrade';
    2929$lang['c13y_upgrade_deactivate'] = 'You can deactivate "Check upgrades" plugin';
    30 
     30$lang['c13y_exif_dbl_email_user'] = 'Users with same email address';
     31$lang['c13y_exif_correction_dbl_email_user'] = 'Delete duplicate users';
    3132?>
  • trunk/plugins/c13y_upgrade/language/fr_FR.iso-8859-1/plugin.lang.php

    r2104 r2115  
    2828$lang['c13y_upgrade_no_anomaly'] = 'Pas d\'anomalie détectée après la mise à jour de l\'application';
    2929$lang['c13y_upgrade_deactivate'] = 'Vous pouvez désactiver le plugin "Check upgrades"';
     30$lang['c13y_exif_dbl_email_user'] = 'Utilisateurs avec la même adresse email';
     31$lang['c13y_exif_correction_dbl_email_user'] = 'Supprimez les utilisateurs en double';
    3032
    3133?>
Note: See TracChangeset for help on using the changeset viewer.