<?php
	include str_replace('\\','/',dirname(__FILE__)).'/include/common.inc.php';
	$catid=intval($id);
	if($catid <=0)
	{
		show404('指定栏目ID='.$catid.'不存在!');
	}

	/*	
		获取栏目信息 由数组 $catinfo 存贮
	*/

	include DIRCMS_ROOT.'include/admin/category.class.php';
	$category=new category();
	$catinfo=$category->catinfo($catid);
	
	if(!$catinfo || $catinfo['type']!=1)
	{
		show404('指定栏目ID='.$catid.'不存在!');
	}

	/*
		判断会员浏览权限
	*/
	if(isset($install['member']) && $install['member'])
	{
		require_once(DIRCMS_ROOT.'member/include/member.class.php');
		$memobj=new member();
		$groupidsviewcatid=$memobj->groupidviewcatid($_groupid);
		$gradeidsviewcatid=$memobj->gradeidviewcatid($_gradeid);
		$viewcatid=array_intersect($groupidsviewcatid,$gradeidsviewcatid);
		if(!in_array($catid,$viewcatid) && !in_array(0,$viewcatid))
		{
			show404('指定栏目ID='.$catid.'的访问权限不足!');
		}
	}	

	@extract($catinfo ,EXTR_SKIP);
	@extract($catinfo['setting'] ,EXTR_SKIP);
	@extract($catinfo['expand'] ,EXTR_PREFIX_ALL,'');

	/*
		定义易创常用模板变量
	*/
	$dir_postion=get_pos($catid);
	$dir_catname=$catinfo['catname'];
	$dir_catid=$catid;
	$dir_url=$catinfo['url'];

	$head['title'] = $catinfo['catname'].'-'.($catinfo['setting']['meta_title']?$catinfo['setting']['meta_title'] : $DIRCMS['site_name']);
	$head['keywords'] = $catinfo['setting']['meta_keywords'];
	$head['description'] = $catinfo['setting']['meta_description'];
	
	$page=isset($page)?intval($page):1;
	$template=isfinalcatid($catid)?$catinfo['setting']['templist']:$catinfo['setting']['tempindex'];
	include template($template);
?>