Ignore:
Timestamp:
Dec 22, 2010, 11:02:57 PM (13 years ago)
Author:
Eric
Message:

bug 2079 fixed : Accents sensitivity enabled on registration
Localisation files updates
English translation done

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/LCAS/trunk/main.inc.php

    r8206 r8239  
    4747}
    4848
     49// Check users identification
    4950add_event_handler('init', 'LCAS_InitPage');
    5051 
     
    6061    if (isset($_POST['username']))
    6162    {
    62       /* User non case sensitive */
     63      /* Username is case insensitive only */
    6364      if (isset($conf_LCAS[0]) and $conf_LCAS[0] == 'true' and isset($conf_LCAS[1]) and $conf_LCAS[1] == 'false')
    6465      {
     
    6768      }
    6869
    69       /* User non accent sensitive */
     70      /* Username is accent insensitive only */
    7071      if (isset($conf_LCAS[0]) and $conf_LCAS[0] == 'false' and isset($conf_LCAS[1]) and $conf_LCAS[1] == 'true')
    7172      {
     
    7475      }
    7576
    76       /* User non accent sensitive */
    77       if (isset($conf_LCAS[1]) and $conf_LCAS[1] == 'true' and isset($conf_LCAS[0]) and $conf_LCAS[0] == 'true')
     77      //* Username is accent and case insensitive */
     78      if (isset($conf_LCAS[0]) and $conf_LCAS[0] == 'true' and isset($conf_LCAS[1]) and $conf_LCAS[1] == 'true')
    7879      {
    7980        $new_username = LCAS_SearchCaseUsername($_POST['username'],3);
     
    8384  }
    8485}
     86
     87// Check users registration
     88add_event_handler('register_user_check', 'LCAS_RegistrationCheck');
     89
     90function LCAS_RegistrationCheck($errors)
     91{
     92  global $conf, $lang;
     93 
     94  $conf_LCAS= unserialize($conf['LoginCaseAccentsSensitivity']);
     95 
     96  load_language('plugin.lang', LCAS_PATH);
     97
     98  /* Username is accent and case insensitive */
     99  if (isset($conf_LCAS[0]) and $conf_LCAS[0] == 'true' and $conf['insensitive_case_logon'] == true and isset($conf_LCAS[1]) and $conf_LCAS[1] == 'true')
     100  {
     101    $NewPostLogin = LCAS_SearchCaseUsername($_POST['login'],3);
     102  }
     103  /* Username is accent insensitive only */
     104  elseif (isset($conf_LCAS[0]) and $conf_LCAS[0] == 'false' and $conf['insensitive_case_logon'] == false and isset($conf_LCAS[1]) and $conf_LCAS[1] == 'true')
     105  {
     106    $NewPostLogin = LCAS_SearchCaseUsername($_POST['login'],2);
     107  }
     108  /* Username is case insensitive only is already controled by Piwigo with $conf['insensitive_case_logon'] == true */
     109
     110  if (isset($NewPostLogin) and get_userid($NewPostLogin))
     111  {
     112    $lang['reg_err_login5'] = $lang['reg_err_login5'].l10n('LCAS_accent_error');
     113    array_push($errors, $lang['reg_err_login5']);
     114  }
     115 
     116  return $errors;
     117}
    85118?>
Note: See TracChangeset for help on using the changeset viewer.