<?php
if (!defined('R_P')) exit('Access Denied');
$id = intval($_GET['id']);
$pid = intval($_GET['pid']);
$cid = 0;
$page = intval($_GET['page']) > 0 ? intval($_GET['page']):1;

$_output = qbase::get_object('content', $channelid, $id)->get();
if (empty($_output)) qbase::showmsg("没有找到您要找的" . $channeltitle, $skin , toPath($channelid));

$_output['play_leader'] = explode(',', $_output['play_leader']);
$_output['play_actor'] = explode(',', $_output['play_actor']);
$_output['description'] = "<p>" . str_replace("\n", "</p><p>", $_output['description']) ."</p>";
$field = array('subject_pre','play_area');
foreach($field as $v){
	$_output['op_' . $v] = qbase::formatSet($v, $_output[$v]);
}
$_output['player'] = qbase::get_object('content', $channelid, $id)->get_s();
foreach($_output['player'] as $key=>$val){
	$_output['player'][$key]['pname_encode'] = addslashes($val['pname']);
}
$_output['player_encode'] = qbase::jsonencode($_output['player']);
$_play_mapping = array('全集','连载中','预告片');
$_output['play_status_tip'] = $_play_mapping[$_output['play_status']];
$cid = $_output['cid'];
$_category_info = getCidInfo($channelid, $cid);
if (empty($_category_info)) qbase::showmsg("提交了错误参数", "$skin", toPath($channelid));
$tag = getTag($channelid, $id);
$iif = !($_category_info['html'] || $_category_info['pur_browse'] || $_output['pay']);

if (($_category_info['pur_browse'] || $_output['pay']) && !qbase::is_admin()) { // 权限检测
	require_once(R_P . '/include/class.userpay.php');
	$pay_purview = array(
		'id' => $id,
		'cid' => $cid,
		'point' => $_output['requirepoint'],
		'read_purview' => $_output['read_purview'],
		'pay_type' => $_output['pay_type'],
		'read_last' => $_output['read_last'],
	);
	$_output['paid'] = 1;
	$_output['pay_param'] = '';
	$purview = new userpay($channelid, $pay_purview, trim(urldecode($_GET['param'])));
	$_output['paid'] = $purview->checkSureLink('view');
	$_output['paid']++;
	if ($_output['paid'] == 1){
		//未付费
		$_output['page'] = 1;
		$_output['pay_param'] = $purview->createSureLink('check');
		$_output['player'] = array();
	}
} 

$showphp = '';
if ($_output['showphp']) {
	$showphp = $_output['showphp'];
} elseif ($info['showmessage']) {
	$showphp = $info['showmessage'];
} else {
	$showphp = qbase::GetCidSkin(2);
}
$title = $_output['subject'];
$keyword = $description = $_output['subject'] .','. $_output['subject_ot'] .','. $_category_info['keyword'] .','. qbase::substrs(strip_tags($_output['description']), 120);
include qbase::template($showphp);
qbase::obHtml(3);
?>