[8141] | 1 | <?php |
---|
| 2 | |
---|
| 3 | global $user, $lang, $conf, $errors; |
---|
| 4 | |
---|
| 5 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 6 | // +-----------------------------------------------------------------------+ |
---|
| 7 | // | Check Access and exit when user status is not ok | |
---|
| 8 | // +-----------------------------------------------------------------------+ |
---|
| 9 | check_status(ACCESS_ADMINISTRATOR); |
---|
| 10 | |
---|
| 11 | if (!defined('LCAS_PATH')) define('LCAS_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'); |
---|
| 12 | |
---|
| 13 | //ini_set('error_reporting', E_ALL); |
---|
| 14 | //ini_set('display_errors', true); |
---|
| 15 | |
---|
[8181] | 16 | //include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); |
---|
| 17 | include_once(PHPWG_ROOT_PATH.'include/constants.php'); |
---|
| 18 | include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); |
---|
[8141] | 19 | $my_base_url = get_admin_plugin_menu_link(__FILE__); |
---|
| 20 | |
---|
| 21 | load_language('plugin.lang', LCAS_PATH); |
---|
| 22 | load_language('help/plugin.lang', LCAS_PATH); |
---|
| 23 | |
---|
| 24 | $error = array(); |
---|
| 25 | |
---|
| 26 | // +-----------------------------------------------------------------------+ |
---|
| 27 | // | Getting plugin version | |
---|
| 28 | // +-----------------------------------------------------------------------+ |
---|
| 29 | $plugin = LCAS_PluginInfos(LCAS_PATH); |
---|
| 30 | $version = $plugin['version']; |
---|
| 31 | |
---|
[8147] | 32 | if (isset($_POST['submit']) and !is_adviser() and isset($_POST['LCAS_Case_Sensitive']) and isset($_POST['LCAS_Accent_Sensitive']) ) |
---|
[8141] | 33 | { |
---|
| 34 | |
---|
| 35 | /* General configuration settings */ |
---|
| 36 | |
---|
| 37 | /* Check if CR-LF exist at begining and end of mail exclusion list - If yes, removes them */ |
---|
| 38 | $newconf_LCAS= array( |
---|
[8147] | 39 | $_POST['LCAS_Case_Sensitive'], |
---|
| 40 | $_POST['LCAS_Accent_Sensitive']); |
---|
[8141] | 41 | |
---|
| 42 | $conf['LoginCaseAccentsSensitivity'] = serialize($newconf_LCAS); |
---|
| 43 | |
---|
| 44 | $query = ' |
---|
| 45 | UPDATE '.CONFIG_TABLE.' |
---|
| 46 | SET value="'.addslashes($conf['LoginCaseAccentsSensitivity']).'" |
---|
| 47 | WHERE param="LoginCaseAccentsSensitivity" |
---|
| 48 | LIMIT 1 |
---|
| 49 | ;'; |
---|
| 50 | |
---|
| 51 | pwg_query($query); |
---|
| 52 | |
---|
| 53 | array_push($page['infos'], l10n('LCAS_save_config')); |
---|
| 54 | } |
---|
| 55 | |
---|
[8181] | 56 | $conf_LCAS= unserialize($conf['LoginCaseAccentsSensitivity']); |
---|
[8141] | 57 | |
---|
| 58 | if ((isset($conf_LCAS[0]) and $conf_LCAS[0]=='true') || (isset($conf_LCAS[1]) and $conf_LCAS[1]=='true')) |
---|
| 59 | { |
---|
| 60 | // +-----------------------------------------------------------------------+ |
---|
| 61 | // | initialization | |
---|
| 62 | // +-----------------------------------------------------------------------+ |
---|
| 63 | |
---|
[8164] | 64 | $lcas_UserToUpdate = -1; |
---|
| 65 | if ((isset($_POST['UserToUpdate'])) && ($_POST['UserToUpdate'] != -1)) { |
---|
| 66 | $lcas_UserToUpdate = $_POST['UserToUpdate']; |
---|
| 67 | |
---|
| 68 | if ((isset($_POST['user-'.$lcas_UserToUpdate])) && ($_POST['user-'.$lcas_UserToUpdate] != '')) { |
---|
[8209] | 69 | // Vérifier si le nom n'est pas déjà pris |
---|
[8164] | 70 | |
---|
| 71 | |
---|
| 72 | |
---|
[8209] | 73 | // Mise à jour du nom |
---|
[8164] | 74 | $query = ' |
---|
| 75 | UPDATE '.USERS_TABLE.' |
---|
| 76 | SET username="'.addslashes($_POST['user-'.$lcas_UserToUpdate]).'" |
---|
| 77 | WHERE id='.$lcas_UserToUpdate.' |
---|
| 78 | LIMIT 1 |
---|
| 79 | ;'; |
---|
[8141] | 80 | |
---|
[8164] | 81 | pwg_query($query); |
---|
| 82 | |
---|
| 83 | array_push($page['infos'], l10n('LCAS_Info_userlist_username_renamed')); |
---|
| 84 | } |
---|
| 85 | else { |
---|
| 86 | // User is empty |
---|
| 87 | array_push($page['errors'], l10n('LCAS_Err_Userlist_Empty_New_Username')); |
---|
| 88 | } |
---|
| 89 | } |
---|
| 90 | |
---|
| 91 | |
---|
| 92 | |
---|
[8141] | 93 | // +-----------------------------------------------------------------------+ |
---|
| 94 | // | user list | |
---|
| 95 | // +-----------------------------------------------------------------------+ |
---|
| 96 | |
---|
[8143] | 97 | if ($conf_LCAS[0]=='true' && $conf_LCAS[1]=='true') |
---|
[8209] | 98 | $lcas_rule = 3; |
---|
[8143] | 99 | else if ($conf_LCAS[0]=='true') |
---|
| 100 | $lcas_rule = 1; |
---|
| 101 | else if ($conf_LCAS[1]=='true') |
---|
[8209] | 102 | $lcas_rule = 2; |
---|
[8143] | 103 | else |
---|
| 104 | $lcas_rule = 0; |
---|
| 105 | |
---|
| 106 | $page['all_users'] = LCAS_get_user_list($lcas_rule); |
---|
[8141] | 107 | |
---|
| 108 | // +-----------------------------------------------------------------------+ |
---|
| 109 | // | user list | |
---|
| 110 | // +-----------------------------------------------------------------------+ |
---|
| 111 | |
---|
[8147] | 112 | $lcas_previous_compare_user = ''; |
---|
| 113 | $visible_user_list = array(); |
---|
| 114 | foreach ($page['all_users'] as $local_user) |
---|
[8141] | 115 | { |
---|
[8147] | 116 | if ($lcas_previous_compare_user != $local_user['transformed']) { |
---|
| 117 | $display = 'orange'; |
---|
| 118 | $lcas_previous_compare_user = $local_user['transformed']; |
---|
[8141] | 119 | } |
---|
[8147] | 120 | else { |
---|
| 121 | $display = ''; |
---|
| 122 | } |
---|
[8141] | 123 | |
---|
| 124 | $template->append( |
---|
| 125 | 'users', |
---|
| 126 | array( |
---|
| 127 | 'ID' => $local_user['id'], |
---|
[8147] | 128 | 'USERNAME' => stripslashes($local_user['username']), |
---|
| 129 | 'COMPARE' => stripslashes($local_user['transformed']), |
---|
[8141] | 130 | 'EMAIL' => get_email_address_as_display_text($local_user['email']), |
---|
| 131 | 'DISPLAY' => $display, |
---|
| 132 | ) |
---|
| 133 | ); |
---|
| 134 | } |
---|
| 135 | /* Plugin version inserted */ |
---|
| 136 | $template->assign( |
---|
| 137 | array( |
---|
| 138 | 'LCAS_VERSION' => $version, |
---|
| 139 | 'LCAS_PATH' => LCAS_PATH, |
---|
| 140 | ) |
---|
| 141 | ); |
---|
[8164] | 142 | |
---|
| 143 | |
---|
[8141] | 144 | // +-----------------------------------------------------------------------+ |
---|
| 145 | // | errors display | |
---|
| 146 | // +-----------------------------------------------------------------------+ |
---|
| 147 | if ( isset ($errors) and count($errors) != 0) |
---|
| 148 | { |
---|
| 149 | $template->assign('errors',array()); |
---|
| 150 | foreach ($errors as $error) |
---|
| 151 | { |
---|
| 152 | array_push($page['errors'], $error); |
---|
| 153 | } |
---|
| 154 | } |
---|
| 155 | |
---|
[8181] | 156 | } |
---|
| 157 | |
---|
| 158 | |
---|
| 159 | $template->assign( |
---|
| 160 | array( |
---|
| 161 | 'LCAS_VERSION' => $version, |
---|
| 162 | 'LCAS_PATH' => LCAS_PATH, |
---|
| 163 | 'PWG_insensitive_case_logon' => $conf['insensitive_case_logon']? 'true' : 'false', |
---|
| 164 | 'LCAS_Case_Sensitive_TRUE' => $conf_LCAS[0]=='true' ? 'checked="checked"' : '' , |
---|
| 165 | 'LCAS_Case_Sensitive_FALSE' => $conf_LCAS[0]=='false' ? 'checked="checked"' : '' , |
---|
| 166 | 'LCAS_Accent_Sensitive_TRUE' => $conf_LCAS[1]=='true' ? 'checked="checked"' : '' , |
---|
| 167 | 'LCAS_Accent_Sensitive_FALSE' => $conf_LCAS[1]=='false' ? 'checked="checked"' : '' |
---|
| 168 | ) |
---|
| 169 | ); |
---|
| 170 | |
---|
| 171 | |
---|
[8141] | 172 | // +-----------------------------------------------------------------------+ |
---|
[8181] | 173 | // | errors display | |
---|
[8141] | 174 | // +-----------------------------------------------------------------------+ |
---|
[8181] | 175 | if (isset ($errors) and count($errors) != 0) |
---|
[8141] | 176 | { |
---|
[8181] | 177 | $template->assign('errors',array()); |
---|
| 178 | foreach ($errors as $error) |
---|
| 179 | { |
---|
| 180 | array_push($page['errors'], $error); |
---|
| 181 | } |
---|
| 182 | } |
---|
[8141] | 183 | |
---|
[8181] | 184 | // +-----------------------------------------------------------------------+ |
---|
| 185 | // | templates display | |
---|
| 186 | // +-----------------------------------------------------------------------+ |
---|
| 187 | $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/template/global.tpl'); |
---|
| 188 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
| 189 | |
---|
[8209] | 190 | ?> |
---|