<?php
error_reporting(E_ERROR);
if(phpversion() < '5.3.0') {
	set_magic_quotes_runtime(0);
}

define('DJ_ROOT', substr(dirname(__FILE__), 0, -3));
define('MAGIC_QUOTES_GPC', function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc());
define('IN_DJCMS', TRUE);
define('TIMESTAMP', time());
timezone_set();
@include DJ_ROOT.'./inc/config.php';
if(!defined('DJ_FUNCTION') && !@include(DJ_ROOT.'./inc/CommonFun.php')) {
	exit('CommonFun.php is missing');
}
if(function_exists('ini_get')) {
	$memorylimit = @ini_get('memory_limit');
	if($memorylimit && return_bytes($memorylimit) < 33554432 && function_exists('ini_set')) {
		ini_set('memory_limit', '128m');
	}
}

define('QUERY_STRING', safe_replace($_SERVER['QUERY_STRING']));
define("DJCMS_TEMPLATE", DJ_ROOT."template/".defaultTemplate."/".templateFileFolder."/");

header('Content-type: text/html; charset=gb2312');

if(!MAGIC_QUOTES_GPC) {
	$_GET = new_addslashes($_GET);
	$_POST = new_addslashes($_POST);
	$_COOKIE = new_addslashes($_COOKIE);
	//$_FILES = new_addslashes($_FILES);
}

//引入数据库类
include DJ_ROOT.'./inc/Mysql.php';
$db = & DB::object();
$db->connect(databaseServer, databaseUser, databasePwd, 'gbk', databaseName, 0);
//引入标签解释类
include DJ_ROOT.'./inc/MainClass.php';
//引入语言包
include DJ_ROOT.'./inc/lang.php';
//引入汉字换拼音包
include DJ_ROOT.'./inc/iconv.php';

function timezone_set($timeoffset = 8) {
	if(function_exists('date_default_timezone_set')) {
		@date_default_timezone_set('Etc/GMT'.($timeoffset > 0 ? '-' : '+').(abs($timeoffset)));
	}
}
?>