function output() { global $_G; //帖子列表增加图片 -start require_once libfile('function/discuzcode'); foreach ($GLOBALS['data']['my']['threadlist'] as $k => $thread) { $post = C::t('forum_post')->fetch_threadpost_by_tid_invisible($GLOBALS['data']['my']['threadlist'][$k]['tid'], 0); $attachment[$post['pid']] = array(); $GLOBALS['data']['my']['threadlist'][$k]['pid'] = $post['pid']; //TODO:下面的代码直接调用discuzcode时,会报错 //./source/plugin/mobile/template/discuzcode.htm 文件不存在 //cp ./source/plugin/mobile/template/mobile/discuzcode.htm ./source/plugin/mobile/template/ //拷贝一份就可以了,原因未查明 $GLOBALS['data']['my']['threadlist'][$k]['message'] = discuzcode($post['message']); //附件,0无附件 1普通附件 2有图片附件 if (!empty($post['attachment']) && intval($post['attachment']) == 2) { $GLOBALS['data']['my']['threadlist'][$k]['attachments'] = array(); $GLOBALS['data']['my']['threadlist'][$k]['imagelist'] = array(); require_once libfile('function/attachment'); $_G['tid'] = $post['tid']; parseattach(array_keys($attachment), array(), $attachment); $GLOBALS['data']['my']['threadlist'][$k]['attachments'] = $attachment[$post['pid']]['attachments']; $GLOBALS['data']['my']['threadlist'][$k]['imagelist'] = $attachment[$post['pid']]['imagelist']; unset($_G['tid']); } } //帖子列表增加图片 -end $data['forumnames'] = $GLOBALS['data']['my']['forumnames']; $data['threadcount'] = $GLOBALS['data']['my']['threadcount']; $data['threadlist'] = array_values($GLOBALS['data']['my']['threadlist']); $variable = array('data' => $data, 'perpage' => $GLOBALS['perpage']); mobile_core::result(mobile_core::variable($variable)); }
public function fetch_thread_replies($count, $tid) { require_once libfile('function/discuzcode'); require_once './source/plugin/singcere_waterfall/singcere_waterfall.func.php'; $list = array(); $query = DB::query("SELECT * FROM %t WHERE first != 1 AND tid = %d AND invisible >= 0 ORDER BY dateline DESC LIMIT 0, %d", array('forum_post', $tid, $count)); while (($result = DB::fetch($query)) != false) { preg_match_all("/\\[attach\\](\\d+)\\[\\/attach\\]/i", $result['message'], $matchaids); $attachs = parseattach($result['tid'], $result['pid'], $matchaids, $result['message'], $skipaids); $k = $result['message'] = preg_replace("/\\[attach\\](\\d+)\\[\\/attach\\]/ ", "\$attachs[\\1]", $result['message']); eval("\$k=\"{$k}\";"); $k = discuzcode($k, FALSE, FALSE); $result['message'] = $k; $result['message'] = html2txt($result['message']); $list[] = $result; } return $list; }
function viewthread_variables(&$variables) { if (!showActivity::init()) { return; } global $_G; $variables['thread']['showactivity'] = 1; $variables['special_activity']['thumb'] = preg_match('/^http:\\//', $GLOBALS['activity']['thumb']) ? $GLOBALS['activity']['thumb'] : $_G['siteurl'] . $GLOBALS['activity']['thumb']; unset($variables['special_activity']['attachurl']); $posts = DB::fetch_all("SELECT pid, voters FROM %t WHERE tid=%d", array('forum_debatepost', $_G['tid']), 'pid'); $voters = array(); foreach ($variables['postlist'] as &$post) { $post['voters'] = intval($posts[$post['pid']]['voters']); } require_once libfile('function/attachment'); if (empty($_GET['viewnew']) && empty($_GET['viewpid'])) { foreach ($posts as $vpost) { if ($vpost['voters'] > 0) { $voters[$vpost['pid']] = $vpost['voters']; } } arsort($voters); $voters = array_slice($voters, 0, 10, 1); $vpids = array_keys($voters); $toparr = C::t('forum_post')->fetch_all('tid:' . $_G['tid'], $vpids, false); $top = 1; foreach ($voters as $pid => &$data) { $toparr[$pid] = array('pid' => $pid, 'author' => $toparr[$pid]['author'], 'authorid' => $toparr[$pid]['authorid'], 'voters' => $data, 'top' => $top++); $data = $toparr[$pid]; } $variables['special_activity']['top_postlist'] = $voters; parseattach($vpids, array(), $variables['special_activity']['top_postlist']); $variables['special_activity']['top_postlist'] = array_values($variables['special_activity']['top_postlist']); } if (!empty($_GET['viewpid'])) { $comments = array(); foreach ($GLOBALS['comments'][$_GET['viewpid']] as $comment) { $comments[] = array('author' => $comment['author'], 'authorid' => $comment['authorid'], 'avatar' => avatar($comment['authorid'], 'small', 1), 'message' => $comment['comment'], 'dateline' => strip_tags(dgmdate($comment['dateline'], 'u'))); } $variables['postlist'] = array_merge($variables['postlist'], $comments); } }
$payment = C::t('common_credit_log')->count_stc_by_relatedid($_G['tid'], $_G['setting']['creditstransextra'][1]); $thread['payers'] = $payment['payers']; $thread['netprice'] = !$_G['setting']['maxincperthread'] || $_G['setting']['maxincperthread'] && $payment['income'] < $_G['setting']['maxincperthread'] ? floor($thread['price'] * (1 - $_G['setting']['creditstax'])) : 0; $thread['creditstax'] = sprintf('%1.2f', $_G['setting']['creditstax'] * 100) . '%'; $thread['endtime'] = $_G['setting']['maxchargespan'] ? dgmdate($_G['forum_thread']['dateline'] + $_G['setting']['maxchargespan'] * 3600, 'u') : 0; $thread['price'] = $_G['forum_thread']['price']; $firstpost = C::t('forum_post')->fetch_threadpost_by_tid_invisible($_G['tid']); if ($firstpost) { $member = getuserbyuid($firstpost['authorid']); $firstpost['groupid'] = $member['groupid']; } $pid = $firstpost['pid']; $freemessage = array(); $freemessage[$pid]['message'] = ''; if (preg_match_all("/\\[free\\](.+?)\\[\\/free\\]/is", $firstpost['message'], $matches)) { foreach ($matches[1] as $match) { $freemessage[$pid]['message'] .= discuzcode($match, $firstpost['smileyoff'], $firstpost['bbcodeoff'], sprintf('%00b', $firstpost['htmlon']), $_G['forum']['allowsmilies'], $_G['forum']['allowbbcode'] ? -$firstpost['groupid'] : 0, $_G['forum']['allowimgcode'], $_G['forum']['allowhtml'], $_G['forum']['jammer'] && $post['authorid'] != $_G['uid'] ? 1 : 0, 0, $post['authorid'], $_G['forum']['allowmediacode'], $pid) . '<br />'; } } $attachtags = array(); if ($_G['group']['allowgetattach'] || $_G['group']['allowgetimage']) { if (preg_match_all("/\\[attach\\](\\d+)\\[\\/attach\\]/i", $freemessage[$pid]['message'], $matchaids)) { $attachtags[$pid] = $matchaids[1]; } } if ($attachtags) { require_once libfile('function/attachment'); parseattach($pid, $attachtags, $freemessage); } $thread['freemessage'] = $freemessage[$pid]['message']; unset($freemessage);
ksort($postlist[$key]['ratelogextcredits']); } } if ($_G['forum_cachepid'] && $_G['setting']['commentnumber']) { list($comments, $postcache, $commentcount, $totalcomment) = C::t('forum_postcomment')->fetch_postcomment_by_pid($_G['forum_cachepid'], $postcache, $commentcount, $totalcomment, $_G['setting']['commentnumber']); } foreach ($postcache as $pid => $data) { C::t('forum_postcache')->insert(array('pid' => $pid, 'rate' => serialize($data['rate']), 'comment' => serialize($data['comment']), 'dateline' => TIMESTAMP), false, true); } } if ($_G['forum_attachpids'] && !defined('IN_ARCHIVER')) { require_once libfile('function/attachment'); if (is_array($threadsortshow) && !empty($threadsortshow['sortaids'])) { $skipaids = $threadsortshow['sortaids']; } parseattach($_G['forum_attachpids'], $_G['forum_attachtags'], $postlist, $skipaids); } if (empty($postlist)) { showmessage('post_not_found'); } elseif (!defined('IN_MOBILE_API')) { foreach ($postlist as $pid => $post) { $postlist[$pid]['message'] = preg_replace("/\\[attach\\]\\d+\\[\\/attach\\]/i", '', $postlist[$pid]['message']); } } if (defined('IN_ARCHIVER')) { include loadarchiver('forum/viewthread'); exit; } $_G['forum_thread']['heatlevel'] = $_G['forum_thread']['recommendlevel'] = 0; if ($_G['setting']['heatthread']['iconlevels']) { foreach ($_G['setting']['heatthread']['iconlevels'] as $k => $i) {
$Id: viewthread_special.inc.php 9806 2007-08-15 06:04:37Z cnteacher $ */ if (!defined('IN_DISCUZ')) { exit('Access Denied'); } $query = $db->query("SELECT count(*) FROM {$tablepre}posts WHERE tid='{$tid}' AND first=0 AND invisible='0'"); $repostnum = $db->result($query, 0); $ppp = $forum['threadcaches'] && !$discuz_uid ? $_DCACHE['settings']['postperpage'] : $ppp; $start_limit = $numpost = ($page - 1) * $ppp; if ($start_limit > $repostnum) { $start_limit = $numpost = 0; $page = 1; } if ($thread['special'] == 3) { $thread['price'] < 0 && $start_limit++; $repostnum--; } $multipage = multi($repostnum, $ppp, $page, "viewthread.php?tid={$tid}&do={$do}&extra={$extra}" . (isset($highlight) ? "&highlight=" . rawurlencode($highlight) : '')); $query = $db->query("SELECT p.*,m.username,m.adminid,m.groupid,m.credits FROM {$tablepre}posts p LEFT JOIN {$tablepre}members m ON m.uid=p.authorid WHERE p.tid='{$tid}' AND p.invisible='0' AND p.first='0' ORDER BY p.dateline LIMIT {$start_limit}, {$ppp}"); while ($post = $db->fetch_array($query)) { $post['first'] = 0; $post = viewthread_procpost($post, 1); $postlist[$post['pid']] = $post; } if ($attachpids) { require_once DISCUZ_ROOT . './include/attachment.func.php'; parseattach($attachpids, $attachtags, $postlist, $showimages); } include template('viewthread_special_post'); exit;
[Discuz!] (C)2001-2007 Comsenz Inc. This is NOT a freeware, use is subject to license terms $Id: printable.inc.php 10115 2007-08-24 00:58:08Z cnteacher $ */ if (!defined('IN_DISCUZ')) { exit('Access Denied'); } $thisbg = '#FFFFFF'; $query = $db->query("SELECT p.*, m.username, m.groupid FROM {$tablepre}posts p\r\n\t\tLEFT JOIN {$tablepre}members m ON m.uid=p.authorid\r\n\t\tWHERE p.tid='{$tid}' AND p.invisible='0' ORDER BY p.dateline LIMIT 100"); while ($post = $db->fetch_array($query)) { $post['dateline'] = gmdate("{$dateformat} {$timeformat}", $post['dateline'] + $timeoffset * 3600); $post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], sprintf('%00b', $post['htmlon']), $forum['allowsmilies'], $forum['allowbbcode'], $forum['allowimgcode'], $forum['allowhtml'], $forum['jammer'] && $post['authorid'] != $discuz_uid ? 1 : 0); if ($post['attachment']) { $attachment = 1; } $post['attachments'] = array(); if ($post['attachment'] && $allowgetattach) { $attachpids .= ",{$post['pid']}"; $post['attachment'] = 0; if (preg_match_all("/\\[attach\\](\\d+)\\[\\/attach\\]/i", $post['message'], $matchaids)) { $attachtags[$post['pid']] = $matchaids[1]; } } $postlist[$post['pid']] = $post; } if ($attachpids) { require_once DISCUZ_ROOT . './include/attachment.func.php'; parseattach($attachpids, $attachtags, $postlist); } include template('viewthread_printable');
* * $Id: thread_printable.php 8578 2010-04-21 07:34:43Z monkey $ */ if (!defined('IN_DISCUZ')) { exit('Access Denied'); } $thisbg = '#FFFFFF'; $posttable = getposttablebytid($_G['tid']); $query = DB::query("SELECT p.*, m.username, m.groupid FROM " . DB::table($posttable) . " p\n\t\tLEFT JOIN " . DB::table('common_member') . " m ON m.uid=p.authorid\n\t\tWHERE p.tid='{$_G['tid']}' AND p.invisible='0' ORDER BY p.dateline LIMIT 100"); while ($post = DB::fetch($query)) { $post['dateline'] = dgmdate($post['dateline'], 'u'); $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); $post['message'] = preg_replace("/\\[hide\\]\\s*(.+?)\\s*\\[\\/hide\\]/is", '', $post['message']); if ($post['attachment']) { $attachment = 1; } $post['attachments'] = array(); if ($post['attachment'] && $_G['group']['allowgetattach']) { $_G['forum_attachpids'] .= ",{$post['pid']}"; $post['attachment'] = 0; if (preg_match_all("/\\[attach\\](\\d+)\\[\\/attach\\]/i", $post['message'], $matchaids)) { $_G['forum_attachtags'][$post['pid']] = $matchaids[1]; } } $postlist[$post['pid']] = $post; } if ($_G['forum_attachpids']) { require_once libfile('function/attachment'); parseattach($_G['forum_attachpids'], $_G['forum_attachtags'], $postlist); } include template('forum/viewthread_printable');
$_G['forum_threadlist'][$k]['authorid'] = 0; } $userids[] = $thread['authorid']; //帖子列表增加图片 -start require_once libfile('function/discuzcode'); $post = C::t('forum_post')->fetch_threadpost_by_tid_invisible($_G['forum_threadlist'][$k]['tid'], 0); $attachment[$post['pid']] = array(); $_G['forum_threadlist'][$k]['pid'] = $post['pid']; $_G['forum_threadlist'][$k]['attachments'] = array(); $_G['forum_threadlist'][$k]['imagelist'] = array(); $_G['forum_threadlist'][$k]['message'] = discuzcode($post['message']); //附件,0无附件 1普通附件 2有图片附件 if (!empty($post['attachment']) && intval($post['attachment']) == 2) { require_once libfile('function/attachment'); $_G['tid'] = $post['tid']; parseattach(array_keys($attachment), array(), $attachment); $_G['forum_threadlist'][$k]['attachments'] = $attachment[$post['pid']]['attachments']; //缩略图处理 if (!empty($_G['forum_threadlist'][$k]['attachments'])) { foreach ($_G['forum_threadlist'][$k]['attachments'] as $aid => $arr) { if ($arr['remote'] == 1) { //具体的缩略尺寸参考Oss的图片规则设置 $_G['forum_threadlist'][$k]['attachments'][$aid]['attachment'] = $_G['forum_threadlist'][$k]['attachments'][$aid]['attachment'] . "@!230x230"; } } } $_G['forum_threadlist'][$k]['imagelist'] = $attachment[$post['pid']]['imagelist']; unset($_G['tid']); } //帖子列表增加图片 -end }
public static function transPostContentToHtml($post) { Mobcent::import(sprintf('%s/forum_viewthread_%s.php', MOBCENT_APP_ROOT . '/components/discuz/forum', MobcentDiscuz::getMobcentDiscuzVersion())); ForumUtils::initForum($post['fid'], $post['tid']); loadcache('usergroups'); $userInfo = UserUtils::getUserInfo($post['authorid']); $post = array_merge($userInfo, $post); global $_G; // 处理主题价格 $_G['forum_threadpay'] = FALSE; if ($post['first']) { if ($_G['forum_thread']['price'] > 0 && $_G['forum_thread']['special'] == 0) { if ($_G['setting']['maxchargespan'] && TIMESTAMP - $_G['forum_thread']['dateline'] >= $_G['setting']['maxchargespan'] * 3600) { C::t('forum_thread')->update($_G['tid'], array('price' => 0), false, false, $archiveid); $_G['forum_thread']['price'] = 0; } else { $exemptvalue = $_G['forum']['ismoderator'] ? 128 : 16; if (!($_G['group']['exempt'] & $exemptvalue) && $_G['forum_thread']['authorid'] != $_G['uid']) { if (!C::t('common_credit_log')->count_by_uid_operation_relatedid($_G['uid'], 'BTC', $_G['tid'])) { require_once libfile('thread/pay', 'include'); $_G['forum_threadpay'] = TRUE; } } } } } $lastvisit = $_G['member']['lastvisit']; $ordertype = $maxposition = 0; // 处理附件 $_G['forum_attachpids'] = $_G['forum_attachtags'] = ''; $_G['tid'] = $post['tid']; // 去掉干扰码 $_G['forum']['jammer'] = 0; $post = viewthread_procpost($post, $lastvisit, $ordertype, $maxposition); $postlist[$post['pid']] = $post; if ($_G['forum_attachpids'] && !defined('IN_ARCHIVER')) { require_once libfile('function/attachment'); if (is_array($threadsortshow) && !empty($threadsortshow['sortaids'])) { $skipaids = $threadsortshow['sortaids']; } parseattach($_G['forum_attachpids'], $_G['forum_attachtags'], $postlist, $skipaids); } if (empty($postlist)) { showmessage('post_not_found'); } elseif (!defined('IN_MOBILE_API')) { foreach ($postlist as $pid => $post) { // 取出没有插入的附件 if (!empty($post['imagelist'])) { $postlist[$pid]['message'] .= showattach($post, 1); } if ($post['attachlist']) { $postlist[$pid]['message'] .= showattach($post); } $postlist[$pid]['message'] = preg_replace("/\\[attach\\]\\d+\\[\\/attach\\]/i", '', $postlist[$pid]['message']); } } if ($post['first'] && $_G['forum_threadpay']) { $postlist[$pid]['message'] = $thread['freemessage']; } // 处理屏蔽 if (!$_G['forum']['ismoderator'] && $postlist[$pid]['status'] & 1) { $postlist[$pid]['message'] = WebUtils::t('该帖被管理员或版主屏蔽'); } return $postlist[$post['pid']]; }
if ($trade['expiration']) { $trade['expiration'] = ($trade['expiration'] - $timestamp) / 86400; if ($trade['expiration'] > 0) { $trade['expirationhour'] = floor(($trade['expiration'] - floor($trade['expiration'])) * 24); $trade['expiration'] = floor($trade['expiration']); } else { $trade['expiration'] = -1; } } $trades[$trade['pid']] = $trade; $tradesaids[] = $trade['aid']; } } if ($attachpids) { require_once DISCUZ_ROOT . './include/attachment.func.php'; parseattach($attachpids, $attachtags, $postlist, $showimages, $tradesaids); } if ($tradespids) { $tradespids = implodeids($tradespids); $query = $db->query("SELECT a.* FROM {$tablepre}attachments a WHERE a.pid IN ({$tradespids})"); while ($attach = $db->fetch_array($query)) { if ($attach['isimage'] && is_array($tradesaids) && in_array($attach['aid'], $tradesaids)) { $trades[$attach['pid']]['attachurl'] = ($attach['remote'] ? $ftp['attachurl'] : $attachurl) . '/' . $attach['attachment']; $trades[$attach['pid']]['thumb'] = $trades[$attach['pid']]['attachurl'] . ($attach['thumb'] ? '.thumb.jpg' : ''); } } } include template('viewthread_trade_post'); } elseif ($do == 'viewrelatedtrade') { $multipage = ''; $relatedtrades = !empty($insenz['relatedtrades']) ? stripslashes($insenz['relatedtrades']) : '';
$trades[$attach['pid']]['attachurl'] = ($attach['remote'] ? $ftp['attachurl'] : $attachurl) . '/' . $attach['attachment']; $trades[$attach['pid']]['thumb'] = $trades[$attach['pid']]['attachurl'] . ($attach['thumb'] ? '.thumb.jpg' : ''); } } } if ($do == 'tradeinfo') { $subjectpos = strrpos($navigation, '» '); $subject = substr($navigation, $subjectpos + 8); $navigation = substr($navigation, 0, $subjectpos) . '» <a href="viewthread.php?tid=' . $tid . '">' . $subject . '</a>'; $trade = $trades[$pid]; unset($trades); $post = $db->fetch_first("SELECT p.*, m.uid, m.username, m.groupid, m.adminid, m.regdate, m.lastactivity, m.posts, m.digestposts, m.oltime,\r\n\t\t\tm.pageviews, m.credits, m.extcredits1, m.extcredits2, m.extcredits3, m.extcredits4, m.extcredits5, m.extcredits6,\r\n\t\t\tm.extcredits7, m.extcredits8, m.email, m.gender, m.showemail, m.invisible, mf.nickname, mf.site,\r\n\t\t\tmf.icq, mf.qq, mf.yahoo, mf.msn, mf.taobao, mf.alipay, mf.location, mf.medals,\r\n\t\t\tmf.avatarheight, mf.customstatus, mf.spacename, mf.buyercredit, mf.sellercredit {$fieldsadd}\r\n\t\t\tFROM {$tablepre}posts p\r\n\t\t\tLEFT JOIN {$tablepre}members m ON m.uid=p.authorid\r\n\t\t\tLEFT JOIN {$tablepre}memberfields mf ON mf.uid=m.uid\r\n\t\t\tWHERE pid='{$pid}'"); $postlist[$post['pid']] = viewthread_procpost($post); if ($attachpids) { require_once DISCUZ_ROOT . './include/attachment.func.php'; parseattach($attachpids, $attachtags, $postlist, $showimages, array($trade['aid'])); } $post = $postlist[$pid]; $post['buyerrank'] = 0; if ($post['buyercredit']) { foreach ($ec_credit['rank'] as $level => $credit) { if ($post['buyercredit'] <= $credit) { $post['buyerrank'] = $level; break; } } } $post['sellerrank'] = 0; if ($post['sellercredit']) { foreach ($ec_credit['rank'] as $level => $credit) { if ($post['sellercredit'] <= $credit) {
exit('Access Denied'); } if (!isset($extcredits[$creditstransextra[1]])) { showmessage('credits_transaction_disabled'); } $payment = $db->fetch_first("SELECT COUNT(*) AS payers, SUM(netamount) AS income FROM {$tablepre}paymentlog WHERE tid='{$tid}'"); $thread['payers'] = $payment['payers']; $thread['netprice'] = !$maxincperthread || $maxincperthread && $payment['income'] < $maxincperthread ? floor($thread['price'] * (1 - $creditstax)) : 0; $thread['creditstax'] = sprintf('%1.2f', $creditstax * 100) . '%'; $thread['endtime'] = $maxchargespan ? dgmdate("{$dateformat} {$timeformat}", $thread['dateline'] + $maxchargespan * 3600 + $timeoffset * 3600) : 0; $firstpost = $db->fetch_first("SELECT * FROM {$tablepre}posts WHERE tid='{$tid}' AND first='1' LIMIT 1"); $pid = $firstpost['pid']; $freemessage = array(); $freemessage[$pid]['message'] = ''; if (preg_match_all("/\\[free\\](.+?)\\[\\/free\\]/is", $firstpost['message'], $matches)) { foreach ($matches[1] as $match) { $freemessage[$pid]['message'] .= discuzcode($match, $firstpost['smileyoff'], $firstpost['bbcodeoff'], sprintf('%00b', $firstpost['htmlon']), $forum['allowsmilies'], $forum['allowbbcode'], $forum['allowimgcode'], $forum['allowhtml'], 0) . '<br />'; } } $attachtags = array(); if ($allowgetattach) { if (preg_match_all("/\\[attach\\](\\d+)\\[\\/attach\\]/i", $freemessage[$pid]['message'], $matchaids)) { $attachtags[$pid] = $matchaids[1]; } } if ($attachtags) { require_once DISCUZ_ROOT . './include/attachment.func.php'; parseattach($pid, $attachtags, $freemessage, $showimages); } $thread['freemessage'] = $freemessage[$pid]['message']; unset($freemessage);
function getthreadlist($tids, $type, $fids, $sid, $havecover, $withpost, $start = 0, $num = 30) { require_once libfile('function/forum'); require_once libfile('function/discuzcode'); global $_G, $block_reply_num, $block_special_data_on, $block_attach_on, $masonry_preread; $query = C::t('#singcere_waterfall#dx')->fetch_all_threads($tids, $type, $fids, $sid, $havecover, $withpost, $start, $num); $threadlist = $tids = array(); foreach ($query as $thread) { $tids[] = $thread['tid']; if ($block_special_data_on && $thread['special']) { $thread['sdata'] = getspecialdata($thread['tid'], $thread['special']); } $thread['coverpath'] = getthreadcover($thread['tid'], $thread['cover']); if ($masonry_preread) { list($thread['w'], $thread['h']) = getimagesize(($thread['cover'] < 0 ? $thread['coverpath'] : DISCUZ_ROOT . $_G['setting']['attachurl']) . 'forum/' . getthreadcover($thread['tid'], $thread['cover'], 1)); } $thread['collections'] = count(explode("\t", $thread['collection'], -1)); $thread['forumname'] = $_G['cache']['forums'][$thread['fid']]['name']; $thread = procthread($thread); $threadlist[$thread[tid]] = $thread; } if ($block_reply_num > 0) { $replies = C::t('#singcere_waterfall#dx')->fetch_all_replies_by_tids($tids, $block_reply_num); foreach ($replies as $reply) { if (count($threadlist[$reply['tid']]['replylist']) <= $block_reply_num) { if ($block_attach_on) { preg_match_all("/\\[attach\\](\\d+)\\[\\/attach\\]/i", $reply['message'], $matchaids); $attachs = parseattach($reply['tid'], $reply['pid'], $matchaids, $reply['message'], $skipaids); $k = $reply['message'] = preg_replace("/\\[attach\\](\\d+)\\[\\/attach\\]/ ", "\$attachs[\\1]", $reply['message']); eval("\$k=\"{$k}\";"); $k = discuzcode($k, FALSE, FALSE); $reply['message'] = $k; $reply['message'] = html2txt($reply['message']); $threadlist[$reply['tid']]['replylist'][] = $reply; } else { $reply['message'] = discuzcode($reply['message'], false, false); $threadlist[$reply['tid']]['replylist'][] = $reply; } } } } return $threadlist; }
$query = DB::query("SELECT t.tid, t.pid, t.aid, t.subject, t.price, t.credit, t.displayorder FROM " . DB::table('forum_trade') . " t\r\n\t\t\t\tLEFT JOIN " . DB::table(getattachtablebytid($_G['tid'])) . " a ON t.aid=a.aid\r\n\t\t\t\tWHERE t.sellerid='" . $_G['forum_thread']['authorid'] . "' AND t.tid='{$_G['tid']}' ORDER BY t.displayorder DESC LIMIT " . ($limit + 1)); $usertradecount = 0; while ($usertrade = DB::fetch($query)) { if ($usertrade['pid'] == $post['pid']) { continue; } $usertradecount++; $usertrades[] = $usertrade; if ($usertradecount == $limit) { break; } } } if ($_G['forum_attachpids']) { require_once libfile('function/attachment'); parseattach($_G['forum_attachpids'], $_G['forum_attachtags'], $postlist, array($trade['aid'])); } $post = $postlist[$_G['gp_pid']]; $post['buyerrank'] = 0; if ($post['buyercredit']) { foreach ($_G['setting']['ec_credit']['rank'] as $level => $credit) { if ($post['buyercredit'] <= $credit) { $post['buyerrank'] = $level; break; } } } $post['sellerrank'] = 0; if ($post['sellercredit']) { foreach ($_G['setting']['ec_credit']['rank'] as $level => $credit) { if ($post['sellercredit'] <= $credit) {
$value['username'] = $value['author']; if ($value['status'] != 1 && !$value['first']) { $value['message'] = discuzcode($value['message'], $value['smileyoff'], $value['bbcodeoff'], $value['htmlon']); $value['cid'] = $value['pid']; $commentlist[$value['pid']] = $value; if ($value['attachment']) { $attachpids[] = $value['pid']; if (preg_match_all("/\\[attach\\](\\d+)\\[\\/attach\\]/i", $value['message'], $matchaids)) { $attachtags[$value['pid']] = $matchaids[1]; } } } } if ($attachpids) { require_once libfile('function/attachment'); parseattach($attachpids, $attachtags, $commentlist); } } } } else { $common_url = "portal.php?mod=comment&id={$aid}&idtype=aid"; $form_url = "portal.php?mod=portalcp&ac=comment"; $query = C::t('portal_comment')->fetch_all_by_id_idtype($aid, 'aid', 'dateline', 'DESC', 0, 20); $pricount = 0; foreach ($query as $value) { if ($value['status'] == 0 || $value['uid'] == $_G['uid'] || $_G['adminid'] == 1) { $value['allowop'] = 1; $commentlist[] = $value; } else { $pricount += 1; }
function viewthread_variables(&$variables) { if (!showActivity::init()) { return; } global $_G; $variables['thread']['showactivity'] = 1; $variables['special_activity']['thumb'] = preg_match('/^http:\\//', $GLOBALS['activity']['thumb']) ? $GLOBALS['activity']['thumb'] : $_G['siteurl'] . $GLOBALS['activity']['thumb']; unset($variables['special_activity']['attachurl']); if (empty($_GET['viewpid'])) { if (!$_GET['viewhot']) { $pids = array(); foreach ($variables['postlist'] as $post) { $pids[] = $post['pid']; } if ($pids) { $posts = DB::fetch_all("SELECT pid, voters FROM %t WHERE pid IN (%n)", array('forum_debatepost', $pids), 'pid'); $voters = array(); foreach ($variables['postlist'] as $key => $post) { $variables['postlist'][$key]['voters'] = intval($posts[$post['pid']]['voters']); if ($_G['page'] == 1 && !$post['first'] && $_G['uid'] && $_G['uid'] == $post['authorid']) { unset($variables['postlist'][$key]); } } } $variables['postlist'] = array_values($variables['postlist']); $myarr = array(); if ($_G['uid'] && $_G['page'] == 1) { $pids = array(); $posts = C::t('forum_post')->fetch_all_common_viewthread_by_tid($_G['tid'], 0, $_G['uid'], 1, 2, 0, 0, 0); foreach ($posts as $pid => $post) { $myarr[$pid] = array('pid' => $pid, 'author' => $post['author'], 'authorid' => $post['authorid'], 'voters' => 0); $pids[] = $post['pid']; } $posts = DB::fetch_all("SELECT pid, voters FROM %t WHERE pid IN (%n)", array('forum_debatepost', $pids), 'pid'); foreach ($posts as $pid => $post) { $myarr[$pid]['voters'] = intval($post['voters']); } if ($myarr) { require_once libfile('function/attachment'); parseattach(array_keys($myarr), array(), $myarr); } } $variables['special_activity']['my_postlist'] = array_values($myarr); $variables['special_activity']['view'] = 'new'; } else { foreach ($variables['postlist'] as $key => $post) { if (!$post['first']) { unset($variables['postlist'][$key]); } } $cachekey = 'showactivity_' . $_G['tid']; loadcache($cachekey); if (!$_G['cache'][$cachekey] || TIMESTAMP - $_G['cache'][$cachekey]['expiration'] > 600) { $posts = DB::fetch_all("SELECT pid, voters FROM %t d WHERE tid=%d AND voters>1 ORDER BY voters DESC LIMIT 500", array('forum_debatepost', $_G['tid']), 'pid'); foreach ($posts as $vpost) { $voters[$vpost['pid']] = $vpost['voters']; } $top = 1; $toparr = array(); $posts = C::t('forum_post')->fetch_all_by_pid('tid:' . $_G['tid'], array_keys($voters), false, '', 0, 0, null, 0); foreach ($voters as $pid => $voters) { if ($posts[$pid]) { $toparr[$pid] = array('pid' => $pid, 'author' => $posts[$pid]['author'], 'authorid' => $posts[$pid]['authorid'], 'voters' => $voters, 'top' => $top++); if ($top > 50) { break; } } } $variables['special_activity']['top_postlist'] = $toparr; savecache($cachekey, array('variable' => $toparr, 'expiration' => TIMESTAMP)); } else { $variables['special_activity']['top_postlist'] = $_G['cache'][$cachekey]['variable']; } $hotpage = max(1, $_GET['page']); $start = max(0, ($hotpage - 1) * $_G['ppp']); $toplist =& $variables['special_activity']['top_postlist']; $toplist = array_slice($toplist, $start, $_G['ppp'], 1); require_once libfile('function/attachment'); parseattach(array_keys($toplist), array(), $toplist); $toplist = array_values($toplist); $variables['special_activity']['view'] = 'hot'; } } else { $comments = array(); foreach ($GLOBALS['comments'][$_GET['viewpid']] as $comment) { $comments[] = array('author' => $comment['author'], 'authorid' => $comment['authorid'], 'avatar' => avatar($comment['authorid'], 'small', 1), 'message' => $comment['comment'], 'dateline' => strip_tags(dgmdate($comment['dateline'], 'u'))); } $variables['postlist'] = array_merge($variables['postlist'], $comments); $variables['thread']['replies'] = $GLOBALS['commentcount'][$_GET['viewpid']]; $voters = C::t('forum_debatepost')->fetch($_GET['viewpid']); $variables['thread']['recommend_add'] = $voters['voters']; } }