v2.0.16-20230425

This commit is contained in:
MI15\Win
2023-04-25 17:14:13 +08:00
parent ccae67f236
commit 3522373de3
35 changed files with 781 additions and 75 deletions

View File

@@ -38,7 +38,7 @@ define('libs',$global_config['Libs']);
define('SysVer',Get_Version());
define('Debug',$global_config['Debug'] == 1);
if($c !== $global_config["Register"]){
if($c != $global_config["Register"]){
$u = Get('u');
if(empty($u) && $global_config['Sub_domain'] == 1 && is_subscribe('bool')){
$cut = explode('.',$_SERVER["HTTP_HOST"]);

View File

@@ -21,8 +21,8 @@ if($_GET['type'] == 'create' ){
msg(-1,'导出失败');
}
}
$_SESSION['download'][$key] = $tempnam;
msgA(['code'=>1,'msg'=>'success','key'=>$key,'name'=>$tempnam]);
$_SESSION['download']["$key"] = $tempnam;
msgA(['code'=>1,'msg'=>'success','key'=>$key]);
}else{
msg(-1,'密码错误');
}
@@ -30,7 +30,7 @@ if($_GET['type'] == 'create' ){
//验证Key
if(!is_file($_SESSION['download'][$_GET['key']])){
exit("Key错误,请在后台重新导出!");
exit("Key错误,请在后台重新导出!".$_SESSION['download']["{$_GET['key']}"]);
}else{
if($_GET['type'] == 'html' ){
header("Cache-Control: public");
@@ -59,7 +59,8 @@ if(!is_file($_SESSION['download'][$_GET['key']])){
//生成数据
function create_data(){
if($_POST['type'] == 'html' ){
$tempnam = tempnam(null,'export_html_');
$key = md5(uniqid().Get_Rand_Str(8));
$tempnam = DIR ."/data/temp/export_html_{$key}.html";
$file = fopen($tempnam, "w") or msg(-1,'载入临时文件失败');
fwrite($file,base64_decode("PCFET0NUWVBFIE5FVFNDQVBFLUJvb2ttYXJrLWZpbGUtMT4NCjwhLS0gVGhpcyBpcyBhbiBhdXRvbWF0aWNhbGx5IGdlbmVyYXRlZCBmaWxlLg0KICAgICBJdCB3aWxsIGJlIHJlYWQgYW5kIG92ZXJ3cml0dGVuLg0KICAgICBETyBOT1QgRURJVCEgLS0+DQo8TUVUQSBIVFRQLUVRVUlWPSJDb250ZW50LVR5cGUiIENPTlRFTlQ9InRleHQvaHRtbDsgY2hhcnNldD1VVEYtOCI+DQo8VElUTEU+T25lTmF2IEV4dGVuZCBCb29rbWFya3M8L1RJVExFPg0KPEgxPk9uZU5hdiBFeHRlbmQgQm9va21hcmtzPC9IMT4NCjxETD48cD4NCg=="));
fwrite($file,' <DT><H3 ADD_DATE="1677783783" LAST_MODIFIED="1677783783" PERSONAL_TOOLBAR_FOLDER="true">书签栏</H3>'."\n");
@@ -94,7 +95,8 @@ function create_data(){
}
if($_POST['type'] == 'db3'){
$tempnam = tempnam(null,'export_db3_');
$key = md5(uniqid().Get_Rand_Str(8));
$tempnam = DIR ."/data/temp/export_db3_{$key}.db3";
try { //初始化数据库
class MyDB extends SQLite3 {function __construct() {} }
$MyDB = new MyDB();

View File

@@ -68,7 +68,7 @@ if($page == 'config_home'){
$theme_config = empty($theme_config['config']) ? []:$theme_config['config'];
//读取用户主题配置
if(!in_array($_GET['fn'],['home','login','register','transit'])){
if(!in_array($_GET['fn'],['home','login','register','transit','guide'])){
msg(-1,"参数错误");
}
$theme_config_db = get_db('user_config','v',['t'=>'theme_'.$_GET['fn'],'k'=>$theme,'uid'=>UID]);
@@ -79,7 +79,7 @@ if($page == 'config_home'){
$theme_config = array_merge ($theme_config,$theme_config_db);
}
//配置为空
if(empty($theme_config)){
if(empty($theme_config) || !check_purview('theme_in',1) || !check_purview('theme_set',1)){
exit("<h3>获取主题配置失败</h3>");
}
require $config_path;
@@ -87,7 +87,11 @@ if($page == 'config_home'){
}
//主题设置页面
if( $page == 'theme_home' || $page == 'theme_login' || $page == 'theme_transit' || $page == 'theme_register') {
if( $page == 'theme_home' || $page == 'theme_login' || $page == 'theme_transit' || $page == 'theme_register' || $page == 'theme_guide') {
if(!check_purview('theme_in',1)){
require(DIR.'/templates/admin/page/404.php');
exit;
}
$fn = str_replace('theme_','',$page);
$dirs = get_dir_list(DIR.'/templates/'.$fn);

View File

@@ -1104,7 +1104,7 @@ function other_testing_link(){
//主题下载/更新/删除
function write_theme(){
global $global_config;
$fn = $_POST['fn'];if($_GET['type'] != 'config' && !in_array($fn,['home','login','transit','register'])){msg(-1,'fn参数错误');}
$fn = $_POST['fn'];if($_GET['type'] != 'config' && !in_array($fn,['home','login','transit','register','guide'])){msg(-1,'fn参数错误');}
if($_GET['type'] == 'download'){
is_root();
if($global_config['offline']){msg(-1,"离线模式禁止下载主题!");} //离线模式
@@ -1191,13 +1191,16 @@ function write_theme(){
$type = $_POST['type'];
$name = $_POST['name'];
//如果是注册模板则必须是root权限
if($fn == 'register'){is_root();}
if($fn == 'register' || $fn == 'guide'){is_root();}
//相关检测
if ( !preg_match("/^[a-zA-Z0-9_-]{1,64}$/",$name) ) {
msg(-1,"主题名称不合法!");
}elseif(!is_dir(DIR."/templates/$fn/".$name)){
msg(-1,'主题不存在');
}elseif(!check_purview('theme_in',1)){
msg(-1,'无权限');
}
//读取用户模板配置
require DIR."/system/templates.php";
//判断设置的类型
@@ -1219,6 +1222,9 @@ function write_theme(){
}elseif($fn == 'register'){
$global_templates['register'] = $name;
update_db('global_config',['v'=>$global_templates],['k'=>'s_templates'],[1,'注册模板设置成功']);
}elseif($fn == 'guide'){
$global_templates['guide'] = $name;
update_db('global_config',['v'=>$global_templates],['k'=>'s_templates'],[1,'引导页模板设置成功']);
}
//更新数据
update_db('user_config',['v'=>$s_templates],['uid'=>UID,'k'=>'s_templates'],[1,'设置成功']);
@@ -1237,7 +1243,7 @@ function write_theme(){
msg(-1,"获取模板类型错误");
}
$fn = empty($GET['fn']) ? $_GET['template_type'] : $GET['fn'];
if(!in_array($fn,['home','login','register','transit'])){
if(!in_array($fn,['home','login','register','transit','guide'])){
msg(-1,"参数错误");
}
//0420 END

View File

@@ -500,6 +500,7 @@ function write_sys_settings(){
'Maintenance'=>['int'=>true,'min'=>0,'max'=>1,'msg'=>'维护模式参数错误'],
'Sub_domain'=>['int'=>true,'min'=>0,'max'=>1,'msg'=>'二级域名参数错误'],
'Privacy'=>['int'=>true,'min'=>0,'max'=>1,'msg'=>'强制私有参数错误'],
'default_page'=>['int'=>true,'min'=>0,'max'=>2,'msg'=>'默认页面参数错误'],
'copyright'=>['empty'=>true],
'global_header'=>['empty'=>true],
'global_footer'=>['empty'=>true],

View File

@@ -5,7 +5,7 @@ define('is_login',is_login());
//判断用户组,是否允许未登录时访问主页
if(!is_login && ($global_config['Privacy'] == 1 || !check_purview('Common_home',1))){
header("HTTP/1.1 302 Moved Permanently");
header("Location: ./?c=admin");
header("Location: ./?c=admin&u=".U);
exit;
}
//载入站点设置
@@ -15,11 +15,32 @@ $site['Title'] = $site['title'].(empty($site['subtitle'])?'':' - '.$site['subt
$copyright = empty($global_config['copyright'])?'<a target="_blank" href="https://gitee.com/tznb/TwoNav">Copyright © TwoNav</a>':$global_config['copyright'];
$ICP = empty($global_config['ICP'])?'':'<a target="_blank" href="https://beian.miit.gov.cn">'.$global_config['ICP'].'</a>';
$favicon = ( !empty($site['site_icon_file'])) ? $site['site_icon'] : './favicon.ico';
//读取默认模板信息
require DIR ."/system/templates.php";
//引导页
if(!empty($global_config['default_page']) && $global_config['default_page'] == 2){
if(empty(Get('u')) && empty($_COOKIE['Default_User'])){
$theme = $global_templates['guide'];
$dir_path = DIR.'/templates/guide/'.$global_templates['guide'];
$index_path = $dir_path.'/index.php';
if(!is_file($index_path)){
$dir_path= DIR.'/templates/guide/default';
$index_path = $dir_path.'/index.php';
}
$theme_dir = str_replace(DIR.'/templates/guide',"./templates/guide",$dir_path);
$theme_info = json_decode(@file_get_contents($dir_path.'/info.json'),true);
$theme_config = empty($theme_info['config']) ? []:$theme_info['config'];
$theme_config_db = get_db('user_config','v',['t'=>'theme_guide','k'=>$theme,'uid'=>UID]);
$theme_config_db = unserialize($theme_config_db);
$theme_config = empty($theme_config_db) ? $theme_config : array_merge ($theme_config,$theme_config_db);
require($index_path);
exit;
}
}
//参数指定主题优先
$theme = trim(@$_GET['theme']);
if ( !empty ($theme) ){
if ( !empty ($theme) && check_purview('theme_in',1)){
$dir_path = DIR.'/templates/home/'.$theme;
$index_path = $dir_path.'/index.php';
}else{

View File

@@ -48,6 +48,10 @@ if(Get_MD5_Password($Password,$USER_DB["RegTime"]) === $USER_DB["Password"]){
}else{
$url = preg_match('/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i',$_SERVER['HTTP_USER_AGENT']) ? "./?c=index&u={$USER_DB['User']}" : "./?c=admin&u={$USER_DB['User']}";
}
//默认页面
if(!empty($global_config['default_page'])){
setcookie('Default_User', $User, strtotime("+360 day"),"/",'',false,false);
}
msgA(['code'=>1,'msg'=>'登录成功','url'=>$url]);
}else{
update_db("user_log", ["description" => "请求登录>账户或密码错误"], ["id"=>$log_id]);

View File

@@ -1 +1 @@
v2.0.15-20230422
v2.0.16-20230425

View File

@@ -48,7 +48,7 @@ layui.use(['layer','miniTab'], function(){
//如果失败
if(up_info.code != 1){
layer.closeAll();
layer.alert(up_info.msg ?? "错误代码404",{icon:2,title:'更新失败',anim: 2,shadeClose: false,closeBtn: 0,btn: ['知道了']});
layer.alert(up_info.msg || "错误代码404",{icon:2,title:'更新失败',anim: 2,shadeClose: false,closeBtn: 0,btn: ['知道了']});
return;
}
//设为异步模式
@@ -70,7 +70,7 @@ layui.use(['layer','miniTab'], function(){
request_update();
}else{
layer.closeAll();
layer.alert(data.msg ?? "未知错误,请联系开发者!",{icon:5,title:up_info.info[i-1],anim: 2,shadeClose: false,closeBtn: 0,btn: ['知道了']});
layer.alert(data.msg || "未知错误,请联系开发者!",{icon:5,title:up_info.info[i-1],anim: 2,shadeClose: false,closeBtn: 0,btn: ['知道了']});
}
});
}

View File

@@ -47,7 +47,7 @@ layui.define(['table', 'jquery', 'form'], function (exports) {
//判断是否多搜索条件
if(opt.searchType == 'more'){
$.each(opt.searchList, function (index, item) {
tableBox += '<input style="display:inline-block;width:'+(item.width ?? '190px') +';height:30px;vertical-align:middle;margin-right:-1px;border: 1px solid #C9C9C9;" type="text" name="'+item.searchKey+'" placeholder="'+item.searchPlaceholder+'" autocomplete="off" class="layui-input">';
tableBox += '<input style="display:inline-block;width:'+(item.width || '190px') +';height:30px;vertical-align:middle;margin-right:-1px;border: 1px solid #C9C9C9;" type="text" name="'+item.searchKey+'" placeholder="'+item.searchPlaceholder+'" autocomplete="off" class="layui-input">';
});
}else{
tableBox += '<input style="display:inline-block;width:190px;height:30px;vertical-align:middle;margin-right:-1px;border: 1px solid #C9C9C9;" type="text" name="'+opt.searchKey+'" placeholder="'+opt.searchPlaceholder+'" autocomplete="off" class="layui-input">';

View File

@@ -79,7 +79,7 @@ layui.use(['form','upload','miniTab'], function () {
form_data.icon = res.icon;
$("#icon").val(res.icon);
}else{
layer.msg(res.msg ?? '上传失败', {icon: 5});
layer.msg(res.msg || '上传失败', {icon: 5});
}
},error: function(){

View File

@@ -7,7 +7,7 @@ layui.use(['form','table','dropdown','miniTab'], function () {
var categorys = [];
var IDs = [];
var api = get_api('read_link_list'); //列表接口
var limit = localStorage.getItem(u + "_limit")??50; //尝试读取本地记忆数据,没有就默认50
var limit = localStorage.getItem(u + "_limit") || 50; //尝试读取本地记忆数据,没有就默认50
var pwds = [];
miniTab.listen();
//渲染表格

View File

@@ -3,7 +3,7 @@ layui.use(['form','table'], function () {
var table = layui.table;
var data_tr,table_page;
var api = get_api('read_link_list'); //列表接口
var limit = localStorage.getItem(u + "_limit")??50; //尝试读取本地记忆数据,没有就默认50
var limit = localStorage.getItem(u + "_limit") || 50; //尝试读取本地记忆数据,没有就默认50
var cols=[[ //表头
{type:'radio'} //开启单选框

View File

@@ -18,7 +18,7 @@ layui.use(['form','table'], function () {
var table = layui.table;
var form = layui.form;
var api = get_api('read_login_info'); //列表接口
var limit = localStorage.getItem(u + "_limit")??50; //尝试读取本地记忆数据,没有就默认50
var limit = localStorage.getItem(u + "_limit") || 50; //尝试读取本地记忆数据,没有就默认50
var cols=[[ //表头
{field: 'id', title: 'ID', width:60, sort: true,hide:true}

View File

@@ -134,9 +134,9 @@
<?php } ?>
<div class="layui-form-item">
<button class="layui-btn layui-btn-primary layui-border-black" id="help" sort_id="7968924">帮助</button>
<button type="button" class="layui-btn layui-btn-primary layui-border-black" id="help" sort_id="7968924">帮助</button>
<?php if($global_config['Default_User'] != U ){ ?>
<button class="layui-btn layui-btn-primary layui-border-black" id="sdhp" data=>设为默认主页</button>
<button type="button" class="layui-btn layui-btn-primary layui-border-black" id="sdhp" data=>设为默认主页</button>
<?php } ?>
<button class="layui-btn layui-btn-normal" lay-submit lay-filter="save">保存</button>
</div>
@@ -184,7 +184,7 @@ layui.use(['jquery','form','upload'], function () {
$.removeCookie("Default_User");
$("#sdhp").text('设为默认主页')
}else{
$.cookie("Default_User",u);
$.cookie("Default_User",u,{expires: 360});
$("#sdhp").text('取消默认主页')
}
layer.msg("设置成功", {icon: 1});

View File

@@ -303,7 +303,7 @@ layui.use(['layer','element','upload','form','table'], function(){
if(res.code == 1){
$("#imp_link button").removeClass("layui-btn-disabled");
}else{
layer.alert(res.msg ?? "上传异常,请刷新重试<br />若无法解决请联系技术支持",{icon:5,title:'上传失败',anim: 2,closeBtn: 0,btn: ['刷新页面']},function () {location.reload();});
layer.alert(res.msg || "上传异常,请刷新重试<br />若无法解决请联系技术支持",{icon:5,title:'上传失败',anim: 2,closeBtn: 0,btn: ['刷新页面']},function () {location.reload();});
}
},error: function(){
layer.alert("上传异常,请刷新重试<br />若无法解决请联系技术支持",{icon:5,title:'错误',anim: 2,closeBtn: 0,btn: ['刷新页面']},function () {location.reload();});

View File

@@ -179,7 +179,7 @@ layui.use(['element','table','layer','form','util','dropdown'], function(){
var form = layui.form;
var dropdown = layui.dropdown;
var layer = layui.layer;
var limit = localStorage.getItem(u + "_limit")??50;
var limit = localStorage.getItem(u + "_limit") || 50;
form.val('conf', <?php echo json_encode($data);?>);
//表头

View File

@@ -171,12 +171,14 @@ require 'header.php';
<cite>站点设置</cite>
</a>
</div>
<?php if(check_purview('theme_in',1)){ ?>
<div class="layui-col-xs3 layuimini-qiuck-module">
<a href="javascript:;" layuimini-content-href="theme_home" data-title="主题设置" data-icon="fa fa-magic">
<i class="fa fa-magic"></i>
<cite>主题设置</cite>
</a>
</div>
<?php }?>
<div class="layui-col-xs3 layuimini-qiuck-module">
<a href="javascript:;" layuimini-content-href="category_list" data-title="分类管理" data-icon="fa fa-list-ul">
<i class="fa fa-list-ul"></i>

View File

@@ -29,7 +29,7 @@ layui.use(['form','table'], function () {
var table = layui.table;
var form = layui.form;
var api = get_api('read_pwd_group_list'); //列表接口
var limit = localStorage.getItem(u + "_limit")??50;
var limit = localStorage.getItem(u + "_limit") || 50;
var load_list = function () {
table.render({

View File

@@ -94,7 +94,7 @@ layui.use(['layer','form','miniTab'], function () {
layer.msg('导入完毕', {icon: 1});
}else{
layer.closeAll();
layer.alert(data.msg ?? "未知错误,请联系开发者!",{icon:5,title:'导入失败',anim: 2,shadeClose: false,closeBtn: 0,btn: ['知道了']});
layer.alert(data.msg || "未知错误,请联系开发者!",{icon:5,title:'导入失败',anim: 2,shadeClose: false,closeBtn: 0,btn: ['知道了']});
}
});
return;
@@ -110,7 +110,7 @@ layui.use(['layer','form','miniTab'], function () {
request_import();
}else{
layer.closeAll();
layer.alert(data.msg ?? "未知错误,请联系开发者!",{icon:5,title:'导入失败',anim: 2,shadeClose: false,closeBtn: 0,btn: ['知道了']});
layer.alert(data.msg || "未知错误,请联系开发者!",{icon:5,title:'导入失败',anim: 2,shadeClose: false,closeBtn: 0,btn: ['知道了']});
}
});
}

View File

@@ -78,7 +78,7 @@ layui.use(['table','layer','form'], function(){
var table = layui.table;
var form = layui.form;
var layer = layui.layer;
var limit = localStorage.getItem(u + "_limit")??50;
var limit = localStorage.getItem(u + "_limit") || 50;
var cols=[[ //表头

View File

@@ -49,7 +49,7 @@ layui.use(['table','layer','form'], function () {
var form = layui.form;
var table = layui.table;
var layer = layui.layer;
var limit = localStorage.getItem(u + "_limit")??50;
var limit = localStorage.getItem(u + "_limit") || 50;
var api = get_api('read_log');
var IDs = [];

View File

@@ -16,7 +16,19 @@ $title='系统设置';require(dirname(__DIR__).'/header.php');
</div>
<div class="layui-form-mid layui-word-aux">默认主页的账号,优先级:Get>Cookie/Host>默认用户>admin</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">默认页面</label>
<div class="layui-input-inline" >
<select name="default_page">
<option value="0" selected="">默认用户主页</option>
<option value="1" >登录用户主页</option>
<option value="2" >引导页面</option>
</select>
</div>
<div class="layui-form-mid layui-word-aux">直接访问域名不带任何参数时显示的页面</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label required">默认分组</label>
<div class="layui-input-inline">

View File

@@ -54,7 +54,7 @@ layui.use(['table','layer','form'], function () {
var form = layui.form;
var table = layui.table;
var layer = layui.layer;
var limit = localStorage.getItem(u + "_limit")??50;
var limit = localStorage.getItem(u + "_limit") || 50;
var api = get_api('read_user_list','list');
var IDs = [];

View File

@@ -149,7 +149,7 @@
layui.use(['form','table','laydate','tableSelect'], function () {
var $ = layui.jquery,table = layui.table,form = layui.form,laydate = layui.laydate,tableSelect = layui.tableSelect;
var api = get_api('read_share','share_list');
var limit = localStorage.getItem(u + "_limit")??50;
var limit = localStorage.getItem(u + "_limit") || 50;
var index,temp_date,type='category';
var isSupported = ClipboardJS.isSupported();
var baseUrl = Get_baseUrl();

View File

@@ -0,0 +1,84 @@
<?php $title='引导页模板';$awesome=true; require 'header.php'; if($USER_DB['UserGroup'] != 'root'){$content='您没有权限访问此页面'; require(DIR.'/templates/admin/page/404.php');exit;}?>
<style type="text/css">
.screenshot{
width: 99%;
height: 99%;
max-width: 100%;
max-height: 100%;
aspect-ratio:16/9;
}
#default #del {display: none;}
</style>
<body>
<div class="layuimini-container">
<div class="layuimini-main">
<blockquote class="layui-elem-quote layuimini-form" style="margin-top: 0px;border-left: 5px solid <?php echo $cache?"#1e9fff":($global_config['offline']?"":"#639d11") ?>;padding: 6px;">
<span class="layui-breadcrumb" lay-separator="|">
<a href="./index.php?c=admin&page=theme_guide&cache=no&u=<?php echo U;?>" >刷新数据</a>
</span>
</blockquote>
<div class="layui-bg-gray" style="padding: 1px;" >
<div class="layui-row layui-col-space15">
<?php
$Space = ' ';//占位符,强迫症想让输出的源码好看点而已...
foreach ($themes as $key => $theme) {
$online = !empty($theme['info']['md5']); //在线主题!
if($global_templates['guide'] == $key){
$icon ='<i class="fa fa-magic" style="color: #03a9f4;" title = "正在使用"></i> ';
}else{
$icon ='';
}
$color = ($global_templates['guide'] == $key ?"color: #03a9f4;":"");
?>
<!--主题卡片-->
<div class="layui-col-xs layui-col-sm4 layui-col-md3 ">
<div class="layui-card">
<div class="layui-card-header">
<div style="float:left; cursor:pointer;<?php echo $color; ?>" title="<?php echo $key; ?>"><?php echo $icon.$theme['info']['name']; ?></div>
<div style="float:right;cursor:pointer;" title="<?php echo $theme['info']['update']; ?>"><?php echo $theme['info']['version']; ?></div>
</div>
<div class="layui-card-body">
<div class="img-list"><img class="screenshot" layer-src="<?php echo $theme['info']['screenshot']; ?>" data-original="<?php echo $theme['info']['screenshot']; ?>"></div>
</div>
<div class="layui-card-header" style="height: 1px;"></div>
<div class="layui-card-header" style="height: auto;" id="guide">
<div class="layui-btn-group" id="<?php echo $key;?>">
<?php
if($online){ //如果是在线主题则显示下载
echo $Space.'<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" id="dw">下载</button>'."\n";
}elseif($theme['info']['up'] == 1){ //如果有更新则同时显示下载和使用
echo $Space.'<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" id="up">更新</button>'."\n";
echo $Space.'<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" id="set">使用</button>'."\n";
}else{ //其他情况仅显示使用
echo $Space.'<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" id="set">使用</button>'."\n";
}
echo $Space.'<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" id="detail">详情</button>'."\n";
if(!$online){ //本地主题显示预览
//echo $Space.'<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" id="preview">预览</button>'."\n";
}
if($theme['info']['config'] == '1'){ //支持配置的主题显示配置
echo $Space.'<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" id="config">配置</button>'."\n";
}
if($USER_DB['UserGroup'] === 'root' && !$online){ //管理员&本地主题>显示删除
echo $Space.'<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" id="del">删除</button>'."\n";
}
?>
</div>
</div>
</div>
</div>
<!--主题卡片End-->
<?php }?>
</div>
</div>
</div>
</div>
<script src = "<?php echo $libs;?>/jquery/jquery-3.6.0.min.js"></script>
<script src = "<?php echo $libs;?>/jquery/jquery.lazyload.min.js"></script>
<script src = "./templates/admin/js/public.js?v=<?php echo $Ver;?>"></script>
<?php load_static('js');?>
<script>var datas = <?php echo json_encode($themes)?>;</script>
<script src = "./templates/admin/js/theme.js?v=<?php echo $Ver;?>"></script>
</body>
</html>

View File

@@ -18,7 +18,7 @@
<a href="javascript:;" layuimini-content-href="theme_login" data-title="登录模板">登录模板</a>
<a href="javascript:;" layuimini-content-href="theme_transit" data-title="过渡模板">过渡模板</a>
<?php if($USER_DB['UserGroup'] === 'root'){echo '<a href="javascript:;" layuimini-content-href="theme_register" data-title="注册模板">注册模板</a>';} ?>
<?php if($USER_DB['UserGroup'] === 'root'){echo '<a href="javascript:;" layuimini-content-href="theme_guide" data-title="引导页模板">引导页模板</a>';} ?>
</span>
</blockquote>
<div class="layui-bg-gray" style="padding: 1px;" >

View File

@@ -2,6 +2,24 @@
<body>
<div class="layuimini-container">
<div class="layuimini-main" style=" margin-left: 20px;">
<li class="layui-timeline-item">
<i class="layui-icon layui-timeline-axis"></i>
<div class="layui-timeline-content layui-text">
<h4 class="layui-timeline-title">v2.0.16-20230425</h4>
<ul>
<li>[优化] 调整部分代码,使其能够兼容一些老旧的浏览器(如2345加速浏览器,都2023年了居然还在用2018年的内核)</li>
<li>[优化] 调整书签导出临时数据的存放路径为自身的temp,避免部分环境无法在/tmp写入数据造成导出异常</li>
<li>[优化] 默认过渡页</li>
<li>[优化] 默认登录模板(注册码注册时显示注册入口)</li>
<li>[新增] 主题商城新增引导页模板</li>
<li>[新增] 网站管理>系统设置>默认页面 (公开使用可以选择引导页面)</li>
<li>[修复] 站点设置>设为默认主页关闭浏览器后失效的问题</li>
<li>[修复] 站点设置在表单输入按回车弹出帮助页面的问题</li>
<li>[修复] 用户组主题设置权限问题</li>
<li>[修复] 其他已知问题</li>
</ul>
</div>
</li>
<li class="layui-timeline-item">
<i class="layui-icon layui-timeline-axis"></i>
<div class="layui-timeline-content layui-text">

View File

@@ -0,0 +1,78 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title><?php echo $theme;?> - 主题配置</title>
<link rel='stylesheet' href='<?php echo $libs?>/Layui/v2.6.8/css/layui.css'>
</head>
<body>
<div class="layui-row" style = "margin-top:18px;">
<div class="layui-container">
<div class="layui-col-lg6 layui-col-md-offset3">
<form class="layui-form" lay-filter="form">
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">页内标题</label>
<div class="layui-input-block">
<input type="text" name="title" placeholder="留空则使用默认用户站点配置的主标题" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">页内描述</label>
<div class="layui-input-block">
<input type="text" name="p1" placeholder="留空则使用默认用户站点配置的描述" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">背景图</label>
<div class="layui-input-block">
<input type="text" name="bg_img" placeholder="请输入背景图URL,留空则使用默认背景图" autocomplete="off" class="layui-input">
</div>
</div>
<div class="layui-form-item" style="padding-top: 10px;">
<div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
</div>
</div>
</form>
</div>
</div>
</div>
<script src = '<?php echo $libs?>/jquery/jquery-3.6.0.min.js'></script>
<script src = '<?php echo $libs?>/Layui/v2.6.8/layui.js'></script>
<script src = "./templates/admin/js/public.js?v=<?php echo $Ver;?>"></script>
<script>
var u = '<?php echo $u?>';
var t = '<?php echo $theme;?>';
var s = '<?php echo $_GET['source'];?>';
var api = get_api('write_theme','config') + '&t=' + t;
layui.use(['form'], function(){
var form = layui.form;
//表单赋值
form.val('form', <?php echo json_encode($theme_config);?>);
form.on('submit(save)', function(data){
$.post(api,data.field,function(data,status){
if(data.code == 1) {
if (s == 'admin'){
layer.msg(data.msg, {icon: 1});
return false;
}else{
layer.msg(data.msg, {icon: 1});
setTimeout(() => {parent.location.reload();}, 500);
}
}else{
layer.msg(data.msg, {icon: 5});
}
});
return false;
});
});
</script>
</body>
</html>

View File

@@ -0,0 +1,39 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
<title><?php echo $site['Title'];?></title>
<meta name="keywords" content="<?php echo $site['keywords']; ?>">
<meta name="description" content="<?php echo $site['description']; ?>">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<link rel="stylesheet" href="<?php echo $theme_dir;?>/main.css" />
<link rel="shortcut icon" href="<?php echo $favicon;?>">
</head>
<style>
#bg:after {background-image: url("<?php echo empty($theme_config['bg_img'])?$libs."/Other/bg.png":$theme_config['bg_img'];?>");}
</style>
<body >
<div id="wrapper">
<header id="header">
<div class="content">
<div class="inner">
<h3><?php echo empty($theme_config['title'])?$site['title']:$theme_config['title'];?></h3>
<p><?php echo empty($theme_config['p1'])?$site['description']:$theme_config['p1']; ?></p>
</div>
</div>
<nav>
<ul>
<li><a href="./index.php?c=<?php echo $global_config["Login"];?>" target="_self">登录</a></li>
<li><a href="./index.php?c=<?php echo $global_config["Register"];?>" target="_self">注册</a></li>
</ul>
</nav>
</header>
<footer id="footer">
<?php echo $copyright.PHP_EOL;?><?php echo $ICP.PHP_EOL;?>
<?php echo $global_config['global_footer'].PHP_EOL;?>
</footer>
</div>
<div id="bg"></div>
</body>
</html>

View File

@@ -0,0 +1,13 @@
{
"name": "默认",
"description": "模板来自于html5up.net",
"homepage": "https://gitee.com/tznb/TwoNav",
"version": "2.0.0",
"update": "2023/04/25",
"author": "TwoNav",
"config": {
"title":"",
"p1":"",
"bg_img":""
}
}

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@@ -43,7 +43,7 @@
<div class="tip">
<?php
//若为默认值则显示注册入口
if($global_config['Register'] == 'register' && $global_config['RegOption'] == 1){
if($global_config['Register'] == 'register' && $global_config['RegOption'] > 0){
echo '<a href="./?c=register" class="forget">没有账号?立即注册</a>';
}
?>
@@ -91,7 +91,7 @@
data.Password = $.md5(data.Password);
$.post('./index.php?c=<?php echo $c; ?>&u='+data.User,data,function(re,status){
if(re.code == 1) {
window.location.href = re.url ?? './index.php?c=admin&u='+ data.User;
window.location.href = re.url;
}else{
layer.msg(re.msg, {icon: 5});
}

View File

@@ -11,12 +11,6 @@
<!--<script src="<?php echo $libs?>/jquery/jquery-2.2.4.min.js"></script>-->
<!--<script src="<?php echo $libs?>/bootstrap4/js/bootstrap.min.js"></script>-->
<style>
.prevent-overflow{
width:260px;
overflow: hidden;
white-space: nowrap;
text-overflow:ellipsis;
}
.a_d img{
max-width:100%;
padding-top:1em;
@@ -26,6 +20,26 @@
width:100%;
background-color: #343a40!important;
}
.list-group-item {
background-color: #bee5eb;
}
.badge-pill-2{
margin-right: 10px;
padding-right: 0.6em;
padding-left: 0.6em;
width: 60px;
}
.badge {
font-size: 100%;
}
a {
display: block;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
</style>
<?php echo $site['custom_header'].PHP_EOL?>
<?php echo $global_config['global_header'].PHP_EOL?>
@@ -40,7 +54,7 @@ if( empty($link['url_standby']) ) {
<div class = "row">
<div class="col-sm-8 offset-sm-2">
<nav class="navbar navbar-expand-md bg-dark navbar-dark">
<a class="navbar-brand" href="/"><?php echo $site['title']; ?></a>
<a class="navbar-brand" href="./?u=<?php echo U; ?>"><?php echo $site['title']; ?></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
<span class="navbar-toggler-icon"></span>
</button>
@@ -64,25 +78,17 @@ if( empty($link['url_standby']) ) {
</div>
<div class="row">
<div class="col-sm-8 offset-sm-2">
<h2>链接信息:</h2>
<table class="table">
<tbody>
<tr class="table-info">
<td width="100">标题</td>
<td><?php echo $link['title']; ?></td>
</tr>
<tr class="table-info">
<td>描述</td>
<td><?php echo $link['description']; ?></td>
</tr>
<tr class="table-info">
<td>链接</td>
<td>
<div class = "prevent-overflow">
<a href="<?php echo $link['url']; ?>" rel = "nofollow" title = "<?php echo $link['title']; ?>"><?php echo $link['url']; ?></a>
</div>
</td>
</tr>
<h3>链接信息:</h3>
<ul class="list-group">
<li class="list-group-item" >
<span class="badge badge-primary badge-pill-2">标 题 </span><?php echo $link['title']; ?>
</li>
<li class="list-group-item" >
<span class="badge badge-primary badge-pill-2">描 述 </span><?php echo $link['description']; ?>
</li>
<li class="list-group-item" >
<a href="<?php echo $link['url']; ?>" rel = "nofollow" title = "<?php echo $link['title']; ?>"><span class="badge badge-primary badge-pill-2"> 链 接 </span><?php echo $link['url']; ?></a>
</li>
<?php
$i = 0;
foreach ($link['url_standby'] as $key => $url_standby){
@@ -95,21 +101,18 @@ foreach ($link['url_standby'] as $key => $url_standby){
$url = $url_standby;
}
?>
<tr class="table-info">
<td>备用链接<?php echo $i;?></td>
<td>
<div class = "prevent-overflow">
<a href="<?php echo $url; ?>" rel = "nofollow" title = "<?php echo $link['title']; ?>"><?php echo $title; ?></a>
</div>
</td>
</tr>
<li class="list-group-item" >
<a href="<?php echo $url; ?>" rel = "nofollow" title = "<?php echo $link['title']; ?>"><span class="badge badge-primary badge-pill-2">备用<?php echo $i;?></span><?php echo $title; ?></a>
</li>
<?php } ?>
</tbody>
</table>
</ul>
<?php if( empty($link['url_standby']) ) { ?>
<div class="spinner-border"></div> 即将打开,请稍等...
<?php }else{ ?>
<div class="alert alert-primary">
<div class="alert alert-primary" style="margin-top: 16px;">
<strong>存在备用链接,请手动点击您要打开的链接!</strong>
</div>
<?php } ?>