Changeset 8638 for extensions/LCAS/trunk/admin
- Timestamp:
- Jan 13, 2011, 2:58:32 AM (13 years ago)
- Location:
- extensions/LCAS/trunk/admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/LCAS/trunk/admin/LCAS_admin.php
r8271 r8638 23 23 $error = array(); 24 24 25 $t = pwg_db_fetch_row(pwg_query(' 26 SELECT `value` 27 FROM `'.CONFIG_TABLE.'` 28 WHERE `param` = "LoginCaseAccentsSensitivity" 29 LIMIT 1; 30 ')); 31 32 $conf['LoginCaseAccentsSensitivity'] = $t[0]; 33 25 34 // +-----------------------------------------------------------------------+ 26 35 // | Getting plugin version | … … 29 38 $version = $plugin['version']; 30 39 31 if (isset($_POST['submit']) and !is_adviser() and isset($_POST['LCAS_ Case_Sensitive']) and isset($_POST['LCAS_Accent_Sensitive']) and isset($_POST['LCAS_Mail']))40 if (isset($_POST['submit']) and !is_adviser() and isset($_POST['LCAS_Option']) and isset($_POST['LCAS_Mail'])) 32 41 { 33 42 34 43 /* General configuration settings */ 35 44 $_POST['LCAS_MailText'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['LCAS_MailText']))); 36 37 $newconf_LCAS= array( 38 $_POST['LCAS_Case_Sensitive'], 39 $_POST['LCAS_Accent_Sensitive'], 45 46 // LCAS configuration is now hereby defined : 47 // $conf_LCAS[0] : "final case", describe how LCAS should behave; 48 // $conf_LCAS[1] : LCAS option, describe the choice of the webmaster; 49 // $conf_LCAS[2] : LCAS_Mail; 50 // $conf_LCAS[3] : LCAS_MailText. 51 $newconf_LCAS= array( 52 LCAS_final_case($_POST['LCAS_Option']), 53 $_POST['LCAS_Option'], 54 // $_POST['LCAS__spare'] : quite lazy, but convenient to not have to 55 // decrease index of each option below everywhere :-/ ... 40 56 $_POST['LCAS_Mail'], 41 57 $_POST['LCAS_MailText']); … … 52 68 pwg_query($query); 53 69 54 // $conf['insensitive_case_logon'] have to be True for a full LCAS use 55 if ($conf['insensitive_case_logon']) 70 array_push($page['infos'], l10n('LCAS_save_config')); 71 } 72 73 $conf_LCAS= unserialize($conf['LoginCaseAccentsSensitivity']); 74 $conf_LCAS[0] = LCAS_final_case($conf_LCAS[1]); 75 76 if (isset($conf_LCAS[0])) 77 { 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'))); 86 87 if ($case_ins or $acc_ins) 56 88 { 57 array_push($page['infos'], l10n('LCAS_save_config')); 89 // +-----------------------------------------------------------------------+ 90 // | initialization | 91 // +-----------------------------------------------------------------------+ 92 93 $lcas_UserToUpdate = -1; 94 if ((isset($_POST['UserToUpdate'])) && ($_POST['UserToUpdate'] != -1)) { 95 $lcas_UserToUpdate = $_POST['UserToUpdate']; 96 97 if ((isset($_POST['user-'.$lcas_UserToUpdate])) && ($_POST['user-'.$lcas_UserToUpdate] != '')) { 98 // Vérifier si le nom n'est pas déjà pris 99 100 101 102 // Mise à jour du nom 103 $query = ' 104 UPDATE '.USERS_TABLE.' 105 SET username="'.addslashes($_POST['user-'.$lcas_UserToUpdate]).'" 106 WHERE id='.$lcas_UserToUpdate.' 107 LIMIT 1 108 ;'; 109 110 pwg_query($query); 111 112 if (isset($conf_LCAS[2]) and $conf_LCAS[2] = 'true') 113 { 114 LCAS_SendMail($lcas_UserToUpdate, $_POST['user-'.$lcas_UserToUpdate]); 115 } 116 117 array_push($page['infos'], l10n('LCAS_Info_userlist_username_renamed')); 118 } 119 else { 120 // User is empty 121 array_push($page['errors'], l10n('LCAS_Err_Userlist_Empty_New_Username')); 122 } 123 } 124 125 126 // +-----------------------------------------------------------------------+ 127 // | user list | 128 // +-----------------------------------------------------------------------+ 129 130 $page['all_users'] = LCAS_get_user_list($conf_LCAS[0]); 131 132 // +-----------------------------------------------------------------------+ 133 // | user list | 134 // +-----------------------------------------------------------------------+ 135 136 $lcas_previous_compare_user = ''; 137 $visible_user_list = array(); 138 foreach ($page['all_users'] as $local_user) 139 { 140 if ($lcas_previous_compare_user != $local_user['transformed']) { 141 $display = 'orange'; 142 $lcas_previous_compare_user = $local_user['transformed']; 143 } 144 else { 145 $display = ''; 146 } 147 148 $template->append( 149 'users', 150 array( 151 'ID' => $local_user['id'], 152 'USERNAME' => stripslashes($local_user['username']), 153 'COMPARE' => stripslashes($local_user['transformed']), 154 'EMAIL' => get_email_address_as_display_text($local_user['email']), 155 'DISPLAY' => $display, 156 ) 157 ); 158 } 159 /* Plugin version insert */ 160 $template->assign( 161 array( 162 'LCAS_VERSION' => $version, 163 'LCAS_PATH' => LCAS_PATH, 164 ) 165 ); 166 167 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 58 180 } 59 else60 {61 array_push($page['infos'], l10n('LCAS_save_config'));62 array_push($page['errors'], l10n('LCAS_warning'));63 }64 }65 66 $conf_LCAS= unserialize($conf['LoginCaseAccentsSensitivity']);67 68 if ((isset($conf_LCAS[0]) and $conf_LCAS[0]=='true') || (isset($conf_LCAS[1]) and $conf_LCAS[1]=='true'))69 {70 // +-----------------------------------------------------------------------+71 // | initialization |72 // +-----------------------------------------------------------------------+73 74 $lcas_UserToUpdate = -1;75 if ((isset($_POST['UserToUpdate'])) && ($_POST['UserToUpdate'] != -1)) {76 $lcas_UserToUpdate = $_POST['UserToUpdate'];77 78 if ((isset($_POST['user-'.$lcas_UserToUpdate])) && ($_POST['user-'.$lcas_UserToUpdate] != '')) {79 // Vérifier si le nom n'est pas déjà pris80 81 82 83 // Mise à jour du nom84 $query = '85 UPDATE '.USERS_TABLE.'86 SET username="'.addslashes($_POST['user-'.$lcas_UserToUpdate]).'"87 WHERE id='.$lcas_UserToUpdate.'88 LIMIT 189 ;';90 91 pwg_query($query);92 93 if (isset($conf_LCAS[2]) and $conf_LCAS[2] = 'true')94 {95 LCAS_SendMail($lcas_UserToUpdate, $_POST['user-'.$lcas_UserToUpdate]);96 }97 98 array_push($page['infos'], l10n('LCAS_Info_userlist_username_renamed'));99 }100 else {101 // User is empty102 array_push($page['errors'], l10n('LCAS_Err_Userlist_Empty_New_Username'));103 }104 }105 106 107 // +-----------------------------------------------------------------------+108 // | user list |109 // +-----------------------------------------------------------------------+110 111 if ($conf_LCAS[0]=='true' && $conf_LCAS[1]=='true')112 $lcas_rule = 3;113 else if ($conf_LCAS[0]=='true')114 $lcas_rule = 1;115 else if ($conf_LCAS[1]=='true')116 $lcas_rule = 2;117 else118 $lcas_rule = 0;119 120 $page['all_users'] = LCAS_get_user_list($lcas_rule);121 122 // +-----------------------------------------------------------------------+123 // | user list |124 // +-----------------------------------------------------------------------+125 126 $lcas_previous_compare_user = '';127 $visible_user_list = array();128 foreach ($page['all_users'] as $local_user)129 {130 if ($lcas_previous_compare_user != $local_user['transformed']) {131 $display = 'orange';132 $lcas_previous_compare_user = $local_user['transformed'];133 }134 else {135 $display = '';136 }137 138 $template->append(139 'users',140 array(141 'ID' => $local_user['id'],142 'USERNAME' => stripslashes($local_user['username']),143 'COMPARE' => stripslashes($local_user['transformed']),144 'EMAIL' => get_email_address_as_display_text($local_user['email']),145 'DISPLAY' => $display,146 )147 );148 }149 /* Plugin version insert */150 $template->assign(151 array(152 'LCAS_VERSION' => $version,153 'LCAS_PATH' => LCAS_PATH,154 )155 );156 157 158 // +-----------------------------------------------------------------------+159 // | errors display |160 // +-----------------------------------------------------------------------+161 if ( isset ($errors) and count($errors) != 0)162 {163 $template->assign('errors',array());164 foreach ($errors as $error)165 {166 array_push($page['errors'], $error);167 }168 }169 170 181 } 171 182 … … 178 189 'LCAS_VERSION' => $version, 179 190 'LCAS_PATH' => LCAS_PATH, 180 'PWG_insensitive_case_logon' => $conf['insensitive_case_logon']? 'true' : 'false', 181 'LCAS_Case_Sensitive_TRUE' => $conf_LCAS[0]=='true' ? 'checked="checked"' : '' , 182 'LCAS_Case_Sensitive_FALSE' => $conf_LCAS[0]=='false' ? 'checked="checked"' : '' , 183 'LCAS_Accent_Sensitive_TRUE' => $conf_LCAS[1]=='true' ? 'checked="checked"' : '' , 184 'LCAS_Accent_Sensitive_FALSE' => $conf_LCAS[1]=='false' ? 'checked="checked"' : '' , 191 'PWG_insensitive_case_logon' => ($conf['insensitive_case_logon']), 192 'Personalized_not_allowed' => (!isset($conf['LCAS_replacement_set'][0])), 193 'LCAS_final_case' => $conf_LCAS[0], 194 'LCAS_Option' => $conf_LCAS[1], 185 195 'LCAS_MAIL_TRUE' => $conf_LCAS[2]=='true' ? 'checked="checked"' : '' , 186 196 'LCAS_MAIL_FALSE' => $conf_LCAS[2]=='false' ? 'checked="checked"' : '' , -
extensions/LCAS/trunk/admin/template/global.tpl
r8565 r8638 7 7 8 8 <script type="text/javascript"> 9 jQuery().ready(function() 10 {ldelim} 9 var LCAS_final_case = '{$LCAS_final_case}'; 10 var PWG_insensitive_case_logon = {if $PWG_insensitive_case_logon}true{else}false{/if}; 11 var Personalized_not_allowed = {if $Personalized_not_allowed}true{else}false{/if}; 12 {literal} 13 jQuery().ready(function(){ 11 14 jQuery('.cluetip').cluetip( 12 { ldelim}15 { 13 16 width: 550, 14 17 splitTitle: '|' 15 {rdelim}); 16 {rdelim}); 18 }); 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 }); 17 35 18 36 function LCAS_blockToggleDisplay( headerId, contentId ) 19 { ldelim}37 { 20 38 if (typeof(headerId)=='string') 21 { ldelim}39 { 22 40 if ( headerId.length> 1) 23 41 blockToggleDisplay(headerId, contentId) ; 24 42 document.getElementById("nb_para").value =headerId ; 25 43 document.getElementById("nb_para2").value =contentId; 26 {rdelim}27 {rdelim}44 } 45 } 28 46 jQuery(document).ready(function() 29 { ldelim}47 { 30 48 jQuery("#sorting") 31 .tablesorter({ ldelim}sortList:[[3,0]], headers: {ldelim} 1: {ldelim} sorter: false {rdelim}, 4: {ldelim} sorter: false {rdelim}, 5: {ldelim} sorter: false {rdelim} {rdelim} {rdelim})32 .tablesorterPager({ ldelim}container: jQuery("#pager"), positionFixed: false, size: 20, totalPages: 0{rdelim});33 {rdelim}49 .tablesorter({sortList:[[3,0]], headers: { 1: { sorter: false }, 4: { sorter: false }, 5: { sorter: false } } }) 50 .tablesorterPager({container: jQuery("#pager"), positionFixed: false, size: 20, totalPages: 0}); 51 } 34 52 ); 35 function UpdateAUser(UserId) { ldelim}53 function UpdateAUser(UserId) { 36 54 document.UserList.UserToUpdate.value=UserId;document.UserList.submit(); 37 {rdelim} 55 } 56 {/literal} 38 57 </script> 39 58 … … 60 79 <li> 61 80 <label class="cluetip" title="{'LCAS_caseSensitiveTitle'|translate}|{'LCAS_caseSensitiveTitle_d'|translate}"> 62 {'LCAS_Case_Sensitive'|@translate} 63 </label> 64 <br><br> 65 <input type="radio" value="false" {$LCAS_Case_Sensitive_FALSE} name="LCAS_Case_Sensitive"> 66 {'LCAS_DisableOption'|@translate}<br> 67 <input type="radio" value="true" {$LCAS_Case_Sensitive_TRUE} name="LCAS_Case_Sensitive"> 68 {'LCAS_EnableOption'|@translate} 81 {'LCAS option'|@translate} 82 </label> 83 <br><br> 84 <label for = "LCAS_id_Option1" id ="LCAS_id_Opt1"> 85 <input type="radio" value="1" {if $LCAS_Option == '1'}checked="checked"{/if} id="LCAS_id_Option1" name="LCAS_Option"> 86 {'LCAS_Option1'|@translate}<br> 87 </label> 88 <label for = "LCAS_id_Option2" id ="LCAS_id_Opt2"> 89 <input type="radio" value="2" {if $LCAS_Option == '2'}checked="checked"{/if} id="LCAS_id_Option2" name="LCAS_Option"> 90 {'LCAS_Option2'|@translate}<br> 91 </label> 92 <label for = "LCAS_id_Option3" id ="LCAS_id_Opt3"> 93 <input type="radio" value="3" {if $LCAS_Option == '3'}checked="checked"{/if} id="LCAS_id_Option3" name="LCAS_Option"> 94 {'LCAS_Option3'|@translate}<br> 95 </label> 96 <label for = "LCAS_id_Option0" id ="LCAS_id_Opt0"> 97 <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> 69 100 <br><br> 70 101 </li> 71 72 <li>73 <label class="cluetip" title="{'LCAS_accentSensitiveTitle'|translate}|{'LCAS_accentSensitiveTitle_d'|translate}">74 {'LCAS_Accent_Sensitive'|@translate}75 </label>76 <br><br>77 <input type="radio" value="false" {$LCAS_Accent_Sensitive_FALSE} name="LCAS_Accent_Sensitive">78 {'LCAS_DisableOption'|@translate}<br>79 <input type="radio" value="true" {$LCAS_Accent_Sensitive_TRUE} name="LCAS_Accent_Sensitive">80 {'LCAS_EnableOption'|@translate}<br>81 <br><br>82 </li>83 102 84 103 <li> … … 127 146 <label class="cluetip" title="{'LCAS_currentPWGConfig'|translate}|{'LCAS_currentPWGConfig_d'|translate}"> 128 147 $conf['insensitive_case_logon'] = 129 {if $PWG_insensitive_case_logon == 'true'}130 <span style="color: green;"> {$PWG_insensitive_case_logon}</span>;148 {if $PWG_insensitive_case_logon} 149 <span style="color: green;">true</span>; 131 150 {else} 132 <span style="color: red;"> {$PWG_insensitive_case_logon}</span>;151 <span style="color: red;">false</span>; 133 152 {/if} 134 153 </label>
Note: See TracChangeset
for help on using the changeset viewer.