<?php
if (!defined('puyuetian')) {
	exit('403');
}

// 关闭缓存
$_G['SET']['MYSQLCACHECYCLE'] = 0;
$_G['TABLE']['READ'] = new Data('read', true);
$_G['TABLE']['REPLY'] = new Data('reply', true);

global $outhtml, $nowchecktitle, $type, $page;
$type = $_G['GET']['TYPE'];
if (!InArray('read,reply', $type)) {
	$type = 'read';
}
if ($type == 'read') {
	$nowchecktitle = '文章';
} else {
	$nowchecktitle = '回复';
}
$page = Cnum($_G['GET']['PAGE'], 1, true, 1);
$shownum = 50;
$spos = ($page - 1) * $shownum;
$postchecks = $_G['TABLE'][strtoupper($type)] -> getDatas($spos, $shownum, 'where `del`=2 order by `id` asc');
if ($postchecks) {
	foreach ($postchecks as $postcheck) {
		$userdata = $_G['TABLE']['USER'] -> getData($postcheck['uid']);
		if ($type == 'reply') {
			$readdata = $_G['TABLE']['READ'] -> getData($postcheck['rid']);
			$title = '回复:' . htmlspecialchars($readdata['title'], ENT_QUOTES);
		} else {
			$title = htmlspecialchars($postcheck['title'], ENT_QUOTES);
		}
		$outhtml .= "
<tr class='pk-text-center pk-text-truncate'>
	<td>
		<input class='check-chkbox' name='ids[]' type='checkbox' value='{$postcheck['id']}'>
	</td>
	<td>{$postcheck['id']}</td>
	<td>
		<a class='pk-text-primary pk-hover-underline' target='_blank' href='index.php?c=center&uid={$userdata['id']}'>{$userdata['nickname']}</a>
	</td>
	<td class='pk-text-left'>{$title}</td>
	<td>" . date('Y-m-d H:i:s', $postcheck['posttime']) . "</td>
	<td>
		<div class=pk-hide id=preview_{$postcheck['id']}>
			<input type=hidden name=uid value=\"{$postcheck['uid']}\">
			<input type=hidden name=sortid value=\"{$postcheck['sortid']}\">
			<input type=hidden name=label value=\"{$postcheck['label']}\">
			<input type=hidden name=title value=\"{$title}\">
			<input type=hidden name=content value=\"" . htmlspecialchars($postcheck['content'], ENT_QUOTES) . "\">
		</div>
		<a class='pk-btn pk-btn-success pk-btn-sm previewbtn' href='javascript:' data-id='{$postcheck['id']}'>预览</a>
	</td>
</tr>
<tr>
	<td colspan='99'>
		<div class='recontent pk-word-break-all' style='height:40px;padding:5px;overflow:hidden;max-width:100%' ondblclick='if(\$(this).outerHeight()==40){\$(this).css(\"height\",\"\")}else{\$(this).outerHeight(40)}'>
			" . htmlspecialchars($postcheck['content'], ENT_QUOTES) . "
		</div>
	</td>
</tr>
		";
	}
}
