- Timestamp:
- Dec 12, 2010, 7:09:27 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/NBC_UserAdvManager/branches/2.16/include/functions.inc.php
r8088 r8095 369 369 } 370 370 371 // Ghost accounts auto deletion372 if ((isset($conf_UAM[22]) and $conf_UAM[22] == 'true') and (isset($conf_UAM[23]) and $conf_UAM[23] == 'true'))373 {374 if (count($collection) > 0)375 {376 if (in_array($user['id'], $collection))377 {378 invalidate_user_cache();379 380 foreach ($collection as $user_id)381 {382 delete_user($user_id);383 }384 logout_user();385 redirect(UAM_PATH.'del_account.php');386 }387 else388 {389 foreach ($collection as $user_id)390 {391 delete_user($user_id);392 }393 }394 }395 }396 397 371 // Ghost accounts auto group or status downgrade with or without information email sending and autodeletion if user already reminded 398 if ((isset($conf_UAM[22]) and $conf_UAM[22] == 'true') and ( isset($conf_UAM[23]) and $conf_UAM[23] == 'false') and ((isset($conf_UAM[27]) and $conf_UAM[27] <> -1) or (isset($conf_UAM[28]) and $conf_UAM[28] <> -1)))372 if ((isset($conf_UAM[22]) and $conf_UAM[22] == 'true') and ((isset($conf_UAM[26]) and $conf_UAM[26] <> -1) or (isset($conf_UAM[27]) and $conf_UAM[27] <> -1))) 399 373 { 400 374 if (count($collection) > 0) … … 450 424 451 425 // Change user status 452 if ($conf_UAM[2 8] <> -1)426 if ($conf_UAM[27] <> -1) 453 427 { 454 428 $query = " 455 429 UPDATE ".USER_INFOS_TABLE." 456 SET status = '".$conf_UAM[2 8]."'430 SET status = '".$conf_UAM[27]."' 457 431 WHERE user_id = '".$user_id."' 458 432 ;"; … … 461 435 462 436 // Change user group 463 if ($conf_UAM[2 7] <> -1)437 if ($conf_UAM[26] <> -1) 464 438 { 465 439 $query = " … … 467 441 (user_id, group_id) 468 442 VALUES 469 ('".$user_id."', '".$conf_UAM[2 7]."')443 ('".$user_id."', '".$conf_UAM[26]."') 470 444 ;"; 471 445 pwg_query($query); … … 473 447 474 448 // Auto send email notification on group / status downgrade only if never reminded before 475 if (isset($conf_UAM[2 4]) and $conf_UAM[24] == 'true')449 if (isset($conf_UAM[23]) and $conf_UAM[23] == 'true') 476 450 { 477 451 // Set reminder true … … 508 482 } 509 483 } 510 // Logged-in user cleanup 511 invalidate_user_cache(); 512 log_user($user['id'], false); 513 redirect(make_index_url()); 484 485 if (!$reminder) // If user never reminded for ghost account 486 { 487 // Logged-in user cleanup 488 invalidate_user_cache(); 489 log_user($user['id'], false); 490 redirect(make_index_url()); 491 } 492 elseif ($reminder) // If user already reminded for ghost account 493 { 494 // Logged-in user cleanup 495 invalidate_user_cache(); 496 log_user($user['id'], false); 497 redirect(UAM_PATH.'del_account.php'); 498 } 514 499 } 515 500 else // Process if an admin or webmaster user is logged … … 561 546 562 547 // Change user status 563 if ($conf_UAM[2 8] <> -1)548 if ($conf_UAM[27] <> -1) 564 549 { 565 550 $query = " 566 551 UPDATE ".USER_INFOS_TABLE." 567 SET status = '".$conf_UAM[2 8]."'552 SET status = '".$conf_UAM[27]."' 568 553 WHERE user_id = '".$user_id."' 569 554 ;"; … … 572 557 573 558 // Change user group 574 if ($conf_UAM[2 7] <> -1)559 if ($conf_UAM[26] <> -1) 575 560 { 576 561 $query = " … … 578 563 (user_id, group_id) 579 564 VALUES 580 ('".$user_id."', '".$conf_UAM[2 7]."')565 ('".$user_id."', '".$conf_UAM[26]."') 581 566 ;"; 582 567 pwg_query($query); … … 584 569 585 570 // Auto send email notification on group / status downgrade 586 if (isset($conf_UAM[2 4]) and $conf_UAM[24] == 'true')571 if (isset($conf_UAM[23]) and $conf_UAM[23] == 'true') 587 572 { 588 573 // Set reminder true … … 983 968 // debugging 984 969 // ********************** 985 //$content = get_user_language_desc($conf_UAM[19])."\n\n";970 //$content = $infos1.get_absolute_root_url(); 986 971 //MailLog($email,$subject,$content,$language); 987 972 // ********************** … … 994 979 * Function called from functions.inc.php to send notification email when user have been downgraded 995 980 * 996 * @param : user id, username, email address , confirmation981 * @param : user id, username, email address 997 982 * 998 983 */ … … 1032 1017 $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('Demotion of %s', stripslashes($username))); 1033 1018 1034 if (isset($conf_UAM[2 6]) and $conf_UAM[26] <> '')1019 if (isset($conf_UAM[25]) and $conf_UAM[25] <> '') 1035 1020 { 1036 1021 if (function_exists('get_user_language_desc')) 1037 1022 { 1038 $custom_txt = get_user_language_desc($conf_UAM[2 6])."\n\n";1039 } 1040 else $custom_txt = l10n($conf_UAM[2 6])."\n\n";1023 $custom_txt = get_user_language_desc($conf_UAM[25])."\n\n"; 1024 } 1025 else $custom_txt = l10n($conf_UAM[25])."\n\n"; 1041 1026 } 1042 1027 … … 1066 1051 // debugging 1067 1052 // ********************** 1068 //$content = ($infos1."\n\n".$infos2."\n\n").get_absolute_root_url(); 1053 //$content = ($custom_txt.l10n_args($infos1)."\n\n".l10n_args($infos2)."\n\n").get_absolute_root_url(); 1054 //MailLog($email,$subject,$content,$language); 1055 // ********************** 1056 1057 // Switching back to default language 1058 switch_lang_back(); 1059 } 1060 1061 /** 1062 * Function called from UAM_admin.php to send notification email when user registration have been manually validated by admin 1063 * 1064 * @param : user id 1065 * 1066 */ 1067 function validation_mail($id) 1068 { 1069 global $conf; 1070 1071 $conf_UAM = unserialize($conf['UserAdvManager']); 1072 1073 include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); 1074 1075 $custom_txt = ""; 1076 1077 // We have to get the user's language in database 1078 $query =' 1079 SELECT user_id, language 1080 FROM '.USER_INFOS_TABLE.' 1081 WHERE user_id = '.$id.' 1082 ;'; 1083 $data = pwg_db_fetch_assoc(pwg_query($query)); 1084 1085 // Check if user is already registered (profile changing) - If not (new registration), language is set to current gallery language 1086 if (empty($data)) 1087 { 1088 // And switch gallery to this language before using personalized and multilangual contents 1089 $language = pwg_get_session_var( 'lang_switch', $user['language'] ); 1090 switch_lang_to($language); 1091 } 1092 else 1093 { 1094 // And switch gallery to this language before using personalized and multilangual contents 1095 $language = $data['language']; // Usefull for debugging 1096 switch_lang_to($data['language']); 1097 load_language('plugin.lang', UAM_PATH); 1098 } 1099 1100 // Retreive users email and user name from id 1101 $query =' 1102 SELECT id, username, mail_address 1103 FROM '.USERS_TABLE.' 1104 WHERE id = '.$id.' 1105 ;'; 1106 $result = pwg_db_fetch_assoc(pwg_query($query)); 1107 1108 $subject = '['.$conf['gallery_title'].'] '.l10n_args(get_l10n_args('Validation of %s', stripslashes($result['username']))); 1109 1110 if (isset($conf_UAM[28]) and $conf_UAM[28] <> '') 1111 { 1112 if (function_exists('get_user_language_desc')) 1113 { 1114 $custom_txt = get_user_language_desc($conf_UAM[28])."\n\n"; 1115 } 1116 else $custom_txt = l10n($conf_UAM[28])."\n\n"; 1117 } 1118 1119 $infos = array( 1120 get_l10n_args('User: %s', stripslashes($result['username'])), 1121 get_l10n_args('Email: %s', $result['mail_address']), 1122 get_l10n_args('', ''), 1123 ); 1124 1125 // Sending the email with subject and contents 1126 pwg_mail($result['mail_address'], array( 1127 'subject' => $subject, 1128 'content' => (l10n_args($infos)."\n\n".$custom_txt), 1129 )); 1130 1131 // ********************** 1132 // Email sending debugger 1133 // This is only to trace 1134 // the send of emails for 1135 // debugging 1136 // ********************** 1137 //$email = $result['mail_address']; 1138 //$content = (l10n_args($infos)."\n\n".$custom_txt); 1069 1139 //MailLog($email,$subject,$content,$language); 1070 1140 // **********************
Note: See TracChangeset
for help on using the changeset viewer.