Changeset 9474


Ignore:
Timestamp:
Mar 2, 2011, 1:38:30 PM (14 years ago)
Author:
Eric
Message:

bug 2208 re-fixed : Duplicate user control improvement on username update will work fine on this way (hopefully !)

Location:
extensions/LCAS/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/LCAS/trunk/admin/LCAS_admin.php

    r9454 r9474  
    9090       
    9191        if ((isset($_POST['user-'.$lcas_UserToUpdate])) && ($_POST['user-'.$lcas_UserToUpdate] != '')) {
     92
    9293          // Check if username already exists
    93                 $count = 0;
    9494                $lcas_previous_compare_user = LCAS_change_case($_POST['user-'.$lcas_UserToUpdate], $conf_LCAS[0]);
    95                       foreach ($page['all_users'] as $local_user)
    96                       {
    97                         if ($lcas_previous_compare_user == $local_user['transformed']) {
    98                                 $count = 1;
    99                                 break;
    100                         }
    101                       }
    102 
     95
     96          $LCAS_users = array();
     97
     98          // This is a dirty request - Works fine for small number of users but could be unoptimized for large number of users
    10399          $query = '
    104                  SELECT username
    105                  FROM '.USERS_TABLE.'
    106                  WHERE username="'.addslashes($_POST['user-'.$lcas_UserToUpdate]).'"
    107           ;';
    108        
    109           $count = pwg_db_num_rows(pwg_query($query));
    110 
    111           if ($count < 1)
     100            SELECT '.$conf['user_fields']['username'].' AS username
     101            FROM '.USERS_TABLE.';';
     102         
     103          while ($r = pwg_db_fetch_assoc(pwg_query($query)))
    112104          {
    113             // Get old username befor update - Usefull for user notification if is set
     105            $LCAS_users[$r['username']] = LCAS_change_case($r['username'], $conf_LCAS[0]);
     106          }
     107           
     108          $users_found = array_keys($LCAS_users, $lcas_previous_compare_user);
     109
     110          if (count($users_found) < 1)
     111          {
     112            // Get old username before update - Usefull for user notification if is set
    114113            $query ='
    115114              SELECT username
  • extensions/LCAS/trunk/main.inc.php

    r9470 r9474  
    2626load_language('messages.lang', LCAS_PATH);
    2727
    28 $t = pwg_db_fetch_row(pwg_query('
    29   SELECT `value`
    30   FROM `'.CONFIG_TABLE.'`
    31   WHERE `param` = "LoginCaseAccentsSensitivity"
    32   LIMIT 1;
    33 '));
    34 
    35 $conf['LoginCaseAccentsSensitivity'] = $t[0];
    3628
    3729/* Plugin admin */
Note: See TracChangeset for help on using the changeset viewer.