First commit
This commit is contained in:
0
source/include/thread/index.htm
Normal file
0
source/include/thread/index.htm
Normal file
94
source/include/thread/thread_activity.php
Normal file
94
source/include/thread/thread_activity.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: thread_activity.php 36284 2016-12-12 00:47:50Z nemohou $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$isverified = $applied = 0;
|
||||
$ufielddata = $applyinfo = array();
|
||||
if($_G['uid']) {
|
||||
$applyinfo = C::t('forum_activityapply')->fetch_info_for_user($_G['uid'], $_G['tid']);
|
||||
if($applyinfo) {
|
||||
$isverified = $applyinfo['verified'];
|
||||
if($applyinfo['ufielddata']) {
|
||||
$ufielddata = dunserialize($applyinfo['ufielddata']);
|
||||
}
|
||||
$applied = 1;
|
||||
}
|
||||
}
|
||||
$applylist = array();
|
||||
$activity = C::t('forum_activity')->fetch($_G['tid']);
|
||||
$activityclose = $activity['expiration'] ? ($activity['expiration'] > TIMESTAMP ? 0 : 1) : 0;
|
||||
$activity['starttimefrom'] = dgmdate($activity['starttimefrom'], 'u');
|
||||
$activity['starttimeto'] = $activity['starttimeto'] ? dgmdate($activity['starttimeto']) : 0;
|
||||
$activity['expiration'] = $activity['expiration'] ? dgmdate($activity['expiration']) : 0;
|
||||
$activity['attachurl'] = $activity['thumb'] = '';
|
||||
if($activity['ufield']) {
|
||||
$activity['ufield'] = dunserialize($activity['ufield']);
|
||||
if($activity['ufield']['userfield']) {
|
||||
$htmls = $settings = array();
|
||||
require_once libfile('function/profile');
|
||||
foreach($activity['ufield']['userfield'] as $fieldid) {
|
||||
if(empty($ufielddata['userfield'])) {
|
||||
$memberprofile = C::t('common_member_profile')->fetch($_G['uid']);
|
||||
foreach($activity['ufield']['userfield'] as $val) {
|
||||
$ufielddata['userfield'][$val] = $memberprofile[$val];
|
||||
}
|
||||
unset($memberprofile);
|
||||
}
|
||||
$html = profile_setting($fieldid, $ufielddata['userfield'], false, true);
|
||||
if($html) {
|
||||
$settings[$fieldid] = $_G['cache']['profilesetting'][$fieldid];
|
||||
$htmls[$fieldid] = $html;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$activity['ufield'] = '';
|
||||
}
|
||||
|
||||
if($activity['aid']) {
|
||||
$attach = C::t('forum_attachment_n')->fetch_attachment('tid:'.$_G['tid'], $activity['aid']);
|
||||
if($attach['isimage']) {
|
||||
$activity['attachurl'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']).'forum/'.$attach['attachment'];
|
||||
$activity['thumb'] = $attach['thumb'] ? getimgthumbname($activity['attachurl']) : $activity['attachurl'];
|
||||
$activity['width'] = $attach['thumb'] && $_G['setting']['thumbwidth'] < $attach['width'] ? $_G['setting']['thumbwidth'] : $attach['width'];
|
||||
}
|
||||
$skipaids[] = $activity['aid'];
|
||||
}
|
||||
|
||||
|
||||
$applylistverified = array();
|
||||
$noverifiednum = 0;
|
||||
$query = C::t('forum_activityapply')->fetch_all_for_thread($_G['tid'], 0, 0, 0, 1);
|
||||
foreach($query as $activityapplies) {
|
||||
$activityapplies['dateline'] = dgmdate($activityapplies['dateline'], 'u');
|
||||
if($activityapplies['verified'] == 1) {
|
||||
$activityapplies['ufielddata'] = dunserialize($activityapplies['ufielddata']);
|
||||
if(count($applylist) < $_G['setting']['activitypp']) {
|
||||
$activityapplies['message'] = preg_replace("/(".lang('forum/misc', 'contact').".*)/", '', $activityapplies['message']);
|
||||
$applylist[] = $activityapplies;
|
||||
}
|
||||
} else {
|
||||
if(count($applylistverified) < 8) {
|
||||
$applylistverified[] = $activityapplies;
|
||||
}
|
||||
$noverifiednum++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$applynumbers = $activity['applynumber'];
|
||||
$aboutmembers = $activity['number'] >= $applynumbers ? $activity['number'] - $applynumbers : 0;
|
||||
$allapplynum = $applynumbers + $noverifiednum;
|
||||
if($_G['forum']['status'] == 3) {
|
||||
$isgroupuser = groupperm($_G['forum'], $_G['uid']);
|
||||
}
|
||||
?>
|
75
source/include/thread/thread_album.php
Normal file
75
source/include/thread/thread_album.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: thread_album.php 28709 2012-11-08 08:53:48Z liulanbo $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
require_once libfile('function/attachment');
|
||||
$imglist = $albumpayaids = $attachmentlist = $freeattachids = array();
|
||||
if($_G['forum_threadpay'] && $_G['thread']['freemessage']) {
|
||||
preg_match_all('/id="aimg_(\d+)"/i', $_G['thread']['freemessage'], $matches);
|
||||
if(!empty($matches[1]) && is_array($matches[1])) {
|
||||
$freeattachids = $matches[1];
|
||||
}
|
||||
}
|
||||
$validpids = C::t('forum_post')->fetch_all_pid_by_tid($_G['tid'], 0);
|
||||
foreach(C::t('forum_attachment_n')->fetch_all_by_id('tid:'.$_G['tid'], 'tid', $_G['tid'], 'aid') as $attach) {
|
||||
if(!isset($validpids[$attach['pid']])) {
|
||||
continue;
|
||||
}
|
||||
if($_G['forum_threadpay'] && !in_array($attach['aid'], $freeattachids)) {
|
||||
continue;
|
||||
}
|
||||
if($attach['uid'] != $_G['forum_thread']['authorid'] && (!defined('IN_MOBILE') || IN_MOBILE != 2)) {
|
||||
continue;
|
||||
}
|
||||
if($attach['isimage'] && !$_G['setting']['attachimgpost']) {
|
||||
$attach['isimage'] = 0;
|
||||
}
|
||||
$attach['attachimg'] = $attach['isimage'] && (!$attach['readperm'] || $_G['group']['readaccess'] >= $attach['readperm']) ? 1 : 0;
|
||||
if(!$attach['attachimg']) {
|
||||
continue;
|
||||
}
|
||||
if($attach['price'] && $_G['uid'] != $attach['uid']) {
|
||||
$albumpayaids[$attach['aid']] = $attach['aid'];
|
||||
$attach['payed'] = 0;
|
||||
} else {
|
||||
$attach['payed'] = 1;
|
||||
}
|
||||
$attachmentlist[$attach['aid']] = $attach;
|
||||
}
|
||||
|
||||
if($albumpayaids) {
|
||||
foreach(C::t('common_credit_log')->fetch_all_by_uid_operation_relatedid($_G['uid'], 'BAC', array_keys($albumpayaids)) as $creditlog) {
|
||||
$attachmentlist[$creditlog['relatedid']]['payed'] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
foreach($attachmentlist as $attach) {
|
||||
if($attach['payed'] == 0) {
|
||||
continue;
|
||||
}
|
||||
$attach['url'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']).'forum/';
|
||||
$attach['dbdateline'] = $attach['dateline'];
|
||||
$attach['dateline'] = dgmdate($attach['dateline'], 'u');
|
||||
$imglist['aid'][] = $attach['aid'];
|
||||
$imglist['url'][] = $attach['url'].$attach['attachment'];
|
||||
$apids[] = $attach['pid'];
|
||||
}
|
||||
|
||||
if(empty($imglist)) {
|
||||
showmessage('author_not_uploadpic');
|
||||
}
|
||||
|
||||
foreach($postlist as $key=>$subpost) {
|
||||
if($subpost['first'] == 1 || in_array($subpost['pid'], $apids)) {
|
||||
unset($postlist[$key]);
|
||||
}
|
||||
}
|
||||
?>
|
65
source/include/thread/thread_debate.php
Normal file
65
source/include/thread/thread_debate.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: thread_debate.php 24551 2011-09-26 03:05:44Z monkey $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$debate = $_G['forum_thread'];
|
||||
$debate = C::t('forum_debate')->fetch($_G['tid']);
|
||||
$debate['dbendtime'] = $debate['endtime'];
|
||||
if($debate['dbendtime']) {
|
||||
$debate['endtime'] = dgmdate($debate['dbendtime']);
|
||||
}
|
||||
if($debate['dbendtime'] > TIMESTAMP) {
|
||||
$debate['remaintime'] = remaintime($debate['dbendtime'] - TIMESTAMP);
|
||||
}
|
||||
$debate['starttime'] = dgmdate($debate['starttime'], 'u');
|
||||
$debate['affirmpoint'] = discuzcode($debate['affirmpoint'], 0, 0, 0, 1, 1, 0, 0, 0, 0, 0);
|
||||
$debate['negapoint'] = discuzcode($debate['negapoint'], 0, 0, 0, 1, 1, 0, 0, 0, 0, 0);
|
||||
if($debate['affirmvotes'] || $debate['negavotes']) {
|
||||
if($debate['affirmvotes'] && $debate['affirmvotes'] > $debate['negavotes']) {
|
||||
$debate['affirmvoteswidth'] = 100;
|
||||
$debate['negavoteswidth'] = intval($debate['negavotes'] / $debate['affirmvotes'] * 100);
|
||||
$debate['negavoteswidth'] = $debate['negavoteswidth'] > 0 ? $debate['negavoteswidth'] : 5;
|
||||
} elseif($debate['negavotes'] && $debate['negavotes'] > $debate['affirmvotes']) {
|
||||
$debate['negavoteswidth'] = 100;
|
||||
$debate['affirmvoteswidth'] = intval($debate['affirmvotes'] / $debate['negavotes'] * 100);
|
||||
$debate['affirmvoteswidth'] = $debate['affirmvoteswidth'] > 0 ? $debate['affirmvoteswidth'] : 5;
|
||||
} else {
|
||||
$debate['affirmvoteswidth'] = $debate['negavoteswidth'] = 100;
|
||||
}
|
||||
} else {
|
||||
$debate['negavoteswidth'] = $debate['affirmvoteswidth'] = 5;
|
||||
}
|
||||
if($debate['umpirepoint']) {
|
||||
$debate['umpirepoint'] = discuzcode($debate['umpirepoint'], 0, 0, 0, 1, 1, 1, 0, 0, 0, 0);
|
||||
}
|
||||
$debate['umpireurl'] = rawurlencode($debate['umpire']);
|
||||
list($debate['bestdebater'], $debate['bestdebateruid'], $debate['bestdebaterstand'], $debate['bestdebatervoters'], $debate['bestdebaterreplies']) = explode("\t", $debate['bestdebater']);
|
||||
$debate['bestdebaterurl'] = rawurlencode($debate['bestdebater']);
|
||||
foreach(C::t('forum_post')->fetch_all_debatepost_by_tid_stand($_G['tid'], 1, 0, 16) as $affirmavatar) {
|
||||
if(!isset($debate['affirmavatars'][$affirmavatar['authorid']])) {
|
||||
$affirmavatar['avatar'] = avatar($affirmavatar['authorid'], 'small');
|
||||
$debate['affirmavatars'][$affirmavatar['authorid']] = $affirmavatar;
|
||||
}
|
||||
}
|
||||
|
||||
foreach(C::t('forum_post')->fetch_all_debatepost_by_tid_stand($_G['tid'], 2, 0, 16) as $negaavatar) {
|
||||
if(!isset($debate['negaavatars'][$negaavatar['authorid']])) {
|
||||
$negaavatar['avatar'] = avatar($negaavatar['authorid'], 'small');
|
||||
$debate['negaavatars'][$negaavatar['authorid']] = $negaavatar;
|
||||
}
|
||||
}
|
||||
|
||||
if($_G['setting']['fastpost'] && $allowpostreply && $_G['forum_thread']['closed'] == 0) {
|
||||
$firststand = C::t('forum_debatepost')->get_firststand($_G['tid'], $_G['uid']);
|
||||
}
|
||||
|
||||
?>
|
53
source/include/thread/thread_pay.php
Normal file
53
source/include/thread/thread_pay.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: thread_pay.php 25889 2011-11-24 09:52:20Z monkey $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
if(!isset($_G['setting']['extcredits'][$_G['setting']['creditstransextra'][1]])) {
|
||||
showmessage('credits_transaction_disabled');
|
||||
}
|
||||
$extcredit = 'extcredits'.$_G['setting']['creditstransextra'][1];
|
||||
$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);
|
||||
|
||||
?>
|
89
source/include/thread/thread_poll.php
Normal file
89
source/include/thread/thread_poll.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: thread_poll.php 36284 2016-12-12 00:47:50Z nemohou $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$polloptions = array();
|
||||
$votersuid = '';
|
||||
if($count = C::t('forum_polloption')->fetch_count_by_tid($_G['tid'])) {
|
||||
|
||||
$options = C::t('forum_poll')->fetch($_G['tid']);
|
||||
if($options['isimage']) {
|
||||
$pollimages = C::t('forum_polloption_image')->fetch_all_by_tid($_G['tid']);
|
||||
require_once libfile('function/home');
|
||||
}
|
||||
$isimagepoll = $options['isimage'] ? true : false;
|
||||
$multiple = $options['multiple'];
|
||||
$visible = $options['visible'];
|
||||
$maxchoices = $options['maxchoices'];
|
||||
$expiration = $options['expiration'];
|
||||
$overt = $options['overt'];
|
||||
$voterscount = $options['voters'];
|
||||
|
||||
$query = C::t('forum_polloption')->fetch_all_by_tid($_G['tid'], 1);
|
||||
$colors = array('E92725', 'F27B21', 'F2A61F', '5AAF4A', '42C4F5', '0099CC', '3365AE', '2A3591', '592D8E', 'DB3191');
|
||||
$voterids = $polloptionpreview = '';
|
||||
$ci = 0;
|
||||
$opts = 1;
|
||||
foreach($query as $options) {
|
||||
$viewvoteruid[] = $options['voterids'];
|
||||
$voterids .= "\t".$options['voterids'];
|
||||
$option = preg_replace("/\[url=(https?){1}:\/\/([^\[\"']+?)\](.+?)\[\/url\]/i", "<a href=\"\\1://\\2\" target=\"_blank\">\\3</a>", $options['polloption']);
|
||||
$attach = array();
|
||||
if($isimagepoll && $pollimages[$options['polloptionid']]) {
|
||||
$attach = $pollimages[$options['polloptionid']];
|
||||
$attach['small'] = pic_get($attach['attachment'], 'forum', $attach['thumb'], $attach['remote']);
|
||||
$attach['big'] = pic_get($attach['attachment'], 'forum', 0, $attach['remote']);
|
||||
}
|
||||
$polloptions[$opts++] = array
|
||||
(
|
||||
'polloptionid' => $options['polloptionid'],
|
||||
'polloption' => $option,
|
||||
'votes' => $options['votes'],
|
||||
'width' => $options['votes'] > 0 ? (@round($options['votes'] * 100 / $count['total'])).'%' : '8px',
|
||||
'percent' => $count['total'] ? sprintf("%01.2f", $options['votes'] * 100 / $count['total']) : 0,
|
||||
'color' => $colors[$ci],
|
||||
'imginfo' => $attach
|
||||
);
|
||||
if($ci < 2) {
|
||||
$polloptionpreview .= $option."\t";
|
||||
}
|
||||
$ci++;
|
||||
if($ci == count($colors)) {
|
||||
$ci = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$voterids = explode("\t", $voterids);
|
||||
$voters = array_unique($voterids);
|
||||
array_shift($voters);
|
||||
|
||||
if(!$expiration) {
|
||||
$expirations = TIMESTAMP + 86400;
|
||||
} else {
|
||||
$expirations = $expiration;
|
||||
if($expirations > TIMESTAMP) {
|
||||
$_G['forum_thread']['remaintime'] = remaintime($expirations - TIMESTAMP);
|
||||
}
|
||||
}
|
||||
|
||||
$allwvoteusergroup = $_G['group']['allowvote'];
|
||||
$allowvotepolled = !in_array(($_G['uid'] ? $_G['uid'] : $_G['clientip']), $voters);
|
||||
$allowvotethread = ($_G['forum_thread']['isgroup'] || !$_G['forum_thread']['closed'] && !checkautoclose($_G['forum_thread']) || $_G['group']['alloweditpoll']) && TIMESTAMP < $expirations && $expirations > 0;
|
||||
|
||||
$_G['group']['allowvote'] = $allwvoteusergroup && $allowvotepolled && $allowvotethread;
|
||||
|
||||
$optiontype = $multiple ? 'checkbox' : 'radio';
|
||||
$visiblepoll = $visible || $_G['forum']['ismoderator'] || ($_G['uid'] && $_G['uid'] == $_G['forum_thread']['authorid']) || ($expirations >= TIMESTAMP && in_array(($_G['uid'] ? $_G['uid'] : $_G['clientip']), $voters)) || $expirations < TIMESTAMP ? 0 : 1;
|
||||
|
||||
}
|
||||
|
||||
?>
|
77
source/include/thread/thread_printable.php
Normal file
77
source/include/thread/thread_printable.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: thread_printable.php 33149 2013-04-28 01:53:37Z nemohou $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$thisbg = '#FFFFFF';
|
||||
if(!getstatus($_G['forum_thread']['status'], 2)) {
|
||||
$posts = C::t('forum_post')->fetch_all_by_tid('tid:'.$_G['tid'], $_G['tid'], true, 'ASC', 0, 100, null, 0);
|
||||
} else {
|
||||
$posts = C::t('forum_post')->fetch_threadpost_by_tid_invisible($_G['tid'], 0);
|
||||
$posts = array($posts);
|
||||
}
|
||||
$userinfo = $uids = $skipaids = array();
|
||||
foreach($posts as $post) {
|
||||
|
||||
if(strpos($post['message'], '[/password]') !== FALSE) {
|
||||
$post['message'] = '';
|
||||
}
|
||||
|
||||
$post['dateline'] = dgmdate($post['dateline'], 'u');
|
||||
if(preg_match("/\[hide\]\s*(.+?)\s*\[\/hide\]/is", $post['message'], $hide)) {
|
||||
if(preg_match_all("/\[attach\](\d+)\[\/attach\]/i", $hide[1], $matchaids)) {
|
||||
$skipaids = array_merge($skipaids, $matchaids[1]);
|
||||
}
|
||||
$post['message'] = preg_replace("/\[hide\]\s*(.+?)\s*\[\/hide\]/is", '', $post['message']);
|
||||
}
|
||||
if(strpos(strtolower($post['message']), '[hide=') !== FALSE) {
|
||||
$post['message'] = preg_replace("/\[hide=(\d+)\]\s*(.*?)\s*\[\/hide\]/is", "", $post['message']);
|
||||
}
|
||||
$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));
|
||||
|
||||
if(strpos($post['message'], '[page]') !== FALSE) {
|
||||
$post['message'] = preg_replace("/\s?\[page\]\s?/is", '', $post['message']);
|
||||
}
|
||||
if(strpos($post['message'], '[/index]') !== FALSE) {
|
||||
$post['message'] = preg_replace("/\s?\[index\](.+?)\[\/index\]\s?/is", '', $post['message']);
|
||||
}
|
||||
|
||||
if($post['attachment']) {
|
||||
$attachment = 1;
|
||||
}
|
||||
$post['attachments'] = array();
|
||||
if($post['attachment'] && ($_G['group']['allowgetattach'] || $_G['group']['allowgetimage'])) {
|
||||
$_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];
|
||||
}
|
||||
}
|
||||
$uids[] = $post['authorid'];
|
||||
$postlist[$post['pid']] = $post;
|
||||
}
|
||||
unset($posts);
|
||||
if($uids) {
|
||||
$uids = array_unique($uids);
|
||||
$userinfo = C::t('common_member')->fetch_all($uids);
|
||||
}
|
||||
|
||||
if($_G['forum_attachpids'] && !defined('IN_ARCHIVER')) {
|
||||
require_once libfile('function/attachment');
|
||||
if(is_array($threadsortshow) && !empty($threadsortshow['sortaids'])) {
|
||||
$skipaids = array_merge($skipaids, $threadsortshow['sortaids']);
|
||||
}
|
||||
parseattach($_G['forum_attachpids'], $_G['forum_attachtags'], $postlist, $skipaids);
|
||||
}
|
||||
|
||||
include template('forum/viewthread_printable');
|
||||
|
||||
?>
|
33
source/include/thread/thread_reward.php
Normal file
33
source/include/thread/thread_reward.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: thread_reward.php 24359 2011-09-14 07:54:47Z svn_project_zhangjie $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
$bapid = 0;
|
||||
$rewardprice = abs($_G['forum_thread']['price']);
|
||||
$dateline = $_G['forum_thread']['dateline'] + 1;
|
||||
$bestpost = array();
|
||||
if($_G['forum_thread']['price'] < 0 && $page == 1) {
|
||||
foreach($postlist as $key => $post) {
|
||||
if($post['dbdateline'] == $dateline) {
|
||||
$bapid = $key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($bapid) {
|
||||
$bestpost = C::t('forum_post')->fetch_post($posttableid, $bapid);
|
||||
$bestpost['message'] = messagecutstr($bestpost['message'], 400);
|
||||
$bestpost['avatar'] = avatar($bestpost['authorid'], 'small');
|
||||
}
|
||||
|
||||
?>
|
136
source/include/thread/thread_trade.php
Normal file
136
source/include/thread/thread_trade.php
Normal file
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* [Discuz!] (C)2001-2099 Comsenz Inc.
|
||||
* This is NOT a freeware, use is subject to license terms
|
||||
*
|
||||
* $Id: thread_trade.php 28348 2012-02-28 06:16:29Z monkey $
|
||||
*/
|
||||
|
||||
if(!defined('IN_DISCUZ')) {
|
||||
exit('Access Denied');
|
||||
}
|
||||
|
||||
if(empty($_GET['do']) || $_GET['do'] == 'tradeinfo') {
|
||||
|
||||
if($_GET['do'] == 'tradeinfo') {
|
||||
$_GET['pid'] = intval($_GET['pid']);
|
||||
} else {
|
||||
$_GET['pid'] = '';
|
||||
!$tradenum && $allowpostreply = FALSE;
|
||||
}
|
||||
|
||||
$query = C::t('forum_trade')->fetch_all_thread_goods($_G['tid'], $_GET['pid']);
|
||||
$trades = $tradesstick = array();$tradelist = 0;
|
||||
if(empty($_GET['do'])) {
|
||||
$sellerid = 0;
|
||||
$listcount = count($query);
|
||||
$tradelist = $tradenum - $listcount;
|
||||
}
|
||||
|
||||
$tradesaids = $tradespids = array();
|
||||
foreach($query as $trade) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
$tradesaids[] = $trade['aid'];
|
||||
$tradespids[] = $trade['pid'];
|
||||
if($trade['displayorder'] < 0) {
|
||||
$trades[$trade['pid']] = $trade;
|
||||
} else {
|
||||
$tradesstick[$trade['pid']] = $trade;
|
||||
}
|
||||
}
|
||||
if(empty($_GET['do'])) {
|
||||
$tradepostlist = C::t('forum_post')->fetch_all_post('tid:'.$_G['tid'], $tradespids);
|
||||
}
|
||||
$trades = $tradesstick + $trades;
|
||||
unset($trade);
|
||||
|
||||
if($tradespids) {
|
||||
foreach(C::t('forum_attachment_n')->fetch_all_by_id('tid:'.$_G['tid'], 'pid', $tradespids) as $attach) {
|
||||
if($attach['isimage'] && is_array($tradesaids) && in_array($attach['aid'], $tradesaids)) {
|
||||
$trades[$attach['pid']]['attachurl'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']).'forum/'.$attach['attachment'];
|
||||
$trades[$attach['pid']]['thumb'] = $attach['thumb'] ? getimgthumbname($trades[$attach['pid']]['attachurl']) : $trades[$attach['pid']]['attachurl'];
|
||||
$trades[$attach['pid']]['width'] = $attach['thumb'] && $_G['setting']['thumbwidth'] < $attach['width'] ? $_G['setting']['thumbwidth'] : $attach['width'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($_GET['do'] == 'tradeinfo') {
|
||||
$trade = $trades[$_GET['pid']];
|
||||
unset($trades);
|
||||
$post = C::t('forum_post')->fetch_post('tid:'.$_G['tid'], $_GET['pid']);
|
||||
if($post) {
|
||||
$post = array_merge(C::t('common_member_status')->fetch($post['authorid']), C::t('common_member_profile')->fetch($post['authorid']),
|
||||
$post, getuserbyuid($post['authorid']));
|
||||
if($_G['setting']['verify']['enabled']) {
|
||||
$post = array_merge($post, C::t('common_member_verify')->fetch($post['authorid']));
|
||||
}
|
||||
}
|
||||
|
||||
$postlist[$post['pid']] = viewthread_procpost($post, $lastvisit, $ordertype);
|
||||
|
||||
$usertrades = $userthreads = array();
|
||||
if(!$_G['inajax']) {
|
||||
$limit = 6;
|
||||
$query = C::t('forum_trade')->fetch_all_for_seller($_G['forum_thread']['authorid'], $limit + 1, $_G['tid']);
|
||||
$usertradecount = 0;
|
||||
foreach($query as $usertrade) {
|
||||
if($usertrade['pid'] == $post['pid']) {
|
||||
continue;
|
||||
}
|
||||
$usertradecount++;
|
||||
$usertrades[] = $usertrade;
|
||||
if($usertradecount == $limit) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if($_G['forum_attachpids'] && !defined('IN_ARCHIVER')) {
|
||||
require_once libfile('function/attachment');
|
||||
parseattach($_G['forum_attachpids'], $_G['forum_attachtags'], $postlist, array($trade['aid']));
|
||||
}
|
||||
|
||||
$post = $postlist[$_GET['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) {
|
||||
$post['sellerrank'] = $level;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$navtitle = $trade['subject'];
|
||||
|
||||
if($post['authorid']) {
|
||||
$online = $sessioninfo = C::app()->session->fetch_by_uid($post['authorid']) && empty($sessioninfo['invisible']) ? 1 : 0;
|
||||
}
|
||||
|
||||
include template('forum/trade_info');
|
||||
exit;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user