PageRenderTime 43ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/source/include/thread/thread_printable.php

https://github.com/kuaileshike/upload
PHP | 63 lines | 49 code | 8 blank | 6 comment | 17 complexity | f1f705a101b81dcd3064397cdedcbe5f MD5 | raw file
  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: thread_printable.php 28348 2012-02-28 06:16:29Z monkey $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. $thisbg = '#FFFFFF';
  12. if(!getstatus($_G['forum_thread']['status'], 2)) {
  13. $posts = C::t('forum_post')->fetch_all_by_tid('tid:'.$_G['tid'], $_G['tid'], true, 'ASC', 0, 100, null, 0);
  14. } else {
  15. $posts = C::t('forum_post')->fetch_threadpost_by_tid_invisible($_G['tid'], 0);
  16. $posts = array($posts);
  17. }
  18. $userinfo = $uids = $skipaids = array();
  19. foreach($posts as $post) {
  20. $post['dateline'] = dgmdate($post['dateline'], 'u');
  21. if(preg_match("/\[hide\]\s*(.+?)\s*\[\/hide\]/is", $post['message'], $hide)) {
  22. if(preg_match_all("/\[attach\](\d+)\[\/attach\]/i", $hide[1], $matchaids)) {
  23. $skipaids = array_merge($skipaids, $matchaids[1]);
  24. }
  25. $post['message'] = preg_replace("/\[hide\]\s*(.+?)\s*\[\/hide\]/is", '', $post['message']);
  26. }
  27. $post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], sprintf('%00b', $post['htmlon']), $_G['forum']['allowsmilies'], $_G['forum']['allowbbcode'], $_G['forum']['allowimgcode'], $_G['forum']['allowhtml'], ($_G['forum']['jammer'] && $post['authorid'] != $_G['uid'] ? 1 : 0));
  28. if($post['attachment']) {
  29. $attachment = 1;
  30. }
  31. $post['attachments'] = array();
  32. if($post['attachment'] && ($_G['group']['allowgetattach'] || $_G['group']['allowgetimage'])) {
  33. $_G['forum_attachpids'][] = $post['pid'];
  34. $post['attachment'] = 0;
  35. if(preg_match_all("/\[attach\](\d+)\[\/attach\]/i", $post['message'], $matchaids)) {
  36. $_G['forum_attachtags'][$post['pid']] = $matchaids[1];
  37. }
  38. }
  39. $uids[] = $post['authorid'];
  40. $postlist[$post['pid']] = $post;
  41. }
  42. unset($posts);
  43. if($uids) {
  44. $uids = array_unique($uids);
  45. $userinfo = C::t('common_member')->fetch_all($uids);
  46. }
  47. if($_G['forum_attachpids'] && !defined('IN_ARCHIVER')) {
  48. require_once libfile('function/attachment');
  49. if(is_array($threadsortshow) && !empty($threadsortshow['sortaids'])) {
  50. $skipaids = array_merge($skipaids, $threadsortshow['sortaids']);
  51. }
  52. parseattach($_G['forum_attachpids'], $_G['forum_attachtags'], $postlist, $skipaids);
  53. }
  54. include template('forum/viewthread_printable');
  55. ?>