⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 thread.inc.php

📁 论坛软件系统亦称电子公告板(BBS)系统
💻 PHP
字号:
<?php

/*
	[Discuz!] (C)2001-2006 Comsenz Inc.
	This is NOT a freeware, use is subject to license terms

	$RCSfile: thread.inc.php,v $
	$Revision: 1.11 $
	$Date: 2006/09/01 01:03:17 $
*/


if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}

$query = $db->query("SELECT * FROM {$tablepre}threads t
	LEFT JOIN {$tablepre}forums f ON f.fid=t.fid
	LEFT JOIN {$tablepre}forumfields ff ON ff.fid=f.fid
	WHERE t.tid='$tid' AND t.readperm='0' AND t.price<='0' AND t.displayorder>='0'
	AND f.status='1' AND ff.password=''");

$thread = $db->fetch_array($query);
$page = empty($page) ? 1 : $page;

$navtitle = ($thread['type'] == 'sub' ? ' - '.strip_tags($_DCACHE['forums'][$thread['fup']]['name']) : '').
	$thread['subject'].'('.$lang['page'].' '.$page.') - '.strip_tags($thread['name']).' - ';

if(!$thread || !(!$thread['viewperm'] || ($thread['viewperm'] && forumperm($thread['viewperm'])))) {
	require_once './include/header.inc.php';
?>
<a href="archiver/"><?=$_DCACHE['settings']['bbname']?></a></div><br>
<div class="simpletable smalltxt" style="width: <?=TABLEWIDTH?>"><div class="subtable altbg2"><br><?=$lang['thread_nonexistence']?><br><br></div></div>
<?

} else {

	$navsub = $thread['type'] == 'sub' ? " <a href=\"archiver/{$qm}fid-$thread[fup].html\">{$_DCACHE[forums][$thread[fup]][name]}</a> <b>&raquo;</b> ": ' ';
	$fullversion = array('title' => $thread['subject'], 'link' => "viewthread.php?tid=$tid");

	$ppp = $_DCACHE['settings']['postperpage'] * 2;
	$start = ($page - 1) * $ppp;

	$query = $db->query("SELECT author, dateline, subject, message, anonymous
		FROM {$tablepre}posts
		WHERE tid='$tid' AND invisible='0'
		ORDER BY dateline LIMIT $start, $ppp");

	if($firstpost = $db->fetch_array($query)) {
		$meta_contentadd = cutstr(strip_tags(str_replace(array("\r", "\n", "\t"), array('', '', ''), $firstpost['message'])), 200);
	}

	require_once './include/header.inc.php';
?>
<div class="subtable bold altbg1">
<a href="archiver/"><?=$_DCACHE['settings']['bbname']?></a> <b>&raquo;</b><?=$navsub?><a href="archiver/<?=$qm?>fid-<?=$thread['fid']?>.html"><?=$thread['name']?></a> <b>&raquo;</b> <?=$thread[subject]?></div><br>
<?
	while(($post = $firstpost) || ($post = $db->fetch_array($query))) {
		if(!empty($firstpost)) $firstpost = array();
		$post['dateline'] = gmdate($_DCACHE['settings']['dateformat'].' '.$_DCACHE['settings']['timeformat'], $post['dateline'] + $_DCACHE['settings']['timeoffset'] * 3600);
		$post['message'] = ($post['subject'] ? '<b>'.$post['subject'].'</b><br><br>' : '').nl2br(preg_replace(array('/&amp;(#\d{3,5};)/', "/\[hide=?\d*\](.+?)\[\/hide\]/is"),
			array('&\\1', '<b>**** Hidden Message *****</b>'),
			str_replace(array('&', '"', '<', '>', "\t", '   ', '  '),
			array('&amp;', '&quot;', '&lt;', '&gt;', '&nbsp; &nbsp; &nbsp; &nbsp; ', '&nbsp; &nbsp;', '&nbsp;&nbsp;'),
			$post['message'])));
		if($thread['jammer']) {
			$post['message'] =  preg_replace("/\<br \/\>/e", "jammer()", $post['message']);
		}
		$post['author'] = !$post['anonymous'] ? $post['author'] : $lang['anonymous'];

?>
<br><div class="simpletable smalltxt" style="width: <?=TABLEWIDTH?>"><div class="subtable altbg1">
<span class="right"><?=$post['dateline']?></span>
<b><?=$post['author']?></b></div>
<div class="subtable altbg2 t_msg" style="width: auto;height: auto">
<?=$post['message']?></div></div>
<?

	}

	echo "<br>".multi($thread['replies'] + 1, $page, $ppp, "{$qm}tid-$tid");

}

function jammer() {
	$randomstr = '';
	for($i = 0; $i < mt_rand(5, 15); $i++) {
		$randomstr .= chr(mt_rand(0, 59)).chr(mt_rand(63, 126));
	}
	return mt_rand(0, 1) ? '<font style="font-size:0px;color:'.ALTBG2.'">'.$randomstr.'</font><br />' :
		'<br /><span style="display:none">'.$randomstr.'</span>';
}

function cutstr($string, $length) {
	$strcut = '';
	if(strlen($string) > $length) {
		for($i = 0; $i < $length - 3; $i++) {
			$strcut .= ord($string[$i]) > 127 ? $string[$i].$string[++$i] : $string[$i];
		}
		return $strcut.' ...';
	} else {
		return $string;
	}
}

?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -