<?php
// +---------------------------------------------+
// |     Copyright 2006 - 2009 weenCompany       |
// |     http://www.weentech.com                 |
// |     This file may not be redistributed.     |
// +---------------------------------------------+

define('MOD_ACCESS', true);
define('IN_ADMIN', true);
define('IN_WEENCOMPANY', true);

$rootpath = "./../";

include($rootpath . 'includes/core.php');

PrintHeader('管理面板首页');

// Should we check for updates?
$updates = $DB->query_first("SELECT value FROM " . TABLE_PREFIX . "mainsettings WHERE  varname = 'checkforupdates'");

$getversion = $DB->query_first("SELECT value FROM " . TABLE_PREFIX . "mainsettings WHERE  varname = 'sdversion'");
$version    = $getversion['value'];  


PrintSection("欢迎 ".$userinfo['username']." 进入后台管理!");

echo '<table width="100%" height="175" bgcolor="#FCFCFC" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="8" background="'.$stylepath.'images/section/td1_top.gif"></td>
      </tr>
      <tr>
        <td valign="top" height="350" style="padding-left: 28px; padding-top: 18px;">
          欢迎 <font class=ohblue><u>'.$userinfo['username'].'</u></font> 进入后台管理面板! 为了确保系统安全, 请在关闭前点击 <a href="index.php?logout=1" target="_parent" onclick="return confirm(\'确定退出weenCompany闻名企业网站系统吗?\');"><font class=ohred><u>退出</u></font></a> 安全离开!<br /><br />
          您在使用weenCompany闻名企业网站系统(CWS)过程中有任何问题, 请联系: <a href="http://www.weentech.com" target="_blank"><font class=weentech><u>闻泰网络</u></font></a>!<br /><br /><br />

          weenCompany升级提示:<br /><br />
      <table>
	  <tr>
		<td width="150" style="padding-left: 36px;"><b>程序名称</b></td>
		<td width="150" align="center" style="padding-right: 10px;"><b>您现在的版本</b></td>
		<td width="150" align="center" style="padding-right: 10px;"><b>最新版本</b></td>
	  </tr>
	  <tr>
		<td style="padding-right: 10px;">weenCompany CWS</td>
		<td align="center" style="padding-right: 10px;">' . $version . '(GB2312)免费版</td>
		<td align="center" style="padding-right: 10px;"><span id="weencompany_latest_versioninfo"></span></td>
	  </tr></table>
	  <div id="weencompany_latest_moreinfo"></div>';

	if($updates[0] <> '1')
	{
		echo '<script type="text/javascript">document.getElementById("weencompany_latest_versioninfo").innerHTML = "<font class=oh_red>未开启检测!</font>";</script>';
	}
	else
	{
	  echo '<script language="javascript" type="text/javascript" src="http://www.weentech.com/cws_version/cws_versioninfo.js?temp='.rand().'"></script>
			<script type="text/javascript">
			if(typeof(v) == "undefined"){
				document.getElementById("weencompany_latest_versioninfo").innerHTML = "<font class=oh_red>无法连接!</font>";
			}else{
				var weencompany_old_version = parseInt("' . $version . '".replace(/\./g,""));
				var weencompany_latest_version = parseInt(v.replace(/\./g,""));
				
				if(weencompany_old_version < weencompany_latest_version ){
					document.getElementById("weencompany_latest_versioninfo").innerHTML = "<font class=oh_red>"+v+"</font>";
					document.getElementById("weencompany_latest_moreinfo").innerHTML = "<br><br>请登录 <a href=\"http://www.weentech.com/bbs\" target=\"_blank\">闻泰网络 weentech.com</a> 下载升级!";
				}else{
					document.getElementById("weencompany_latest_versioninfo").innerHTML = "<font class=ohgreen>暂无更新!</font>";
				}
			
			}
			</script>';
	  
	}

echo '  </td>
      </tr>
      <tr><td height="6" background="'.$stylepath.'images/section/td1_bottom.gif"></td></tr>
      </table>';

EndSection();

PrintFooter();

?>