Changeset 26077
- Timestamp:
- Dec 22, 2013, 2:26:22 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/UserAdvManager/trunk/include/functions.inc.php
r25092 r26077 1281 1281 ); 1282 1282 1283 UAM_mail_notification_admins($subject, $content); 1283 //UAM_mail_notification_admins($subject, $content); 1284 pwg_mail_notification_admins($subject, $content, true); 1284 1285 } 1285 1286 elseif ((isset($conf_UAM['CONFIRM_MAIL']) and $conf_UAM['CONFIRM_MAIL'] == 'true') and $confirm) … … 1288 1289 if (isset($conf_UAM['ADD_GALLERY_URL_TO_EMAILS']) and $conf_UAM['ADD_GALLERY_URL_TO_EMAILS'] == 'true') 1289 1290 { 1290 pwg_mail($email, array( 1291 'subject' => $subject, 1292 'content' => (isset($infos1) ? $infos1_perso.l10n_args($infos1)."\n\n" : "").(isset($infos2) ? $infos2_perso.l10n_args($infos2)."\n\n" : "").get_absolute_root_url(), 1293 )); 1291 $content = (isset($infos1) ? $infos1_perso.l10n_args($infos1)."\n\n" : "").(isset($infos2) ? $infos2_perso.l10n_args($infos2)."\n\n" : "").get_absolute_root_url(); 1292 1293 pwg_mail( 1294 array( 1295 'name' => stripslashes($username), 1296 'email' => $email, 1297 ), 1298 array( 1299 'content' => $content, 1300 'content_format' => 'text/plain', 1301 'subject' => $subject, 1302 ) 1303 ); 1294 1304 } 1295 1305 // Do not add gallery URL at the end of the email 1296 1306 elseif (isset($conf_UAM['ADD_GALLERY_URL_TO_EMAILS']) and $conf_UAM['ADD_GALLERY_URL_TO_EMAILS'] == 'false') 1297 1307 { 1298 pwg_mail($email, array( 1299 'subject' => $subject, 1300 'content' => (isset($infos1) ? $infos1_perso.l10n_args($infos1)."\n\n" : "").(isset($infos2) ? $infos2_perso.l10n_args($infos2)."\n\n" : ""), 1301 )); 1308 $content = (isset($infos1) ? $infos1_perso.l10n_args($infos1)."\n\n" : "").(isset($infos2) ? $infos2_perso.l10n_args($infos2)."\n\n" : ""); 1309 1310 pwg_mail( 1311 array( 1312 'name' => stripslashes($username), 1313 'email' => $email, 1314 ), 1315 array( 1316 'content' => $content, 1317 'content_format' => 'text/plain', 1318 'subject' => $subject, 1319 ) 1320 ); 1302 1321 } 1303 1322 // By default do not add gallery URL at the end of the email 1304 1323 else 1305 1324 { 1306 pwg_mail($email, array( 1307 'subject' => $subject, 1308 'content' => (isset($infos1) ? $infos1_perso.l10n_args($infos1)."\n\n" : "").(isset($infos2) ? $infos2_perso.l10n_args($infos2)."\n\n" : ""), 1309 )); 1325 $content = (isset($infos1) ? $infos1_perso.l10n_args($infos1)."\n\n" : "").(isset($infos2) ? $infos2_perso.l10n_args($infos2)."\n\n" : ""); 1326 1327 pwg_mail( 1328 array( 1329 'name' => stripslashes($username), 1330 'email' => $email, 1331 ), 1332 array( 1333 'content' => $content, 1334 'content_format' => 'text/plain', 1335 'subject' => $subject, 1336 ) 1337 ); 1310 1338 } 1311 1339 } … … 1313 1341 // ---------------------------------- 1314 1342 switch_lang_back(); 1315 }1316 1317 1318 /**1319 * Function called from SendMail2User in functions.inc.php to notify admins on user registration validation with validation key1320 *1321 * @param:1322 * - keyargs_subject: mail subject on l10n_args format1323 * - keyargs_content: mail content on l10n_args format1324 *1325 * @return boolean (Ok or not)1326 */1327 function UAM_mail_notification_admins($keyargs_subject, $keyargs_content)1328 {1329 global $conf, $user;1330 1331 // Check arguments1332 if (empty($keyargs_subject) or empty($keyargs_content))1333 {1334 return false;1335 }1336 1337 $return = true;1338 1339 $admins = array();1340 1341 $query = '1342 SELECT1343 u.username AS username,1344 u.mail_address AS mail_address1345 FROM '.USERS_TABLE.' AS u1346 JOIN '.USER_INFOS_TABLE.' AS i ON i.user_id = id1347 WHERE i.status in (\'webmaster\', \'admin\')1348 AND mail_address IS NOT NULL1349 AND i.user_id = id1350 ORDER BY username1351 ;';1352 1353 $datas = pwg_query($query);1354 if (!empty($datas))1355 {1356 while ($admin = pwg_db_fetch_assoc($datas))1357 {1358 if (!empty($admin['mail_address']))1359 {1360 array_push($admins, format_email($admin['username'], $admin['mail_address']));1361 }1362 }1363 }1364 1365 if (count($admins) > 0)1366 {1367 $content = l10n_args($keyargs_content)."\n";1368 1369 $return = pwg_mail(1370 implode(', ', $admins),1371 array(1372 'subject' => '['.$conf['gallery_title'].'] '.l10n_args($keyargs_subject),1373 'content' => $content,1374 'content_format' => 'text/plain',1375 'email_format' => 'text/plain',1376 )1377 );1378 }1379 1380 return $return;1381 1343 } 1382 1344 … … 1532 1494 if (isset($conf_UAM['ADD_GALLERY_URL_TO_EMAILS']) and $conf_UAM['ADD_GALLERY_URL_TO_EMAILS'] == 'true') 1533 1495 { 1534 pwg_mail($email, array( 1535 'subject' => $subject, 1536 'content' => ($infos1."\n\n").(isset($infos2) ? l10n_args($infos2)."\n\n" : "").get_absolute_root_url(), 1537 )); 1496 $content = ($infos1."\n\n").(isset($infos2) ? l10n_args($infos2)."\n\n" : "").get_absolute_root_url(); 1497 1498 pwg_mail( 1499 array( 1500 'name' => stripslashes($username), 1501 'email' => $email, 1502 ), 1503 array( 1504 'content' => $content, 1505 'content_format' => 'text/plain', 1506 'subject' => $subject, 1507 ) 1508 ); 1538 1509 } 1539 1510 // Do not add gallery URL at the end of the email 1540 1511 elseif (isset($conf_UAM['ADD_GALLERY_URL_TO_EMAILS']) and $conf_UAM['ADD_GALLERY_URL_TO_EMAILS'] == 'false') 1541 1512 { 1542 pwg_mail($email, array( 1543 'subject' => $subject, 1544 'content' => ($infos1."\n\n").(isset($infos2) ? l10n_args($infos2)."\n\n" : ""), 1545 )); 1513 $content = ($infos1."\n\n").(isset($infos2) ? l10n_args($infos2)."\n\n" : ""); 1514 1515 pwg_mail( 1516 array( 1517 'name' => stripslashes($username), 1518 'email' => $email, 1519 ), 1520 array( 1521 'content' => $content, 1522 'content_format' => 'text/plain', 1523 'subject' => $subject, 1524 ) 1525 ); 1546 1526 } 1547 1527 // By default do not add gallery URL at the end of the email 1548 1528 else 1549 1529 { 1550 pwg_mail($email, array( 1551 'subject' => $subject, 1552 'content' => ($infos1."\n\n").(isset($infos2) ? l10n_args($infos2)."\n\n" : ""), 1553 )); 1530 $content = ($infos1."\n\n").(isset($infos2) ? l10n_args($infos2)."\n\n" : ""); 1531 1532 pwg_mail( 1533 array( 1534 'name' => stripslashes($username), 1535 'email' => $email, 1536 ), 1537 array( 1538 'content' => $content, 1539 'content_format' => 'text/plain', 1540 'subject' => $subject, 1541 ) 1542 ); 1554 1543 } 1555 1544 … … 1635 1624 if (isset($conf_UAM['ADD_GALLERY_URL_TO_EMAILS']) and $conf_UAM['ADD_GALLERY_URL_TO_EMAILS'] == 'true') 1636 1625 { 1637 pwg_mail($email, array( 1638 'subject' => $subject, 1639 'content' => $infos1.get_absolute_root_url(), 1640 )); 1626 $content = $infos1.get_absolute_root_url(); 1627 1628 pwg_mail( 1629 array( 1630 'name' => stripslashes($username), 1631 'email' => $email, 1632 ), 1633 array( 1634 'content' => $content, 1635 'content_format' => 'text/plain', 1636 'subject' => $subject, 1637 ) 1638 ); 1641 1639 } 1642 1640 // Do not add gallery URL at the end of the email 1643 1641 elseif (isset($conf_UAM['ADD_GALLERY_URL_TO_EMAILS']) and $conf_UAM['ADD_GALLERY_URL_TO_EMAILS'] == 'false') 1644 1642 { 1645 pwg_mail($email, array( 1646 'subject' => $subject, 1647 'content' => $infos1, 1648 )); 1643 $content = $infos1; 1644 1645 pwg_mail( 1646 array( 1647 'name' => stripslashes($username), 1648 'email' => $email, 1649 ), 1650 array( 1651 'content' => $content, 1652 'content_format' => 'text/plain', 1653 'subject' => $subject, 1654 ) 1655 ); 1649 1656 } 1650 1657 // By default do not add gallery URL at the end of the email 1651 1658 else 1652 1659 { 1653 pwg_mail($email, array( 1654 'subject' => $subject, 1655 'content' => $infos1, 1656 )); 1660 $content = $infos1; 1661 1662 pwg_mail( 1663 array( 1664 'name' => stripslashes($username), 1665 'email' => $email, 1666 ), 1667 array( 1668 'content' => $content, 1669 'content_format' => 'text/plain', 1670 'subject' => $subject, 1671 ) 1672 ); 1657 1673 } 1658 1674 … … 1761 1777 if (isset($conf_UAM['ADD_GALLERY_URL_TO_EMAILS']) and $conf_UAM['ADD_GALLERY_URL_TO_EMAILS'] == 'true') 1762 1778 { 1763 pwg_mail($email, array( 1764 'subject' => $subject, 1765 'content' => ($custom_txt.l10n_args($infos1)."\n\n".l10n_args($infos2)."\n\n").get_absolute_root_url(), 1766 )); 1779 $content = ($custom_txt.l10n_args($infos1)."\n\n".l10n_args($infos2)."\n\n").get_absolute_root_url(); 1780 1781 pwg_mail( 1782 array( 1783 'name' => stripslashes($username), 1784 'email' => $email, 1785 ), 1786 array( 1787 'content' => $content, 1788 'content_format' => 'text/plain', 1789 'subject' => $subject, 1790 ) 1791 ); 1767 1792 } 1768 1793 // Do not add gallery URL at the end of the email 1769 1794 elseif (isset($conf_UAM['ADD_GALLERY_URL_TO_EMAILS']) and $conf_UAM['ADD_GALLERY_URL_TO_EMAILS'] == 'false') 1770 1795 { 1771 pwg_mail($email, array( 1772 'subject' => $subject, 1773 'content' => ($custom_txt.l10n_args($infos1)."\n\n".l10n_args($infos2)."\n\n"), 1774 )); 1796 $content = ($custom_txt.l10n_args($infos1)."\n\n".l10n_args($infos2)."\n\n"); 1797 1798 pwg_mail( 1799 array( 1800 'name' => stripslashes($username), 1801 'email' => $email, 1802 ), 1803 array( 1804 'content' => $content, 1805 'content_format' => 'text/plain', 1806 'subject' => $subject, 1807 ) 1808 ); 1775 1809 } 1776 1810 // By default do not add gallery URL at the end of the email 1777 1811 else 1778 1812 { 1779 pwg_mail($email, array( 1780 'subject' => $subject, 1781 'content' => ($custom_txt.l10n_args($infos1)."\n\n".l10n_args($infos2)."\n\n"), 1782 )); 1813 $content = ($custom_txt.l10n_args($infos1)."\n\n".l10n_args($infos2)."\n\n"); 1814 1815 pwg_mail( 1816 array( 1817 'name' => stripslashes($username), 1818 'email' => $email, 1819 ), 1820 array( 1821 'content' => $content, 1822 'content_format' => 'text/plain', 1823 'subject' => $subject, 1824 ) 1825 ); 1783 1826 } 1784 1827 … … 1849 1892 // ------------------------------------------------------- 1850 1893 $patterns[] = '#\[username\]#i'; 1851 $replacements[] = $result['username'];1894 $replacements[] = stripslashes($result['username']); 1852 1895 $patterns[] = '#\[mygallery\]#i'; 1853 1896 $replacements[] = $conf['gallery_title']; … … 1865 1908 // ---------------------------------------------------------------- 1866 1909 $patterns[] = '#\[username\]#i'; 1867 $replacements[] = $result['username'];1910 $replacements[] = stripslashes($result['username']); 1868 1911 $patterns[] = '#\[mygallery\]#i'; 1869 1912 $replacements[] = $conf['gallery_title']; … … 1888 1931 if (isset($conf_UAM['ADD_GALLERY_URL_TO_EMAILS']) and $conf_UAM['ADD_GALLERY_URL_TO_EMAILS'] == 'true') 1889 1932 { 1890 pwg_mail($result['mail_address'], array( 1891 'subject' => $subject, 1892 'content' => (l10n_args($infos)."\n\n".$custom_txt).get_absolute_root_url(), 1893 )); 1933 $content = (l10n_args($infos)."\n\n".$custom_txt).get_absolute_root_url(); 1934 1935 pwg_mail( 1936 array( 1937 'name' => stripslashes($result['username']), 1938 'email' => $result['mail_address'], 1939 ), 1940 array( 1941 'content' => $content, 1942 'content_format' => 'text/plain', 1943 'subject' => $subject, 1944 ) 1945 ); 1894 1946 } 1895 1947 // Do not add gallery URL at the end of the email 1896 1948 elseif (isset($conf_UAM['ADD_GALLERY_URL_TO_EMAILS']) and $conf_UAM['ADD_GALLERY_URL_TO_EMAILS'] == 'false') 1897 1949 { 1898 pwg_mail($result['mail_address'], array( 1899 'subject' => $subject, 1900 'content' => (l10n_args($infos)."\n\n".$custom_txt), 1901 )); 1950 $content = (l10n_args($infos)."\n\n".$custom_txt); 1951 1952 pwg_mail( 1953 array( 1954 'name' => stripslashes($result['username']), 1955 'email' => $result['mail_address'], 1956 ), 1957 array( 1958 'content' => $content, 1959 'content_format' => 'text/plain', 1960 'subject' => $subject, 1961 ) 1962 ); 1902 1963 } 1903 1964 // By defaukt do not add gallery URL at the end of the email 1904 1965 else 1905 1966 { 1906 pwg_mail($result['mail_address'], array( 1907 'subject' => $subject, 1908 'content' => (l10n_args($infos)."\n\n".$custom_txt), 1909 )); 1967 $content = (l10n_args($infos)."\n\n".$custom_txt); 1968 1969 pwg_mail( 1970 array( 1971 'name' => stripslashes($result['username']), 1972 'email' => $result['mail_address'], 1973 ), 1974 array( 1975 'content' => $content, 1976 'content_format' => 'text/plain', 1977 'subject' => $subject, 1978 ) 1979 ); 1910 1980 } 1911 1981 … … 2055 2125 2056 2126 pwg_query($query); 2057 2058 // $query = '2059 //INSERT INTO '.USER_INFOS_TABLE.'2060 // (user_id, level)2061 //VALUES2062 // ('.$user_id.', "'.$conf_UAM['NO_VALID_LEVEL'].'")2063 //;';2064 //2065 // pwg_query($query);2066 2127 } 2067 2128 }
Note: See TracChangeset
for help on using the changeset viewer.