viewthread.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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: viewthread.php 34314 2014-02-20 01:04:24Z nemohou $
  7. */
  8. if(!defined('IN_MOBILE_API')) {
  9. exit('Access Denied');
  10. }
  11. $_GET['mod'] = 'viewthread';
  12. include_once 'forum.php';
  13. class mobile_api {
  14. function common() {
  15. }
  16. function output() {
  17. global $_G, $thread;
  18. if($GLOBALS['hiddenreplies']) {
  19. foreach($GLOBALS['postlist'] as $k => $post) {
  20. if(!$post['first'] && $_G['uid'] != $post['authorid'] && $_G['uid'] != $_G['forum_thread']['authorid'] && !$_G['forum']['ismoderator']) {
  21. $GLOBALS['postlist'][$k]['message'] = lang('plugin/mobile', 'mobile_post_author_visible');
  22. $GLOBALS['postlist'][$k]['attachments'] = array();
  23. }
  24. }
  25. }
  26. $_G['thread']['lastpost'] = dgmdate($_G['thread']['lastpost']);
  27. $variable = array(
  28. 'thread' => $_G['thread'],
  29. 'fid' => $_G['fid'],
  30. 'postlist' => array_values(mobile_core::getvalues($GLOBALS['postlist'], array('/^\d+$/'), array('pid', 'tid', 'author', 'first', 'dbdateline', 'dateline', 'username', 'adminid', 'memberstatus', 'authorid', 'username', 'groupid', 'memberstatus', 'status', 'message', 'number', 'memberstatus', 'groupid', 'attachment', 'attachments', 'attachlist', 'imagelist', 'anonymous'))),
  31. 'imagelist' => array(),
  32. 'ppp' => $_G['ppp'],
  33. 'setting_rewriterule' => $_G['setting']['rewriterule'],
  34. 'setting_rewritestatus' => $_G['setting']['rewritestatus'],
  35. 'forum_threadpay' => $_G['forum_threadpay'],
  36. 'cache_custominfo_postno' => $_G['cache']['custominfo']['postno'],
  37. );
  38. if(!empty($GLOBALS['threadsortshow'])) {
  39. $optionlist = array();
  40. foreach ($GLOBALS['threadsortshow']['optionlist'] AS $key => $val) {
  41. $val['optionid'] = $key;
  42. $optionlist[] = $val;
  43. }
  44. if(!empty($optionlist)) {
  45. $GLOBALS['threadsortshow']['optionlist'] = $optionlist;
  46. $GLOBALS['threadsortshow']['threadsortname'] = $_G['forum']['threadsorts']['types'][$thread['sortid']];
  47. }
  48. }
  49. $threadsortshow = mobile_core::getvalues($GLOBALS['threadsortshow'], array('/^(?!typetemplate).*$/'));
  50. if(!empty($threadsortshow)) {
  51. $variable['threadsortshow'] = $threadsortshow;
  52. }
  53. foreach($variable['postlist'] as $k => $post) {
  54. if(!$_G['forum']['ismoderator'] && $_G['setting']['bannedmessages'] & 1 && (($post['authorid'] && !$post['username']) || ($_G['thread']['digest'] == 0 && ($post['groupid'] == 4 || $post['groupid'] == 5 || $post['memberstatus'] == '-1')))) {
  55. $message = lang('forum/template', 'message_banned');
  56. } elseif(!$_G['forum']['ismoderator'] && $post['status'] & 1) {
  57. $message = lang('forum/template', 'message_single_banned');
  58. } elseif($GLOBALS['needhiddenreply']) {
  59. $message = lang('forum/template', 'message_ishidden_hiddenreplies');
  60. } elseif($post['first'] && $_G['forum_threadpay']) {
  61. $message = lang('forum/template', 'pay_threads').' '.$GLOBALS['thread']['price'].' '.$_G['setting']['extcredits'][$_G['setting']['creditstransextra'][1]]['unit'].$_G['setting']['extcredits'][$_G['setting']['creditstransextra'][1]]['title'];
  62. } elseif($_G['forum_discuzcode']['passwordlock']) {
  63. $message = lang('forum/template', 'message_password_exists');
  64. } else {
  65. $message = '';
  66. }
  67. if($message) {
  68. $variable['postlist'][$k]['message'] = $message;
  69. }
  70. if($post['anonymous'] && !$_G['forum']['ismoderator']) {
  71. $variable['postlist'][$k]['username'] = $variable['postlist'][$k]['author'] = $_G['setting']['anonymoustext'];
  72. $variable['postlist'][$k]['adminid'] = $variable['postlist'][$k]['groupid'] = $variable['postlist'][$k]['authorid'] = 0;
  73. if($post['first']) {
  74. $variable['thread']['authorid'] = 0;
  75. }
  76. }
  77. if(strpos($variable['postlist'][$k]['message'], '[/tthread]') !== FALSE) {
  78. $matches = array();
  79. preg_match('/\[tthread=(.+?),(.+?)\](.*?)\[\/tthread\]/', $variable['postlist'][$k]['message'], $matches);
  80. $variable['postlist'][$k]['message'] = preg_replace('/\[tthread=(.+?)\](.*?)\[\/tthread\]/', lang('plugin/qqconnect', 'connect_tthread_message', array('username' => $matches[1], 'nick' => $matches[2])), $variable['postlist'][$k]['message']);
  81. }
  82. }
  83. foreach($GLOBALS['aimgs'] as $pid => $aids) {
  84. foreach($aids as $aid) {
  85. $variable['imagelist'][] = $GLOBALS['postlist'][$pid]['attachments'][$aid]['url'].$GLOBALS['postlist'][$pid]['attachments'][$aid]['attachment'];
  86. }
  87. }
  88. if(!empty($GLOBALS['polloptions'])) {
  89. $variable['special_poll']['polloptions'] = $GLOBALS['polloptions'];
  90. $variable['special_poll']['expirations'] = $GLOBALS['expirations'];
  91. $variable['special_poll']['multiple'] = $GLOBALS['multiple'];
  92. $variable['special_poll']['maxchoices'] = $GLOBALS['maxchoices'];
  93. $variable['special_poll']['voterscount'] = $GLOBALS['voterscount'];
  94. $variable['special_poll']['visiblepoll'] = $GLOBALS['visiblepoll'];
  95. $variable['special_poll']['allowvote'] = $_G['group']['allowvote'];
  96. $variable['special_poll']['remaintime'] = $thread['remaintime'];
  97. }
  98. if(!empty($GLOBALS['rewardprice'])) {
  99. $variable['special_reward']['rewardprice'] = $GLOBALS['rewardprice'].' '.$_G['setting']['extcredits'][$_G['setting']['creditstransextra'][2]]['title'];
  100. $variable['special_reward']['bestpost'] = $GLOBALS['bestpost'];
  101. }
  102. if(!empty($GLOBALS['trades'])) {
  103. $variable['special_trade'] = $GLOBALS['trades'];
  104. }
  105. if(!empty($GLOBALS['debate'])) {
  106. $variable['special_debate'] = $GLOBALS['debate'];
  107. }
  108. if(!empty($GLOBALS['activity'])) {
  109. $variable['special_activity'] = $GLOBALS['activity'];
  110. }
  111. $variable['forum']['password'] = $variable['forum']['password'] ? '1' : '0';
  112. mobile_core::result(mobile_core::variable($variable));
  113. }
  114. }
  115. ?>