<?php
error_reporting(0);
define("CACHE_FILE",0);
define("IN_CRONLITE",true);
date_default_timezone_set('PRC');
define("SYSTEM_ROOT",dirname(__FILE__)."/");
define("ROOT",dirname(SYSTEM_ROOT)."/");
$date = date('Y-m-d H:i:s');
session_start();
if(defined('SAE_ACCESSKEY')){
	include_once ROOT.'includes/sae.php';
}else{
	include_once ROOT.'config.php';
}
if (!defined('SQLITE') && (!$dbconfig['user'] || !$dbconfig['pwd'] || !$dbconfig['dbname'])) {
	header('Content-type:text/html;charset=utf-8');
	echo '你还没安装！<a href="install/">点此安装</a>';
	exit;
}
$scriptpath = str_replace('\\', '/', $_SERVER['SCRIPT_NAME']);
$sitepath = substr($scriptpath, 0, strrpos($scriptpath, '/'));
$siteurl = ($_SERVER['SERVER_PORT']==443?'https://':'http://') . $_SERVER['HTTP_HOST'].$sitepath.'/';

include_once ROOT.'includes/db.class.php';
$DB = new DB($dbconfig['host'], $dbconfig['user'], $dbconfig['pwd'], $dbconfig['dbname'], $dbconfig['port']);

include_once ROOT."includes/cache.class.php";
$CACHE = new CACHE();
$conf = $CACHE->pre_fetch();

function saveSetting($k,$v){
	global $DB;
	$v = addslashes($v);
	return $DB->query("REPLACE INTO ds_config SET k='$k',v='$v' ");
}