<?php
/*
	+------------------------------------------------------------------------+
	| index.php
	+------------------------------------------------------------------------+
	| 首页文件 V1.0.3 Build 20120617
	| Author : 华强℡ （QQ：3421209） 
	| Email  : master@xuewl.com 
	| WebSite: http://bbs.xuewl.com 
	| Contact: http://t.qq.com/dede_tech
	| Copyright @ 2007 - 2012 织梦教程网（xuewl.com）
	+------------------------------------------------------------------------+
	+ 不管是否为商业用途，您必须保留此头部信息并不得修改，尊重版权从现在做起	+
*/
if(!file_exists(dirname(__FILE__).'/data/common.inc.php'))
{
    header('Location:install/index.php');
    exit();
}
//自动生成HTML版
if(isset($_GET['upcache']) || !file_exists('index.html'))
{
    require_once (dirname(__FILE__) . "/include/common.inc.php");    
    $GLOBALS['_arclistEnv'] = 'index';
    $row = $dsql->GetOne("Select * From `#@__homepageset`");
    $row['templet'] = MfTemplet($row['templet']);
	
	//如果是博客首页版
	if($row['makemod'] == 1){
		require_once DEDEINC."/arc.indexblog.class.php";
		$pv = new IndexBlogView();
		$pv->SetTemplet($cfg_basedir.$cfg_templets_dir."/".$row['templet']);
		if($row['showmod'] == 1){//如果是静态浏览
			include(dirname(__FILE__).'/index.html');
			exit();
		}else{
			$pv->Display();
			exit();
		}		
	}else{	
		require_once DEDEINC."/arc.partview.class.php";
		$pv = new PartView();
		$pv->SetTemplet($cfg_basedir . $cfg_templets_dir . "/" . $row['templet']);
		$row['showmod'] = isset($row['showmod'])? $row['showmod'] : 0;
		if($row['showmod'] == 1)
		{
			$pv->SaveToHtml(dirname(__FILE__).'/index.html');
			include(dirname(__FILE__).'/index.html');
			exit();
		} else { 
			$pv->Display();
			exit();
		}	
	}
}
else
{
    header('HTTP/1.1 301 Moved Permanently');
    header('Location:index.html');
}
?>