<?
include "../CheckUser.php";
include_once("../comm/db_sql.php");
include_once("../comm/config.php");
include_once("../comm/connect.php");
include_once("../comm/Function.php");
include_once("Function.php");
include_once("../../Smarty/Smarty.class.php");

$page_show = new Smarty(); 
$page_show->template_dir = "./template";
$page_show->compile_dir = "./templates_c"; 
$page_show->left_delimiter = "<{";      
$page_show->right_delimiter = "}>";

$check=$_GET['action'];
$channel=$_GET['channel'];
if(empty($channel))
	{
		$channel=1;
	}
	
$id=$_GET['id'];

if ($check=="edit"){
		$info_record=info_query_one($id,$db);
		$action="edit&id=".$id;
	}else if ($check=="copy"){
		$info_record=info_query_one($id,$db);
		$action="add";
	}else
	{	
		$action="add";
	}
//转换选项
$top_record=option_convert($info_record['TOP']);
$top_false=$top_record['str_false']; 
$top_true=$top_record['str_true'];

//审核
$review_record=option_convert($info_record['Review']);
$review_false=$review_record['str_false']; 
$review_true=$review_record['str_true'];

//热点
$hot_record=option_convert($info_record['Hot']);
$hot_false=$hot_record['str_false']; 
$hot_true=$hot_record['str_true'];

//推荐
$recommend_record=option_convert($info_record['Recommend']);
$recommend_false=$recommend_record['str_false']; 
$recommend_true=$recommend_record['str_true'];


//修改

//转换:
$page_show->assign("top_false", $top_false); 
$page_show->assign("top_true", $top_true); 
$page_show->assign("hot_false", $hot_false); 
$page_show->assign("hot_true", $hot_true); 
$page_show->assign("recommend_false", $recommend_false); 
$page_show->assign("recommend_true", $recommend_true); 
$page_show->assign("review_false", $review_false); 
$page_show->assign("review_true", $review_true); 

//通用:
$page_show->assign("Title", $info_record['Title']);       
$page_show->assign("Description", $info_record['Description']);       
$page_show->assign("model", $info_record['model']); 
$page_show->assign("Text", $info_record['Text']);       
$page_show->assign("Add_date", $info_record['Add_date']);       
$page_show->assign("Picture", $info_record['Picture']);       
$page_show->assign("Up_File", $info_record['Up_File']);       
$page_show->assign("Review", $info_record['Review']);       
$page_show->assign("price", $info_record['price']);       
$page_show->assign("vip_price", $info_record['vip_price']);       
$page_show->assign("Hit", $info_record['Hit']);       
$page_show->assign("Hot", $info_record['Hot']);       
$page_show->assign("TOP", $info_record['TOP']);       
$page_show->assign("Recommend", $info_record['Recommend']);       
$page_show->assign("Cate_id", $info_record['Cate_id']); 
$page_show->assign("big_cate_id", $info_record['big_cate_id']);        
$page_show->assign("Flash_file", $info_record['Flash_file']);       
$page_show->assign("channel", $info_record['channel']);      
$page_show->assign("category_name", $info_record['category_name']);       

//系统
$page_show->assign("action", $action);
$page_show->assign("check", $check);


//数组:子类
$category_record=sub_category_query_all($db);
$page_show->assign("category_record_array", $category_record);

//专题:
$category_record_zt=channel_query_category_zt($db);
$page_show->assign("category_record_zt_array", $category_record_zt);

//大类,独立大类
$category_record_all_no=category_query_all_no($db);
$page_show->assign("category_record_all_no_array", $category_record_all_no);




$page_show->display("add_info.html"); 
?>