newthread.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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: newthread.php 35251 2015-04-09 06:05:51Z nemohou $
  7. */
  8. if(!defined('IN_MOBILE_API')) {
  9. exit('Access Denied');
  10. }
  11. $_GET['mod'] = 'post';
  12. $_GET['action'] = 'newthread';
  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. if(!empty($_POST['allowsound'])) {
  22. $setstatus = array(1, 0, 0);
  23. } elseif(!empty($_POST['allowphoto'])) {
  24. $setstatus = array(0, 1, 1);
  25. } elseif(!empty($_POST['allowlocal'])) {
  26. $setstatus = array(0, 1, 0);
  27. } else {
  28. $setstatus = array(0, 0, 1);
  29. }
  30. foreach($setstatus as $i => $bit) {
  31. $threadstatus = setstatus(13 - $i, $bit, $threadstatus);
  32. }
  33. C::t('forum_thread')->update($values['tid'], array('status' => $threadstatus));
  34. $poststatus = DB::result_first("SELECT status FROM ".DB::table('forum_post')." WHERE pid='$values[pid]'");
  35. $poststatus = setstatus(4, 1, $poststatus);
  36. if(!empty($_POST['allowlocal'])) {
  37. $poststatus = setstatus(6, 1, $poststatus);
  38. }
  39. if(!empty($_POST['allowsound'])) {
  40. $poststatus = setstatus(7, 1, $poststatus);
  41. }
  42. if(!empty($_POST['mobiletype'])) {
  43. $mobiletype = base_convert($_POST['mobiletype'], 10, 2);
  44. $mobiletype = sprintf('%03d', $mobiletype);
  45. for($i = 0;$i < 3;$i++) {
  46. $poststatus = setstatus(10 - $i, $mobiletype{$i}, $poststatus);
  47. }
  48. }
  49. C::t('forum_post')->update(0, $values['pid'], array('status' => $poststatus));
  50. if($_POST['location']) {
  51. list($mapx, $mapy, $location) = explode('|', dhtmlspecialchars($_POST['location']));
  52. C::t('forum_post_location')->insert(array(
  53. 'pid' => $values['pid'],
  54. 'tid' => $values['tid'],
  55. 'uid' => $_G['uid'],
  56. 'mapx' => $mapx,
  57. 'mapy' => $mapy,
  58. 'location' => $location,
  59. ));
  60. }
  61. }
  62. }
  63. function output() {
  64. global $_G;
  65. $variable = array(
  66. 'tid' => $GLOBALS['tid'],
  67. 'pid' => $GLOBALS['pid'],
  68. );
  69. if(!empty($_G['forum']['threadtypes'])) {
  70. $variable['threadtypes'] = $_G['forum']['threadtypes'];
  71. }
  72. mobile_core::result(mobile_core::variable($variable));
  73. }
  74. }
  75. ?>