mirror of
https://github.com/tznb1/TwoNav.git
synced 2025-08-10 08:51:49 +00:00
v2.1.14-20240416
This commit is contained in:
@@ -27,6 +27,13 @@ if($config['switch'] === 1){
|
||||
exit;
|
||||
}
|
||||
|
||||
$layui_dir = "../static/Layui";
|
||||
foreach(scandir($layui_dir) as $value) {
|
||||
if(is_dir($layui_dir . '/' . $value) && preg_match('/^v\d+\.\d+\.\d+$/', $value) && is_file("{$layui_dir}/$value/layui.js")) {
|
||||
$layui['js'] = "../static/Layui/{$value}/layui.js";
|
||||
$layui['css'] = "../static/Layui/{$value}/css/layui.css";
|
||||
}
|
||||
}
|
||||
session_name('ATool_SSID');
|
||||
session_start();
|
||||
|
||||
@@ -228,7 +235,7 @@ function echo_Atool(){
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>ATool 工具箱</title>
|
||||
<link rel="stylesheet" href="../static/Layui/v2.9.8/css/layui.css">
|
||||
<link rel="stylesheet" href="<?php echo $GLOBALS['layui']['css']; ?>">
|
||||
<style>
|
||||
html, body {min-width: 1200px;background-color: #fff;position: relative;}
|
||||
.page-wrapper {width: 1200px;margin: 0 auto;padding: 0 15px;}
|
||||
@@ -280,7 +287,7 @@ function echo_Atool(){
|
||||
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="del_otp" title="移除OTP登录验证">删OTP</a>
|
||||
</div>
|
||||
</script>
|
||||
<script src="../static/Layui/v2.9.8/layui.js"></script>
|
||||
<script src="<?php echo $GLOBALS['layui']['js']; ?>"></script>
|
||||
<script src="../static/jquery/jquery-3.6.0.min.js"></script>
|
||||
<script src="../static/jquery/jquery.md5.js"></script>
|
||||
<script src="../templates/admin/js/public.js?v=<?php echo time();?>"></script>
|
||||
@@ -417,7 +424,7 @@ function echo_verify(){ ?>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>ATool 工具箱</title>
|
||||
<link rel="stylesheet" href="../static/Layui/v2.9.8/css/layui.css">
|
||||
<link rel="stylesheet" href="<?php echo $GLOBALS['layui']['css']; ?>">
|
||||
<link rel="stylesheet" href="../static/Other/login.css">
|
||||
</head>
|
||||
<body>
|
||||
@@ -440,9 +447,9 @@ function echo_verify(){ ?>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>$G
|
||||
<script src = "../static/jquery/jquery-3.6.0.min.js"></script>
|
||||
<script src = "../static/Layui/v2.9.8/layui.js"></script>
|
||||
<script src = "<?php echo $GLOBALS['layui']['js']; ?>"></script>
|
||||
<script src = '../static/jquery/jquery.md5.js'></script>
|
||||
<script>
|
||||
layui.use(['form','jquery'], function () {
|
||||
|
||||
@@ -152,8 +152,6 @@ function other_upsys(){
|
||||
//查找数据库是否已安装更新
|
||||
if(empty(get_db('updatadb_logs','*',['file_name'=>$file_name]))){
|
||||
require $filePath; //载入升级脚本
|
||||
//脚本规范:头部判断是否有DIR常量来避免被直接访问,中间执行升级脚本!底部将执行记录写入数据库!
|
||||
//insert_db('updatadb_logs',['file_name'=>$file_name,'update_time'=>time(),'status'=>'TRUE','extra'=>'']);
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
@@ -163,7 +161,6 @@ function other_upsys(){
|
||||
$updatadb_logs = select_db('updatadb_logs','file_name',['file_name[!]'=>'install.sql']);
|
||||
$msg .= "当前版本:" . SysVer . "\n";
|
||||
$msg .= "数据储存:{$GLOBALS['db_config']['type']}\n";
|
||||
//$msg .= "脚本列表:".(empty($file_list)?'无': "\n".implode("\n",$file_list))."\n" ;
|
||||
$msg .= "更新记录:".(empty($updatadb_logs)?'无':"\n".implode("\n",$updatadb_logs))."\n";
|
||||
msg(1,$msg);
|
||||
}else{
|
||||
@@ -347,10 +344,7 @@ function write_sys_settings(){
|
||||
if(!empty($_POST['copyright'])){$o_config['copyright'] = "";$filter = true;}
|
||||
if(!empty($_POST['global_header'])){$o_config['global_header'] = "";$filter = true;}
|
||||
if(!empty($_POST['global_footer'])){$o_config['global_footer'] = "";$filter = true;}
|
||||
if($_POST['apply'] == 1){$o_config['apply'] = 0;$filter = true;}
|
||||
if($_POST['guestbook'] == 1){$o_config['guestbook'] = 0;$filter = true;}
|
||||
if($_POST['link_extend'] == 1){$o_config['link_extend'] = 0;$filter = true;}
|
||||
if($_POST['article'] == 1){$o_config['article'] = 0;$filter = true;}
|
||||
if($_POST['static_link'] == 1){$o_config['static_link'] = 0;$filter = true;}
|
||||
}
|
||||
update_db("global_config", ["v" => $o_config], ["k" => "o_config"],[1,($filter ?"保存成功,未检测到有效授权,带*号的配置无法为你保存":"保存成功")]);
|
||||
|
||||
@@ -4,24 +4,27 @@ if(!defined('DIR')){header('HTTP/1.1 404 Not Found');header("status: 404 Not Fou
|
||||
//初始化
|
||||
session_name('TwoNav_initial');
|
||||
session_start();
|
||||
$layui['js'] = './static/Layui/v2.9.8/layui.js';
|
||||
$layui['css'] = './static/Layui/v2.9.8/css/layui.css';
|
||||
$layui_dir = "./static/Layui";
|
||||
foreach(scandir($layui_dir) as $value) {
|
||||
if(is_dir($layui_dir . '/' . $value) && preg_match('/^v\d+\.\d+\.\d+$/', $value) && is_file("{$layui_dir}/$value/layui.js")) {
|
||||
$layui['js'] = "./static/Layui/{$value}/layui.js";
|
||||
$layui['css'] = "./static/Layui/{$value}/css/layui.css";
|
||||
}
|
||||
}
|
||||
|
||||
//判断请求类型
|
||||
if($_SERVER['REQUEST_METHOD'] === 'POST'){
|
||||
if(empty($_SESSION['initial'])){ msg(-1,'当前环境无法满足程序运行条件!'); }
|
||||
define('Debug',TRUE);
|
||||
$db = null;
|
||||
$USER_DB =null;
|
||||
$USER_DB = null;
|
||||
require DIR.'/system/public.php';
|
||||
install();
|
||||
}else{
|
||||
clearstatcache();//清除缓存
|
||||
check_env();
|
||||
$libs = './static'; //使用本地静态库
|
||||
}
|
||||
|
||||
|
||||
// 环境检查
|
||||
function check_env() {
|
||||
if(!empty($_GET['diagnosis'])){
|
||||
@@ -57,7 +60,7 @@ function diagnosis() {
|
||||
|
||||
//检查PHP版本,需要大于5.6小于8.0
|
||||
$php_version = floatval(PHP_VERSION);
|
||||
$log .= "PHP版本:{$php_version}<br />";
|
||||
$log .= "PHP版本:{$php_version} <a href='./?phpinfo=1' style='text-decoration: none;'> 显示phpinfo</a> <br />";
|
||||
$log .= "Web版本:{$_SERVER['SERVER_SOFTWARE']}<br />";
|
||||
if( $php_version < 7.3) {
|
||||
$log .= "PHP版本:不满足要求,要求不低于7.3<br />";
|
||||
@@ -267,7 +270,7 @@ function Write_Config(){
|
||||
$s_site['title'] = '我的书签'; //站点标题
|
||||
$s_site['subtitle'] = 'TwoNav'; //副标题
|
||||
$s_site['logo'] = '我的书签'; //站点logo
|
||||
$s_site['keywords'] = 'TwoNav,开源导航,开源书签,简洁导航,云链接,个人导航,个人书签,扩展,多用户,落幕'; //关键字
|
||||
$s_site['keywords'] = 'TwoNav,开源导航,开源书签,简洁导航,网址导航,云链接,个人导航,个人书签'; //关键字
|
||||
$s_site['description'] = 'TwoNav 是一款使用PHP + SQLite3/MySQL 开发的简约导航/书签管理器。'; //描述
|
||||
$s_site['link_model'] = '302'; //链接模式
|
||||
$s_site['link_icon'] = '0'; //链接图标
|
||||
@@ -458,15 +461,17 @@ function Write_Config(){
|
||||
</div>
|
||||
</div>
|
||||
<!--MySQL/MariaDB 配置 End-->
|
||||
<div class="layui-form-mid layui-word-aux">安装方式:全新安装      </div>
|
||||
<div class="layui-form-mid layui-word-aux">推荐配置:Nginx-1.20 + PHP-8.1 </div>
|
||||
<button class="layui-btn" lay-submit lay-filter="register" style = "width:100%;">开始安装</button>
|
||||
<div class="layui-form-mid layui-word-aux" style="width: 99%;">
|
||||
<span>推荐环境:Nginx & PHP8+ </span>
|
||||
<a href="./?diagnosis=1" style="float: right;color: #fff;" target="_blank">info</a>
|
||||
</div>
|
||||
<button class="layui-btn" lay-submit lay-filter="install" style = "width:100%;">开始安装</button>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src = '<?php echo $libs?>/jquery/jquery-3.6.0.min.js'></script>
|
||||
<script src = './static/jquery/jquery-3.6.0.min.js'></script>
|
||||
<script src = '<?php echo $layui['js']; ?>'></script>
|
||||
<script>
|
||||
|
||||
@@ -478,7 +483,7 @@ set_db_type(db_type);
|
||||
|
||||
layui.use(['form'], function(){
|
||||
var form = layui.form;
|
||||
|
||||
var install = 0;
|
||||
//伪静态检测
|
||||
var request = new XMLHttpRequest();
|
||||
request.open('GET', './static/Other/login.css?t=' + new Date().getTime(), true);
|
||||
@@ -499,7 +504,7 @@ layui.use(['form'], function(){
|
||||
|
||||
|
||||
//开始安装
|
||||
form.on('submit(register)', function(data){
|
||||
form.on('submit(install)', function(data){
|
||||
var d = data.field;
|
||||
if(!/^[A-Za-z0-9]{3,13}$/.test(d.User)){
|
||||
layer.msg('账号只能是3到13位的数字和字母!', {icon: 5});
|
||||
@@ -516,20 +521,40 @@ layui.use(['form'], function(){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//防止重复安装
|
||||
if(install > 0){
|
||||
return false;
|
||||
}
|
||||
//安装标记和动态效果
|
||||
install = 1;
|
||||
layer.load(1, {shade:[0.5,'#fff']});
|
||||
layer.msg('正在安装中..', {icon: 16,time: 1000*300});
|
||||
setTimeout(function() {
|
||||
if(install == 1){
|
||||
layer.msg('如果页面长时间无响应,请检查您的运行环境和网络,然后尝试刷新页面再次操作...', {icon: 16,time: 1000*300});
|
||||
}
|
||||
}, 6000);
|
||||
$.post('./index.php?c=install',d,function(Re,status){
|
||||
if(Re.code == 1){
|
||||
install = 2;
|
||||
layer.closeLast('loading');
|
||||
open_msg(d.User,d.Password);
|
||||
}else if(Re.code == -2){ //强制安装
|
||||
layer.confirm(Re.msg,{icon: 3, title:'确定继续 ?'}, function(index){
|
||||
$.post('./index.php?c=install&f=yes',d,function(Re,status){
|
||||
layer.closeLast('loading');
|
||||
if(Re.code == 1){
|
||||
install = 2;
|
||||
open_msg(d.User,d.Password);
|
||||
}else{
|
||||
install = 0;
|
||||
layer.msg(Re.msg, {icon: 5,time: 60*1000});
|
||||
}
|
||||
});
|
||||
});
|
||||
}else{
|
||||
install = 0;
|
||||
layer.closeLast('loading');
|
||||
layer.msg(Re.msg, {icon: 5,time: 60*1000});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1 +1 @@
|
||||
v2.1.14-20240414
|
||||
v2.1.14-20240416
|
||||
Reference in New Issue
Block a user