- Timestamp:
- Feb 16, 2011, 7:28:44 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/NBC_UserAdvManager/trunk/include/functions.inc.php
r9197 r9253 322 322 $conf_UAM = unserialize($conf['UserAdvManager']); 323 323 324 // Performing scheduled tasks324 // Performing GhostTracker scheduled tasks 325 325 if ((isset($conf_UAM[22]) and $conf_UAM[22] == 'true')) 326 326 { 327 UAM_ ScheduledTasks();327 UAM_GT_ScheduledTasks(); 328 328 } 329 329 … … 350 350 * Triggered on UAM_LoginTasks() 351 351 * 352 * Executes optional post-login tasks 353 * 354 */ 355 function UAM_ ScheduledTasks()352 * Executes optional post-login tasks for Ghost users 353 * 354 */ 355 function UAM_GT_ScheduledTasks() 356 356 { 357 357 global $conf, $user, $page; 358 358 359 if (!defined('PHPWG_ROOT_PATH')) 360 { 361 die('Hacking attempt!'); 362 } 363 364 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); 365 359 366 $conf_UAM = unserialize($conf['UserAdvManager']); 360 367 … … 377 384 if (in_array($user['id'], $collection)) 378 385 { 379 foreach ($collection as $user_id) 380 { 381 // Check lastvisit reminder state 382 $query = ' 386 // Check lastvisit reminder state 387 $query = ' 383 388 SELECT reminder 384 389 FROM '.USER_LASTVISIT_TABLE.' 385 WHERE user_id = '.$user_id.';'; 386 387 $result = pwg_db_fetch_assoc(pwg_query($query)); 388 389 if (isset($result['reminder']) and $result['reminder'] == 'true') 390 { 391 $reminder = true; 392 } 393 else 394 { 395 $reminder = false; 396 } 397 398 // If never reminded before, set reminder True 399 if (!$reminder) 400 { 401 // Reset of lastvisit date 402 list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();')); 403 404 $query = " 405 UPDATE ".USER_LASTVISIT_TABLE." 406 SET lastvisit='".$dbnow."' 407 WHERE user_id = '".$user_id."' 408 ;"; 409 pwg_query($query); 410 411 // Auto change group and / or status 412 // Delete user from all groups 413 $query = " 414 DELETE FROM ".USER_GROUP_TABLE." 415 WHERE user_id = '".$user_id."' 416 AND ( 417 group_id = '".$conf_UAM[2]."' 418 OR 419 group_id = '".$conf_UAM[3]."' 420 ) 421 ;"; 422 423 pwg_query($query); 424 425 // Change user status 426 if ($conf_UAM[27] <> -1) 427 { 428 $query = " 429 UPDATE ".USER_INFOS_TABLE." 430 SET status = '".$conf_UAM[27]."' 431 WHERE user_id = '".$user_id."' 432 ;"; 433 pwg_query($query); 434 } 435 436 // Change user group 437 if ($conf_UAM[26] <> -1) 438 { 439 $query = " 440 INSERT INTO ".USER_GROUP_TABLE." 441 (user_id, group_id) 442 VALUES 443 ('".$user_id."', '".$conf_UAM[26]."') 444 ;"; 445 pwg_query($query); 446 } 447 448 // Auto send email notification on group / status downgrade only if never reminded before 449 if (isset($conf_UAM[23]) and $conf_UAM[23] == 'true') 450 { 451 // Set reminder true 452 $query = " 453 UPDATE ".USER_LASTVISIT_TABLE." 454 SET reminder = 'true' 455 WHERE user_id = '".$user_id."' 456 ;"; 457 pwg_query($query); 458 459 // Reset confirmed user date_check 460 $query = ' 461 UPDATE '.USER_CONFIRM_MAIL_TABLE.' 462 SET date_check = NULL 463 WHERE user_id = "'.$user_id.'" 464 ;'; 465 pwg_query($query); 466 467 // Get users information for email notification 468 $query = ' 469 SELECT username, mail_address 470 FROM '.USERS_TABLE.' 471 WHERE id = '.$user_id.' 472 ;'; 473 $data = pwg_db_fetch_assoc(pwg_query($query)); 474 475 demotion_mail($user_id, $data['username'], $data['mail_address']); 476 } 477 } 478 elseif ($reminder) // If user already reminded for ghost account 479 { 480 // delete account 481 delete_user($user_id); 482 } 390 WHERE user_id = '.$user['id'].';'; 391 392 $result = pwg_db_fetch_assoc(pwg_query($query)); 393 394 if (isset($result['reminder']) and $result['reminder'] == 'true') 395 { 396 $reminder = true; 483 397 } 484 485 if (!$reminder) // If user never reminded for ghost account 398 else 486 399 { 487 // Logged-in user cleanup 400 $reminder = false; 401 } 402 403 // If never reminded before, set reminder True 404 if ($reminder) // If user already reminded for ghost account 405 { 406 // delete account 407 delete_user($user['id']); 408 409 // Logged-in user cleanup, session destruction and redirected to custom page 488 410 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); 411 logout_user(); 497 412 redirect(UAM_PATH.'del_account.php'); 498 413 } … … 1097 1012 // Management of Extension flags ([username], [mygallery], [myurl]) 1098 1013 $patterns[] = '#\[username\]#i'; 1099 $replacements[] = $username;1014 $replacements[] = stripslashes($username); 1100 1015 $patterns[] = '#\[mygallery\]#i'; 1101 1016 $replacements[] = $conf['gallery_title']; … … 1122 1037 ); 1123 1038 1039 resetlastvisit($id); 1124 1040 1125 1041 // Sending the email with subject and contents … … 1196 1112 // Management of Extension flags ([username], [mygallery], [myurl]) 1197 1113 $patterns[] = '#\[username\]#i'; 1198 $replacements[] = $ username;1114 $replacements[] = $result['username']; 1199 1115 $patterns[] = '#\[mygallery\]#i'; 1200 1116 $replacements[] = $conf['gallery_title']; … … 2197 2113 $score = $step1 * $step2; 2198 2114 2199 // Multiplication du r ésultat par la longueur de la chaîne - Multiplying the result by the length of the chain2115 // Multiplication du resultat par la longueur de la chaine - Multiplying the result by the length of the string 2200 2116 $finalscore = $score * $length; 2201 2117
Note: See TracChangeset
for help on using the changeset viewer.