<?php
if(!file_exists('../data/install.lock'))header("location:../../index.php");
require '../public.init.php';
$path = explode('/',$_SERVER['PHP_SELF']);
array_pop($path);
$cookies_path = '/'.join('/',array_filter($path)).'/';
define('ADMIN_COOKIE_PATH',$cookies_path);
@ini_set('session.cookie_path',$cookies_path);
@ini_set("session.cookie_domain",$_SERVER['SERVER_NAME']);
@session_start();
define('TPL_PATH','include/tpl/');
define('MANAGER_ROOT','admin');
define('API_PATH','api/');
if(!defined('IN_ADMINCP'))define('IN_ADMINCP',TRUE);
$sys_dir = SYS_ROOT;
define('UPFILE_PATH','files/upfiles/');
extract($_REQUEST);
// load classes
require(SYS_ROOT. TPL_PATH .'Smarty.class.php');
require SYS_ROOT.'pub/phpwms.CacheLite.php';
$sp_cache = php188StaticCache::getInstance();
require(CLASS_PATH.'cls.sys_public.php');
require(CLASS_PATH.'cls.show_page.php');
$tpl   = new Smarty();
$tpl->load_filter('output','filter_other');
$config  = get_cache('siteBase');
$skin_dir = SYS_ROOT."admin/tpl/";
$cache_dir = SYS_ROOT."cache/admin/";
clearstatcache();
if(!file_exists($cache_dir))mkdirs($cache_dir);
$tpl -> compile_dir  = $cache_dir;
$tpl -> template_dir = $skin_dir;
$tpl -> cache_dir = $cache_dir;
$tpl -> caching = 0;
$tpl -> compile_check = true;
$tpl -> debugging = false;
function smarty_debug_info($item){
	global $tpl,$db;
	$assign = $item['assign'];
	$show_sql = strtolower($item['show_sql']);
	$is_show_sql = $show_sql=='true'?TRUE:FALSE;
	$tpl->assign($assign,get_debug_info());
	if($is_show_sql){
		$log = $db->loadQueryLog();
		!empty($log)?dump($log):'';
	}
}
$tpl->register_function('debug_info','smarty_debug_info');
$sp		 = new SysPublic($config,$db,$tpl);
$PHP_SELF = $_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
$BASESCRIPT = basename($PHP_SELF);
# 兼容保存数据库中的模型
$charset = 'GBK';
header("Content-type:text/html;charset=GBK");
?>