pm.php 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. //decode by http://dezend.qiling.org QQ 2859470
  3. function member_groups()
  4. {
  5. global $db;
  6. global $db_mymps;
  7. $all = $db->getAll('SELECT * FROM `' . $db_mymps . 'member_level`');
  8. foreach ($all as $k => $v) {
  9. $mymps .= '<option value=' . $v[id] . '>' . $v[levelname] . '</option>';
  10. }
  11. return $mymps;
  12. }
  13. define('CURSCRIPT', 'pm');
  14. require_once dirname(__FILE__) . '/global.php';
  15. require_once MYMPS_INC . '/db.class.php';
  16. require_once MYMPS_MEMBER . '/include/common.func.php';
  17. !in_array($part, array('outbox', 'send', 'del')) && ($part = 'send');
  18. chk_admin_purview('purview_站内短消息');
  19. if (!submit_check(CURSCRIPT . '_submit')) {
  20. $here = $part == 'send' ? '群发短消息' : '已发送短消息';
  21. if ($part == 'outbox') {
  22. $sql = 'SELECT * FROM `' . $db_mymps . 'member_pm` WHERE if_sys = \'1\' AND if_del = \'0\' ORDER BY id DESC';
  23. $rows_num = mymps_count('member_pm', 'WHERE if_sys = \'1\'');
  24. $param = setParam(array('part'));
  25. $pm = page1($sql);
  26. } else {
  27. if ($part == 'send' && $id) {
  28. $pm_row = $db->getRow('SELECT title,content FROM `' . $db_mymps . 'member_pm` WHERE id = \'' . $id . '\'');
  29. $title = de_textarea_post_change($pm_row['title']);
  30. $content = de_textarea_post_change($pm_row['content']);
  31. } else {
  32. if ($part == 'del') {
  33. mymps_delete('member_pm', 'WHERE id = \'' . $id . '\'');
  34. write_msg('编号为' . $id . '的短消息已成功删除!', $url, 'writerecord');
  35. }
  36. }
  37. }
  38. include mymps_tpl(CURSCRIPT . '_' . $part);
  39. } else {
  40. if (is_array($delids)) {
  41. foreach ($delids as $kids => $vids) {
  42. mymps_delete('member_pm', 'WHERE id = ' . $vids);
  43. }
  44. write_msg('指定的短消息已成功删除!', $url);
  45. }
  46. set_time_limit(0);
  47. $content = textarea_post_change($content);
  48. empty($touser) && empty($group) && exit('请指定发送用户名!');
  49. echo '<style>*{font-size:12px}</style>';
  50. if (is_array($group)) {
  51. foreach ($group as $kid => $vid) {
  52. if (!($rgrow = $db->getAll('SELECT userid FROM `' . $db_mymps . 'member` WHERE levelid = \'' . $vid . '\''))) {
  53. echo '该会员组下尚没有会员!';
  54. } else {
  55. foreach ($rgrow as $row) {
  56. $result = sendpm($admin_id, $row[userid], $title, $content, 1);
  57. if ($result[succ] == 'yes') {
  58. echo '发送状态:<font color=green>发送成功!</font> 接收用户:' . $result[member] . '<br>';
  59. } else {
  60. echo '发送状态:<font color=red>发送失败!</font> 接收用户:' . $result[member] . '<br>';
  61. }
  62. ob_flush();
  63. flush();
  64. }
  65. }
  66. }
  67. } else {
  68. $touser = str_replace(',', ',', $touser);
  69. $touser = explode(',', $touser);
  70. foreach ($touser as $kuser => $vuser) {
  71. $result = sendpm($admin_id, $vuser, $title, $content, 1);
  72. echo '<style>*{font-size:12px}</style>';
  73. if ($result[succ] == 'yes') {
  74. echo '发送状态:<font color=green>发送成功!</font> 接收用户:' . $result[member] . '<br>';
  75. } else {
  76. echo '发送状态:<font color=red>发送失败!</font> 接收用户:' . $result[member] . '<br>';
  77. }
  78. ob_flush();
  79. flush();
  80. }
  81. }
  82. write_msg('短消息发送结束', 'olmsg', 'record');
  83. }
  84. is_object($db) && $db->Close();
  85. $mymps_global = $db = $db_mymps = $part = NULL;