<?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 . '(UTF-8)免費版</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();

?>
