<?php
/**
 * @version $Id: preview.inc.php v2.0 $
 * @package PBDigg
 * @copyright Copyright (C) 2007 - 2008 PBDigg.com. All Rights Reserved.
 * @license PBDigg is free software and use is subject to license terms
 */

if(!defined('IN_ADMIN') || !isset($_PBDEV['PHP_SELF']) || !preg_match('/[\/\\\\]admincp\.php$/i', $_PBDEV['PHP_SELF']))
{
	exit('Access Denied');
}

if (empty($id) || !is_numeric($id))
{
	exit('Access Denied!');
}
define('PB_CSCRIPT', 'preview');
$id = (int)$id;

if ($type == 'article')
{
	$rt = getFiledValues(array('tid', 'author', 'content'), 'threads', "tid = $id");
	if (!$rt[0]['author'])
	{
		$rt[0]['author'] = $cp_message['anonymity'];
	}
}
elseif ($type == 'comment')
{
	$rt = getFiledValues(array('rid', 'author', 'content'), 'comments', "rid = $id");
}
else
{
	echo '<script>alert("unknow action!");self.close();</script>';
}
$TPL->assign('topic', $rt[0]);
?>
