<?php 
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__)."/inc/inc_catalog_options.php");
require_once(dirname(__FILE__)."/../include/pub_dedetag.php");
require_once(dirname(__FILE__)."/inc/inc_archives_all.php");
if(!isset($cid)) $cid=0;
else $cid = trim(ereg_replace("[^0-9]","",$cid));
if(!isset($channelid)) $channelid=0;
else $channelid = trim(ereg_replace("[^0-9]","",$channelid));
if(!$cid>0 && !$channelid>0)
{
	ShowMsg("你没指定栏目ID或频道ID，不允许访问本页面！","-1");
	exit();
}
$dsql = new DedeSql(false);
if($cid>0)
{
  $query = "
  Select #@__arctype.typename as arctypename,
  #@__channeltype.* From #@__arctype 
  left join #@__channeltype on #@__channeltype.ID=#@__arctype.channeltype
  where #@__arctype.ID='$cid'
  ";
  $dsql = new DedeSql(false);
  $cInfos = $dsql->GetOne($query);
  $channelid = $cInfos['ID'];
  $addtable = $cInfos['addtable'];
}
else if($channelid>0)
{
	$query = " Select * From  #@__channeltype where ID='$channelid'";
  $dsql = new DedeSql(false);
  $cInfos = $dsql->GetOne($query);
  $channelid = $cInfos['ID'];
  $addtable = $cInfos['addtable'];
}
require_once(dirname(__FILE__)."/templets/archives_add.htm");
$dsql->Close();
?>