sendreply.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: sendreply.php 34771 2014-07-30 09:29:44Z nemohou $
  7. */
  8. if(!defined('IN_MOBILE_API')) {
  9. exit('Access Denied');
  10. }
  11. $_GET['mod'] = 'post';
  12. $_GET['action'] = 'reply';
  13. include_once 'forum.php';
  14. class mobile_api {
  15. function common() {
  16. }
  17. function post_mobile_message($message, $url_forward, $values, $extraparam, $custom) {
  18. if($values['tid'] && $values['pid']) {
  19. global $_G;
  20. $threadstatus = DB::result_first("SELECT status FROM ".DB::table('forum_thread')." WHERE tid='$values[tid]'");
  21. $setstatusold = base_convert(getstatus($threadstatus, 13).getstatus($threadstatus, 12).getstatus($threadstatus, 11), 2, 10);
  22. $updatestatus = false;
  23. if(!empty($_POST['allowsound'])) {
  24. $setstatus = array(1, 0, 0);
  25. $updatestatus = $setstatusold < 4;
  26. } elseif(!empty($_POST['allowphoto'])) {
  27. $setstatus = array(0, 1, 1);
  28. $updatestatus = $setstatusold < 3;
  29. } elseif(!empty($_POST['allowlocal'])) {
  30. $setstatus = array(0, 1, 0);
  31. $updatestatus = $setstatusold < 2;
  32. } else {
  33. $setstatus = array(0, 0, 1);
  34. }
  35. if($updatestatus) {
  36. foreach($setstatus as $i => $bit) {
  37. $threadstatus = setstatus(13 - $i, $bit, $threadstatus);
  38. }
  39. C::t('forum_thread')->update($values['tid'], array('status' => $threadstatus));
  40. }
  41. $posttable = getposttablebytid($values['tid']);
  42. $poststatus = DB::result_first("SELECT status FROM ".DB::table($posttable)." WHERE pid='$values[pid]'");
  43. $poststatus = setstatus(4, 1, $poststatus);
  44. if(!empty($_POST['allowlocal'])) {
  45. $poststatus = setstatus(6, 1, $poststatus);
  46. }
  47. if(!empty($_POST['allowsound'])) {
  48. $poststatus = setstatus(7, 1, $poststatus);
  49. }
  50. if(!empty($_POST['mobiletype']) && $_POST['mobiletype'] < 8) {
  51. $mobiletype = base_convert($_POST['mobiletype'], 10, 2);
  52. $mobiletype = sprintf('%03d', $mobiletype);
  53. for($i = 0;$i < 3;$i++) {
  54. $poststatus = setstatus(10 - $i, $mobiletype{$i}, $poststatus);
  55. }
  56. }
  57. C::t('forum_post')->update('tid:'.$values['tid'], $values['pid'], array('status' => $poststatus));
  58. if($_POST['location']) {
  59. list($mapx, $mapy, $location) = explode('|', dhtmlspecialchars($_POST['location']));
  60. C::t('forum_post_location')->insert(array(
  61. 'pid' => $values['pid'],
  62. 'tid' => $values['tid'],
  63. 'uid' => $_G['uid'],
  64. 'mapx' => $mapx,
  65. 'mapy' => $mapy,
  66. 'location' => $location,
  67. ));
  68. }
  69. }
  70. }
  71. function output() {
  72. global $_G;
  73. $variable = array(
  74. 'tid' => $_G['tid'],
  75. 'pid' => $GLOBALS['pid'],
  76. 'noticetrimstr' => $GLOBALS['noticetrimstr'],
  77. );
  78. mobile_core::result(mobile_core::variable($variable));
  79. }
  80. }
  81. ?>