<?php
if(version_compare(PHP_VERSION,'5.2.0','<'))  die('程序运行需要PHP版本 >5.2.0 !');
header('X-Powered-By: duotaopu.com');
date_default_timezone_set ('PRC');
header("Content-type: text/html; charset=gbk");
define('APP_NAME','DuoTaoPu');
//定义路径常量
define('VIVI_CORE', str_replace("\\", '/', dirname(__FILE__) ) );
define('VIVI_ROOT', substr(VIVI_CORE,0,-5));
define('VIVI_DATA',VIVI_ROOT."/data");
define('VIVI_PUBLIC',VIVI_ROOT."/public");
define('VIVI_UPLOADS',VIVI_ROOT."/uploads");
define('VIVI_TMPL',VIVI_ROOT."/template");
define('VIVI_SMARTY',VIVI_CORE."/smarty");
define('VIVI_CONFIGS',VIVI_DATA."/configs");
define('VIVI_CACHE',VIVI_DATA."/cache");
define('VIVI_TMPLCACHE',VIVI_CACHE."/compile");
define('VIVI_ERRORJUMP_FILE',VIVI_PUBLIC."/msg/errorjump.php");
define('VIVI_DB_PATH',VIVI_DATA."/mydb");
define('ROBOT_FILE',VIVI_CACHE.'/robots.log');
define('VIVI_SMARTY_PLUGINS',VIVI_CORE."/plugins");
session_save_path(VIVI_CACHE.'/session');
session_set_cookie_params(24 * 3600);
if(!is_file(VIVI_CONFIGS.'/config.php')){
    echo '没找到配置文件 data/configs/config.php，请重新安装程序！';
    exit();
}
//iis7 REQUEST_URI
if(isset($_SERVER['HTTP_X_ORIGINAL_URL'])){
	$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL'];
}
//iis6 REQUEST_URI
else if(isset($_SERVER['HTTP_X_REWRITE_URL'])) {
	$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];
}
$list=array(
	VIVI_CORE.'/define.php',
	VIVI_CORE.'/function.php',
	VIVI_CORE.'/duotaopu.class.php',
	VIVI_CORE.'/robot.class.php',
	VIVI_CORE.'/collect.class.php',
);
//加载系统基础库
foreach ($list as $key=>$file){
	require $file;
}
define('START_TIME',debug_time());
define('START_MEMORY',memory_get_usage());
//实例化核心类
$duotaopu=new duotaopu;
C($duotaopu->require_load(VIVI_CONFIGS.'/config.php'));
//获取web_path
$temp_url=parse_url(C('web_url'));
define('WEB_ROOT',substr($temp_url['path'],0,-1));
define('VIVI_DEBUG',C('web_debug'));
define('RE_SUFFIX','.'.C('rewrite_suffix'));
if(VIVI_DEBUG){
	error_reporting(E_ALL & ~E_NOTICE);
}else{
	error_reporting(0);
}