Changeset 9158 for extensions
- Timestamp:
- Feb 10, 2011, 9:31:02 PM (14 years ago)
- Location:
- extensions/LCAS/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/LCAS/trunk/admin/LCAS_admin.php
r8845 r9158 38 38 $version = $plugin['version']; 39 39 40 if (isset($_POST['submit']) and isset($_POST['LCAS_Option']) and isset($_POST['LCAS_Mail']))40 if (isset($_POST['submit']) and !is_adviser() and isset($_POST['LCAS_Option']) and isset($_POST['LCAS_Mail'])) 41 41 { 42 42 … … 45 45 46 46 // LCAS configuration is now hereby defined : 47 // $conf_LCAS[0] : "final case", describe how LCAS should behave; 47 // $conf_LCAS[0] : spare // quite lazy, but convenient to not have to 48 // decrease index of each option below everywhere :-/ ... 48 49 // $conf_LCAS[1] : LCAS option, describe the choice of the webmaster; 49 50 // $conf_LCAS[2] : LCAS_Mail; 50 51 // $conf_LCAS[3] : LCAS_MailText. 51 52 $newconf_LCAS= array( 52 LCAS_final_case($_POST['LCAS_Option']), 53 '', // quite lazy, but convenient to not have to 54 // decrease index of each option everywhere :-/ ... 53 55 $_POST['LCAS_Option'], 54 // $_POST['LCAS__spare'] : quite lazy, but convenient to not have to55 // decrease index of each option below everywhere :-/ ...56 56 $_POST['LCAS_Mail'], 57 57 $_POST['LCAS_MailText']); … … 72 72 73 73 $conf_LCAS= unserialize($conf['LoginCaseAccentsSensitivity']); 74 $conf_LCAS[0] = LCAS_final_case($conf_LCAS[1]);75 74 76 if (isset($conf_LCAS[ 0]))75 if (isset($conf_LCAS[1])) 77 76 { 78 // $conf['insensitive_case_logon'] must be true or false when needed 79 if ($conf_LCAS[0]=='4' or $conf_LCAS[0]=='5') 80 array_push($page['errors'], l10n('LCAS_warning')); 81 elseif ($conf_LCAS[0]=='6' or $conf_LCAS[0]=='7') 82 array_push($page['errors'], l10n('LCAS_warning2')); 83 84 $case_ins = (in_array($conf_LCAS[0], array('1', '3','6','7'))); 85 $acc_ins = (in_array($conf_LCAS[0], array('2', '5', '3','6','7'))); 77 $case_ins = ($conf_LCAS[1] == '1' or $conf_LCAS[1] == '3'); 78 $acc_ins = ($conf_LCAS[1] == '2' or $conf_LCAS[1] == '3'); 86 79 87 80 if ($case_ins or $acc_ins) … … 128 121 // +-----------------------------------------------------------------------+ 129 122 130 $page['all_users'] = LCAS_get_user_list($conf_LCAS[ 0]);123 $page['all_users'] = LCAS_get_user_list($conf_LCAS[1]); 131 124 132 125 // +-----------------------------------------------------------------------+ … … 157 150 ); 158 151 } 159 /* Plugin version insert */160 $template->assign(161 array(162 'LCAS_VERSION' => $version,163 'LCAS_PATH' => LCAS_PATH,164 )165 );166 167 152 168 // +-----------------------------------------------------------------------+169 // | errors display |170 // +-----------------------------------------------------------------------+171 if ( isset ($errors) and count($errors) != 0)172 {173 $template->assign('errors',array());174 foreach ($errors as $error)175 {176 array_push($page['errors'], $error);177 }178 }179 180 153 } 181 154 } … … 189 162 'LCAS_VERSION' => $version, 190 163 'LCAS_PATH' => LCAS_PATH, 191 'PWG_insensitive_case_logon' => ($conf['insensitive_case_logon']),192 164 'Personalized_not_allowed' => (!isset($conf['LCAS_replacement_set'][0])), 193 'LCAS_final_case' => $conf_LCAS[0],194 165 'LCAS_Option' => $conf_LCAS[1], 195 'LCAS_MAIL_TRUE' => $conf_LCAS[2] =='true' ? 'checked="checked"' : '' ,196 'LCAS_MAIL_FALSE' => $conf_LCAS[2] =='false' ? 'checked="checked"' : '' ,166 'LCAS_MAIL_TRUE' => $conf_LCAS[2] == 'true' ? 'checked = "checked"' : '' , 167 'LCAS_MAIL_FALSE' => $conf_LCAS[2] == 'false' ? 'checked = "checked"' : '' , 197 168 'LCAS_MAILTEXT' => $conf_LCAS[3] 198 169 ) -
extensions/LCAS/trunk/admin/template/global.tpl
r8840 r9158 1 {known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js"} 2 {known_script id="jquery.cluetip" src=$ROOT_URL|@cat:"themes/default/js/plugins/jquery.cluetip.packed.js"} 3 {known_script id="jquery.tablesorter" src=$LCAS_PATH|@cat:"admin/template/js/jquery.tablesorter.js"} 4 {known_script id="jquery.tablesorter.pager" src=$LCAS_PATH|@cat:"admin/template/js/jquery.tablesorter.pager.js"} 5 {* 1 6 {combine_script id="jquery" path=$ROOT_URL|@cat:"themes/default/js/jquery.js"} 2 7 {combine_script id="jquery.cluetip" path=$ROOT_URL|@cat:"themes/default/js/plugins/jquery.cluetip.packed.js"} 3 8 {combine_script id="jquery.tablesorter" path=$LCAS_PATH|@cat:"admin/template/js/jquery.tablesorter.js"} 4 9 {combine_script id="jquery.tablesorter.pager" path=$LCAS_PATH|@cat:"admin/template/js/jquery.tablesorter.pager.js"} 10 *} 5 11 6 12 {html_head}<link rel="stylesheet" type="text/css" href="{$LCAS_PATH}admin/template/lcas.css">{/html_head} 7 13 8 14 <script type="text/javascript"> 9 var LCAS_final_case = '{$LCAS_final_case}';10 var PWG_insensitive_case_logon = {if $PWG_insensitive_case_logon}true{else}false{/if};11 15 var Personalized_not_allowed = {if $Personalized_not_allowed}true{else}false{/if}; 12 16 {literal} … … 17 21 splitTitle: '|' 18 22 }); 19 });20 21 jQuery().ready(function(){22 if (PWG_insensitive_case_logon) {23 jQuery('#LCAS_id_Option0, #LCAS_id_Option2').attr('disabled', 'disabled');24 jQuery('#LCAS_id_Opt0, #LCAS_id_Opt2').attr("title", "{/literal}{'conf[insensitive_case_logon] is true'|@translate}{literal}");25 }26 else {27 jQuery('#LCAS_id_Option1, #LCAS_id_Option3').attr('disabled', 'disabled');28 jQuery('#LCAS_id_Opt1, #LCAS_id_Opt3').attr("title", "{/literal}{'conf[insensitive_case_logon] is false'|@translate}{literal}");29 }30 if (Personalized_not_allowed) {31 jQuery('#LCAS_id_Option0').attr('disabled', 'disabled');32 jQuery('#LCAS_id_Opt0').attr("title", "{/literal}{'Personalized not allowed tooltip'|@translate}{literal}");33 }34 23 }); 35 24 … … 49 38 .tablesorter({sortList:[[3,0]], headers: { 1: { sorter: false }, 4: { sorter: false }, 5: { sorter: false } } }) 50 39 .tablesorterPager({container: jQuery("#pager"), positionFixed: false, size: 20, totalPages: 0}); 40 if (Personalized_not_allowed) { 41 jQuery('#LCAS_id_Option0').attr('disabled', 'disabled'); 42 jQuery('#LCAS_id_Opt0').attr("title", "{/literal}{'Personalized not allowed tooltip'|@translate}{literal}"); 43 } 51 44 } 52 45 ); … … 94 87 {'LCAS_Option3'|@translate}<br> 95 88 </label> 89 {* <!-- Shall be implemented later 96 90 <label for = "LCAS_id_Option0" id ="LCAS_id_Opt0"> 97 91 <input type="radio" value="0" {if $LCAS_Option == '0'}checked="checked"{/if} id="LCAS_id_Option0" name="LCAS_Option"> 98 {'LCAS_Option0'|@translate}{if $Personalized_not_allowed}{'Personalized not allowed explanation'|@translate}{/if}<br> 99 </label> 92 {'LCAS_Option0'|@translate}<br>{if $Personalized_not_allowed}{'Personalized not allowed explanation'|@translate}{/if}<br> 93 </label> 94 --> *} 100 95 <br><br> 101 96 </li> -
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 -
extensions/LCAS/trunk/main.inc.php
r8638 r9158 63 63 64 64 $conf_LCAS= unserialize($conf['LoginCaseAccentsSensitivity']); 65 66 // Set $conf['insensitive_case_logon'] to false, as LCAS takes completely 67 // in charge everything around the case and the accents 68 $conf['insensitive_case_logon'] = false; 65 69 66 70 /* User identification */ 67 71 if (script_basename() == 'identification') 68 72 { 69 if (isset($_POST['username']) and isset($conf_LCAS[ 0]))73 if (isset($_POST['username']) and isset($conf_LCAS[1])) 70 74 { 71 $new_username = LCAS_SearchCaseUsername($_POST['username'],$conf_LCAS[ 0]);75 $new_username = LCAS_SearchCaseUsername($_POST['username'],$conf_LCAS[1]); 72 76 $_POST['username'] = $new_username == '' ? $_POST['username'] : $new_username; 73 77 } … … 87 91 load_language('plugin.lang', LCAS_PATH); 88 92 89 if (isset($conf_LCAS[ 0]))90 $NewPostLogin = LCAS_SearchCaseUsername($_POST['login'], $conf_LCAS[ 0], false);93 if (isset($conf_LCAS[1])) 94 $NewPostLogin = LCAS_SearchCaseUsername($_POST['login'], $conf_LCAS[1]); 91 95 92 96 if (isset($NewPostLogin) and get_userid($NewPostLogin))
Note: See TracChangeset
for help on using the changeset viewer.