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