Ignore:
Timestamp:
Feb 10, 2011, 9:31:02 PM (13 years ago)
Author:
LucMorizur
Message:

LCAS takes completely care for case sensitivity: $confinsensitive_case_logon set to false by LCAS

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/LCAS/trunk/include/functions.inc.php

    r8643 r9158  
    3333 * @return : string modified as stated
    3434*/
    35 function LCAS_change_case($Username, $Opt, $At_login=true)
     35function LCAS_change_case($Username, $Opt)
    3636{
    3737  global $conf;
     
    3939  if ($Opt == '0' and !isset($conf['LCAS_replacement_set'][0]))
    4040   return $Username;
     41  if ($Opt == '0') return $Username; // to be removed once rule 0 is done
    4142  $Option = intval($Opt);
    42   if (!isset($Opt) or ($Option < 0) or ($Option > 7)) return $Username;
    43   if ($Option > 3) {
    44     // Management of bad setting of $conf['insensitive_case_logon']
    45     switch ($Opt) {
    46       case '4':
    47         // LCAS set to case insensitive, but $conf['insensitive_case_logon']
    48         // is false : exit immediately, LCAS actually inactive
    49         return $Username;
    50       break;
    51       case '5':
    52         // LCAS set to case and accents insensitive, but
    53         // $conf['insensitive_case_logon'] is false : only accents are
    54         // insensitive
    55         $Option = 2;
    56       break;
    57       case '6':
    58         // LCAS set to accents only insensitive, but
    59         // $conf['insensitive_case_logon'] is true : if check is done at
    60         // login, LCAS cares for both case and accents insensitivity, but
    61         // using strtolower() as does Piwigo at register; in case the check is
    62         // done at register, Piwigo cares for the case, thus LCAS cares only
    63         // for the accents.
    64         $Option = 2;
    65         if ($At_login) $Username = strtolower($Username);
    66       break;
    67       case '7':
    68         // LCAS set to personal, but $conf['insensitive_case_logon'] is true :
    69         // if check is done at login, LCAS cares for both case and personal
    70         // insensitivity, but using strtolower() as does Piwigo at register;
    71         // in case the check is done at register, Piwigo cares for the case,
    72         // thus LCAS cares only for the personal setting.
    73         $Option = 0;
    74         if ($At_login) $Username = strtolower($Username);
    75       break;
    76     }
    77   }
     43  if (!isset($Opt) or ($Option < 0) or ($Option > 3)) return $Username;
    7844 
    7945  include(LCAS_PATH.'include/LCAS_replacement_set.inc.php');
    8046
    81   // Builds an array of characters that must be replaced
     47  // Build an array of characters that must be replaced
    8248  // $rep_char is the replacement character ; $char_rep_arr is an array of
    8349  // characters which have to be replaced. ie :
     
    320286 *
    321287 */
    322 function LCAS_SearchCaseUsername($username, $rule, $At_login=true)
     288function LCAS_SearchCaseUsername($username, $rule)
    323289{
    324290  global $conf;
    325291
    326   $username_c = LCAS_change_case($username, $rule, $At_login);
     292  $username_c = LCAS_change_case($username, $rule);
    327293
    328294  if (isset($username))
     
    336302    while ($r = pwg_db_fetch_assoc($q))
    337303     $LCAS_users[$r['username']] =
    338       LCAS_change_case($r['username'], $rule, $At_login);
     304      LCAS_change_case($r['username'], $rule);
    339305     // $LCAS_users is now an associative table where the key is the account
    340306     // as registered in the DB, and the value is this same account,
     
    349315     return $users_found[0];
    350316  }
    351 }
    352 
    353 
    354 /*
    355  * LCAS_final_case($var)
    356  * return the value of the case in which is the gallery, regarding
    357  * case and accents sensitivity
    358  *
    359  * @param $var
    360  *   the inital proposal from the webmaster
    361  * @return
    362  *   string being an image of the case and accents sensitivity
    363  */
    364 function LCAS_final_case($var) {
    365 
    366   global $conf;
    367  
    368   if (isset($conf['insensitive_case_logon']) and $conf['insensitive_case_logon'] == true)
    369   {
    370     // Uncomfortable status if $conf['insensitive_case_logon'] is true and
    371     // case insensitivity is not set in LCAS
    372     if ($var == '2') return '6';
    373     elseif  ($var == '0') return '7';
    374   }
    375   else
    376   {
    377     // Uncomfortable status if $conf['insensitive_case_logon'] is false and
    378     // case insensitivity is set in LCAS
    379     if ($var == '1') return '4';
    380     elseif  ($var == '3') return '5';
    381   }
    382  
    383   return $var;
    384 
    385317}
    386318
Note: See TracChangeset for help on using the changeset viewer.