Witamy w Nieoficjalnym polskim support'cie AMX Mod X
Witamy w Nieoficjalnym polskim support'cie AMX Mod X, jak w większości społeczności internetowych musisz się zarejestrować aby móc odpowiadać lub zakładać nowe tematy, ale nie bój się to jest prosty proces w którym wymagamy minimalnych informacji.
|
Guest Message by DevFuse
Wklejka 41dps9q86g dodana przez Gość, 12.01.2013 14:17
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54. 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72. 73. 74. 75. 76. 77. 78. 79. 80. 81. 82. 83. 84. 85. 86. 87. 88. 89. 90. 91. 92. 93. 94. 95. 96. 97. 98. 99. 100. 101. 102. 103. 104. 105. 106. 107. 108. 109. 110. 111. 112. 113. 114. 115. 116. 117. 118. 119. 120. 121. 122. 123. 124. 125. 126. 127. 128. 129. 130. 131. 132. 133. 134. 135. 136. 137. 138. 139. 140. 141. 142. 143. 144. 145. 146. 147. 148. 149. 150. 151. 152. 153. 154. 155. 156. 157. 158. 159. 160. 161. 162. 163. 164. 165. 166. 167. 168. 169. 170. 171. 172. 173. 174. 175. 176. 177. 178. 179. 180. 181. 182. 183. 184. 185. 186. 187. 188. 189. 190. 191. 192. 193. 194. 195. 196. 197. 198. 199. 200. 201. 202. 203. 204. 205. 206. 207. 208. 209. 210. 211. 212. 213. 214. 215. 216. 217. 218. 219. 220. 221. 222. 223. 224. 225. 226. 227. 228. 229. 230. 231. 232. 233. 234. 235. 236. 237. 238. 239. 240. 241. 242. 243. 244. 245. 246. 247. 248. 249. 250. 251. 252. 253. 254. 255. 256. 257. 258. 259. 260. 261. 262. 263. 264. 265. 266. 267. 268. 269. 270. 271. 272. 273. 274. 275. 276. 277. 278. 279. 280. 281. 282. 283. 284. 285. 286. 287. 288. 289. 290. 291. 292. 293. 294. 295. 296. 297. 298. 299. 300. 301. 302. 303. 304. 305. 306. 307. 308. 309. 310. 311. 312. 313. 314. 315. 316. 317. 318. 319. 320. 321. 322. 323. 324. 325. 326. 327. 328. 329. 330. 331. 332. 333. 334. 335. 336. 337. 338. 339. 340. 341. 342. 343. 344. 345. 346. 347. 348. 349. 350. 351. 352. 353. 354. 355. 356. 357. 358. 359. 360. 361. 362. 363. 364. 365. 366. 367. 368. 369. 370. 371. 372. 373. 374. 375. 376. 377. 378. 379. 380. 381. 382. 383. 384. 385. 386. 387. 388. 389. 390. 391. 392. 393. 394. 395. 396. 397. 398. 399. 400. 401. 402. 403. 404. 405. 406. 407. 408. 409. 410. 411. 412. 413. 414. 415. 416. 417. 418. 419. 420. 421. 422. 423. 424. 425. 426. 427. 428. 429. 430. 431. 432. 433. 434. 435. 436. 437. 438. 439. 440. 441. 442. 443. 444. 445. 446. 447. 448. 449. 450. 451. 452. 453. 454. 455. 456. 457. 458. 459. 460. 461. 462. 463. 464. 465. 466. 467. 468. 469. 470. 471. 472. 473. 474. 475. 476. 477. 478. 479. 480. 481. 482. 483. 484. 485. 486. 487. 488. 489. 490. 491. 492. 493. 494. 495. 496. 497. 498. 499. 500. 501. 502. 503. 504. 505. 506. 507. 508. 509. 510. 511. 512. 513. 514. 515. 516. 517. 518. 519. 520. 521. 522. 523. 524. 525. 526. 527. 528. 529. 530. 531. 532. 533. 534. 535. 536. 537. 538. 539. 540. 541. 542. 543. 544. 545. 546. 547. 548. 549. 550. 551. 552. 553. 554. 555. 556. 557. 558. 559. 560. 561. 562. 563. 564. 565. 566. 567. 568. 569. 570. 571. 572. 573. 574. 575. 576. 577. 578. 579. 580. 581. 582. 583. 584. 585. 586. 587. 588. 589. 590. 591. 592. 593. 594. 595. 596. 597. 598. 599. 600. 601. 602. 603. 604. 605. 606. 607. 608. 609. 610. 611. 612. 613. 614. 615. 616. 617. 618. 619. 620. 621. 622. 623. 624. 625. 626. 627. 628. 629. 630. 631. 632. 633. 634. 635. 636. 637. 638. 639. 640. 641. 642. 643. 644. 645. 646. 647. 648. 649. 650. 651. 652. 653. 654. 655. 656. 657. 658. 659. 660. 661. 662. 663. 664. 665. 666. 667. 668. 669. 670. 671. 672. 673. 674. 675. 676. 677. 678. 679. 680. 681. 682. 683. 684. 685. 686. 687. 688. 689. 690. 691. 692. 693. 694. 695. 696. 697. 698. 699. 700. 701. 702. 703. 704. 705. 706. 707. 708. 709. 710. 711. 712. 713. 714. 715. 716. 717. 718. 719. 720. 721. 722. 723. 724. 725. 726. 727. 728. 729. 730. 731. 732. 733. 734. 735. 736. 737. 738. 739. 740. 741. 742. 743. 744. 745. 746. 747. 748. 749. 750. 751. 752. 753. 754. 755. 756. 757. 758. 759. 760. 761. 762. 763. 764. 765. 766. 767. 768. 769. 770. 771. 772. 773. 774. 775. 776. 777. 778. 779. 780. 781. 782. 783. 784. 785. 786. 787. 788. 789. 790. 791. 792. 793. 794. 795. 796. 797. 798. 799. 800. 801. 802. 803. 804. 805. 806. 807. 808. 809. 810. 811. 812. 813. 814. 815. 816. 817. 818. 819. 820. 821. 822. 823. 824. 825. 826. 827. 828. 829. 830. 831. 832. 833. 834. 835. 836. 837. 838. 839. 840. 841. 842. 843. 844. 845. 846. 847. 848. 849. 850. 851. 852. 853. 854. 855. 856. 857. 858. 859. 860. 861. 862. 863. 864. 865. 866. 867. 868. 869. 870. 871. 872. 873. 874. 875. 876. 877. 878. 879. 880. 881. 882. 883. 884. 885. 886. 887. 888. 889. 890. 891. 892. 893. 894. 895. 896. 897. 898. 899. 900. 901. 902. 903. 904. 905. 906. 907. 908. 909. 910. 911. 912. 913. 914. 915. 916. 917. 918. 919. 920. 921. 922. 923. 924. 925. 926. 927. 928. 929. 930. 931. 932. 933. 934. 935. 936. 937. 938. 939. 940. 941. 942. 943. 944. 945. 946. 947. 948. 949. 950. 951. 952. 953. 954. 955. 956. 957. 958. 959. 960. 961. 962. 963. 964. 965. 966. 967. 968. 969. 970. 971. 972. 973. 974. 975. 976. 977. 978. 979. 980. 981. 982. 983. 984. 985. 986. 987. 988. 989. 990. 991. 992. 993. 994. 995. 996. 997. 998. 999. 1000. 1001. 1002. 1003. 1004. 1005. 1006. 1007. 1008. 1009. 1010. 1011. 1012. 1013. 1014. 1015. 1016. 1017. 1018. 1019. 1020. 1021. 1022. 1023. 1024. 1025. 1026. 1027. 1028. 1029. 1030. 1031. 1032. 1033. 1034. 1035. 1036. 1037. 1038. 1039. 1040. 1041. 1042. 1043. 1044. 1045. 1046. 1047. 1048. 1049. 1050. 1051. 1052. 1053. 1054. 1055. 1056. 1057. 1058. 1059. 1060. 1061. 1062. 1063. 1064. 1065. 1066. 1067. 1068. 1069. 1070. 1071. 1072. 1073. 1074. 1075. 1076. 1077. 1078. 1079. 1080. 1081. 1082. 1083. 1084. 1085. 1086. 1087. 1088. 1089. 1090. 1091. 1092. 1093. 1094. 1095. 1096. 1097. 1098. 1099. 1100. 1101. 1102. 1103. 1104. 1105. 1106. 1107. 1108. 1109. 1110. 1111. 1112. 1113. 1114. 1115. 1116. 1117. 1118. 1119. 1120. 1121. 1122. 1123. 1124. 1125. 1126. 1127. 1128. 1129. 1130. 1131. 1132. 1133. 1134. 1135. 1136. 1137. 1138. 1139. 1140. 1141. 1142. 1143. 1144. 1145. 1146. 1147. 1148. 1149. 1150. 1151. 1152. 1153. 1154. 1155. 1156. 1157. 1158. 1159. 1160. 1161. 1162. 1163. 1164. 1165. 1166. 1167. 1168. 1169. 1170. 1171. 1172. 1173. 1174. 1175. 1176. 1177. 1178. 1179. 1180. 1181. 1182. 1183. 1184. 1185. 1186. 1187. 1188. 1189. 1190. 1191. 1192. 1193. 1194. 1195. 1196. 1197. 1198. 1199. 1200. 1201. 1202. 1203. 1204. 1205. 1206. 1207. 1208. 1209. 1210. 1211. 1212. 1213. 1214. 1215. 1216. 1217. 1218. 1219. 1220. 1221. 1222. 1223. 1224. 1225. 1226. 1227. 1228. 1229. 1230. 1231. 1232. 1233. 1234. 1235. 1236. 1237. 1238. 1239. 1240. 1241. 1242. 1243. 1244. 1245. 1246. 1247. 1248. 1249. 1250. 1251. 1252. 1253. 1254. 1255. 1256. 1257. 1258. 1259. 1260. 1261. 1262. 1263. 1264. 1265. 1266. 1267. 1268. 1269. 1270. 1271. 1272. 1273. 1274. 1275. 1276. 1277. 1278. 1279. 1280. 1281. 1282. 1283. 1284. 1285. 1286. 1287. 1288. 1289. 1290. 1291. 1292. 1293. 1294. 1295. 1296. 1297. 1298. 1299. 1300. 1301. 1302. 1303. 1304. 1305. 1306. 1307. 1308. 1309. 1310. 1311. 1312. 1313. 1314. 1315. 1316. 1317. 1318. 1319. 1320. 1321. 1322. 1323. 1324. 1325. 1326. 1327. 1328. 1329. 1330. 1331. 1332. 1333. 1334. 1335. 1336. 1337. 1338. 1339. 1340. 1341. 1342. 1343. 1344. 1345. 1346. 1347. 1348. 1349. 1350. 1351. 1352. 1353. 1354. 1355. 1356. 1357. 1358. 1359. 1360. 1361. 1362. 1363. 1364. 1365. 1366. 1367. 1368. 1369. 1370. 1371. 1372. 1373. 1374. 1375. 1376. 1377. 1378. 1379. 1380. 1381. 1382. 1383. 1384. 1385. 1386. 1387. 1388. 1389. 1390. 1391. 1392. 1393. 1394. 1395. 1396. 1397. 1398. 1399. 1400. 1401. 1402. 1403. 1404. 1405. 1406. 1407. 1408. 1409. 1410. 1411. 1412. 1413. 1414. 1415. 1416. 1417. 1418. 1419. 1420. 1421. 1422. 1423. 1424. 1425. 1426. 1427. 1428. 1429. 1430. 1431. 1432. 1433. 1434. 1435. 1436. 1437. 1438. 1439. 1440. 1441. 1442. 1443. 1444. 1445. 1446. 1447. 1448. 1449. 1450. 1451. 1452. 1453. 1454. 1455. 1456. 1457. 1458. 1459. 1460. 1461. 1462. 1463. 1464. 1465. 1466. 1467. 1468. 1469. 1470. 1471. 1472. 1473. 1474. 1475. 1476. 1477. 1478. 1479. 1480. 1481. 1482. 1483. 1484. 1485. 1486. 1487. 1488. 1489. 1490. 1491. 1492. 1493. 1494. 1495. 1496. 1497. 1498. 1499. 1500. 1501. 1502. 1503. 1504. 1505. 1506. 1507. 1508. 1509. 1510. 1511. 1512. 1513. 1514. 1515. 1516. 1517. 1518. 1519. 1520. 1521. 1522. 1523. 1524. 1525. 1526. 1527. 1528. 1529. 1530. 1531. 1532. 1533. 1534. 1535. 1536. 1537. 1538. 1539. 1540. 1541. 1542. 1543. 1544. 1545. 1546. 1547. 1548. 1549. 1550. 1551. 1552. 1553. 1554. 1555. 1556. 1557. 1558. 1559. 1560. 1561. 1562. 1563. 1564. 1565. 1566. 1567. 1568. 1569. 1570. 1571. 1572. 1573. 1574. 1575. 1576. 1577. 1578. 1579. 1580. 1581. 1582. 1583. 1584. 1585. 1586. 1587. 1588. 1589. 1590. 1591. 1592. 1593. 1594. 1595. 1596. 1597. 1598. 1599. 1600. 1601. 1602. 1603. 1604. 1605. 1606. 1607. 1608. 1609. 1610. 1611. 1612. 1613. 1614. 1615. 1616. 1617. 1618.
<?php /*************************************************************************** * privmsgs.php * ------------------- * begin : Saturday, Jun 9, 2001 * copyright : (C) 2001 The phpBB Group * email : [email protected] * modification : (C) 2005 Przemo www.przemo.org/phpBB2/ * date modification : ver. 1.12.0 2005/10/09 16:54 * * $Id: privmsg.php,v 1.96.2.43 2005/10/30 15:17:14 acydburn Exp $ * * ***************************************************************************/ /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/ define('IN_PHPBB', true); define('ATTACH', true); $auto_lang_enable = true; $phpbb_root_path = './'; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); include($phpbb_root_path . 'includes/bbcode.'.$phpEx); include($phpbb_root_path . 'includes/functions_post.'.$phpEx); // // Is PM disabled? // if ( !empty($board_config['privmsg_disable']) ) { message_die(GENERAL_MESSAGE, 'PM_disabled'); } $html_entities_match = array('#&(?!(#[0-9]+;))#', '#<#', '#>#', '#"#'); $html_entities_replace = array('&', '<', '>', '"'); // // Parameters // $submit = (isset($HTTP_POST_VARS['post'])) ? TRUE : 0; $submit_search = (isset($HTTP_POST_VARS['usersubmit'])) ? TRUE : 0; $submit_msgdays = (isset($HTTP_POST_VARS['submit_msgdays'])) ? TRUE : 0; $cancel = (isset($HTTP_POST_VARS['cancel'])) ? TRUE : 0; $preview = (isset($HTTP_POST_VARS['preview'])) ? TRUE : 0; $confirm = (isset($HTTP_POST_VARS['confirm'])) ? TRUE : 0; $delete = (isset($HTTP_POST_VARS['delete'])) ? TRUE : 0; $delete_all = (isset($HTTP_POST_VARS['deleteall'])) ? TRUE : 0; $save = (isset($HTTP_POST_VARS['save'])) ? TRUE : 0; $refresh = $preview || $submit_search; $mark_list = (!empty($HTTP_POST_VARS['mark'])) ? $HTTP_POST_VARS['mark'] : 0; if ( isset($HTTP_POST_VARS['folder']) || isset($HTTP_GET_VARS['folder']) ) { $folder = (isset($HTTP_POST_VARS['folder'])) ? $HTTP_POST_VARS['folder'] : $HTTP_GET_VARS['folder']; $folder = htmlspecialchars($folder); if ( $folder != 'inbox' && $folder != 'outbox' && $folder != 'sentbox' && $folder != 'savebox' ) { $folder = 'inbox'; } } else { $folder = 'inbox'; } // // Start session management // $userdata = session_pagestart($user_ip, PAGE_PRIVMSGS); init_userprefs($userdata); // // End session management // $user_topics_per_page = ($userdata['user_topics_per_page'] > $board_config['topics_per_page']) ? $board_config['topics_per_page'] : $userdata['user_topics_per_page']; if ( $board_config['login_require'] && !$userdata['session_logged_in'] ) { $message = $lang['login_require'] . '<br /><br />' . sprintf($lang['login_require_register'], '<a href="' . append_sid("profile.$phpEx?mode=register") . '">', '</a>'); message_die(GENERAL_MESSAGE, $message); } // // Cancel // if ( $cancel ) { redirect(append_sid("privmsg.$phpEx?folder=$folder", true)); } // // Var definitions // if ( !empty($HTTP_POST_VARS['mode']) || !empty($HTTP_GET_VARS['mode']) ) { $mode = ( !empty($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode']; $mode = htmlspecialchars($mode); } else { $mode = ''; } $sql = $pm_sql_user = $privmsgs_id = $sql_priority = ''; // session id check if (!empty($HTTP_POST_VARS['sid']) || !empty($HTTP_GET_VARS['sid'])) { $sid = (!empty($HTTP_POST_VARS['sid'])) ? $HTTP_POST_VARS['sid'] : $HTTP_GET_VARS['sid']; } else { $sid = ''; } $start = (!empty($HTTP_GET_VARS['start'])) ? intval($HTTP_GET_VARS['start']) : 0; if ( isset($HTTP_POST_VARS['start']) ) { $start = intval($HTTP_POST_VARS['start']); } if ( isset($HTTP_POST_VARS[POST_POST_URL]) || isset($HTTP_GET_VARS[POST_POST_URL]) ) { $privmsg_id = ( isset($HTTP_POST_VARS[POST_POST_URL]) ) ? intval($HTTP_POST_VARS[POST_POST_URL]) : intval($HTTP_GET_VARS[POST_POST_URL]); } else { $privmsg_id = ''; } function check_enable_pm($user_id) { global $db, $lang, $userdata, $phpEx; $sql = "SELECT allowpm FROM " . USERS_TABLE . " WHERE user_id = $user_id"; if ( !$result = $db->sql_query($sql) ) { message_die(GENERAL_MESSAGE, $lang['No_user_id_specified']); } $allowpm = $db->sql_fetchrow($result); if ( !$allowpm['allowpm'] && $userdata['user_level'] != ADMIN && $userdata['user_level'] != MOD ) { message_die(GENERAL_MESSAGE, $lang['user_not_allowpm'] . '<br /><br />' . sprintf($lang['Click_return_inbox'], '<a href="' . append_sid("privmsg.$phpEx?folder=inbox") . '">', '</a> ') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>')); } return; } $error = FALSE; // Define the box image links $inbox_img = ($folder != 'inbox' || $mode != '') ? '<a href="' . append_sid("privmsg.$phpEx?folder=inbox") . '"><img src="' . $images['pm_inbox'] . '" border="0" alt="' . $lang['Inbox'] . '" /></a>' : '<img src="' . $images['pm_inbox'] . '" border="0" alt="' . $lang['Inbox'] . '" />'; $inbox_url = ($folder != 'inbox' || $mode != '') ? '<a href="' . append_sid("privmsg.$phpEx?folder=inbox") . '">' . $lang['Inbox'] . '</a>' : $lang['Inbox']; $outbox_img = ($folder != 'outbox' || $mode != '') ? '<a href="' . append_sid("privmsg.$phpEx?folder=outbox") . '"><img src="' . $images['pm_outbox'] . '" border="0" alt="' . $lang['Outbox'] . '" /></a>' : '<img src="' . $images['pm_outbox'] . '" border="0" alt="' . $lang['Outbox'] . '" />'; $outbox_url = ($folder != 'outbox' || $mode != '') ? '<a href="' . append_sid("privmsg.$phpEx?folder=outbox") . '">' . $lang['Outbox'] . '</a>' : $lang['Outbox']; $sentbox_img = ($folder != 'sentbox' || $mode != '') ? '<a href="' . append_sid("privmsg.$phpEx?folder=sentbox") . '"><img src="' . $images['pm_sentbox'] . '" border="0" alt="' . $lang['Sentbox'] . '" /></a>' : '<img src="' . $images['pm_sentbox'] . '" border="0" alt="' . $lang['Sentbox'] . '" />'; $sentbox_url = ($folder != 'sentbox' || $mode != '') ? '<a href="' . append_sid("privmsg.$phpEx?folder=sentbox") . '">' . $lang['Sentbox'] . '</a>' : $lang['Sentbox']; $savebox_img = ($folder != 'savebox' || $mode != '') ? '<a href="' . append_sid("privmsg.$phpEx?folder=savebox") . '"><img src="' . $images['pm_savebox'] . '" border="0" alt="' . $lang['Savebox'] . '" /></a>' : '<img src="' . $images['pm_savebox'] . '" border="0" alt="' . $lang['Savebox'] . '" />'; $savebox_url = ($folder != 'savebox' || $mode != '') ? '<a href="' . append_sid("privmsg.$phpEx?folder=savebox") . '">' . $lang['Savebox'] . '</a>' : $lang['Savebox']; if ( defined('ATTACHMENTS_ON') ) { execute_privmsgs_attachment_handling($mode); } $user_can_use_bbcode = false; if ( $board_config['allow_bbcode'] && $userdata['user_allowbbcode'] ) { $user_can_use_bbcode = true; } if ( !$user_can_use_bbcode ) { $bbcode_on = 0; } else { $bbcode_on = (!empty($HTTP_POST_VARS['disable_bbcode'])) ? 0 : true; } // Start main if ( $mode == 'birthday' ) { $gen_simple_header = true; $page_title = $lang['Greeting_Messaging']; include($phpbb_root_path . 'includes/page_header.'.$phpEx); $l_greeting = (date('dm') == realdate('dm', $userdata['user_birthday'])) ? sprintf($lang['Birthday_greeting_today'], date('Y')-realdate('Y',$userdata['user_birthday'])) : sprintf ( $lang['Birthday_greeting_prev'], date('Y')-realdate('Y',$userdata['user_birthday']), realdate(str_replace('Y','',$lang['DATE_FORMAT']),$userdata['user_birthday']) ); $template->set_filenames(array( 'body' => 'greeting_popup.tpl') ); $template->assign_vars(array( 'L_CLOSE_WINDOW' => $lang['Close_window'], 'L_MESSAGE' => $l_greeting ) ); $template->pparse('body'); include($phpbb_root_path . 'includes/page_tail.'.$phpEx); } else if ( $mode == 'newpm' ) { $gen_simple_header = TRUE; $page_title = $lang['Private_Messaging']; include($phpbb_root_path . 'includes/page_header.'.$phpEx); $template->set_filenames(array( 'body' => 'privmsgs_popup.tpl') ); if ( $userdata['session_logged_in'] ) { if ( $userdata['user_new_privmsg'] ) { $l_new_message = ($userdata['user_new_privmsg'] == 1) ? $lang['You_new_pm'] : $lang['You_new_pms']; } else { $l_new_message = $lang['You_no_new_pm']; } $l_new_message .= '<br /><br />' . sprintf($lang['Click_view_privmsg'], '<a href="' . append_sid("privmsg.".$phpEx."?folder=inbox") . '" onclick="jump_to_inbox();return false;" target="_new">', '</a>'); } else { $l_new_message = $lang['Login_check_pm']; } $template->assign_vars(array( 'L_CLOSE_WINDOW' => $lang['Close_window'], 'L_MESSAGE' => $l_new_message) ); $template->pparse('body'); include($phpbb_root_path . 'includes/page_tail.'.$phpEx); } else if ( $mode == 'read' ) { if ( !empty($HTTP_GET_VARS[POST_POST_URL]) ) { $privmsgs_id = intval($HTTP_GET_VARS[POST_POST_URL]); } else { message_die(GENERAL_ERROR, $lang['No_post_id']); } if ( !$userdata['session_logged_in'] ) { redirect(append_sid("login.$phpEx?redirect=privmsg.$phpEx&folder=$folder&mode=$mode&" . POST_POST_URL . "=$privmsgs_id", true)); } // SQL to pull appropriate message, prevents nosey people // reading other peoples messages ... hopefully! switch( $folder ) { case 'inbox': $l_box_name = $lang['Inbox']; $pm_sql_user = "AND pm.privmsgs_to_userid = " . $userdata['user_id'] . " AND ( pm.privmsgs_type = " . PRIVMSGS_READ_MAIL . " OR pm.privmsgs_type = " . PRIVMSGS_NEW_MAIL . " OR pm.privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )"; break; case 'outbox': $l_box_name = $lang['Outbox']; $pm_sql_user = "AND pm.privmsgs_from_userid = " . $userdata['user_id'] . " AND ( pm.privmsgs_type = " . PRIVMSGS_NEW_MAIL . " OR pm.privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " ) "; break; case 'sentbox': $l_box_name = $lang['Sentbox']; $pm_sql_user = "AND pm.privmsgs_from_userid = " . $userdata['user_id'] . " AND pm.privmsgs_type = " . PRIVMSGS_SENT_MAIL; break; case 'savebox': $l_box_name = $lang['Savebox']; $pm_sql_user = "AND ( ( pm.privmsgs_to_userid = " . $userdata['user_id'] . " AND pm.privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . " ) OR ( pm.privmsgs_from_userid = " . $userdata['user_id'] . " AND pm.privmsgs_type = " . PRIVMSGS_SAVED_OUT_MAIL . " ) )"; break; default: message_die(GENERAL_ERROR, $lang['No_such_folder']); break; } // Major query obtains the message ... $sql = "SELECT u.username AS username_1, u.user_id AS user_id_1, u2.username AS username_2, u2.user_id AS user_id_2, u.user_sig_bbcode_uid, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_viewaim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_image, u.user_allowsig, u.user_avatar, pm.*, pmt.privmsgs_bbcode_uid, pmt.privmsgs_text FROM (" . PRIVMSGS_TABLE . " pm, " . PRIVMSGS_TEXT_TABLE . " pmt, " . USERS_TABLE . " u, " . USERS_TABLE . " u2) WHERE pm.privmsgs_id = $privmsgs_id AND pmt.privmsgs_text_id = pm.privmsgs_id $pm_sql_user AND u.user_id = pm.privmsgs_from_userid AND u2.user_id = pm.privmsgs_to_userid"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not query private message post information', '', __LINE__, __FILE__, $sql); } // Did the query return any data? if ( !($privmsg = $db->sql_fetchrow($result)) ) { redirect(append_sid("privmsg.$phpEx?folder=$folder", true)); } $privmsg_id = $privmsg['privmsgs_id']; // Is this a new message in the inbox? If it is then save // a copy in the posters sent box if ( ($privmsg['privmsgs_type'] == PRIVMSGS_NEW_MAIL || $privmsg['privmsgs_type'] == PRIVMSGS_UNREAD_MAIL) && $folder == 'inbox' ) { // Update appropriate counter switch ($privmsg['privmsgs_type']) { case PRIVMSGS_NEW_MAIL: $sql = "user_new_privmsg = user_new_privmsg - 1"; break; case PRIVMSGS_UNREAD_MAIL: $sql = "user_unread_privmsg = user_unread_privmsg - 1"; break; } $sql = "UPDATE " . USERS_TABLE . " SET $sql WHERE user_id = " . $userdata['user_id']; if ( !$db->sql_query($sql) ) { message_die(GENERAL_ERROR, 'Could not update private message read status for user', '', __LINE__, __FILE__, $sql); } $sql = "UPDATE " . PRIVMSGS_TABLE . " SET privmsgs_type = " . PRIVMSGS_READ_MAIL . " WHERE privmsgs_id = " . $privmsg['privmsgs_id']; if ( !$db->sql_query($sql) ) { message_die(GENERAL_ERROR, 'Could not update private message read status', '', __LINE__, __FILE__, $sql); } // Check to see if the poster has a 'full' sent box $sql = "SELECT COUNT(privmsgs_id) AS sent_items, MIN(privmsgs_date) AS oldest_post_time FROM " . PRIVMSGS_TABLE . " WHERE privmsgs_type = " . PRIVMSGS_SENT_MAIL . " AND privmsgs_from_userid = " . $privmsg['privmsgs_from_userid']; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not obtain sent message info for sendee', '', __LINE__, __FILE__, $sql); } $sql_priority = ( SQL_LAYER == 'mysql' ) ? 'LOW_PRIORITY' : ''; if ( $sent_info = $db->sql_fetchrow($result) ) { if ( $userdata['user_level'] == ADMIN ) { $max_sentbox_privmsgs = $board_config['max_sentbox_privmsgs'] * 6; } else if ( $userdata['user_level'] == MOD ) { $max_sentbox_privmsgs = $board_config['max_sentbox_privmsgs'] * 3; } else { $max_sentbox_privmsgs = $board_config['max_sentbox_privmsgs']; } if ( $board_config['max_sentbox_privmsgs'] && $sent_info['sent_items'] >= $max_sentbox_privmsgs ) { $sql = "SELECT privmsgs_id FROM " . PRIVMSGS_TABLE . " WHERE privmsgs_type = " . PRIVMSGS_SENT_MAIL . " AND privmsgs_date = " . $sent_info['oldest_post_time'] . " AND privmsgs_from_userid = " . $privmsg['privmsgs_from_userid']; if ( !$result = $db->sql_query($sql) ) { message_die(GENERAL_ERROR, 'Could not find oldest privmsgs', '', __LINE__, __FILE__, $sql); } $old_privmsgs_id = $db->sql_fetchrow($result); $old_privmsgs_id = $old_privmsgs_id['privmsgs_id']; $sql = "DELETE $sql_priority FROM " . PRIVMSGS_TABLE . " WHERE privmsgs_id = $old_privmsgs_id"; if ( !$db->sql_query($sql) ) { message_die(GENERAL_ERROR, 'Could not delete oldest privmsgs (sent)', '', __LINE__, __FILE__, $sql); } $sql = "DELETE $sql_priority FROM " . PRIVMSGS_TEXT_TABLE . " WHERE privmsgs_text_id = $old_privmsgs_id"; if ( !$db->sql_query($sql) ) { message_die(GENERAL_ERROR, 'Could not delete oldest privmsgs text (sent)', '', __LINE__, __FILE__, $sql); } } } if ( $privmsg['privmsgs_from_userid'] != ANONYMOUS ) { $sql = "INSERT $sql_priority INTO " . PRIVMSGS_TABLE . " (privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_ip, privmsgs_enable_html, privmsgs_enable_bbcode, privmsgs_enable_smilies, privmsgs_attach_sig) VALUES (" . PRIVMSGS_SENT_MAIL . ", '" . str_replace("'", "''", addslashes($privmsg['privmsgs_subject'])) . "', " . $privmsg['privmsgs_from_userid'] . ", " . $privmsg['privmsgs_to_userid'] . ", " . $privmsg['privmsgs_date'] . ", '" . $privmsg['privmsgs_ip'] . "', " . $privmsg['privmsgs_enable_html'] . ", " . $privmsg['privmsgs_enable_bbcode'] . ", " . $privmsg['privmsgs_enable_smilies'] . ", " . $privmsg['privmsgs_attach_sig'] . ")"; if ( !$db->sql_query($sql) ) { message_die(GENERAL_ERROR, 'Could not insert private message sent info', '', __LINE__, __FILE__, $sql); } $privmsg_sent_id = $db->sql_nextid(); $sql = "INSERT $sql_priority INTO " . PRIVMSGS_TEXT_TABLE . " (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text) VALUES ($privmsg_sent_id, '" . $privmsg['privmsgs_bbcode_uid'] . "', '" . str_replace("'", "''", addslashes($privmsg['privmsgs_text'])) . "')"; if ( !$db->sql_query($sql) ) { message_die(GENERAL_ERROR, 'Could not insert private message sent text', '', __LINE__, __FILE__, $sql); } } } if ( defined('ATTACHMENTS_ON') ) { $attachment_mod['pm'] -> duplicate_attachment_pm($privmsg['privmsgs_attachment'], $privmsg['privmsgs_id'], $privmsg_sent_id); } $service = ($privmsg['user_id_1'] == ANONYMOUS) ? true : false; // Pick a folder, any folder, so long as it's one below ... $post_urls = array( 'post' => append_sid("privmsg.$phpEx?mode=post"), 'reply' => append_sid("privmsg.$phpEx?mode=reply&" . POST_POST_URL . "=$privmsg_id"), 'quote' => append_sid("privmsg.$phpEx?mode=quote&" . POST_POST_URL . "=$privmsg_id"), 'edit' => append_sid("privmsg.$phpEx?mode=edit&" . POST_POST_URL . "=$privmsg_id") ); $post_icons = array( 'post_img' => '<a href="' . $post_urls['post'] . '"><img src="' . $images['pm_postmsg'] . '" alt="' . $lang['Post_new_pm'] . '" border="0" /></a>', 'post' => '<a href="' . $post_urls['post'] . '">' . $lang['Post_new_pm'] . '</a>', 'reply_img' => (!$service) ? '<a href="' . $post_urls['reply'] . '"><img src="' . $images['pm_replymsg'] . '" alt="' . $lang['Post_reply_pm'] . '" border="0" /></a>' : '', 'reply' => '<a href="' . $post_urls['reply'] . '">' . $lang['Post_reply_pm'] . '</a>', 'quote_img' => (!$service) ? '<a href="' . $post_urls['quote'] . '"><img src="' . $images['pm_quotemsg'] . '" alt="' . $lang['Post_quote_pm'] . '" border="0" /></a>' : '', 'quote' => '<a href="' . $post_urls['quote'] . '">' . $lang['Post_quote_pm'] . '</a>', 'edit_img' => '<a href="' . $post_urls['edit'] . '"><img src="' . $images['pm_editmsg'] . '" alt="' . $lang['Edit_pm'] . '" border="0" /></a>', 'edit' => '<a href="' . $post_urls['edit'] . '">' . $lang['Edit_pm'] . '</a>' ); if ( $folder == 'inbox' ) { $post_img = $post_icons['post_img']; $reply_img = $post_icons['reply_img']; $edit_img = $edit = ''; $post = $post_icons['post']; $reply = $post_icons['reply']; $l_box_name = $lang['Inbox']; if ( $user_can_use_bbcode ) { $quote_img = $post_icons['quote_img']; $quote = $post_icons['quote']; } } else if ( $folder == 'outbox' ) { $post_img = $post_icons['post_img']; $reply_img = ''; $quote_img = ''; $edit_img = $post_icons['edit_img']; $post = $post_icons['post']; $reply = ''; $quote = ''; $edit = $post_icons['edit']; $l_box_name = $lang['Outbox']; } else if ( $folder == 'savebox' ) { if ( $privmsg['privmsgs_type'] == PRIVMSGS_SAVED_IN_MAIL ) { $post_img = $post_icons['post_img']; $reply_img = $post_icons['reply_img']; if ( $user_can_use_bbcode ) { $quote_img = $post_icons['quote_img']; } $edit_img = ''; $post = $post_icons['post']; $reply = $post_icons['reply']; $quote = $post_icons['quote']; $edit = ''; } else { $post_img = $post_icons['post_img']; $reply_img = ''; $quote_img = ''; $edit_img = ''; $post = $post_icons['post']; $reply = ''; $quote = ''; $edit = ''; } $l_box_name = $lang['Saved']; } else if ( $folder == 'sentbox' ) { $post_img = $post_icons['post_img']; $reply_img = ''; $quote_img = ''; $edit_img = ''; $post = $post_icons['post']; $reply = ''; $quote = ''; $edit = ''; $l_box_name = $lang['Sent']; } $s_hidden_fields = '<input type="hidden" name="mark[]" value="' . $privmsgs_id . '" />'; $page_title = $lang['Read_pm']; include($phpbb_root_path . 'includes/page_header.'.$phpEx); // Load templates $template->set_filenames(array( 'body' => 'privmsgs_read_body.tpl') ); make_jumpbox('viewforum.'.$phpEx); $template->assign_vars(array( 'INBOX_IMG' => $inbox_img, 'SENTBOX_IMG' => $sentbox_img, 'OUTBOX_IMG' => $outbox_img, 'SAVEBOX_IMG' => $savebox_img, 'INBOX' => $inbox_url, 'POST_PM_IMG' => $post_img, 'REPLY_PM_IMG' => $reply_img, 'EDIT_PM_IMG' => $edit_img, 'QUOTE_PM_IMG' => $quote_img, 'POST_PM' => $post, 'REPLY_PM' => $reply, 'EDIT_PM' => $edit, 'QUOTE_PM' => $quote, 'SENTBOX' => $sentbox_url, 'OUTBOX' => $outbox_url, 'SAVEBOX' => $savebox_url, 'BOX_NAME' => $l_box_name, 'L_MESSAGE' => $lang['Message'], 'L_SZYBKA' => $lang['Quick_Reply'], 'L_INBOX' => $lang['Inbox'], 'L_OUTBOX' => $lang['Outbox'], 'L_SENTBOX' => $lang['Sent'], 'L_SAVEBOX' => $lang['Saved'], 'L_FLAG' => $lang['Flag'], 'L_SUBJECT' => $lang['Subject'], 'L_POSTED' => $lang['Posted'], 'L_DATE' => $lang['Date'], 'L_FROM' => $lang['From'], 'L_TO' => $lang['To'], 'L_SAVE_MSG' => $lang['Save_message'], 'L_DELETE_MSG' => $lang['Delete_message'], 'L_REPLY'=> $lang['Reply'], 'L_PREVIEW' => $lang['Preview'], 'L_SUBMIT' => $lang['Submit'], 'S_PRIVMSGS_ACTION' => append_sid("privmsg.$phpEx?folder=$folder"), 'S_HIDDEN_FIELDS' => $s_hidden_fields) ); $username_from = ($service) ? '<b>' . $lang['forum_service'] . '</b>' : $privmsg['username_1']; $user_id_from = $privmsg['user_id_1']; $username_to = $privmsg['username_2']; $user_id_to = $privmsg['user_id_2']; if ( defined('ATTACHMENTS_ON') ) { init_display_pm_attachments($privmsg['privmsgs_attachment']); } $post_date = create_date($board_config['default_dateformat'], $privmsg['privmsgs_date'], $board_config['board_timezone']); $temp_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $user_id_from); $profile_img = ($service) ? '' : '<a href="' . $temp_url . '"><img src="' . $images['icon_profile'] . '" alt="' . $lang['Read_profile'] . '" title="' . $lang['Read_profile'] . '" border="0" /></a>'; $profile = ($service) ? '' : '<a href="' . $temp_url . '">' . $lang['Read_profile'] . '</a>'; $temp_url = append_sid("privmsg.$phpEx?mode=post&" . POST_USERS_URL . "=$user_id_from"); $pm_img = ($service) ? '' : '<a href="' . $temp_url . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['Send_private_message'] . '" title="' . $lang['Send_private_message'] . '" border="0" /></a>'; $pm = ($service) ? '' : '<a href="' . $temp_url . '">' . $lang['Send_private_message'] . '</a>'; if ( (!empty($privmsg['user_viewemail']) || $userdata['user_level'] == ADMIN) && !$service ) { $email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&" . POST_USERS_URL .'=' . $user_id_from) : 'mailto:' . $privmsg['user_email']; $email_img = '<a href="' . $email_uri . '"><img src="' . $images['icon_email'] . '" alt="' . $lang['Send_email'] . '" title="' . $lang['Send_email'] . '" border="0" /></a>'; $email = '<a href="' . $email_uri . '">' . $lang['Send_email'] . '</a>'; } else { $email_img = ''; $email = ''; } $www_img = ($privmsg['user_website'] && !$service) ? '<a href="' . $privmsg['user_website'] . '" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $lang['Visit_website'] . '" title="' . $lang['Visit_website'] . '" border="0" /></a>' : ''; $www = ($privmsg['user_website'] && !$service) ? '<a href="' . $privmsg['user_website'] . '" target="_userwww">' . $lang['Visit_website'] . '</a>' : ''; if ( !empty($privmsg['user_icq']) && !$service) { $icq_status_img = '<a href="http://wwp.icq.com/' . $privmsg['user_icq'] . '#pager"><img src="http://web.icq.com/whitepages/online?icq=' . $privmsg['user_icq'] . '&img=5" width="18" height="18" border="0" alt="" /></a>'; $icq_img = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $privmsg['user_icq'] . '"><img src="' . $images['icon_icq'] . '" alt="' . $lang['ICQ'] . '" title="' . $lang['ICQ'] . '" border="0" /></a>'; $icq = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $privmsg['user_icq'] . '">' . $lang['ICQ'] . '</a>'; } else { $icq_status_img = ''; $icq_img = ''; $icq = ''; } if ( !empty($privmsg['user_aim']) && !$service ) { $gg_url = append_sid("gg.$phpEx?mode=gadu&" . POST_USERS_URL . '=' . $user_id_from); if ( $privmsg['user_viewaim'] ) { $gg_url = append_sid("gg.$phpEx?mode=gadu&" . POST_USERS_URL . '=' . $user_id_from); $aim_status_img = '<a href="' . $gg_url . '"><img alt="' .$postrow[$i]['user_aim'] . '" src="http://status.gadu-gadu.pl/users/status.asp?id=' . $privmsg['user_aim'] . '&styl=1" width="16" height="16" border="0" alt="" /></a>'; $aim_img = '<a href="' . $gg_url . '"><img src="' . $images['icon_aim'] . '" alt="' . $lang['AIM'] . '" title="' . $lang['AIM'] . '" border="0" /></a>'; } else { $aim_status_img = ''; $aim_img = '<a href="' . $gg_url . '"><img src="' . $images['icon_aim'] . '" alt="" border="0" /></a>'; } } else { $aim_status_img = ''; $aim_img = ''; } $temp_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id_from"); $msn_img = ($privmsg['user_msnm'] && !$service) ? '<a href="' . $temp_url . '"><img src="' . $images['icon_msnm'] . '" alt="' . $lang['MSNM'] . '" title="' . $lang['MSNM'] . '" border="0" /></a>' : ''; $msn = ($privmsg['user_msnm'] && !$service) ? '<a href="' . $temp_url . '">' . $lang['MSNM'] . '</a>' : ''; $yim_img = ($privmsg['user_yim'] && !$service) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $privmsg['user_yim'] . '&.src=pg"><img src="' . $images['icon_yim'] . '" alt="' . $lang['YIM'] . '" title="' . $lang['YIM'] . '" border="0" /></a>' : ''; $yim = ($privmsg['user_yim'] && !$service) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $privmsg['user_yim'] . '&.src=pg">' . $lang['YIM'] . '</a>' : ''; $temp_url = append_sid("search.$phpEx?search_author=" . urlencode($username_from) . "&showresults=posts"); $search_img = ($service) ? '' : '<a href="' . $temp_url . '"><img src="' . $images['icon_search'] . '" alt="' . sprintf($lang['Search_user_posts'], $username_from) . '" title="' . sprintf($lang['Search_user_posts'], $username_from) . '" border="0" /></a>'; $search = ($service) ? '' : '<a href="' . $temp_url . '">' . sprintf($lang['Search_user_posts'], $username_from) . '</a>'; // Processing of post $post_subject = $privmsg['privmsgs_subject']; $private_message = $privmsg['privmsgs_text']; $bbcode_uid = $privmsg['privmsgs_bbcode_uid']; if ( $board_config['allow_sig'] && $privmsg['user_allowsig'] ) { $user_sig = ( $privmsg['privmsgs_from_userid'] == $userdata['user_id'] ) ? $userdata['user_sig'] : $privmsg['user_sig']; if ( $board_config['allow_sig_image'] ) { $user_sig_image = ($privmsg['privmsgs_from_userid'] == $userdata['user_id']) ? $userdata['user_sig_image'] : $privmsg['user_sig_image']; } } else { $user_sig = ''; $user_sig_image = ''; } $user_sig_bbcode_uid = ($privmsg['privmsgs_from_userid'] == $userdata['user_id']) ? $userdata['user_sig_bbcode_uid'] : $privmsg['user_sig_bbcode_uid']; $user_sig = ($userdata['user_allow_signature']) ? $user_sig : ''; $user_sig_image = ( $userdata['user_allow_sig_image'] ) ? $user_sig_image : ''; // If the board has HTML off but the post has HTML // on then we process it, else leave it alone if ( !$board_config['allow_html'] || !$userdata['user_allowhtml']) { if ( $user_sig != '') { $user_sig = preg_replace('#(<)([/]?.*?)(>)#is', "<2>", $user_sig); } if ( $privmsg['privmsgs_enable_html'] ) { $private_message = preg_replace('#(<)([/]?.*?)(>)#is', "<2>", $private_message); } } if ( $user_sig != '' && $privmsg['privmsgs_attach_sig'] && $user_sig_bbcode_uid != '' ) { $user_sig = ($board_config['allow_bbcode']) ? bbencode_second_pass($user_sig, $user_sig_bbcode_uid, $userdata['username']) : preg_replace('/:[0-9a-z:]+]/si', ']', $user_sig); } if ( $bbcode_uid != '' ) { $private_message = ($board_config['allow_bbcode']) ? bbencode_second_pass($private_message, $bbcode_uid, $userdata['username']) : preg_replace('/:[0-9a-z:]+]/si', ']', $private_message); } $private_message = make_clickable($private_message); if ( $privmsg['privmsgs_attach_sig'] && $user_sig != '' ) { $private_message .= '<br /><br />_________________<br />' . make_clickable($user_sig); } if ( $privmsg['privmsgs_attach_sig'] && $user_sig_image != '' ) { $private_message .= ( ($user_sig != '' ) ? '<br />' : '<br /><br />_________________<br />' ) . '<img src="' . $board_config['sig_images_path'] . '/' . $user_sig_image . '" border="0" alt="" />'; } $orig_word = array(); $replacement_word = array(); $replacement_word_html = array(); obtain_word_list($orig_word, $replacement_word, $replacement_word_html); if ( count($orig_word) ) { $post_subject = preg_replace($orig_word, $replacement_word, $post_subject); $private_message = preg_replace($orig_word, $replacement_word, $private_message); } if ( $board_config['allow_smilies'] && $privmsg['privmsgs_enable_smilies'] && $userdata['show_smiles'] ) { $private_message = smilies_pass($private_message); } $private_message = str_replace(array("n", "r"), array("<br />", ''), $private_message); // Dump it to the templating engine $template->assign_vars(array( 'MESSAGE_TO' => $username_to, 'MESSAGE_REPLY'=> $username, 'MESSAGE_FROM' => $username_from, 'RANK_IMAGE' => $rank_image, 'POSTER_JOINED' => $poster_joined, 'POSTER_POSTS' => $poster_posts, 'POSTER_FROM' => $poster_from, 'POSTER_AVATAR' => $poster_avatar, 'POST_SUBJECT' => $post_subject, 'POST_DATE' => $post_date, 'MESSAGE' => $private_message, 'PROFILE_IMG' => $profile_img, 'PROFILE' => $profile, 'SEARCH_IMG' => $search_img, 'SEARCH' => $search, 'EMAIL_IMG' => $email_img, 'EMAIL' => $email, 'WWW_IMG' => $www_img, 'WWW' => $www, 'ICQ_STATUS_IMG' => $icq_status_img, 'ICQ_IMG' => $icq_img, 'ICQ' => $icq, 'AIM_IMG' => $aim_img, 'AIM_STATUS_IMG' => $aim_status_img, 'MSN_IMG' => $msn_img, 'MSN' => $msn, 'YIM_IMG' => $yim_img, 'YIM' => $yim) ); $template->pparse('body'); include($phpbb_root_path . 'includes/page_tail.'.$phpEx); } else if ( ( $delete && $mark_list ) || $delete_all ) { if ( !$userdata['session_logged_in'] ) { redirect(append_sid("login.$phpEx?redirect=privmsg.$phpEx&folder=inbox", true)); } if ( isset($mark_list) && !is_array($mark_list) ) { // Set to empty array instead of '0' if nothing is selected. $mark_list = array(); } if ( !$confirm ) { $s_hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" />'; $s_hidden_fields .= ( isset($HTTP_POST_VARS['delete']) ) ? '<input type="hidden" name="delete" value="true" />' : '<input type="hidden" name="deleteall" value="true" />'; for($i = 0; $i < count($mark_list); $i++) { $s_hidden_fields .= '<input type="hidden" name="mark[]" value="' . intval($mark_list[$i]) . '" />'; } // Output confirmation page include($phpbb_root_path . 'includes/page_header.'.$phpEx); $template->set_filenames(array( 'confirm_body' => 'confirm_body.tpl') ); $template->assign_vars(array( 'MESSAGE_TITLE' => $lang['Information'], 'MESSAGE_TEXT' => (count($mark_list) == 1) ? $lang['Confirm_delete_pm'] : $lang['Confirm_delete_pms'], 'L_YES' => $lang['Yes'], 'L_NO' => $lang['No'], 'S_CONFIRM_ACTION' => append_sid("privmsg.$phpEx?folder=$folder"), 'S_HIDDEN_FIELDS' => $s_hidden_fields) ); $template->pparse('confirm_body'); include($phpbb_root_path . 'includes/page_tail.'.$phpEx); } else if ( $confirm ) { $delete_sql_id = $delete_type = ''; if (!$delete_all) { for ($i = 0; $i < count($mark_list); $i++) { $delete_sql_id .= (($delete_sql_id != '') ? ', ' : '') . intval($mark_list[$i]); } $delete_sql_id = "AND privmsgs_id IN ($delete_sql_id)"; } switch($folder) { case 'inbox': $delete_type = "privmsgs_to_userid = " . $userdata['user_id'] . " AND ( privmsgs_type = " . PRIVMSGS_READ_MAIL . " OR privmsgs_type = " . PRIVMSGS_NEW_MAIL . " OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )"; break; case 'outbox': $delete_type = "privmsgs_from_userid = " . $userdata['user_id'] . " AND ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . " OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )"; break; case 'sentbox': $delete_type = "privmsgs_from_userid = " . $userdata['user_id'] . " AND privmsgs_type = " . PRIVMSGS_SENT_MAIL; break; case 'savebox': $delete_type = "( ( privmsgs_from_userid = " . $userdata['user_id'] . " AND privmsgs_type = " . PRIVMSGS_SAVED_OUT_MAIL . " ) OR ( privmsgs_to_userid = " . $userdata['user_id'] . " AND privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . " ) )"; break; } $sql = "SELECT privmsgs_id FROM " . PRIVMSGS_TABLE . " WHERE $delete_type $delete_sql_id"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not obtain id list to delete messages', '', __LINE__, __FILE__, $sql); } $mark_list = array(); while ( $row = $db->sql_fetchrow($result) ) { $mark_list[] = $row['privmsgs_id']; } unset($delete_type); if ( defined('ATTACHMENTS_ON') ) { $attachment_mod['pm']->delete_all_pm_attachments($mark_list); } if ( count($mark_list) ) { $delete_sql_id = ''; for ($i = 0; $i < sizeof($mark_list); $i++) { $delete_sql_id .= (($delete_sql_id != '') ? ', ' : '') . intval($mark_list[$i]); } if ( $folder == 'inbox' || $folder == 'outbox') { switch ($folder) { case 'inbox': $sql = "privmsgs_to_userid = " . $userdata['user_id']; break; case 'outbox': $sql = "privmsgs_from_userid = " . $userdata['user_id']; break; } // Get information relevant to new or unread mail // so we can adjust users counters appropriately $sql = "SELECT privmsgs_to_userid, privmsgs_type FROM " . PRIVMSGS_TABLE . " WHERE privmsgs_id IN ($delete_sql_id) AND $sql AND privmsgs_type IN (" . PRIVMSGS_NEW_MAIL . ", " . PRIVMSGS_UNREAD_MAIL . ")"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not obtain user id list for outbox messages', '', __LINE__, __FILE__, $sql); } if ( $row = $db->sql_fetchrow($result)) { $type = $dec = ''; $update_users = $update_list = array(); do { switch ($row['privmsgs_type']) { case PRIVMSGS_NEW_MAIL: $update_users['new'][$row['privmsgs_to_userid']]++; break; case PRIVMSGS_UNREAD_MAIL: $update_users['unread'][$row['privmsgs_to_userid']]++; break; } } while ($row = $db->sql_fetchrow($result)); if ( sizeof($update_users) ) { while (list($type, $users) = each($update_users)) { while (list($user_id, $dec) = each($users)) { $update_list[$type][$dec][] = $user_id; } } unset($update_users); while (list($type, $dec_ary) = each($update_list)) { switch ($type) { case 'new': $type = 'user_new_privmsg'; break; case 'unread': $type = 'user_unread_privmsg'; break; } while (list($dec, $user_ary) = each($dec_ary)) { $user_ids = implode(', ', $user_ary); $sql = "UPDATE " . USERS_TABLE . " SET $type = $type - $dec WHERE user_id IN ($user_ids)"; if ( !$db->sql_query($sql) ) { message_die(GENERAL_ERROR, 'Could not update user pm counters', '', __LINE__, __FILE__, $sql); } } } unset($update_list); } } $db->sql_freeresult($result); } // Delete the messages $delete_text_sql = "DELETE FROM " . PRIVMSGS_TEXT_TABLE . " WHERE privmsgs_text_id IN ($delete_sql_id)"; $delete_sql = "DELETE FROM " . PRIVMSGS_TABLE . " WHERE privmsgs_id IN ($delete_sql_id) AND "; switch( $folder ) { case 'inbox': $delete_sql .= "privmsgs_to_userid = " . $userdata['user_id'] . " AND ( privmsgs_type = " . PRIVMSGS_READ_MAIL . " OR privmsgs_type = " . PRIVMSGS_NEW_MAIL . " OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )"; break; case 'outbox': $delete_sql .= "privmsgs_from_userid = " . $userdata['user_id'] . " AND ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . " OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " )"; break; case 'sentbox': $delete_sql .= "privmsgs_from_userid = " . $userdata['user_id'] . " AND privmsgs_type = " . PRIVMSGS_SENT_MAIL; break; case 'savebox': $delete_sql .= "( ( privmsgs_from_userid = " . $userdata['user_id'] . " AND privmsgs_type = " . PRIVMSGS_SAVED_OUT_MAIL . " ) OR ( privmsgs_to_userid = " . $userdata['user_id'] . " AND privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . " ) )"; break; } if ( !$db->sql_query($delete_sql, BEGIN_TRANSACTION) ) { message_die(GENERAL_ERROR, 'Could not delete private message info', '', __LINE__, __FILE__, $delete_sql); } if ( !$db->sql_query($delete_text_sql, END_TRANSACTION) ) { message_die(GENERAL_ERROR, 'Could not delete private message text', '', __LINE__, __FILE__, $delete_text_sql); } } } } else if ( $save && $mark_list && $folder != 'savebox' && $folder != 'outbox' ) { if ( !$userdata['session_logged_in'] ) { redirect(append_sid("login.$phpEx?redirect=privmsg.$phpEx&folder=inbox", true)); } if ( sizeof($mark_list) ) { // See if recipient is at their savebox limit $sql = "SELECT COUNT(privmsgs_id) AS savebox_items, MIN(privmsgs_date) AS oldest_post_time FROM " . PRIVMSGS_TABLE . " WHERE ( ( privmsgs_to_userid = " . $userdata['user_id'] . " AND privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . " ) OR ( privmsgs_from_userid = " . $userdata['user_id'] . " AND privmsgs_type = " . PRIVMSGS_SAVED_OUT_MAIL . ") )"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not obtain sent message info for sendee', '', __LINE__, __FILE__, $sql); } $sql_priority = ( SQL_LAYER == 'mysql' ) ? 'LOW_PRIORITY' : ''; if ( $saved_info = $db->sql_fetchrow($result) ) { if ( $userdata['user_level'] == ADMIN ) { $max_savebox_privmsgs = $board_config['max_savebox_privmsgs'] * 6; } else if ( $userdata['user_level'] == MOD ) { $max_savebox_privmsgs = $board_config['max_savebox_privmsgs'] * 3; } else { $max_savebox_privmsgs = $board_config['max_savebox_privmsgs']; } if ( $board_config['max_savebox_privmsgs'] && $saved_info['savebox_items'] >= $max_savebox_privmsgs ) { $sql = "SELECT privmsgs_id FROM " . PRIVMSGS_TABLE . " WHERE ( ( privmsgs_to_userid = " . $userdata['user_id'] . " AND privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . " ) OR ( privmsgs_from_userid = " . $userdata['user_id'] . " AND privmsgs_type = " . PRIVMSGS_SAVED_OUT_MAIL . ") ) AND privmsgs_date = " . $saved_info['oldest_post_time']; if ( !$result = $db->sql_query($sql) ) { message_die(GENERAL_ERROR, 'Could not find oldest privmsgs (save)', '', __LINE__, __FILE__, $sql); } $old_privmsgs_id = $db->sql_fetchrow($result); $old_privmsgs_id = $old_privmsgs_id['privmsgs_id']; $sql = "DELETE $sql_priority FROM " . PRIVMSGS_TABLE . " WHERE privmsgs_id = $old_privmsgs_id"; if ( !$db->sql_query($sql) ) { message_die(GENERAL_ERROR, 'Could not delete oldest privmsgs (save)', '', __LINE__, __FILE__, $sql); } $sql = "DELETE $sql_priority FROM " . PRIVMSGS_TEXT_TABLE . " WHERE privmsgs_text_id = $old_privmsgs_id"; if ( !$db->sql_query($sql) ) { message_die(GENERAL_ERROR, 'Could not delete oldest privmsgs text (save)', '', __LINE__, __FILE__, $sql); } } } $saved_sql_id = ''; for ($i = 0; $i < sizeof($mark_list); $i++) { $saved_sql_id .= (($saved_sql_id != '') ? ', ' : '') . intval($mark_list[$i]); } // Process request $saved_sql = "UPDATE " . PRIVMSGS_TABLE; // Decrement read/new counters if appropriate if ( $folder == 'inbox' || $folder == 'outbox' ) { switch ($folder) { case 'inbox': $sql = "privmsgs_to_userid = " . $userdata['user_id']; break; case 'outbox': $sql = "privmsgs_from_userid = " . $userdata['user_id']; break; } // Get information relevant to new or unread mail // so we can adjust users counters appropriately $sql = "SELECT privmsgs_to_userid, privmsgs_type FROM " . PRIVMSGS_TABLE . " WHERE privmsgs_id IN ($saved_sql_id) AND $sql AND privmsgs_type IN (" . PRIVMSGS_NEW_MAIL . ", " . PRIVMSGS_UNREAD_MAIL . ")"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not obtain user id list for outbox messages', '', __LINE__, __FILE__, $sql); } if ( $row = $db->sql_fetchrow($result) ) { $type = $dec = ''; $update_users = $update_list = array(); do { switch ($row['privmsgs_type']) { case PRIVMSGS_NEW_MAIL: $update_users['new'][$row['privmsgs_to_userid']]++; break; case PRIVMSGS_UNREAD_MAIL: $update_users['unread'][$row['privmsgs_to_userid']]++; break; } } while ($row = $db->sql_fetchrow($result)); if ( sizeof($update_users) ) { while (list($type, $users) = each($update_users)) { while (list($user_id, $dec) = each($users)) { $update_list[$type][$dec][] = $user_id; } } unset($update_users); while (list($type, $dec_ary) = each($update_list)) { switch ($type) { case 'new': $type = "user_new_privmsg"; break; case 'unread': $type = "user_unread_privmsg"; break; } while (list($dec, $user_ary) = each($dec_ary)) { $user_ids = implode(', ', $user_ary); $sql = "UPDATE " . USERS_TABLE . " SET $type = $type - $dec WHERE user_id IN ($user_ids)"; if ( !$db->sql_query($sql) ) { message_die(GENERAL_ERROR, 'Could not update user pm counters', '', __LINE__, __FILE__, $sql); } } } unset($update_list); } } $db->sql_freeresult($result); } switch ($folder) { case 'inbox': $saved_sql .= " SET privmsgs_type = " . PRIVMSGS_SAVED_IN_MAIL . " WHERE privmsgs_to_userid = " . $userdata['user_id'] . " AND ( privmsgs_type = " . PRIVMSGS_READ_MAIL . " OR privmsgs_type = " . PRIVMSGS_NEW_MAIL . " OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . ")"; break; case 'outbox': $saved_sql .= " SET privmsgs_type = " . PRIVMSGS_SAVED_OUT_MAIL . " WHERE privmsgs_from_userid = " . $userdata['user_id'] . " AND ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . " OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " ) "; break; case 'sentbox': $saved_sql .= " SET privmsgs_type = " . PRIVMSGS_SAVED_OUT_MAIL . " WHERE privmsgs_from_userid = " . $userdata['user_id'] . " AND privmsgs_type = " . PRIVMSGS_SENT_MAIL; break; } $saved_sql .= " AND privmsgs_id IN ($saved_sql_id)"; if ( !$db->sql_query($saved_sql) ) { message_die(GENERAL_ERROR, 'Could not save private messages', '', __LINE__, __FILE__, $saved_sql); } redirect(append_sid("privmsg.$phpEx?folder=savebox", true)); } } else if ( $submit || $refresh || $mode != '' ) { if ( !$userdata['session_logged_in'] ) { $user_id = ( isset($HTTP_GET_VARS[POST_USERS_URL]) ) ? '&' . POST_USERS_URL . '=' . intval($HTTP_GET_VARS[POST_USERS_URL]) : ''; redirect(append_sid("login.$phpEx?redirect=privmsg.$phpEx&folder=$folder&mode=$mode" . $user_id, true)); } // Toggles if ( !$board_config['allow_html'] ) { $html_on = 0; } else { $html_on = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['disable_html']) ) ? 0 : TRUE ) : $userdata['user_allowhtml']; } if ( !$user_can_use_bbcode ) { $bbcode_on = 0; } else { $bbcode_on = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['disable_bbcode']) ) ? 0 : TRUE ) : $userdata['user_allowbbcode']; } if ( !$board_config['allow_smilies'] ) { $smilies_on = 0; } else { $smilies_on = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['disable_smilies']) ) ? 0 : TRUE ) : $userdata['user_allowsmile']; } $attach_sig = ($submit || $refresh) ? ( ( !empty($HTTP_POST_VARS['attach_sig']) ) ? TRUE : 0 ) : $userdata['user_attachsig']; $user_sig = ($userdata['user_sig'] != '' && $board_config['allow_sig']) ? $userdata['user_sig'] : ''; if ( $submit && $mode != 'edit' ) { // Flood control $sql = "SELECT MAX(privmsgs_date) AS last_post_time FROM " . PRIVMSGS_TABLE . " WHERE privmsgs_from_userid = " . $userdata['user_id']; if ( $result = $db->sql_query($sql) ) { $db_row = $db->sql_fetchrow($result); $last_post_time = $db_row['last_post_time']; if ( (( CR_TIME - $last_post_time ) < $board_config['flood_interval']) && $userdata['user_level'] == USER && !$userdata['user_jr'] ) { message_die(GENERAL_MESSAGE, $lang['Flood_Error']); } } // End Flood control } if ($submit && $mode == 'edit') { $sql = 'SELECT privmsgs_from_userid FROM ' . PRIVMSGS_TABLE . ' WHERE privmsgs_id = ' . (int) $privmsg_id . ' AND privmsgs_from_userid = ' . $userdata['user_id']; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, "Could not obtain message details", "", __LINE__, __FILE__, $sql); } if (!($row = $db->sql_fetchrow($result))) { message_die(GENERAL_MESSAGE, $lang['No_such_post']); } $db->sql_freeresult($result); unset($row); } if ( $submit ) { if ( !empty($HTTP_POST_VARS['username']) ) { $to_username = phpbb_clean_username($HTTP_POST_VARS['username']); $sql = "SELECT user_id, user_level, user_notify_pm, user_email, user_lang, user_active, user_aim, user_notify_gg FROM " . USERS_TABLE . " WHERE username = '" . str_replace("'", "''", $to_username) . "' AND user_id <> " . ANONYMOUS; if ( !($result = $db->sql_query($sql)) ) { $error = TRUE; $error_msg = $lang['No_user_id_specified']; } if (!($to_userdata = $db->sql_fetchrow($result))) { $error = TRUE; $error_msg = $lang['No_user_id_specified']; } } else { $error = TRUE; $error_msg .= ( ( !empty($error_msg) ) ? '<br />' : '' ) . $lang['No_to_user']; } $privmsg_subject = trim(strip_tags($HTTP_POST_VARS['subject'])); if ( empty($privmsg_subject) ) { $error = TRUE; $error_msg .= ( ( !empty($error_msg) ) ? '<br />' : '' ) . $lang['Empty_subject']; } if ( !empty($HTTP_POST_VARS['message']) ) { if ( !$error ) { if ( $bbcode_on ) { $bbcode_uid = make_bbcode_uid(); } $privmsg_message = prepare_message($HTTP_POST_VARS['message'], $html_on, $bbcode_on, $smilies_on, $bbcode_uid); } } else { $error = TRUE; $error_msg .= ( ( !empty($error_msg) ) ? '<br />' : '' ) . $lang['Empty_message']; } } if ( $submit && !$error ) { // Has admin prevented user from sending PM's? if ( !$userdata['user_allow_pm'] ) { message_die(GENERAL_MESSAGE, $lang['Cannot_send_privmsg']); } $msg_time = CR_TIME; if ( $sid == '' || $sid != $userdata['session_id'] ) { message_die(GENERAL_ERROR, 'Invalid_session'); } if ( $mode != 'edit' ) { check_enable_pm($to_userdata['user_id']); // See if recipient is at their inbox limit $sql = "SELECT COUNT(privmsgs_id) AS inbox_items, MIN(privmsgs_date) AS oldest_post_time FROM " . PRIVMSGS_TABLE . " WHERE ( privmsgs_type = " . PRIVMSGS_NEW_MAIL . " OR privmsgs_type = " . PRIVMSGS_READ_MAIL . " OR privmsgs_type = " . PRIVMSGS_UNREAD_MAIL . " ) AND privmsgs_to_userid = " . $to_userdata['user_id']; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_MESSAGE, $lang['No_user_id_specified']); } $sql_priority = ( SQL_LAYER == 'mysql' ) ? 'LOW_PRIORITY' : ''; if ( $inbox_info = $db->sql_fetchrow($result) ) { if ( $to_userdata['user_level'] == ADMIN ) { $max_inbox_privmsgs = $board_config['max_inbox_privmsgs'] * 6; } else if ( $to_userdata['user_level'] == MOD ) { $max_inbox_privmsgs = $board_config['max_inbox_privmsgs'] * 3; } else { $max_inbox_privmsgs = $board_config['max_inbox_privmsgs']; } if ( $board_config['max_inbox_privmsgs'] && $inbox_info['inbox_items'] >= $max_inbox_privmsgs ) { $sql = "SELECT privmsgs_id FROM " . PRIVMSGS_TABLE . " WHERE ( privmsgs_type = '" . PRIVMSGS_NEW_MAIL . "' OR privmsgs_type = '" . PRIVMSGS_READ_MAIL . "' OR privmsgs_type = '" . PRIVMSGS_UNREAD_MAIL . "' ) AND privmsgs_date = '" . $inbox_info['oldest_post_time'] . "' AND privmsgs_to_userid = " . $to_userdata['user_id']; if ( !$result = $db->sql_query($sql) ) { message_die(GENERAL_ERROR, 'Could not find oldest privmsgs (inbox)', '', __LINE__, __FILE__, $sql); } $old_privmsgs_id = $db->sql_fetchrow($result); $old_privmsgs_id = $old_privmsgs_id['privmsgs_id']; $sql = "DELETE $sql_priority FROM " . PRIVMSGS_TABLE . " WHERE privmsgs_id = '$old_privmsgs_id'"; if ( !$db->sql_query($sql) ) { message_die(GENERAL_ERROR, 'Could not delete oldest privmsgs (inbox)'.$sql, '', __LINE__, __FILE__, $sql); } $sql = "DELETE $sql_priority FROM " . PRIVMSGS_TEXT_TABLE . " WHERE privmsgs_text_id = '$old_privmsgs_id'"; if ( !$db->sql_query($sql) ) { message_die(GENERAL_ERROR, 'Could not delete oldest privmsgs text (inbox)', '', __LINE__, __FILE__, $sql); } } } $sql_info = "INSERT INTO " . PRIVMSGS_TABLE . " (privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_ip, privmsgs_enable_html, privmsgs_enable_bbcode, privmsgs_enable_smilies, privmsgs_attach_sig) VALUES (" . PRIVMSGS_NEW_MAIL . ", '" . str_replace("'", "''", $privmsg_subject) . "', " . $userdata['user_id'] . ", " . $to_userdata['user_id'] . ", $msg_time, '$user_ip', $html_on, $bbcode_on, $smilies_on, $attach_sig)"; } else { $sql_info = "UPDATE " . PRIVMSGS_TABLE . " SET privmsgs_type = " . PRIVMSGS_NEW_MAIL . ", privmsgs_subject = '" . str_replace("'", "''", $privmsg_subject) . "', privmsgs_from_userid = " . $userdata['user_id'] . ", privmsgs_to_userid = " . $to_userdata['user_id'] . ", privmsgs_date = $msg_time, privmsgs_ip = '$user_ip', privmsgs_enable_html = $html_on, privmsgs_enable_bbcode = $bbcode_on, privmsgs_enable_smilies = $smilies_on, privmsgs_attach_sig = $attach_sig WHERE privmsgs_id = $privmsg_id"; } if ( !($result = $db->sql_query($sql_info, BEGIN_TRANSACTION)) ) { message_die(GENERAL_ERROR, "Could not insert/update private message sent info.", "", __LINE__, __FILE__, $sql_info); } if ( $mode != 'edit' ) { $privmsg_sent_id = $db->sql_nextid(); $sql = "INSERT INTO " . PRIVMSGS_TEXT_TABLE . " (privmsgs_text_id, privmsgs_bbcode_uid, privmsgs_text) VALUES ($privmsg_sent_id, '" . $bbcode_uid . "', '" . str_replace("'", "''", $privmsg_message) . "')"; } else { $sql = "UPDATE " . PRIVMSGS_TEXT_TABLE . " SET privmsgs_text = '" . str_replace("'", "''", $privmsg_message) . "', privmsgs_bbcode_uid = '$bbcode_uid' WHERE privmsgs_text_id = $privmsg_id"; } if ( !$db->sql_query($sql, END_TRANSACTION) ) { message_die(GENERAL_ERROR, "Could not insert/update private message sent text.", "", __LINE__, __FILE__, $sql); } if ( defined('ATTACHMENTS_ON') ) { $attachment_mod['pm']->insert_attachment_pm($privmsg_id); } if ( $mode != 'edit' ) { // Add to the users new pm counter $sql = "UPDATE " . USERS_TABLE . " SET user_new_privmsg = user_new_privmsg + 1, user_last_privmsg = " . CR_TIME . " WHERE user_id = " . $to_userdata['user_id']; if ( !$status = $db->sql_query($sql) ) { message_die(GENERAL_ERROR, 'Could not update private message new/read status for user', '', __LINE__, __FILE__, $sql); } $script_name = preg_replace('/^/?(.*?)/?$/', "1", trim($board_config['script_path'])); $script_name = ( $script_name != '' ) ? $script_name . '/privmsg.'.$phpEx : 'privmsg.'.$phpEx; $server_name = trim($board_config['server_name']); $server_protocol = ( $board_config['cookie_secure'] ) ? 'https://' : 'http://'; $server_port = ( $board_config['server_port'] <> 80 ) ? ':' . trim($board_config['server_port']) . '/' : '/'; if ( $to_userdata['user_notify_gg'] && !empty($to_userdata['user_aim']) && !empty($board_config['numer_gg']) && !empty($board_config['haslo_gg'])) { $tresc = """ . $board_config['sitename'] . ""rn" . sprintf($lang['gg_header_info_pm'], $userdata['username']) . "rnrn"; $tresc2 = sprintf($lang['l_notify_gg_privmsg'], $server_protocol . $server_name . $server_port . $script_name . '?folder=inbox'); $tresc = $tresc.$tresc2; require_once('includes/functions_gg_notice.'.$phpEx); wiadomosc_gg( intval(trim($to_userdata['user_aim'])), $tresc, intval(trim($board_config['numer_gg'])), $board_config['haslo_gg']); $gg_send = true; } if ( $to_userdata['user_notify_pm'] && !empty($to_userdata['user_email']) && $to_userdata['user_active'] && !$gg_send ) { include($phpbb_root_path . 'includes/emailer.'.$phpEx); $emailer = new emailer($board_config['smtp_delivery']); $emailer->from($board_config['email_from']); $emailer->replyto($board_config['email_return_path']); $emailer->use_template('privmsg_notify', $to_userdata['user_lang']); $emailer->email_address($to_userdata['user_email']); $emailer->set_subject($lang['Notification_subject']); $emailer->assign_vars(array( 'USERNAME' => stripslashes($to_username), 'POSTER_USERNAME' => stripslashes($userdata['username']), 'SITENAME' => $board_config['sitename'], 'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('<br />', "n", "-- n" . $board_config['board_email_sig']) : '', 'U_INBOX' => $server_protocol . $server_name . $server_port . $script_name . '?folder=inbox') ); $emailer->send(); $emailer->reset(); } } $template->assign_vars(array( 'META' => '<meta http-equiv="refresh" content="' . $board_config['refresh'] . ';url=' . append_sid("privmsg.$phpEx?folder=inbox") . '">') ); $msg = $lang['Message_sent'] . '<br /><br />' . sprintf($lang['Click_return_inbox'], '<a href="' . append_sid("privmsg.$phpEx?folder=inbox") . '">', '</a> ') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a>'); message_die(GENERAL_MESSAGE, $msg); } else if ( $preview || $refresh || $error ) { // If we're previewing or refreshing then obtain the data // passed to the script, process it a little, do some checks // where neccessary, etc. $to_username = (isset($HTTP_POST_VARS['username'])) ? trim(strip_tags(stripslashes($HTTP_POST_VARS['username']))) : ''; $privmsg_subject = (isset($HTTP_POST_VARS['subject'])) ? trim(strip_tags(stripslashes($HTTP_POST_VARS['subject']))) : ''; $privmsg_message = (isset($HTTP_POST_VARS['message'])) ? trim($HTTP_POST_VARS['message']) : ''; $privmsg_message = preg_replace('#<textarea>#si', '<textarea>', $privmsg_message); if ( !$preview ) { $privmsg_message = stripslashes($privmsg_message); } // Do mode specific things if ( $mode == 'post' ) { $page_title = $lang['Post_new_pm']; $user_sig = ($userdata['user_sig'] != '' && $board_config['allow_sig']) ? $userdata['user_sig'] : ''; $user_sig_image = ($userdata['user_sig_image'] != '' && $board_config['allow_sig'] && $board_config['allow_sig_image']) ? $userdata['user_sig_image'] : ''; } else if ( $mode == 'reply' ) { $page_title = $lang['Post_reply_pm']; $user_sig = ($userdata['user_sig'] != '' && $board_config['allow_sig']) ? $userdata['user_sig'] : ''; $user_sig_image = ( $userdata['user_sig_image'] != '' && $board_config['allow_sig'] && $board_config['allow_sig_image']) ? '<img src="' . $board_config['sig_images_path'] . '/' . $userdata['user_sig_image'] . '" border="0" alt="" />' : ''; } else if ( $mode == 'edit' ) { $page_title = $lang['Edit_pm']; $sql = "SELECT u.user_id, u.user_sig, u.user_sig_image FROM (" . PRIVMSGS_TABLE . " pm, " . USERS_TABLE . " u) WHERE pm.privmsgs_id = $privmsg_id AND u.user_id = pm.privmsgs_from_userid"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not obtain post and post text', '', __LINE__, __FILE__, $sql); } if ( $postrow = $db->sql_fetchrow($result) ) { if ( $userdata['user_id'] != $postrow['user_id'] ) { message_die(GENERAL_MESSAGE, $lang['Edit_own_posts']); } $user_sig = ($postrow['user_sig'] != '' && $board_config['allow_sig']) ? $postrow['user_sig'] : ''; $user_sig_image = ($postrow['user_sig_image'] != '' && $board_config['allow_sig'] && $board_config['allow_sig_image']) ? '<img src="' . $board_config['sig_images_path'] . '/' . $postrow['user_sig_image'] . '" alt="" border="0" />' : ''; } } } else { if ( !$privmsg_id && ( $mode == 'reply' || $mode == 'edit' || $mode == 'quote' ) ) { message_die(GENERAL_ERROR, $lang['No_post_id']); } if ( !empty($HTTP_GET_VARS[POST_USERS_URL]) ) { $user_id = intval($HTTP_GET_VARS[POST_USERS_URL]); check_enable_pm($user_id); $sql = "SELECT username FROM " . USERS_TABLE . " WHERE user_id = $user_id AND user_id <> " . ANONYMOUS; if ( !($result = $db->sql_query($sql)) ) { $error = TRUE; $error_msg = $lang['No_user_id_specified']; } if ( $row = $db->sql_fetchrow($result) ) { $to_username = $row['username']; } } else if ( $mode == 'edit' ) { $sql = "SELECT pm.*, pmt.privmsgs_bbcode_uid, pmt.privmsgs_t
Dodanych wklejek: 12215
Powered By (Pav32) Pastebin © 2011