sendreply.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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($message == 'comment_add_succeed') {
  19. showmessage($message);
  20. }
  21. if ($values['tid'] && $values['pid']) {
  22. global $_G;
  23. $threadstatus = DB::result_first("SELECT status FROM " . DB::table('forum_thread') . " WHERE tid='$values[tid]'");
  24. $setstatusold = base_convert(getstatus($threadstatus, 13) . getstatus($threadstatus, 12) . getstatus($threadstatus, 11), 2, 10);
  25. $updatestatus = false;
  26. if (!empty($_POST['allowsound'])) {
  27. $setstatus = array(1, 0, 0);
  28. $updatestatus = $setstatusold < 4;
  29. } elseif (!empty($_POST['allowphoto'])) {
  30. $setstatus = array(0, 1, 1);
  31. $updatestatus = $setstatusold < 3;
  32. } elseif (!empty($_POST['allowlocal'])) {
  33. $setstatus = array(0, 1, 0);
  34. $updatestatus = $setstatusold < 2;
  35. } else {
  36. $setstatus = array(0, 0, 1);
  37. }
  38. if ($updatestatus) {
  39. foreach ($setstatus as $i => $bit) {
  40. $threadstatus = setstatus(13 - $i, $bit, $threadstatus);
  41. }
  42. C::t('forum_thread')->update($values['tid'], array('status' => $threadstatus));
  43. }
  44. $posttable = getposttablebytid($values['tid']);
  45. $poststatus = DB::result_first("SELECT status FROM " . DB::table($posttable) . " WHERE pid='$values[pid]'");
  46. $poststatus = setstatus(4, 1, $poststatus);
  47. if (!empty($_POST['allowlocal'])) {
  48. $poststatus = setstatus(6, 1, $poststatus);
  49. }
  50. if (!empty($_POST['allowsound'])) {
  51. $poststatus = setstatus(7, 1, $poststatus);
  52. }
  53. if (!empty($_POST['mobiletype']) && $_POST['mobiletype'] < 8) {
  54. $mobiletype = base_convert($_POST['mobiletype'], 10, 2);
  55. $mobiletype = sprintf('%03d', $mobiletype);
  56. for ($i = 0; $i < 3; $i++) {
  57. $poststatus = setstatus(10 - $i, $mobiletype{$i}, $poststatus);
  58. }
  59. }
  60. C::t('forum_post')->update('tid:' . $values['tid'], $values['pid'], array('status' => $poststatus));
  61. if($_POST['location']) {
  62. list($mapx, $mapy, $location) = explode('|', dhtmlspecialchars($_POST['location']));
  63. C::t('forum_post_location')->insert(array(
  64. 'pid' => $values['pid'],
  65. 'tid' => $values['tid'],
  66. 'uid' => $_G['uid'],
  67. 'mapx' => $mapx,
  68. 'mapy' => $mapy,
  69. 'location' => $location,
  70. ));
  71. }
  72. }
  73. }
  74. function output() {
  75. global $_G;
  76. $variable = array(
  77. 'tid' => $_G['tid'],
  78. 'pid' => $GLOBALS['pid'],
  79. );
  80. mobile_core::result(mobile_core::variable($variable));
  81. }
  82. }
  83. ?>