Changeset 9158 for extensions/LCAS/trunk/include/functions.inc.php
- Timestamp:
- Feb 10, 2011, 9:31:02 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/LCAS/trunk/include/functions.inc.php
r8643 r9158 33 33 * @return : string modified as stated 34 34 */ 35 function LCAS_change_case($Username, $Opt , $At_login=true)35 function LCAS_change_case($Username, $Opt) 36 36 { 37 37 global $conf; … … 39 39 if ($Opt == '0' and !isset($conf['LCAS_replacement_set'][0])) 40 40 return $Username; 41 if ($Opt == '0') return $Username; // to be removed once rule 0 is done 41 42 $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; 78 44 79 45 include(LCAS_PATH.'include/LCAS_replacement_set.inc.php'); 80 46 81 // Build san array of characters that must be replaced47 // Build an array of characters that must be replaced 82 48 // $rep_char is the replacement character ; $char_rep_arr is an array of 83 49 // characters which have to be replaced. ie : … … 320 286 * 321 287 */ 322 function LCAS_SearchCaseUsername($username, $rule , $At_login=true)288 function LCAS_SearchCaseUsername($username, $rule) 323 289 { 324 290 global $conf; 325 291 326 $username_c = LCAS_change_case($username, $rule , $At_login);292 $username_c = LCAS_change_case($username, $rule); 327 293 328 294 if (isset($username)) … … 336 302 while ($r = pwg_db_fetch_assoc($q)) 337 303 $LCAS_users[$r['username']] = 338 LCAS_change_case($r['username'], $rule , $At_login);304 LCAS_change_case($r['username'], $rule); 339 305 // $LCAS_users is now an associative table where the key is the account 340 306 // as registered in the DB, and the value is this same account, … … 349 315 return $users_found[0]; 350 316 } 351 }352 353 354 /*355 * LCAS_final_case($var)356 * return the value of the case in which is the gallery, regarding357 * case and accents sensitivity358 *359 * @param $var360 * the inital proposal from the webmaster361 * @return362 * string being an image of the case and accents sensitivity363 */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 and371 // case insensitivity is not set in LCAS372 if ($var == '2') return '6';373 elseif ($var == '0') return '7';374 }375 else376 {377 // Uncomfortable status if $conf['insensitive_case_logon'] is false and378 // case insensitivity is set in LCAS379 if ($var == '1') return '4';380 elseif ($var == '3') return '5';381 }382 383 return $var;384 385 317 } 386 318
Note: See TracChangeset
for help on using the changeset viewer.