sub_threadlist.php 4.0 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: sub_threadlist.php 35068 2014-11-04 02:37:45Z nemohou $
  7. */
  8. if (!defined('IN_MOBILE_API')) {
  9. exit('Access Denied');
  10. }
  11. $_G['wechat']['setting'] = unserialize($_G['setting']['mobilewechat']);
  12. $tids = array();
  13. foreach ($_G['forum_threadlist'] as $k => $thread) {
  14. $tids[] = $_G['forum_threadlist'][$k]['tid'] = $thread['icontid'];
  15. $_G['forum_threadlist'][$k]['cover'] = array();
  16. if ($thread['cover']) {
  17. $_G['forum_threadlist'][$k]['cover'] = array('w' => 200, 'h' => 200);
  18. }
  19. $_G['forum_threadlist'][$k]['reply'] = array();
  20. if(!isset($_G['wechat']['setting']['wechat_forumdisplay_reply']) || $_G['wechat']['setting']['wechat_forumdisplay_reply']) {
  21. $key = C::t('#mobile#mobile_wsq_threadlist')->fetch($thread['tid']);
  22. if ($key['svalue']) {
  23. $_G['forum_threadlist'][$k]['reply'] = dunserialize($key['svalue']);
  24. }
  25. }
  26. $_G['forum_threadlist'][$k]['dateline'] = strip_tags($thread['dateline']);
  27. $_G['forum_threadlist'][$k]['lastpost'] = strip_tags($thread['lastpost']);
  28. if(!$thread['authorid'] || !$thread['author']) {
  29. $_G['forum_threadlist'][$k]['author'] = $_G['setting']['anonymoustext'];
  30. $_G['forum_threadlist'][$k]['authorid'] = 0;
  31. }
  32. $userids[] = $thread['authorid'];
  33. }
  34. foreach(C::t('common_member')->fetch_all($userids) as $user) {
  35. $groupiconIds[$user['uid']] = mobile_core::usergroupIconId($user['groupid']);
  36. }
  37. if($_G['uid']) {
  38. $memberrecommends = array();
  39. $query = DB::query('SELECT * FROM %t WHERE recommenduid=%d AND tid IN (%n)', array('forum_memberrecommend', $_G['uid'], $tids));
  40. while ($memberrecommend = DB::fetch($query)) {
  41. $memberrecommends[$memberrecommend['tid']] = 1;
  42. }
  43. foreach ($_G['forum_threadlist'] as $k => $thread) {
  44. $_G['forum_threadlist'][$k]['recommend'] = isset($memberrecommends[$thread['icontid']]) ? 1 : 0;
  45. }
  46. }
  47. foreach ($GLOBALS['sublist'] as $k => $sublist) {
  48. if ($sublist['icon']) {
  49. $icon = preg_match('/src="(.+?)"/', $sublist['icon'], $r) ? $r[1] : '';
  50. if (!preg_match('/^http:\//', $icon)) {
  51. $icon = $_G['siteurl'] . $icon;
  52. }
  53. $GLOBALS['sublist'][$k]['icon'] = $icon;
  54. }
  55. }
  56. if($_G['forum']['icon']) {
  57. require_once libfile('function/forumlist');
  58. if(strncasecmp($_G['forum']['icon'], 'http://', 7) !== 0) {
  59. $_G['forum']['icon'] = get_forumimg($_G['forum']['icon']);
  60. if(strncasecmp($_G['forum']['icon'], 'http://', 7) !== 0) {
  61. $_G['forum']['icon'] = $_G['siteurl'] . $_G['forum']['icon'];
  62. }
  63. }
  64. }
  65. $_G['forum']['threadcount'] = $_G['forum_threadcount'];
  66. $variable = array(
  67. 'forum' => mobile_core::getvalues($_G['forum'], array('fid', 'fup', 'name', 'threads', 'posts', 'rules', 'autoclose', 'password', 'icon', 'threadcount', 'picstyle', 'description')),
  68. 'group' => mobile_core::getvalues($_G['group'], array('groupid', 'grouptitle')),
  69. 'forum_threadlist' => mobile_core::getvalues(array_values($_G['forum_threadlist']), array('/^\d+$/'), array('tid', 'author', 'special', 'authorid', 'subject', 'subject', 'dbdateline', 'dateline', 'dblastpost', 'lastpost', 'lastposter', 'attachment', 'replies', 'readperm', 'views', 'digest', 'cover', 'recommend', 'recommend_add', 'reply', 'avatar', 'displayorder', 'coverpath', 'typeid', 'rushreply', 'replycredit', 'price')),
  70. 'groupiconid' => $groupiconIds,
  71. 'sublist' => mobile_core::getvalues($GLOBALS['sublist'], array('/^\d+$/'), array('fid', 'name', 'threads', 'todayposts', 'posts', 'icon')),
  72. 'tpp' => $_G['tpp'],
  73. 'page' => $GLOBALS['page'],
  74. 'reward_unit' => $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][2]]['unit'].$_G['setting']['extcredits'][$_G['setting']['creditstransextra'][2]]['title'],
  75. );
  76. if (!empty($_G['forum']['threadtypes']) || !empty($_GET['debug'])) {
  77. $variable['threadtypes'] = $_G['forum']['threadtypes'];
  78. }
  79. if (!empty($_G['forum']['threadsorts']) || !empty($_GET['debug'])) {
  80. $variable['threadsorts'] = $_G['forum']['threadsorts'];
  81. }
  82. $variable['forum']['password'] = $variable['forum']['password'] ? '1' : '0';
  83. ?>