Ignore:
Timestamp:
12/08/10 21:36:30 (9 years ago)
Author:
Eric
Message:

bug 2050 fixed : Compatibility with Captcha
IT translation improved (thx to Rio)
New version 2.15.10 hard coded

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/NBC_UserAdvManager/branches/2.15/main.inc.php

    r7657 r8041  
    22/* 
    33Plugin Name: UserAdvManager 
    4 Version: 2.15.9 
     4Version: 2.15.10 
    55Description: Renforcer la gestion des utilisateurs - Enforce users management 
    66Plugin URI: http://fr.piwigo.org/ext/extension_view.php?eid=216 
     
    168168add_event_handler('register_user_check', 'UAM_RegistrationCheck', EVENT_HANDLER_PRIORITY_NEUTRAL, 2); 
    169169 
    170 function UAM_RegistrationCheck($err, $user) 
    171 { 
    172   global $errors, $conf; 
     170function UAM_RegistrationCheck($errors, $user) 
     171{ 
     172  global $conf; 
    173173 
    174174  // Exclusion of Adult_Content users 
    175175  if ($user['username'] != "16" and $user['username'] != "18") 
    176176  { 
    177 // *********************************************************** 
    178 // We need to reset the standard Piwigo's register controls    
    179 // because the call of register_user_check trigger resets them 
    180 // *********************************************************** 
    181   // ********************************** 
    182   // Standard Piwigo's username control 
    183   // ********************************** 
    184     if ($_POST['login'] == '') 
    185     { 
    186       return l10n('reg_err_login1'); 
    187     } 
    188     if (preg_match('/^.* $/', $_POST['login'])) 
    189     { 
    190       return l10n('reg_err_login2'); 
    191     } 
    192     if (preg_match('/^ .*$/', $_POST['login'])) 
    193     { 
    194       return l10n('reg_err_login3'); 
    195     } 
    196     if (get_userid($_POST['login'])) 
    197     { 
    198       return l10n('reg_err_login5'); 
    199     } 
    200    
    201     if (script_basename() == 'admin' and isset($_GET['page']) and $_GET['page'] == 'user_list') // not the same email variable if we are on users registration page or on admin's user registration page 
    202     { 
    203     // Email doblons check 
    204       $atom   = '[-a-z0-9!#$%&\'*+\\/=?^_`{|}~]';   // before  arobase 
    205       $domain = '([a-z0-9]([-a-z0-9]*[a-z0-9]+)?)'; // domain name 
    206       $regex = '/^' . $atom . '+' . '(\.' . $atom . '+)*' . '@' . '(' . $domain . '{1,63}\.)+' . $domain . '{2,63}$/i'; 
    207    
    208       if (!preg_match($regex, $_POST['email'])) 
    209       { 
    210         return l10n('reg_err_mail_address'); 
    211       } 
    212      
    213       $query = ' 
    214 SELECT count(*) 
    215 FROM '.USERS_TABLE.' 
    216 WHERE upper('.$conf['user_fields']['email'].') = upper(\''.$_POST['email'].'\') 
    217 ;'; 
    218       list($count) = pwg_db_fetch_row(pwg_query($query)); 
    219       if ($count != 0) 
    220       { 
    221         return l10n('reg_err_mail_address_dbl'); 
    222       } 
    223     } 
    224  
    225     if (script_basename() == 'register') // not the same email variable if we are on users registration page or on admin's user registration page 
    226     { 
    227   // Email doblons check 
    228       $atom   = '[-a-z0-9!#$%&\'*+\\/=?^_`{|}~]';   // before  arobase 
    229       $domain = '([a-z0-9]([-a-z0-9]*[a-z0-9]+)?)'; // domain name 
    230       $regex = '/^' . $atom . '+' . '(\.' . $atom . '+)*' . '@' . '(' . $domain . '{1,63}\.)+' . $domain . '{2,63}$/i'; 
    231    
    232       if (!preg_match($regex, $_POST['mail_address'])) 
    233       { 
    234         return l10n('reg_err_mail_address'); 
    235       } 
    236      
    237       $query = ' 
    238 SELECT count(*) 
    239 FROM '.USERS_TABLE.' 
    240 WHERE upper('.$conf['user_fields']['email'].') = upper(\''.$_POST['mail_address'].'\') 
    241 ;'; 
    242       list($count) = pwg_db_fetch_row(pwg_query($query)); 
    243       if ($count != 0) 
    244       { 
    245         return l10n('reg_err_mail_address_dbl'); 
    246       } 
    247     } 
    248 // ****************************************** 
    249 // End of Piwigo's standard register controls 
    250 // ****************************************** 
    251  
    252  
    253 // ****************************************** 
    254 // Here begins the advanced register controls 
    255 // ****************************************** 
     177    load_language('plugin.lang', UAM_PATH); 
     178 
    256179    $PasswordCheck = 0; 
    257180 
     
    268191        { 
    269192          $message = get_l10n_args('reg_err_login4_%s', $PasswordCheck); 
    270           return($lang['reg_err_pass'] = l10n_args($message).$conf_UAM[14]); 
     193          $lang['reg_err_pass'] = l10n_args($message).$conf_UAM[14]; 
     194          array_push($errors, $lang['reg_err_pass']); 
    271195        } 
    272196      } 
     
    278202        { 
    279203          $message = get_l10n_args('reg_err_login4_%s', $PasswordCheck); 
    280           return($lang['reg_err_pass'] = l10n_args($message).$conf_UAM[14]); 
     204          $lang['reg_err_pass'] = l10n_args($message).$conf_UAM[14]; 
     205          array_push($errors, $lang['reg_err_pass']); 
    281206        } 
    282207      } 
     
    284209 
    285210    // Username without forbidden keys 
    286     if (isset($conf_UAM[6]) and $conf_UAM[6] == 'true' and !empty($_POST['login']) and ValidateUsername($_POST['login']) and !is_admin()) 
    287     { 
    288       $_POST['login'] = ''; 
    289       return($lang['reg_err_login1'] = l10n('reg_err_login6')."'".$conf_UAM[7]."'"); 
     211    if (isset($conf_UAM[6]) and $conf_UAM[6] == 'true' and !empty($user['username']) and ValidateUsername($user['username']) and !is_admin()) 
     212    { 
     213      $lang['reg_err_login1'] = l10n('reg_err_login6')."'".$conf_UAM[7]."'"; 
     214      array_push($errors, $lang['reg_err_login1']); 
    290215    } 
    291216 
    292217    // Email without forbidden domains 
    293     if (isset($conf_UAM[11]) and $conf_UAM[11] == 'true' and !empty($_POST['mail_address']) and ValidateEmailProvider($_POST['mail_address']) and !is_admin()) 
    294     { 
    295       $_POST['mail_address'] = ''; 
    296       return($lang['reg_err_login1'] = l10n('reg_err_login7')."'".$conf_UAM[12]."'"); 
    297     } 
     218    if (isset($conf_UAM[11]) and $conf_UAM[11] == 'true' and !empty($user['email']) and ValidateEmailProvider($user['email']) and !is_admin()) 
     219    { 
     220      $lang['reg_err_login1'] = l10n('reg_err_login7')."'".$conf_UAM[12]."'"; 
     221      array_push($errors, $lang['reg_err_login1']); 
     222    } 
     223    return $errors; 
    298224  } 
    299225} 
Note: See TracChangeset for help on using the changeset viewer.