<?php
/*
页面：加载系统统运行必备文件
*/
/*
error_reporting(0);//禁用错误报告
error_reporting(E_ERROR | E_WARNING | E_PARSE);//报告运行时错误
error_reporting(E_ALL);//报告所有错误
*/
require WEB_ROOT.'/'.DATA_DIR.'/config.inc.php';
if(EVN_TEST=="0"){
	error_reporting(0);//禁用错误报告
}else{
	error_reporting(E_ALL);//报告所有错误
}
//初始化系统环境
define('SYS_ROOT',dirname(__FILE__));
define('IN_KLKKDJ', '1');
define('TIME', time());
//设置系统时间
if(@date_default_timezone_get() != "Asia/Shanghai") date_default_timezone_set("Asia/Shanghai"); 
//加载系统函数,及类库
if(isset($_REQUEST["isajax"])){
	header("Cache-Control: no-cache, must-revalidate");
	header('Content-Type:text/html;charset='.DB_CHARSET);
}

require SYS_ROOT.'/fun/fun.common.php';//常用函数
require SYS_ROOT.'/fun/fun.file.php';//文件操作函数
require SYS_ROOT.'/cls/cls.msg.php';//系统消息类
require SYS_ROOT.'/cls/cls.mysql.php';//数据库类
require SYS_ROOT.'/cls_tab/base.table.php';//数据库类
//站点初始运行库
require SYS_ROOT.'/fun/fun.website.php';//数据库类
define('MAGIC_QUOTES_GPC', get_magic_quotes_gpc());
//系统类自动加载函数
function __autoload($msg_cls){
	$str_ext=substr($msg_cls,0,7);
	$str_name=str_replace("_",".",$msg_cls).".php";
	switch($str_ext){
		case "cls_tab":
			require SYS_ROOT."/cls_tab/".substr($str_name,4);
			break;
		case "cls_ctl":
			require SYS_ROOT."/cls_ctl/".substr($str_name,4);
			break;
		default:
			require SYS_ROOT."/cls/".$str_name;
	}
}
//定义系统变量
$web_url=WEB_URL;
$web_domain=WEB_DOMAIN;
$web_time=TIME;
$obj_db = new cls_sql;
$arr_connect = $obj_db->connect(DB_HOST, DB_USER, DB_PWD, DB_NAME, 0, DB_CHARSET);
if($arr_connect["err"]!=""){
	echo $arr_connect["err"];
	exit;
}
$obj_msg=new cls_msg;
$web_filename=basename($_SERVER["SCRIPT_FILENAME"]);
$web_script_url=WEB_SCRIPT_URL;
if($_REQUEST)
{
	if(MAGIC_QUOTES_GPC)
	{
		$_REQUEST = new_stripslashes($_REQUEST);
		$_REQUEST = new_stripslashes($_REQUEST);
		$_POST = new_stripslashes($_POST);
		$_GET = new_stripslashes($_GET);
		if($_COOKIE) $_COOKIE = new_stripslashes($_COOKIE);
	}
	foreach($_POST as $key => $val)
	{
		if(!preg_match("/^[a-zA-z][a-zA-z0-9_]{0,20}$/i", $key)) continue;
		$x="get_".$key;
		$$x=format_request($val);
	}
	foreach($_GET as $key => $val)
	{
		if(!preg_match("/^[a-zA-z][a-zA-z0-9_]{0,20}$/i", $key)) continue;
		$x="get_".$key;
		$$x=format_request($val);
	}
}
if(defined("SYS_OPEN_FZ") && SYS_OPEN_FZ=="1")	include_once WEB_ROOT."/data/config.fz.php";
require WEB_ROOT.WEB_CTL_USER;
$obj_ctl_user=new cls_ctl_user;
$obj_tab_sys_config=new cls_tab_sys_config;
?>