Changeset 8638 for extensions/LCAS/trunk/include/functions.inc.php
- Timestamp:
- Jan 13, 2011, 2:58:32 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/LCAS/trunk/include/functions.inc.php
r8565 r8638 33 33 * @return : string, or array of strings, modified as stated 34 34 */ 35 function LCAS_change_case($Username, $Opt ion)35 function LCAS_change_case($Username, $Opt, $At_login=true) 36 36 { 37 37 global $conf; 38 39 // Exits immediately without changing the parameter, if the configuration 40 // is set on "case sensitive and accent sensitive". 41 if (!isset($Option) or 42 $Option != 0 and 43 $Option != 1 and 44 $Option != 2 and 45 $Option != 3 46 ) return $Username; 38 39 if ($Opt == '0' and !isset($conf['LCAS_replacement_set'][0])) 40 return $Username; 41 $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 } 47 78 48 79 include(LCAS_PATH.'include/LCAS_replacement_set.inc.php'); … … 320 351 321 352 /* 353 * LCAS_final_case($var) 354 * return the value of the case in which is the gallery, regarding 355 * case and accents sensitivity 356 * 357 * @param $var 358 * the inital proposal from the webmaster 359 * @return 360 * string being an image of the case and accents sensitivity 361 */ 362 function LCAS_final_case($var) { 363 364 global $conf; 365 366 if (isset($conf['insensitive_case_logon']) and $conf['insensitive_case_logon'] == true) 367 { 368 // Uncomfortable status if $conf['insensitive_case_logon'] is true and 369 // case insensitivity is not set in LCAS 370 if ($var == '2') return '6'; 371 elseif ($var == '0') return '7'; 372 } 373 else 374 { 375 // Uncomfortable status if $conf['insensitive_case_logon'] is false and 376 // case insensitivity is set in LCAS 377 if ($var == '1') return '4'; 378 elseif ($var == '3') return '5'; 379 } 380 381 return $var; 382 383 } 384 385 386 /* 322 387 * str_from_var3($var) 323 388 * returns a string easing array var informations displaying in Piwigo :
Note: See TracChangeset
for help on using the changeset viewer.