inc_pm.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. if (!defined('IN_MYMPS')) {
  3. exit('Forbidden');
  4. }
  5. require_once MEMBERDIR . '/include/common.func.php';
  6. !in_array($ac, array('outbox', 'inbox', 'sendnew', 'view')) && ($ac = 'inbox');
  7. if (submit_check('pm_submit')) {
  8. if (is_array($deleteids)) {
  9. $where = $ac == 'inbox' ? 'touser = \'' . $s_uid . '\'' : 'fromuser = \'' . $s_uid . '\'';
  10. $db->query('DELETE FROM `' . $db_mymps . 'member_pm` WHERE ' . $where . ' AND id ' . create_in($deleteids));
  11. write_msg('', '?m=pm&success=8&ac=' . $ac . '&page=' . $page);
  12. }
  13. else {
  14. if (empty($touser)) {
  15. write_msg('', '?m=pm&error=1&ac=' . $ac . ($id != '' ? '&id=' . $id : ''));
  16. }
  17. if (empty($title) && empty($content)) {
  18. write_msg('', '?m=pm&error=10&ac=' . $ac);
  19. }
  20. $content = textarea_post_change($content);
  21. $result = sendpm($s_uid, $touser, $title, $content);
  22. $url = $result['succ'] == 'yes' ? '?m=pm&success=7&ac=' . $ac : '?m=pm&error=9&ac=' . $ac;
  23. $url .= '&id=' . $id;
  24. write_msg('', $url);
  25. }
  26. }
  27. else {
  28. $id = isset($id) ? intval($id) : '';
  29. if (!empty($id)) {
  30. $db->query('UPDATE `' . $db_mymps . 'member_pm` SET `if_read` = \'1\' WHERE id = \'' . $id . '\'');
  31. $pm = $db->getRow('SELECT * FROM `' . $db_mymps . 'member_pm` WHERE id = \'' . $id . '\'');
  32. if ($pm['id'] == '') {
  33. write_msg('', '?m=pm&error=12&ac=' . $ac . '&page=' . $page);
  34. }
  35. }
  36. else {
  37. if (empty($id) && in_array($ac, array('inbox', 'outbox'))) {
  38. $where = $ac == 'inbox' ? ' WHERE touser = \'' . $s_uid . '\'' : ' WHERE fromuser = \'' . $s_uid . '\'';
  39. $sql = 'SELECT * FROM `' . $db_mymps . 'member_pm` ' . $where . ' ORDER BY pubtime DESC';
  40. $rows_num = mymps_count('member_pm', $where);
  41. $param = setParam(array('m', 'ac'));
  42. $pm = page1($sql);
  43. }
  44. }
  45. $location = location();
  46. include mymps_tpl('pm_' . ($id != '' ? 'view' : $ac));
  47. }
  48. ?>