📄 forum.inc.php
字号:
<?php
/*
[Discuz!] (C)2001-2007 Comsenz Inc.
This is NOT a freeware, use is subject to license terms
$Id: forum.inc.php 9806 2007-08-15 06:04:37Z cnteacher $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
$discuz_action = 192;
$page = max(1, intval($page));
$start_limit = $number = ($page - 1) * $waptpp;
if(!empty($fid)) {
require_once DISCUZ_ROOT.'./include/forum.func.php';
if(empty($forum)) {
wapmsg('forum_nonexistence');
}
if(($forum['viewperm'] && !forumperm($forum['viewperm']) && !$forum['allowview']) || $forum['redirect'] || $forum['password']) {
wapmsg('forum_nopermission');
}
echo "<p>".strip_tags($forum['name'])."<br />".
"<a href=\"index.php?action=post&do=newthread&fid=$forum[fid]\">$lang[post_new]</a> ".
"<a href=\"index.php?action=forum&do=digest&fid=$forum[fid]\">$lang[digest]</a><br /><br />".
"$lang[forum_list] <a href=\"index.php?action=forum&fid=$forum[fid]\">$lang[reload]</a><br />";
$do = !empty($do) ? 'digest' : '';
$filteradd = $do == 'digest' ? 'AND digest>\'0\'' : '';
$query = $db->query("SELECT COUNT(*) FROM {$tablepre}threads WHERE fid='$fid' $filteradd AND displayorder>='0'");
$threadcount = $db->result($query, 0);
$thread['prefix'] = '';
$query = $db->query("SELECT * FROM {$tablepre}threads
WHERE fid='$fid' $filteradd AND displayorder>='0'
ORDER BY displayorder DESC, lastpost DESC LIMIT $start_limit, $waptpp");
while($thread = $db->fetch_array($query)) {
$thread['prefix'] .= $thread['displayorder'] > 0 ? $lang['forum_thread_sticky'] : '';
$thread['prefix'] .= $thread['digest'] ? $lang['forum_thread_digest'] : '';
echo "<a href=\"index.php?action=thread&tid=$thread[tid]\">#".++$number." ".cutstr($thread['subject'], 30)."</a>$thread[prefix]<br />\n".
"<small>[$thread[author] $lang[replies]$thread[replies] $lang[views]$thread[views]]</small><br />\n";
}
echo wapmulti($threadcount, $waptpp, $page, "index.php?action=forum&fid=$forum[fid]&sid=$sid");
if($do != 'digest') {
$subforums = '';
foreach($_DCACHE['forums'] as $subforum) {
if($subforum['type'] == 'sub' && $subforum['fup'] == $fid && (!$forum['viewperm'] || (strexists("\t".trim($forum['viewperm'])."\t", "\t".trim($groupid)."\t")))) {
$subforums .= "<a href=\"index.php?action=forum&fid=$subforum[fid]\">".strip_tags($subforum['name'])."</a><br />";
}
}
if(!empty($subforums)) {
echo "<br /><br />$lang[forum_sublist]<br />".$subforums;
}
}
echo (!empty($allowsearch) ? "<br /><br /><a href=\"index.php?action=post&do=newthread&fid=$forum[fid]\">$lang[post_new]</a><br />".
"<a href=\"index.php?action=my&do=fav&favid=$forum[fid]&type=forum\">$lang[my_addfav]</a><br />".
"<input type=\"text\" name=\"srchtxt\" value=\"\" size=\"6\" format=\"M*m\" emptyok=\"true\"/>".
"<anchor title=\"submit\">$lang[search]\n".
"<go method=\"post\" href=\"index.php?action=search&srchfid=$forum[fid]&do=submit&sid=$sid\">\n".
"<postfield name=\"srchtxt\" value=\"$(srchtxt)\" />\n".
"</go></anchor><br />" : '').
"</p>";
} else {
echo "<p>$lang[home_forums]<br />";
$query = $db->query("SELECT COUNT(*) FROM {$tablepre}forums WHERE status>0 AND type='forum'");
$forumcount = $db->result($query, 0);
$sql = !empty($accessmasks) ?
"SELECT f.fid, f.name, ff.viewperm, a.allowview FROM {$tablepre}forums f
LEFT JOIN {$tablepre}forumfields ff ON ff.fid=f.fid
LEFT JOIN {$tablepre}access a ON a.uid='$discuz_uid' AND a.fid=f.fid
WHERE f.status>0 AND f.type='forum' ORDER BY f.displayorder LIMIT $start_limit, $waptpp"
: "SELECT f.fid, f.name, ff.viewperm FROM {$tablepre}forums f
LEFT JOIN {$tablepre}forumfields ff USING(fid)
WHERE f.status>0 AND f.type='forum' ORDER BY f.displayorder LIMIT $start_limit, $waptpp";
$query = $db->query($sql);
while($forum = $db->fetch_array($query)) {
if(forum($forum) && (!$forum['viewperm'] || (strexists("\t".trim($forum['viewperm'])."\t", "\t".trim($groupid)."\t") && $forum['viewperm']))) {
echo "<a href=\"index.php?action=forum&fid=$forum[fid]\">".strip_tags($forum['name'])."</a><br/>";
}
}
echo wapmulti($forumcount, $waptpp, $page, "index.php?action=forum&sid=$sid");
echo "</p>";
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -