<?php
require("session_check.php");
require("proxy/proxy.php");
//语言包引入
$so_softwarelp=new softwarelp;
$er_langpackage=new errorlp;
$u_langpackage=new uilp;
$version_url="../doc/version.txt";
$whole_version=file_get_contents($version_url);
$version=intval(str_replace(".","",$whole_version));
$serv_url=list_substitue("software","&version=".$whole_version);
$show_error='';
$show_data='content_none';
$show_str='';
$ver_str=@file_get_contents($serv_url);
if($ver_str==''){
	$show_str=$so_softwarelp->so_list_false;
}else{
	if(preg_match("/error\_\d/",$ver_str)){
		$show_str=$er_langpackage->{"er_".$ver_str};//代理程序返回错误
	}
	elseif(!preg_match("/<software>.+<\/software>/",$ver_str)){
		$show_str=$so_softwarelp->so_last_version;
	}
	else{
		$xmlDom=new DomDocument;
		$xmlDom->loadXML($ver_str);
		$xmlDom->formatOutput=true;
		preg_match_all("/<version>/",$ver_str,$num_array);
		$version_count=count($num_array[0]);
		$version_nodes=$xmlDom->getElementsByTagName('version');
		$date_nodes=$xmlDom->getElementsByTagName('date');
		$show_error='content_none';
		$show_data='';
	}
}

?>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="css/right.css">
<script type='text/javascript'>
	function download_action(software){
		document.getElementById('action').style.display='';
		document.getElementById('action').style.top=document.body.clientHeight/2-150+"px";
		document.getElementById('action').style.left=document.body.clientWidth/2-150+"px";
		window.location.href="update_software.action.php?version="+software;
	}
</script>
</head>
<body>
<div id='action' style='display:none;' class='ajax_window'>
	<div style='background-color:white;width:220px;height:50px'>
		<div style='margin-left:25px;width:220px'>
			<div style='margin-top:15px;width:220px'><img src='images/loading.gif' style='float:left' />正在编译，请稍等...</div>
		</div>
	</div>
</div>
<div class="container">
	<div class="rs_head"><?php echo $so_softwarelp->so_update_list;?></div>
</div>

<table class="main <?php echo $show_data;?>">
	<tr>
		<th><?php echo $so_softwarelp->so_soft_version;?></th>
		<th><?php echo $so_softwarelp->so_time;?></th>
		<th><?php echo $so_softwarelp->so_ctrl;?></th>
	</tr>
<?php for($num=0;$num < $version_count;$num++){?>
	<tr>
		<td><?php echo $version_nodes->item($num)->nodeValue;?></td>
		<td><?php echo date("Y-m-d h:i:s",$date_nodes->item($num)->nodeValue);?></td>
		<td><a href='javascript:download_action("<?php echo $version_nodes->item($num)->nodeValue;?>");' onClick="return confirm('<?php echo $so_softwarelp->so_ask_update;?>');"><?php echo $so_softwarelp->so_act_update;?></a></td>
	</tr>
<?php }?>
</table>

<table class="main main_left <?php echo $show_error;?>">
	<tr>
		<td><?php echo $show_str;?></td>
	</tr>
</table>

<div class="container">
	<div class="rs_head"><?php echo $so_softwarelp->so_tip_inf?></div>
</div>
<table class="main main_left">
	<tr>
		<td><?php echo str_replace("{version}",$whole_version,$so_softwarelp->so_loction_version);?></td>
	</tr>
	<tr>
		<td><?php echo $so_softwarelp->so_pro_1;?></td>
	</tr>
	<tr>
		<td><?php echo $so_softwarelp->so_pro_2;?></td>
	</tr>
	<tr>
		<td><?php echo $so_softwarelp->so_pro_3;?></td>
	</tr>
</table>

</body>
</html>