lylme_spage/admin/update.php
2023-07-22 22:11:49 +08:00

84 lines
4.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
$title = '检查更新';
include './head.php';
@unlink('log.txt');
$update = update();
?>
<!--页面主要内容-->
<main class="lyear-layout-content">
<div class="container-fluid">
<?php
if(getver($update['version']) > getver($conf['version']) && !empty($update['version']) ) {
echo '<div class="alert alert-info" role="alert">发现新版本:'.$update['version'].'&nbsp;&nbsp;当前版本:</b>'.$conf['version'].'&nbsp;&nbsp;<a href="https://gitee.com/LyLme/lylme_spage/releases" target="_blank" class="alert-link">查看发行版</a></div>
<div class="card"><div class="card-header"><h4>更新说明</h4></div><ul class="list-group">
'.$update['update_log'].'
<li class="list-group-item"><button onclick="update()" class="btn btn-primary">更新</button></li>';
} else if(!empty($update['version'])) {
echo '<div class="alert alert-success" role="alert">当前已是最新版本!&nbsp;&nbsp;<a href="https://gitee.com/LyLme/lylme_spage/releases" target="_blank" class="alert-link">查看发行版</a></div>
<div class="card"><div class="card-header"><h4>版本更新</h4></div><ul class="list-group">
<li class="list-group-item"><b>当前版本:</b>'.$conf['version'].'</li>
<li class="list-group-item"><b>最新版本:</b>'.$update['version'].'</li>';
} else {
echo '<div class="alert alert-danger" role="alert">检查更新失败!</div>
<div class="card"><div class="card-header"><h4>版本更新</h4></div><ul class="list-group">
<li class="list-group-item"><b>当前版本:</b>'.$conf['version'].'</li>
<li class="list-group-item"><b>手动更新:</b>请前往<a href="https://gitee.com/LyLme/lylme_spage/releases" target="_blank" class="alert-link">码云</a>下载最新版本<code>lylme_spage_update.zip</code>后缀的更新包上传到网站根目录解压即可,程序会自动更新数据库</a></li>';
}
?>
</ul></div>
</div>
</main>
</div>
</div>
<?php
include './footer.php';
?>
<script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/layer/3.1.1/layer.min.js" type="application/javascript"></script>
<script type="text/javascript" src="js/lightyear.js"></script>
<script src="js/bootstrap-notify.min.js"></script>
<link href="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery-confirm/3.3.0/jquery-confirm.min.css" type="text/css" rel="stylesheet" />
<script src="https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery-confirm/3.3.0/jquery-confirm.min.js" type="application/javascript"></script>
<script>
function update() {
$.confirm({
title: '更新',
content: '<p><b>注意:更新会替换大部分文件(不会删除原有文件)</b></p><p>若您修改了源码的内容,为防止丢失请先进行备份</p><p>另外不建议通过修改源码的方式来修改内容本程序预留了自定义JS的功能建议通过JS的方式来修改内容欢迎加群讨论获取',
type: 'orange',
buttons: {
omg: {
text: '更新',
btnClass: 'btn-orange',
action: function(){
lightyear.loading('show');
$.ajax({
url:"ajax_link.php?submit=update",
method:"POST",
data:{file:"<?php echo $update['file'] ?>"},
success:function(data){
if(data == 'success'){
lightyear.loading('hide');
lightyear.notify('更新成功!', 'success', 1000);
window.location.replace("./");
return true;
}else{
lightyear.loading('hide');
lightyear.notify(data, 'warning', 2000);
return false;
}
},
error:function(data){
layer.msg('服务器错误');
lightyear.loading('hide');
return false;
}
});
}
},
close: {
text: '取消',
}
}
});
}
</script>