[5056] | 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 | |
---|
[5181] | 11 | if (!defined('UAM_PATH')) define('UAM_PATH' , PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'); |
---|
[5056] | 12 | |
---|
| 13 | //ini_set('error_reporting', E_ALL); |
---|
| 14 | //ini_set('display_errors', true); |
---|
| 15 | |
---|
[5593] | 16 | include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); |
---|
[5056] | 17 | include_once (PHPWG_ROOT_PATH.'/include/constants.php'); |
---|
| 18 | |
---|
[5181] | 19 | load_language('plugin.lang', UAM_PATH); |
---|
[12205] | 20 | load_language('help.lang', UAM_PATH); |
---|
[5056] | 21 | |
---|
[7955] | 22 | |
---|
| 23 | // +-----------------------------------------------------------------------+ |
---|
| 24 | // | Variables initialization | |
---|
| 25 | // +-----------------------------------------------------------------------+ |
---|
| 26 | $my_base_url = get_admin_plugin_menu_link(__FILE__); |
---|
| 27 | |
---|
[5056] | 28 | $page['global'] = array(); |
---|
| 29 | $error = array(); |
---|
| 30 | $pattern = '/;/'; |
---|
| 31 | $replacement = '.'; |
---|
| 32 | |
---|
| 33 | $UAM_Password_Test_Score = 0; |
---|
| 34 | $UAM_Exclusionlist_Error = false; |
---|
[11318] | 35 | $UAM_Illegal_Flag_Error1 = false; |
---|
| 36 | $UAM_Illegal_Flag_Error2 = false; |
---|
| 37 | $UAM_Illegal_Flag_Error3 = false; |
---|
[12689] | 38 | $UAM_Email_Mandatory_Check = false; |
---|
[5056] | 39 | |
---|
[10342] | 40 | $dump_download = ''; |
---|
[7955] | 41 | |
---|
[5056] | 42 | // +-----------------------------------------------------------------------+ |
---|
| 43 | // | Tabssheet | |
---|
| 44 | // +-----------------------------------------------------------------------+ |
---|
| 45 | if (!isset($_GET['tab'])) |
---|
| 46 | $page['tab'] = 'global'; |
---|
| 47 | else |
---|
[17918] | 48 | $page['tab'] = $_GET['tab']; |
---|
[5056] | 49 | |
---|
| 50 | $tabsheet = new tabsheet(); |
---|
| 51 | $tabsheet->add('global', |
---|
[9177] | 52 | l10n('UAM_Tab_Global'), |
---|
[5056] | 53 | $my_base_url.'&tab=global'); |
---|
[17918] | 54 | $tabsheet->add('userlist', |
---|
| 55 | l10n('UAM_Tracking registered users'), |
---|
| 56 | $my_base_url.'&tab=userlist'); |
---|
[5056] | 57 | $tabsheet->add('usermanager', |
---|
[13107] | 58 | l10n('UAM_Tracking confirmations'), |
---|
[5056] | 59 | $my_base_url.'&tab=usermanager'); |
---|
| 60 | $tabsheet->add('ghosttracker', |
---|
[9177] | 61 | l10n('UAM_Tab_GhostTracker'), |
---|
[5056] | 62 | $my_base_url.'&tab=ghosttracker'); |
---|
| 63 | $tabsheet->select($page['tab']); |
---|
| 64 | $tabsheet->assign(); |
---|
| 65 | |
---|
| 66 | |
---|
| 67 | // +-----------------------------------------------------------------------+ |
---|
| 68 | // | Getting plugin version | |
---|
| 69 | // +-----------------------------------------------------------------------+ |
---|
[5181] | 70 | $plugin = PluginInfos(UAM_PATH); |
---|
[5762] | 71 | $version = $plugin['version']; |
---|
[5056] | 72 | |
---|
| 73 | |
---|
| 74 | // +----------------------------------------------------------+ |
---|
| 75 | // | FCK Editor for email text fields | |
---|
| 76 | // +----------------------------------------------------------+ |
---|
[5181] | 77 | $toolbar = 'Basic'; |
---|
[5073] | 78 | $width = '750px'; |
---|
| 79 | $height = '300px'; |
---|
| 80 | $areas = array(); |
---|
[12661] | 81 | array_push( $areas,'UAM_ConfirmMail_Custom_Txt1','UAM_ConfirmMail_Custom_Txt2','UAM_GTAutoDelText','UAM_USRAutoDelText','UAM_CustomRejectConnexion_Text'); |
---|
[5084] | 82 | |
---|
[5073] | 83 | if (function_exists('set_fckeditor_instance')) |
---|
[5084] | 84 | { |
---|
[20592] | 85 | $fcke_config = unserialize($conf['FCKEditor']); |
---|
[5084] | 86 | foreach($areas as $area) |
---|
| 87 | { |
---|
[20592] | 88 | if (!isset($fcke_config[$area])) |
---|
[5084] | 89 | { |
---|
| 90 | $fcke_config[$area] = false; |
---|
| 91 | } |
---|
| 92 | } |
---|
[20592] | 93 | $conf['FCKEditor'] = serialize($fcke_config); |
---|
[5084] | 94 | |
---|
[20592] | 95 | set_fckeditor_instance($areas, $toolbar, $width, $height); |
---|
[5181] | 96 | } |
---|
[5056] | 97 | |
---|
| 98 | |
---|
| 99 | // +-----------------------------------------------------------------------+ |
---|
| 100 | // | Tabssheet select | |
---|
| 101 | // +-----------------------------------------------------------------------+ |
---|
| 102 | |
---|
| 103 | switch ($page['tab']) |
---|
| 104 | { |
---|
| 105 | // ************************************************************************* |
---|
| 106 | // +-----------------------------------------------------------------------+ |
---|
| 107 | // | Global Config | |
---|
| 108 | // +-----------------------------------------------------------------------+ |
---|
| 109 | // ************************************************************************* |
---|
[20592] | 110 | case 'global': |
---|
[5056] | 111 | |
---|
[20592] | 112 | if (isset($_POST['submit']) and isset($_POST['UAM_Mail_Info']) and isset($_POST['UAM_Username_Char']) and isset($_POST['UAM_Confirm_Mail']) and isset($_POST['UAM_Password_Enforced']) and isset($_POST['UAM_AdminPassword_Enforced']) and isset($_POST['UAM_GhostUser_Tracker']) and isset($_POST['UAM_Admin_ConfMail']) and isset($_POST['UAM_RedirToProfile']) and isset($_POST['UAM_GTAuto']) and isset($_POST['UAM_GTAutoMail']) and isset($_POST['UAM_CustomPasswRetr']) and isset($_POST['UAM_USRAuto']) and isset($_POST['UAM_USRAutoMail']) and isset($_POST['UAM_Stuffs']) and isset($_POST['UAM_HidePassw']) and isset($_POST['UAM_PwdReset']) and isset($_POST['UAM_RejectConnexion'])) |
---|
| 113 | { |
---|
[5056] | 114 | |
---|
[20592] | 115 | // Render email contents fields |
---|
| 116 | // ---------------------------- |
---|
| 117 | $_POST['UAM_MailInfo_Text'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_MailInfo_Text']))); |
---|
[11318] | 118 | |
---|
[20592] | 119 | $_POST['UAM_ConfirmMail_Text'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_ConfirmMail_Text']))); |
---|
[5056] | 120 | |
---|
[20592] | 121 | $_POST['UAM_GhostTracker_ReminderText'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_GhostTracker_ReminderText']))); |
---|
[14729] | 122 | |
---|
[20592] | 123 | $_POST['UAM_GTAutoDelText'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_GTAutoDelText']))); |
---|
[5056] | 124 | |
---|
[20592] | 125 | $_POST['UAM_GTAutoMailText'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_GTAutoMailText']))); |
---|
[9135] | 126 | |
---|
[20592] | 127 | $_POST['UAM_AdminValidationMail_Text'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_AdminValidationMail_Text']))); |
---|
[5056] | 128 | |
---|
[20592] | 129 | $_POST['UAM_CustomPasswRetr_Text'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_CustomPasswRetr_Text']))); |
---|
[9135] | 130 | |
---|
[20592] | 131 | $_POST['UAM_USRAutoDelText'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_GTAutoDelText']))); |
---|
[9266] | 132 | |
---|
[20592] | 133 | $_POST['UAM_CustomRejectConnexion_Text'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_CustomRejectConnexion_Text']))); |
---|
[12661] | 134 | |
---|
[20592] | 135 | // Render email subjects fields |
---|
| 136 | // --------------------------- |
---|
| 137 | $_POST['UAM_ConfirmMail_Subject'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_ConfirmMail_Subject']))); |
---|
[14635] | 138 | |
---|
[20592] | 139 | $_POST['UAM_ConfirmMail_Remail_Subject'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_ConfirmMail_Remail_Subject']))); |
---|
[14729] | 140 | |
---|
[20592] | 141 | $_POST['UAM_InfoMail_Subject'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_InfoMail_Subject']))); |
---|
[14729] | 142 | |
---|
[20592] | 143 | $_POST['UAM_GTAutoMail_Subject'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_GTAutoMail_Subject']))); |
---|
[14729] | 144 | |
---|
[20592] | 145 | $_POST['UAM_GTReminder_Subject'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_GTReminder_Subject']))); |
---|
[14729] | 146 | |
---|
[20592] | 147 | $_POST['UAM_AdminValidationMail_Subject'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_AdminValidationMail_Subject']))); |
---|
[14729] | 148 | |
---|
| 149 | |
---|
[20592] | 150 | // Check if emails are mandatory for registrations (needed for email exclusion option) |
---|
| 151 | // ----------------------------------------------------------------------------------- |
---|
| 152 | if ($conf['obligatory_user_mail_address']) |
---|
| 153 | { |
---|
| 154 | // Check if CR-LF exist at begining and end of mail exclusion list - If yes, removes them |
---|
| 155 | // -------------------------------------------------------------------------------------- |
---|
| 156 | if (preg_match('/^[\s]+/', $_POST['UAM_MailExclusion_List'])) |
---|
| 157 | { |
---|
| 158 | array_push($page['errors'], l10n('UAM_mail_exclusionlist_error')); |
---|
| 159 | $UAM_Exclusionlist_Error = true; |
---|
| 160 | } |
---|
| 161 | } |
---|
| 162 | elseif (!$conf['obligatory_user_mail_address']) |
---|
| 163 | { |
---|
| 164 | $_POST['UAM_MailExclusion_List'] = ''; |
---|
| 165 | } |
---|
[6754] | 166 | |
---|
[8065] | 167 | // Consistency check between ConfirmMail and AutoMail - We cannot use GTAutoMail if ConfirmMail is disabled |
---|
[12271] | 168 | // --------------------------------------------------------------------------------------------------------- |
---|
[8065] | 169 | $conf_UAM = unserialize($conf['UserAdvManager']); |
---|
[11318] | 170 | $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']); |
---|
[8065] | 171 | |
---|
| 172 | if (((isset($conf_UAM['1']) and ($conf_UAM['1'] == 'false' or $conf_UAM['1'] == 'local')) or ($_POST['UAM_Confirm_Mail'] == 'false' or $_POST['UAM_Confirm_Mail'] == 'local')) and $_POST['UAM_GTAutoMail'] == 'true') |
---|
| 173 | { |
---|
[20592] | 174 | $newvalue = 'false'; |
---|
[8065] | 175 | $_POST['UAM_GTAutoMail'] = $newvalue; |
---|
[9177] | 176 | array_push($page['errors'], l10n('UAM_Error_GTAutoMail_cannot_be_set_without_ConfirmMail')); |
---|
[8065] | 177 | } |
---|
| 178 | |
---|
[11318] | 179 | // Check if [Kdays] flag is used in a legal way (ConfirmMail Time out have to be set) |
---|
[12271] | 180 | // ---------------------------------------------------------------------------------- |
---|
[11318] | 181 | if (isset($conf_UAM_ConfirmMail[0]) and $conf_UAM_ConfirmMail[0] == 'false' and preg_match('#\[Kdays\]#i',$_POST['UAM_ConfirmMail_Text']) != 0) |
---|
| 182 | { |
---|
| 183 | $UAM_Illegal_Flag_Error1 = true; |
---|
| 184 | array_push($page['errors'], l10n('UAM_Error_Using_illegal_Kdays')); |
---|
| 185 | } |
---|
| 186 | |
---|
[12205] | 187 | // Save global UAM configuration |
---|
[12271] | 188 | // ----------------------------- |
---|
[20592] | 189 | $newconf_UAM = array( |
---|
| 190 | $_POST['UAM_Mail_Info'], |
---|
[5056] | 191 | $_POST['UAM_Confirm_Mail'], |
---|
| 192 | (isset($_POST['UAM_No_Confirm_Group'])?$_POST['UAM_No_Confirm_Group']:''), |
---|
| 193 | (isset($_POST['UAM_Validated_Group'])?$_POST['UAM_Validated_Group']:''), |
---|
| 194 | (isset($_POST['UAM_Validated_Status'])?$_POST['UAM_Validated_Status']:''), |
---|
| 195 | $_POST['UAM_Username_Char'], |
---|
| 196 | $_POST['UAM_Username_List'], |
---|
[17972] | 197 | (isset($_POST['UAM_No_Confirm_Status'])?$_POST['UAM_No_Confirm_Status']:''), |
---|
[5056] | 198 | $_POST['UAM_MailInfo_Text'], |
---|
| 199 | $_POST['UAM_ConfirmMail_Text'], |
---|
| 200 | $_POST['UAM_MailExclusion'], |
---|
| 201 | $_POST['UAM_MailExclusion_List'], |
---|
| 202 | $_POST['UAM_Password_Enforced'], |
---|
| 203 | $_POST['UAM_Password_Score'], |
---|
| 204 | $_POST['UAM_AdminPassword_Enforced'], |
---|
| 205 | $_POST['UAM_GhostUser_Tracker'], |
---|
| 206 | $_POST['UAM_GhostTracker_DayLimit'], |
---|
| 207 | $_POST['UAM_GhostTracker_ReminderText'], |
---|
[5064] | 208 | $_POST['UAM_Add_LastVisit_Column'], |
---|
[6775] | 209 | $_POST['UAM_Admin_ConfMail'], |
---|
[8065] | 210 | $_POST['UAM_RedirToProfile'], |
---|
| 211 | $_POST['UAM_GTAuto'], |
---|
| 212 | $_POST['UAM_GTAutoMail'], |
---|
| 213 | $_POST['UAM_GTAutoDelText'], |
---|
| 214 | $_POST['UAM_GTAutoMailText'], |
---|
| 215 | (isset($_POST['UAM_Downgrade_Group'])?$_POST['UAM_Downgrade_Group']:''), |
---|
[17972] | 216 | (isset($_POST['UAM_Downgrade_Status'])?$_POST['UAM_Downgrade_Status']:''), |
---|
[9135] | 217 | $_POST['UAM_AdminValidationMail_Text'], |
---|
| 218 | $_POST['UAM_CustomPasswRetr'], |
---|
[9266] | 219 | $_POST['UAM_CustomPasswRetr_Text'], |
---|
| 220 | $_POST['UAM_USRAuto'], |
---|
| 221 | $_POST['UAM_USRAutoDelText'], |
---|
[9908] | 222 | $_POST['UAM_USRAutoMail'], |
---|
[10391] | 223 | $_POST['UAM_Stuffs'], |
---|
[10957] | 224 | $_POST['UAM_HidePassw'], |
---|
[12189] | 225 | (isset($_POST['UAM_No_Valid_Level'])?$_POST['UAM_No_Valid_Level']:''), |
---|
| 226 | (isset($_POST['UAM_Valid_Level'])?$_POST['UAM_Valid_Level']:''), |
---|
| 227 | (isset($_POST['UAM_Downgrade_Level'])?$_POST['UAM_Downgrade_Level']:''), |
---|
[12239] | 228 | $_POST['UAM_PwdReset'], |
---|
[12661] | 229 | $_POST['UAM_RejectConnexion'], |
---|
| 230 | $_POST['UAM_CustomRejectConnexion_Text'], |
---|
[14729] | 231 | $_POST['UAM_ConfirmMail_Subject'], |
---|
| 232 | $_POST['UAM_ConfirmMail_Remail_Subject'], |
---|
| 233 | $_POST['UAM_InfoMail_Subject'], |
---|
| 234 | $_POST['UAM_GTAutoMail_Subject'], |
---|
| 235 | $_POST['UAM_GTReminder_Subject'], |
---|
| 236 | $_POST['UAM_AdminValidationMail_Subject'], |
---|
[20592] | 237 | ); |
---|
[5056] | 238 | |
---|
[5181] | 239 | $conf['UserAdvManager'] = serialize($newconf_UAM); |
---|
[5056] | 240 | |
---|
[10976] | 241 | conf_update_param('UserAdvManager', pwg_db_real_escape_string($conf['UserAdvManager'])); |
---|
[5056] | 242 | |
---|
[12271] | 243 | // Email confirmation settings |
---|
| 244 | // -------------------------- |
---|
[6753] | 245 | $_POST['UAM_ConfirmMail_ReMail_Txt1'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_ConfirmMail_ReMail_Txt1']))); |
---|
[5056] | 246 | |
---|
[6753] | 247 | $_POST['UAM_ConfirmMail_ReMail_Txt2'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_ConfirmMail_ReMail_Txt2']))); |
---|
[17918] | 248 | |
---|
[6753] | 249 | $_POST['UAM_ConfirmMail_Custom_Txt1'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_ConfirmMail_Custom_Txt1']))); |
---|
[17918] | 250 | |
---|
[6753] | 251 | $_POST['UAM_ConfirmMail_Custom_Txt2'] = str_replace('\"', '"', str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UAM_ConfirmMail_Custom_Txt2']))); |
---|
[11318] | 252 | |
---|
| 253 | // Check if [Kdays] flag is used in a legal way (ConfirmMail Time out have to be set) |
---|
[12271] | 254 | // ---------------------------------------------------------------------------------- |
---|
[11318] | 255 | if (isset($conf_UAM_ConfirmMail[0]) and $conf_UAM_ConfirmMail[0] == 'false' and preg_match('#\[Kdays\]#i',$_POST['UAM_ConfirmMail_ReMail_Txt1']) == 1) |
---|
| 256 | { |
---|
| 257 | $UAM_Illegal_Flag_Error2 = true; |
---|
| 258 | array_push($page['errors'], l10n('UAM_Error_Using_illegal_flag')); |
---|
| 259 | } |
---|
| 260 | elseif (isset($conf_UAM_ConfirmMail[0]) and $conf_UAM_ConfirmMail[0] == 'false' and preg_match('#\[Kdays\]#i',$_POST['UAM_ConfirmMail_ReMail_Txt2']) == 1) |
---|
| 261 | { |
---|
| 262 | $UAM_Illegal_Flag_Error3 = true; |
---|
| 263 | array_push($page['errors'], l10n('UAM_Error_Using_illegal_flag')); |
---|
| 264 | } |
---|
[12205] | 265 | |
---|
| 266 | // Save ConfirmMail settings |
---|
[12271] | 267 | // ------------------------- |
---|
[20592] | 268 | $newconf_UAM_ConfirmMail = array ( |
---|
[5056] | 269 | $_POST['UAM_ConfirmMail_TimeOut'], |
---|
| 270 | $_POST['UAM_ConfirmMail_Delay'], |
---|
| 271 | $_POST['UAM_ConfirmMail_ReMail_Txt1'], |
---|
| 272 | $_POST['UAM_ConfirmMail_Remail'], |
---|
[5181] | 273 | $_POST['UAM_ConfirmMail_ReMail_Txt2'], |
---|
| 274 | $_POST['UAM_ConfirmMail_Custom_Txt1'], |
---|
[20592] | 275 | $_POST['UAM_ConfirmMail_Custom_Txt2'] |
---|
| 276 | ); |
---|
[5056] | 277 | |
---|
[5181] | 278 | $conf['UserAdvManager_ConfirmMail'] = serialize($newconf_UAM_ConfirmMail); |
---|
[5056] | 279 | |
---|
[10976] | 280 | conf_update_param('UserAdvManager_ConfirmMail', pwg_db_real_escape_string($conf['UserAdvManager_ConfirmMail'])); |
---|
[5056] | 281 | |
---|
[20592] | 282 | array_push($page['infos'], l10n('UAM_save_config')); |
---|
[5056] | 283 | } |
---|
| 284 | |
---|
[10342] | 285 | // Saving UAM tables and configuration settings |
---|
[12271] | 286 | // -------------------------------------------- |
---|
[10342] | 287 | if (isset($_POST['save'])) |
---|
| 288 | { |
---|
| 289 | $dump_download = (isset($_POST['dump_download'])) ? 'true' : 'false'; |
---|
| 290 | |
---|
[12239] | 291 | if(UAM_dump($dump_download) and $dump_download == 'false') |
---|
[10342] | 292 | { |
---|
| 293 | array_push($page['infos'], l10n('UAM_Dump_OK')); |
---|
| 294 | } |
---|
| 295 | else |
---|
| 296 | { |
---|
| 297 | array_push($page['errors'], l10n('UAM_Dump_NOK')); |
---|
| 298 | } |
---|
| 299 | } |
---|
[5056] | 300 | |
---|
[12275] | 301 | // Restoring UAM tables and configuration settings |
---|
| 302 | // ----------------------------------------------- |
---|
| 303 | if (isset($_POST['restore'])) |
---|
| 304 | { |
---|
| 305 | $Backup_File = UAM_PATH.'/include/backup/UAM_dbbackup.sql'; |
---|
| 306 | |
---|
[12314] | 307 | if (file_exists($Backup_File) and $file = file($Backup_File, FILE_IGNORE_NEW_LINES) and !empty($file)) |
---|
[12275] | 308 | { |
---|
[12314] | 309 | // Check backup file version |
---|
| 310 | // ------------------------- |
---|
| 311 | if ($file[0] == "-- ".$version." --") |
---|
[12275] | 312 | { |
---|
[12314] | 313 | $restore = UAM_Restore_backup_file(); |
---|
| 314 | if(empty($restore)) |
---|
| 315 | { |
---|
| 316 | array_push($page['infos'], l10n('UAM_Restoration_OK')); |
---|
| 317 | } |
---|
| 318 | else |
---|
| 319 | { |
---|
| 320 | array_push($page['errors'], l10n('UAM_Restoration_NOK')); |
---|
| 321 | } |
---|
[12275] | 322 | } |
---|
[12314] | 323 | else array_push($page['errors'], l10n('UAM_Bad_version_backup')); |
---|
[12275] | 324 | } |
---|
| 325 | else |
---|
| 326 | { |
---|
| 327 | array_push($page['errors'], l10n('UAM_No_Backup_File')); |
---|
| 328 | } |
---|
| 329 | } |
---|
| 330 | |
---|
[12271] | 331 | // Testing password enforcement |
---|
| 332 | // ---------------------------- |
---|
[8841] | 333 | if (isset($_POST['PasswordTest']) and isset($_POST['UAM_Password_Test']) and !empty($_POST['UAM_Password_Test'])) |
---|
[5056] | 334 | { |
---|
| 335 | $UAM_Password_Test_Score = testpassword($_POST['UAM_Password_Test']); |
---|
| 336 | } |
---|
[8841] | 337 | else if (isset($_POST['PasswordTest']) and empty($_POST['UAM_Password_Test'])) |
---|
[5056] | 338 | { |
---|
[9177] | 339 | array_push($page['errors'], l10n('UAM_reg_err_login3')); |
---|
[5056] | 340 | } |
---|
| 341 | |
---|
[5181] | 342 | $conf_UAM = unserialize($conf['UserAdvManager']); |
---|
[5056] | 343 | |
---|
[12271] | 344 | // Group setting for unvalidated, validated users and downgrade group |
---|
| 345 | // ------------------------------------------------------------------ |
---|
[5056] | 346 | $groups[-1] = '---------'; |
---|
| 347 | $No_Valid = -1; |
---|
| 348 | $Valid = -1; |
---|
[8065] | 349 | $Downgrade = -1; |
---|
[5056] | 350 | |
---|
[12271] | 351 | // Get groups list in database |
---|
| 352 | // --------------------------- |
---|
[5056] | 353 | $query = ' |
---|
| 354 | SELECT id, name |
---|
[20592] | 355 | FROM '.GROUPS_TABLE.' |
---|
[5056] | 356 | ORDER BY name ASC |
---|
| 357 | ;'; |
---|
| 358 | |
---|
| 359 | $result = pwg_query($query); |
---|
| 360 | |
---|
[5633] | 361 | while ($row = pwg_db_fetch_assoc($result)) |
---|
[5056] | 362 | { |
---|
| 363 | $groups[$row['id']] = $row['name']; |
---|
[7955] | 364 | //configuration value for unvalidated users |
---|
[6354] | 365 | if (isset($conf_UAM[2]) and $conf_UAM[2] == $row['id']) |
---|
[5056] | 366 | { |
---|
[20592] | 367 | $No_Valid = $row['id']; |
---|
| 368 | } |
---|
[7955] | 369 | //configuration value for validated users |
---|
[6354] | 370 | if (isset($conf_UAM[3]) and $conf_UAM[3] == $row['id']) |
---|
[20592] | 371 | { |
---|
| 372 | $Valid = $row['id']; |
---|
| 373 | } |
---|
[8065] | 374 | //configuration value for downgrade users |
---|
[11018] | 375 | if (isset($conf_UAM[25]) and $conf_UAM[25] == $row['id']) |
---|
[20592] | 376 | { |
---|
| 377 | $Downgrade = $row['id']; |
---|
| 378 | } |
---|
[5056] | 379 | } |
---|
| 380 | |
---|
[12271] | 381 | // Template initialization for unvalidated users group |
---|
| 382 | // --------------------------------------------------- |
---|
[5056] | 383 | $template->assign( |
---|
[20592] | 384 | 'No_Confirm_Group', |
---|
| 385 | array( |
---|
| 386 | 'group_options'=> $groups, |
---|
| 387 | 'group_selected' => $No_Valid |
---|
| 388 | ) |
---|
| 389 | ); |
---|
[12271] | 390 | |
---|
| 391 | // Template initialization for validated users group |
---|
| 392 | // ------------------------------------------------- |
---|
[5056] | 393 | $template->assign( |
---|
[20592] | 394 | 'Validated_Group', |
---|
| 395 | array( |
---|
| 396 | 'group_options'=> $groups, |
---|
| 397 | 'group_selected' => $Valid |
---|
| 398 | ) |
---|
| 399 | ); |
---|
[12271] | 400 | |
---|
| 401 | // Template initialization for downgrade group |
---|
| 402 | // ------------------------------------------- |
---|
[8065] | 403 | $template->assign( |
---|
| 404 | 'Downgrade_Group', |
---|
[20592] | 405 | array( |
---|
| 406 | 'group_options'=> $groups, |
---|
| 407 | 'group_selected' => $Downgrade |
---|
| 408 | ) |
---|
[8065] | 409 | ); |
---|
[5056] | 410 | |
---|
[12271] | 411 | // Status setting for unvalidated, validated users and downgrade status |
---|
| 412 | // -------------------------------------------------------------------- |
---|
[5056] | 413 | $status_options[-1] = '------------'; |
---|
| 414 | $No_Valid_Status = -1; |
---|
| 415 | $Valid_Status = -1; |
---|
[8065] | 416 | $Downgrade_Status = -1; |
---|
[5056] | 417 | |
---|
[12271] | 418 | // Get unvalidate status values |
---|
| 419 | // ---------------------------- |
---|
[5056] | 420 | foreach (get_enums(USER_INFOS_TABLE, 'status') as $status) |
---|
| 421 | { |
---|
| 422 | $status_options[$status] = l10n('user_status_'.$status); |
---|
[11018] | 423 | if (isset($conf_UAM[7]) and $conf_UAM[7] == $status) |
---|
[5056] | 424 | { |
---|
| 425 | $No_Valid_Status = $status; |
---|
| 426 | } |
---|
| 427 | |
---|
[12271] | 428 | // Template initialization for unvalidated users status |
---|
| 429 | // ---------------------------------------------------- |
---|
| 430 | $template->assign( |
---|
[20592] | 431 | 'No_Confirm_Status', |
---|
| 432 | array( |
---|
| 433 | 'Status_options' => $status_options, |
---|
| 434 | 'Status_selected' => $No_Valid_Status |
---|
| 435 | ) |
---|
| 436 | ); |
---|
[5056] | 437 | } |
---|
| 438 | |
---|
[12271] | 439 | // Get validate status values |
---|
| 440 | // -------------------------- |
---|
[5056] | 441 | foreach (get_enums(USER_INFOS_TABLE, 'status') as $status) |
---|
[20592] | 442 | { |
---|
| 443 | $status_options[$status] = l10n('user_status_'.$status); |
---|
| 444 | if (isset($conf_UAM[4]) and $conf_UAM[4] == $status) |
---|
| 445 | { |
---|
| 446 | $Valid_Status = $status; |
---|
| 447 | } |
---|
[5056] | 448 | |
---|
[12271] | 449 | // Template initialization for validated users status |
---|
| 450 | // -------------------------------------------------- |
---|
| 451 | $template->assign( |
---|
[20592] | 452 | 'Confirm_Status', |
---|
| 453 | array( |
---|
| 454 | 'Status_options' => $status_options, |
---|
| 455 | 'Status_selected' => $Valid_Status |
---|
| 456 | ) |
---|
| 457 | ); |
---|
| 458 | } |
---|
[5056] | 459 | |
---|
[12271] | 460 | // Get downgrade status values |
---|
| 461 | // --------------------------- |
---|
[8065] | 462 | foreach (get_enums(USER_INFOS_TABLE, 'status') as $status) |
---|
| 463 | { |
---|
[20592] | 464 | $status_options[$status] = l10n('user_status_'.$status); |
---|
| 465 | if (isset($conf_UAM[26]) and $conf_UAM[26] == $status) |
---|
| 466 | { |
---|
| 467 | $Downgrade_Status = $status; |
---|
| 468 | } |
---|
[8065] | 469 | |
---|
[12271] | 470 | // Template initialization for validated users status |
---|
| 471 | // -------------------------------------------------- |
---|
| 472 | $template->assign( |
---|
[20592] | 473 | 'Downgrade_Status', |
---|
| 474 | array( |
---|
| 475 | 'Status_options' => $status_options, |
---|
| 476 | 'Status_selected' => $Downgrade_Status |
---|
| 477 | ) |
---|
| 478 | ); |
---|
| 479 | } |
---|
[8065] | 480 | |
---|
[12189] | 481 | |
---|
[12271] | 482 | // Level setting for unvalidated, validated users and downgrade level |
---|
| 483 | // ------------------------------------------------------------------ |
---|
[12189] | 484 | $level_options[-1] = '------------'; |
---|
| 485 | $No_Valid_Level = -1; |
---|
| 486 | $Valid_Level = -1; |
---|
| 487 | $Downgrade_Level = -1; |
---|
| 488 | |
---|
| 489 | // Get unvalidated privacy levels values |
---|
[12271] | 490 | // ------------------------------------- |
---|
[12189] | 491 | foreach ($conf['available_permission_levels'] as $level) |
---|
| 492 | { |
---|
[20592] | 493 | $level_options[$level] = l10n(sprintf('Level %d', $level)); |
---|
| 494 | if (isset($conf_UAM[35]) and $conf_UAM[35] == $level) |
---|
| 495 | { |
---|
| 496 | $No_Valid_Level = $level; |
---|
| 497 | } |
---|
[12271] | 498 | |
---|
| 499 | // Template initialization for unvalidated users level |
---|
| 500 | // --------------------------------------------------- |
---|
| 501 | $template->assign( |
---|
[20592] | 502 | 'No_Valid_Level', |
---|
| 503 | array( |
---|
| 504 | 'Level_options' => $level_options, |
---|
| 505 | 'Level_selected' => $No_Valid_Level |
---|
| 506 | ) |
---|
| 507 | ); |
---|
[12189] | 508 | } |
---|
| 509 | |
---|
| 510 | // Get validated privacy levels values |
---|
[12271] | 511 | // ----------------------------------- |
---|
[12189] | 512 | foreach ($conf['available_permission_levels'] as $level) |
---|
| 513 | { |
---|
[20592] | 514 | $level_options[$level] = l10n(sprintf('Level %d', $level)); |
---|
| 515 | if (isset($conf_UAM[36]) and $conf_UAM[36] == $level) |
---|
| 516 | { |
---|
| 517 | $Valid_Level = $level; |
---|
| 518 | } |
---|
[12271] | 519 | |
---|
| 520 | // Template initialization for unvalidated users level |
---|
| 521 | // --------------------------------------------------- |
---|
| 522 | $template->assign( |
---|
[20592] | 523 | 'Valid_Level', |
---|
| 524 | array( |
---|
| 525 | 'Level_options' => $level_options, |
---|
| 526 | 'Level_selected' => $Valid_Level |
---|
| 527 | ) |
---|
| 528 | ); |
---|
[12189] | 529 | } |
---|
| 530 | |
---|
| 531 | // Get downgrade privacy levels values |
---|
[12271] | 532 | // ----------------------------------- |
---|
[12189] | 533 | foreach ($conf['available_permission_levels'] as $level) |
---|
| 534 | { |
---|
[20592] | 535 | $level_options[$level] = l10n(sprintf('Level %d', $level)); |
---|
| 536 | if (isset($conf_UAM[37]) and $conf_UAM[37] == $level) |
---|
| 537 | { |
---|
| 538 | $Downgrade_Level = $level; |
---|
| 539 | } |
---|
[12271] | 540 | |
---|
| 541 | // Template initialization for unvalidated users level |
---|
| 542 | // --------------------------------------------------- |
---|
| 543 | $template->assign( |
---|
[20592] | 544 | 'Downgrade_Level', |
---|
| 545 | array( |
---|
| 546 | 'Level_options' => $level_options, |
---|
| 547 | 'Level_selected' => $Downgrade_Level |
---|
| 548 | ) |
---|
| 549 | ); |
---|
[12189] | 550 | } |
---|
| 551 | |
---|
[12689] | 552 | // Check if emails are mandatory for registrations (needed for email exclusion option) |
---|
| 553 | // ----------------------------------------------------------------------------------- |
---|
| 554 | if (!$conf['obligatory_user_mail_address']) |
---|
| 555 | { |
---|
| 556 | $UAM_Email_Mandatory_Check = true; |
---|
| 557 | } |
---|
| 558 | |
---|
[12271] | 559 | // Save last opened paragraph in configuration tab |
---|
| 560 | // ----------------------------------------------- |
---|
[5056] | 561 | $nb_para=(isset($_POST["nb_para"])) ? $_POST["nb_para"]:""; |
---|
| 562 | $nb_para2=(isset($_POST["nb_para2"])) ? $_POST["nb_para2"]:""; |
---|
| 563 | |
---|
[5181] | 564 | $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']); |
---|
[7955] | 565 | |
---|
[12271] | 566 | // ------------------------------------------ |
---|
[7955] | 567 | // Template initialization for forms and data |
---|
[12271] | 568 | // ------------------------------------------ |
---|
[10359] | 569 | $themeconf=$template->get_template_vars('themeconf'); |
---|
| 570 | $UAM_theme=$themeconf['id']; |
---|
| 571 | |
---|
[5056] | 572 | $template->assign( |
---|
[20592] | 573 | array( |
---|
[17918] | 574 | 'nb_para' => $nb_para, |
---|
[20592] | 575 | 'nb_para2' => $nb_para2, |
---|
| 576 | 'UAM_VERSION' => $version, |
---|
| 577 | 'UAM_PATH' => UAM_PATH, |
---|
| 578 | 'UAM_DUMP_DOWNLOAD' => $dump_download, |
---|
| 579 | 'UAM_THEME' => $UAM_theme, |
---|
[17918] | 580 | 'UAM_MAIL_INFO_TRUE' => $conf_UAM[0]=='true' ? 'checked="checked"' : '' , |
---|
| 581 | 'UAM_MAIL_INFO_FALSE' => $conf_UAM[0]=='false' ? 'checked="checked"' : '' , |
---|
| 582 | 'UAM_MAILINFO_TEXT' => $conf_UAM[8], |
---|
| 583 | 'UAM_USERNAME_CHAR_TRUE' => $conf_UAM[5]=='true' ? 'checked="checked"' : '' , |
---|
| 584 | 'UAM_USERNAME_CHAR_FALSE' => $conf_UAM[5]=='false' ? 'checked="checked"' : '' , |
---|
| 585 | 'UAM_USERNAME_CHAR_LIST' => $conf_UAM[6], |
---|
| 586 | 'UAM_CONFIRM_MAIL_TRUE' => $conf_UAM[1]=='true' ? 'checked="checked"' : '' , |
---|
| 587 | 'UAM_CONFIRM_MAIL_FALSE' => $conf_UAM[1]=='false' ? 'checked="checked"' : '' , |
---|
[20592] | 588 | 'UAM_CONFIRM_MAIL_LOCAL' => $conf_UAM[1]=='local' ? 'checked="checked"' : '' , |
---|
[17918] | 589 | 'UAM_CONFIRMMAIL_TEXT' => $conf_UAM[9], |
---|
| 590 | 'UAM_No_Confirm_Group' => $conf_UAM[2], |
---|
| 591 | 'UAM_Validated_Group' => $conf_UAM[3], |
---|
| 592 | 'UAM_No_Confirm_Status' => $conf_UAM[7], |
---|
| 593 | 'UAM_Validated_Status' => $conf_UAM[4], |
---|
| 594 | 'UAM_MAILEXCLUSION_TRUE' => $conf_UAM[10]=='true' ? 'checked="checked"' : '' , |
---|
| 595 | 'UAM_MAILEXCLUSION_FALSE' => $conf_UAM[10]=='false' ? 'checked="checked"' : '' , |
---|
| 596 | 'UAM_MAILEXCLUSION_LIST' => $conf_UAM[11], |
---|
| 597 | 'UAM_PASSWORDENF_TRUE' => $conf_UAM[12]=='true' ? 'checked="checked"' : '' , |
---|
| 598 | 'UAM_PASSWORDENF_FALSE' => $conf_UAM[12]=='false' ? 'checked="checked"' : '' , |
---|
| 599 | 'UAM_PASSWORD_SCORE' => $conf_UAM[13], |
---|
[20592] | 600 | 'UAM_ADMINPASSWENF_TRUE' => $conf_UAM[14]=='true' ? 'checked="checked"' : '' , |
---|
[17918] | 601 | 'UAM_ADMINPASSWENF_FALSE' => $conf_UAM[14]=='false' ? 'checked="checked"' : '' , |
---|
[20592] | 602 | 'UAM_GHOSTRACKER_TRUE' => $conf_UAM[15]=='true' ? 'checked="checked"' : '' , |
---|
[17918] | 603 | 'UAM_GHOSTRACKER_FALSE' => $conf_UAM[15]=='false' ? 'checked="checked"' : '' , |
---|
[20592] | 604 | 'UAM_GHOSTRACKER_DAYLIMIT' => $conf_UAM[16], |
---|
| 605 | 'UAM_GHOSTRACKER_REMINDERTEXT' => $conf_UAM[17], |
---|
| 606 | 'UAM_ADDLASTVISIT_TRUE' => $conf_UAM[18]=='true' ? 'checked="checked"' : '' , |
---|
| 607 | 'UAM_ADDLASTVISIT_FALSE' => $conf_UAM[18]=='false' ? 'checked="checked"' : '' , |
---|
| 608 | 'UAM_ADMINCONFMAIL_TRUE' => $conf_UAM[19]=='true' ? 'checked="checked"' : '' , |
---|
| 609 | 'UAM_ADMINCONFMAIL_FALSE' => $conf_UAM[19]=='false' ? 'checked="checked"' : '' , |
---|
| 610 | 'UAM_REDIRTOPROFILE_TRUE' => $conf_UAM[20]=='true' ? 'checked="checked"' : '' , |
---|
| 611 | 'UAM_REDIRTOPROFILE_FALSE' => $conf_UAM[20]=='false' ? 'checked="checked"' : '' , |
---|
| 612 | 'UAM_GTAUTO_TRUE' => $conf_UAM[21]=='true' ? 'checked="checked"' : '' , |
---|
| 613 | 'UAM_GTAUTO_FALSE' => $conf_UAM[21]=='false' ? 'checked="checked"' : '' , |
---|
| 614 | 'UAM_GTAUTOMAIL_TRUE' => $conf_UAM[22]=='true' ? 'checked="checked"' : '' , |
---|
| 615 | 'UAM_GTAUTOMAIL_FALSE' => $conf_UAM[22]=='false' ? 'checked="checked"' : '' , |
---|
| 616 | 'UAM_GTAUTODEL_TEXT' => $conf_UAM[23], |
---|
| 617 | 'UAM_GTAUTOMAILTEXT' => $conf_UAM[24], |
---|
[17918] | 618 | 'UAM_Downgrade_Group' => $conf_UAM[25], |
---|
| 619 | 'UAM_Downgrade_Status' => $conf_UAM[26], |
---|
[20592] | 620 | 'UAM_ADMINVALIDATIONMAIL_TEXT' => $conf_UAM[27], |
---|
| 621 | 'UAM_CUSTOMPASSWRETR_TRUE' => $conf_UAM[28]=='true' ? 'checked="checked"' : '' , |
---|
| 622 | 'UAM_CUSTOMPASSWRETR_FALSE' => $conf_UAM[28]=='false' ? 'checked="checked"' : '' , |
---|
| 623 | 'UAM_CUSTOMPASSWRETR_TEXT' => $conf_UAM[29], |
---|
| 624 | 'UAM_USRAUTO_TRUE' => $conf_UAM[30]=='true' ? 'checked="checked"' : '' , |
---|
| 625 | 'UAM_USRAUTO_FALSE' => $conf_UAM[30]=='false' ? 'checked="checked"' : '' , |
---|
| 626 | 'UAM_USRAUTODEL_TEXT' => $conf_UAM[31], |
---|
| 627 | 'UAM_USRAUTOMAIL_TRUE' => $conf_UAM[32]=='true' ? 'checked="checked"' : '' , |
---|
| 628 | 'UAM_USRAUTOMAIL_FALSE' => $conf_UAM[32]=='false' ? 'checked="checked"' : '' , |
---|
| 629 | 'UAM_STUFFS_TRUE' => $conf_UAM[33]=='true' ? 'checked="checked"' : '' , |
---|
| 630 | 'UAM_STUFFS_FALSE' => $conf_UAM[33]=='false' ? 'checked="checked"' : '' , |
---|
| 631 | 'UAM_HIDEPASSW_TRUE' => $conf_UAM[34]=='true' ? 'checked="checked"' : '' , |
---|
| 632 | 'UAM_HIDEPASSW_FALSE' => $conf_UAM[34]=='false' ? 'checked="checked"' : '' , |
---|
[17918] | 633 | 'UAM_NO_VALID_LEVEL' => $conf_UAM[35], |
---|
| 634 | 'UAM_VALID_LEVEL' => $conf_UAM[36], |
---|
[20592] | 635 | 'UAM_DOWNGRADE_LEVEL' => $conf_UAM[37], |
---|
| 636 | 'UAM_PWDRESET_TRUE' => $conf_UAM[38]=='true' ? 'checked="checked"' : '' , |
---|
| 637 | 'UAM_PWDRESET_FALSE' => $conf_UAM[38]=='false' ? 'checked="checked"' : '' , |
---|
| 638 | 'UAM_REJECTCONNECT_TRUE' => $conf_UAM[39]=='true' ? 'checked="checked"' : '' , |
---|
| 639 | 'UAM_REJECTCONNECT_FALSE' => $conf_UAM[39]=='false' ? 'checked="checked"' : '' , |
---|
| 640 | 'UAM_REJECTCONNECT_TEXT' => $conf_UAM[40], |
---|
| 641 | 'UAM_CONFIRMMAIL_SUBJECT' => $conf_UAM[41], |
---|
| 642 | 'UAM_CONFIRMMAIL_REMAIL_SUBJECT' => $conf_UAM[42], |
---|
| 643 | 'UAM_INFOMAIL_SUBJECT' => $conf_UAM[43], |
---|
| 644 | 'UAM_GTAUTOMAIL_SUBJECT' => $conf_UAM[44], |
---|
| 645 | 'UAM_GTREMINDER_SUBJECT' => $conf_UAM[45], |
---|
| 646 | 'UAM_ADMINVALIDATIONMAIL_SUBJECT' => $conf_UAM[46], |
---|
[17918] | 647 | 'UAM_PASSWORD_TEST_SCORE' => $UAM_Password_Test_Score, |
---|
[20592] | 648 | 'UAM_ERROR_REPORTS1' => $UAM_Exclusionlist_Error, |
---|
| 649 | 'UAM_ERROR_REPORTS2' => $UAM_Illegal_Flag_Error1, |
---|
| 650 | 'UAM_ERROR_REPORTS3' => $UAM_Illegal_Flag_Error2, |
---|
| 651 | 'UAM_ERROR_REPORTS4' => $UAM_Illegal_Flag_Error3, |
---|
| 652 | 'UAM_EMAIL_MANDATORY' => $UAM_Email_Mandatory_Check, |
---|
| 653 | 'UAM_CONFIRMMAIL_TIMEOUT_TRUE' => $conf_UAM_ConfirmMail[0]=='true' ? 'checked="checked"' : '' , |
---|
[17918] | 654 | 'UAM_CONFIRMMAIL_TIMEOUT_FALSE' => $conf_UAM_ConfirmMail[0]=='false' ? 'checked="checked"' : '' , |
---|
[20592] | 655 | 'UAM_CONFIRMMAIL_DELAY' => $conf_UAM_ConfirmMail[1], |
---|
| 656 | 'UAM_CONFIRMMAIL_REMAIL_TRUE' => $conf_UAM_ConfirmMail[3]=='true' ? 'checked="checked"' : '', |
---|
| 657 | 'UAM_CONFIRMMAIL_REMAIL_FALSE' => $conf_UAM_ConfirmMail[3]=='false' ? 'checked="checked"' : '', |
---|
| 658 | 'UAM_CONFIRMMAIL_REMAIL_TXT1' => $conf_UAM_ConfirmMail[2], |
---|
| 659 | 'UAM_CONFIRMMAIL_REMAIL_TXT2' => $conf_UAM_ConfirmMail[4], |
---|
| 660 | 'UAM_CONFIRMMAIL_CUSTOM_TXT1' => $conf_UAM_ConfirmMail[5], |
---|
| 661 | 'UAM_CONFIRMMAIL_CUSTOM_TXT2' => $conf_UAM_ConfirmMail[6], |
---|
[5056] | 662 | ) |
---|
| 663 | ); |
---|
| 664 | |
---|
| 665 | if (isset($_POST['audit'])) |
---|
[20592] | 666 | { |
---|
| 667 | $msg_error1 = ''; |
---|
[5056] | 668 | |
---|
[12271] | 669 | // Username without forbidden keys |
---|
| 670 | // ------------------------------- |
---|
[11018] | 671 | if ( isset($conf_UAM[5]) and $conf_UAM[5] == 'true' ) |
---|
[20592] | 672 | { |
---|
| 673 | $query = ' |
---|
[17918] | 674 | SELECT '.$conf['user_fields']['username'].', '.$conf['user_fields']['email'].' |
---|
[20592] | 675 | FROM '.USERS_TABLE.' |
---|
[17918] | 676 | ;'; |
---|
[5056] | 677 | |
---|
[20592] | 678 | $result = pwg_query($query); |
---|
| 679 | |
---|
| 680 | while($row = pwg_db_fetch_assoc($result)) |
---|
| 681 | { |
---|
| 682 | if (!ValidateUsername(stripslashes($row['username']))) |
---|
| 683 | $msg_error1 .= (($msg_error1 <> '') ? '<br>' : '').l10n('UAM_Err_audit_username_char').stripslashes($row['username']); |
---|
| 684 | } |
---|
| 685 | } |
---|
| 686 | |
---|
| 687 | $msg_error2 = ''; |
---|
[5056] | 688 | |
---|
[12271] | 689 | // Email without forbidden domain |
---|
| 690 | // ------------------------------ |
---|
[11018] | 691 | if ( isset($conf_UAM[10]) and $conf_UAM[10] == 'true' ) |
---|
[20592] | 692 | { |
---|
| 693 | $query = ' |
---|
[17918] | 694 | SELECT '.$conf['user_fields']['username'].', '.$conf['user_fields']['email'].' |
---|
[20592] | 695 | FROM '.USERS_TABLE.' |
---|
[17918] | 696 | ;'; |
---|
[20592] | 697 | |
---|
| 698 | $result = pwg_query($query); |
---|
| 699 | |
---|
| 700 | while($row = pwg_db_fetch_assoc($result)) |
---|
| 701 | { |
---|
| 702 | $conf_MailExclusion = preg_split("/[\s,]+/",$conf_UAM[11]); |
---|
| 703 | for ($i = 0 ; $i < count($conf_MailExclusion) ; $i++) |
---|
| 704 | { |
---|
| 705 | $pattern = '/'.$conf_MailExclusion[$i].'/'; |
---|
| 706 | if (preg_match($pattern, $row['mail_address'])) |
---|
| 707 | { |
---|
| 708 | $msg_error2 .= (($msg_error2 <> '') ? '<br>' : '').l10n('UAM_Err_audit_email_forbidden').stripslashes($row['username']).' ('.$row['mail_address'].')'; |
---|
| 709 | } |
---|
| 710 | } |
---|
| 711 | } |
---|
| 712 | } |
---|
| 713 | |
---|
| 714 | if ($msg_error1 <> '') |
---|
| 715 | $errors[] = $msg_error1.'<br><br>'; |
---|
| 716 | |
---|
| 717 | if ($msg_error2 <> '') |
---|
| 718 | $errors[] = $msg_error2.'<br><br>'; |
---|
| 719 | |
---|
| 720 | if ($msg_error1 <> '' or $msg_error2 <> '') |
---|
| 721 | array_push($page['errors'], l10n('UAM_Err_audit_advise')); |
---|
| 722 | else |
---|
| 723 | array_push($page['infos'], l10n('UAM_audit_ok')); |
---|
[17918] | 724 | } |
---|
[5056] | 725 | |
---|
| 726 | |
---|
| 727 | // +-----------------------------------------------------------------------+ |
---|
| 728 | // | errors display | |
---|
| 729 | // +-----------------------------------------------------------------------+ |
---|
[20592] | 730 | if (isset ($errors) and count($errors) != 0) |
---|
[5056] | 731 | { |
---|
[20592] | 732 | $template->assign('errors',array()); |
---|
| 733 | foreach ($errors as $error) |
---|
| 734 | { |
---|
| 735 | array_push($page['errors'], $error); |
---|
| 736 | } |
---|
| 737 | } |
---|
[5056] | 738 | |
---|
| 739 | // +-----------------------------------------------------------------------+ |
---|
| 740 | // | templates display | |
---|
| 741 | // +-----------------------------------------------------------------------+ |
---|
[5593] | 742 | $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/template/global.tpl'); |
---|
[5056] | 743 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
| 744 | |
---|
| 745 | break; |
---|
| 746 | |
---|
| 747 | |
---|
| 748 | // ************************************************************************* |
---|
| 749 | // +-----------------------------------------------------------------------+ |
---|
| 750 | // | Users list page | |
---|
| 751 | // +-----------------------------------------------------------------------+ |
---|
| 752 | // ************************************************************************* |
---|
| 753 | case 'userlist': |
---|
| 754 | |
---|
[5181] | 755 | $conf_UAM = unserialize($conf['UserAdvManager']); |
---|
[5056] | 756 | |
---|
[11018] | 757 | if (isset($conf_UAM[18]) and $conf_UAM[18]=='true') |
---|
[5056] | 758 | { |
---|
| 759 | // +-----------------------------------------------------------------------+ |
---|
| 760 | // | initialization | |
---|
| 761 | // +-----------------------------------------------------------------------+ |
---|
| 762 | |
---|
[20592] | 763 | if (!defined('PHPWG_ROOT_PATH')) |
---|
| 764 | { |
---|
| 765 | die('Hacking attempt!'); |
---|
| 766 | } |
---|
[5056] | 767 | |
---|
[20592] | 768 | include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); |
---|
[5056] | 769 | |
---|
| 770 | // +-----------------------------------------------------------------------+ |
---|
| 771 | // | Check Access and exit when user status is not ok | |
---|
| 772 | // +-----------------------------------------------------------------------+ |
---|
[20592] | 773 | check_status(ACCESS_ADMINISTRATOR); |
---|
[5056] | 774 | |
---|
| 775 | |
---|
| 776 | // +-----------------------------------------------------------------------+ |
---|
| 777 | // | user list | |
---|
| 778 | // +-----------------------------------------------------------------------+ |
---|
| 779 | |
---|
[20592] | 780 | $page['filtered_users'] = get_user_list(); |
---|
[5056] | 781 | |
---|
| 782 | // +-----------------------------------------------------------------------+ |
---|
| 783 | // | user list | |
---|
| 784 | // +-----------------------------------------------------------------------+ |
---|
| 785 | |
---|
[20592] | 786 | $visible_user_list = array(); |
---|
[17918] | 787 | foreach ($page['filtered_users'] as $num => $local_user) |
---|
| 788 | { |
---|
[20592] | 789 | $visible_user_list[] = $local_user; |
---|
| 790 | } |
---|
[5056] | 791 | |
---|
[20592] | 792 | foreach ($visible_user_list as $local_user) |
---|
| 793 | { |
---|
| 794 | // dates formating and compare |
---|
[17918] | 795 | // --------------------------- |
---|
| 796 | $today = date("d-m-Y"); // Get today's date |
---|
| 797 | list($day, $month, $year) = explode('-', $today); // explode date of today |
---|
| 798 | $daytimestamp = mktime(0, 0, 0, $month, $day, $year);// Generate UNIX timestamp |
---|
[5056] | 799 | |
---|
[17918] | 800 | list($regdate, $regtime) = explode(' ', $local_user['lastvisit']); // Explode date and time from registration date |
---|
| 801 | list($regyear, $regmonth, $regday) = explode('-', $regdate); // Explode date from registration date |
---|
| 802 | $regtimestamp = mktime(0, 0, 0, $regmonth, $regday, $regyear);// Generate UNIX timestamp |
---|
| 803 | |
---|
[20592] | 804 | $deltasecs = $daytimestamp - $regtimestamp;// Compare the 2 UNIX timestamps |
---|
[17918] | 805 | $deltadays = floor($deltasecs / 86400);// Convert result from seconds to days |
---|
| 806 | |
---|
[20592] | 807 | if (isset($conf_UAM[15]) and $conf_UAM[15]=='true' and !empty($conf_UAM[16])) |
---|
[17918] | 808 | { |
---|
[20592] | 809 | if ($deltadays <= ($conf_UAM[16]/2)) |
---|
[17918] | 810 | { |
---|
[20592] | 811 | $display = 'green'; |
---|
[17918] | 812 | } |
---|
| 813 | |
---|
[20592] | 814 | if (($deltadays > ($conf_UAM[16]/2)) and ($deltadays < $conf_UAM[16])) |
---|
[17918] | 815 | { |
---|
[20592] | 816 | $display = 'orange'; |
---|
[17918] | 817 | } |
---|
| 818 | |
---|
| 819 | if ($deltadays >= $conf_UAM[16]) |
---|
| 820 | { |
---|
[20592] | 821 | $display = 'red'; |
---|
[17918] | 822 | } |
---|
[20592] | 823 | } |
---|
[17918] | 824 | else $display = ''; |
---|
| 825 | |
---|
| 826 | // Template initialization |
---|
| 827 | // ----------------------- |
---|
| 828 | $template->append( |
---|
| 829 | 'users', |
---|
| 830 | array( |
---|
| 831 | 'ID' => $local_user['id'], |
---|
[20592] | 832 | 'USERNAME' => stripslashes($local_user['username']), |
---|
| 833 | 'EMAIL' => get_email_address_as_display_text($local_user['email']), |
---|
| 834 | 'LASTVISIT' => $local_user['lastvisit'], |
---|
| 835 | 'DAYS' => $deltadays, |
---|
| 836 | 'DISPLAY' => $display, |
---|
| 837 | ) |
---|
| 838 | ); |
---|
| 839 | } |
---|
[17918] | 840 | |
---|
[20592] | 841 | // Plugin version inserted |
---|
[17918] | 842 | // ----------------------- |
---|
| 843 | $template->assign( |
---|
| 844 | array( |
---|
| 845 | 'UAM_VERSION' => $version, |
---|
[20592] | 846 | 'UAM_PATH' => UAM_PATH, |
---|
| 847 | ) |
---|
| 848 | ); |
---|
| 849 | |
---|
[5056] | 850 | // +-----------------------------------------------------------------------+ |
---|
| 851 | // | errors display | |
---|
| 852 | // +-----------------------------------------------------------------------+ |
---|
[20592] | 853 | if ( isset ($errors) and count($errors) != 0) |
---|
| 854 | { |
---|
| 855 | $template->assign('errors',array()); |
---|
| 856 | foreach ($errors as $error) |
---|
| 857 | { |
---|
| 858 | array_push($page['errors'], $error); |
---|
| 859 | } |
---|
| 860 | } |
---|
[5056] | 861 | |
---|
| 862 | // +-----------------------------------------------------------------------+ |
---|
| 863 | // | templates display | |
---|
| 864 | // +-----------------------------------------------------------------------+ |
---|
[20592] | 865 | $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/template/userlist.tpl'); |
---|
| 866 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
| 867 | } |
---|
| 868 | else |
---|
| 869 | { |
---|
| 870 | array_push($page['errors'], l10n('UAM_Err_Userlist_Settings')); |
---|
| 871 | } |
---|
[5056] | 872 | |
---|
[17918] | 873 | break; |
---|
[5056] | 874 | |
---|
[17918] | 875 | |
---|
[5056] | 876 | // ************************************************************************* |
---|
| 877 | // +-----------------------------------------------------------------------+ |
---|
| 878 | // | Users manager page | |
---|
| 879 | // +-----------------------------------------------------------------------+ |
---|
| 880 | // ************************************************************************* |
---|
| 881 | case 'usermanager': |
---|
| 882 | |
---|
[5181] | 883 | $conf_UAM = unserialize($conf['UserAdvManager']); |
---|
[5056] | 884 | |
---|
[5181] | 885 | $conf_UAM_ConfirmMail = unserialize($conf['UserAdvManager_ConfirmMail']); |
---|
[5056] | 886 | |
---|
[17918] | 887 | if (isset($conf_UAM[1]) and ($conf_UAM[1]=='true' or $conf_UAM[1]=='local')) |
---|
[8072] | 888 | { |
---|
[5056] | 889 | // +-----------------------------------------------------------------------+ |
---|
| 890 | // | initialization | |
---|
| 891 | // +-----------------------------------------------------------------------+ |
---|
| 892 | |
---|
[20592] | 893 | if (!defined('PHPWG_ROOT_PATH')) |
---|
[5056] | 894 | { |
---|
[20592] | 895 | die('Hacking attempt!'); |
---|
[5056] | 896 | } |
---|
[8072] | 897 | |
---|
[5056] | 898 | include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); |
---|
| 899 | |
---|
| 900 | // +-----------------------------------------------------------------------+ |
---|
| 901 | // | Check Access and exit when user status is not ok | |
---|
| 902 | // +-----------------------------------------------------------------------+ |
---|
[20592] | 903 | check_status(ACCESS_ADMINISTRATOR); |
---|
[5056] | 904 | |
---|
| 905 | // +-----------------------------------------------------------------------+ |
---|
| 906 | // | user list | |
---|
| 907 | // +-----------------------------------------------------------------------+ |
---|
| 908 | |
---|
[20592] | 909 | $page['filtered_users'] = get_unvalid_user_list(); |
---|
[5056] | 910 | |
---|
| 911 | // +-----------------------------------------------------------------------+ |
---|
| 912 | // | selected users | |
---|
| 913 | // +-----------------------------------------------------------------------+ |
---|
[20592] | 914 | if (isset($_POST['Del_Selected'])) |
---|
| 915 | { |
---|
| 916 | $collection = array(); |
---|
[5056] | 917 | |
---|
[20592] | 918 | switch ($_POST['target']) |
---|
| 919 | { |
---|
| 920 | case 'all' : |
---|
| 921 | { |
---|
| 922 | foreach($page['filtered_users'] as $local_user) |
---|
| 923 | { |
---|
| 924 | array_push($collection, $local_user['id']); |
---|
| 925 | } |
---|
| 926 | break; |
---|
| 927 | } |
---|
| 928 | case 'selection' : |
---|
| 929 | { |
---|
| 930 | if (isset($_POST['selection'])) |
---|
| 931 | { |
---|
| 932 | $collection = $_POST['selection']; |
---|
| 933 | } |
---|
| 934 | break; |
---|
| 935 | } |
---|
| 936 | } |
---|
[17918] | 937 | |
---|
[20592] | 938 | if (count($collection) == 0) |
---|
| 939 | { |
---|
| 940 | array_push($page['errors'], l10n('Select at least one user')); |
---|
| 941 | } |
---|
| 942 | } |
---|
[5056] | 943 | |
---|
| 944 | // +-----------------------------------------------------------------------+ |
---|
| 945 | // | delete users | |
---|
| 946 | // +-----------------------------------------------------------------------+ |
---|
[20592] | 947 | if (isset($_POST['Del_Selected']) and count($collection) > 0) |
---|
| 948 | { |
---|
| 949 | if (in_array($conf['guest_id'], $collection)) |
---|
| 950 | { |
---|
| 951 | array_push($page['errors'], l10n('Guest cannot be deleted')); |
---|
| 952 | } |
---|
| 953 | if (($conf['guest_id'] != $conf['default_user_id']) and |
---|
| 954 | in_array($conf['default_user_id'], $collection)) |
---|
| 955 | { |
---|
| 956 | array_push($page['errors'], l10n('Default user cannot be deleted')); |
---|
| 957 | } |
---|
| 958 | if (in_array($conf['webmaster_id'], $collection)) |
---|
| 959 | { |
---|
| 960 | array_push($page['errors'], l10n('Webmaster cannot be deleted')); |
---|
| 961 | } |
---|
| 962 | if (in_array($user['id'], $collection)) |
---|
| 963 | { |
---|
| 964 | array_push($page['errors'], l10n('You cannot delete your account')); |
---|
| 965 | } |
---|
[5056] | 966 | |
---|
[20592] | 967 | if (count($page['errors']) == 0) |
---|
| 968 | { |
---|
| 969 | foreach ($collection as $user_id) |
---|
| 970 | { |
---|
| 971 | delete_user($user_id); |
---|
| 972 | } |
---|
| 973 | array_push( |
---|
| 974 | $page['infos'], |
---|
| 975 | l10n_dec( |
---|
| 976 | '%d user deleted', '%d users deleted', |
---|
| 977 | count($collection) |
---|
| 978 | ) |
---|
| 979 | ); |
---|
[5056] | 980 | |
---|
[20592] | 981 | foreach ($page['filtered_users'] as $filter_key => $filter_user) |
---|
| 982 | { |
---|
| 983 | if (in_array($filter_user['id'], $collection)) |
---|
| 984 | { |
---|
| 985 | unset($page['filtered_users'][$filter_key]); |
---|
| 986 | } |
---|
| 987 | } |
---|
| 988 | } |
---|
| 989 | } |
---|
[5056] | 990 | |
---|
| 991 | // +-----------------------------------------------------------------------+ |
---|
| 992 | // | Resend new validation key to users | |
---|
| 993 | // +-----------------------------------------------------------------------+ |
---|
| 994 | // +-----------------------------------------------------------------------+ |
---|
| 995 | // | selected users | |
---|
| 996 | // +-----------------------------------------------------------------------+ |
---|
[20592] | 997 | if (isset($_POST['Mail_With_Key'])) |
---|
| 998 | { |
---|
| 999 | $collection = array(); |
---|
[5056] | 1000 | |
---|
[20592] | 1001 | switch ($_POST['target']) |
---|
| 1002 | { |
---|
| 1003 | case 'all' : |
---|
| 1004 | { |
---|
| 1005 | foreach($page['filtered_users'] as $local_user) |
---|
| 1006 | { |
---|
| 1007 | array_push($collection, $local_user['id']); |
---|
| 1008 | } |
---|
| 1009 | break; |
---|
| 1010 | } |
---|
| 1011 | case 'selection' : |
---|
| 1012 | { |
---|
| 1013 | if (isset($_POST['selection'])) |
---|
| 1014 | { |
---|
| 1015 | $collection = $_POST['selection']; |
---|
| 1016 | } |
---|
| 1017 | break; |
---|
| 1018 | } |
---|
| 1019 | } |
---|
[17918] | 1020 | |
---|
[20592] | 1021 | if (count($collection) == 0) |
---|
| 1022 | { |
---|
| 1023 | array_push($page['errors'], l10n('Select at least one user')); |
---|
| 1024 | } |
---|
| 1025 | } |
---|
[5056] | 1026 | // +-----------------------------------------------------------------------+ |
---|
| 1027 | // | Resend new validation key to users | |
---|
| 1028 | // +-----------------------------------------------------------------------+ |
---|
[20592] | 1029 | if (isset($_POST['Mail_With_Key']) and count($collection) > 0) |
---|
| 1030 | { |
---|
| 1031 | if (in_array($conf['guest_id'], $collection)) |
---|
| 1032 | { |
---|
| 1033 | array_push($page['errors'], l10n('UAM_No_validation_for_Guest')); |
---|
| 1034 | } |
---|
| 1035 | if (($conf['guest_id'] != $conf['default_user_id']) and |
---|
| 1036 | in_array($conf['default_user_id'], $collection)) |
---|
| 1037 | { |
---|
| 1038 | array_push($page['errors'], l10n('UAM_No_validation_for_default_user')); |
---|
| 1039 | } |
---|
| 1040 | if (in_array($conf['webmaster_id'], $collection)) |
---|
| 1041 | { |
---|
| 1042 | array_push($page['errors'], l10n('UAM_No_validation_for_Webmaster')); |
---|
| 1043 | } |
---|
| 1044 | if (in_array($user['id'], $collection)) |
---|
| 1045 | { |
---|
| 1046 | array_push($page['errors'], l10n('UAM_No_validation_for_your_account')); |
---|
| 1047 | } |
---|
[5056] | 1048 | |
---|
[20592] | 1049 | if (count($page['errors']) == 0) |
---|
| 1050 | { |
---|
| 1051 | foreach ($collection as $user_id) |
---|
| 1052 | { |
---|
| 1053 | $typemail = 1; |
---|
| 1054 | $query = ' |
---|
[5056] | 1055 | SELECT id, username, mail_address |
---|
[20592] | 1056 | FROM '.USERS_TABLE.' |
---|
[17918] | 1057 | WHERE id = '.$user_id.' |
---|
| 1058 | ;'; |
---|
[20592] | 1059 | $data = pwg_db_fetch_assoc(pwg_query($query)); |
---|
[5056] | 1060 | |
---|
[20592] | 1061 | ResendMail2User($typemail,$user_id,stripslashes($data['username']),$data['mail_address'],true); |
---|
| 1062 | } |
---|
| 1063 | array_push( |
---|
| 1064 | $page['infos'], |
---|
| 1065 | l10n_dec( |
---|
| 1066 | 'UAM_%d_Mail_With_Key', 'UAM_%d_Mails_With_Key', |
---|
| 1067 | count($collection) |
---|
| 1068 | ) |
---|
| 1069 | ); |
---|
| 1070 | |
---|
| 1071 | $page['filtered_users'] = get_unvalid_user_list(); |
---|
| 1072 | } |
---|
| 1073 | } |
---|
| 1074 | |
---|
[5056] | 1075 | // +-----------------------------------------------------------------------+ |
---|
| 1076 | // | Send reminder without new key to users | |
---|
| 1077 | // +-----------------------------------------------------------------------+ |
---|
| 1078 | // +-----------------------------------------------------------------------+ |
---|
| 1079 | // | selected users | |
---|
| 1080 | // +-----------------------------------------------------------------------+ |
---|
[20592] | 1081 | if (isset($_POST['Mail_Without_Key'])) |
---|
| 1082 | { |
---|
| 1083 | $collection = array(); |
---|
[5056] | 1084 | |
---|
[20592] | 1085 | switch ($_POST['target']) |
---|
| 1086 | { |
---|
| 1087 | case 'all' : |
---|
| 1088 | { |
---|
| 1089 | foreach($page['filtered_users'] as $local_user) |
---|
| 1090 | { |
---|
| 1091 | array_push($collection, $local_user['id']); |
---|
| 1092 | } |
---|
| 1093 | break; |
---|
| 1094 | } |
---|
| 1095 | case 'selection' : |
---|
| 1096 | { |
---|
| 1097 | if (isset($_POST['selection'])) |
---|
| 1098 | { |
---|
| 1099 | $collection = $_POST['selection']; |
---|
| 1100 | } |
---|
| 1101 | break; |
---|
| 1102 | } |
---|
| 1103 | } |
---|
[17918] | 1104 | |
---|
[20592] | 1105 | if (count($collection) == 0) |
---|
| 1106 | { |
---|
| 1107 | array_push($page['errors'], l10n('Select at least one user')); |
---|
| 1108 | } |
---|
| 1109 | } |
---|
[5056] | 1110 | // +-----------------------------------------------------------------------+ |
---|
| 1111 | // | Send reminder without new key to users | |
---|
| 1112 | // +-----------------------------------------------------------------------+ |
---|
[20592] | 1113 | if (isset($_POST['Mail_Without_Key']) and count($collection) > 0) |
---|
| 1114 | { |
---|
| 1115 | if (in_array($conf['guest_id'], $collection)) |
---|
| 1116 | { |
---|
| 1117 | array_push($page['errors'], l10n('UAM_No_validation_for_Guest')); |
---|
| 1118 | } |
---|
| 1119 | if (($conf['guest_id'] != $conf['default_user_id']) and |
---|
| 1120 | in_array($conf['default_user_id'], $collection)) |
---|
| 1121 | { |
---|
| 1122 | array_push($page['errors'], l10n('UAM_No_validation_for_default_user')); |
---|
| 1123 | } |
---|
| 1124 | if (in_array($conf['webmaster_id'], $collection)) |
---|
| 1125 | { |
---|
| 1126 | array_push($page['errors'], l10n('UAM_No_validation_for_Webmaster')); |
---|
| 1127 | } |
---|
| 1128 | if (in_array($user['id'], $collection)) |
---|
| 1129 | { |
---|
| 1130 | array_push($page['errors'], l10n('UAM_No_validation_for_your_account')); |
---|
| 1131 | } |
---|
[5056] | 1132 | |
---|
[20592] | 1133 | if (count($page['errors']) == 0) |
---|
| 1134 | { |
---|
| 1135 | foreach ($collection as $user_id) |
---|
| 1136 | { |
---|
| 1137 | $typemail = 2; |
---|
| 1138 | $query = ' |
---|
[5056] | 1139 | SELECT id, username, mail_address |
---|
[20592] | 1140 | FROM '.USERS_TABLE.' |
---|
[17918] | 1141 | WHERE id = '.$user_id.' |
---|
| 1142 | ;'; |
---|
[5056] | 1143 | |
---|
[20592] | 1144 | $data = pwg_db_fetch_assoc(pwg_query($query)); |
---|
| 1145 | |
---|
| 1146 | ResendMail2User($typemail,$user_id,stripslashes($data['username']),$data['mail_address'],false); |
---|
| 1147 | } |
---|
| 1148 | array_push( |
---|
| 1149 | $page['infos'], |
---|
| 1150 | l10n_dec( |
---|
| 1151 | 'UAM_%d_Reminder_Sent', 'UAM_%d_Reminders_Sent', |
---|
[17918] | 1152 | count($collection) |
---|
[20592] | 1153 | ) |
---|
| 1154 | ); |
---|
[5056] | 1155 | |
---|
[20592] | 1156 | $page['filtered_users'] = get_unvalid_user_list(); |
---|
| 1157 | } |
---|
| 1158 | } |
---|
| 1159 | |
---|
[5056] | 1160 | // +-----------------------------------------------------------------------+ |
---|
[20592] | 1161 | // | Manual validation by admins | |
---|
[5056] | 1162 | // +-----------------------------------------------------------------------+ |
---|
| 1163 | // +-----------------------------------------------------------------------+ |
---|
| 1164 | // | selected users | |
---|
| 1165 | // +-----------------------------------------------------------------------+ |
---|
[20592] | 1166 | if (isset($_POST['Manual_Validation'])) |
---|
| 1167 | { |
---|
| 1168 | $collection = array(); |
---|
[5056] | 1169 | |
---|
[20592] | 1170 | switch ($_POST['target']) |
---|
| 1171 | { |
---|
| 1172 | case 'all' : |
---|
| 1173 | { |
---|
| 1174 | foreach($page['filtered_users'] as $local_user) |
---|
| 1175 | { |
---|
| 1176 | array_push($collection, $local_user['id']); |
---|
| 1177 | } |
---|
| 1178 | break; |
---|
| 1179 | } |
---|
| 1180 | case 'selection' : |
---|
| 1181 | { |
---|
| 1182 | if (isset($_POST['selection'])) |
---|
| 1183 | { |
---|
| 1184 | $collection = $_POST['selection']; |
---|
| 1185 | } |
---|
[17918] | 1186 | break; |
---|
[20592] | 1187 | } |
---|
| 1188 | } |
---|
[17918] | 1189 | |
---|
[20592] | 1190 | if (count($collection) == 0) |
---|
| 1191 | { |
---|
| 1192 | array_push($page['errors'], l10n('Select at least one user')); |
---|
| 1193 | } |
---|
| 1194 | } |
---|
[5056] | 1195 | // +-----------------------------------------------------------------------+ |
---|
| 1196 | // | Force validation | |
---|
| 1197 | // +-----------------------------------------------------------------------+ |
---|
[20592] | 1198 | if (isset($_POST['Manual_Validation']) and count($collection) > 0) |
---|
| 1199 | { |
---|
| 1200 | if (in_array($conf['guest_id'], $collection)) |
---|
| 1201 | { |
---|
| 1202 | array_push($page['errors'], l10n('UAM_No_validation_for_Guest')); |
---|
| 1203 | } |
---|
| 1204 | if (($conf['guest_id'] != $conf['default_user_id']) and |
---|
| 1205 | in_array($conf['default_user_id'], $collection)) |
---|
| 1206 | { |
---|
| 1207 | array_push($page['errors'], l10n('UAM_No_validation_for_default_user')); |
---|
| 1208 | } |
---|
| 1209 | if (in_array($conf['webmaster_id'], $collection)) |
---|
| 1210 | { |
---|
| 1211 | array_push($page['errors'], l10n('UAM_No_validation_for_Webmaster')); |
---|
| 1212 | } |
---|
| 1213 | if (in_array($user['id'], $collection)) |
---|
| 1214 | { |
---|
| 1215 | array_push($page['errors'], l10n('UAM_No_validation_for_your_account')); |
---|
| 1216 | } |
---|
[5056] | 1217 | |
---|
[20592] | 1218 | if (count($page['errors']) == 0) |
---|
| 1219 | { |
---|
| 1220 | foreach ($collection as $user_id) |
---|
| 1221 | { |
---|
| 1222 | ManualValidation($user_id); |
---|
[8092] | 1223 | validation_mail($user_id); |
---|
[20592] | 1224 | } |
---|
| 1225 | array_push( |
---|
| 1226 | $page['infos'], |
---|
| 1227 | l10n_dec( |
---|
| 1228 | 'UAM_%d_Validated_User', 'UAM_%d_Validated_Users', |
---|
[17918] | 1229 | count($collection) |
---|
[20592] | 1230 | ) |
---|
| 1231 | ); |
---|
[5056] | 1232 | |
---|
[20592] | 1233 | $page['filtered_users'] = get_unvalid_user_list(); |
---|
| 1234 | } |
---|
| 1235 | } |
---|
[5056] | 1236 | |
---|
[20592] | 1237 | |
---|
[5056] | 1238 | // +-----------------------------------------------------------------------+ |
---|
| 1239 | // | groups list | |
---|
| 1240 | // +-----------------------------------------------------------------------+ |
---|
| 1241 | |
---|
[20592] | 1242 | $groups[-1] = '------------'; |
---|
[5056] | 1243 | |
---|
| 1244 | $query = ' |
---|
| 1245 | SELECT id, name |
---|
[20592] | 1246 | FROM '.GROUPS_TABLE.' |
---|
[5056] | 1247 | ORDER BY name ASC |
---|
| 1248 | ;'; |
---|
| 1249 | |
---|
[20592] | 1250 | $result = pwg_query($query); |
---|
| 1251 | |
---|
[5633] | 1252 | while ($row = pwg_db_fetch_assoc($result)) |
---|
[5056] | 1253 | { |
---|
[20592] | 1254 | $groups[$row['id']] = $row['name']; |
---|
[5056] | 1255 | } |
---|
| 1256 | |
---|
| 1257 | // +-----------------------------------------------------------------------+ |
---|
| 1258 | // | user list | |
---|
| 1259 | // +-----------------------------------------------------------------------+ |
---|
| 1260 | |
---|
[20592] | 1261 | $profile_url = get_root_url().'admin.php?page=profile&user_id='; |
---|
| 1262 | $perm_url = get_root_url().'admin.php?page=user_perm&user_id='; |
---|
[5056] | 1263 | |
---|
| 1264 | $visible_user_list = array(); |
---|
| 1265 | foreach ($page['filtered_users'] as $num => $local_user) |
---|
| 1266 | { |
---|
[20592] | 1267 | $visible_user_list[] = $local_user; |
---|
| 1268 | } |
---|
[5056] | 1269 | |
---|
[20592] | 1270 | foreach ($visible_user_list as $local_user) |
---|
[5056] | 1271 | { |
---|
[20592] | 1272 | $groups_string = preg_replace( |
---|
| 1273 | '/(\d+)/e', |
---|
[5056] | 1274 | "\$groups['$1']", |
---|
| 1275 | implode( |
---|
[20592] | 1276 | ', ', |
---|
| 1277 | $local_user['groups'] |
---|
| 1278 | ) |
---|
| 1279 | ); |
---|
[5056] | 1280 | |
---|
| 1281 | $query = ' |
---|
| 1282 | SELECT user_id, reminder |
---|
| 1283 | FROM '.USER_CONFIRM_MAIL_TABLE.' |
---|
| 1284 | WHERE user_id = '.$local_user['id'].' |
---|
| 1285 | ;'; |
---|
| 1286 | $result = pwg_query($query); |
---|
| 1287 | |
---|
[5633] | 1288 | $row = pwg_db_fetch_assoc($result); |
---|
[5056] | 1289 | |
---|
| 1290 | if (isset($row['reminder']) and $row['reminder'] == 'true') |
---|
| 1291 | { |
---|
[9177] | 1292 | $reminder = l10n('UAM_Reminder_Sent_OK'); |
---|
[5056] | 1293 | } |
---|
| 1294 | else if ((isset($row['reminder']) and $row['reminder'] == 'false') or !isset($row['reminder'])) |
---|
| 1295 | { |
---|
[9177] | 1296 | $reminder = l10n('UAM_Reminder_Sent_NOK'); |
---|
[5056] | 1297 | } |
---|
| 1298 | |
---|
| 1299 | |
---|
[20592] | 1300 | if (isset($_POST['pref_submit']) |
---|
| 1301 | and isset($_POST['selection']) |
---|
| 1302 | and in_array($local_user['id'], $_POST['selection'])) |
---|
| 1303 | { |
---|
| 1304 | $checked = 'checked="checked"'; |
---|
| 1305 | } |
---|
| 1306 | else |
---|
| 1307 | { |
---|
| 1308 | $checked = ''; |
---|
| 1309 | } |
---|
[5056] | 1310 | |
---|
[20592] | 1311 | $properties = array(); |
---|
[5056] | 1312 | |
---|
[20592] | 1313 | if ($local_user['level'] != 0) |
---|
| 1314 | { |
---|
| 1315 | $properties[] = l10n( sprintf('Level %d', $local_user['level']) ); |
---|
| 1316 | } |
---|
[12271] | 1317 | |
---|
[20592] | 1318 | $properties[] = (isset($local_user['enabled_high']) and ($local_user['enabled_high'] == 'true')) |
---|
| 1319 | ? l10n('is_high_enabled') : l10n('is_high_disabled'); |
---|
| 1320 | |
---|
| 1321 | $expiration = expiration($local_user['id']); |
---|
| 1322 | |
---|
[12271] | 1323 | // Template initialization |
---|
| 1324 | // ----------------------- |
---|
[20592] | 1325 | $template->append( |
---|
| 1326 | 'users', |
---|
| 1327 | array( |
---|
| 1328 | 'ID' => $local_user['id'], |
---|
| 1329 | 'CHECKED' => $checked, |
---|
| 1330 | 'U_PROFILE' => $profile_url.$local_user['id'], |
---|
| 1331 | 'U_PERM' => $perm_url.$local_user['id'], |
---|
| 1332 | 'USERNAME' => stripslashes($local_user['username']) |
---|
| 1333 | .($local_user['id'] == $conf['guest_id'] |
---|
| 1334 | ? '<BR>['.l10n('is_the_guest').']' : '') |
---|
| 1335 | .($local_user['id'] == $conf['default_user_id'] |
---|
| 1336 | ? '<BR>['.l10n('is_the_default').']' : ''), |
---|
| 1337 | 'STATUS' => l10n('user_status_' |
---|
| 1338 | .$local_user['status']), |
---|
| 1339 | 'EMAIL' => get_email_address_as_display_text($local_user['email']), |
---|
| 1340 | 'GROUPS' => $groups_string, |
---|
| 1341 | 'REGISTRATION' => $local_user['registration_date'], |
---|
| 1342 | 'REMINDER' => $reminder, |
---|
| 1343 | 'EXPIRATION' => $expiration, |
---|
| 1344 | ) |
---|
| 1345 | ); |
---|
| 1346 | } |
---|
[6754] | 1347 | |
---|
| 1348 | // Check if validation of register is made by admin or visitor |
---|
| 1349 | // If visitor, $Confirm_Local is used to mask useless buttons |
---|
[12271] | 1350 | // ----------------------------------------------------------- |
---|
[6754] | 1351 | $Confirm_Local = ""; |
---|
| 1352 | |
---|
| 1353 | if ($conf_UAM[1] == 'local') |
---|
| 1354 | { |
---|
| 1355 | $Confirm_Local = $conf_UAM[1]; |
---|
| 1356 | } |
---|
| 1357 | else |
---|
| 1358 | { |
---|
| 1359 | $Confirm_Local = ""; |
---|
| 1360 | } |
---|
| 1361 | |
---|
[12271] | 1362 | // Plugin version inserted |
---|
| 1363 | // ----------------------- |
---|
[5056] | 1364 | $template->assign( |
---|
[20592] | 1365 | array( |
---|
[6754] | 1366 | 'CONFIRM_LOCAL'=> $Confirm_Local, |
---|
[5181] | 1367 | 'UAM_VERSION' => $version, |
---|
| 1368 | 'UAM_PATH' => UAM_PATH, |
---|
[5056] | 1369 | ) |
---|
| 1370 | ); |
---|
| 1371 | |
---|
| 1372 | // +-----------------------------------------------------------------------+ |
---|
| 1373 | // | errors display | |
---|
| 1374 | // +-----------------------------------------------------------------------+ |
---|
[20592] | 1375 | if ( isset ($errors) and count($errors) != 0) |
---|
| 1376 | { |
---|
| 1377 | $template->assign('errors',array()); |
---|
| 1378 | foreach ($errors as $error) |
---|
| 1379 | { |
---|
| 1380 | array_push($page['errors'], $error); |
---|
| 1381 | } |
---|
| 1382 | } |
---|
[5056] | 1383 | |
---|
| 1384 | // +-----------------------------------------------------------------------+ |
---|
| 1385 | // | templates display | |
---|
| 1386 | // +-----------------------------------------------------------------------+ |
---|
[20592] | 1387 | $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/template/usermanager.tpl'); |
---|
| 1388 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
| 1389 | } |
---|
[5056] | 1390 | else |
---|
| 1391 | { |
---|
[20592] | 1392 | array_push($page['errors'], l10n('UAM_Err_UserManager_Settings')); |
---|
[5056] | 1393 | } |
---|
| 1394 | break; |
---|
| 1395 | |
---|
| 1396 | |
---|
| 1397 | // ************************************************************************* |
---|
| 1398 | // +-----------------------------------------------------------------------+ |
---|
| 1399 | // | Ghost Tracker page | |
---|
| 1400 | // +-----------------------------------------------------------------------+ |
---|
| 1401 | // ************************************************************************* |
---|
[20592] | 1402 | case 'ghosttracker': |
---|
[5056] | 1403 | |
---|
[5181] | 1404 | $conf_UAM = unserialize($conf['UserAdvManager']); |
---|
[5056] | 1405 | |
---|
[11018] | 1406 | if (isset($conf_UAM[16]) and $conf_UAM[15]=='true') |
---|
[5056] | 1407 | { |
---|
| 1408 | // +-----------------------------------------------------------------------+ |
---|
| 1409 | // | initialization | |
---|
| 1410 | // +-----------------------------------------------------------------------+ |
---|
| 1411 | |
---|
[20592] | 1412 | if (!defined('PHPWG_ROOT_PATH')) |
---|
| 1413 | { |
---|
| 1414 | die('Hacking attempt!'); |
---|
| 1415 | } |
---|
| 1416 | |
---|
| 1417 | include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); |
---|
[5056] | 1418 | |
---|
| 1419 | // +-----------------------------------------------------------------------+ |
---|
| 1420 | // | Check Access and exit when user status is not ok | |
---|
| 1421 | // +-----------------------------------------------------------------------+ |
---|
[20592] | 1422 | check_status(ACCESS_ADMINISTRATOR); |
---|
[5056] | 1423 | |
---|
| 1424 | // +-----------------------------------------------------------------------+ |
---|
| 1425 | // | user list | |
---|
| 1426 | // +-----------------------------------------------------------------------+ |
---|
| 1427 | |
---|
[20592] | 1428 | $page['filtered_users'] = get_ghost_user_list(); |
---|
[5056] | 1429 | |
---|
| 1430 | // +-----------------------------------------------------------------------+ |
---|
| 1431 | // | selected users | |
---|
| 1432 | // +-----------------------------------------------------------------------+ |
---|
[20592] | 1433 | if (isset($_POST['Del_Selected'])) |
---|
| 1434 | { |
---|
| 1435 | $collection = array(); |
---|
[5056] | 1436 | |
---|
[20592] | 1437 | switch ($_POST['target']) |
---|
| 1438 | { |
---|
| 1439 | case 'all' : |
---|
| 1440 | { |
---|
| 1441 | foreach($page['filtered_users'] as $local_user) |
---|
| 1442 | { |
---|
| 1443 | array_push($collection, $local_user['id']); |
---|
| 1444 | } |
---|
| 1445 | break; |
---|
| 1446 | } |
---|
| 1447 | case 'selection' : |
---|
| 1448 | { |
---|
| 1449 | if (isset($_POST['selection'])) |
---|
| 1450 | { |
---|
| 1451 | $collection = $_POST['selection']; |
---|
| 1452 | } |
---|
| 1453 | break; |
---|
| 1454 | } |
---|
| 1455 | } |
---|
[17918] | 1456 | |
---|
[20592] | 1457 | if (count($collection) == 0) |
---|
| 1458 | { |
---|
| 1459 | array_push($page['errors'], l10n('Select at least one user')); |
---|
| 1460 | } |
---|
| 1461 | } |
---|
[5056] | 1462 | |
---|
| 1463 | // +-----------------------------------------------------------------------+ |
---|
| 1464 | // | delete users | |
---|
| 1465 | // +-----------------------------------------------------------------------+ |
---|
[20592] | 1466 | if (isset($_POST['Del_Selected']) and count($collection) > 0) |
---|
| 1467 | { |
---|
| 1468 | if (in_array($conf['guest_id'], $collection)) |
---|
| 1469 | { |
---|
| 1470 | array_push($page['errors'], l10n('Guest cannot be deleted')); |
---|
| 1471 | } |
---|
| 1472 | if (($conf['guest_id'] != $conf['default_user_id']) and |
---|
| 1473 | in_array($conf['default_user_id'], $collection)) |
---|
| 1474 | { |
---|
| 1475 | array_push($page['errors'], l10n('Default user cannot be deleted')); |
---|
| 1476 | } |
---|
| 1477 | if (in_array($conf['webmaster_id'], $collection)) |
---|
| 1478 | { |
---|
| 1479 | array_push($page['errors'], l10n('Webmaster cannot be deleted')); |
---|
| 1480 | } |
---|
| 1481 | if (in_array($user['id'], $collection)) |
---|
| 1482 | { |
---|
| 1483 | array_push($page['errors'], l10n('You cannot delete your account')); |
---|
| 1484 | } |
---|
[5056] | 1485 | |
---|
[20592] | 1486 | if (count($page['errors']) == 0) |
---|
| 1487 | { |
---|
| 1488 | foreach ($collection as $user_id) |
---|
| 1489 | { |
---|
| 1490 | delete_user($user_id); |
---|
| 1491 | } |
---|
| 1492 | array_push( |
---|
| 1493 | $page['infos'], |
---|
| 1494 | l10n_dec( |
---|
| 1495 | '%d user deleted', '%d users deleted', |
---|
[17918] | 1496 | count($collection) |
---|
[20592] | 1497 | ) |
---|
| 1498 | ); |
---|
[5056] | 1499 | |
---|
[20592] | 1500 | foreach ($page['filtered_users'] as $filter_key => $filter_user) |
---|
| 1501 | { |
---|
| 1502 | if (in_array($filter_user['id'], $collection)) |
---|
| 1503 | { |
---|
| 1504 | unset($page['filtered_users'][$filter_key]); |
---|
| 1505 | } |
---|
| 1506 | } |
---|
| 1507 | } |
---|
| 1508 | } |
---|
[5056] | 1509 | |
---|
| 1510 | // +-----------------------------------------------------------------------+ |
---|
| 1511 | // | Send ghost reminder | |
---|
| 1512 | // +-----------------------------------------------------------------------+ |
---|
| 1513 | // +-----------------------------------------------------------------------+ |
---|
| 1514 | // | selected users | |
---|
| 1515 | // +-----------------------------------------------------------------------+ |
---|
[20592] | 1516 | if (isset($_POST['Reminder_Email'])) |
---|
| 1517 | { |
---|
| 1518 | $collection = array(); |
---|
[5056] | 1519 | |
---|
[20592] | 1520 | switch ($_POST['target']) |
---|
| 1521 | { |
---|
| 1522 | case 'all' : |
---|
| 1523 | { |
---|
| 1524 | foreach($page['filtered_users'] as $local_user) |
---|
| 1525 | { |
---|
| 1526 | array_push($collection, $local_user['id']); |
---|
| 1527 | } |
---|
| 1528 | break; |
---|
| 1529 | } |
---|
| 1530 | case 'selection' : |
---|
| 1531 | { |
---|
| 1532 | if (isset($_POST['selection'])) |
---|
| 1533 | { |
---|
| 1534 | $collection = $_POST['selection']; |
---|
| 1535 | } |
---|
[17918] | 1536 | break; |
---|
[20592] | 1537 | } |
---|
| 1538 | } |
---|
[17918] | 1539 | |
---|
[20592] | 1540 | if (count($collection) == 0) |
---|
| 1541 | { |
---|
| 1542 | array_push($page['errors'], l10n('Select at least one user')); |
---|
| 1543 | } |
---|
| 1544 | } |
---|
[5056] | 1545 | // +-----------------------------------------------------------------------+ |
---|
| 1546 | // | Send ghost reminder | |
---|
| 1547 | // +-----------------------------------------------------------------------+ |
---|
[20592] | 1548 | if (isset($_POST['Reminder_Email']) and count($collection) > 0) |
---|
| 1549 | { |
---|
| 1550 | if (in_array($conf['guest_id'], $collection)) |
---|
| 1551 | { |
---|
| 1552 | array_push($page['errors'], l10n('UAM_No_reminder_for_Guest')); |
---|
| 1553 | } |
---|
| 1554 | if (($conf['guest_id'] != $conf['default_user_id']) and |
---|
| 1555 | in_array($conf['default_user_id'], $collection)) |
---|
| 1556 | { |
---|
| 1557 | array_push($page['errors'], l10n('UAM_No_reminder_for_default_user')); |
---|
| 1558 | } |
---|
| 1559 | if (in_array($conf['webmaster_id'], $collection)) |
---|
| 1560 | { |
---|
| 1561 | array_push($page['errors'], l10n('UAM_No_reminder_for_Webmaster')); |
---|
| 1562 | } |
---|
| 1563 | if (in_array($user['id'], $collection)) |
---|
| 1564 | { |
---|
| 1565 | array_push($page['errors'], l10n('UAM_No_reminder_for_your_account')); |
---|
| 1566 | } |
---|
[5056] | 1567 | |
---|
[20592] | 1568 | if (count($page['errors']) == 0) |
---|
| 1569 | { |
---|
| 1570 | foreach ($collection as $user_id) |
---|
| 1571 | { |
---|
| 1572 | $query = ' |
---|
[5056] | 1573 | SELECT id, username, mail_address |
---|
[20592] | 1574 | FROM '.USERS_TABLE.' |
---|
[17918] | 1575 | WHERE id = '.$user_id.' |
---|
| 1576 | ;'; |
---|
[5056] | 1577 | |
---|
[20592] | 1578 | $data = pwg_db_fetch_assoc(pwg_query($query)); |
---|
[17918] | 1579 | |
---|
[20592] | 1580 | ghostreminder($user_id,stripslashes($data['username']),$data['mail_address']); |
---|
| 1581 | } |
---|
| 1582 | |
---|
| 1583 | array_push( |
---|
| 1584 | $page['infos'], |
---|
| 1585 | l10n_dec( |
---|
| 1586 | 'UAM_%d_Reminder_Sent', 'UAM_%d_Reminders_Sent', |
---|
| 1587 | count($collection) |
---|
| 1588 | ) |
---|
| 1589 | ); |
---|
| 1590 | |
---|
| 1591 | $page['filtered_users'] = get_ghost_user_list(); |
---|
| 1592 | } |
---|
| 1593 | } |
---|
| 1594 | |
---|
[9253] | 1595 | if (isset($_POST['GhostTracker_Init']) and is_admin()) //Reset is only allowed for admins ! |
---|
[5056] | 1596 | { |
---|
[20592] | 1597 | $query1 = ' |
---|
[5056] | 1598 | SELECT * |
---|
[20592] | 1599 | FROM '.USER_LASTVISIT_TABLE.';'; |
---|
[5056] | 1600 | |
---|
[9253] | 1601 | $count = pwg_db_num_rows(pwg_query($query1)); |
---|
[5056] | 1602 | |
---|
[9253] | 1603 | if ($count <> 0) |
---|
| 1604 | { |
---|
[20592] | 1605 | $query = ' |
---|
[5056] | 1606 | SELECT DISTINCT u.id, |
---|
| 1607 | ui.status AS status |
---|
| 1608 | FROM '.USERS_TABLE.' AS u |
---|
| 1609 | INNER JOIN '.USER_INFOS_TABLE.' AS ui |
---|
| 1610 | ON u.id = ui.user_id |
---|
| 1611 | WHERE u.id NOT IN (SELECT user_id FROM '.USER_LASTVISIT_TABLE.') |
---|
| 1612 | AND status != "webmaster" |
---|
| 1613 | AND status != "guest" |
---|
| 1614 | AND status != "admin" |
---|
| 1615 | ORDER BY u.id ASC |
---|
| 1616 | ;'; |
---|
| 1617 | |
---|
[9253] | 1618 | $result = pwg_query($query); |
---|
[20592] | 1619 | |
---|
[9253] | 1620 | while ($row = pwg_db_fetch_assoc($result)) |
---|
| 1621 | { |
---|
[19235] | 1622 | $dbnow = date("Y-m-d H:i:s"); |
---|
[5056] | 1623 | |
---|
[17918] | 1624 | $query = ' |
---|
| 1625 | INSERT INTO '.USER_LASTVISIT_TABLE.' |
---|
| 1626 | (user_id, lastvisit, reminder) |
---|
| 1627 | VALUES ('.$row['id'].',"'.$dbnow.'","false") |
---|
| 1628 | ;'; |
---|
[9253] | 1629 | pwg_query($query); |
---|
[5056] | 1630 | } |
---|
[9253] | 1631 | } |
---|
| 1632 | else if ($count == 0) |
---|
| 1633 | { |
---|
| 1634 | $query = ' |
---|
[5056] | 1635 | SELECT DISTINCT u.id, |
---|
| 1636 | ui.status AS status |
---|
| 1637 | FROM '.USERS_TABLE.' AS u |
---|
| 1638 | INNER JOIN '.USER_INFOS_TABLE.' AS ui |
---|
| 1639 | ON u.id = ui.user_id |
---|
| 1640 | WHERE status != "webmaster" |
---|
| 1641 | AND status != "guest" |
---|
| 1642 | AND status != "admin" |
---|
| 1643 | ORDER BY u.id ASC |
---|
| 1644 | ;'; |
---|
| 1645 | |
---|
[9253] | 1646 | $result = pwg_query($query); |
---|
[20592] | 1647 | |
---|
[9253] | 1648 | while($row = pwg_db_fetch_assoc($result)) |
---|
| 1649 | { |
---|
[19235] | 1650 | $dbnow = date("Y-m-d H:i:s"); |
---|
[20592] | 1651 | |
---|
[17918] | 1652 | $query = ' |
---|
| 1653 | INSERT INTO '.USER_LASTVISIT_TABLE.' |
---|
| 1654 | (user_id, lastvisit, reminder) |
---|
| 1655 | VALUES ('.$row['id'].',"'.$dbnow.'","false") |
---|
| 1656 | ;'; |
---|
[9253] | 1657 | pwg_query($query); |
---|
[5056] | 1658 | } |
---|
[9253] | 1659 | } |
---|
[20592] | 1660 | |
---|
[9253] | 1661 | array_push($page['infos'], l10n('UAM_GhostTracker_Init_OK')); |
---|
[5056] | 1662 | } |
---|
| 1663 | |
---|
| 1664 | // +-----------------------------------------------------------------------+ |
---|
| 1665 | // | user list | |
---|
| 1666 | // +-----------------------------------------------------------------------+ |
---|
| 1667 | |
---|
| 1668 | $visible_user_list = array(); |
---|
| 1669 | foreach ($page['filtered_users'] as $num => $local_user) |
---|
| 1670 | { |
---|
| 1671 | $visible_user_list[] = $local_user; |
---|
[20592] | 1672 | } |
---|
| 1673 | |
---|
| 1674 | foreach ($visible_user_list as $local_user) |
---|
[17918] | 1675 | { |
---|
[20592] | 1676 | $reminder = ''; |
---|
| 1677 | |
---|
[5056] | 1678 | if (isset($local_user['reminder']) and $local_user['reminder'] == 'true') |
---|
| 1679 | { |
---|
[9177] | 1680 | $reminder = l10n('UAM_Reminder_Sent_OK'); |
---|
[5056] | 1681 | } |
---|
| 1682 | else if (isset($local_user['reminder']) and $local_user['reminder'] == 'false') |
---|
| 1683 | { |
---|
[9177] | 1684 | $reminder = l10n('UAM_Reminder_Sent_NOK'); |
---|
[5056] | 1685 | } |
---|
[20592] | 1686 | |
---|
[5056] | 1687 | if (isset($_POST['pref_submit']) and isset($_POST['selection']) and in_array($local_user['id'], $_POST['selection'])) |
---|
[20592] | 1688 | { |
---|
| 1689 | $checked = 'checked="checked"'; |
---|
| 1690 | } |
---|
| 1691 | else |
---|
| 1692 | { |
---|
| 1693 | $checked = ''; |
---|
| 1694 | } |
---|
[5056] | 1695 | |
---|
[12271] | 1696 | // Template initialization |
---|
| 1697 | // ----------------------- |
---|
[5056] | 1698 | $template->append( |
---|
| 1699 | 'users', |
---|
| 1700 | array( |
---|
[20592] | 1701 | 'ID' => $local_user['id'], |
---|
[5056] | 1702 | 'CHECKED' => $checked, |
---|
| 1703 | 'USERNAME' => stripslashes($local_user['username']), |
---|
[20592] | 1704 | 'EMAIL' => get_email_address_as_display_text($local_user['email']), |
---|
[5056] | 1705 | 'LASTVISIT' => $local_user['lastvisit'], |
---|
| 1706 | 'REMINDER' => $reminder, |
---|
[20592] | 1707 | ) |
---|
| 1708 | ); |
---|
| 1709 | } |
---|
[5056] | 1710 | |
---|
[12271] | 1711 | // Plugin version inserted |
---|
| 1712 | // ----------------------- |
---|
[9153] | 1713 | $template->assign( |
---|
| 1714 | array( |
---|
| 1715 | 'UAM_VERSION' => $version, |
---|
| 1716 | 'UAM_PATH' => UAM_PATH, |
---|
| 1717 | ) |
---|
| 1718 | ); |
---|
| 1719 | |
---|
[5056] | 1720 | // +-----------------------------------------------------------------------+ |
---|
| 1721 | // | errors display | |
---|
| 1722 | // +-----------------------------------------------------------------------+ |
---|
[20592] | 1723 | if ( isset ($errors) and count($errors) != 0) |
---|
| 1724 | { |
---|
| 1725 | $template->assign('errors',array()); |
---|
| 1726 | foreach ($errors as $error) |
---|
| 1727 | { |
---|
| 1728 | array_push($page['errors'], $error); |
---|
| 1729 | } |
---|
| 1730 | } |
---|
[5056] | 1731 | |
---|
| 1732 | // +-----------------------------------------------------------------------+ |
---|
| 1733 | // | templates display | |
---|
| 1734 | // +-----------------------------------------------------------------------+ |
---|
[20592] | 1735 | $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/template/ghosttracker.tpl'); |
---|
[5056] | 1736 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
[20592] | 1737 | } |
---|
[5056] | 1738 | else |
---|
| 1739 | { |
---|
[20592] | 1740 | array_push($page['errors'], l10n('UAM_Err_GhostTracker_Settings')); |
---|
[5056] | 1741 | } |
---|
| 1742 | |
---|
| 1743 | break; |
---|
| 1744 | } |
---|
| 1745 | ?> |
---|