<?php
/*
	应用主框架
*/

//载入依赖库以及配置
require_once dirname(__FILE__)."/include/global.php";
require_once dirname(__FILE__)."/include/cacher.php";

//载入 日历转换 类
require_once("class/lunar.php");

//读取个人配置
if( $_SESSION['Manager']['id'] && VI_DBMANPRE && VI_DBMODPRE ){
	
	//用户自定义
	$config = $_CACHE['system']['admin'][$_SESSION['Manager']['id']]["config"];
	
}

//界面风格
$config['ui-model'] = isset($config['ui-model']) ? $config['ui-model'] : $_G['setting']['global']['model'];

//开启页面压缩
ob_start("compress");

//圣诞节（共5天）
$xmas = ( date("m")==12 && date("d")>20 && date("d")<30 );

?>
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $_G['product']['charset'];?>" />
<title>VeryIDE Bee* <?php echo $_G['product']['version'];?> - <?php echo $_G['setting']['global']['site'];?> - Powered By VeryIDE</title>
<meta name="generator" content="VeryIDE" appname="<?php echo $_G['product']['appname'];?>" version="<?php echo $_G['product']['version'];?>" charset="<?php echo $_G['product']['charset'];?>" build="<?php echo $_G['product']['build'];?>" licence="<?php echo $_G['licence']['type'];?>" />
<meta name="viewport" content="minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0, width=device-width, user-scalable=no">
<?php

//加载基本脚本
$script = array( 'mo','mo.ui','mo.fx','serv' );

for ( $i = 0 ; $i < count($script) ; $i++ ) {
	echo '<script type="text/javascript" charset="utf-8" src="js/'.$script[$i].'.js?ver='.$_G['product']['version'].'"></script>';
}

//用户登录后用到的脚本
if( $_SESSION['Manager']['id'] ){
	$script = array( 'mo.xml','mo.hash','mo.drag','mo.ajax' );	
	for ( $i = 0 ; $i < count($script) ; $i++ ) {
		echo '<script type="text/javascript" charset="utf-8" src="js/'.$script[$i].'.js?ver='.$_G['product']['version'].'"></script>';
	}
}

//界面模式
if( $config['ui-model'] == 'classic' ){	
	echo '<link type="text/css" href="style/classic.css?ver='.$_G['product']['version'].'" rel="stylesheet" />';
	echo loader_script( array('js/serv.classic.js'), 'utf-8', $_G['product']['version'] );
}else{
	echo '<link type="text/css" href="style/serv.css?ver='.$_G['product']['version'].'" rel="stylesheet" />';
	echo '<link type="text/css" id="style" href="theme/'.( $xmas ? 'xmas' : 'default' ).'/style.css?ver='.$_G['product']['version'].'" rel="stylesheet" />';
}
echo '<link type="text/css" href="style/extend.css?ver='.$_G['product']['version'].'" rel="stylesheet" />';

?>
<script type="text/javascript">
	//当前主题
	Mo.store.model	= "<?php echo $config['ui-model'] ? $config['ui-model'] : 'modern';?>";	
	
	//当前主题
	Mo.store.theme	= "<?php echo $_SESSION['Manager']['theme'];?>";
	
	//当前头像
	Mo.store.avatar	= "<?php echo $_SESSION['Manager']['avatar'];?>";

	//当前UID
	Mo.store.aid	= "<?php echo $_SESSION['Manager']['id'];?>";
		
	//当前用户
	Mo.store.account= "<?php echo $_SESSION['Manager']['account'];?>";
		
	//当前版本
	Mo.store.appname= "<?php echo $_G['product']['appname'];?>";
		
	//当前版本
	Mo.store.version= "<?php echo $_G['product']['version'];?>";
		
	//授权类型
	Mo.store.licence= "<?php echo $_G['licence']['type'];?>";
	
	//心跳频率（秒）
	Mo.store.heartbeat= "<?php echo $_G['project']['heartbeat'];?>";
</script>
</head>

<body>

	<?php require( 'dialog/'.( $config['ui-model'] == 'classic' ? 'classic' : 'modern' ).'.index.php' );?>
    
</body>
</html>