- Timestamp:
- Sep 19, 2011, 9:48:39 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/UserAdvManager/trunk/include/functions.inc.php
r11318 r12189 100 100 $passwd = (isset($_POST['password'])) ? $_POST['password'] : ''; 101 101 SendMail2User(1, $register_user['id'], $register_user['username'], $passwd, $register_user['email'], false); 102 setgroup($register_user['id']);// Set to "waiting" group or status until admin validation102 SetPermission($register_user['id']);// Set to "waiting" group or status until admin validation 103 103 } 104 104 elseif ((isset($conf_UAM[0]) and $conf_UAM[0] == 'false') and (isset($conf_UAM[1]) and $conf_UAM[1] == 'local')) 105 105 { 106 106 // This is to set user to "waiting" group or status until admin validation 107 setgroup($register_user['id']);// Set to "waiting" group or status until admin validation107 SetPermission($register_user['id']);// Set to "waiting" group or status until admin validation 108 108 } 109 109 elseif ((isset($conf_UAM[0]) and $conf_UAM[0] == 'true') and (isset($conf_UAM[1]) and $conf_UAM[1] == 'false')) … … 296 296 if ($_POST['mail_address'] != $current_email and (isset($conf_UAM[1]) and $conf_UAM[1] == 'local')) 297 297 298 setgroup($register_user['id']);// Set to "waiting" group or status until admin validation298 SetPermission($register_user['id']);// Set to "waiting" group or status until admin validation 299 299 $confirm_mail_need = false; 300 300 } … … 407 407 } 408 408 409 // Ghost accounts auto group or statusdowngrade with or without information email sending and autodeletion if user already reminded410 if ((isset($conf_UAM[21]) and $conf_UAM[21] == 'true') and ((isset($conf_UAM[25]) and $conf_UAM[25] <> -1) or (isset($conf_UAM[26]) and $conf_UAM[26] <> -1) ))409 // Ghost accounts auto group, status or privacy level downgrade with or without information email sending and autodeletion if user already reminded 410 if ((isset($conf_UAM[21]) and $conf_UAM[21] == 'true') and ((isset($conf_UAM[25]) and $conf_UAM[25] <> -1) or (isset($conf_UAM[26]) and $conf_UAM[26] <> -1) or (isset($conf_UAM[37]) and $conf_UAM[37] <> -1))) 411 411 { 412 412 if (count($collection) > 0) … … 510 510 VALUES 511 511 ('".$user_id."', '".$conf_UAM[25]."') 512 ;"; 513 pwg_query($query); 514 } 515 516 // Change user privacy level 517 if ($conf_UAM[37] <> -1) 518 { 519 $query = " 520 UPDATE ".USER_INFOS_TABLE." 521 SET level = '".$conf_UAM[37]."' 522 WHERE user_id = '".$user_id."' 512 523 ;"; 513 524 pwg_query($query); … … 1363 1374 pwg_query($query); 1364 1375 } 1376 1377 // Set user unvalidated privacy level 1378 if (!is_admin() and $conf_UAM[35] <> -1) 1379 { 1380 $query = " 1381 UPDATE ".USER_INFOS_TABLE." 1382 SET level = '".$conf_UAM[35]."' 1383 WHERE user_id = '".$user_id."' 1384 ;"; 1385 pwg_query($query); 1386 } 1365 1387 1366 1388 return get_absolute_root_url().UAM_PATH.'ConfirmMail.php?key='.$Confirm_Mail_ID.'&userid='.$user_id; … … 1370 1392 1371 1393 /** 1372 * Function called from main.inc.php to set groupto new users if manual validation is set1394 * Function called from UAM_Adduser() to set group/status/level to new users if manual validation is set 1373 1395 * 1374 1396 * @param : User id … … 1376 1398 * 1377 1399 */ 1378 function setgroup($user_id)1400 function SetPermission($user_id) 1379 1401 { 1380 1402 global $conf; … … 1382 1404 $conf_UAM = unserialize($conf['UserAdvManager']); 1383 1405 1406 // Groups cleanup 1384 1407 $query = " 1385 1408 DELETE FROM ".USER_GROUP_TABLE." … … 1393 1416 pwg_query($query); 1394 1417 1395 if (!is_admin() and $conf_UAM[7] <> -1) 1418 if (!is_admin() and $conf_UAM[7] <> -1) // Set status 1396 1419 { 1397 1420 $query = " … … 1403 1426 } 1404 1427 1405 if (!is_admin() and $conf_UAM[2] <> -1) 1428 if (!is_admin() and $conf_UAM[2] <> -1) // Set group 1406 1429 { 1407 1430 $query = " … … 1410 1433 VALUES 1411 1434 ('".$user_id."', '".$conf_UAM[2]."') 1435 ;"; 1436 pwg_query($query); 1437 } 1438 1439 if (!is_admin() and $conf_UAM[2] <> -1) // Set privacy level 1440 { 1441 $query = " 1442 INSERT INTO ".USER_INFOS_TABLE." 1443 (user_id, level) 1444 VALUES 1445 ('".$user_id."', '".$conf_UAM[level]."') 1412 1446 ;"; 1413 1447 pwg_query($query); … … 1600 1634 list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();')); 1601 1635 1636 // Update ConfirmMail table 1602 1637 $query = ' 1603 1638 UPDATE '.USER_CONFIRM_MAIL_TABLE.' 1604 1639 SET date_check="'.$dbnow.'", reminder="false" 1605 1640 WHERE id = "'.$id.'" 1641 ;'; 1642 pwg_query($query); 1643 1644 // Update LastVisit table - Force reminder field to false 1645 // Usefull when a user has been automatically downgraded and revalidate its registration 1646 $query = ' 1647 UPDATE '.USER_LASTVISIT_TABLE.' 1648 SET reminder="false" 1649 WHERE user_id = "'.$data['user_id'].'" 1606 1650 ;'; 1607 1651 pwg_query($query); … … 1637 1681 pwg_query($query); 1638 1682 } 1683 1684 if (($conf_UAM[36] <> -1 or isset($data['level']))) // Change user's privacy level 1685 { 1686 $query = " 1687 UPDATE ".USER_INFOS_TABLE." 1688 SET level = '".(isset($data['level']) ? $data['level'] : $conf_UAM[36])."' 1689 WHERE user_id = '".$data['user_id']."' 1690 ;"; 1691 pwg_query($query); 1692 } 1693 1639 1694 // Refresh user's category cache 1640 1695 invalidate_user_cache(); … … 1652 1707 list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();')); 1653 1708 1709 // Update ConfirmMail table 1654 1710 $query = ' 1655 1711 UPDATE '.USER_CONFIRM_MAIL_TABLE.' … … 1658 1714 ;'; 1659 1715 pwg_query($query); 1716 1717 // Update LastVisit table - Force reminder field to false 1718 // Usefull when a user has been automatically downgraded and revalidate its registration 1719 $query = ' 1720 UPDATE '.USER_LASTVISIT_TABLE.' 1721 SET reminder="false" 1722 WHERE user_id = "'.$data['user_id'].'" 1723 ;'; 1724 pwg_query($query); 1660 1725 1661 if ($conf_UAM[2] <> -1) 1726 if ($conf_UAM[2] <> -1) // Delete user from unvalidated users group 1662 1727 { 1663 1728 $query = " … … 1687 1752 } 1688 1753 1689 if (($conf_UAM[4] <> -1 or isset($data['status']))) 1754 if (($conf_UAM[4] <> -1 or isset($data['status']))) // Change user's status 1690 1755 { 1691 1756 $query = " … … 1696 1761 pwg_query($query); 1697 1762 } 1763 1764 if (($conf_UAM[36] <> -1 or isset($data['level']))) // Change user's privacy level 1765 { 1766 $query = " 1767 UPDATE ".USER_INFOS_TABLE." 1768 SET level = '".(isset($data['level']) ? $data['level'] : $conf_UAM[36])."' 1769 WHERE user_id = '".$data['user_id']."' 1770 ;"; 1771 pwg_query($query); 1772 } 1773 1698 1774 // Refresh user's category cache 1699 1775 invalidate_user_cache(); … … 1742 1818 } 1743 1819 1744 if ($conf_UAM[3] <> -1) 1820 if ($conf_UAM[3] <> -1) // Change user's group 1745 1821 { 1746 1822 $query = " … … 1760 1836 } 1761 1837 1762 if ($conf_UAM[4] <> -1) 1838 if ($conf_UAM[4] <> -1) // Change user's status 1763 1839 { 1764 1840 $query = " … … 1769 1845 pwg_query($query); 1770 1846 } 1847 1848 if ($conf_UAM[36] <> -1) // Change user's privacy level 1849 { 1850 $query = " 1851 UPDATE ".USER_INFOS_TABLE." 1852 SET level = '".$conf_UAM[36]."' 1853 WHERE user_id = '".$id."' 1854 ;"; 1855 pwg_query($query); 1856 } 1771 1857 } 1772 1858 elseif (isset($conf_UAM[1]) and $conf_UAM[1] == 'local') … … 1774 1860 list($dbnow) = pwg_db_fetch_row(pwg_query('SELECT NOW();')); 1775 1861 1776 if ($conf_UAM[2] <> -1) 1862 if ($conf_UAM[2] <> -1) // Delete user's from waiting group 1777 1863 { 1778 1864 $query = " … … 1784 1870 } 1785 1871 1786 if ($conf_UAM[3] <> -1) 1872 if ($conf_UAM[3] <> -1) // Change user's group 1787 1873 { 1788 1874 $query = " … … 1802 1888 } 1803 1889 1804 if ($conf_UAM[4] <> -1) 1890 if ($conf_UAM[4] <> -1) // Change user's status 1805 1891 { 1806 1892 $query = " 1807 1893 UPDATE ".USER_INFOS_TABLE." 1808 1894 SET status = '".$conf_UAM[4]."' 1895 WHERE user_id = '".$id."' 1896 ;"; 1897 pwg_query($query); 1898 } 1899 1900 if ($conf_UAM[36] <> -1) // Change user's privacy level 1901 { 1902 $query = " 1903 UPDATE ".USER_INFOS_TABLE." 1904 SET level = '".$conf_UAM[36]."' 1809 1905 WHERE user_id = '".$id."' 1810 1906 ;";
Note: See TracChangeset
for help on using the changeset viewer.