Changeset 8087 for extensions/NBC_UserAdvManager
- Timestamp:
- Dec 12, 2010, 12:02:15 AM (13 years ago)
- Location:
- extensions/NBC_UserAdvManager/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/NBC_UserAdvManager/trunk/changelog.txt.php
r8072 r8087 211 211 ***** Plugin history (branch 2.16)***** 212 212 *************************************** 213 -- 2.16.0 : Bug 1430 and 1840 fixed - Automated tasks are available to delete or downgrade ghost users with or without email notification 214 Bug 1585 fixed - UAM version is set in database to improve future upgrades 213 -- 2.16.0 : Bug 1585 fixed - UAM version is set in database to improve future upgrades 215 214 Bug 2011 fixed - Text fields are no longer locked if related option button is not set and saved. Now this fields and unused options are hidden 216 215 Bug 2046 fixed - Using Piwigo's $conf['insensitive_case_logon'] = true option works again with UAM 217 216 Bug 2053 fixed - Manual validation by admins wasn't working correctly 217 Bug 2054 218 Bug 2056 fixed - Automated tasks are available to delete or downgrade ghost users with or without email notification 219 Add of Latvian (lv_LV) translation (Thx to Aivars Baldone) 218 220 219 221 */ -
extensions/NBC_UserAdvManager/trunk/include/functions.inc.php
r8072 r8087 322 322 $conf_UAM = unserialize($conf['UserAdvManager']); 323 323 324 // Performing scheduled tasks 324 // Performing scheduled tasks 325 if ((isset($conf_UAM[22]) and $conf_UAM[22] == 'true')) 326 { 327 UAM_ScheduledTasks(); 328 } 329 325 330 if ((isset($conf_UAM[21]) and $conf_UAM[21] == 'true')) 326 331 { 327 if ((isset($conf_UAM[22]) and $conf_UAM[22] == 'true')) 328 { 329 UAM_ScheduledTasks(); 330 } 331 } 332 333 // Performing redirection 334 $query =' 332 // Performing redirection 333 $query =' 335 334 SELECT user_id, status 336 335 FROM '.USER_INFOS_TABLE.' 337 336 WHERE user_id = '.$user['id'].' 338 337 ;'; 339 $data = pwg_db_fetch_assoc(pwg_query($query)); 340 341 if ($data['status'] <> "admin" and $data['status'] <> "webmaster" and $data['status'] <> "generic") 342 { 343 $user_idsOK = array(); 344 if (!UAM_check_profile($user['id'], $user_idsOK)) 345 redirect(PHPWG_ROOT_PATH.'profile.php'); 338 $data = pwg_db_fetch_assoc(pwg_query($query)); 339 340 if ($data['status'] <> "admin" and $data['status'] <> "webmaster" and $data['status'] <> "generic") 341 { 342 $user_idsOK = array(); 343 if (!UAM_check_profile($user['id'], $user_idsOK)) 344 redirect(PHPWG_ROOT_PATH.'profile.php'); 345 } 346 346 } 347 347 } … … 360 360 361 361 $collection = array(); 362 $reminder = false; 362 363 363 364 $page['filtered_users'] = get_ghosts_autotasks(); 364 365 365 { 366 foreach($page['filtered_users'] as $listed_user) 367 { 368 array_push($collection, $listed_user['id']); 369 } 370 366 foreach($page['filtered_users'] as $listed_user) 367 { 368 array_push($collection, $listed_user['id']); 369 } 370 371 // Ghost accounts auto deletion 372 if ((isset($conf_UAM[22]) and $conf_UAM[22] == 'true') and (isset($conf_UAM[23]) and $conf_UAM[23] == 'true')) 373 { 371 374 if (count($collection) > 0) 372 375 { … … 377 380 foreach ($collection as $user_id) 378 381 { 379 //delete_user($user_id);382 delete_user($user_id); 380 383 } 381 384 logout_user(); … … 386 389 foreach ($collection as $user_id) 387 390 { 388 //delete_user($user_id);391 delete_user($user_id); 389 392 } 390 393 } … … 392 395 } 393 396 394 // Ghost accounts auto group or status downgrade with or without information email sending 397 // Ghost accounts auto group or status downgrade with or without information email sending and autodeletion if user already reminded 395 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))) 396 { 397 foreach($page['filtered_users'] as $listed_user) 398 { 399 array_push($collection, $listed_user['id']); 400 } 401 399 { 402 400 if (count($collection) > 0) 403 401 { 404 if (in_array($user['id'], $collection)) 405 { 402 // Process if a non-admin nor webmaster user is logged 403 if (in_array($user['id'], $collection)) 404 { 406 405 foreach ($collection as $user_id) 407 406 { 407 // Check lastvisit reminder state 408 $query = ' 409 SELECT reminder 410 FROM '.USER_LASTVISIT_TABLE.' 411 WHERE user_id = '.$user_id.';'; 412 413 $result = pwg_db_fetch_assoc(pwg_query($query)); 414 415 if (isset($result['reminder']) and $result['reminder'] == 'true') 416 { 417 $reminder = true; 418 } 419 else 420 { 421 $reminder = false; 422 } 423 424 // If never reminded before, set reminder True 425 if (!$reminder) 426 { 427 // Reset of lastvisit date 428 list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();')); 429 430 $query = " 431 UPDATE ".USER_LASTVISIT_TABLE." 432 SET lastvisit='".$dbnow."' 433 WHERE user_id = '".$user_id."' 434 ;"; 435 pwg_query($query); 436 408 437 // Auto change group and / or status 409 // Delete user from all groups410 $query = "438 // Delete user from all groups 439 $query = " 411 440 DELETE FROM ".USER_GROUP_TABLE." 412 441 WHERE user_id = '".$user_id."' … … 418 447 ;"; 419 448 420 pwg_query($query);421 422 // Change user status423 if (!is_admin() and$conf_UAM[28] <> -1)424 {425 $query = "449 pwg_query($query); 450 451 // Change user status 452 if ($conf_UAM[28] <> -1) 453 { 454 $query = " 426 455 UPDATE ".USER_INFOS_TABLE." 427 456 SET status = '".$conf_UAM[28]."' 428 457 WHERE user_id = '".$user_id."' 429 458 ;"; 430 pwg_query($query);431 }432 433 // Change user group434 if (!is_admin() and$conf_UAM[27] <> -1)435 {436 $query = "459 pwg_query($query); 460 } 461 462 // Change user group 463 if ($conf_UAM[27] <> -1) 464 { 465 $query = " 437 466 INSERT INTO ".USER_GROUP_TABLE." 438 467 (user_id, group_id) … … 440 469 ('".$user_id."', '".$conf_UAM[27]."') 441 470 ;"; 442 pwg_query($query);443 }471 pwg_query($query); 472 } 444 473 445 // Auto send email notification on group / status downgrade 446 if ((isset($conf_UAM[24]) and $conf_UAM[24] == 'true')) 447 { 448 // Reset confirmed user status to unvalidated 449 $query = ' 474 // Auto send email notification on group / status downgrade only if never reminded before 475 if (isset($conf_UAM[24]) and $conf_UAM[24] == 'true') 476 { 477 // Set reminder true 478 $query = " 479 UPDATE ".USER_LASTVISIT_TABLE." 480 SET reminder = 'true' 481 WHERE user_id = '".$user_id."' 482 ;"; 483 pwg_query($query); 484 485 // Reset confirmed user date_check 486 $query = ' 450 487 UPDATE '.USER_CONFIRM_MAIL_TABLE.' 451 488 SET date_check = NULL 452 489 WHERE user_id = "'.$user_id.'" 453 490 ;'; 454 pwg_query($query);455 456 // Get users information for email notification457 $query = '458 SELECT id,username, mail_address491 pwg_query($query); 492 493 // Get users information for email notification 494 $query = ' 495 SELECT username, mail_address 459 496 FROM '.USERS_TABLE.' 460 497 WHERE id = '.$user_id.' 461 498 ;'; 462 $data = pwg_db_fetch_assoc(pwg_query($query));499 $data = pwg_db_fetch_assoc(pwg_query($query)); 463 500 464 demotion_mail($user_id, $data['username'], $data['mail_address']); 501 demotion_mail($user_id, $data['username'], $data['mail_address']); 502 } 503 } 504 elseif ($reminder) // If user already reminded for ghost account 505 { 506 // delete account 507 delete_user($user_id); 465 508 } 466 509 } 510 // Logged-in user cleanup 467 511 invalidate_user_cache(); 468 512 log_user($user['id'], false); 469 513 redirect(make_index_url()); 470 514 } 471 else 515 else // Process if an admin or webmaster user is logged 472 516 { 473 517 foreach ($collection as $user_id) 474 518 { 519 // Check lastvisit reminder state 520 $query = ' 521 SELECT reminder 522 FROM '.USER_LASTVISIT_TABLE.' 523 WHERE user_id = '.$user_id.';'; 524 525 $result = pwg_db_fetch_assoc(pwg_query($query)); 526 527 if (isset($result['reminder']) and $result['reminder'] == 'true') 528 { 529 $reminder = true; 530 } 531 else 532 { 533 $reminder = false; 534 } 535 536 // If never reminded before 537 if (!$reminder) 538 { 539 // Reset of lastvisit date 540 list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();')); 541 542 $query = " 543 UPDATE ".USER_LASTVISIT_TABLE." 544 SET lastvisit='".$dbnow."' 545 WHERE user_id = '".$user_id."' 546 ;"; 547 pwg_query($query); 548 475 549 // Auto change group and / or status 476 // Delete user from all groups477 $query = "550 // Delete user from all groups 551 $query = " 478 552 DELETE FROM ".USER_GROUP_TABLE." 479 553 WHERE user_id = '".$user_id."' … … 484 558 ) 485 559 ;"; 486 487 pwg_query($query); 488 489 // Change user status 490 if (!is_admin() and $conf_UAM[28] <> -1) 491 { 492 $query = " 560 pwg_query($query); 561 562 // Change user status 563 if ($conf_UAM[28] <> -1) 564 { 565 $query = " 493 566 UPDATE ".USER_INFOS_TABLE." 494 567 SET status = '".$conf_UAM[28]."' 495 568 WHERE user_id = '".$user_id."' 496 569 ;"; 497 pwg_query($query);498 }499 500 // Change user group501 if (!is_admin() and$conf_UAM[27] <> -1)502 {503 $query = "570 pwg_query($query); 571 } 572 573 // Change user group 574 if ($conf_UAM[27] <> -1) 575 { 576 $query = " 504 577 INSERT INTO ".USER_GROUP_TABLE." 505 578 (user_id, group_id) … … 507 580 ('".$user_id."', '".$conf_UAM[27]."') 508 581 ;"; 509 pwg_query($query); 510 } 511 512 // Auto send email notification on group / status downgrade 513 if ((isset($conf_UAM[24]) and $conf_UAM[24] == 'true')) 514 { 515 // Reset confirmed user status to unvalidated 516 $query = ' 582 pwg_query($query); 583 } 584 585 // Auto send email notification on group / status downgrade 586 if (isset($conf_UAM[24]) and $conf_UAM[24] == 'true') 587 { 588 // Set reminder true 589 $query = " 590 UPDATE ".USER_LASTVISIT_TABLE." 591 SET reminder = 'true' 592 WHERE user_id = '".$user_id."' 593 ;"; 594 pwg_query($query); 595 596 // Reset confirmed user status to unvalidated 597 $query = ' 517 598 UPDATE '.USER_CONFIRM_MAIL_TABLE.' 518 599 SET date_check = NULL 519 600 WHERE user_id = "'.$user_id.'" 520 601 ;'; 521 pwg_query($query);522 523 // Get users information for email notification524 $query = '602 pwg_query($query); 603 604 // Get users information for email notification 605 $query = ' 525 606 SELECT id, username, mail_address 526 607 FROM '.USERS_TABLE.' 527 608 WHERE id = '.$user_id.' 528 609 ;'; 529 $data = pwg_db_fetch_assoc(pwg_query($query));610 $data = pwg_db_fetch_assoc(pwg_query($query)); 530 611 531 demotion_mail($user_id, $data['username'], $data['mail_address']); 612 demotion_mail($user_id, $data['username'], $data['mail_address']); 613 } 614 } 615 elseif ($reminder) // If user already reminded for ghost account 616 { 617 // delete account 618 delete_user($user_id); 532 619 } 533 620 } … … 1429 1516 global $conf; 1430 1517 1431 include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');1432 1433 1518 $conf_UAM = unserialize($conf['UserAdvManager']); 1434 1519 … … 1752 1837 $query = ' 1753 1838 SELECT DISTINCT u.'.$conf['user_fields']['id'].' AS id, 1754 lv.lastvisit, 1755 lv.reminder 1839 lv.lastvisit 1756 1840 FROM '.USERS_TABLE.' AS u 1757 1841 INNER JOIN '.USER_LASTVISIT_TABLE.' AS lv 1758 1842 ON u.'.$conf['user_fields']['id'].' = lv.user_id 1759 1843 WHERE (TO_DAYS(NOW()) - TO_DAYS(lv.lastvisit) >= "'.$conf_UAM[17].'") 1760 AND lv.reminder = "true"1761 1844 ORDER BY lv.lastvisit ASC;'; 1762 1845 -
extensions/NBC_UserAdvManager/trunk/language/fr_FR/help/plugin.lang.php
r8065 r8087 190 190 Note : Lorsque cette option est active, les autres règles automatiques ne sont pas accessibles.'; 191 191 $lang['UAM_GTAutoGpTitle'] = 'Changement automatique de groupe / statut'; 192 $lang['UAM_GTAutoGpTitle_d'] = 'Le changement automatique de groupe ou de statut équivaut à une rétrogradation des comptes concernés et fonctionne sur le même principe que le groupe ou le statut de validation (voir "Paramétrage des confirmations et validations d\'inscriptions"). Il conviendra donc de définir un groupe et/ou un statut rétrogradant l\'accès à la galerie. Si cela a déjà été défini avec l\'utilisation de la fonction Confirmation d\'inscription, on peut utiliser ces mêmes groupe / statut.'; 192 $lang['UAM_GTAutoGpTitle_d'] = 'Le changement automatique de groupe ou de statut équivaut à une rétrogradation des comptes concernés et fonctionne sur le même principe que le groupe ou le statut de validation (voir "Paramétrage des confirmations et validations d\'inscriptions"). Il conviendra donc de définir un groupe et/ou un statut rétrogradant l\'accès à la galerie. Si cela a déjà été défini avec l\'utilisation de la fonction Confirmation d\'inscription, on peut utiliser ces mêmes groupe / statut.<br><br> 193 <b style="color: red;">Point important :</b> Si un utilisateur fantôme n\'a toujours pas donné signe de vie après le délai imparti malgré la notification par mail, il est automatiquement supprimé de la base de données.'; 193 194 $lang['UAM_GTAutoMailTitle'] = 'Email automatique sur changement de groupe / statut'; 194 195 $lang['UAM_GTAutoMailTitle_d'] = 'Lorsqu\'un compte est expiré (changement de groupe / statut rétrogradant le visiteur), un email d\'information peut être envoyé pour préciser les raisons de ce changement et le moyen de recouvrer l\'accès initial à la galerie.
Note: See TracChangeset
for help on using the changeset viewer.