📄 forumdisplay.php
字号:
$threadcount = $db->result_first("SELECT COUNT(*) FROM {$tablepre}threads WHERE fid='$fid' $filteradd AND displayorder>='0'");
}
$thisgid = $forum['type'] == 'forum' ? $forum['fup'] : $_DCACHE['forums'][$forum['fup']]['fup'];
if($globalstick) {
$stickytids = $_DCACHE['globalstick']['global']['tids'].(empty($_DCACHE['globalstick']['categories'][$thisgid]['count']) ? '' : ','.$_DCACHE['globalstick']['categories'][$thisgid]['tids']);
$stickycount = $_DCACHE['globalstick']['global']['count'] + $_DCACHE['globalstick']['categories'][$thisgid]['count'];
} else {
$stickycount = $stickytids = 0;
}
$filterbool = !empty($filter) && in_array($filter, array('digest', 'type', 'activity', 'poll', 'trade', 'reward', 'debate', 'video'));
$threadcount += $filterbool ? 0 : $stickycount;
$multipage = multi($threadcount, $tpp, $page, "forumdisplay.php?fid=$fid$forumdisplayadd", $threadmaxpages);
$extra = rawurlencode("page=$page$forumdisplayadd");
$separatepos = 0;
$threadlist = array();
$colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
$displayorderadd = !$filterbool && $stickycount ? 't.displayorder IN (0, 1)' : 't.displayorder IN (0, 1, 2, 3)';
if(($start_limit && $start_limit > $stickycount) || !$stickycount || $filterbool) {
$querysticky = '';
$query = $db->query("SELECT t.* FROM {$tablepre}threads t
WHERE t.fid='$fid' $filteradd AND $displayorderadd
ORDER BY t.displayorder DESC, t.$orderby $ascdesc
LIMIT ".($filterbool ? $start_limit : $start_limit - $stickycount).", $tpp");
} else {
$querysticky = $db->query("SELECT t.* FROM {$tablepre}threads t
WHERE t.tid IN ($stickytids) AND t.displayorder IN (2, 3)
ORDER BY displayorder DESC, $orderby $ascdesc
LIMIT $start_limit, ".($stickycount - $start_limit < $tpp ? $stickycount - $start_limit : $tpp));
if($tpp - $stickycount + $start_limit > 0) {
$query = $db->query("SELECT t.* FROM {$tablepre}threads t
WHERE t.fid='$fid' $filteradd AND $displayorderadd
ORDER BY displayorder DESC, $orderby $ascdesc
LIMIT ".($tpp - $stickycount + $start_limit));
} else {
$query = '';
}
}
if($page < 4 && !(empty($_DCACHE['floatthreads']['categories'][$thisgid]) && empty($_DCACHE['floatthreads']['forums'][$fid]))) {
$queryfloat = $db->query("SELECT t.* FROM {$tablepre}threads t
WHERE t.tid IN (".(!empty($_DCACHE['floatthreads']['categories'][$thisgid]) ? $_DCACHE['floatthreads']['categories'][$thisgid] : 0).','.(!empty($_DCACHE['floatthreads']['forums'][$fid]) ? $_DCACHE['floatthreads']['forums'][$fid] : 0).") AND t.displayorder IN (4, 5)
ORDER BY displayorder DESC");
} else {
$queryfloat = '';
}
$ppp = $forum['threadcaches'] && !$discuz_uid ? $_DCACHE['settings']['postperpage'] : $ppp;
while(($querysticky && $thread = $db->fetch_array($querysticky)) || ($query && $thread = $db->fetch_array($query)) || ($queryfloat && $thread = $db->fetch_array($queryfloat))) {
$thread['icon'] = isset($_DCACHE['icons'][$thread['iconid']]) ? '<img src="images/icons/'.$_DCACHE['icons'][$thread['iconid']].'" alt="Icon'.$thread['iconid'].'" class="icon" />' : ' ';
$thread['lastposterenc'] = rawurlencode($thread['lastposter']);
$thread['typeid'] = $thread['typeid'] && !empty($forum['threadtypes']['prefix']) && isset($forum['threadtypes']['types'][$thread['typeid']]) ?
'<em>[<a href="forumdisplay.php?fid='.$fid.'&filter=type&typeid='.$thread['typeid'].'">'.$forum['threadtypes']['types'][$thread['typeid']].'</a>]</em>' : '';
$thread['multipage'] = '';
$topicposts = $thread['special'] ? $thread['replies'] : $thread['replies'] + 1;
$thread['special'] == 3 && $thread['price'] < 0 && $thread['replies']--;
if($topicposts > $ppp) {
$pagelinks = '';
$thread['pages'] = ceil($topicposts / $ppp);
for($i = 1; $i <= 6 && $i <= $thread['pages']; $i++) {
$pagelinks .= "<a href=\"viewthread.php?tid=$thread[tid]&extra=$extra&page=$i\">$i</a> ";
}
if($thread['pages'] > 6) {
$pagelinks .= " .. <a href=\"viewthread.php?tid=$thread[tid]&extra=$extra&page=$thread[pages]\">$thread[pages]</a> ";
}
$thread['multipage'] = ' '.$pagelinks;
}
if($thread['highlight']) {
$string = sprintf('%02d', $thread['highlight']);
$stylestr = sprintf('%03b', $string[0]);
$thread['highlight'] = ' style="';
$thread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
$thread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
$thread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
$thread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
$thread['highlight'] .= '"';
} else {
$thread['highlight'] = '';
}
$thread['moved'] = 0;
if($thread['closed'] || ($forum['autoclose'] && $timestamp - $thread[$closedby] > $forum['autoclose'])) {
$thread['new'] = 0;
if($thread['closed'] > 1) {
$thread['moved'] = $thread['tid'];
$thread['tid'] = $thread['closed'];
$thread['replies'] = '-';
$thread['views'] = '-';
}
$thread['folder'] = 'lock';
} else {
$thread['folder'] = 'common';
if($lastvisit < $thread['lastpost'] && (empty($_DCOOKIE['oldtopics']) || strpos($_DCOOKIE['oldtopics'], 'D'.$thread['tid'].'D') === FALSE)) {
$thread['new'] = 1;
$thread['folder'] = 'new';
} else {
$thread['new'] = 0;
}
if($thread['replies'] > $thread['views']) {
$thread['views'] = $thread['replies'];
}
if($thread['replies'] >= $hottopic) {
$thread['folder'] = 'hot';
}
}
$thread['dateline'] = gmdate($dateformat, $thread['dateline'] + $timeoffset * 3600);
$thread['lastpost'] = gmdate("$dateformat $timeformat", $thread['lastpost'] + $timeoffset * 3600);
if(in_array($thread['displayorder'], array(1, 2, 3))) {
$thread['id'] = 'stickthread_'.$thread['tid'];
$separatepos++;
} elseif(in_array($thread['displayorder'], array(4, 5))) {
$thread['id'] = 'floatthread_'.$thread['tid'];
} else {
$thread['id'] = 'normalthread_'.$thread['tid'];
}
$resulttid[] = $thread['tid'];
$threadlist[] = $thread;
}
/*
if($forum['threadtypes']['special'][$typeid]) {
if(@include_once DISCUZ_ROOT.'./forumdata/cache/threadtype_'.$typeid.'.php') {
$query = $db->query("SELECT tid, optionid, value FROM {$tablepre}typeoptionvars WHERE tid IN (".(implodeids($resulttid)).")");
while($option = $db->fetch_array($query)) {
if($_DTYPE[$option['optionid']]['search']) {
$optiondata[$option['tid']]['optionid'] = $option['optionid'];
$optiondata[$option['tid']]['title'] = $_DTYPE[$option['optionid']]['title'];
$optiondata[$option['tid']]['value'] = $option['value'];
}
}
print_r($optiondata);
foreach($optiondata as $tid => $option) {
if(in_array($_DTYPE[$optionid]['type'], array('select', 'radio'))) {
$resultlist[$tid] = $_DTYPE[$optionid]['choices'][$option['value']];
} elseif($_DTYPE[$optionid]['type'] == 'checkbox') {
foreach(explode("\t", $option['value']) as $choiceid) {
$choiceshow .= $_DTYPE[$optionid]['choices'][$choiceid].' ';
}
$resultlist[$tid] = $choiceshow;
} elseif($_DTYPE[$optionid]['type'] == 'image') {
$maxwidth = $_DTYPE[$optionid]['maxwidth'] ? 'width="'.$_DTYPE[$optionid]['maxwidth'].'"' : '';
$maxheight = $_DTYPE[$optionid]['maxheight'] ? 'height="'.$_DTYPE[$optionid]['maxheight'].'"' : '';
$resultlist[$tid] = $optiondata[$optionid] ? "<a href=\"$optiondata[$optionid]\" target=\"_blank\"><img src=\"$option[value]\" $maxwidth $maxheight border=\"0\"></a>" : '';
} elseif($_DTYPE[$optionid]['type'] == 'url') {
$resultlist[$tid] = $optiondata[$optionid] ? "<a href=\"$value[value]\" target=\"_blank\">$option[value]</a>" : '';
} else {
$resultlist[$tid] = $option;
}
}
//print_r($resultlist);
}
}
*/
$separatepos = $separatepos ? $separatepos + 1 : ($announcement ? 1 : 0);
$visitedforums = $visitedforums ? visitedforums() : '';
$forumselect = $forummenu = '';
$typeselect = typeselect($typeid, '', 'onchange="if(this.options[this.selectedIndex].className) {this.form.action=this.form.action + \'&previewpost=yes&showpreview=no\';this.form.submit();}"');
$usesigcheck = $discuz_uid && $sigstatus ? 'checked="checked"' : '';
$allowpost = (!$forum['postperm'] && $allowpost) || ($forum['postperm'] && forumperm($forum['postperm'])) || $forum['allowpost'] == 1;
$fastpost = $fastpost && !$forum['allowspecialonly'];
$allowpost = $forum['allowpost'] != -1 ? $allowpost : false;
$addfeedcheck = $customaddfeed & 1 ? 'checked="checked"': '';
$showpoll = $showtrade = $showreward = $showactivity = $showdebate = $showvideo = 0;
if($forum['allowpostspecial']) {
$showpoll = $forum['allowpostspecial'] & 1;
$showtrade = $forum['allowpostspecial'] & 2;
$showreward = isset($extcredits[$creditstrans]) && ($forum['allowpostspecial'] & 4);
$showactivity = $forum['allowpostspecial'] & 8;
$showdebate = $forum['allowpostspecial'] & 16;
$showvideo = ($forum['allowpostspecial'] & 32) && $videoopen;
}
if($allowpost) {
$allowpostpoll = $allowpostpoll && $showpoll;
$allowposttrade = $allowposttrade && $showtrade;
$allowpostreward = $allowpostreward && $showreward;
$allowpostactivity = $allowpostactivity && $showactivity;
$allowpostdebate = $allowpostdebate && $showdebate;
$allowpostvideo = $allowpostvideo && $showvideo;
}
$forumselect = $forummenu = '';
if($forumjump) {
if($jsmenu[1]) {
$forummenu = forumselect(FALSE, 1);
} else {
$forumselect = forumselect(FALSE, 1);
}
}
$smile = isset($_DCOOKIE['smile']) ? explode('D', $_DCOOKIE['smile']) : array();
$stypeid = intval(!empty($stypeid) ? $stypeid : ($smile[3] != $styleid ? STYPEID : $smile[0]));
$stypeid = isset($_DCACHE['smileytypes'][$stypeid]) ? $stypeid : (isset($_DCACHE['smileytypes'][STYPEID]) ? STYPEID : key($_DCACHE['smileytypes']));
$smilies = $_DCACHE['smilies_display'][$stypeid];
$scrollt = intval(!empty($scrollt) ? $scrollt : $smile[2]);
$sm_page = (!isset($_GET['stypeid']) || $_GET['stypeid'] == $smile[0] ? $smile[1] : 1);
$spp = $smcols * $smrows;
$sm_multipage = multi(count($smilies), $spp, $sm_page, 'post.php?action=smilies&stypeid='.$stypeid.'&inajax=1&scrollt='.$scrollt, 0, 10, FALSE, TRUE);
$smilies = arrayslice($smilies, $spp * ($sm_page - 1), $spp);
dsetcookie('smile', $stypeid.'D'.$sm_page.'D'.$scrollt.'D'.$styleid, 86400 * 365);
include template('forumdisplay');
function arrayslice($array, $offset, $length) {
if(PHP_VERSION >= '5.0.2') {
return array_slice($array, $offset, $length, TRUE);
} else {
$array = array_chunk($array, $length, TRUE);
return $array[$offset / $length];
}
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -