<?php
error_reporting(7);
ini_set("display_errors",true);

session_start();

//================ 定义站点根目录 ================//

define('WEB_TEMPLATE',WEB_ROOT.'/template');
define('WEB_SHTML',WEB_ROOT.'/shtml');
define('WEB_MODULE',WEB_ROOT.'/module');
define('WEB_SCRIPT',WEB_ROOT.'/script');
define('WEB_MODEL',WEB_ROOT.'/model');
define('WEB_MODULE',WEB_ROOT.'/module');
define('WEB_IMAGES',WEB_ROOT.'/images');
define('WEB_CSS',WEB_ROOT.'/css');


//================ 定义整站站点目录 ================//
define('CORE_ROOT', WEB_ROOT.'/../core/');
define('CORE_CONF',CORE_ROOT.'conf');
define('CORE_COMMON',CORE_ROOT.'common');
define('CORE_LIB',CORE_ROOT.'lib');
define('CORE_STATIC',CORE_ROOT.'static');


//================ 定义常量 ================//
define('FRAME_URL', "http://esfadmin.house365.com/");
define('FRAME_MODULE', FRAME_URL."module");
define("FRAME_LOGIN", FRAME_URL."login.php");
define("FRAME_LOGOUT", FRAME_URL."login.php?submit_flag=logout");
define("FRAME_INDEX", FRAME_URL."index.php");
define("FRAME_DEFAULT", FRAME_MODULE."/default/default.php");


/****载入配置类库、方法库开始****/
include_once(CORE_LIB . "/class_spell.php");      //基本拼音类
include_once(CORE_LIB . "/ip/ip.php");            //包含IP文件
include_once(CORE_LIB . "/class_adodb.php");      //包含配置变量文件
include_once(CORE_LIB . "/class_server.php");     //中间件
include_once(CORE_LIB . "/class_dao.php");        //数据库类
include_once(CORE_LIB . "/class_uploadfile.php"); //中间件
include_once(CORE_LIB . "/class_page.php"); //中间件
/****载入配置类库、方法库结束****/

/*** 载入基本函数文件***/
include_once(CORE_COMMON . "/func_tony.php");   //标签函数集合
include_once(CORE_COMMON . "/func_template.php"); //模板函数集合
/*** 载入基本函数文件结束***/

//================ 载入后台本站通用文件 ================//
include_once(WEB_MODEL."/func_base.php");	//本站公用函数
if($directory != ""){
	//include_once(WEB_MODEL."/".$directory."_base_func.php");//模块公用集合
}

//================ 框架系统标识 ================//
$web_auth = "esfadmin";

//================ 载入基础配置文件 ================//
include_once(CORE_CONF."/conf_base.php");
include_once(CORE_CONF."/conf_esfadmin.php");

//================ 合并整站和模块的相应配置 ================//

$house = array_merge($house,$conf_house);
//var_dump($conf_house);
unset($conf_house);


//================ 设置框架风格 ================//
$dwz_theme = $_COOKIE['dwz_theme'] != '' ? $_COOKIE['dwz_theme'] : 'default';


//================ 城市判断 ================//
//$conf_cityflag = $_SESSION[$web_auth]["now_city"] != "" ? $_SESSION[$web_auth]["now_city"] : "";
$conf_cityflag = $conf_cityflag?$conf_cityflag:'hf';

//================ 基础库开通 ================//
/****实例化Dao FISHER 2013-7-18****/
//不确定是否配置了从库
$conf_dbback_host = $conf_dbback_host != "" ? $conf_dbback_host : $conf_db_host;
$dao_sys = new Dao();
$dao_sys->initDb(CORE_LIB."/class_adodb.php", array('conf_db_type'=>$conf_db_type,'conf_db_host'=>$conf_db_host,'conf_db_user'=>$conf_db_user,'conf_db_password'=>$conf_db_password,'conf_db_name'=>$conf_db_name,'conf_db_charset'=>$conf_db_charset,'conf_db_debug'=>$conf_db_debug,'conf_db_connect'=>$conf_db_connect), array('conf_db_type'=>$conf_db_type,'conf_db_host'=>$conf_dbback_host,'conf_db_user'=>$conf_db_user,'conf_db_password'=>$conf_db_password,'conf_db_name'=>$conf_db_name,'conf_db_charset'=>$conf_db_charset,'conf_db_debug'=>$conf_db_debug,'conf_db_connect'=>$conf_db_connect));
$dao_sys->initMc('172.17.1.51', 1122);

$db_sys = $dao_sys->db;//数据库主库
$dbback_sys = $dao_sys->dbback;//数据库从库
$mc = $dao_sys->mc;//初始化Memcache
/*********************************/


//================ 初始化特定角色权限 ================//
$global_purview = array("super"=>1,"admin"=>2);

//===================== 已开通站点 ===================//
$global_admin_citys = array_merge(array('super'=>'系统管理','admin'=>'系统管理'), $esfadmin_citys);



//================ 载入城市配置文件 ================//
if($conf_cityflag != "" && $esfadmin_citys[$conf_cityflag] != "")
{
	/****实例化各站Dao FISHER 2013-7-24****/
	include_once(CORE_CONF."/conf_".$conf_cityflag.".php");

	//不确定是否配置了从库
	$conf_dbback_host = $conf_dbback_host != "" ? $conf_dbback_host : $conf_db_host;
	$dao = new Dao();
	$dao->initDb(CORE_LIB."/class_adodb.php", array('conf_db_type'=>$conf_db_type,'conf_db_host'=>$conf_db_host,'conf_db_user'=>$conf_db_user,'conf_db_password'=>$conf_db_password,'conf_db_name'=>$conf_db_name,'conf_db_charset'=>$conf_db_charset,'conf_db_debug'=>$conf_db_debug,'conf_db_connect'=>$conf_db_connect), array('conf_db_type'=>$conf_db_type,'conf_db_host'=>$conf_dbback_host,'conf_db_user'=>$conf_db_user,'conf_db_password'=>$conf_db_password,'conf_db_name'=>$conf_db_name,'conf_db_charset'=>$conf_db_charset,'conf_db_debug'=>$conf_db_debug,'conf_db_connect'=>$conf_db_connect));

	$db = $dao->db;//数据库主库
	$dbback = $dao->dbback;//数据库从库
}
/*********************************/
define("GROWTH_DIR",WEB_MODULE."/growth/");
if(file_exists(GROWTH_DIR.'base.inc.php')) {
    include_once GROWTH_DIR.'base.inc.php';   
}

?>