<?php
if(!defined( 'R_P')) die("access die");
$id = intval($_GET['id']);
$_output = $cms->get_item($id);
if (empty($_output)) qbase::purviewCheckDie("您提交的数据不存在");
$_output = array_merge($_output, $cms->getExtendData($channelid, $id));
if ($admin_info['groupid'] > 3 && !in_array(intval($_output['cid']), $manage_category[$channelid])) qbase::purviewCheckDie();
$systems = explode(',', $_output['systems']);
$author = $_output['author'];
$authorhttp = $_output['authorhttp'];
$_output['filter'] = explode(",", $_output['filter']);
$_output['description'] = htmlspecialchars($_output['description']);
$extends = $cms->getExtend($channelselect);

if ($_output['type'] == 0) {
	$downurl_result = qdb::fetchAll("select * from `".TABLEPRE."downloads_{$channelid}`   where id = '{$id}' ");
	$downurls = array();
	foreach ($downurl_result as $downurl) {
		$number++;
		$downurl['index'] = $number;
		$downurls[] = $downurl;
	} 
} else {
	$serverlists = qdb::fetchAll("select name,id from `".TABLEPRE."downserver` where `channelid` IN($channelid,0)  and `is_lock`=0");
	$downInfo = qdb::QueryFirst("select * from ".TABLEPRE."downloads_{$channelid} where id='$id' limit 1");
	if (is_array($downInfo))  @extract($downInfo);
	$nowServer = array();
	$nowServer = @explode(',', $serverid);
} 

if($channel[$channelid]['show_related']){
	$related_arr = $cms ->get_related($channelid.'-'.$id);
	foreach($related_arr as &$val){
		foreach($val['data'] as &$v){
			$v['channelname'] = $channel[$v['channelid']]['channelname'];
		}
	}
	unset($val, $v);
	$related_json = qbase::jsonencode($related_arr);
}else{
	$related_json = "";
}

$keywords_array = getTag($channelid, $id);

unset($strall); 
$ppcid = $_output['cid'];
$strall = str_replace("value=\"{$ppcid}-", " selected value=\"{$ppcid}-", $menuTree);
include qbase::template($path . 'download/edit');
?>
