{include file="head.html"}
<div id="maincontent">
  <div class="wrap">
    <div class="crumbs"> <a href="__APP__/index/home">{lang='系统设置'}</a> <a href="#">{lang='程序升级'}</a> </div>
    <hr />
    <div class="tip">{lang='如果无法通过自动更新请下载离线更新包手动更新！'}</div>
    <div class="infobox">
        <h3>{lang='程序升级'}</h3>
        <table class="form-table table_style">
          <tr>
          <td width="15%" align="left"><strong>{lang='本地版本'}</strong></td>
          <td width="35%" align="left">&nbsp;</td>
          <td width="15%" align="left"><strong>{lang='更新版本'}</strong></td>
          <td align="left">&nbsp;</td>
        </tr>
        <tr>
          <td width="15%" align="left">{lang='程序名称'}：</td>
          <td align="left"><?php echo $sys['ver_name'] ?></td>
          <td align="left">{lang='程序名称'}：</td>
          <td align="left"><?php echo $ver['ver_name'] ?></td>
        </tr>
        <tr>
          <td width="15%" align="left">{lang='可更新版本'}：</td>
          <td align="left"><?php echo $sys['ver'] ?></td>
          <td align="left">{lang='当前版本'}：</td>
          <td align="left"><?php echo $ver['ver'] ?></td>
        </tr>
        <tr>
          <td width="15%" align="left">{lang='程序发布时间'}：</td>
          <td align="left"><?php echo $sys['ver_date'] ?></td>
          <td align="left">{lang='程序发布时间'}：</td>
          <td align="left"><?php echo $ver['ver_date'] ?></td>
        </tr>
        <tr>
          <td align="left">&nbsp;</td>
          <td align="left">&nbsp;</td>
          <td align="left">{lang='补丁名称'}：</td>
          <td align="left"><?php echo $ver['patch_name'] ?></td>
        </tr>
        <tr>
          <td align="left">&nbsp;</td>
          <td align="left">&nbsp;</td>
          <td align="left">{lang='手动补丁地址'}：</td>
          <td align="left"><?php echo $ver['patch_admin'] ?></td>
        </tr>
        <tr>
          <td align="left">&nbsp;</td>
          <td align="left">&nbsp;</td>
          <td align="left">{lang='手动后台补丁地址'}：</td>
          <td align="left"><?php echo $ver['patch'] ?></td>
        </tr>
        <tr>
          <td align="left">&nbsp;</td>
          <td align="left">&nbsp;</td>
          <td align="left">{lang='可更新版本'}：</td>
          <td align="left"><?php echo $ver['patch_ver'] ?></td>
        </tr>
        <tr>
          <td align="left">&nbsp;</td>
          <td align="left">&nbsp;</td>
          <td align="left">{lang='补丁说明'}：</td>
          <td align="left"><?php echo $ver['low_ver'] ?></td>
        </tr>
        </table>
      </div>
      <div class="submit_body">     
        <?php if($sys['ver_date']<$ver['ver_date']){  ?>
        <button class="regular-button" onclick="update()" >{lang='在线更新'}</button>
        <?php }else{ ?>
        <button class="regular-button" >{lang='暂无更新'}</button>
    <?php } ?>
     </div>
  </div>
</div>
<script>
function update() {
parent.asyncbox.warning("<?php echo module('common')->getlang('确认要升级吗？') ?>","<?php echo module('common')->getlang('询问') ?>",function(action){
if(action == 'yes'){　　
var post_data= {
	patch: "<?php echo $ver['patch'] ?>",
	patch_admin: "<?php echo $ver['patch_admin'] ?>",
	patch_name: "<?php echo $ver['patch_name'] ?>"
}
$.ajax({
  type: 'POST',
  url: "__URL__/update",
  data:post_data,
  dataType: "json",
  success: function(json) {
	if(json.result==1){//成功
	asyncbox.success("<?php echo module('common')->getlang('网站文件更新成功!点击确认更新数据库！') ?>","<?php echo module('common')->getlang('更新成功') ?>",function(action){
	if(action == 'ok'){
	window.location.href = "__APP__/updb";
	}
　  });
	}else{
	asyncbox.error(json.msg,"<?php echo module('common')->getlang('更新失败') ?>");
	}
	
  }
})

　}
})

};
</script>
</body></html>