<?php
/*By雷日锦*/
error_reporting(E_ALL^E_NOTICE );
if(!file_exists("config/install.lock")){
	header("Location:install");exit;
}

header("Content-type:text/html; charset=utf-8");
define("ROOT_PATH",  str_replace("\\", "/", dirname(__FILE__))."/");
@include_once("config/site_list.php");
@include_once("config/version.php");
@include_once("config/setconfig.php");
define("SITEID",isset($SITELIST[$_SERVER['HTTP_HOST']])?$SITELIST[$_SERVER['HTTP_HOST']]['siteid']:1);
require("config/rewriterule.php");
require("config/config.php");
require("config/const.php");

@ini_set("session.cookie_domain", DOMAIN);
define("CONTROL_DIR","source/index");
define("MODEL_DIR","source/model");
/*视图模版配置*/
$cache_dir="";//模版缓存文件夹
$template_dir="skins/".SKINS;//模版风格文件夹
$wap_template_dir="skins/".WAPSKINS;
$compile_dir="";//模版编译文件夹

$html_dir="";//生成静态文件夹
$rewrite_on=REWRITE_ON;//是否开启伪静态 0不开 1开启
$smarty_caching=true;//是否开启缓存
$smarty_cache_lifetime=3600;//缓存时间

require("./skymvc/skymvc.php");
//用户自定义初始化函数
function userinit(&$base){
	
	if(isset($_SESSION["ssuser"]["userid"])){
		$base->ssuser=$_SESSION["ssuser"];//当前登录用户的信息
		$base->smarty->assign("ssuser",$base->ssuser);
	}
	//关闭session防止session死锁
	if(!in_array(get('m'),array('login',"user","sinalogin","qqlogin","qqopen","taobaologin","checkcode","setgps","near"))){
		session_write_close();
	}
	//设置唯一cookie
	if(isset($_COOKIE['oc_ssid'])){
		$oc_ssid=$_COOKIE['oc_ssid'];
		setcookie("oc_ssid",$oc_ssid,time()+3600*24*7,"/",DOMAIN);
		define("OC_SSID",$oc_ssid);
	}else{
		$oc_ssid=session_id().time();
		setcookie("oc_ssid",$oc_ssid,time()+3600*24*7,"/",DOMAIN);
		define("OC_SSID",$oc_ssid);
	}
	
	$base->loadConfig("table");	
	$base->smarty->assign("skins","/skins/".SKINS."/");
	$base->smarty->assign("wapskins","/skins/".WAPSKINS."/");
	$base->smarty->assign("appindex",APPINDEX);
}

?>