function GetCatalogNum($tid)
	{
		if(!is_array($this->CatalogNums)){ $this->UpdateCatalogNum(); }
		if(!isset($this->CatalogNums[$tid])) return 0;
		else
		{
			$totalnum = 0;
			$GLOBALS['idArray'] = array();
			$ids = TypeGetSunTypes($tid,$this->dsql,0);
			foreach($ids as $tid){
				if(isset($this->CatalogNums[$tid])) $totalnum += $this->CatalogNums[$tid];
			}
			return $totalnum;
		}
	}
$body = "";
$litpic = "";
$fieldear = array();

header("Content-Type: text/html; charset={$cfg_ver_lang}");

$dsql = new DedeSql(false);
$mkimg=new CreatMiniature();
//获取条件
//------------------------
$gwhere = " where ID>=$startid And arcrank=0 ";
if($endid > $startid) $gwhere .= " And ID<= $endid ";
$idsql = "";
if($typeid!=0){
	$tpids = '';
	$idArrary = TypeGetSunTypes($typeid,$dsql,0);
	if(is_array($idArrary))
	{
	  
	  foreach($idArrary as $tid){
	  	$tpids = ($tpids=='' ? $tid : ','.$tid);
	  }
	  $idsql = " And typeid in ($tpids)";
  }
  $idsql = $gwhere.$idsql;
}
if($idsql=="") $idsql = $gwhere;
if($seltime==1){
	 $t1 = GetMkTime($stime);
	 $t2 = GetMkTime($etime);
	 $idsql .= " And (senddate >= $t1 And senddate <= $t2) ";
function TypeGetSunID($ID,&$dsql,$tb="#@__archives",$channel=0,$onlydd=false)
{
		$GLOBALS['idArray'] = array();
		TypeGetSunTypes($ID,$dsql,$channel);
		$rquery = "";
		foreach($GLOBALS['idArray'] as $k=>$v)
		{
			if($onlydd){
				$rquery .= ($rquery=='' ? $k : ",{$k}");
			}else{
			  if($tb!="")
			     $rquery .= ($rquery!='' ? " Or {$tb}.typeid='$k' " : " {$tb}.typeid='$k' ");
		    else
		  	   $rquery .= ($rquery!='' ? " Or typeid='$k' " : " typeid='$k' ");
		  }
		}
		if($onlydd) return $rquery;
		else return " (".$rquery.") ";
}