mirror of
https://github.com/tznb1/TwoNav.git
synced 2025-08-10 08:51:49 +00:00
Compare commits
10 Commits
v2.0.07-20
...
v2.0.17-20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
689dcb2e94 | ||
|
|
5b6925aafa | ||
|
|
ccae67f236 | ||
|
|
87566c39f3 | ||
|
|
5cae5af159 | ||
|
|
fa292ba2ab | ||
|
|
0ef96aba23 | ||
|
|
d1f4530ded | ||
|
|
c65ca9225c | ||
|
|
a2f84325af |
@@ -22,7 +22,8 @@ if($db_config['type'] == 'sqlite'){
|
||||
'port' => $db_config['port'],
|
||||
'database' => $db_config['name'],
|
||||
'username' => $db_config['user'],
|
||||
'password' => $db_config['password']
|
||||
'password' => $db_config['password'],
|
||||
'charset' => 'utf8mb4'
|
||||
]);
|
||||
}catch (Exception $e) {
|
||||
Amsg(-1,'链接数据库失败!');
|
||||
@@ -37,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"]);
|
||||
@@ -72,6 +73,7 @@ if(empty($c) || $c == 'index'){
|
||||
}elseif(in_array($c,['admin','click','api','ico','verify'])){
|
||||
require "./system/{$c}.php";
|
||||
}elseif(in_array($c,['apply','guestbook'])){
|
||||
if($global_config['Maintenance'] != 0){Amsg(-1,'网站正在进行维护,请稍后再试!');}
|
||||
require "./system/expand/{$c}.php";
|
||||
}else{
|
||||
Amsg(-1,'接口错误'.$c);
|
||||
|
||||
10985
static/Layui/v2.6.8/modules/jquery.js
vendored
10985
static/Layui/v2.6.8/modules/jquery.js
vendored
File diff suppressed because one or more lines are too long
458
system/ATool.php
Normal file
458
system/ATool.php
Normal file
@@ -0,0 +1,458 @@
|
||||
<?php
|
||||
//管理员应急工具箱
|
||||
error_reporting(E_ALL^E_NOTICE^E_WARNING^E_DEPRECATED);
|
||||
define('DIR',dirname(__DIR__));
|
||||
define('config_path', DIR . '/data/ATool_config.php'); ;
|
||||
|
||||
//判断配置文件是否存在
|
||||
if(is_file(config_path)){
|
||||
require config_path;
|
||||
if(empty($config['key'])){
|
||||
exit('未读取到Key');
|
||||
}
|
||||
require DIR."/system/Msg.php";
|
||||
}else{
|
||||
require DIR.'/system/public.php';
|
||||
Reset_Config();
|
||||
}
|
||||
|
||||
//switch状态
|
||||
if($config['switch'] === 1){
|
||||
|
||||
}else{
|
||||
$msg['title'] = 'ATool未开启';
|
||||
$msg['methodTitle'] = '开启方式:';
|
||||
$msg['content'] = '1. 登录您的云服务器或虚拟主机<br /> 2. 进入TwoNav的程序目录<br /> 3. 编辑 data/ATool_config.php 将"switch" => 0 改为 "switch" => 1 <br /> 4. 复制Key的内容,保存后刷新此页面,使用Key验证即可进入ATool';
|
||||
require DIR.'/templates/admin/other/error.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
session_name('ATool_SSID');
|
||||
session_start();
|
||||
|
||||
if(!empty($_GET['type'])){
|
||||
if($_GET['type'] == 'verify'){
|
||||
if(isset($_SESSION['verify']) && $_SESSION['verify'] === true){
|
||||
msg(-1,'您已经验证过了,无需重复验证!');
|
||||
}else{
|
||||
if(!empty($_POST['Key']) && $_POST['Key'] === md5($config['key'])){
|
||||
$_SESSION['verify'] = true;
|
||||
msg(1,'验证成功');
|
||||
}else{
|
||||
msg(-1,'Key错误');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//判断是否已验证
|
||||
if(isset($_SESSION['verify']) && $_SESSION['verify'] === true){
|
||||
$db = Load_db();
|
||||
$global_config = unserialize( get_db("global_config", "v", ["k" => "o_config"]) );
|
||||
}else{
|
||||
msg(-1,'鉴权失败');
|
||||
}
|
||||
|
||||
if($_GET['type'] == 'logout'){
|
||||
$_SESSION['verify'] = false;
|
||||
Reset_Config();
|
||||
msg(1,'退出成功');
|
||||
}elseif($_GET['type'] == 'user_list'){
|
||||
$query = $_POST['query'];
|
||||
$UserGroup = @$_POST['UserGroup'];
|
||||
$page = empty(intval($_REQUEST['page'])) ? 1 : intval($_REQUEST['page']);
|
||||
$limit = empty(intval($_REQUEST['limit'])) ? 50 : intval($_REQUEST['limit']);
|
||||
$offset = ($page - 1) * $limit; //起始行号
|
||||
//用户组筛选
|
||||
if(!empty($UserGroup)){
|
||||
$where['AND']['UserGroup'] = $UserGroup;
|
||||
}
|
||||
//关键字筛选
|
||||
if(!empty($query)){
|
||||
$where['AND']['OR'] = ["User[~]" => $query,"Email[~]" => $query,"RegIP[~]" => $query];
|
||||
}
|
||||
//统计条数
|
||||
$count = count_db('global_user',$where);
|
||||
//权重排序(数字小的排前面)
|
||||
$where['ORDER']['RegTime'] = 'DESC';
|
||||
//分页
|
||||
$where['LIMIT'] = [$offset,$limit];
|
||||
//查询
|
||||
$datas = select_db('global_user',['ID','User','UserGroup','Email','RegIP','RegTime','Login'],$where);
|
||||
if(!empty($datas)){
|
||||
$user_group = select_db('user_group',['name','code'],'');//读用户组
|
||||
$user_group = array_column($user_group, 'name', 'code');//以代号为键
|
||||
$user_group['root'] = '站长';
|
||||
$user_group['default'] = '默认';
|
||||
foreach ($datas as $key => $data){
|
||||
$datas[$key]['UserGroupName'] = $user_group[$data['UserGroup']]??'Null';
|
||||
}
|
||||
}
|
||||
msgA(['code'=>1,'msg'=>'获取成功','count'=>$count,'data'=>$datas]);
|
||||
}elseif($_GET['type'] == 'set_pwd'){
|
||||
if(!has_db('global_user',['ID'=>$_POST['ID']])){
|
||||
msg(-1,'用户不存在!');
|
||||
}
|
||||
//空字符串md5 防止意外出现空密码
|
||||
if( $_POST['new_pwd']== 'd41d8cd98f00b204e9800998ecf8427e'){
|
||||
msg(-1,'密码不能为空');
|
||||
}
|
||||
$RegTime = get_db('global_user','RegTime',['ID'=>$_POST['ID']]);
|
||||
update_db('global_user',['Password'=>Get_MD5_Password($_POST['new_pwd'],$RegTime)],["ID" => $_POST['ID'] ],[1,'修改成功']);
|
||||
}elseif($_GET['type'] == 'set_root'){
|
||||
update_db('global_user',['UserGroup'=>'root'],["ID" => $_POST['ID'] ],[1,'修改成功']);
|
||||
//设为允许注册
|
||||
}elseif($_GET['type'] == 'set_allow_register'){
|
||||
$global_config['RegOption'] = 1;
|
||||
update_db("global_config", ["v" => $global_config], ["k" => "o_config"],[1,'设置成功']);
|
||||
//关闭维护模式
|
||||
}elseif($_GET['type'] == 'set_close_Maintenance'){
|
||||
$global_config['Maintenance'] = 0;
|
||||
update_db("global_config", ["v" => $global_config], ["k" => "o_config"],[1,'设置成功']);
|
||||
//重置静态路径
|
||||
}elseif($_GET['type'] == 'Set_Libs'){
|
||||
$global_config['Libs'] = "./static";
|
||||
update_db("global_config", ["v" => $global_config], ["k" => "o_config"],[1,'设置成功']);
|
||||
//清理缓存
|
||||
}elseif($_GET['type'] == 'Set_clear_cache'){
|
||||
clearstatcache();
|
||||
if(function_exists("opcache_reset")){
|
||||
opcache_reset(); //清理PHP缓存
|
||||
}
|
||||
msgA(['code'=>1,'msg'=>'操作成功']);
|
||||
//改账号
|
||||
}elseif($_GET['type'] == 'set_user_name'){
|
||||
//新用户名是否合规
|
||||
if(empty($_POST['new_user_name'])){
|
||||
msgA(['code'=>-1,'msg'=>'用户名不能为空']);
|
||||
}elseif(empty($_POST['ID'])){
|
||||
msgA(['code'=>-1,'msg'=>'ID不能为空']);
|
||||
}elseif(!preg_match('/^[A-Za-z0-9]{4,13}$/',$_POST['new_user_name'])){
|
||||
msg(-1,'账号只能是4到13位的数字和字母!');
|
||||
}
|
||||
|
||||
//检测是否冲突
|
||||
if(file_exists(DIR."/data/user/".$_POST['new_user_name'])){
|
||||
msgA(['code'=>-1,'msg'=>'data/user/存在同名文件夹']);
|
||||
}
|
||||
if(file_exists(DIR."/data/backup/".$_POST['new_user_name'])){
|
||||
msgA(['code'=>-1,'msg'=>'data/backup/存在同名文件夹']);
|
||||
}
|
||||
//读取用户信息
|
||||
$USER = get_db("global_user", "*", ["ID" => $_POST['ID']]);
|
||||
if(empty($USER)){
|
||||
msgA(['code'=>-1,'msg'=>'用户ID不存在']);
|
||||
}elseif($USER['User'] == $_POST['new_user_name']){
|
||||
msgA(['code'=>-1,'msg'=>'新用户名不能和旧的一样']);
|
||||
}elseif(has_db('global_user',['User'=>$_POST['new_user_name']])){
|
||||
msgA(['code'=>-1,'msg'=>'新账号已存在,请核对后再试!']);
|
||||
}
|
||||
//移动数据目录
|
||||
$Path = DIR.'/data/user/'.$USER['User'];
|
||||
if(is_dir($Path)){
|
||||
$New_Path = DIR.'/data/user/'.$_POST['new_user_name'];
|
||||
if(!rename($Path,$New_Path)){
|
||||
msgA(['code'=>-1,'msg'=>'移动数据目录失败']);
|
||||
}
|
||||
}
|
||||
//移动备份目录
|
||||
$Path = DIR.'/data/backup/'.$USER['User'];
|
||||
if(is_dir($Path)){
|
||||
$New_Path = DIR.'/data/backup/'.$_POST['new_user_name'];
|
||||
if(!rename($Path,$New_Path)){
|
||||
msgA(['code'=>-1,'msg'=>'移动备份目录失败']);
|
||||
}
|
||||
}
|
||||
update_db("user_login_info", ["user" => $_POST['new_user_name']], ["user" => $USER['User']]);
|
||||
update_db("user_log", ["user" => $_POST['new_user_name']], ["user" => $USER['User']]);
|
||||
update_db("global_user", ["User" => $_POST['new_user_name']], ["ID" => $_POST['ID']],[1,'操作成功']);
|
||||
}
|
||||
|
||||
msgA(['code'=>-1,'msg'=>'请求类型错误']);
|
||||
}else{
|
||||
//判断是否已验证
|
||||
if(isset($_SESSION['verify']) && $_SESSION['verify'] === true){
|
||||
$db = Load_db();
|
||||
$global_config = unserialize( get_db("global_config", "v", ["k" => "o_config"]) );
|
||||
echo_Atool();
|
||||
}else{
|
||||
echo_verify();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//载入数据库
|
||||
function Load_db(){
|
||||
require DIR."/data/config.php";
|
||||
require DIR.'/system/Medoo.php';
|
||||
if($db_config['type'] == 'sqlite'){
|
||||
try {
|
||||
$db_config['path'] = DIR."/data/".$db_config['file'];
|
||||
$db = new Medoo\Medoo(['type'=>'sqlite','database'=>$db_config['path']]);
|
||||
}catch (Exception $e) {
|
||||
Amsg(-1,'载入数据库失败'.$db_config['path']);
|
||||
}
|
||||
}elseif($db_config['type'] == 'mysql'){
|
||||
try {
|
||||
$db = new Medoo\Medoo(['type' => 'mysql',
|
||||
'host' => $db_config['host'],
|
||||
'port' => $db_config['port'],
|
||||
'database' => $db_config['name'],
|
||||
'username' => $db_config['user'],
|
||||
'password' => $db_config['password']
|
||||
]);
|
||||
}catch (Exception $e) {
|
||||
Amsg(-1,'链接数据库失败!');
|
||||
}
|
||||
}
|
||||
require DIR.'/system/public.php';
|
||||
return $db;
|
||||
}
|
||||
|
||||
function echo_Atool(){
|
||||
global $global_config;
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>ATool 工具箱</title>
|
||||
<link rel="stylesheet" href="../static/Layui/v2.6.8/css/layui.css">
|
||||
<style>
|
||||
html, body {min-width: 1200px;background-color: #fff;position: relative;}
|
||||
.page-wrapper {width: 1200px;margin: 0 auto;padding: 0 15px;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="page-wrapper">
|
||||
<fieldset class="layui-elem-field layui-field-title">
|
||||
<legend> ATool 工具箱 </legend>
|
||||
</fieldset>
|
||||
<div class="layui-btn-container" style="display: inline-block;">
|
||||
<button id="logout" class="layui-btn layui-btn-sm layui-btn-primary"><i class="layui-icon layui-icon-snowflake"></i>安全退出</button>
|
||||
<a class="layui-btn layui-btn-sm layui-btn-primary" href="../index.php?c=<?php echo $global_config['Login'];?>" target="_blank"><i class="layui-icon layui-icon-username"></i>打开登录页</a>
|
||||
<a class="layui-btn layui-btn-sm layui-btn-primary" href="../index.php?c=<?php echo $global_config['Register'];?>" target="_blank"><i class="layui-icon layui-icon-add-1"></i>打开注册页</a>
|
||||
<button type="set_allow_register" class="set layui-btn layui-btn-sm layui-btn-primary"><i class="layui-icon layui-icon-set-sm"></i>允许注册</button>
|
||||
<button type="set_close_Maintenance" class="set layui-btn layui-btn-sm layui-btn-primary"><i class="layui-icon layui-icon-set-sm"></i>关闭维护模式</button>
|
||||
<button type="Set_Libs" class="set layui-btn layui-btn-sm layui-btn-primary"><i class="layui-icon layui-icon-set-sm"></i>重置静态路径</button>
|
||||
<button type="Set_clear_cache" class="set layui-btn layui-btn-sm layui-btn-primary"><i class="layui-icon layui-icon-set-sm"></i>清除缓存</button>
|
||||
<a class="layui-btn layui-btn-sm layui-btn-primary" href="https://gitee.com/tznb/TwoNav/wikis/pages?sort_id=7993451&doc_id=3767990" target="_blank"><i class="layui-icon layui-icon-align-left"></i>帮助</a>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="layui-inline layui-form" style="padding-bottom: 5px;">
|
||||
<div class="layui-input-inline" style=" width: 150px; ">
|
||||
<select id="UserGroup" name="UserGroup" >
|
||||
<option value="" selected>全部</option>
|
||||
<option value="root">站长</option>
|
||||
<option value="default">默认</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline layui-form" style="padding-bottom: 5px;">
|
||||
<label class="layui-form-label layui-hide-sm" style="width:60px;padding-left: 5px;padding-right: 5px;">关键字:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input class="layui-input" name="keyword" id="keyword" placeholder='请输入账号/邮箱/注册IP' value=''autocomplete="off" >
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="layui-inline layui-form" style="padding-bottom: 5px;">
|
||||
<button class="layui-btn layui-btn-normal " id="search" style="height: 36px;">搜索</button>
|
||||
</div>
|
||||
<table id="table" lay-filter="table"></table>
|
||||
</div>
|
||||
<!-- 表格操作列 -->
|
||||
<script type="text/html" id="tablebar">
|
||||
<div class="layui-btn-group">
|
||||
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="set_pwd">改密码</a>
|
||||
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="set_root">设站长</a>
|
||||
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="set_user_name">改账号</a>
|
||||
</div>
|
||||
</script>
|
||||
<script src="../static/Layui/v2.6.8/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>
|
||||
<script>
|
||||
layui.use(['layer','table'], function () {
|
||||
var $ = layui.jquery;
|
||||
var layer = layui.layer;
|
||||
var table = layui.table;
|
||||
var cols = [[
|
||||
{field:'ID',title:'ID',width:60,sort:true}
|
||||
,{title:'操作',toolbar:'#tablebar',width:175}
|
||||
,{field:'User',title:'账号',minWidth:120,templet:function(d){
|
||||
return '<a style="color:#3c78d8" title="打开用户主页" target="_blank" href="../?u='+d.User+'">'+d.User+'</a>'
|
||||
}}
|
||||
,{field:'UserGroupName',title:'用户组',minWidth:90}
|
||||
,{field:'Email',title:'Email',minWidth:170}
|
||||
,{field:'RegIP',title:'注册IP',minWidth:140,templet:function(d){
|
||||
return '<a style="color:#3c78d8" title="查询归属地" target="_blank" href="//ip.rss.ink/result/'+d.RegIP+'">'+d.RegIP+'</a>'
|
||||
}}
|
||||
,{field:'RegTime',title: '注册时间',minWidth:100,templet:function(d){
|
||||
return d.RegTime == null ? '' : timestampToTime(d.RegTime,true);
|
||||
}}
|
||||
]]
|
||||
//用户表渲染
|
||||
table.render({
|
||||
elem: '#table'
|
||||
,height: '500'
|
||||
,url: './ATool.php?type=user_list'
|
||||
,page: true
|
||||
,limit:50
|
||||
,even:true
|
||||
,loading:true
|
||||
,id:'table'
|
||||
,method: 'post'
|
||||
,response: {statusCode: 1 }
|
||||
,cols: cols
|
||||
});
|
||||
//关键字回车
|
||||
$('#keyword').keydown(function (e){if(e.keyCode === 13){search();}});
|
||||
//搜索按钮点击
|
||||
$('#search').on('click', function(){search();});
|
||||
//搜索
|
||||
function search(){
|
||||
var UserGroup = document.getElementById("UserGroup").value;
|
||||
var keyword = document.getElementById("keyword").value;
|
||||
table.reload('table', {
|
||||
url: './ATool.php?type=user_list'
|
||||
,method: 'post'
|
||||
,request: {pageName: 'page',limitName: 'limit'}
|
||||
,where: {query:keyword,UserGroup:UserGroup}
|
||||
,page: {curr: 1}
|
||||
});
|
||||
}
|
||||
//行工具
|
||||
table.on('tool(table)', function (obj) {
|
||||
console.log(obj.data);
|
||||
var data = obj.data;
|
||||
if (obj.event == 'set_pwd') {
|
||||
layer.prompt({formType: 3,value: '',title: '请输入新密码'}, function(value, index, elem){
|
||||
$.post('./ATool.php?type=set_pwd',{ID:data.ID,new_pwd:$.md5(value)},function(data,status){
|
||||
if(data.code == 1) {
|
||||
layer.close(index);
|
||||
layer.msg(data.msg, {icon: 1});
|
||||
}else{
|
||||
layer.msg(data.msg, {icon: 5});
|
||||
}
|
||||
});
|
||||
});
|
||||
}else if(obj.event == 'set_root'){
|
||||
$.post('./ATool.php?type=set_root',{ID:data.ID},function(data,status){
|
||||
if(data.code == 1) {
|
||||
table.reload('table');
|
||||
layer.msg(data.msg, {icon: 1});
|
||||
}else{
|
||||
layer.msg(data.msg, {icon: 5});
|
||||
}
|
||||
});
|
||||
}else if(obj.event == 'set_user_name'){
|
||||
layer.prompt({formType: 3,value: '',title:'请输入新账号 (原账号:'+data.User+')'}, function(value, index, elem){
|
||||
$.post('./ATool.php?type=set_user_name',{ID:data.ID,new_user_name:value},function(data,status){
|
||||
if(data.code == 1) {
|
||||
layer.close(index);
|
||||
table.reload('table');
|
||||
layer.msg(data.msg, {icon: 1});
|
||||
}else{
|
||||
layer.msg(data.msg, {icon: 5});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
$('.set').click(function () {
|
||||
let type = $(this).attr("type");
|
||||
$.post('./ATool.php?type='+type,function(re,status){
|
||||
if(re.code == 1) {
|
||||
layer.msg(re.msg, {icon: 6,time: 600,end: function() {window.location.reload();return false;}});
|
||||
}else{
|
||||
layer.msg(re.msg, {icon: 5});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
$('#logout').click(function () {
|
||||
layer.confirm('退出后ATool将被关闭并重置Key',{icon: 3, title:'为了您的站点安全:'}, function(index){
|
||||
$.post('./ATool.php?type=logout',function(re,status){
|
||||
if(re.code == 1) {
|
||||
layer.msg(re.msg, {icon: 6,time: 600,end: function() {window.location.reload();return false;}});
|
||||
}else{
|
||||
layer.msg(re.msg, {icon: 5});
|
||||
}
|
||||
});
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
<?php exit;
|
||||
}
|
||||
|
||||
//输出验证页面
|
||||
function echo_verify(){ ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>ATool 工具箱</title>
|
||||
<link rel="stylesheet" href="../static/Layui/v2.6.8/css/layui.css">
|
||||
<link rel="stylesheet" href="../static/Other/login.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="main-body">
|
||||
<div class="login-main">
|
||||
<div class="login-top">
|
||||
<span>ATool 工具箱</span>
|
||||
<span class="bg1"></span>
|
||||
<span class="bg2"></span>
|
||||
</div>
|
||||
<form class="layui-form login-bottom">
|
||||
<div class="center">
|
||||
<div class="item">
|
||||
<span class="icon icon-3"></span>
|
||||
<input type="password" name="Key" lay-verify="required" placeholder="请输入Key">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" style="text-align:center; width:100%;height:100%;margin:0px;">
|
||||
<button class="login-btn" lay-submit="" lay-filter="verify">验证</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script src = "../static/jquery/jquery-3.6.0.min.js"></script>
|
||||
<script src = "../static/Layui/v2.6.8/layui.js"></script>
|
||||
<script src = '../static/jquery/jquery.md5.js'></script>
|
||||
<script>
|
||||
layui.use(['form','jquery'], function () {
|
||||
var form = layui.form,layer = layui.layer;
|
||||
form.on('submit(verify)', function (data) {
|
||||
data.field.Key = $.md5(data.field.Key);
|
||||
$.post('./ATool.php?type=verify',data.field,function(re,status){
|
||||
if(re.code == 1) {
|
||||
layer.msg(re.msg, {icon: 6,time: 600,end: function() {window.location.reload();return false;}});
|
||||
}else{
|
||||
layer.msg(re.msg, {icon: 5});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
<?php exit;
|
||||
}
|
||||
|
||||
function Reset_Config(){
|
||||
clearstatcache();
|
||||
if(function_exists("opcache_reset")){
|
||||
opcache_reset(); //清理PHP缓存
|
||||
}
|
||||
$text = '<?php $config = array( "key" => "'.Get_Rand_Str(32).'", "switch" => 0 );?>';
|
||||
if(!file_put_contents(config_path,$text)) {
|
||||
exit('写初始配置失败,请检查data目录权限');
|
||||
}
|
||||
}
|
||||
859
system/Medoo.php
859
system/Medoo.php
File diff suppressed because it is too large
Load Diff
@@ -23,6 +23,6 @@ function Amsg($code,$msg){
|
||||
msg($code,$msg);
|
||||
}else{
|
||||
header("content-Type: text/html; charset=utf-8");
|
||||
exit('<title>错误</title><font color="red">错误代码:'.$code.'<br />错误信息:'.$msg.'</font>');
|
||||
exit('<title>错误</title><font color="red">代码:'.$code.'<br />信息:'.$msg.'</font>');
|
||||
}
|
||||
}
|
||||
28
system/MySQL/20230417.php
Normal file
28
system/MySQL/20230417.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php if(!defined('DIR')){header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit;}
|
||||
$sql ="
|
||||
ALTER DATABASE {$GLOBALS['db_config']['name']} DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
||||
ALTER TABLE global_config CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
||||
ALTER TABLE global_user CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
||||
ALTER TABLE purview_list CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
||||
ALTER TABLE regcode_list CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
||||
ALTER TABLE updatadb_logs CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
||||
ALTER TABLE user_apply CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
||||
ALTER TABLE user_categorys CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
||||
ALTER TABLE user_config CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
||||
ALTER TABLE user_count CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
||||
ALTER TABLE user_group CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
||||
ALTER TABLE user_links CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
||||
ALTER TABLE user_log CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
||||
ALTER TABLE user_login_info CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
||||
ALTER TABLE user_pwd_group CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
||||
ALTER TABLE user_share CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
||||
INSERT INTO `purview_list` (`code`, `name`, `description`) VALUES
|
||||
('link_extend', '链接扩展', '允许使用链接扩展字段'),
|
||||
('theme_in', '主题设置', '后台显示主题设置菜单'),
|
||||
('theme_set', '主题配置', '允许自定义主题配置');
|
||||
";
|
||||
if(exe_sql($sql)){
|
||||
insert_db('updatadb_logs',['file_name'=>$file_name,'update_time'=>time(),'status'=>'TRUE','extra'=>'']);
|
||||
}else{
|
||||
msg(-1,'数据库更新失败');
|
||||
}
|
||||
23
system/MySQL/20230420.php
Normal file
23
system/MySQL/20230420.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php if(!defined('DIR')){header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit;}
|
||||
//弥补主题配置目录名相同造成的窜数据的bug
|
||||
//复制主题配置,并重新标记t类型
|
||||
// 'theme_home','theme_login','theme_transit','theme_register';
|
||||
|
||||
$datas = select_db('user_config','*',['t'=>'theme']);
|
||||
foreach ($datas as $data) {
|
||||
$name = $data['k'];
|
||||
unset($data['id']);
|
||||
if($name == 'default'){
|
||||
$data['t'] = 'theme_transit';
|
||||
insert_db('user_config',$data);
|
||||
}
|
||||
if($name == 'WebStack-Hugo'){
|
||||
$data['t'] = 'theme_transit';
|
||||
insert_db('user_config',$data);
|
||||
}
|
||||
$data['t'] = 'theme_home';
|
||||
insert_db('user_config',$data);
|
||||
}
|
||||
|
||||
insert_db('updatadb_logs',['file_name'=>$file_name,'update_time'=>time(),'status'=>'TRUE','extra'=>'']);
|
||||
delete_db('user_config',['t'=>'theme']);
|
||||
@@ -5,7 +5,7 @@ CREATE TABLE IF NOT EXISTS `global_config` (
|
||||
`v` text NOT NULL COMMENT '值',
|
||||
`d` varchar(32) DEFAULT '' COMMENT '描述',
|
||||
UNIQUE KEY `k` (`k`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- 用户配置
|
||||
DROP TABLE IF EXISTS `user_config`;
|
||||
@@ -17,7 +17,7 @@ CREATE TABLE IF NOT EXISTS `user_config` (
|
||||
`t` varchar(32) NOT NULL COMMENT '类型',
|
||||
`d` varchar(32) DEFAULT '' COMMENT '描述',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
|
||||
-- 统计
|
||||
@@ -27,7 +27,7 @@ CREATE TABLE IF NOT EXISTS `user_count` (
|
||||
`k` varchar(32) NOT NULL COMMENT '键',
|
||||
`v` bigint(10) UNSIGNED DEFAULT '0' COMMENT '值',
|
||||
`t` varchar(32) NOT NULL COMMENT '类型'
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
|
||||
-- 数据库升级记录
|
||||
@@ -40,8 +40,10 @@ CREATE TABLE IF NOT EXISTS `updatadb_logs` (
|
||||
`extra` varchar(512) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `file_name` (`file_name`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
INSERT INTO "updatadb_logs" ("file_name", "update_time", "status", "extra") VALUES ('20230417.php', '1681719049', 'TRUE', '');
|
||||
INSERT INTO "updatadb_logs" ("file_name", "update_time", "status", "extra") VALUES ('20230420.php', '1681977368', 'TRUE', '');
|
||||
|
||||
-- 创建用户表
|
||||
DROP TABLE IF EXISTS `global_user`;
|
||||
@@ -64,7 +66,7 @@ CREATE TABLE IF NOT EXISTS `global_user` (
|
||||
PRIMARY KEY (`ID`),
|
||||
UNIQUE KEY `User` (`User`),
|
||||
UNIQUE KEY `Email` (`Email`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- 用户分类表
|
||||
DROP TABLE IF EXISTS `user_categorys`;
|
||||
@@ -85,7 +87,7 @@ CREATE TABLE IF NOT EXISTS `user_categorys` (
|
||||
`icon` text NOT NULL DEFAULT '' COMMENT '个性图标',
|
||||
`extend` text NOT NULL COMMENT '扩展',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='用户分类';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='用户分类';
|
||||
|
||||
INSERT INTO `user_categorys` (`id`, `cid`, `fid`, `uid`, `pid`, `status`, `property`, `name`, `add_time`, `up_time`, `weight`, `description`, `font_icon`, `icon`, `extend`) VALUES
|
||||
(1, 1, 0, 0, 0, 1, 0, '默认分类', 1672502400, 1672502400, 0, 'TwoNav默认分类', 'fa fa-book', '', '');
|
||||
@@ -112,7 +114,7 @@ CREATE TABLE IF NOT EXISTS `user_links` (
|
||||
`up_time` int(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
`extend` text NOT NULL COMMENT '扩展',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='用户链接';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='用户链接';
|
||||
|
||||
|
||||
INSERT INTO `user_links` (`id`, `lid`, `uid`, `fid`, `pid`, `status`, `property`, `title`, `url`, `url_standby`, `weight`, `description`, `icon`, `click`, `add_time`, `up_time`, `extend`) VALUES
|
||||
@@ -134,7 +136,7 @@ CREATE TABLE IF NOT EXISTS `user_login_info` (
|
||||
`expire_time` int(10) UNSIGNED NOT NULL COMMENT '过期时间',
|
||||
`cookie_key` varchar(32) NOT NULL COMMENT 'cookie_key',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- 日志表
|
||||
DROP TABLE IF EXISTS `user_log`;
|
||||
@@ -148,7 +150,7 @@ CREATE TABLE IF NOT EXISTS `user_log` (
|
||||
`content` text NOT NULL COMMENT '请求内容',
|
||||
`description` varchar(128) NOT NULL COMMENT '描述',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='日志';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='日志';
|
||||
|
||||
-- 用户组
|
||||
DROP TABLE IF EXISTS `user_group`;
|
||||
@@ -162,7 +164,7 @@ CREATE TABLE IF NOT EXISTS `user_group` (
|
||||
`codes` text NOT NULL COMMENT '允许代号',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `code` (`code`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- 权限列表
|
||||
DROP TABLE IF EXISTS `purview_list`;
|
||||
@@ -172,7 +174,7 @@ CREATE TABLE IF NOT EXISTS `purview_list` (
|
||||
`name` varchar(64) NOT NULL COMMENT '名称',
|
||||
`description` varchar(128) NOT NULL COMMENT '描述',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
INSERT INTO `purview_list` (`code`, `name`, `description`) VALUES
|
||||
('Upload_icon', '上传图标', '允许上传分类和链接图标'),
|
||||
@@ -185,7 +187,10 @@ INSERT INTO `purview_list` (`code`, `name`, `description`) VALUES
|
||||
('link', '链接管理', '允许添加/编辑/删除链接(未勾选时只读)'),
|
||||
('apply', '收录管理', '允许使用收录功能'),
|
||||
('link_pwd', '加密管理', '允许使用加密管理(未勾选时只读)'),
|
||||
('guestbook', '留言板', '允许使用留言板功能');
|
||||
('guestbook', '留言板', '允许使用留言板功能'),
|
||||
('link_extend', '链接扩展', '允许使用链接扩展字段'),
|
||||
('theme_in', '主题设置', '后台显示主题设置菜单'),
|
||||
('theme_set', '主题配置', '允许自定义主题配置');
|
||||
|
||||
-- 注册码列表
|
||||
DROP TABLE IF EXISTS `regcode_list`;
|
||||
@@ -199,7 +204,7 @@ CREATE TABLE IF NOT EXISTS `regcode_list` (
|
||||
`use_time` int(10) UNSIGNED NOT NULL COMMENT '使用时间',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `regcode` (`regcode`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- 加密分组
|
||||
DROP TABLE IF EXISTS `user_pwd_group`;
|
||||
@@ -212,7 +217,7 @@ CREATE TABLE IF NOT EXISTS `user_pwd_group` (
|
||||
`description` varchar(128) NOT NULL DEFAULT '' COMMENT '描述',
|
||||
`display` int(1) UNSIGNED NOT NULL DEFAULT '1' COMMENT '主页显示',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- 收录申请
|
||||
DROP TABLE IF EXISTS `user_apply`;
|
||||
@@ -231,7 +236,7 @@ CREATE TABLE IF NOT EXISTS `user_apply` (
|
||||
`category_name` varchar(512) NOT NULL DEFAULT '' COMMENT '分类名',
|
||||
`description` varchar(512) NOT NULL DEFAULT '' COMMENT '描述',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- 书签分享
|
||||
DROP TABLE IF EXISTS `user_share`;
|
||||
@@ -250,5 +255,5 @@ CREATE TABLE IF NOT EXISTS `user_share` (
|
||||
`data` text NOT NULL COMMENT '数据',
|
||||
`pv` int(1) NOT NULL COMMENT '私有可见',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php if(!defined('DIR')||$global_config['RegOption']=='0'){header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit;}
|
||||
if($global_config['Maintenance'] != 0){Amsg(-1,'网站正在进行维护,请稍后再试!');}
|
||||
//注册入口
|
||||
$global_templates = unserialize(get_db("global_config",'v', ["k" => "s_templates"]));
|
||||
//如果是Get请求则载入登录模板
|
||||
@@ -14,7 +15,7 @@ if($_SERVER['REQUEST_METHOD'] === 'GET'){
|
||||
$global_templates['register'] = 'default';
|
||||
update_db("global_config", ["v" => $global_templates], ["k"=>"s_templates"]);
|
||||
}
|
||||
$copyright = empty($global_config['copyright'])?'<a target="_blank" href="https://gitee.com/tznb/twonav">Copyright © TwoNav</a>':$global_config['copyright'];
|
||||
$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>';
|
||||
$reg_tips = get_db('global_config','v',['k'=>'reg_tips']);
|
||||
require $t_path;
|
||||
@@ -55,17 +56,61 @@ if(!preg_match('/^[A-Za-z0-9]{4,13}$/', $user)){
|
||||
msg(-1,'邮箱长度超限');
|
||||
}elseif(strlen($pass)!=32){
|
||||
msg(-1,'POST提交的密码异常≠32!');
|
||||
}elseif(preg_match("/(class|controller|data|favicon|initial|static|templates|index|root|admin|cache|upload)/i",$user) ) {
|
||||
msg(-1,'禁止注册保留用户名!');
|
||||
}elseif(preg_match("/^(system|data|static|templates|index|root|admin)$/i",$user) ) {
|
||||
msg(-1,'改用户名已被系统保留!');
|
||||
}elseif(!empty(get_db('global_user','ID',['User'=>$user ]))){
|
||||
msg(-1,'该账号已被注册!');
|
||||
}elseif(!empty(get_db('global_user','ID',['Email'=>$Email ]))){
|
||||
msg(-1,'该邮箱已被使用!');
|
||||
}elseif(!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/i",$Email)){
|
||||
msg(-1,'邮箱错误!');
|
||||
}elseif(username_retain_verify($user)){
|
||||
msg(-1,'该账号已被站长保留!');
|
||||
}
|
||||
|
||||
//读取邮件配置
|
||||
$mail_config = get_db("global_config","v",["k"=>"mail_config"]);
|
||||
if(!empty($mail_config)){
|
||||
$mail_config = unserialize($mail_config);
|
||||
if($mail_config['verify_email'] == 1 && $_GET['type'] == 'getcode'){
|
||||
//判断是否频繁发送
|
||||
$send_interval = intval($mail_config['send_interval']);
|
||||
if($send_interval > 0 && has_db('user_log',['type'=>'send_email','ip'=>$IP,'time[>]'=>time() - $send_interval])){
|
||||
msg(-1,'请勿频繁获取验证码');
|
||||
}
|
||||
$mail_config['addressee'] = $_POST['Email'];
|
||||
$mail_config['Subject'] = '验证码';
|
||||
$code = mt_rand(100000,999999);
|
||||
|
||||
if(!strstr($mail_config['verify_template'],'$code')){
|
||||
$mail_config['verify_template'] = '您的验证:$code';
|
||||
}
|
||||
$mail_config['Body'] = empty($mail_config['verify_template']) ? '您的验证:'.$code:str_replace('$code', $code, $mail_config['verify_template']);
|
||||
$mail_config['return']='bool';
|
||||
if(send_email($mail_config)){
|
||||
session_start();
|
||||
$_SESSION["{$_POST['Email']}"]['code'] = "$code";
|
||||
$_SESSION["{$_POST['Email']}"]['time'] = time();
|
||||
insert_db("user_log", ["uid" => 0,"user"=>$user,"ip"=>$IP,"time"=>time(),"type" => 'send_email',"content"=>Get_Request_Content(),"description"=>"发送注册验证码:".$code.', 接收邮箱: '.$_POST['Email']]);
|
||||
msg(1,'发送成功');
|
||||
}else{
|
||||
msg(-1,'发送失败');
|
||||
}
|
||||
exit;
|
||||
}
|
||||
}
|
||||
//验证码效验
|
||||
if(!empty($mail_config['verify_email']) && $mail_config['verify_email'] == 1){
|
||||
session_start();
|
||||
if(empty($_POST['code'])){
|
||||
msg(-1,'请输入验证码');
|
||||
}elseif ($_POST['code'] != $_SESSION["{$_POST['Email']}"]['code']) {
|
||||
msg(-1,'验证码错误'.$_SESSION["{$_POST['Email']}"]['code']);
|
||||
}elseif($_SESSION["{$_POST['Email']}"]['time'] + 300 < time()){
|
||||
msg(-1,'验证码已过期');
|
||||
}
|
||||
unset($_SESSION["{$_POST['Email']}"]);
|
||||
}
|
||||
//插入用户表和创建初始数据库
|
||||
$RegTime = time();
|
||||
$PassMD5 = Get_MD5_Password($pass,$RegTime);
|
||||
@@ -153,28 +198,28 @@ insert_db("user_config", ["uid" => $USER_DB['ID'],"k"=>"s_templates","v"=>$globa
|
||||
$time = time();
|
||||
if($blueprint){
|
||||
$categorys = select_db('user_categorys','*',['uid'=>$Group['uid']]);
|
||||
$inks = select_db('user_links','*',['uid'=>$Group['uid']]);
|
||||
$links = select_db('user_links','*',['uid'=>$Group['uid']]);
|
||||
}else{
|
||||
$categorys = select_db('user_categorys','*',['uid'=>0]);
|
||||
$inks = select_db('user_links','*',['uid'=>0]);
|
||||
$links = select_db('user_links','*',['uid'=>0]);
|
||||
}
|
||||
|
||||
foreach ($categorys as $key => $data){
|
||||
$categorys[$key]['uid'] = $USER_DB['ID'];
|
||||
$categorys[$key]['add_time'] = $time;
|
||||
$categorys[$key]['up_time'] = $time;
|
||||
unset($categorys[$key]['id']);
|
||||
$data['uid'] = $USER_DB['ID'];
|
||||
$data['add_time'] = $time;
|
||||
$data['up_time'] = $time;
|
||||
unset($data['id']);
|
||||
insert_db('user_categorys',$data);
|
||||
}
|
||||
insert_db('user_categorys',$categorys);
|
||||
|
||||
|
||||
foreach ($inks as $key => $data){
|
||||
$inks[$key]['uid'] = $USER_DB['ID'];
|
||||
$inks[$key]['add_time'] = $time;
|
||||
$inks[$key]['up_time'] = $time;
|
||||
unset($inks[$key]['id']);
|
||||
foreach ($links as $key => $data){
|
||||
$data['uid'] = $USER_DB['ID'];
|
||||
$data['add_time'] = $time;
|
||||
$data['up_time'] = $time;
|
||||
unset($data['id']);
|
||||
insert_db('user_links',$data);
|
||||
}
|
||||
insert_db('user_links',$inks);
|
||||
|
||||
//写初始ID
|
||||
$link_id = intval(max_db('user_links','lid',['uid'=>$USER_DB['ID']])) +1;
|
||||
insert_db("user_config", ["uid"=>$USER_DB['ID'],"k"=>"link_id","v"=>$link_id,"t"=>"max_id","d"=>'链接ID']);
|
||||
@@ -182,6 +227,22 @@ $category_id = intval(max_db('user_categorys','cid',['uid'=>$USER_DB['ID']])) +1
|
||||
insert_db("user_config", ["uid"=>$USER_DB['ID'],"k"=>"category_id","v"=>$category_id,"t"=>"max_id","d"=>'分类ID']);
|
||||
insert_db("user_config", ["uid"=>$USER_DB['ID'],"k"=>"pwd_group_id","v"=>1,"t"=>"max_id","d"=>'加密组ID']);
|
||||
|
||||
|
||||
//账号保留
|
||||
function username_retain_verify($username){
|
||||
$list = get_db("global_config", "v", ["k" => "username_retain"]);
|
||||
if(empty($list)){
|
||||
return false;
|
||||
}
|
||||
$patterns = explode("\n", $list);
|
||||
foreach($patterns as $pattern){
|
||||
if (preg_match($pattern, $username)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//返回注册成功
|
||||
msg(1,'注册成功');
|
||||
|
||||
|
||||
12
system/SQLite/20230417.php
Normal file
12
system/SQLite/20230417.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php if(!defined('DIR')){header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit;}
|
||||
$sql =<<<EOF
|
||||
INSERT INTO `purview_list` (`code`, `name`, `description`) VALUES
|
||||
('link_extend', '链接扩展', '允许使用链接扩展字段'),
|
||||
('theme_in', '主题设置', '后台显示主题设置菜单'),
|
||||
('theme_set', '主题配置', '允许自定义主题配置');
|
||||
EOF;
|
||||
if(exe_sql($sql)){
|
||||
insert_db('updatadb_logs',['file_name'=>$file_name,'update_time'=>time(),'status'=>'TRUE','extra'=>'']);
|
||||
}else{
|
||||
msg(-1,'数据库更新失败');
|
||||
}
|
||||
23
system/SQLite/20230420.php
Normal file
23
system/SQLite/20230420.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php if(!defined('DIR')){header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit;}
|
||||
//弥补主题配置目录名相同造成的窜数据的bug
|
||||
//复制主题配置,并重新标记t类型
|
||||
// 'theme_home','theme_login','theme_transit','theme_register';
|
||||
|
||||
$datas = select_db('user_config','*',['t'=>'theme']);
|
||||
foreach ($datas as $data) {
|
||||
$name = $data['k'];
|
||||
unset($data['id']);
|
||||
if($name == 'default'){
|
||||
$data['t'] = 'theme_transit';
|
||||
insert_db('user_config',$data);
|
||||
}
|
||||
if($name == 'WebStack-Hugo'){
|
||||
$data['t'] = 'theme_transit';
|
||||
insert_db('user_config',$data);
|
||||
}
|
||||
$data['t'] = 'theme_home';
|
||||
insert_db('user_config',$data);
|
||||
}
|
||||
|
||||
insert_db('updatadb_logs',['file_name'=>$file_name,'update_time'=>time(),'status'=>'TRUE','extra'=>'']);
|
||||
delete_db('user_config',['t'=>'theme']);
|
||||
@@ -35,6 +35,8 @@ CREATE TABLE IF NOT EXISTS "updatadb_logs" (
|
||||
"extra" TEXT(512) NOT NULL DEFAULT "",
|
||||
CONSTRAINT "file_name" UNIQUE ("file_name" ASC)
|
||||
);
|
||||
INSERT INTO "updatadb_logs" ("file_name", "update_time", "status", "extra") VALUES ('20230417.php', '1681719049', 'TRUE', '');
|
||||
INSERT INTO "updatadb_logs" ("file_name", "update_time", "status", "extra") VALUES ('20230420.php', '1681977368', 'TRUE', '');
|
||||
|
||||
-- 创建用户表
|
||||
CREATE TABLE IF NOT EXISTS "global_user" (
|
||||
@@ -158,7 +160,10 @@ INSERT INTO `purview_list` (`code`, `name`, `description`) VALUES
|
||||
('link', '链接管理', '允许添加/编辑/删除链接(未勾选时只读)'),
|
||||
('apply', '收录管理', '允许使用收录功能'),
|
||||
('link_pwd', '加密管理', '允许使用加密管理(未勾选时只读)'),
|
||||
('guestbook', '留言板', '允许使用留言板功能');
|
||||
('guestbook', '留言板', '允许使用留言板功能'),
|
||||
('link_extend', '链接扩展', '允许使用链接扩展字段'),
|
||||
('theme_in', '主题设置', '后台显示主题设置菜单'),
|
||||
('theme_set', '主题配置', '允许自定义主题配置');
|
||||
|
||||
-- 注册码列表
|
||||
CREATE TABLE IF NOT EXISTS "regcode_list" (
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php if(!defined('DIR')){header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit;}
|
||||
<?php if(!defined('DIR')){header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit;}AccessControl();
|
||||
|
||||
//获取请求参数
|
||||
$page = trim($_GET['page']);
|
||||
@@ -53,32 +53,8 @@ if ($page == 'home') {
|
||||
array_push($day_data[0]['data'],get_db('user_count','v',['uid'=>UID,'k'=>$date,'t'=>'index_Ymd'])??0);
|
||||
array_push($day_data[1]['data'],get_db('user_count','v',['uid'=>UID,'k'=>$date,'t'=>'click_Ymd'])??0);
|
||||
}
|
||||
//var_dump(json_encode($day),$day_data);
|
||||
}
|
||||
|
||||
//调试
|
||||
if( $page == 'test' ) {
|
||||
$dirs = getDir(DIR.'/templates/home');
|
||||
//var_dump($dirs);
|
||||
foreach ($dirs as $dir) {
|
||||
$path = DIR.'/templates/home/'.$dir; //目录完整路径
|
||||
//没有信息文件则跳过
|
||||
if(!is_file($path.'/info.json') ) {continue;}
|
||||
//读取主题信息
|
||||
$themes[$dir]['info'] = json_decode(@file_get_contents($path.'/info.json'),true);
|
||||
//是否支持配置
|
||||
$themes[$dir]['info']['config'] = is_file($path.'/config.php') ? '1':'0';
|
||||
//预览图优先顺序:png>jpg>info>default
|
||||
if(is_file($dirs.'/screenshot.png')){
|
||||
$themes[$dir]['info']['screenshot'] = "./templates/home/".$dir."/screenshot.png";
|
||||
}elseif(is_file($dirs.'/screenshot.jpg')){
|
||||
$themes[$dir]['info']['screenshot'] = "./templates/home/".$dir."/screenshot.jpg";
|
||||
}elseif(empty($themes[$dir]['info']['screenshot'])){
|
||||
$themes[$dir]['info']['screenshot'] = "./templates/admin/static/42ed3ef2c4a50f6d.png";
|
||||
}
|
||||
//var_dump($themes);
|
||||
}
|
||||
}
|
||||
//载入主题配置
|
||||
if($page == 'config_home'){
|
||||
$theme = $_GET['theme'];
|
||||
@@ -92,7 +68,10 @@ if($page == 'config_home'){
|
||||
$theme_config = empty($theme_config['config']) ? []:$theme_config['config'];
|
||||
|
||||
//读取用户主题配置
|
||||
$theme_config_db = get_db('user_config','v',['t'=>'theme','k'=>$theme,'uid'=>UID]);
|
||||
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]);
|
||||
$theme_config_db = unserialize($theme_config_db);
|
||||
|
||||
//如果不为空则合并数据
|
||||
@@ -100,18 +79,21 @@ 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>");
|
||||
}
|
||||
//var_dump($theme_config);
|
||||
require $config_path;
|
||||
exit;
|
||||
}
|
||||
|
||||
//主题设置页面
|
||||
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 = getDir(DIR.'/templates/'.$fn);
|
||||
$dirs = get_dir_list(DIR.'/templates/'.$fn);
|
||||
|
||||
foreach ($dirs as $dir) {
|
||||
$path = DIR.'/templates/'.$fn.'/'.$dir; //目录完整路径
|
||||
@@ -129,7 +111,6 @@ if( $page == 'theme_home' || $page == 'theme_login' || $page == 'theme_transit'
|
||||
}elseif(empty($themes[$dir]['info']['screenshot'])){
|
||||
$themes[$dir]['info']['screenshot'] = "./templates/admin/static/42ed3ef2c4a50f6d.png";
|
||||
}
|
||||
//var_dump($themes);
|
||||
}
|
||||
|
||||
//获取当前主题
|
||||
@@ -191,15 +172,19 @@ if( $page == 'theme_home' || $page == 'theme_login' || $page == 'theme_transit'
|
||||
define('referrer',$data['referrer']);
|
||||
}
|
||||
}
|
||||
//var_dump($themes);exit;
|
||||
}
|
||||
|
||||
|
||||
//菜单接口
|
||||
if ($page == 'menu') {
|
||||
$menu = array(
|
||||
['title'=>'站点设置','href'=>'SiteSetting','icon'=>'fa fa-cog'],
|
||||
['title'=>'主题设置','href'=>'theme_home','icon'=>'fa fa-magic'],
|
||||
$menu = [];
|
||||
if(check_purview('site_info',1)){
|
||||
array_push($menu,['title'=>'站点设置','href'=>'SiteSetting','icon'=>'fa fa-cog']);
|
||||
}
|
||||
if(check_purview('theme_in',1)){
|
||||
array_push($menu,['title'=>'主题设置','href'=>'theme_home','icon'=>'fa fa-magic']);
|
||||
}
|
||||
array_push($menu,
|
||||
['title'=>'分类管理','href'=>'category_list','icon'=>'fa fa-list-ul'],
|
||||
['title'=>'加密管理','href'=>'pwd_group','icon'=>'fa fa-lock'],
|
||||
['title'=>'链接管理','icon'=>'fa fa-folder-open-o','href'=>'','child'=>
|
||||
@@ -225,7 +210,6 @@ if ($page == 'menu') {
|
||||
array_push($menu,$extend);
|
||||
}
|
||||
|
||||
|
||||
//如果是管理员则追加菜单
|
||||
if($USER_DB['UserGroup'] == 'root'){
|
||||
array_push($menu,
|
||||
@@ -246,7 +230,6 @@ if ($page == 'menu') {
|
||||
exit(json_encode($init));
|
||||
}
|
||||
|
||||
|
||||
//不带参数是载入框架
|
||||
if(empty($page)){
|
||||
$site = unserialize(get_db('user_config','v',['uid'=>UID,'k'=>'s_site']));
|
||||
@@ -266,7 +249,6 @@ if(!empty($page)){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//加载静态库
|
||||
function load_static($type){
|
||||
if($type == 'css'){
|
||||
|
||||
150
system/api.php
150
system/api.php
@@ -2,7 +2,7 @@
|
||||
//允许跨域访问
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
header("Access-Control-Allow-Headers: Access-Control-Allow-Private-Network,Content-Type, AccessToken, X-CSRF-Token, Authorization, Token,X-Token,X-Cid");
|
||||
|
||||
AccessControl();
|
||||
//鉴权验证 Cookie验证通过,验证二级密码,Cookie验证失败时尝试验证token
|
||||
|
||||
//获取请求方法
|
||||
@@ -44,8 +44,10 @@ if(!is_login()){
|
||||
}else{
|
||||
msg(-1,'请先验证二级密码!');
|
||||
}
|
||||
|
||||
|
||||
//是否加载扩展API
|
||||
if($global_config['api_extend'] == 1 && is_file('./system/api_extend.php')){
|
||||
require './system/api_extend.php';
|
||||
}
|
||||
|
||||
//站长相关方法名
|
||||
$root = ['write_subscribe','write_sys_settings','write_default_settings','read_user_list','write_user_info','read_purview_list','read_users_list','write_users','read_regcode_list','write_regcode','other_upsys','read_log','other_root'];
|
||||
@@ -282,6 +284,18 @@ function write_category(){
|
||||
|
||||
//读链接列表
|
||||
function read_link_list(){
|
||||
if($_GET['type'] == 'extend_list'){
|
||||
if($GLOBALS['global_config']['link_extend'] != 1 || !check_purview('link_extend',1)){
|
||||
msgA(['code'=>1,'msg'=>'无权限','count'=>0,'data'=>[]]);
|
||||
}
|
||||
$list = get_db("user_config","v",["k"=>"s_extend_list","uid"=>UID]);
|
||||
if(empty($list)){
|
||||
msgA(['code'=>1,'msg'=>'无数据','count'=>0,'data'=>[]]);
|
||||
}
|
||||
$list = unserialize($list);
|
||||
msgA(['code'=>1,'msg'=>'获取成功','count'=>count($list),'data'=>$list]);
|
||||
}
|
||||
|
||||
$query = $_POST['query'];
|
||||
$fid = intval(@$_POST['fid']); //获取分类ID
|
||||
$page = empty(intval($_REQUEST['page'])) ? 1 : intval($_REQUEST['page']);
|
||||
@@ -541,6 +555,22 @@ function write_link(){
|
||||
'icon' => $icon
|
||||
];
|
||||
|
||||
//扩展字段
|
||||
if($GLOBALS['global_config']['link_extend'] == 1 && check_purview('link_extend',1)){
|
||||
$list = get_db("user_config","v",["k"=>"s_extend_list","uid"=>UID]);
|
||||
if(!empty($list)){
|
||||
$list = unserialize($list);
|
||||
$extend = [];
|
||||
foreach($list as $field){
|
||||
$name = "_{$field['name']}";
|
||||
if(isset($_POST[$name])){
|
||||
$data['extend'][$name] = $_POST[$name];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//非必须参数,未传递参数时
|
||||
if(isset($_POST['icon'])){
|
||||
//指定本地图标时检测是否存在
|
||||
@@ -641,12 +671,86 @@ function write_link(){
|
||||
if(empty($fid)){msg(-1,'分类ID错误');}
|
||||
//加一个查找分类是否存在
|
||||
update_db('user_links',['fid'=>$fid],['uid'=>UID ,"lid" => json_decode($_POST['lid']) ],[1,'设置成功']);
|
||||
//图标拉取(不完善,未开放使用)
|
||||
}elseif($_GET['type'] === 'icon_pull'){
|
||||
$link = get_db('user_links','url',['uid'=>UID,'lid'=>$_POST['id']]);
|
||||
if(empty($link)){
|
||||
msg(-1,'请求的链接id不存在');
|
||||
}
|
||||
$s_site = unserialize(get_db("user_config","v",["k"=>"s_site","uid"=>UID]));
|
||||
if(empty($s_site['link_icon']) || $s_site['link_icon'] == 0){
|
||||
msg(-1,'站点设置链接图标不能是离线图标!请先修改配置!');
|
||||
}
|
||||
$icon = $s_site['link_icon'];
|
||||
if($icon ==2){
|
||||
function base64($url){
|
||||
$urls = parse_url($url);
|
||||
$scheme = empty( $urls['scheme'] ) ? 'http://' : $urls['scheme'].'://'; //获取请求协议
|
||||
$host = $urls['host']; //获取主机名
|
||||
$port = empty( $urls['port'] ) ? '' : ':'.$urls['port']; //获取端口
|
||||
$new_url = $scheme.$host.$port;
|
||||
return base64_encode($new_url);
|
||||
}
|
||||
$api = 'https://favicon.rss.ink/v1/'.base64($link);
|
||||
}elseif($icon ==4){
|
||||
$api = 'https://api.15777.cn/get.php?url='.$link;
|
||||
}elseif($icon ==5){
|
||||
$api = 'https://favicon.cccyun.cc/'.$link;
|
||||
}elseif($icon ==6){
|
||||
$api = 'https://api.iowen.cn/favicon/'.parse_url($link)['host'].'.png';
|
||||
}elseif($icon ==7){
|
||||
$api = 'https://toolb.cn/favicon/'.parse_url($link)['host'];
|
||||
}
|
||||
if(downFile($api,$_POST['id'].'.ico',DIR ."/data/user/".U."/favicon/")){
|
||||
update_db('user_links',['icon'=>"./data/user/".U.'/favicon/'.$_POST['id'].'.ico'],['uid'=>UID ,"lid" => $_POST['id'] ],[1,'获取成功']);
|
||||
}
|
||||
msg(-1,'获取失败');
|
||||
|
||||
}elseif($_GET['type'] == 'extend_list'){
|
||||
if($GLOBALS['global_config']['link_extend'] != 1 ||!check_purview('link_extend',1)){
|
||||
msg(-1,'无权限');
|
||||
}
|
||||
$lists = json_decode($_POST['list'],true);
|
||||
|
||||
$weight = [];
|
||||
foreach ($lists as $data ){
|
||||
if(empty($data['weight']) || !preg_match('/^\d$/', $data['weight'])){
|
||||
msgA( ['code' => -1,'msg' => '序号错误,请输入正整数'] );
|
||||
}
|
||||
if(empty($data['title']) || check_xss($data['title'])){
|
||||
msgA( ['code' => -1,'msg' => '标题不能为空'] );
|
||||
}
|
||||
if(empty($data['name']) || check_xss($data['name']) || !preg_match('/^[A-Za-z0-9]{3,18}$/',$data['name'])){
|
||||
msgA( ['code' => -1,'msg' => '字段名错误,请输入长度3-18的字母/数字'] );
|
||||
}
|
||||
if(!in_array($data['type'],['text','textarea'])){
|
||||
msgA( ['code' => -1,'msg' => '类型错误'] );
|
||||
}
|
||||
}
|
||||
if(is_Duplicated($lists,'weight')){
|
||||
msg(-1,'序号不能重复');
|
||||
}elseif(is_Duplicated($lists,'title')){
|
||||
msg(-1,'标题不能重复');
|
||||
}elseif(is_Duplicated($lists,'name')){
|
||||
msg(-1,'字段名不能重复');
|
||||
}
|
||||
|
||||
$datas = [];
|
||||
foreach ($lists as $key => $data ){
|
||||
array_push($datas,['title'=>$data['title'],'name'=>$data['name'],'weight'=>$data['weight'],'type'=>$data['type'],'default'=> "{$data['default']}"]);
|
||||
}
|
||||
//根据序号排序
|
||||
usort($datas, function($a, $b) {
|
||||
return $a['weight'] - $b['weight'];
|
||||
});
|
||||
write_user_config('s_extend_list',$datas,'config','链接扩展字段');
|
||||
msgA( ['code' => 1,'msg' => '保存成功','datas'=>$datas] );
|
||||
}
|
||||
|
||||
|
||||
|
||||
msg(-1,'操作类型错误');
|
||||
}
|
||||
|
||||
|
||||
//写安全设置
|
||||
function write_security_setting(){
|
||||
global $USER_DB;
|
||||
@@ -844,8 +948,11 @@ function write_site_setting(){
|
||||
'keywords'=>['empty'=>true],
|
||||
'description'=>['empty'=>true],
|
||||
'link_model'=>['v'=>['direct','Privacy','Privacy_js','Privacy_meta','301','302','Transition'],'msg'=>'链接模式参数错误'],
|
||||
'link_icon'=>['int'=>true,'min'=>0,'max'=>6,'msg'=>'链接图标参数错误'],
|
||||
'link_icon'=>['int'=>true,'min'=>0,'max'=>10,'msg'=>'链接图标参数错误'],
|
||||
'site_icon'=>['empty'=>true],
|
||||
'top_link'=>['int'=>true,'min'=>0,'max'=>20,'msg'=>'热门链接参数错误'],
|
||||
'new_link'=>['int'=>true,'min'=>0,'max'=>20,'msg'=>'最新链接参数错误'],
|
||||
'max_link'=>['int'=>true,'min'=>0,'max'=>100,'msg'=>'输出上限参数错误'],
|
||||
'custom_header'=>['empty'=>true],
|
||||
'custom_footer'=>['empty'=>true]
|
||||
];
|
||||
@@ -865,6 +972,7 @@ function write_site_setting(){
|
||||
//留空时尝试删除图标
|
||||
if(empty($s_site['site_icon']) && !empty($site['site_icon_file']) && is_file($site['site_icon_file'])){
|
||||
@unlink($site['site_icon_file']);
|
||||
$s_site['site_icon_file'] = '';
|
||||
}
|
||||
update_db("user_config",["v"=>$s_site],["k"=>'s_site',"uid"=>UID],[1,'保存成功']);
|
||||
}
|
||||
@@ -992,13 +1100,16 @@ function other_testing_link(){
|
||||
global $global_config;
|
||||
if ( $global_config['offline'] == '1'){ msg(-1,"离线模式无法使用此功能"); }
|
||||
$code = get_http_code($_POST['url']);
|
||||
if($code != 200 && $code != 302 && $code != 301){
|
||||
$code = ccurl($_POST['url'])['code'];
|
||||
}
|
||||
msgA(['code' => 0 ,'StatusCode'=> $code]);
|
||||
}
|
||||
|
||||
//主题下载/更新/删除
|
||||
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,"离线模式禁止下载主题!");} //离线模式
|
||||
@@ -1085,13 +1196,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";
|
||||
//判断设置的类型
|
||||
@@ -1113,19 +1227,37 @@ 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,'设置成功']);
|
||||
|
||||
//配置主题信息
|
||||
}elseif($_GET['type'] == 'config'){
|
||||
if(!check_purview('theme_set',1)){
|
||||
msg(-1,"无权限!");
|
||||
}
|
||||
if(empty($_POST)){
|
||||
msg(-1,"POST请求数据不能为空!");
|
||||
}
|
||||
write_user_config($_GET['t'],$_POST,'theme','主题配置');
|
||||
//20230420,修复同名窜数据的问题!由于保存主题不提交模板类型,只能从来路中提取
|
||||
parse_str(parse_url($_SERVER['HTTP_REFERER'])['query'],$GET);
|
||||
if(empty($GET['fn']) && empty($_GET['template_type']) ){
|
||||
msg(-1,"获取模板类型错误");
|
||||
}
|
||||
$fn = empty($GET['fn']) ? $_GET['template_type'] : $GET['fn'];
|
||||
if(!in_array($fn,['home','login','register','transit','guide'])){
|
||||
msg(-1,"参数错误");
|
||||
}
|
||||
//0420 END
|
||||
write_user_config($_GET['t'],$_POST,'theme_' . $fn,'主题配置');
|
||||
msg(1,"保存成功!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//读登录信息
|
||||
function read_login_info(){
|
||||
$page = empty(intval($_REQUEST['page'])) ? 1 : intval($_REQUEST['page']);
|
||||
|
||||
@@ -25,13 +25,15 @@ function other_upsys(){
|
||||
if(!preg_match('/^v.+-(\d{8})$/i',SysVer,$matches)){
|
||||
msg(-1,"获取程序版本异常");
|
||||
}
|
||||
if (!is_dir('./data/temp')) mkdir('./data/temp',0755,true) or msg(-1,'下载失败,创建临时[/data/temp]目录失败');
|
||||
//检查指定文件夹是否可写
|
||||
$paths = ["./","./data","./static","./system","./templates"];
|
||||
$paths = ["./","./data","./data/temp","./static","./system","./templates"];
|
||||
foreach($paths as $path){
|
||||
if(!is_writable($path)){
|
||||
msg(-1,"文件夹不可写 >> $path");
|
||||
}
|
||||
}
|
||||
|
||||
$_SESSION['upsys']['sysver'] = intval($matches[1]);
|
||||
usleep(1000*300); //延迟300毫秒
|
||||
msg(1,'success');
|
||||
@@ -40,9 +42,9 @@ function other_upsys(){
|
||||
if($_POST['i'] == 2){
|
||||
if(!is_subscribe('bool')){
|
||||
msg(-1,'未检测到有效授权,请
|
||||
<a href="https://gitee.com/tznb/OneNav/wikis/%E8%AE%A2%E9%98%85%E6%9C%8D%E5%8A%A1%E6%8C%87%E5%BC%95" target="_blank" style="color: #01AAED;">购买授权</a>
|
||||
<a href="https://gitee.com/tznb/TwoNav/wikis/pages?sort_id=7968669&doc_id=3767990" target="_blank" style="color: #01AAED;">购买授权</a>
|
||||
或
|
||||
<a href="https://gitee.com/tznb/TwoNav/releases" target="_blank" style="color: #01AAED;">手动更新</a>');
|
||||
<a href="https://gitee.com/tznb/TwoNav/wikis/pages?sort_id=8013447&doc_id=3767990" target="_blank" style="color: #01AAED;">手动更新</a>');
|
||||
}
|
||||
//设置执行最长时间,0为无限制。单位秒!
|
||||
set_time_limit(5*60);
|
||||
@@ -319,10 +321,25 @@ function write_user_info(){
|
||||
//删除
|
||||
case "Del":
|
||||
$uids = json_decode($_POST['ID']);
|
||||
$USER_S = select_db('global_user','User',['ID'=>$uids]);
|
||||
foreach($USER_S as $USER){
|
||||
if(is_dir(DIR.'/data/user/'.$USER)){
|
||||
deldir(DIR.'/data/user/'.$USER);
|
||||
if(is_dir(DIR.'/data/user/'.$USER)){
|
||||
msg(1,'删除用户数据目录失败,用户名:'.$USER);
|
||||
}
|
||||
}
|
||||
if(is_dir(DIR.'/data/backup/'.$USER)){
|
||||
deldir(DIR.'/data/backup/'.$USER);
|
||||
if(is_dir(DIR.'/data/backup/'.$USER)){
|
||||
msg(1,'删除用户备份目录失败,用户名:'.$USER);
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (['regcode_list','user_categorys','user_config','user_count','user_links','user_log','user_login_info'] as $table){
|
||||
delete_db($table,[ "uid" => $uids ]);
|
||||
}
|
||||
delete_db('global_user',["ID" => json_decode($_POST['ID']) ]);
|
||||
delete_db('global_user',["ID" => $uids]);
|
||||
msg(1,'删除成功');
|
||||
break;
|
||||
//设用户组
|
||||
@@ -420,6 +437,9 @@ function write_regcode(){
|
||||
}elseif($_GET['type'] == 'set'){
|
||||
write_global_config('reg_tips',$_POST['content'],'注册提示');
|
||||
msg(1,'保存成功');
|
||||
}elseif($_GET['type'] == 'del'){
|
||||
delete_db("regcode_list",[ "id" => json_decode($_POST['id'])]);
|
||||
msg(1,'删除成功');
|
||||
}
|
||||
|
||||
msg(-1,'无效的请求类型');
|
||||
@@ -494,12 +514,16 @@ function write_sys_settings(){
|
||||
'Debug'=>['int'=>true,'min'=>0,'max'=>1,'msg'=>'调试模式参数错误'],
|
||||
'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],
|
||||
'api_extend'=>['empty'=>true],
|
||||
//扩展功能-(全局开关)
|
||||
'apply'=>['int'=>true,'min'=>0,'max'=>1,'msg'=>'收录管理参数错误'],
|
||||
'guestbook'=>['int'=>true,'min'=>0,'max'=>1,'msg'=>'留言管理参数错误'],
|
||||
'link_extend'=>['int'=>true,'min'=>0,'max'=>1,'msg'=>'链接扩展参数错误'],
|
||||
];
|
||||
$o_config = [];
|
||||
foreach ($datas as $key => $data){
|
||||
@@ -513,11 +537,13 @@ function write_sys_settings(){
|
||||
}
|
||||
if(!is_subscribe('bool')){
|
||||
if($_POST['Sub_domain'] == 1){$o_config['Sub_domain'] = 0;$filter = true;}
|
||||
if($_POST['Privacy'] == 1){$o_config['Privacy'] = 0;$filter = true;}
|
||||
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(!empty($_POST['apply'])){$o_config['apply'] = 0;$filter = true;}
|
||||
if(!empty($_POST['guestbook'])){$o_config['guestbook'] = 0;$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;}
|
||||
}
|
||||
|
||||
update_db("global_config", ["v" => $o_config], ["k" => "o_config"],[1,($filter ?"保存成功,未检测到有效授权,带*号的配置无法为你保存":"保存成功")]);
|
||||
@@ -599,6 +625,7 @@ function read_log(){
|
||||
$count = count_db('user_log',$where);
|
||||
//分页
|
||||
$where['LIMIT'] = [$offset,$limit];
|
||||
$where['ORDER']['id'] = 'DESC';
|
||||
//查询
|
||||
$datas = select_db('user_log','*',$where);
|
||||
//返回
|
||||
@@ -625,6 +652,54 @@ function other_root(){
|
||||
msg(1,'已释放 '.byteFormat($size).' 缓存');
|
||||
}elseif($_GET['type'] == 'import_data'){
|
||||
require DIR .'/system/UseFew/root_import_data.php';
|
||||
}elseif($_GET['type'] == 'read_username_retain'){
|
||||
$data = get_db("global_config", "v", ["k" => "username_retain"]);
|
||||
msgA(['code'=>1,'msg'=>'获取成功','data'=>$data]);
|
||||
}elseif($_GET['type'] == 'write_username_retain'){
|
||||
//遍历检测语法
|
||||
$patterns = explode("\n",$_POST['username_retain']);
|
||||
foreach($patterns as $pattern){
|
||||
if (@preg_match($pattern, '') === false) {
|
||||
msg(-1,'正则表达式语法错误,请检查');
|
||||
}
|
||||
}
|
||||
if(!is_subscribe('bool')){
|
||||
msg(-1,'未检测到有效授权');
|
||||
}
|
||||
write_global_config('username_retain',$_POST['username_retain'],'账号保留');
|
||||
msg(1,'保存成功');
|
||||
}elseif($_GET['type'] == 'write_mail_config'){
|
||||
if($GLOBALS['global_config']['offline'] == '1'){msg(-1,"离线模式无法使用此功能");}
|
||||
if(!is_subscribe('bool')){msg(-1,"未检测到有效授权,无法使用该功能!");}
|
||||
//检测PHPMailer是否存在
|
||||
clearstatcache();
|
||||
if(!is_file(DIR.'/system/PHPMailer/PHPMailer.php')){
|
||||
$filePath = "./data/temp/PHPMailer_6.8.0.tar.gz";
|
||||
if(downFile('https://update.lm21.top/TwoNav/updata/PHPMailer_6.8.0.tar.gz','PHPMailer_6.8.0.tar.gz','./data/temp/')){
|
||||
$file_md5 = md5_file($filePath);
|
||||
if($file_md5 != "07251997fb7ebf3bf2d296d4214ccf0a"){
|
||||
unlink($filePath);
|
||||
msg(-1,'效验PHPMailer失败<br/>!');
|
||||
}
|
||||
}else{
|
||||
msg(-1,'下载PHPMailer失败,请重试!<br/>如需手动安装可联系技术支持!');
|
||||
}
|
||||
try {
|
||||
$phar = new PharData($filePath);
|
||||
$phar->extractTo('./system/', null, true);
|
||||
unlink($filePath);
|
||||
clearstatcache();
|
||||
} catch (Exception $e) {
|
||||
msg(-1,'安装PHPMailer失败');
|
||||
}
|
||||
}
|
||||
write_global_config('mail_config',$_POST,'账号保留');
|
||||
msg(1,'保存成功');
|
||||
}elseif($_GET['type'] == 'write_mail_test'){
|
||||
$_POST['Subject'] = 'TwoNav 测试邮件' . time();
|
||||
$_POST['Body'] = '<h1>TwoNav 测试邮件</h1>' . date('Y-m-d H:i:s');
|
||||
send_email($_POST);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php if(!defined('DIR')){Not_Found();}
|
||||
<?php if(!defined('DIR')){Not_Found();}AccessControl();
|
||||
//负责过渡页/跳转/隐私保护/密码访问
|
||||
$id = intval($_GET['id']);
|
||||
|
||||
@@ -8,17 +8,20 @@ if(empty($id)){Not_Found();}
|
||||
//查询链接信息
|
||||
$where['lid'] = $id;
|
||||
$where['uid'] = UID;
|
||||
//$where['status'] = 1;
|
||||
$where['status'] = 1;
|
||||
$link = get_db('user_links','*',$where);
|
||||
|
||||
//查找失败时显示404
|
||||
if(empty($link)){
|
||||
Not_Found();
|
||||
}
|
||||
if(empty($link)){Not_Found();}
|
||||
|
||||
//站点设置和站点图标
|
||||
$site = unserialize(get_db('user_config','v',['uid'=>UID,'k'=>'s_site']));
|
||||
$site['Title'] = $site['title'].(empty($site['subtitle'])?'':' - '.$site['subtitle']);
|
||||
//免费用户请保留版权,谢谢!
|
||||
$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';
|
||||
|
||||
|
||||
//取登录状态
|
||||
$is_login = is_login();
|
||||
|
||||
@@ -39,7 +42,6 @@ if(!$is_login){
|
||||
$pv = empty($share['pwd']) || $_SESSION['verify']['share'][$share['id']] == $share['pwd'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//判断链接是否停用/私有
|
||||
if($link['status'] == 0){
|
||||
@@ -64,7 +66,6 @@ if(!$is_login){
|
||||
exit('很抱歉,页面所属的祖分类是私有的!您无权限查看,如果您是管理员,请先登录!');
|
||||
}
|
||||
|
||||
|
||||
//判断链接是否加密
|
||||
if(!empty($link['pid'])){
|
||||
$verify_type = 'link_pwd';
|
||||
@@ -94,9 +95,6 @@ if(!$is_login){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//取模板信息
|
||||
require DIR ."/system/templates.php";
|
||||
$dir_path = DIR.'/templates/transit/'.$s_templates['transit'];
|
||||
@@ -107,36 +105,28 @@ if(!is_file($transit_path)){
|
||||
$transit_path= DIR.'/templates/transit/default/index.php';
|
||||
}
|
||||
|
||||
//免费用户请保留版权,谢谢!
|
||||
$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>';
|
||||
|
||||
//读取站点配置
|
||||
$s_site = unserialize(get_db("user_config","v",["k"=>"s_site","uid"=>UID]));
|
||||
|
||||
//var_dump($link,$transit_path,$category_parent,$category_ancestor,$s_site);
|
||||
|
||||
//统计点击数
|
||||
write_user_count(date('Ym'),'click_Ym');
|
||||
write_user_count(date('Ymd'),'click_Ymd');
|
||||
update_db("user_links", ["click[+]"=>1],['uid'=>UID,'lid'=>$id]);
|
||||
|
||||
//读取过渡页设置
|
||||
$transition_page = unserialize(get_db("user_config","v",["t"=>"config","k"=>"s_transition_page","uid"=>UID]));
|
||||
|
||||
//载入站点设置
|
||||
$site = unserialize(get_db('user_config','v',['uid'=>UID,'k'=>'s_site']));
|
||||
|
||||
//读取用户主题配置
|
||||
$theme_config_db = unserialize(get_db('user_config','v',['t'=>'theme','k'=>$s_templates['transit'],'uid'=>UID]));
|
||||
$theme_config_db = unserialize(get_db('user_config','v',['t'=>'theme_transit','k'=>$s_templates['transit'],'uid'=>UID]));
|
||||
|
||||
//读取默认主题配置
|
||||
$theme_info = json_decode(@file_get_contents($dir_path.'/info.json'),true);
|
||||
$theme_config = empty($theme_info['config']) ? []:$theme_info['config'];
|
||||
$theme_ver = !Debug?$theme_info['version']:$theme_info['version'].'.'.time();
|
||||
|
||||
//合并配置数据
|
||||
$theme_config = empty($theme_config_db) ? $theme_config : array_merge ($theme_config??[],$theme_config_db??[]);
|
||||
|
||||
//如果主题信息声明支持扩展字段
|
||||
if($global_config['link_extend'] == 1 && check_purview('link_extend',1) && in_array($theme_info['support']['link_extend'],["true","1"])){
|
||||
$extend = empty($link['extend']) ? [] : unserialize($link['extend']);
|
||||
}
|
||||
|
||||
//如果存在备用链接,则强制载入过渡页
|
||||
if(!empty($link['url_standby'])) {
|
||||
@@ -145,24 +135,24 @@ if(!empty($link['url_standby'])) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($s_site['link_model'] == '302'){ //302重定向
|
||||
if ($site['link_model'] == '302'){ //302重定向
|
||||
header("HTTP/1.1 302 Moved Permanently");
|
||||
header("Location: ".$link['url']);
|
||||
exit;
|
||||
}elseif($s_site['link_model'] == '301'){ //301重定向
|
||||
}elseif($site['link_model'] == '301'){ //301重定向
|
||||
header("HTTP/1.1 301 Moved Permanently");
|
||||
header("Location: ".$link['url']);
|
||||
exit;
|
||||
}elseif($s_site['link_model'] == 'Privacy'){ //隐私保护_header
|
||||
}elseif($site['link_model'] == 'Privacy'){ //隐私保护_header
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
header("Refresh:0;url=".$link['url']);
|
||||
echo '<html lang="zh-ch"><head><title>正在保护您的隐私..</title><meta name="referrer" content="same-origin"></head>';
|
||||
exit;
|
||||
}elseif($s_site['link_model'] == 'Privacy_js'){ //隐私保护_js
|
||||
}elseif($site['link_model'] == 'Privacy_js'){ //隐私保护_js
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
echo '<html lang="zh-ch"><head><title>正在保护您的隐私..</title><meta name="referrer" content="same-origin"><script>window.location.href="'.$link['url'].'"</script></head>';
|
||||
exit;
|
||||
}elseif($s_site['link_model'] == 'Privacy_meta'){ //隐私保护_meta
|
||||
}elseif($site['link_model'] == 'Privacy_meta'){ //隐私保护_meta
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
echo '<html lang="zh-ch"><head><title>正在保护您的隐私..</title><meta name="referrer" content="same-origin"><meta http-equiv="refresh" content="0;url='.$link['url'].'"></head>';
|
||||
exit;
|
||||
|
||||
170
system/index.php
170
system/index.php
@@ -1,26 +1,46 @@
|
||||
<?php if(!defined('DIR')){header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit;}
|
||||
<?php if(!defined('DIR')){header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit;}AccessControl();
|
||||
//主页入口
|
||||
define('is_login',is_login());
|
||||
//var_dump($global_config['offline']);
|
||||
|
||||
//判断用户组,是否允许未登录时访问主页
|
||||
if(!is_login && !check_purview('Common_home',1)){
|
||||
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;
|
||||
}
|
||||
//载入站点设置
|
||||
$site = unserialize(get_db('user_config','v',['uid'=>UID,'k'=>'s_site']));
|
||||
$site['Title'] = $site['title'].(empty($site['subtitle'])?'':' - '.$site['subtitle']);
|
||||
//免费用户请保留版权,谢谢!
|
||||
$copyright = empty($global_config['copyright'])?'<a target="_blank" href="https://gitee.com/tznb/twonav">Copyright © TwoNav</a>':$global_config['copyright'];
|
||||
$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{
|
||||
@@ -44,13 +64,13 @@ $support_category_svg = $theme_info['support']['category_svg']??0; //0.不支持
|
||||
//主题配置(默认)
|
||||
$theme_config = empty($theme_info['config']) ? []:$theme_info['config'];
|
||||
//主题配置(用户)
|
||||
$theme_config_db = get_db('user_config','v',['t'=>'theme','k'=>$theme,'uid'=>UID]);
|
||||
$theme_config_db = get_db('user_config','v',['t'=>'theme_home','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);
|
||||
//主题版本(调试时追加时间戳)
|
||||
$theme_ver = !Debug?$theme_info['version']:$theme_info['version'].'.'.time();
|
||||
|
||||
$site['ex_theme'] = in_array($theme,['snail-nav','heimdall']); //例外主题,不支持热门网址/最新网址/输出上限
|
||||
//分类查找条件
|
||||
$categorys = []; //声明一个空数组
|
||||
$content = ['cid(id)','name','property','font_icon','icon','description'];//需要的内容
|
||||
@@ -69,7 +89,11 @@ $fid_s = array_column($fid_s,null,'cid');
|
||||
|
||||
//根据分类ID查询二级分类
|
||||
function get_category_sub($id) {
|
||||
global $site,$share,$data;
|
||||
global $share,$data;
|
||||
//禁止搜索非数字
|
||||
if(intval($id) == 0){
|
||||
return;
|
||||
}
|
||||
//书签分享>限定范围内的分类ID
|
||||
if(!empty($share)){
|
||||
$where['cid'] = $data;
|
||||
@@ -92,7 +116,7 @@ function get_category_sub($id) {
|
||||
|
||||
//根据分类id查找链接
|
||||
function get_links($fid) {
|
||||
global $site,$fid_s,$share,$data;
|
||||
global $site,$fid_s,$share,$data,$u;
|
||||
$where = [];
|
||||
$where = ["uid"=> UID];
|
||||
$where['fid'] = intval($fid);
|
||||
@@ -101,6 +125,7 @@ function get_links($fid) {
|
||||
$where['ORDER']['lid'] = 'ASC';
|
||||
if(!is_login){
|
||||
$where['property'] = 0;
|
||||
|
||||
}
|
||||
//书签分享>私有可见
|
||||
if(isset($share['pv']) && $share['pv'] == 1){
|
||||
@@ -111,8 +136,30 @@ function get_links($fid) {
|
||||
$where['lid'] = $data;
|
||||
unset($where['fid']);
|
||||
}
|
||||
|
||||
//虚拟分类,根据特定条件查找
|
||||
if($fid == 'top_link' || $fid == 'new_link' ){
|
||||
unset($where['ORDER']);
|
||||
if(!is_login) {
|
||||
$where['fid'] = get_open_category();
|
||||
}else{
|
||||
unset($where['fid']);
|
||||
}
|
||||
if($fid == 'top_link'){
|
||||
$where['ORDER']['click'] = 'DESC';
|
||||
$where['LIMIT'] = $site['top_link'];
|
||||
}elseif($fid == 'new_link'){
|
||||
$where['ORDER']['add_time'] = 'DESC';
|
||||
$where['LIMIT'] = $site['new_link'];
|
||||
}
|
||||
$where['ORDER']['lid'] = 'DESC';
|
||||
//输出上限&不在子页面&例外主题&书签分享
|
||||
}elseif($site['max_link'] > 0 && empty(Get('oc')) && !$site['ex_theme'] && empty($_GET['share'])){
|
||||
$count = count_db('user_links',$where);
|
||||
$where['LIMIT'] = $site['max_link'];
|
||||
$max_link = true;
|
||||
}
|
||||
$links = select_db('user_links',['lid(id)','fid','property','title','url(real_url)','url_standby','description','icon','click','pid'],$where);
|
||||
//var_dump($fid_s);exit;
|
||||
foreach ($links as $key => $link) {
|
||||
$click = false; $lock = false;
|
||||
|
||||
@@ -147,6 +194,11 @@ function get_links($fid) {
|
||||
//获取图标链接
|
||||
$links[$key]['ico'] = $lock ? $GLOBALS['libs'].'/Other/lock.svg' : geticourl($site['link_icon'],$link);
|
||||
}
|
||||
if($max_link && $count > $site['max_link']){
|
||||
$oc_url = "./index.php?u={$u}&oc={$fid}" . (empty($_GET['theme']) ? '':"&theme={$_GET['theme']}");
|
||||
array_push($links,['id'=>0,'title'=>'查看全部','url'=>$oc_url,'real_url'=>$oc_url,'description'=>'该分类共有'.$count.'条数据','ico'=>'./favicon.ico']);
|
||||
}
|
||||
|
||||
return $links;
|
||||
}
|
||||
|
||||
@@ -204,75 +256,33 @@ if($category_parent == []){
|
||||
$categorys = array_merge ($categorys,$category_subitem);
|
||||
}
|
||||
}
|
||||
//书签分享/例外主题禁止热门和最新
|
||||
if(empty($_GET['share']) && !$site['ex_theme']){
|
||||
//非指定分类页面
|
||||
if(empty(Get('oc'))){
|
||||
//热门链接
|
||||
if($site['top_link'] > 0){
|
||||
$top_link = ['name' => "热门网址","font_icon" =>"fa fa-bookmark-o" , "id" => 'top_link' ,"description" => ""];
|
||||
array_unshift($category_parent,$top_link);
|
||||
array_unshift($categorys,$top_link);
|
||||
}
|
||||
//最新链接
|
||||
if($site['new_link'] > 0){
|
||||
$new_link = ['name' => "最新网址","font_icon" =>"fa fa-bookmark-o" , "id" => 'new_link' ,"description" => ""];
|
||||
array_unshift($category_parent,$new_link);
|
||||
array_unshift($categorys,$new_link);
|
||||
}
|
||||
}else{
|
||||
unset($where['fid']);
|
||||
$where['cid'] = Get('oc');
|
||||
$categorys = select_db('user_categorys',$content,$where);
|
||||
$category_parent = $categorys;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//访问统计
|
||||
write_user_count(date('Ym'),'index_Ym');
|
||||
write_user_count(date('Ymd'),'index_Ymd');
|
||||
//var_dump($site);
|
||||
//var_dump(is_login);
|
||||
//var_dump($theme_info);
|
||||
//var_dump($categorys);
|
||||
|
||||
require($index_path);
|
||||
|
||||
//辅助函数
|
||||
function get_category($content){
|
||||
if(empty($content)){
|
||||
return '';
|
||||
}
|
||||
if(substr($content, 0,4) == '<svg'){
|
||||
return 'data:image/svg+xml;base64,'.base64_encode($content);
|
||||
}else{
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
|
||||
//获取图标URL
|
||||
function geticourl($icon,$link){
|
||||
if( !empty( $link['icon']) ){
|
||||
if(substr($link['icon'], 0,4) == '<svg'){
|
||||
return('data:image/svg+xml;base64,'.base64_encode($link['icon']));
|
||||
}else{
|
||||
return($link['icon']);
|
||||
}
|
||||
}
|
||||
if ($site['link_icon'] == 'default'){
|
||||
return($GLOBALS['libs'].'/Other/default.ico');
|
||||
}elseif ($icon ==1){
|
||||
return('./favicon/index2.php?url='.$link['real_url']);
|
||||
}elseif($icon ==2){
|
||||
return('//favicon.rss.ink/v1/'.base64($link['real_url']));
|
||||
}elseif($icon ==4){
|
||||
return('//api.15777.cn/get.php?url='.$link['real_url']);
|
||||
}elseif($icon ==5){
|
||||
return('//favicon.cccyun.cc/'.$link['real_url']);
|
||||
}elseif($icon ==6){
|
||||
return('//api.iowen.cn/favicon/'.parse_url($link['real_url'])['host'].'.png');
|
||||
}elseif($icon ==0){
|
||||
return('./system/ico.php?text='.mb_strtoupper(mb_substr($link['title'], 0, 1)));
|
||||
}else{
|
||||
return('./favicon/index2.php?url='.$link['real_url']);
|
||||
}//如果参数错误则使用本地服务器
|
||||
}
|
||||
|
||||
//将URL转换为base64编码
|
||||
function base64($url){
|
||||
$urls = parse_url($url);
|
||||
$scheme = empty( $urls['scheme'] ) ? 'http://' : $urls['scheme'].'://'; //获取请求协议
|
||||
$host = $urls['host']; //获取主机名
|
||||
$port = empty( $urls['port'] ) ? '' : ':'.$urls['port']; //获取端口
|
||||
$new_url = $scheme.$host.$port;
|
||||
return base64_encode($new_url);
|
||||
}
|
||||
//是否启用收录
|
||||
function is_apply(){
|
||||
global $global_config;
|
||||
$apply_user = unserialize( get_db("user_config", "v", ["k" => "apply","uid"=>UID]));
|
||||
return ($global_config['apply'] == 1 && $apply_user['apply'] == 1);
|
||||
}
|
||||
//是否启用留言
|
||||
function is_guestbook(){
|
||||
global $global_config;
|
||||
$guestbook_user = unserialize( get_db("user_config", "v", ["k" => "guestbook","uid"=>UID]) );
|
||||
return ($global_config['guestbook'] == 1 && $guestbook_user['allow'] == 1);
|
||||
|
||||
}
|
||||
//载入模板
|
||||
require($index_path);
|
||||
@@ -2,11 +2,12 @@
|
||||
if(!defined('DIR')){header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit;}
|
||||
|
||||
//初始化
|
||||
session_name('TwoNav_initial');
|
||||
session_start();
|
||||
|
||||
//判断请求类型
|
||||
if($_SERVER['REQUEST_METHOD'] === 'POST'){
|
||||
if( !$_SESSION['initial'] ){ msg(-1,'当前环境无法满足程序运行条件!'); }
|
||||
if(empty($_SESSION['initial'])){ msg(-1,'当前环境无法满足程序运行条件!'); }
|
||||
define('Debug',TRUE);
|
||||
$db = null;
|
||||
$USER_DB =null;
|
||||
@@ -50,7 +51,7 @@ function diagnosis() {
|
||||
$log='';
|
||||
$log .= "服务器时间:" . date("Y-m-d H:i:s") ."<br />";
|
||||
$log .= "系统信息:" . php_uname('s').','.php_uname('r') ."<br />";
|
||||
$log .= "当前版本:" . SysVer . "<br />";
|
||||
$log .= "当前版本:" . file_get_contents('./system/version.txt') . "<br />";
|
||||
|
||||
//检查PHP版本,需要大于5.6小于8.0
|
||||
$php_version = floatval(PHP_VERSION);
|
||||
@@ -75,7 +76,7 @@ function diagnosis() {
|
||||
if(function_exists("opcache_reset")){
|
||||
$log = $log ."opcache: 已安装<br />";
|
||||
}
|
||||
$log .= "脚本权限:" . get_current_user()."/".substr(sprintf("%o",fileperms("index.php")),-4)."\n";
|
||||
$log .= "脚本权限:" . get_current_user()."/".substr(sprintf("%o",fileperms("index.php")),-4)."<br />";
|
||||
$log .= in_array("pdo_sqlite",$ext) ? "PDO_Sqlite:支持<br />" : "PDO_Sqlite:不支持 (导入db3)<br />";
|
||||
$log .= in_array("curl",$ext) ? "curl:支持<br />" : "curl:不支持 (链接识别/在线更新/主题下载/订阅等)<br />";
|
||||
$log .= in_array("mbstring",$ext) ? "mbstring:支持<br />" : "mbstring:不支持 (链接识别)<br />";
|
||||
|
||||
@@ -5,7 +5,7 @@ require "./system/templates.php";
|
||||
if($_SERVER['REQUEST_METHOD'] === 'GET'){
|
||||
require DIR ."/system/templates.php";
|
||||
$t_path = DIR ."/templates/login/{$s_templates['login']}/index.php"; //模板路径
|
||||
$copyright = empty($global_config['copyright'])?'<a target="_blank" href="https://gitee.com/tznb/twonav">Copyright © TwoNav</a>':$global_config['copyright'];
|
||||
$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>';
|
||||
//检查是否存在,不存在则使用默认
|
||||
if(!is_file($t_path)){
|
||||
@@ -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]);
|
||||
|
||||
@@ -155,8 +155,7 @@ function get_db($table,$columns,$where,$rp = []){
|
||||
|
||||
//写全局配置(存在则更新,不存在则创建)
|
||||
function write_global_config($key,$value,$d){
|
||||
$re = get_db('global_config','k',['k'=>$key]);
|
||||
if(empty($re)){
|
||||
if(!has_db('global_config',['k'=>$key])){
|
||||
insert_db("global_config", ["k" => $key,"v" => $value,"d" => $d]);
|
||||
}else{
|
||||
update_db("global_config", ["v" => $value],['k'=>$key]);
|
||||
@@ -165,17 +164,16 @@ function write_global_config($key,$value,$d){
|
||||
|
||||
//写用户配置(存在则更新,不存在则创建)
|
||||
function write_user_config($key,$value,$t,$d){
|
||||
$re = get_db('user_config','k',['uid'=>UID,'k'=>$key]);
|
||||
if(empty($re)){
|
||||
if(!has_db('user_config',['uid'=>UID,'k'=>$key,'t'=>$t])){
|
||||
insert_db("user_config", ['uid'=>UID,"k"=>$key,"v"=>$value,"t"=>$t,"d"=>$d]);
|
||||
}else{
|
||||
update_db("user_config", ["v"=>$value],['uid'=>UID,'k'=>$key]);
|
||||
update_db("user_config", ["v"=>$value],['uid'=>UID,'k'=>$key,'t'=>$t]);
|
||||
}
|
||||
}
|
||||
|
||||
//写用户统计
|
||||
function write_user_count($key,$t){
|
||||
$re = get_db('user_count','k',['uid'=>UID,'t'=>$t,'k'=>$key]);
|
||||
if(empty($re)){
|
||||
if(!has_db('user_count',['uid'=>UID,'t'=>$t,'k'=>$key])){
|
||||
insert_db("user_count", ['uid'=>UID,"k"=>$key,"v"=>1,'t'=>$t]);
|
||||
}else{
|
||||
update_db("user_count", ["v[+]"=>1],['uid'=>UID,'t'=>$t,'k'=>$key]);
|
||||
@@ -230,8 +228,8 @@ function echo_category($property = false){
|
||||
function echo_pwds(){
|
||||
$where["uid"] = UID;
|
||||
$where['ORDER']['pid'] = 'ASC';
|
||||
foreach (select_db('user_pwd_group',['pid','name'],$where) as $data) {
|
||||
echo "<option value=\"{$data['pid']}\">{$data['name']}</option>";
|
||||
foreach (select_db('user_pwd_group',['pid','name','password'],$where) as $data) {
|
||||
echo "<option value=\"{$data['pid']}\">{$data['name']} | 密码 [{$data['password']}]</option>";
|
||||
}
|
||||
}
|
||||
//检查链接
|
||||
@@ -482,6 +480,7 @@ function get_http_code($url) {
|
||||
curl_setopt($curl, CURLOPT_NOBODY, true);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($curl, CURLOPT_TIMEOUT, 10);
|
||||
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36');
|
||||
$data = curl_exec($curl);
|
||||
$return = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
||||
curl_close($curl);
|
||||
@@ -497,6 +496,7 @@ function ccurl($url,$overtime = 3){
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
|
||||
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36');
|
||||
$Res["content"] = curl_exec ( $curl ) ;
|
||||
$Res["code"] = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
||||
curl_close ( $curl ) ;
|
||||
@@ -536,8 +536,8 @@ function downFile($url, $file = '', $savePath = './data/temp/'){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//获取目录
|
||||
function getDir($dir){
|
||||
//获取目录列表
|
||||
function get_dir_list($dir){
|
||||
$dirArray=[];
|
||||
if(false != ($handle = opendir($dir))){
|
||||
while(false !== ($file = readdir($handle))) {
|
||||
@@ -582,7 +582,18 @@ function getindexurl(){
|
||||
$HOST = $http_type.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
|
||||
return($HOST);
|
||||
}
|
||||
|
||||
//检查数组指定字段是否有重复值
|
||||
function is_Duplicated($array, $field){
|
||||
$values = [];
|
||||
foreach($array as $item){
|
||||
if(in_array($item[$field], $values)){
|
||||
return true;
|
||||
}else{
|
||||
$values[] = $item[$field];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//检查权限(有权限返回true 没有权限时根传递参数1是返回false 2是直接返回错误信息)
|
||||
function check_purview($name,$return_type){
|
||||
global $USER_DB;
|
||||
@@ -627,3 +638,51 @@ function Get_Rand_Str( $length = 8 ,$extend = false){
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
//发送邮件
|
||||
function send_email($config){
|
||||
if(!is_file(DIR.'/system/PHPMailer/PHPMailer.php')){
|
||||
msg(-1,'未安装PHPMailer!');
|
||||
}
|
||||
|
||||
require DIR.'/system/PHPMailer/Exception.php';
|
||||
require DIR.'/system/PHPMailer/PHPMailer.php';
|
||||
require DIR.'/system/PHPMailer/SMTP.php';
|
||||
$mail = new PHPMailer\PHPMailer\PHPMailer(true);
|
||||
try {
|
||||
$mail->CharSet ="UTF-8";
|
||||
$mail->SMTPDebug = 0;
|
||||
$mail->isSMTP();
|
||||
$mail->Host = $config['host'];
|
||||
$mail->SMTPAuth = true;
|
||||
$mail->Username = $config['user'];
|
||||
$mail->Password = $config['pwd'];
|
||||
$mail->SMTPSecure = $config['secure'];
|
||||
$mail->Port = intval($config['port']);
|
||||
|
||||
if(preg_match('/(.+)<(.+)>/', $config['sender'], $match)){
|
||||
$mail->setFrom($match[2],$match[1]);
|
||||
}else{
|
||||
$mail->setFrom($config['sender']);
|
||||
}
|
||||
|
||||
$mail->addAddress($config['addressee']); //收件人
|
||||
|
||||
$mail->isHTML(true);
|
||||
$mail->Subject = $config['Subject'];
|
||||
$mail->Body = $config['Body'];
|
||||
$mail->send();
|
||||
if(!empty($config['return']) && $config['return'] == 'bool'){
|
||||
return true;
|
||||
}
|
||||
msg(1,'邮件发送成功');
|
||||
} catch (Exception $e) {
|
||||
if(!empty($config['return']) && $config['return'] == 'bool'){
|
||||
return false;
|
||||
}
|
||||
if(Debug){
|
||||
msgA(['code'=>-1,'msg'=>'发送失败:'.$mail->ErrorInfo]);
|
||||
}else{
|
||||
msg(-1,'发送失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,3 +12,87 @@ if(empty($s_templates)){
|
||||
$s_templates = $global_templates;
|
||||
insert_db("user_config", ["uid" => UID,"k"=>"s_templates","v"=>$global_templates,"t"=>"config","d" => '默认模板']);
|
||||
}
|
||||
|
||||
//载入辅助函数
|
||||
if(empty($c) || in_array($c,['index','click'])){
|
||||
//将URL转换为base64编码
|
||||
function base64($url){
|
||||
$urls = parse_url($url);
|
||||
$scheme = empty( $urls['scheme'] ) ? 'http://' : $urls['scheme'].'://'; //获取请求协议
|
||||
$host = $urls['host']; //获取主机名
|
||||
$port = empty( $urls['port'] ) ? '' : ':'.$urls['port']; //获取端口
|
||||
$new_url = $scheme.$host.$port;
|
||||
return base64_encode($new_url);
|
||||
}
|
||||
//是否启用收录
|
||||
function is_apply(){
|
||||
global $global_config;
|
||||
$apply_user = unserialize( get_db("user_config", "v", ["k" => "apply","uid"=>UID]));
|
||||
return ($global_config['apply'] == 1 && $apply_user['apply'] == 1);
|
||||
}
|
||||
//是否启用留言
|
||||
function is_guestbook(){
|
||||
global $global_config;
|
||||
$guestbook_user = unserialize( get_db("user_config", "v", ["k" => "guestbook","uid"=>UID]) );
|
||||
return ($global_config['guestbook'] == 1 && $guestbook_user['allow'] == 1);
|
||||
|
||||
}
|
||||
//获取图标URL
|
||||
function geticourl($icon,$link){
|
||||
if( !empty( $link['icon']) ){
|
||||
if(substr($link['icon'], 0,4) == '<svg'){
|
||||
return('data:image/svg+xml;base64,'.base64_encode($link['icon']));
|
||||
}else{
|
||||
return($link['icon']);
|
||||
}
|
||||
}
|
||||
if ($site['link_icon'] == 'default'){
|
||||
return($GLOBALS['libs'].'/Other/default.ico');
|
||||
}elseif ($icon ==1){
|
||||
return('./favicon/index2.php?url='.$link['real_url']);
|
||||
}elseif($icon ==2){
|
||||
return('//favicon.rss.ink/v1/'.base64($link['real_url']));
|
||||
}elseif($icon ==4){
|
||||
return('//api.15777.cn/get.php?url='.$link['real_url']);
|
||||
}elseif($icon ==5){
|
||||
return('//favicon.cccyun.cc/'.$link['real_url']);
|
||||
}elseif($icon ==6){
|
||||
return('//api.iowen.cn/favicon/'.parse_url($link['real_url'])['host'].'.png');
|
||||
}elseif($icon ==7){
|
||||
return('https://toolb.cn/favicon/'.parse_url($link['real_url'])['host']);
|
||||
}elseif($icon ==8){
|
||||
return('https://apis.jxcxin.cn/api/Favicon?url='.$link['real_url']);
|
||||
}elseif($icon ==0){
|
||||
return('./system/ico.php?text='.mb_strtoupper(mb_substr($link['title'], 0, 1)));
|
||||
}else{
|
||||
return('./favicon/index2.php?url='.$link['real_url']);
|
||||
}//如果参数错误则使用本地服务器
|
||||
}
|
||||
//取分类图标(六零系主题在用)
|
||||
function get_category($content){ //抽风的命名..过度几个版本后删除
|
||||
return get_category_icon($content);
|
||||
}
|
||||
function get_category_icon($content){
|
||||
if(empty($content)){
|
||||
return '';
|
||||
}
|
||||
if(substr($content, 0,4) == '<svg'){
|
||||
return 'data:image/svg+xml;base64,'.base64_encode($content);
|
||||
}else{
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
//获取公开分类(返回数组cid)
|
||||
function get_open_category(){
|
||||
$where['uid'] = UID;
|
||||
$where['fid'] = 0;
|
||||
$where['status'] = 1;
|
||||
$where['property'] = 0;
|
||||
$categorys = select_db('user_categorys','cid',$where);
|
||||
$where['fid'] = $categorys;
|
||||
$categorys = array_merge ($categorys,select_db('user_categorys','cid',$where));
|
||||
return $categorys;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
v2.0.07-20230405
|
||||
v2.0.17-20230428
|
||||
@@ -1,15 +1,10 @@
|
||||
/**
|
||||
配色方案(如有需要,请自行配置)
|
||||
*/
|
||||
/**头部-配色*/
|
||||
.layui-layout-admin .layui-header {
|
||||
background-color: #1aa094 !important;
|
||||
}
|
||||
|
||||
.layui-header > ul > .layui-nav-item.layui-this, .layuimini-tool i:hover {
|
||||
background-color: #197971 !important;
|
||||
}
|
||||
|
||||
.layui-header .layuimini-header-content > ul > .layui-nav-item.layui-this, .layuimini-tool i:hover {
|
||||
background-color: #197971 !important;
|
||||
}
|
||||
@@ -33,7 +28,6 @@
|
||||
background-color: #1aa094 !important;
|
||||
}
|
||||
|
||||
|
||||
/**头部样式 */
|
||||
.layui-layout-admin .header {
|
||||
position: fixed;
|
||||
@@ -656,20 +650,6 @@
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/**
|
||||
菜单缩放
|
||||
*/
|
||||
.popup-tips .layui-layer-TipsG{
|
||||
display: none;
|
||||
}
|
||||
.popup-tips.layui-layer-tips .layui-layer-content{
|
||||
padding: 0;
|
||||
}
|
||||
.popup-tips .layui-nav-tree{
|
||||
width: 150px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
/**左侧菜单字体间距*/
|
||||
.layuimini-menu-left .layui-nav-item a span {
|
||||
letter-spacing: 1px;
|
||||
@@ -680,7 +660,6 @@
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
|
||||
/**左侧菜单更多下拉样式*/
|
||||
.layuimini-menu-left .layui-nav-more,.layuimini-menu-left-zoom .layui-nav-more {
|
||||
font-family: layui-icon !important;
|
||||
@@ -691,20 +670,14 @@
|
||||
overflow: hidden;
|
||||
width: auto;
|
||||
height: auto;
|
||||
/*line-height: normal;*/
|
||||
border: none;
|
||||
display: inline-block;
|
||||
/*margin-top: -6px !important;*/
|
||||
}
|
||||
|
||||
.layuimini-menu-left .layui-nav-child .layui-nav-more {
|
||||
margin-top: -6px !important;
|
||||
}
|
||||
|
||||
.layuimini-menu-left .layui-nav .layui-nav-mored,.layuimini-menu-left .layui-nav-itemed>a .layui-nav-more{
|
||||
/*margin-top: -9px!important;*/
|
||||
}
|
||||
|
||||
.layuimini-menu-left-zoom.layui-nav .layui-nav-mored,.layuimini-menu-left-zoom.layui-nav-itemed>a .layui-nav-more{
|
||||
margin-top: -9px!important;
|
||||
}
|
||||
@@ -735,10 +708,7 @@
|
||||
width: 20px;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
PC版样式
|
||||
*/
|
||||
/**PC版样式*/
|
||||
@media screen and (min-width: 1025px) {
|
||||
/**头部样式(缩放) */
|
||||
.layuimini-mini .layui-layout-left.layuimini-header-menu.layuimini-pc-show {
|
||||
@@ -796,7 +766,7 @@
|
||||
|
||||
/**菜单缩放*/
|
||||
.layuimini-mini .layuimini-menu-left .layui-nav-more,.layuimini-mini .layuimini-menu-left .layui-nav-child{
|
||||
display: none;!important;
|
||||
display: none!important;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -886,25 +856,6 @@
|
||||
left: 15px;
|
||||
}
|
||||
|
||||
.layuimini-mini .layuimini-site-mobile {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.layuimini-site-mobile {
|
||||
display: block !important;
|
||||
position: fixed;
|
||||
z-index: 100000;
|
||||
bottom: 15px;
|
||||
left: 15px;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
border-radius: 2px;
|
||||
text-align: center;
|
||||
background-color: rgba(0, 0, 0, .7);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.layuimini-header-content {
|
||||
z-index: 997;
|
||||
}
|
||||
@@ -913,14 +864,9 @@
|
||||
.layuimini-make {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.layuimini-site-mobile {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 550px){
|
||||
|
||||
/**头部右侧数据*/
|
||||
.layuimini-multi-module.layuimini-mini .layuimini-header-content .layui-layout-right {
|
||||
display: none;
|
||||
|
||||
@@ -10,23 +10,6 @@ body {
|
||||
width: 190px;
|
||||
}
|
||||
|
||||
/*手机端适配*/
|
||||
@media screen and (max-width: 768px) {
|
||||
.layui-form-mid {
|
||||
margin-left: 10px;
|
||||
}
|
||||
.layui-form-item .layui-input-inline {
|
||||
margin-right: 0px;
|
||||
width: calc(100% - 110px);
|
||||
}
|
||||
}
|
||||
@media screen and (max-width: 450px){
|
||||
.layui-form-item .layui-input-inline+.layui-form-mid {
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.layuimini-container {
|
||||
border: 1px solid #f2f2f2;
|
||||
border-radius: 5px;
|
||||
@@ -91,4 +74,40 @@ body {
|
||||
|
||||
.layui-table-tool-temp{
|
||||
padding-right: 0px;
|
||||
}
|
||||
|
||||
|
||||
/*手机端适配*/
|
||||
@media screen and (max-width: 768px) {
|
||||
.layui-form-mid {
|
||||
margin-left: 10px;
|
||||
}
|
||||
.layui-form-item .layui-input-inline {
|
||||
margin-right: 0px;
|
||||
width: calc(100% - 110px);
|
||||
}
|
||||
/*手机端表单调整230410*/
|
||||
.layui-form-label{
|
||||
width: 60px;
|
||||
padding: 9px 9px;
|
||||
}
|
||||
.layui-input-block{
|
||||
margin-left: 85px;
|
||||
}
|
||||
/*隐藏描述*/
|
||||
.layui-form-mid{
|
||||
display:none
|
||||
}
|
||||
/*边距*/
|
||||
.layuimini-main {
|
||||
margin: 10px 5px 10px 0px;
|
||||
}
|
||||
.layui-form-item{
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
}
|
||||
@media screen and (max-width: 450px){
|
||||
.layui-form-item .layui-input-inline+.layui-form-mid {
|
||||
margin-left: 10px;
|
||||
}
|
||||
}
|
||||
@@ -45,15 +45,11 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--无限极左侧菜单-->
|
||||
<div class="layui-side layui-bg-black layuimini-menu-left"></div>
|
||||
|
||||
<!--手机端遮罩层-->
|
||||
<div class="layuimini-make"></div>
|
||||
|
||||
<!-- 移动导航 -->
|
||||
<!--<div class="layuimini-site-mobile"><i class="layui-icon"></i></div>-->
|
||||
<div class="layui-body">
|
||||
<div class="layuimini-tab layui-tab-rollTool layui-tab" lay-filter="layuiminiTab" lay-allowclose="true">
|
||||
<ul class="layui-tab-title"><li class="layui-this" id="layuiminiHomeTabId" lay-id=""></li></ul>
|
||||
@@ -82,28 +78,16 @@
|
||||
<script>
|
||||
var u = "<?php echo U;?>"
|
||||
layui.config({version:"<?php echo $Ver;?>"});
|
||||
layui.use(['jquery', 'layer', 'miniAdmin'], function () {
|
||||
var $ = layui.jquery,layer = layui.layer,miniAdmin = layui.miniAdmin;
|
||||
miniAdmin.render({
|
||||
layui.use(['layer','miniAdmin'], function () {
|
||||
var layer = layui.layer;
|
||||
layui.miniAdmin.render({
|
||||
iniUrl: "./index.php?c=admin&page=menu&u="+u,
|
||||
urlHashLocation: true,
|
||||
bgColorDefault: false,
|
||||
multiModule: false,
|
||||
menuChildOpen: true,
|
||||
pageAnim: true,
|
||||
maxTabNum: 30
|
||||
});
|
||||
$('#logout').on("click", function () {
|
||||
$.post('./index.php?c=admin&page=logout&u='+u,function(d,status){
|
||||
if(d.code == 1) {
|
||||
layer.alert("您已安全的退出登录!", function () {
|
||||
top.location.href='./index.php?u='+u;
|
||||
});
|
||||
}else{
|
||||
layer.msg(d.msg,{icon: 5});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
@@ -80,20 +80,6 @@
|
||||
$("#fid").append("<option value=\""+res.data[i].cid+"\">"+res.data[i].name+"</option>");
|
||||
}
|
||||
}
|
||||
//加载加密分组数据
|
||||
$.post(get_api('read_pwd_group_list'),{'page':'1','limit':'9999'},function(data,status){
|
||||
if(data.code == 1){
|
||||
pwds = [];
|
||||
$("#pwd_id").empty();
|
||||
$("#pwd_id").append("<option value=\"0\">无</option>");
|
||||
for(var i =0;i<data.count;i++){
|
||||
pwds['pid_'+data.data[i].pid] = {'pwd':data.data[i].password,'name':data.data[i].name};
|
||||
$("#pwd_id").append("<option value=\""+data.data[i].pid+"\">"+data.data[i].name+" | 密码 [" + data.data[i].password +"]</option>");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
layui.form.render("select");//重新渲染下拉框
|
||||
limit = false; //取消修改限制
|
||||
layer.closeAll('loading'); //关闭加载层
|
||||
}
|
||||
|
||||
@@ -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: ['知道了']});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -13,13 +13,8 @@ layui.config({
|
||||
miniTab: "layuimini/miniTab", // layuimini tab扩展
|
||||
miniTheme: "layuimini/miniTheme", // layuimini 主题扩展
|
||||
treetable: 'treetable-lay/treetable', //table树形扩展
|
||||
treetable2: 'treeTable/treeTable', //table树形表格2
|
||||
tableSelect: 'tableSelect/tableSelect', // table选择扩展
|
||||
iconPickerFa: 'iconPicker/iconPickerFa', // fa图标选择扩展
|
||||
tableSelect: 'tableSelect/tableSelect', // table选择扩展
|
||||
xIcon: 'xIcon/xIcon', //图标选择器
|
||||
echarts: 'echarts/echarts', // echarts图表扩展
|
||||
echartsTheme: 'echarts/echartsTheme', // echarts图表主题扩展
|
||||
layarea: 'layarea/layarea', // 省市县区三级联动下拉选择器
|
||||
treeSelect: 'treeSelect/treeSelect', // 树形下拉选择器
|
||||
background: 'background/background' //随机背景图
|
||||
});
|
||||
|
||||
@@ -1,399 +0,0 @@
|
||||
/**
|
||||
* fa图标选择器 根据开源项目https://gitee.com/wujiawei0926/iconpicker修改而来
|
||||
* @author wujiawei0926@yeah.net chung@99php.cn
|
||||
* @version 1.1
|
||||
*/
|
||||
|
||||
layui.define(['laypage', 'form'], function (exports) {
|
||||
"use strict";
|
||||
|
||||
var IconPicker = function () {
|
||||
this.v = '1.1';
|
||||
}, _MOD = 'iconPickerFa',
|
||||
_this = this,
|
||||
$ = layui.jquery,
|
||||
laypage = layui.laypage,
|
||||
form = layui.form,
|
||||
BODY = 'body',
|
||||
TIPS = '请选择图标';
|
||||
|
||||
/**
|
||||
* 渲染组件
|
||||
*/
|
||||
IconPicker.prototype.render = function (options) {
|
||||
var opts = options,
|
||||
// DOM选择器
|
||||
elem = opts.elem,
|
||||
// 数据类型:fontClass/unicode
|
||||
url = opts.url,
|
||||
// 是否分页:true/false
|
||||
page = opts.page == null ? true : opts.page,
|
||||
// 每页显示数量
|
||||
limit = opts.limit == null ? 12 : opts.limit,
|
||||
// 是否开启搜索:true/false
|
||||
search = opts.search == null ? true : opts.search,
|
||||
// 每个图标格子的宽度:'43px'或'20%'
|
||||
cellWidth = opts.cellWidth,
|
||||
// 点击回调
|
||||
click = opts.click,
|
||||
// 渲染成功后的回调
|
||||
success = opts.success,
|
||||
// json数据
|
||||
data = {},
|
||||
// 唯一标识
|
||||
tmp = new Date().getTime(),
|
||||
// 初始化时input的值
|
||||
ORIGINAL_ELEM_VALUE = $(elem).val(),
|
||||
TITLE = 'layui-select-title',
|
||||
TITLE_ID = 'layui-select-title-' + tmp,
|
||||
ICON_BODY = 'layui-iconpicker-' + tmp,
|
||||
PICKER_BODY = 'layui-iconpicker-body-' + tmp,
|
||||
PAGE_ID = 'layui-iconpicker-page-' + tmp,
|
||||
LIST_BOX = 'layui-iconpicker-list-box',
|
||||
selected = 'layui-form-selected',
|
||||
unselect = 'layui-unselect';
|
||||
|
||||
var a = {
|
||||
init: function () {
|
||||
data = common.getData(url);
|
||||
|
||||
a.hideElem().createSelect().createBody().toggleSelect();
|
||||
a.preventEvent().inputListen();
|
||||
common.loadCss();
|
||||
|
||||
if (success) {
|
||||
success(this.successHandle());
|
||||
}
|
||||
|
||||
return a;
|
||||
},
|
||||
successHandle: function () {
|
||||
var d = {
|
||||
options: opts,
|
||||
data: data,
|
||||
id: tmp,
|
||||
elem: $('#' + ICON_BODY)
|
||||
};
|
||||
return d;
|
||||
},
|
||||
/**
|
||||
* 隐藏elem
|
||||
*/
|
||||
hideElem: function () {
|
||||
$(elem).hide();
|
||||
return a;
|
||||
},
|
||||
/**
|
||||
* 绘制select下拉选择框
|
||||
*/
|
||||
createSelect: function () {
|
||||
var oriIcon = '<i class="fa">';
|
||||
|
||||
// 默认图标
|
||||
if (ORIGINAL_ELEM_VALUE === '') {
|
||||
ORIGINAL_ELEM_VALUE = 'fa-adjust';
|
||||
|
||||
}
|
||||
|
||||
|
||||
oriIcon = '<i class="fa ' + ORIGINAL_ELEM_VALUE + '">';
|
||||
|
||||
oriIcon += '</i>';
|
||||
|
||||
var selectHtml = '<div class="layui-iconpicker layui-unselect layui-form-select" id="' + ICON_BODY + '">' +
|
||||
'<div class="' + TITLE + '" id="' + TITLE_ID + '">' +
|
||||
'<div class="layui-iconpicker-item">' +
|
||||
'<span class="layui-iconpicker-icon layui-unselect">' +
|
||||
oriIcon +
|
||||
'</span>' +
|
||||
'<i class="layui-edge"></i>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div class="layui-anim layui-anim-upbit" style="">' +
|
||||
'123' +
|
||||
'</div>';
|
||||
$(elem).after(selectHtml);
|
||||
return a;
|
||||
},
|
||||
/**
|
||||
* 展开/折叠下拉框
|
||||
*/
|
||||
toggleSelect: function () {
|
||||
var item = '#' + TITLE_ID + ' .layui-iconpicker-item,#' + TITLE_ID + ' .layui-iconpicker-item .layui-edge';
|
||||
a.event('click', item, function (e) {
|
||||
var $icon = $('#' + ICON_BODY);
|
||||
if ($icon.hasClass(selected)) {
|
||||
$icon.removeClass(selected).addClass(unselect);
|
||||
} else {
|
||||
// 隐藏其他picker
|
||||
$('.layui-form-select').removeClass(selected);
|
||||
// 显示当前picker
|
||||
$icon.addClass(selected).removeClass(unselect);
|
||||
}
|
||||
e.stopPropagation();
|
||||
});
|
||||
return a;
|
||||
},
|
||||
/**
|
||||
* 绘制主体部分
|
||||
*/
|
||||
createBody: function () {
|
||||
// 获取数据
|
||||
var searchHtml = '';
|
||||
|
||||
if (search) {
|
||||
searchHtml = '<div class="layui-iconpicker-search">' +
|
||||
'<input class="layui-input">' +
|
||||
'<i class="layui-icon"></i>' +
|
||||
'</div>';
|
||||
}
|
||||
|
||||
// 组合dom
|
||||
var bodyHtml = '<div class="layui-iconpicker-body" id="' + PICKER_BODY + '">' +
|
||||
searchHtml +
|
||||
'<div class="' + LIST_BOX + '"></div> ' +
|
||||
'</div>';
|
||||
$('#' + ICON_BODY).find('.layui-anim').eq(0).html(bodyHtml);
|
||||
a.search().createList().check().page();
|
||||
|
||||
return a;
|
||||
},
|
||||
/**
|
||||
* 绘制图标列表
|
||||
* @param text 模糊查询关键字
|
||||
* @returns {string}
|
||||
*/
|
||||
createList: function (text) {
|
||||
var d = data,
|
||||
l = d.length,
|
||||
pageHtml = '',
|
||||
listHtml = $('<div class="layui-iconpicker-list">')//'<div class="layui-iconpicker-list">';
|
||||
|
||||
// 计算分页数据
|
||||
var _limit = limit, // 每页显示数量
|
||||
_pages = l % _limit === 0 ? l / _limit : parseInt(l / _limit + 1), // 总计多少页
|
||||
_id = PAGE_ID;
|
||||
|
||||
// 图标列表
|
||||
var icons = [];
|
||||
|
||||
for (var i = 0; i < l; i++) {
|
||||
var obj = d[i];
|
||||
|
||||
// 判断是否模糊查询
|
||||
if (text && obj.indexOf(text) === -1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 是否自定义格子宽度
|
||||
var style = '';
|
||||
if (cellWidth !== null) {
|
||||
style += ' style="width:' + cellWidth + '"';
|
||||
}
|
||||
|
||||
// 每个图标dom
|
||||
var icon = '<div class="layui-iconpicker-icon-item" title="' + obj + '" ' + style + '>';
|
||||
|
||||
icon += '<i class="fa ' + obj + '"></i>';
|
||||
|
||||
icon += '</div>';
|
||||
|
||||
icons.push(icon);
|
||||
}
|
||||
|
||||
// 查询出图标后再分页
|
||||
l = icons.length;
|
||||
_pages = l % _limit === 0 ? l / _limit : parseInt(l / _limit + 1);
|
||||
for (var i = 0; i < _pages; i++) {
|
||||
// 按limit分块
|
||||
var lm = $('<div class="layui-iconpicker-icon-limit" id="layui-iconpicker-icon-limit-' + tmp + (i + 1) + '">');
|
||||
|
||||
for (var j = i * _limit; j < (i + 1) * _limit && j < l; j++) {
|
||||
lm.append(icons[j]);
|
||||
}
|
||||
|
||||
listHtml.append(lm);
|
||||
}
|
||||
|
||||
// 无数据
|
||||
if (l === 0) {
|
||||
listHtml.append('<p class="layui-iconpicker-tips">无数据</p>');
|
||||
}
|
||||
|
||||
// 判断是否分页
|
||||
if (page) {
|
||||
$('#' + PICKER_BODY).addClass('layui-iconpicker-body-page');
|
||||
pageHtml = '<div class="layui-iconpicker-page" id="' + PAGE_ID + '">' +
|
||||
'<div class="layui-iconpicker-page-count">' +
|
||||
'<span id="' + PAGE_ID + '-current">1</span>/' +
|
||||
'<span id="' + PAGE_ID + '-pages">' + _pages + '</span>' +
|
||||
' (<span id="' + PAGE_ID + '-length">' + l + '</span>)' +
|
||||
'</div>' +
|
||||
'<div class="layui-iconpicker-page-operate">' +
|
||||
'<i class="layui-icon" id="' + PAGE_ID + '-prev" data-index="0" prev></i> ' +
|
||||
'<i class="layui-icon" id="' + PAGE_ID + '-next" data-index="2" next></i> ' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
}
|
||||
|
||||
|
||||
$('#' + ICON_BODY).find('.layui-anim').find('.' + LIST_BOX).html('').append(listHtml).append(pageHtml);
|
||||
return a;
|
||||
},
|
||||
// 阻止Layui的一些默认事件
|
||||
preventEvent: function () {
|
||||
var item = '#' + ICON_BODY + ' .layui-anim';
|
||||
a.event('click', item, function (e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
return a;
|
||||
},
|
||||
// 分页
|
||||
page: function () {
|
||||
var icon = '#' + PAGE_ID + ' .layui-iconpicker-page-operate .layui-icon';
|
||||
|
||||
$(icon).unbind('click');
|
||||
a.event('click', icon, function (e) {
|
||||
var elem = e.currentTarget,
|
||||
total = parseInt($('#' + PAGE_ID + '-pages').html()),
|
||||
isPrev = $(elem).attr('prev') !== undefined,
|
||||
// 按钮上标的页码
|
||||
index = parseInt($(elem).attr('data-index')),
|
||||
$cur = $('#' + PAGE_ID + '-current'),
|
||||
// 点击时正在显示的页码
|
||||
current = parseInt($cur.html());
|
||||
|
||||
// 分页数据
|
||||
if (isPrev && current > 1) {
|
||||
current = current - 1;
|
||||
$(icon + '[prev]').attr('data-index', current);
|
||||
} else if (!isPrev && current < total) {
|
||||
current = current + 1;
|
||||
$(icon + '[next]').attr('data-index', current);
|
||||
}
|
||||
$cur.html(current);
|
||||
|
||||
// 图标数据
|
||||
$('#' + ICON_BODY + ' .layui-iconpicker-icon-limit').hide();
|
||||
$('#layui-iconpicker-icon-limit-' + tmp + current).show();
|
||||
e.stopPropagation();
|
||||
});
|
||||
return a;
|
||||
},
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
search: function () {
|
||||
var item = '#' + PICKER_BODY + ' .layui-iconpicker-search .layui-input';
|
||||
a.event('input propertychange', item, function (e) {
|
||||
var elem = e.target,
|
||||
t = $(elem).val();
|
||||
a.createList(t);
|
||||
});
|
||||
return a;
|
||||
},
|
||||
/**
|
||||
* 点击选中图标
|
||||
*/
|
||||
check: function () {
|
||||
var item = '#' + PICKER_BODY + ' .layui-iconpicker-icon-item';
|
||||
a.event('click', item, function (e) {
|
||||
var el = $(e.currentTarget).find('.fa'),
|
||||
icon = '';
|
||||
|
||||
var clsArr = el.attr('class').split(/[\s\n]/),
|
||||
cls = clsArr[1],
|
||||
icon = cls;
|
||||
$('#' + TITLE_ID).find('.layui-iconpicker-item .fa').html('').attr('class', clsArr.join(' '));
|
||||
|
||||
|
||||
$('#' + ICON_BODY).removeClass(selected).addClass(unselect);
|
||||
$(elem).val(icon).attr('value', icon);
|
||||
// 回调
|
||||
if (click) {
|
||||
click({
|
||||
icon: icon
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
return a;
|
||||
},
|
||||
// 监听原始input数值改变
|
||||
inputListen: function () {
|
||||
var el = $(elem);
|
||||
a.event('change', elem, function () {
|
||||
var value = el.val();
|
||||
})
|
||||
// el.change(function(){
|
||||
|
||||
// });
|
||||
return a;
|
||||
},
|
||||
event: function (evt, el, fn) {
|
||||
$(BODY).on(evt, el, fn);
|
||||
}
|
||||
};
|
||||
|
||||
var common = {
|
||||
/**
|
||||
* 加载样式表
|
||||
*/
|
||||
loadCss: function () {
|
||||
var css = '.layui-iconpicker {max-width: 280px;}.layui-iconpicker .layui-anim{display:none;position:absolute;left:0;top:42px;padding:5px 0;z-index:899;min-width:100%;border:1px solid #d2d2d2;max-height:300px;overflow-y:auto;background-color:#fff;border-radius:2px;box-shadow:0 2px 4px rgba(0,0,0,.12);box-sizing:border-box;}.layui-iconpicker-item{border:1px solid #e6e6e6;width:90px;height:38px;border-radius:4px;cursor:pointer;position:relative;}.layui-iconpicker-icon{border-right:1px solid #e6e6e6;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;width:60px;height:100%;float:left;text-align:center;background:#fff;transition:all .3s;}.layui-iconpicker-icon i{line-height:38px;font-size:18px;}.layui-iconpicker-item > .layui-edge{left:70px;}.layui-iconpicker-item:hover{border-color:#D2D2D2!important;}.layui-iconpicker-item:hover .layui-iconpicker-icon{border-color:#D2D2D2!important;}.layui-iconpicker.layui-form-selected .layui-anim{display:block;}.layui-iconpicker-body{padding:6px;}.layui-iconpicker .layui-iconpicker-list{background-color:#fff;border:1px solid #ccc;border-radius:4px;}.layui-iconpicker .layui-iconpicker-icon-item{display:inline-block;width:21.1%;line-height:36px;text-align:center;cursor:pointer;vertical-align:top;height:36px;margin:4px;border:1px solid #ddd;border-radius:2px;transition:300ms;}.layui-iconpicker .layui-iconpicker-icon-item i.layui-icon{font-size:17px;}.layui-iconpicker .layui-iconpicker-icon-item:hover{background-color:#eee;border-color:#ccc;-webkit-box-shadow:0 0 2px #aaa,0 0 2px #fff inset;-moz-box-shadow:0 0 2px #aaa,0 0 2px #fff inset;box-shadow:0 0 2px #aaa,0 0 2px #fff inset;text-shadow:0 0 1px #fff;}.layui-iconpicker-search{position:relative;margin:0 0 6px 0;border:1px solid #e6e6e6;border-radius:2px;transition:300ms;}.layui-iconpicker-search:hover{border-color:#D2D2D2!important;}.layui-iconpicker-search .layui-input{cursor:text;display:inline-block;width:86%;border:none;padding-right:0;margin-top:1px;}.layui-iconpicker-search .layui-icon{position:absolute;top:11px;right:4%;}.layui-iconpicker-tips{text-align:center;padding:8px 0;cursor:not-allowed;}.layui-iconpicker-page{margin-top:6px;margin-bottom:-6px;font-size:12px;padding:0 2px;}.layui-iconpicker-page-count{display:inline-block;}.layui-iconpicker-page-operate{display:inline-block;float:right;cursor:default;}.layui-iconpicker-page-operate .layui-icon{font-size:12px;cursor:pointer;}.layui-iconpicker-body-page .layui-iconpicker-icon-limit{display:none;}.layui-iconpicker-body-page .layui-iconpicker-icon-limit:first-child{display:block;}';
|
||||
var $style = $('head').find('style[iconpicker]');
|
||||
if ($style.length === 0) {
|
||||
$('head').append('<style rel="stylesheet" iconpicker>' + css + '</style>');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取数据
|
||||
*/
|
||||
getData: function (url) {
|
||||
var iconlist = [];
|
||||
$.ajax({
|
||||
url: url,
|
||||
type: 'get',
|
||||
contentType: "application/x-www-form-urlencoded; charset=UTF-8",
|
||||
async: false,
|
||||
success: function (ret) {
|
||||
var exp = /fa-var-(.*):/ig;
|
||||
var result;
|
||||
while ((result = exp.exec(ret)) != null) {
|
||||
iconlist.push('fa-' + result[1]);
|
||||
}
|
||||
},
|
||||
error: function (xhr, textstatus, thrown) {
|
||||
layer.msg('fa图标接口有误');
|
||||
}
|
||||
});
|
||||
return iconlist;
|
||||
}
|
||||
};
|
||||
|
||||
a.init();
|
||||
return new IconPicker();
|
||||
};
|
||||
|
||||
/**
|
||||
* 选中图标
|
||||
* @param filter lay-filter
|
||||
* @param iconName 图标名称,自动识别fontClass/unicode
|
||||
*/
|
||||
IconPicker.prototype.checkIcon = function (filter, iconName) {
|
||||
var el = $('*[lay-filter=' + filter + ']'),
|
||||
p = el.next().find('.layui-iconpicker-item .fa'),
|
||||
c = iconName;
|
||||
|
||||
if (c.indexOf('#xe') > 0) {
|
||||
p.html(c);
|
||||
} else {
|
||||
p.html('').attr('class', 'fa ' + c);
|
||||
}
|
||||
el.attr('value', c).val(c);
|
||||
};
|
||||
|
||||
var iconPicker = new IconPicker();
|
||||
exports(_MOD, iconPicker);
|
||||
});
|
||||
@@ -1,34 +1,11 @@
|
||||
/**
|
||||
* date:2020/02/27
|
||||
* author:Mr.Chung
|
||||
* version:2.0
|
||||
* description:layuimini 主体框架扩展
|
||||
*/
|
||||
layui.define(["jquery", "miniMenu", "element","miniTab", "miniTheme"], function (exports) {
|
||||
var $ = layui.$,
|
||||
layer = layui.layer,
|
||||
miniMenu = layui.miniMenu,
|
||||
miniTheme = layui.miniTheme,
|
||||
element = layui.element ,
|
||||
element = layui.element,
|
||||
miniTab = layui.miniTab;
|
||||
|
||||
if (!/http(s*):\/\//.test(location.href)) {
|
||||
var tips = "请先将项目部署至web容器(Apache/Tomcat/Nginx/IIS/等),否则部分数据将无法显示";
|
||||
return layer.alert(tips);
|
||||
}
|
||||
|
||||
var miniAdmin = {
|
||||
|
||||
/**
|
||||
* 后台框架初始化
|
||||
* @param options.iniUrl 后台初始化接口地址
|
||||
* @param options.urlHashLocation URL地址hash定位
|
||||
* @param options.bgColorDefault 默认皮肤
|
||||
* @param options.multiModule 是否开启多模块
|
||||
* @param options.menuChildOpen 是否展开子菜单
|
||||
* @param options.pageAnim iframe窗口动画
|
||||
* @param options.maxTabNum 最大的tab打开数量
|
||||
*/
|
||||
render: function (options) {
|
||||
options.iniUrl = options.iniUrl || null;
|
||||
options.urlHashLocation = options.urlHashLocation || false;
|
||||
@@ -39,7 +16,7 @@ layui.define(["jquery", "miniMenu", "element","miniTab", "miniTheme"], function
|
||||
options.maxTabNum = options.maxTabNum || 20;
|
||||
$.getJSON(options.iniUrl, function (data) {
|
||||
if (data == null) {
|
||||
miniAdmin.error('暂无菜单信息')
|
||||
miniAdmin.error('暂无菜单信息');
|
||||
} else {
|
||||
miniAdmin.renderLogo(data.logoInfo);
|
||||
miniAdmin.renderHome(data.homeInfo);
|
||||
@@ -71,31 +48,19 @@ layui.define(["jquery", "miniMenu", "element","miniTab", "miniTheme"], function
|
||||
miniAdmin.error('菜单接口有误');
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 初始化logo
|
||||
* @param data
|
||||
*/
|
||||
//初始化logo
|
||||
renderLogo: function (data) {
|
||||
var html = '<a href="' + data.href + '"><img src="' + data.image + '" alt="logo"><h1>' + data.title + '</h1></a>';
|
||||
$('.layuimini-logo').html(html);
|
||||
},
|
||||
|
||||
/**
|
||||
* 初始化首页
|
||||
* @param data
|
||||
*/
|
||||
//初始化首页
|
||||
renderHome: function (data) {
|
||||
sessionStorage.setItem('layuiminiHomeHref', data.href);
|
||||
$('#layuiminiHomeTabId').html('<span class="layuimini-tab-active"></span><span class="disable-close">' + data.title + '</span><i class="layui-icon layui-unselect layui-tab-close">ဆ</i>');
|
||||
$('#layuiminiHomeTabId').attr('lay-id', data.href);
|
||||
$('#layuiminiHomeTabIframe').html('<iframe width="100%" height="100%" frameborder="no" border="0" marginwidth="0" marginheight="0" src="./?c=admin&page=' + data.href + '&u=' + u + '"></iframe>');
|
||||
},
|
||||
|
||||
/**
|
||||
* 初始化iframe窗口动画
|
||||
* @param anim
|
||||
*/
|
||||
//初始化iframe窗口动画
|
||||
renderAnim: function (anim) {
|
||||
if (anim) {
|
||||
$('#layuimini-bg-color').after('<style id="layuimini-page-anim">' +
|
||||
@@ -115,7 +80,7 @@ layui.define(["jquery", "miniMenu", "element","miniTab", "miniTheme"], function
|
||||
'</style>');
|
||||
}
|
||||
},
|
||||
|
||||
//进入全屏
|
||||
fullScreen: function () {
|
||||
var el = document.documentElement;
|
||||
var rfs = el.requestFullScreen || el.webkitRequestFullScreen;
|
||||
@@ -138,10 +103,7 @@ layui.define(["jquery", "miniMenu", "element","miniTab", "miniTheme"], function
|
||||
miniAdmin.error('浏览器不支持全屏调用!');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 退出全屏
|
||||
*/
|
||||
//退出全屏
|
||||
exitFullScreen: function () {
|
||||
var el = document;
|
||||
var cfs = el.cancelFullScreen || el.webkitCancelFullScreen || el.exitFullScreen;
|
||||
@@ -164,10 +126,7 @@ layui.define(["jquery", "miniMenu", "element","miniTab", "miniTheme"], function
|
||||
miniAdmin.error('浏览器不支持全屏调用!');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 初始化设备端
|
||||
*/
|
||||
//初始化设备端
|
||||
renderDevice: function () {
|
||||
if (miniAdmin.checkMobile()) {
|
||||
$('.layuimini-tool i').attr('data-side-fold', 1);
|
||||
@@ -176,29 +135,15 @@ layui.define(["jquery", "miniMenu", "element","miniTab", "miniTheme"], function
|
||||
$('.layui-layout-body').addClass('layuimini-all');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 成功
|
||||
* @param title
|
||||
* @returns {*}
|
||||
*/
|
||||
//成功提示
|
||||
success: function (title) {
|
||||
return layer.msg(title, {icon: 1, shade: this.shade, scrollbar: false, time: 2000, shadeClose: true});
|
||||
},
|
||||
|
||||
/**
|
||||
* 失败
|
||||
* @param title
|
||||
* @returns {*}
|
||||
*/
|
||||
//失败提示
|
||||
error: function (title) {
|
||||
return layer.msg(title, {icon: 2, shade: this.shade, scrollbar: false, time: 3000, shadeClose: true});
|
||||
},
|
||||
|
||||
/**
|
||||
* 判断是否为手机
|
||||
* @returns {boolean}
|
||||
*/
|
||||
//判断是否为手机
|
||||
checkMobile: function () {
|
||||
var ua = navigator.userAgent.toLocaleLowerCase();
|
||||
var pf = navigator.platform.toLocaleLowerCase();
|
||||
@@ -213,55 +158,15 @@ layui.define(["jquery", "miniMenu", "element","miniTab", "miniTheme"], function
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
||||
// 监听
|
||||
listen: function () {
|
||||
// 刷新
|
||||
$('body').on('click', '[data-refresh]', function () {
|
||||
//刷新
|
||||
$('body').on('click','[data-refresh]', function () {
|
||||
$(".layui-tab-item.layui-show").find("iframe")[0].contentWindow.location.reload();
|
||||
miniAdmin.success('刷新成功');
|
||||
});
|
||||
|
||||
// 监听提示信息
|
||||
$("body").on("mouseenter", ".layui-nav-tree .menu-li", function () {
|
||||
if (miniAdmin.checkMobile()) {
|
||||
return false;
|
||||
}
|
||||
var classInfo = $(this).attr('class'),
|
||||
tips = $(this).prop("innerHTML"),
|
||||
isShow = $('.layuimini-tool i').attr('data-side-fold');
|
||||
if (isShow == 0 && tips) {
|
||||
tips = "<ul class='layuimini-menu-left-zoom layui-nav layui-nav-tree layui-this'><li class='layui-nav-item layui-nav-itemed'>"+tips+"</li></ul>" ;
|
||||
window.openTips = layer.tips(tips, $(this), {
|
||||
tips: [2, '#2f4056'],
|
||||
time: 300000,
|
||||
skin:"popup-tips",
|
||||
success:function (el) {
|
||||
var left = $(el).position().left - 10 ;
|
||||
$(el).css({ left:left });
|
||||
element.render();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$("body").on("mouseleave", ".popup-tips", function () {
|
||||
if (miniAdmin.checkMobile()) {
|
||||
return false;
|
||||
}
|
||||
var isShow = $('.layuimini-tool i').attr('data-side-fold');
|
||||
if (isShow == 0) {
|
||||
try {
|
||||
layer.close(window.openTips);
|
||||
} catch (e) {
|
||||
console.log(e.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// 全屏
|
||||
$('body').on('click', '[data-check-screen]', function () {
|
||||
//全屏
|
||||
$('body').on('click','[data-check-screen]', function () {
|
||||
var check = $(this).attr('data-check-screen');
|
||||
if (check == 'full') {
|
||||
miniAdmin.fullScreen();
|
||||
@@ -273,14 +178,23 @@ layui.define(["jquery", "miniMenu", "element","miniTab", "miniTheme"], function
|
||||
$(this).html('<i class="fa fa-arrows-alt"></i>');
|
||||
}
|
||||
});
|
||||
|
||||
// 点击遮罩层
|
||||
$('body').on('click', '.layuimini-make', function () {
|
||||
//点击遮罩层
|
||||
$('body').on('click','.layuimini-make', function () {
|
||||
miniAdmin.renderDevice();
|
||||
});
|
||||
|
||||
//退出登录
|
||||
$('#logout').on("click", function () {
|
||||
$.post('./index.php?c=admin&page=logout&u='+u,function(d,status){
|
||||
if(d.code == 1) {
|
||||
layer.alert("您已安全的退出登录!", function () {
|
||||
top.location.href='./index.php?u='+u;
|
||||
});
|
||||
}else{
|
||||
layer.msg(d.msg,{icon: 5});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
exports("miniAdmin", miniAdmin);
|
||||
exports("miniAdmin",miniAdmin);
|
||||
});
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
/**
|
||||
* date:2020/02/27
|
||||
* author:Mr.Chung
|
||||
* version:2.0
|
||||
* description:layuimini 菜单框架扩展
|
||||
*/
|
||||
layui.define(["element","laytpl" ,"jquery"], function (exports) {
|
||||
var element = layui.element,
|
||||
$ = layui.$,
|
||||
@@ -11,30 +5,14 @@ layui.define(["element","laytpl" ,"jquery"], function (exports) {
|
||||
layer = layui.layer;
|
||||
|
||||
var miniMenu = {
|
||||
|
||||
/**
|
||||
* 菜单初始化
|
||||
* @param options.menuList 菜单数据信息
|
||||
* @param options.multiModule 是否开启多模块
|
||||
* @param options.menuChildOpen 是否展开子菜单
|
||||
*/
|
||||
//菜单初始化
|
||||
render: function (options) {
|
||||
options.menuList = options.menuList || [];
|
||||
options.multiModule = options.multiModule || false;
|
||||
options.menuChildOpen = options.menuChildOpen || false;
|
||||
if (options.multiModule) {
|
||||
miniMenu.renderMultiModule(options.menuList, options.menuChildOpen);
|
||||
} else {
|
||||
miniMenu.renderSingleModule(options.menuList, options.menuChildOpen);
|
||||
}
|
||||
miniMenu.renderSingleModule(options.menuList, options.menuChildOpen);
|
||||
miniMenu.listen();
|
||||
},
|
||||
|
||||
/**
|
||||
* 单模块
|
||||
* @param menuList 菜单数据
|
||||
* @param menuChildOpen 是否默认展开
|
||||
*/
|
||||
//单模块
|
||||
renderSingleModule: function (menuList, menuChildOpen) {
|
||||
menuList = menuList || [];
|
||||
var leftMenuHtml = '',
|
||||
@@ -49,10 +27,7 @@ layui.define(["element","laytpl" ,"jquery"], function (exports) {
|
||||
|
||||
element.init();
|
||||
},
|
||||
|
||||
/**
|
||||
* 渲染一级菜单
|
||||
*/
|
||||
//渲染一级菜单
|
||||
compileMenu: function(menu,isSub){
|
||||
var menuHtml = '<li {{#if( d.menu){ }} data-menu="{{d.menu}}" {{#}}} class="layui-nav-item menu-li {{d.childOpenClass}} {{d.className}}" {{#if( d.id){ }} id="{{d.id}}" {{#}}}> <a {{#if( d.href){ }} layuimini-href="{{d.href}}" {{#}}} {{#if( d.target){ }} target="{{d.target}}" {{#}}} href="javascript:;">{{#if( d.icon){ }} <i class="{{d.icon}}"></i> {{#}}} <span class="layui-left-nav">{{d.title}}</span></a> {{# if(d.children){}} {{d.children}} {{#}}} </li>' ;
|
||||
if(isSub){
|
||||
@@ -70,7 +45,6 @@ layui.define(["element","laytpl" ,"jquery"], function (exports) {
|
||||
}
|
||||
return laytpl(wrapperHtml).render(menu);
|
||||
},
|
||||
|
||||
each:function(list,callback){
|
||||
var _list = [];
|
||||
for(var i = 0 ,length = list.length ; i<length ;i++ ){
|
||||
@@ -111,98 +85,9 @@ layui.define(["element","laytpl" ,"jquery"], function (exports) {
|
||||
leftMenusHtml = me.compileMenuContainer({ id:options.parentMenuId,className:options.leftMenuCheckDefault,children:leftMenusHtml }) ;
|
||||
return leftMenusHtml ;
|
||||
},
|
||||
/**
|
||||
* 多模块
|
||||
* @param menuList 菜单数据
|
||||
* @param menuChildOpen 是否默认展开
|
||||
*/
|
||||
renderMultiModule: function (menuList, menuChildOpen) {
|
||||
menuList = menuList || [];
|
||||
var me = this ;
|
||||
var headerMenuHtml = '',
|
||||
headerMobileMenuHtml = '',
|
||||
leftMenuHtml = '',
|
||||
leftMenuCheckDefault = 'layui-this',
|
||||
childOpenClass = '',
|
||||
headerMenuCheckDefault = 'layui-this';
|
||||
|
||||
if (menuChildOpen) childOpenClass = ' layui-nav-itemed';
|
||||
var headerMenuHtml = this.each(menuList, function (index, val) { //顶部菜单渲染
|
||||
var menu = 'multi_module_' + index ;
|
||||
var id = menu+"HeaderId";
|
||||
var topMenuItemHtml = "" ;
|
||||
topMenuItemHtml = me.compileMenu({
|
||||
className:headerMenuCheckDefault,
|
||||
menu:menu,
|
||||
id:id,
|
||||
title:val.title,
|
||||
href:"",
|
||||
target:"",
|
||||
children:""
|
||||
});
|
||||
leftMenuHtml+=me.renderLeftMenu(val.child,{
|
||||
parentMenuId:menu,
|
||||
childOpenClass:childOpenClass,
|
||||
leftMenuCheckDefault:leftMenuCheckDefault
|
||||
});
|
||||
headerMobileMenuHtml +=me.compileMenu({ id:id,menu:menu,id:id,icon:val.icon, title:val.title, },true);
|
||||
headerMenuCheckDefault = "";
|
||||
leftMenuCheckDefault = "layui-hide" ;
|
||||
return topMenuItemHtml ;
|
||||
}).join("");
|
||||
$('.layui-layout-body').addClass('layuimini-multi-module'); //多模块标识
|
||||
$('.layuimini-menu-header-pc').html(headerMenuHtml); //电脑
|
||||
$('.layuimini-menu-left').html(leftMenuHtml);
|
||||
$('.layuimini-menu-header-mobile').html(headerMobileMenuHtml); //手机
|
||||
element.init();
|
||||
},
|
||||
|
||||
/**
|
||||
* 监听
|
||||
*/
|
||||
//监听
|
||||
listen: function () {
|
||||
|
||||
/**
|
||||
* 菜单模块切换
|
||||
*/
|
||||
$('body').on('click', '[data-menu]', function () {
|
||||
var loading = layer.load(0, {shade: false, time: 2 * 1000});
|
||||
var menuId = $(this).attr('data-menu');
|
||||
// header
|
||||
$(".layuimini-header-menu .layui-nav-item.layui-this").removeClass('layui-this');
|
||||
$(this).addClass('layui-this');
|
||||
// left
|
||||
$(".layuimini-menu-left .layui-nav.layui-nav-tree.layui-this").addClass('layui-hide');
|
||||
$(".layuimini-menu-left .layui-nav.layui-nav-tree.layui-this.layui-hide").removeClass('layui-this');
|
||||
$("#" + menuId).removeClass('layui-hide');
|
||||
$("#" + menuId).addClass('layui-this');
|
||||
layer.close(loading);
|
||||
});
|
||||
|
||||
/**
|
||||
* 菜单缩放
|
||||
*/
|
||||
$('body').on('click', '.layuimini-site-mobile', function () {
|
||||
var loading = layer.load(0, {shade: false, time: 2 * 1000});
|
||||
var isShow = $('.layuimini-tool [data-side-fold]').attr('data-side-fold');
|
||||
if (isShow == 1) { // 缩放
|
||||
$('.layuimini-tool [data-side-fold]').attr('data-side-fold', 0);
|
||||
$('.layuimini-tool [data-side-fold]').attr('class', 'fa fa-indent');
|
||||
$('.layui-layout-body').removeClass('layuimini-all');
|
||||
$('.layui-layout-body').addClass('layuimini-mini');
|
||||
} else { // 正常
|
||||
$('.layuimini-tool [data-side-fold]').attr('data-side-fold', 1);
|
||||
$('.layuimini-tool [data-side-fold]').attr('class', 'fa fa-outdent');
|
||||
$('.layui-layout-body').removeClass('layuimini-mini');
|
||||
$('.layui-layout-body').addClass('layuimini-all');
|
||||
layer.close(window.openTips);
|
||||
}
|
||||
element.init();
|
||||
layer.close(loading);
|
||||
});
|
||||
/**
|
||||
* 菜单缩放
|
||||
*/
|
||||
//菜单缩放
|
||||
$('body').on('click', '[data-side-fold]', function () {
|
||||
var loading = layer.load(0, {shade: false, time: 2 * 1000});
|
||||
var isShow = $('.layuimini-tool [data-side-fold]').attr('data-side-fold');
|
||||
@@ -211,40 +96,17 @@ layui.define(["element","laytpl" ,"jquery"], function (exports) {
|
||||
$('.layuimini-tool [data-side-fold]').attr('class', 'fa fa-indent');
|
||||
$('.layui-layout-body').removeClass('layuimini-all');
|
||||
$('.layui-layout-body').addClass('layuimini-mini');
|
||||
// $(".menu-li").each(function (idx,el) {
|
||||
// $(el).addClass("hidden-sub-menu");
|
||||
// });
|
||||
|
||||
} else { // 正常
|
||||
$('.layuimini-tool [data-side-fold]').attr('data-side-fold', 1);
|
||||
$('.layuimini-tool [data-side-fold]').attr('class', 'fa fa-outdent');
|
||||
$('.layui-layout-body').removeClass('layuimini-mini');
|
||||
$('.layui-layout-body').addClass('layuimini-all');
|
||||
// $(".menu-li").each(function (idx,el) {
|
||||
// $(el).removeClass("hidden-sub-menu");
|
||||
// });
|
||||
layer.close(window.openTips);
|
||||
}
|
||||
element.init();
|
||||
layer.close(loading);
|
||||
});
|
||||
|
||||
/**
|
||||
* 手机端点开模块
|
||||
*/
|
||||
$('body').on('click', '.layuimini-header-menu.layuimini-mobile-show dd', function () {
|
||||
var loading = layer.load(0, {shade: false, time: 2 * 1000});
|
||||
var check = $('.layuimini-tool [data-side-fold]').attr('data-side-fold');
|
||||
if(check === "1"){
|
||||
$('.layuimini-site-mobile').trigger("click");
|
||||
element.init();
|
||||
}
|
||||
layer.close(loading);
|
||||
});
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
|
||||
exports("miniMenu", miniMenu);
|
||||
});
|
||||
|
||||
@@ -1,27 +1,13 @@
|
||||
/**
|
||||
* date:2020/02/27
|
||||
* author:Mr.Chung
|
||||
* version:2.0
|
||||
* description:layuimini tab框架扩展
|
||||
*/
|
||||
layui.define(["element", "layer", "jquery"], function (exports) {
|
||||
var element = layui.element,
|
||||
layer = layui.layer,
|
||||
$ = layui.$;
|
||||
|
||||
|
||||
var element = layui.element,layer = layui.layer,$ = layui.$;
|
||||
var miniTab = {
|
||||
|
||||
/**
|
||||
* 初始化tab
|
||||
* @param options
|
||||
*/
|
||||
//初始化tab
|
||||
render: function (options) {
|
||||
options.filter = options.filter || null;
|
||||
options.multiModule = options.multiModule || false;
|
||||
options.urlHashLocation = options.urlHashLocation || false;
|
||||
options.maxTabNum = options.maxTabNum || 20;
|
||||
options.menuList = options.menuList || []; // todo 后期菜单想改为不操作dom, 而是直接操作初始化传过来的数据
|
||||
options.menuList = options.menuList || [];
|
||||
options.homeInfo = options.homeInfo || {};
|
||||
options.listenSwichCallback = options.listenSwichCallback || function () {
|
||||
};
|
||||
@@ -30,15 +16,7 @@ layui.define(["element", "layer", "jquery"], function (exports) {
|
||||
miniTab.listenSwitch(options);
|
||||
miniTab.listenHash(options);
|
||||
},
|
||||
|
||||
/**
|
||||
* 新建tab窗口
|
||||
* @param options.tabId
|
||||
* @param options.href
|
||||
* @param options.title
|
||||
* @param options.isIframe
|
||||
* @param options.maxTabNum
|
||||
*/
|
||||
//新建tab窗口
|
||||
create: function (options) {
|
||||
options.tabId = options.tabId || null;
|
||||
options.href = options.href || null;
|
||||
@@ -59,35 +37,20 @@ layui.define(["element", "layer", "jquery"], function (exports) {
|
||||
$('.layuimini-menu-left').attr('layuimini-tab-tag', 'add');
|
||||
sessionStorage.setItem('layuiminimenu_' + options.tabId, options.title);
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 切换选项卡
|
||||
* @param tabId
|
||||
*/
|
||||
//切换选项卡
|
||||
change: function (tabId) {
|
||||
element.tabChange('layuiminiTab', tabId);
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除tab窗口
|
||||
* @param tabId
|
||||
* @param isParent
|
||||
*/
|
||||
//删除tab窗口
|
||||
delete: function (tabId, isParent) {
|
||||
// todo 未知BUG,不知道是不是layui问题,必须先删除元素
|
||||
$(".layuimini-tab .layui-tab-title .layui-unselect.layui-tab-bar").remove();
|
||||
|
||||
if (isParent === true) {
|
||||
parent.layui.element.tabDelete('layuiminiTab', tabId);
|
||||
} else {
|
||||
element.tabDelete('layuiminiTab', tabId);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 在iframe层打开新tab方法
|
||||
*/
|
||||
//在iframe层打开新tab方法
|
||||
openNewTabByIframe: function (options) {
|
||||
options.href = options.href || null;
|
||||
options.title = options.title || null;
|
||||
@@ -105,10 +68,7 @@ layui.define(["element", "layer", "jquery"], function (exports) {
|
||||
parent.layui.element.tabChange('layuiminiTab', options.href);
|
||||
parent.layer.close(loading);
|
||||
},
|
||||
|
||||
/**
|
||||
* 在iframe层关闭当前tab方法
|
||||
*/
|
||||
//在iframe层关闭当前tab方法
|
||||
deleteCurrentByIframe: function () {
|
||||
var ele = $(".layuimini-tab .layui-tab-title li.layui-this", parent.document);
|
||||
if (ele.length > 0) {
|
||||
@@ -116,10 +76,7 @@ layui.define(["element", "layer", "jquery"], function (exports) {
|
||||
miniTab.delete(layId, true);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 判断tab窗口
|
||||
*/
|
||||
//判断tab窗口
|
||||
check: function (tabId, isIframe) {
|
||||
// 判断选项卡上是否有
|
||||
var checkTab = false;
|
||||
@@ -140,12 +97,7 @@ layui.define(["element", "layer", "jquery"], function (exports) {
|
||||
}
|
||||
return checkTab;
|
||||
},
|
||||
|
||||
/**
|
||||
* 开启tab右键菜单
|
||||
* @param tabId
|
||||
* @param left
|
||||
*/
|
||||
//开启tab右键菜单
|
||||
openTabRignMenu: function (tabId, left) {
|
||||
miniTab.closeTabRignMenu();
|
||||
var menuHtml = '<div class="layui-unselect layui-form-select layui-form-selected layuimini-tab-mousedown layui-show" data-tab-id="' + tabId + '" style="left: ' + left + 'px!important">\n' +
|
||||
@@ -159,20 +111,12 @@ layui.define(["element", "layer", "jquery"], function (exports) {
|
||||
$('.layuimini-tab .layui-tab-title').after(menuHtml);
|
||||
$('.layuimini-tab .layui-tab-content').after(makeHtml);
|
||||
},
|
||||
|
||||
/**
|
||||
* 关闭tab右键菜单
|
||||
*/
|
||||
//关闭tab右键菜单
|
||||
closeTabRignMenu: function () {
|
||||
$('.layuimini-tab-mousedown').remove();
|
||||
$('.layuimini-tab-make').remove();
|
||||
},
|
||||
|
||||
/**
|
||||
* 查询菜单信息
|
||||
* @param href
|
||||
* @param menuList
|
||||
*/
|
||||
//查询菜单信息
|
||||
searchMenu: function (href, menuList) {
|
||||
var menu;
|
||||
for (key in menuList) {
|
||||
@@ -191,18 +135,11 @@ layui.define(["element", "layer", "jquery"], function (exports) {
|
||||
}
|
||||
return menu;
|
||||
},
|
||||
|
||||
/**
|
||||
* 监听
|
||||
* @param options
|
||||
*/
|
||||
//监听
|
||||
listen: function (options) {
|
||||
options = options || {};
|
||||
options.maxTabNum = options.maxTabNum || 20;
|
||||
|
||||
/**
|
||||
* 打开新窗口
|
||||
*/
|
||||
//打开新窗口
|
||||
$('body').on('click', '[layuimini-href]', function () {
|
||||
var loading = layer.load(0, {shade: false, time: 2 * 1000});
|
||||
var tabId = $(this).attr('layuimini-href'),
|
||||
@@ -237,10 +174,7 @@ layui.define(["element", "layer", "jquery"], function (exports) {
|
||||
element.tabChange('layuiminiTab', tabId);
|
||||
layer.close(loading);
|
||||
});
|
||||
|
||||
/**
|
||||
* 在iframe子菜单上打开新窗口
|
||||
*/
|
||||
//在iframe子菜单上打开新窗口
|
||||
$('body').on('click', '[layuimini-content-href]', function () {
|
||||
var loading = parent.layer.load(0, {shade: false, time: 2 * 1000});
|
||||
var tabId = $(this).attr('layuimini-content-href'),
|
||||
@@ -266,10 +200,7 @@ layui.define(["element", "layer", "jquery"], function (exports) {
|
||||
parent.layui.element.tabChange('layuiminiTab', tabId);
|
||||
parent.layer.close(loading);
|
||||
});
|
||||
|
||||
/**
|
||||
* 关闭选项卡
|
||||
**/
|
||||
//关闭选项卡
|
||||
$('body').on('click', '.layuimini-tab .layui-tab-title .layui-tab-close', function () {
|
||||
var loading = layer.load(0, {shade: false, time: 2 * 1000});
|
||||
var $parent = $(this).parent();
|
||||
@@ -279,10 +210,7 @@ layui.define(["element", "layer", "jquery"], function (exports) {
|
||||
}
|
||||
layer.close(loading);
|
||||
});
|
||||
|
||||
/**
|
||||
* 选项卡操作
|
||||
*/
|
||||
//选项卡操作
|
||||
$('body').on('click', '[layuimini-tab-close]', function () {
|
||||
var loading = layer.load(0, {shade: false, time: 2 * 1000});
|
||||
var closeType = $(this).attr('layuimini-tab-close');
|
||||
@@ -304,18 +232,12 @@ layui.define(["element", "layer", "jquery"], function (exports) {
|
||||
});
|
||||
layer.close(loading);
|
||||
});
|
||||
|
||||
/**
|
||||
* 禁用网页右键
|
||||
*/
|
||||
//禁用网页右键
|
||||
$(".layuimini-tab .layui-tab-title").unbind("mousedown").bind("contextmenu", function (e) {
|
||||
e.preventDefault();
|
||||
return false;
|
||||
});
|
||||
|
||||
/**
|
||||
* 注册鼠标右键
|
||||
*/
|
||||
//注册鼠标右键
|
||||
$('body').on('mousedown', '.layuimini-tab .layui-tab-title li', function (e) {
|
||||
var left = $(this).offset().left - $('.layuimini-tab ').offset().left + ($(this).width() / 2),
|
||||
tabId = $(this).attr('lay-id');
|
||||
@@ -323,17 +245,11 @@ layui.define(["element", "layer", "jquery"], function (exports) {
|
||||
miniTab.openTabRignMenu(tabId, left);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 关闭tab右键菜单
|
||||
*/
|
||||
//关闭tab右键菜单
|
||||
$('body').on('click', '.layui-body,.layui-header,.layuimini-menu-left,.layuimini-tab-make', function () {
|
||||
miniTab.closeTabRignMenu();
|
||||
});
|
||||
|
||||
/**
|
||||
* tab右键选项卡操作
|
||||
*/
|
||||
//tab右键选项卡操作
|
||||
$('body').on('click', '[layuimini-tab-menu-close]', function () {
|
||||
var loading = layer.load(0, {shade: false, time: 2 * 1000});
|
||||
var closeType = $(this).attr('layuimini-tab-menu-close'),
|
||||
@@ -358,10 +274,7 @@ layui.define(["element", "layer", "jquery"], function (exports) {
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 监听tab切换
|
||||
* @param options
|
||||
*/
|
||||
//监听tab切换
|
||||
listenSwitch: function (options) {
|
||||
options.filter = options.filter || null;
|
||||
options.multiModule = options.multiModule || false;
|
||||
@@ -382,21 +295,12 @@ layui.define(["element", "layer", "jquery"], function (exports) {
|
||||
$('.layuimini-menu-left').attr('layuimini-tab-tag', 'no')
|
||||
} else {
|
||||
$("[layuimini-href]").parent().removeClass('layui-this');
|
||||
if (options.multiModule) {
|
||||
miniTab.listenSwitchMultiModule(tabId);
|
||||
} else {
|
||||
miniTab.listenSwitchSingleModule(tabId);
|
||||
}
|
||||
miniTab.listenSwitchSingleModule(tabId);
|
||||
}
|
||||
miniTab.rollPosition();
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 监听hash变化
|
||||
* @param options
|
||||
* @returns {boolean}
|
||||
*/
|
||||
//监听hash变化
|
||||
listenHash: function (options) {
|
||||
options.urlHashLocation = options.urlHashLocation || false;
|
||||
options.maxTabNum = options.maxTabNum || 20;
|
||||
@@ -405,10 +309,8 @@ layui.define(["element", "layer", "jquery"], function (exports) {
|
||||
if (!options.urlHashLocation) return false;
|
||||
var tabId = location.hash.replace(/^#/, '');
|
||||
if (tabId === null || tabId === undefined || tabId ==='') return false;
|
||||
|
||||
// 判断是否为首页
|
||||
if(tabId ===options.homeInfo.href) return false;
|
||||
|
||||
// 判断是否为右侧菜单
|
||||
var menu = miniTab.searchMenu(tabId, options.menuList);
|
||||
if (menu !== undefined) {
|
||||
@@ -423,7 +325,6 @@ layui.define(["element", "layer", "jquery"], function (exports) {
|
||||
element.tabChange('layuiminiTab', tabId);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 判断是否为快捷菜单
|
||||
var isSearchMenu = false;
|
||||
$("[layuimini-content-href]").each(function () {
|
||||
@@ -443,7 +344,6 @@ layui.define(["element", "layer", "jquery"], function (exports) {
|
||||
}
|
||||
});
|
||||
if (isSearchMenu) return false;
|
||||
|
||||
// 既不是右侧菜单、快捷菜单,就直接打开
|
||||
var title = sessionStorage.getItem('layuiminimenu_' + tabId) === null ? tabId : sessionStorage.getItem('layuiminimenu_' + tabId);
|
||||
miniTab.create({
|
||||
@@ -456,10 +356,7 @@ layui.define(["element", "layer", "jquery"], function (exports) {
|
||||
element.tabChange('layuiminiTab', tabId);
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
* 监听滚动
|
||||
*/
|
||||
//监听滚动
|
||||
listenRoll: function () {
|
||||
$(".layuimini-tab-roll-left").click(function () {
|
||||
miniTab.rollClick("left");
|
||||
@@ -468,11 +365,7 @@ layui.define(["element", "layer", "jquery"], function (exports) {
|
||||
miniTab.rollClick("right");
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 单模块切换
|
||||
* @param tabId
|
||||
*/
|
||||
//单模块切换
|
||||
listenSwitchSingleModule: function (tabId) {
|
||||
$("[layuimini-href]").each(function () {
|
||||
if ($(this).attr("layuimini-href") === tabId) {
|
||||
@@ -499,50 +392,7 @@ layui.define(["element", "layer", "jquery"], function (exports) {
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 多模块切换
|
||||
* @param tabId
|
||||
*/
|
||||
listenSwitchMultiModule: function (tabId) {
|
||||
$("[layuimini-href]").each(function () {
|
||||
if ($(this).attr("layuimini-href") === tabId) {
|
||||
|
||||
// 自动展开菜单栏
|
||||
var addMenuClass = function ($element, type) {
|
||||
if (type === 1) {
|
||||
$element.addClass('layui-this');
|
||||
if ($element.hasClass('layui-nav-item') && $element.hasClass('layui-this')) {
|
||||
var moduleId = $element.parent().attr('id');
|
||||
$(".layuimini-header-menu li").attr('class', 'layui-nav-item');
|
||||
$("#" + moduleId + "HeaderId").addClass("layui-this");
|
||||
$(".layuimini-menu-left .layui-nav.layui-nav-tree").attr('class', 'layui-nav layui-nav-tree layui-hide');
|
||||
$("#" + moduleId).attr('class', 'layui-nav layui-nav-tree layui-this');
|
||||
} else {
|
||||
addMenuClass($element.parent().parent(), 2);
|
||||
}
|
||||
} else {
|
||||
$element.addClass('layui-nav-itemed');
|
||||
if ($element.hasClass('layui-nav-item') && $element.hasClass('layui-nav-itemed')) {
|
||||
var moduleId = $element.parent().attr('id');
|
||||
$(".layuimini-header-menu li").attr('class', 'layui-nav-item');
|
||||
$("#" + moduleId + "HeaderId").addClass("layui-this");
|
||||
$(".layuimini-menu-left .layui-nav.layui-nav-tree").attr('class', 'layui-nav layui-nav-tree layui-hide');
|
||||
$("#" + moduleId).attr('class', 'layui-nav layui-nav-tree layui-this');
|
||||
} else {
|
||||
addMenuClass($element.parent().parent(), 2);
|
||||
}
|
||||
}
|
||||
};
|
||||
addMenuClass($(this).parent(), 1);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 自动定位
|
||||
*/
|
||||
//自动定位
|
||||
rollPosition: function () {
|
||||
var $tabTitle = $('.layuimini-tab .layui-tab-title');
|
||||
var autoLeft = 0;
|
||||
@@ -557,11 +407,7 @@ layui.define(["element", "layer", "jquery"], function (exports) {
|
||||
scrollLeft: autoLeft - $tabTitle.width() / 3
|
||||
}, 200);
|
||||
},
|
||||
|
||||
/**
|
||||
* 点击滚动
|
||||
* @param direction
|
||||
*/
|
||||
//点击滚动
|
||||
rollClick: function (direction) {
|
||||
var $tabTitle = $('.layuimini-tab .layui-tab-title');
|
||||
var left = $tabTitle.scrollLeft();
|
||||
@@ -575,8 +421,6 @@ layui.define(["element", "layer", "jquery"], function (exports) {
|
||||
}, 200);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
exports("miniTab", miniTab);
|
||||
});
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -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">';
|
||||
|
||||
@@ -1,396 +0,0 @@
|
||||
/* 最外层容器 */
|
||||
.ew-tree-table {
|
||||
margin: 10px 0;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.ew-tree-table .layui-table {
|
||||
margin: 0;
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
/* 表格容器 */
|
||||
.ew-tree-table-group {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* 主体表格容器 */
|
||||
.ew-tree-table > .ew-tree-table-group > .ew-tree-table-box {
|
||||
overflow: auto;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* 表头表格容器 */
|
||||
.ew-tree-table > .ew-tree-table-group > .ew-tree-table-head {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
|
||||
/* 容器加边框 */
|
||||
.ew-tree-table .ew-tree-table-border {
|
||||
position: absolute;
|
||||
background-color: #e6e6e6;
|
||||
}
|
||||
|
||||
.ew-tree-table .ew-tree-table-border.top {
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
height: 1px;
|
||||
}
|
||||
|
||||
.ew-tree-table .ew-tree-table-border.left {
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 1px;
|
||||
}
|
||||
|
||||
.ew-tree-table .ew-tree-table-border.right {
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
width: 0.52px;
|
||||
}
|
||||
|
||||
.ew-tree-table .ew-tree-table-border.bottom {
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
height: 0.52px;
|
||||
}
|
||||
|
||||
/* table的loading */
|
||||
.ew-tree-table .ew-tree-table-box > .ew-tree-table-loading {
|
||||
padding: 10px 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.ew-tree-table .ew-tree-table-box > .ew-tree-table-loading > i {
|
||||
color: #999;
|
||||
font-size: 30px;
|
||||
}
|
||||
|
||||
.ew-tree-table .ew-tree-table-box > .ew-tree-table-loading.ew-loading-float {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
/* 空数据提示 */
|
||||
.ew-tree-table .ew-tree-table-box > .ew-tree-table-empty {
|
||||
color: #666;
|
||||
font-size: 14px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* 折叠箭头 */
|
||||
.ew-tree-table .ew-tree-table-arrow {
|
||||
margin-right: 5px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.ew-tree-table .ew-tree-table-arrow:before {
|
||||
content: "\e623";
|
||||
}
|
||||
|
||||
.ew-tree-table .ew-tree-table-open .ew-tree-table-arrow:before {
|
||||
content: "\e625";
|
||||
}
|
||||
|
||||
.ew-tree-table .ew-tree-table-arrow.arrow2 {
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
line-height: 16px;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.ew-tree-table .ew-tree-table-arrow.arrow2:before {
|
||||
content: "\e602";
|
||||
}
|
||||
|
||||
.ew-tree-table .ew-tree-table-open .ew-tree-table-arrow.arrow2:before {
|
||||
content: "\e61a";
|
||||
}
|
||||
|
||||
/* 箭头隐藏 */
|
||||
.ew-tree-table-arrow.ew-tree-table-arrow-hide {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
/* 箭头变加载中状态 */
|
||||
.ew-tree-table .ew-tree-table-loading > td .ew-tree-pack > .ew-tree-table-arrow:before {
|
||||
content: "\e63d" !important;
|
||||
}
|
||||
|
||||
.ew-tree-table .ew-tree-table-loading > td .ew-tree-pack > .ew-tree-table-arrow {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.ew-tree-table .ew-tree-table-loading > td .ew-tree-pack > .ew-tree-table-arrow + * {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
/* tr加载中禁用事件 */
|
||||
.ew-tree-table tr.ew-tree-table-loading > * {
|
||||
pointer-events: none !important;
|
||||
}
|
||||
|
||||
/* 图标列 */
|
||||
.ew-tree-table .ew-tree-pack {
|
||||
cursor: pointer;
|
||||
line-height: 16px;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.ew-tree-table .ew-tree-pack > span {
|
||||
height: 16px;
|
||||
line-height: 16px;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
/* 折叠行 */
|
||||
.ew-tree-table .ew-tree-tb-hide {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* 缩进 */
|
||||
.ew-tree-table .ew-tree-table-indent {
|
||||
margin-right: 5px;
|
||||
padding-left: 16px;
|
||||
}
|
||||
|
||||
/* 图标 */
|
||||
.ew-tree-table .ew-tree-icon {
|
||||
margin-right: 5px;
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.ew-tree-table .ew-tree-icon-folder, .ew-tree-table .ew-tree-icon-file {
|
||||
width: 22px;
|
||||
height: 16px;
|
||||
line-height: 16px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.ew-tree-table .ew-tree-icon-folder:after, .ew-tree-table .ew-tree-icon-file:after {
|
||||
content: "";
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: -3px;
|
||||
background-size: cover;
|
||||
background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/PjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+PHN2ZyB0PSIxNTc0MDYyMzE3MTQ3IiBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHAtaWQ9IjIxNTgiIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iNjQiIGhlaWdodD0iNjQiPjxkZWZzPjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+PC9zdHlsZT48L2RlZnM+PHBhdGggZD0iTTE4MSA4MjNoLTMxLjFjLTI4LjYgMC01MS45LTIzLjItNTEuOS01MS45VjI1Mi40YzAtMjguNiAyMy4yLTUxLjkgNTEuOS01MS45SDQzMGw4MyA3Ny44aDMzMmM0NS42IDAgODMgMzUgODMgNzcuOHYzODkuMWMwIDQyLjgtMzcuMyA3Ny44LTgzIDc3LjhIMTgxeiIgcC1pZD0iMjE1OSIgZmlsbD0iI0ZGQTUwMCI+PC9wYXRoPjwvc3ZnPg==")
|
||||
}
|
||||
|
||||
.ew-tree-table tr.ew-tree-table-open > td > .ew-tree-pack .ew-tree-icon-folder:after {
|
||||
background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/PjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+PHN2ZyB0PSIxNTc0MDYyMzA5MDQwIiBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHAtaWQ9IjE5NzciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iNjQiIGhlaWdodD0iNjQiPjxkZWZzPjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+PC9zdHlsZT48L2RlZnM+PHBhdGggZD0iTTMyNi40IDQ2MC4xSDkyOGwtODIuMyAzMjRjLTUuOCAyMy0yNi42IDM5LjEtNTAuMyAzOS4xSDE0OS45Yy0yOC42IDAtNTEuOS0yMy4yLTUxLjktNTEuOVYyNTIuNmMwLTI4LjYgMjMuMi01MS45IDUxLjktNTEuOUg0MTNsMTA1IDEwMy43aDI5MS44YzE0LjMgMCAyNS45IDExLjYgMjUuOSAyNS45djc3LjhoLTUyN0wyMDMuNCA1NjMuOWg1Mi43bDcwLjMtMTAzLjh6IiBwLWlkPSIxOTc4IiBmaWxsPSIjRkZBNTAwIj48L3BhdGg+PC9zdmc+")
|
||||
}
|
||||
|
||||
.ew-tree-table .ew-tree-icon-file:after {
|
||||
background-image: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/PjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+PHN2ZyB0PSIxNTc0MDYyNTE1MDUxIiBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHAtaWQ9IjEzNTE4IiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgd2lkdGg9IjY0IiBoZWlnaHQ9IjY0Ij48ZGVmcz48c3R5bGUgdHlwZT0idGV4dC9jc3MiPjwvc3R5bGU+PC9kZWZzPjxwYXRoIGQ9Ik03NDEuMyAxNjEuNmgtNDIuNGMtMTAuNSAwLTE5LjEgOC42LTE5LjEgMTkuMXM4LjYgMTkuMSAxOS4xIDE5LjFoNDIuNGM0MiAwIDc2LjIgMzQuMiA3Ni4yIDc2LjN2NDc3LjRjMCA0Mi4xLTM0LjMgNzYuMy03Ni40IDc2LjNIMjgyLjljLTQyLjEgMC03Ni4zLTM0LjItNzYuMy03Ni4zVjI3Ni4xYzAtNDIuMSAzNC4yLTc2LjMgNzYuMy03Ni4zaDQ0LjljMTAuNSAwIDE5LjEtOC42IDE5LjEtMTkuMXMtOC42LTE5LjEtMTkuMS0xOS4xaC00NC45Yy02My4xIDAtMTE0LjUgNTEuNC0xMTQuNSAxMTQuNXY0NzcuNGMwIDYzLjEgNTEuNCAxMTQuNSAxMTQuNSAxMTQuNWg0NTguM2M2My4xIDAgMTE0LjUtNTEuNCAxMTQuNS0xMTQuNVYyNzYuMWMtMC4xLTYzLjEtNTEuNC0xMTQuNS0xMTQuNC0xMTQuNXoiIHAtaWQ9IjEzNTE5IiBmaWxsPSIjRkZBNTAwIj48L3BhdGg+PHBhdGggZD0iTTY4MC42IDUwNS4zSDM0My40Yy0xMi4zIDAtMjIuMyA4LjYtMjIuMyAxOS4xczEwIDE5LjEgMjIuMyAxOS4xaDMzNy4yYzEyLjMgMCAyMi4zLTguNiAyMi4zLTE5LjEgMC0xMC42LTEwLTE5LjEtMjIuMy0xOS4xek00MzkuMyAyMTMuM2gxNDQuNmMxOSAwIDM0LjQtMTIuOCAzNC40LTI4LjZzLTE1LjQtMjguNi0zNC40LTI4LjZINDM5LjNjLTE5IDAtMzQuNCAxMi44LTM0LjQgMjguNi0wLjEgMTUuNyAxNS4zIDI4LjYgMzQuNCAyOC42ek02ODAuNiA2NThIMzQzLjRjLTEyLjMgMC0yMi4zIDguNS0yMi4zIDE5LjEgMCAxMC41IDEwIDE5LjEgMjIuMyAxOS4xaDMzNy4yYzEyLjMgMCAyMi4zLTguNiAyMi4zLTE5LjEgMC0xMC42LTEwLTE5LjEtMjIuMy0xOS4xek02ODAuNiAzNTIuNUgzNDMuNGMtMTIuMyAwLTIyLjMgOC42LTIyLjMgMTkuMXMxMCAxOS4xIDIyLjMgMTkuMWgzMzcuMmMxMi4zIDAgMjIuMy04LjYgMjIuMy0xOS4xIDAtMTAuNS0xMC0xOS4xLTIyLjMtMTkuMXoiIHAtaWQ9IjEzNTIwIiBmaWxsPSIjRkZBNTAwIj48L3BhdGg+PC9zdmc+")
|
||||
}
|
||||
|
||||
/* 序号列调整 */
|
||||
.ew-tree-table td[data-type="numbers"] {
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* 单元格内表单元素样式调整 */
|
||||
.ew-tree-table .layui-form-switch {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.ew-tree-table .layui-form-radio {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* checkbox和radio列调整 */
|
||||
.ew-tree-table-checkbox + .layui-form-checkbox {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.ew-tree-table-checkbox + .layui-form-checkbox > .layui-icon {
|
||||
color: transparent;
|
||||
transition: background-color .1s linear;
|
||||
}
|
||||
|
||||
.ew-tree-table-checkbox + .layui-form-checkbox.layui-form-checked > .layui-icon {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.ew-tree-table-radio + .layui-form-radio {
|
||||
padding: 0;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.ew-tree-table-radio + .layui-form-radio > i {
|
||||
margin: 0;
|
||||
height: 20px;
|
||||
font-size: 20px;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
/* checkbox半选状态 */
|
||||
.ew-tree-table .layui-form-checked.ew-form-indeterminate > .layui-icon:before {
|
||||
content: "";
|
||||
width: 9px;
|
||||
height: 2px;
|
||||
display: inline-block;
|
||||
background-color: #eee;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.ew-tree-table .layui-form-checked.ew-form-indeterminate > .layui-icon {
|
||||
line-height: 14px;
|
||||
}
|
||||
|
||||
/* 单元格编辑 */
|
||||
.ew-tree-table .layui-table td[data-edit] {
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
.ew-tree-table .ew-tree-table-edit {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 0;
|
||||
box-shadow: 1px 1px 20px rgba(0, 0, 0, .15);
|
||||
}
|
||||
|
||||
.ew-tree-table .ew-tree-table-edit:focus {
|
||||
border-color: #5FB878 !important;
|
||||
}
|
||||
|
||||
.ew-tree-table .ew-tree-table-edit.layui-form-danger {
|
||||
border-color: #FF5722 !important;
|
||||
}
|
||||
|
||||
/* 搜索数据隐藏行 */
|
||||
.ew-tree-table tr.ew-tree-table-filter-hide {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/* 单元格超出隐藏 */
|
||||
.ew-tree-table-td-single {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.ew-tree-table-td-single > .ew-tree-tips {
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.ew-tree-table-td-single > .ew-tree-tips-c {
|
||||
position: absolute;
|
||||
right: -10px;
|
||||
top: -6px;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
line-height: 24px;
|
||||
font-size: 18px;
|
||||
text-align: center;
|
||||
color: #fff;
|
||||
border-radius: 50%;
|
||||
background-color: #666;
|
||||
cursor: pointer;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ew-tree-table table tr:first-child .ew-tree-table-td-single > .ew-tree-tips-c {
|
||||
top: 2px;
|
||||
bottom: auto;
|
||||
right: -12px;
|
||||
}
|
||||
|
||||
.ew-tree-table-td-single.ew-tree-tips-open {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 5;
|
||||
background-color: #fff;
|
||||
min-height: 100%;
|
||||
box-sizing: border-box;
|
||||
box-shadow: 3px 3px 8px rgba(0, 0, 0, .15);
|
||||
}
|
||||
|
||||
.ew-tree-table table thead .ew-tree-table-td-single.ew-tree-tips-open {
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
|
||||
.ew-tree-table-td-single.ew-tree-tips-open.ew-show-left {
|
||||
right: 0;
|
||||
left: auto;
|
||||
box-shadow: -3px 3px 8px rgba(0, 0, 0, .15);
|
||||
}
|
||||
|
||||
.ew-tree-table-td-single.ew-tree-tips-open.ew-show-bottom {
|
||||
bottom: 0;
|
||||
top: auto;
|
||||
box-shadow: 3px -3px 8px rgba(0, 0, 0, .15);
|
||||
}
|
||||
|
||||
.ew-tree-table-td-single.ew-tree-tips-open.ew-show-left.ew-show-bottom {
|
||||
box-shadow: -3px -3px 8px rgba(0, 0, 0, .15);
|
||||
}
|
||||
|
||||
.ew-tree-table-td-single.ew-tree-tips-open > .ew-tree-tips {
|
||||
padding: 9px 15px;
|
||||
overflow: auto;
|
||||
max-width: 280px;
|
||||
max-height: 100px;
|
||||
width: max-content;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.ew-tree-table-td-single.ew-tree-tips-open > .ew-tree-tips-c {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.ew-tree-table-td-single.ew-tree-tips-open.ew-show-left > .ew-tree-tips-c {
|
||||
left: -10px;
|
||||
right: auto !important;
|
||||
}
|
||||
|
||||
.ew-tree-table td > .layui-table-grid-down {
|
||||
bottom: 0;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
/* 辅助样式 */
|
||||
.pd-tb-0 {
|
||||
padding-top: 0 !important;
|
||||
padding-bottom: 0 !important;
|
||||
}
|
||||
|
||||
.break-all {
|
||||
word-break: break-all !important;
|
||||
}
|
||||
|
||||
/* 列宽拖拽调整 */
|
||||
/*.ew-tree-table .ew-tb-resize {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 10px;
|
||||
cursor: col-resize;
|
||||
}*/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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(){
|
||||
|
||||
@@ -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();
|
||||
//渲染表格
|
||||
@@ -165,7 +165,7 @@ layui.use(['form','table','dropdown','miniTab'], function () {
|
||||
}
|
||||
|
||||
var checkStatus = table.checkStatus(obj.config.id);
|
||||
if( checkStatus.data.length == 0 && ['LAYTABLE_COLS','LAYTABLE_EXPORT','LAYTABLE_PRINT','batch'].indexOf(event) == -1 ) {
|
||||
if( checkStatus.data.length == 0 && ['LAYTABLE_COLS','LAYTABLE_EXPORT','LAYTABLE_PRINT','batch','link_extend'].indexOf(event) == -1 ) {
|
||||
layer.msg('未选中任何数据!');
|
||||
return;
|
||||
}
|
||||
@@ -248,21 +248,63 @@ layui.use(['form','table','dropdown','miniTab'], function () {
|
||||
return true;
|
||||
}
|
||||
})
|
||||
}else if(event === 'generate'){ //生成大量链接
|
||||
if($('#fid').val() == 0 ){
|
||||
layer.msg("请选择一个分类",{icon:3});
|
||||
return;
|
||||
}
|
||||
var fid = $('#fid').val();
|
||||
for (i = 0; i < 1000; i++) {
|
||||
$.post(get_api('write_link','add'),{title:'百度翻译'+i,fid:fid,url:'https://fanyi.baidu.com/#zh/en/'+i+'_'+randomString(5)},function(data,status){
|
||||
|
||||
}else if(event === 'icon_pull'){
|
||||
let i = 0;
|
||||
let total = checkStatus.data.length;
|
||||
layer.load(1, {shade:[0.3,'#fff']});//加载层
|
||||
let msg_id = layer.msg('正在拉取中', {icon: 16,time: 1000*300});
|
||||
icon_pull(i);
|
||||
function icon_pull(id){
|
||||
if(i >= total){
|
||||
layer.closeAll();
|
||||
layer.alert('拉取完毕',{icon:1,title:'信息',anim: 2,shadeClose: false,closeBtn: 0});
|
||||
return true;
|
||||
}
|
||||
$("#layui-layer"+ msg_id+" .layui-layer-padding").html('<i class="layui-layer-ico layui-layer-ico16"></i>[ ' + i + ' / ' + total + ' ] 正在拉取图标');
|
||||
$.post(get_api('write_link','icon_pull'),{id:checkStatus.data[i].lid},function(data,status){
|
||||
if(data.code == 1){
|
||||
i ++;
|
||||
icon_pull(i);
|
||||
} else{
|
||||
layer.closeAll();
|
||||
layer.alert(data.msg,{icon:5,title:'信息',anim: 2,shadeClose: false,closeBtn: 0});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}else if(event === 'link_extend'){
|
||||
extend_data = '';
|
||||
index = layer.open({type: 1,scrollbar: false,shadeClose: true,title: '编辑扩展字段',area : ['100%', '100%'],content: $('.link_extend')});
|
||||
$.post(get_api('read_link_list','extend_list'),function(data,status){
|
||||
if(data.code == 1){
|
||||
extend_data = data.data;
|
||||
table.reload('link_extend_list', {data: extend_data});
|
||||
} else{
|
||||
layer.msg(data.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
table.render({
|
||||
elem: '#link_extend_list'
|
||||
,height: 'full-150'
|
||||
,data: {}
|
||||
,response: {statusCode: 1 }
|
||||
,method: 'post'
|
||||
,page: false
|
||||
,limit: 1000
|
||||
,even:true
|
||||
,id:'link_extend_list'
|
||||
,loading:true
|
||||
,cols: [[
|
||||
{field:'weight',title:'序号',edit:'text',width:80}
|
||||
,{field:'title',title:'标题',edit:'text',width:256}
|
||||
,{field:'name',title:'字段名',edit:'text',width:256}
|
||||
,{field:'type',title:'类型',edit:'text',width:256}
|
||||
,{field:'default',title:'默认值',edit:'text',width:256}
|
||||
,{ title:'操作',toolbar:'#link_extend_toolbar',align:'center',width:118}
|
||||
]]
|
||||
});
|
||||
//监听工具条
|
||||
table.on('tool(table)', function (obj) {
|
||||
var data = obj.data;
|
||||
@@ -387,4 +429,58 @@ layui.use(['form','table','dropdown','miniTab'], function () {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//自定义字段行事件
|
||||
table.on('tool(link_extend_list)', function (obj) {
|
||||
var data = obj.data;
|
||||
var row = $(obj.tr).attr("data-index"); //获取行索引
|
||||
if (obj.event === 'del') {
|
||||
layer.confirm('确认移除?',{icon: 3, title:'温馨提示'}, function(index){
|
||||
obj.del();
|
||||
layer.close(index);
|
||||
layer.msg("移除成功,点击保存后生效!",{icon:1});
|
||||
});
|
||||
}
|
||||
});
|
||||
//添加字段
|
||||
$('#add_field').click(function () {
|
||||
let data = table.cache.link_extend_list;
|
||||
let max_weight = 0;
|
||||
//找出最大的一个排序值
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
if( parseInt(data[i].weight) > max_weight ){
|
||||
max_weight = parseInt(data[i].weight);
|
||||
}
|
||||
}
|
||||
data.push({
|
||||
"title": "请输入标题",
|
||||
"name":"请输入字段名(大小写字母或数字)",
|
||||
"weight":(max_weight + 1),
|
||||
"type":"请输入 text 或 textarea",
|
||||
"default":""
|
||||
});
|
||||
table.reload('link_extend_list', {data: data});
|
||||
return false;
|
||||
});
|
||||
//保存字段
|
||||
$('#save_field').click(function () {
|
||||
var data = [];
|
||||
var tableBak = table.cache.link_extend_list;
|
||||
for (var i = 0; i < tableBak.length; i++) {
|
||||
//过滤掉被删除的空数据
|
||||
if(typeof tableBak[i].LAY_TABLE_INDEX == 'number'){
|
||||
data.push(tableBak[i]);
|
||||
}
|
||||
}
|
||||
$.post(get_api('write_link','extend_list') ,{list:JSON.stringify(data)},function(data,status){
|
||||
if(data.code == 1){
|
||||
table.reload("link_extend_list",{data:data.datas});
|
||||
layer.msg('保存成功', {icon: 1});
|
||||
} else{
|
||||
layer.msg(data.msg,{icon:5});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -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'} //开启单选框
|
||||
|
||||
@@ -32,16 +32,19 @@ function _GET(letiable,top = false){
|
||||
let pair = lets[i].split("=");
|
||||
if(pair[0] == letiable){return pair[1];}
|
||||
}
|
||||
return(false);
|
||||
return false;
|
||||
}
|
||||
//时间戳格式化
|
||||
function timestampToTime(timestamp) {
|
||||
function timestampToTime(timestamp,ymd = false) {
|
||||
let date = new Date(timestamp * 1000);
|
||||
let y = date.getFullYear();
|
||||
let m = date.getMonth() + 1;
|
||||
m = m < 10 ? ('0' + m) : m;
|
||||
let d = date.getDate();
|
||||
d = d < 10 ? ('0' + d) : d;
|
||||
if(ymd){
|
||||
return y + '-' + m + '-' + d;
|
||||
}
|
||||
let h = date.getHours();
|
||||
h = h < 10 ? ('0' + h) : h;
|
||||
let minute = date.getMinutes();
|
||||
@@ -68,4 +71,12 @@ function Get_baseUrl() {
|
||||
pathname = pathname.substring(0, pathname.lastIndexOf("/") + 1),
|
||||
baseUrl = protocol + "//" + hostname + (port ? ":" + port : "") + pathname;
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
//帮助
|
||||
if (typeof jQuery != 'undefined') {
|
||||
$("#help").click(function(){
|
||||
window.open("https://gitee.com/tznb/TwoNav/wikis/pages?sort_id=" + $(this).attr("sort_id") + "&doc_id=3767990","target");
|
||||
return false;
|
||||
});
|
||||
}
|
||||
@@ -66,7 +66,7 @@
|
||||
<div class="content">
|
||||
<p class="result"><?php echo $msg['big_title'] ??''; ?></p>
|
||||
<div class="method">
|
||||
<p class="methodTitle">可能原因:</p>
|
||||
<p class="methodTitle"><?php echo $msg['methodTitle'] ??'可能原因:'; ?></p>
|
||||
<div class="methodItems">
|
||||
<?php echo $msg['content']; ?>
|
||||
</div>
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -62,11 +62,49 @@
|
||||
<option value="4" >api.15777.cn</option>
|
||||
<option value="5" >favicon.cccyun.cc</option>
|
||||
<option value="6" >api.iowen.cn</option>
|
||||
<!--<option value="7" >toolb.cn</option>-->
|
||||
<!--<option value="8" >apis.jxcxin.cn</option>-->
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">所有API接口均由其他大佬提供!若有异常请尝试更换接口!</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">热门网址</label>
|
||||
<div class="layui-input-inline" >
|
||||
<select name="top_link">
|
||||
<option value="0" selected>不显示</option>
|
||||
<option value="5" >显示5条</option>
|
||||
<option value="10" >显示10条</option>
|
||||
<option value="15" >显示15条</option>
|
||||
<option value="20" >显示20条</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">在主页显示热门网址(点击排行)</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">最新网址</label>
|
||||
<div class="layui-input-inline" >
|
||||
<select name="new_link">
|
||||
<option value="0" selected>不显示</option>
|
||||
<option value="5" >显示5条</option>
|
||||
<option value="10" >显示10条</option>
|
||||
<option value="15" >显示15条</option>
|
||||
<option value="20" >显示20条</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">在主页显示最新的网址(创建时间)</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">输出上限</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="number" name="max_link" class="layui-input" value="0" placeholder="输入范围: 0-100" lay-verify="required">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">限制每个分类下显示多少链接,0表示不限制</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">站点图标</label>
|
||||
<div class="layui-input-block">
|
||||
@@ -96,14 +134,19 @@
|
||||
|
||||
<?php } ?>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block"><button class="layui-btn layui-btn-normal" lay-submit lay-filter="save">确认保存</button></div>
|
||||
<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 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>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script src = "<?php echo $libs;?>/jquery/jquery-3.6.0.min.js"></script>
|
||||
<script src = "./templates/admin/js/public.js?v=<?php echo $Ver;?>"></script>
|
||||
<script src="<?php echo $libs;?>/jquery/jquery-3.6.0.min.js"></script>
|
||||
<script src="<?php echo $libs;?>/jquery/jQueryCookie.js"></script>
|
||||
<script src="./templates/admin/js/public.js?v=<?php echo $Ver;?>"></script>
|
||||
<?php load_static('js.layui');?>
|
||||
<script>
|
||||
layui.use(['jquery','form','upload'], function () {
|
||||
@@ -135,6 +178,18 @@ layui.use(['jquery','form','upload'], function () {
|
||||
layer.msg("权限不足", {icon: 2});
|
||||
});
|
||||
|
||||
$("#sdhp").text( getCookie("Default_User") == u ? '取消默认主页' : '设为默认主页')
|
||||
$('#sdhp').click(function () {
|
||||
if(getCookie("Default_User") == u){
|
||||
$.removeCookie("Default_User");
|
||||
$("#sdhp").text('设为默认主页')
|
||||
}else{
|
||||
$.cookie("Default_User",u,{expires: 360});
|
||||
$("#sdhp").text('取消默认主页')
|
||||
}
|
||||
layer.msg("设置成功", {icon: 1});
|
||||
return false;
|
||||
});
|
||||
//监听提交
|
||||
form.on('submit(save)', function (data) {
|
||||
$.post('./index.php?c=api&method=write_site_setting&u='+u,data.field,function(data,status){
|
||||
@@ -146,6 +201,7 @@ layui.use(['jquery','form','upload'], function () {
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
<label class="layui-form-label required">所属分类</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="fid" id="fid" lay-verify="required">
|
||||
<option value=""></option><?php echo_category(true); ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -72,6 +72,7 @@
|
||||
<div class="layui-input-block">
|
||||
<select name="pwd_id" id="pwd_id">
|
||||
<option value="0">无</option>
|
||||
<?php echo_pwds(); ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
<div class="layui-progress" lay-filter="progress" id="progress" style="display:none;">
|
||||
<div class="layui-progress-bar"></div>
|
||||
</div>
|
||||
<blockquote class="layui-elem-quote" style="margin-top: 10px;border-left: 5px solid #FF5722; color: #FF5722;" id='guide'>第一步:请上传数据,支持: db3 / html 格式(最大10M),使用前请参考<a href="https://gitee.com/tznb/TwoNav/wikis/pages?sort_id=7937908&doc_id=3674619" target="_blank" rel = "nofollow">帮助文档</a></blockquote>
|
||||
<blockquote class="layui-elem-quote" style="margin-top: 10px;border-left: 5px solid #FF5722; color: #FF5722;" id='guide'>第一步:请上传数据,支持: db3 / html 格式(最大10M),使用前请参考<a href="https://gitee.com/tznb/TwoNav/wikis/pages?sort_id=7968661&doc_id=3767990" target="_blank" rel = "nofollow">帮助文档</a></blockquote>
|
||||
|
||||
<div class="layui-form-item" style="display:none;" id='fid'>
|
||||
<label class="layui-form-label">所属分类</label>
|
||||
@@ -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();});
|
||||
@@ -500,7 +500,7 @@ layui.use(['layer','element','upload','form','table'], function(){
|
||||
}else if(obj.event == 'local_refresh'){
|
||||
table.reload('list');
|
||||
}else if(obj.event == 'local_help'){
|
||||
window.open('https://gitee.com/tznb/TwoNav/wikis/pages?sort_id=7937908&doc_id=3674619');
|
||||
window.open('https://gitee.com/tznb/TwoNav/wikis/pages?sort_id=7968661&doc_id=3767990');
|
||||
}
|
||||
});
|
||||
//行事件
|
||||
|
||||
@@ -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);?>);
|
||||
//表头
|
||||
|
||||
@@ -58,7 +58,7 @@ if($s['help'] != 'del'|| !count($dbs) || isset($_GET['help'])){
|
||||
$arr['type'] = '使用说明';
|
||||
$arr['contact'] = '271152681@qq.com';
|
||||
$arr['title'] = 'TwoNav 极简留言板';
|
||||
$arr['content'] = "1.极简留言板采用轻量设计,整体只有几KB\n2.留言数据存放路径/data/user/xxx/MessageBoard/ (xxx表示用户名)\n3.默认是禁止留言的,点击上方蓝色字(禁止留言/允许留言)可切换状态\n4.使用方法: 点击极简留言板(蓝字)>把地址栏的URL复制>在后台添加链接即可\n5.本条信息被删除时如果存在留言则不显示,没有留言时依旧会显示!\n6.有提交长度限制,类型32,联系方式64,标题128,内容2048字节!若不够用请自己修改源代码!\n7.为了防止被恶意提交,当留言数超过256时将不在接收留言!";
|
||||
$arr['content'] = "1.极简留言板采用轻量设计,整体只有几KB\n2.留言数据存放路径/data/user/xxx/MessageBoard/ (xxx表示用户名)\n3.默认是禁止留言的,点击上方蓝色字(禁止留言/允许留言)可切换状态\n4.使用方法: 点击极简留言板(蓝字)>把地址栏的URL复制>在后台添加链接即可(部分主题已支持自动展现入口)\n5.本条信息被删除时如果存在留言则不显示,没有留言时依旧会显示!\n6.有提交长度限制,类型32,联系方式64,标题128,内容2048字节!若不够用请自己修改源代码!\n7.为了防止被恶意提交,当留言数超过256时将不在接收留言!";
|
||||
$arr['time'] = date("Y-m-d H:i:s",time());
|
||||
$arr['ip'] = '127.0.0.1';
|
||||
$arr['id'] = $id;
|
||||
@@ -113,7 +113,7 @@ $title='留言管理';require dirname(__DIR__).'/header.php';
|
||||
<?php foreach ( $data as $value ) { ?>
|
||||
<div class="layui-colla-item">
|
||||
<h2 class="layui-colla-title"><?php echo $value['id'] .'. [ '. $value['type'] .' ] [ '. $value['title'].' ]'; ?> 
|
||||
<a style="cursor:pointer;" rel = "nofollow" onclick = "del('<?php echo $value['file'] ?>')">删除</a>
|
||||
<a class="click" style="cursor:pointer;" rel = "nofollow" onclick = "del('<?php echo $value['file'] ?>')">删除</a>  
|
||||
</h2>
|
||||
<div class="layui-colla-content <?php if( $value['id'] <= $show ){echo 'layui-show';} ?>">
|
||||
<p><?php echo '提交时间: '. $value['time'] .'<br />终端地址: '. $value['ip'] .'<br />联系方式: '. $value['contact'] .'<br /> <br />'. str_replace("\n","<br />",str_replace(" "," ",$value['content'])) ; ?></p>
|
||||
@@ -134,6 +134,11 @@ layui.use(['layer','element'], function(){
|
||||
var layer = layui.layer;
|
||||
});
|
||||
|
||||
$('.click').click(function (event) {
|
||||
event.preventDefault();
|
||||
return false;
|
||||
});
|
||||
|
||||
function del(name) {
|
||||
$.post('',{'type':'del','name':name},function(data,status){
|
||||
if(data.code == 1) {
|
||||
@@ -154,6 +159,7 @@ function set(key){
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -22,7 +22,7 @@
|
||||
<div class="layui-container">
|
||||
<div class="layui-col-lg10 ">
|
||||
<form class="layui-form">
|
||||
<fieldset class="layui-elem-field layui-field-title " style="margin-top: 30px;"><legend><a href="https://gitee.com/tznb/OneNav" target="_blank" rel="nofollow">TwoNav</a> 极简留言板</legend></fieldset>
|
||||
<fieldset class="layui-elem-field layui-field-title " style="margin-top: 30px;"><legend><a href="https://gitee.com/tznb/TwoNav" target="_blank" rel="nofollow">TwoNav</a> 极简留言板</legend></fieldset>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">反馈类型</label>
|
||||
<div class="layui-input-inline">
|
||||
@@ -59,7 +59,7 @@
|
||||
</div>
|
||||
</form>
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
|
||||
<legend>Powered by <a href="https://gitee.com/tznb/OneNav" target="_blank" rel="nofollow">lm21</a></legend>
|
||||
<legend>Powered by <a href="https://gitee.com/tznb/TwoNav" target="_blank" rel="nofollow">lm21</a></legend>
|
||||
<!--非订阅用户请勿去除版权,谢谢-->
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<?php
|
||||
$title='概况';
|
||||
$awesome=true;
|
||||
$HOST = getindexurl();
|
||||
|
||||
|
||||
//读取缓存数据
|
||||
$Notice = get_db('global_config','v',['k'=>'notice']);
|
||||
@@ -173,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>
|
||||
@@ -252,20 +252,21 @@ require 'header.php';
|
||||
<?php }?>
|
||||
<tr>
|
||||
<td>用户交流</td>
|
||||
<td>QQ群:695720839</td>
|
||||
<td><a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=LaIzFK2hfTYBZGR0cKvW3xZL6aNgcSXH&jump_from=webapi&authKey=LHh1NtAiGdK0wNyoZiHWrzAZTWWq26YgAwX0Ak7rBWchh6Y5ocUX/0cCXLMXvq/k" title="TwoNav - 技术交流">QQ群:695720839</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>技术支持</td>
|
||||
<td>QQ:271152681</td>
|
||||
<td><a target="_blank" href="tencent://message/?uin=271152681">QQ:271152681</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>专属地址</td>
|
||||
<td>
|
||||
<a href="<?php echo $HOST.'?u='.U;?>" target="_blank">我的主页</a>
|
||||
<a href="<?php echo './?u='.U;?>" target="_blank">我的主页</a>
|
||||
|
||||
<a href="<?php echo $HOST.'?c='.$USER_DB['Login'].'&u='.U;?>" target="_blank">TwoNav - 登录</a>
|
||||
<a href="<?php echo './?c='.$USER_DB['Login'].'&u='.U;?>" target="_blank">TwoNav - 登录</a>
|
||||
|
||||
<i class="fa fa-arrow-left layui-hide-xs" style="color: #ff5722;"> <span style="color: #ff5722;" title="收藏专属入口可避免出现无法登录后台的情况">建议收藏</span></i>
|
||||
<i class="fa fa-arrow-left layui-hide-xs" style="color: #ff5722;"> <span style="color: #ff5722;" title="收藏专属入口可避免无法登录后台的情况">建议收藏</span></i>
|
||||
</td>
|
||||
<tr>
|
||||
</tbody>
|
||||
@@ -285,6 +286,10 @@ if($USER_DB['UserGroup'] == 'root'){
|
||||
}
|
||||
?>
|
||||
<script>
|
||||
layui.extend({
|
||||
echarts: '{/}<?php echo $libs?>/Layui/extend/echarts',
|
||||
echartsTheme: '{/}<?php echo $libs?>/Layui/extend/echartsTheme'
|
||||
});
|
||||
layui.use(['layer', 'miniTab','echarts'], function () {
|
||||
var $ = layui.jquery,
|
||||
layer = layui.layer,
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:11px;font-weight:700;color:#fff;line-height:1;vertical-align:middle;white-space:nowrap;text-align:center;background-color:#777;border-radius:10px}
|
||||
</style>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main" style=" margin-left: 0px; ">
|
||||
<div class="layuimini-main">
|
||||
<form class="layui-form layuimini-form" lay-filter="form">
|
||||
|
||||
<div class="layui-form-item">
|
||||
|
||||
@@ -99,7 +99,11 @@ $title='编辑链接';$awesome=true; require 'header.php';
|
||||
<textarea name="description" id="description" placeholder="请输入内容" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
//判断全局是否开启扩展
|
||||
if($global_config['link_extend'] && check_purview('link_extend',1)){
|
||||
require 'link_extend.php';
|
||||
}?>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block layui-btn-group">
|
||||
<button class="layui-btn layui-btn-warm" type="button" id="close" >关闭</button>
|
||||
|
||||
47
templates/admin/page/link_extend.php
Normal file
47
templates/admin/page/link_extend.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
|
||||
<legend>扩展字段</legend>
|
||||
</fieldset>
|
||||
<?php
|
||||
//读取扩展字段列表
|
||||
$list = get_db("user_config","v",["k"=>"s_extend_list","uid"=>UID]);
|
||||
//不为空则渲染
|
||||
if(!empty($list)){
|
||||
$list = unserialize($list);
|
||||
$extend_data = get_db('user_links','extend',['uid'=>UID,'lid'=>$link['lid']]);
|
||||
$extend_data = empty($extend_data) ? [] : unserialize($extend_data);
|
||||
|
||||
foreach ($list as $data) {
|
||||
$field = "_".$data['name'];
|
||||
$data['value'] = isset($extend_data[$field]) ? $extend_data[$field] : $data['default'];
|
||||
if($data['type'] == 'text'){
|
||||
echo_text($data);
|
||||
}elseif($data['type'] == 'textarea'){
|
||||
echo_textarea($data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function echo_text($data){ ?>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><?php echo $data['title']?></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="_<?php echo $data['name']?>" autocomplete="off" value="<?php echo htmlentities($data['value'])?>" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
function echo_textarea($data){ ?>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><?php echo $data['title']?></label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="_<?php echo $data['name']?>" class="layui-textarea"><?php echo htmlentities($data['value'])?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -65,34 +65,48 @@
|
||||
<button class="layui-btn layui-btn-sm layui-btn-normal layui-hide-xs" lay-event="batch_public" id="batch_public">设为公开</button>
|
||||
<button class="layui-btn layui-btn-sm layui-btn-normal layui-hide-xs" lay-event="batch_start" id="batch_start">设为启用</button>
|
||||
<button class="layui-btn layui-btn-sm layui-btn-normal layui-hide-xs" lay-event="batch_disable" id="batch_disable">设为禁用</button>
|
||||
<button class="layui-btn layui-btn-sm layui-btn-normal layui-btn-danger layui-hide-xs" lay-event="testing" id="testing" <?php echo $global_config['offline']?'style="display:none;"':''?> >检测</button>
|
||||
<?php if($global_config['link_extend'] == 1 && check_purview('link_extend',1)){ ?>
|
||||
<button class="layui-btn layui-btn-sm layui-btn-normal layui-btn-danger layui-hide-xs" lay-event="link_extend" id="link_extend">扩展字段</button>
|
||||
<?php }?>
|
||||
<?php if($global_config['offline'] != 1 ){ ?>
|
||||
<button class="layui-btn layui-btn-sm layui-btn-normal layui-btn-danger layui-hide-xs" lay-event="testing" id="testing">检测</button>
|
||||
<?php }?>
|
||||
<button class="layui-btn layui-btn-sm layui-btn-normal layui-btn-danger" layuimini-content-href="link_sort" data-title="链接排序">排序模式</button>
|
||||
<button class="layui-btn layui-btn-sm layui-btn-normal layui-btn-danger layui-hide-xs" lay-event="generate" id="generate">生成</button>
|
||||
</div>
|
||||
</script>
|
||||
<script src = "<?php echo $libs;?>/jquery/jquery-3.6.0.min.js"></script>
|
||||
<script src = "./templates/admin/js/public.js?v=<?php echo $Ver;?>"></script>
|
||||
<?php load_static('js');?>
|
||||
<script src = "./templates/admin/js/link_list.js?v=<?php echo $Ver;?>"></script>
|
||||
<ul class="batch_category" style = "margin-top:18px;display:none;padding-right: 10px;" >
|
||||
<ul class="batch_category" style="margin-top:18px;display:none;padding-right: 10px;">
|
||||
<form class="layui-form" lay-filter="batch_category">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">父级分类</label>
|
||||
<div class="layui-input-block">
|
||||
<select id="batch_category_fid">
|
||||
<select id="batch_category_fid">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn layui-btn-normal" lay-submit lay-filter="batch_category" id="batch_category" >确定修改</button>
|
||||
<button class="layui-btn layui-btn-warm" type="button" id="close" >关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</form>
|
||||
</ul>
|
||||
<ul class="link_extend" style="margin-top: 18px;display:none;padding-right: 10px;padding-left: 10px;">
|
||||
<div class="layui-btn-container">
|
||||
<button class="layui-btn" lay-submit id="add_field">新增字段</button>
|
||||
<button class="layui-btn" lay-submit id="save_field">保存</button>
|
||||
<button class="layui-btn layui-btn-primary" style="color: red;">数据变更需要点击保存!确定好需要的字段后请勿随意修改,以免造成数据错乱!</button>
|
||||
</div>
|
||||
<table id="link_extend_list" lay-filter="link_extend_list"></table>
|
||||
<script type="text/html" id="link_extend_toolbar">
|
||||
<div class="layui-btn-container">
|
||||
<button class="layui-btn layui-btn-sm layui-btn-danger del" lay-event="del">移除</button>
|
||||
</div>
|
||||
</script>
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
||||
@@ -17,6 +17,7 @@
|
||||
<script type="text/html" id="toolbar">
|
||||
<div class="layui-btn-group">
|
||||
<button class="layui-btn layui-btn-sm layui-btn-normal" lay-event="add">新增</button>
|
||||
<button class="layui-btn layui-btn-sm layui-btn-normal" lay-event="help">使用说明</button>
|
||||
</div>
|
||||
</script>
|
||||
<script src = "<?php echo $libs;?>/jquery/jquery-3.6.0.min.js"></script>
|
||||
@@ -28,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({
|
||||
@@ -65,6 +66,9 @@ layui.use(['form','table'], function () {
|
||||
if (obj.event === 'add') {
|
||||
form.val('form', {'pid':'0','name':'','password':'','description':''});
|
||||
index = layer.open({type: 1,scrollbar: false,shadeClose: true,title: '新增分组',area : ['100%', '100%'],content: $('.form')});
|
||||
}else if(obj.event === 'help'){
|
||||
window.open("https://gitee.com/tznb/TwoNav/wikis/pages?sort_id=7969061&doc_id=3767990","target");
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -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: ['知道了']});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
144
templates/admin/page/root/mail_set.php
Normal file
144
templates/admin/page/root/mail_set.php
Normal file
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
if($USER_DB['UserGroup'] != 'root'){$content='您没有权限访问此页面'; require(DIR.'/templates/admin/page/404.php');exit;}
|
||||
$title='系统设置';require(dirname(__DIR__).'/header.php');
|
||||
?>
|
||||
<body>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<form class="layui-form" lay-filter="form">
|
||||
<div class="layui-form layuimini-form layui-form-pane">
|
||||
<blockquote class="layui-elem-quote layui-text" style="">
|
||||
1.此功能<a href="https://gitee.com/tznb/OneNav/wikis/%E8%AE%A2%E9%98%85%E6%9C%8D%E5%8A%A1%E6%8C%87%E5%BC%95" target="_blank">授权用户</a>专享
|
||||
</blockquote>
|
||||
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;"><legend>SMTP 配置</legend></fieldset>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">账号</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="pass" name="user" lay-verify="required" lay-reqtext="账号不能为空" placeholder='请输入账号' autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">密码</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="password" name="pwd" lay-verify="required" lay-reqtext="密码不能为空" placeholder='请输入密码或授权码' autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">服务器</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="host" lay-verify="required" lay-reqtext="服务器不能为空" placeholder='请输入发件服务器地址' autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">端口</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="number" name="port" lay-verify="required" lay-reqtext="端口不能为空" placeholder='请输入服务器端口' value="465" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">协议</label>
|
||||
<div class="layui-input-inline" >
|
||||
<select name="secure">
|
||||
<option value="ssl" selected="">SSL</option>
|
||||
<option value="TLS" >TLS</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">发送人</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="sender" lay-verify="required" lay-reqtext="发送人邮箱不能为空" placeholder='' autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">收件人</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="addressee" placeholder='仅用于发件测试' autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;"><legend>注册参数</legend></fieldset>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">验证邮箱</label>
|
||||
<div class="layui-input-inline" >
|
||||
<select name="verify_email">
|
||||
<option value="0" selected="">关闭</option>
|
||||
<option value="1" >开启</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">发送间隔</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="number" name="send_interval" lay-verify="required" lay-reqtext="发送间隔不能为空" placeholder='IP发送间隔,单位秒!' value="60" 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">
|
||||
<textarea name="verify_template" class="layui-textarea" placeholder='您的验证码: $code'></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn layui-btn-normal" lay-submit lay-filter="send_test">测试</button>
|
||||
<button class="layui-btn layui-btn-normal" lay-submit lay-filter="save">确认保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php load_static('js.layui');?>
|
||||
<script src="./templates/admin/js/public.js?v=<?php echo $Ver;?>"></script>
|
||||
<script>
|
||||
layui.use(['jquery','form'], function () {
|
||||
var form = layui.form;
|
||||
var layer = layui.layer;
|
||||
var $ = layui.jquery;
|
||||
|
||||
//表单赋值
|
||||
form.val('form', <?php echo json_encode(unserialize( get_db("global_config", "v", ["k" => "mail_config"])));?>);
|
||||
|
||||
//监听提交
|
||||
form.on('submit(save)', function (data) {
|
||||
$.post(get_api('other_root','write_mail_config'),data.field,function(data,status){
|
||||
if(data.code == 1) {
|
||||
if(data.msg!="保存成功"){
|
||||
layer.alert(data.msg)
|
||||
}else{
|
||||
layer.msg(data.msg, {icon: 1});
|
||||
}
|
||||
}else{
|
||||
layer.msg(data.msg, {icon: 5});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
//测试
|
||||
form.on('submit(send_test)', function (data) {
|
||||
layer.load(1, {shade:[0.3,'#fff']});
|
||||
layer.msg('正在发送中..', {icon: 16,time: 1000*300});
|
||||
$.post(get_api('other_root','write_mail_test'),data.field,function(data,status){
|
||||
layer.closeAll();
|
||||
if(data.code == 1) {
|
||||
layer.alert(data.msg);
|
||||
}else{
|
||||
layer.msg(data.msg, {icon: 5});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -16,6 +16,7 @@ $user_groups = select_db('user_group',['id','code','name'],'');
|
||||
<script type="text/html" id="toolbar">
|
||||
<div class="layui-btn-group" >
|
||||
<button class="layui-btn layui-btn-sm" lay-event="generate">生成注册码</button>
|
||||
<button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="del">删除</button>
|
||||
<button class="layui-btn layui-btn-sm" lay-event="refresh">刷新</button>
|
||||
<button class="layui-btn layui-btn-sm" lay-event="set">设置</button>
|
||||
</div>
|
||||
@@ -71,17 +72,18 @@ $user_groups = select_db('user_group',['id','code','name'],'');
|
||||
<script src = "./templates/admin/js/public.js?v=<?php echo $Ver;?>"></script>
|
||||
<?php load_static('js');?>
|
||||
<script>
|
||||
var host = '<?php echo getindexurl().'?c='.$global_config['Register']."&key=";?>';
|
||||
var host = Get_baseUrl() + '<?php echo 'index.php?c='.$global_config['Register']."&key=";?>';
|
||||
|
||||
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=[[ //表头
|
||||
{field:'id',title:'id',width:80,sort:true}
|
||||
{type:'checkbox'}
|
||||
,{field:'id',title:'id',width:80,sort:true}
|
||||
,{field:'regcode',title:'注册码',width:120,sort:true}
|
||||
,{field:'UserGroupName',title:'用户组',width:120,sort:true}
|
||||
,{field:'url',title:'注册链接',minWidth:400,sort:true,templet:function(d){
|
||||
@@ -152,6 +154,25 @@ layui.use(['table','layer','form'], function(){
|
||||
content: $('.Set')
|
||||
});
|
||||
break;
|
||||
case 'del':
|
||||
if( checkStatus.data.length == 0 && ['LAYTABLE_COLS','LAYTABLE_EXPORT','LAYTABLE_PRINT'].indexOf(obj.event) == -1 ) {
|
||||
layer.msg('未选中任何数据!');
|
||||
return;
|
||||
}
|
||||
layer.confirm('确认删除?',{icon: 3, title:'温馨提示'}, function(index){
|
||||
tableIds = checkStatus.data.map(function (value) {return value.id;});
|
||||
tableIds = JSON.stringify(tableIds);
|
||||
$.post(get_api('write_regcode','del') ,{"id":tableIds},function(data,status){
|
||||
if(data.code == 1){
|
||||
table.reload('table');
|
||||
layer.msg(data.msg, {icon: 1});
|
||||
}else{
|
||||
layer.msg(data.msg, {icon: 5});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
break;
|
||||
};
|
||||
});
|
||||
//自定义表单验证
|
||||
|
||||
@@ -13,6 +13,7 @@ require(dirname(__DIR__).'/header.php');
|
||||
<option value="" selected>全部</option>
|
||||
<option value="login">登录</option>
|
||||
<option value="register">注册</option>
|
||||
<option value="send_email">邮件</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@@ -49,7 +50,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 = [];
|
||||
|
||||
@@ -57,6 +58,9 @@ layui.use(['table','layer','form'], function () {
|
||||
//{type:'checkbox'} //开启复选框
|
||||
{field:'id',title:'ID',width:60}
|
||||
,{field:'user',title:'账号',width:120,templet:function(d){
|
||||
if(d.type == 'send_email'){
|
||||
return d.user;
|
||||
}
|
||||
return '<a style="color:#3c78d8" title="用户ID:' + d.uid + ',点击打开用户主页" target="_blank" href="./?u='+d.user+'">'+d.user+'</a>'
|
||||
}}
|
||||
,{field:'ip',title:'请求IP',width:140,templet:function(d){
|
||||
|
||||
@@ -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">
|
||||
@@ -123,6 +135,17 @@ $title='系统设置';require(dirname(__DIR__).'/header.php');
|
||||
</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">
|
||||
<select name="Privacy">
|
||||
<option value="0" selected="">依用户组配置</option>
|
||||
<option value="1" >全站用户</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>
|
||||
@@ -156,6 +179,16 @@ $title='系统设置';require(dirname(__DIR__).'/header.php');
|
||||
<textarea name="global_footer" class="layui-textarea" placeholder='例如备案号,统计代码等,支持HTML,JS,CSS'></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" id="api_extend" style="display:none;">
|
||||
<label class="layui-form-label required">api_extend</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="api_extend">
|
||||
<option value="0" selected="">关闭</option>
|
||||
<option value="1" >开启</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;"><legend>扩展功能</legend></fieldset>
|
||||
<blockquote class="layui-elem-quote layui-text" style="">注:开关后请刷新整个页面</blockquote>
|
||||
@@ -179,7 +212,16 @@ $title='系统设置';require(dirname(__DIR__).'/header.php');
|
||||
</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">
|
||||
<select name="link_extend">
|
||||
<option value="0" selected="">关闭</option>
|
||||
<option value="1" >开启</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">自定义链接的扩展信息(需自行添加字段,目前仅用于自定义过渡页)</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block"><button class="layui-btn layui-btn-normal" lay-submit lay-filter="save">确认保存</button></div>
|
||||
</div>
|
||||
@@ -212,6 +254,18 @@ layui.use(['jquery','form'], function () {
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
//开启隐藏功能
|
||||
$('.layui-elem-field').click(function () {
|
||||
if(Number( $(this).attr('click')) >= 6){
|
||||
$("#api_extend").show();
|
||||
}else{
|
||||
let click = $(this).attr('click') ? Number($(this).attr('click')) + 1 : 0;
|
||||
$(this).attr('click',click)
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<?php
|
||||
if($USER_DB['UserGroup'] != 'root'){$content='您没有权限访问此页面'; require(DIR.'/templates/admin/page/404.php');exit;}
|
||||
$title='站长工具';
|
||||
if(function_exists("opcache_reset")){
|
||||
opcache_reset(); //清理PHP缓存
|
||||
}
|
||||
require(dirname(__DIR__).'/header.php');
|
||||
?>
|
||||
<style>
|
||||
@@ -24,7 +27,7 @@ require(dirname(__DIR__).'/header.php');
|
||||
<button type="button" class="layui-btn" layuimini-content-href="root/sys_log" data-title="系统日志">系统日志</button>
|
||||
<button type="button" class="layui-btn" layuimini-content-href="updatelog" data-title="更新日志">更新日志</button>
|
||||
<button type="button" class="layui-btn" layuimini-content-href="root/import_data" data-title="导入数据">导入数据</button>
|
||||
|
||||
<button type="button" class="layui-btn" layuimini-content-href="root/mail_set" data-title="邮件配置">邮件配置</button>
|
||||
</div>
|
||||
<pre class="layui-code" id="console_log" >
|
||||
1.功能都集中在上方的按钮了,需要那个就点击那个!
|
||||
|
||||
@@ -35,8 +35,9 @@ $user_groups = select_db('user_group',['id','code','name'],'');
|
||||
<script type="text/html" id="user_tool">
|
||||
<div class="layui-btn-group">
|
||||
<button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="Del">删除</button>
|
||||
<button class="layui-btn layui-btn-sm " lay-event="register" <?php echo $global_config['RegOption'] == 0? 'style = "display:none;"':'' ?> >注册账号</button>
|
||||
<button class="layui-btn layui-btn-sm " lay-event="set_UserGroup" >设用户组</button>
|
||||
<button class="layui-btn layui-btn-sm" lay-event="register" <?php echo $global_config['RegOption'] == 0? 'style = "display:none;"':'' ?> >注册账号</button>
|
||||
<button class="layui-btn layui-btn-sm" lay-event="set_UserGroup">设用户组</button>
|
||||
<button class="layui-btn layui-btn-sm" lay-event="username_retain">账号保留</button>
|
||||
</div>
|
||||
</script>
|
||||
<!-- 操作列 -->
|
||||
@@ -53,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 = [];
|
||||
|
||||
@@ -122,6 +123,17 @@ layui.use(['table','layer','form'], function () {
|
||||
if (event == 'register') {
|
||||
window.open('./index.php?c=<?php echo $global_config['Register'];?>');
|
||||
return;
|
||||
}else if(event == 'username_retain'){
|
||||
index = layer.open({type: 1,scrollbar: false,shadeClose: true,title: '账号保留',area : ['100%', '100%'],content: $('.username_retain')});
|
||||
|
||||
$.post(get_api('other_root','read_username_retain'),function(data,status){
|
||||
if(data.code == 1) {
|
||||
form.val('username_retain', {"username_retain": data.data});
|
||||
}else{
|
||||
layer.msg(data.msg, {icon: 5});
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
var checkStatus = table.checkStatus(obj.config.id);
|
||||
@@ -206,6 +218,20 @@ layui.use(['table','layer','form'], function () {
|
||||
});
|
||||
return false;
|
||||
});
|
||||
//保存账号保留
|
||||
form.on('submit(save_username_retain)', function (data) {
|
||||
$.post(get_api('other_root','write_username_retain'),data.field,function(data,status){
|
||||
if(data.code == 1) {
|
||||
layer.msg(data.msg, {icon: 1});
|
||||
}else{
|
||||
layer.msg(data.msg, {icon: 5});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
<ul class="set_UserGroup" style = "margin-top:18px;display:none;padding-right: 10px;" >
|
||||
@@ -225,8 +251,47 @@ layui.use(['table','layer','form'], function () {
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn layui-btn-normal" lay-submit lay-filter="save_UserGroup" id ='save_UserGroup'>保存</button>
|
||||
<button class="layui-btn layui-btn-warm" type="button" id="close" >关闭</button>
|
||||
<button class="layui-btn layui-btn-normal" lay-submit lay-filter="save_UserGroup" id ='save_UserGroup'>保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</ul>
|
||||
|
||||
<ul class="username_retain" style="margin-left: 10px;padding-right: 10px;margin-top:18px;display:none;" >
|
||||
<form class="layui-form layuimini-form layui-form-pane" lay-filter="username_retain">
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label required">账号保留 - 正则表达式匹配</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="username_retain" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<pre class="layui-code" >
|
||||
使用举例:
|
||||
/^(root|data)$/ 匹配用户等于root或data 区分大小写!
|
||||
/^(root|data)$/i 匹配用户等于root或data 不区分大小写!
|
||||
/root|data/ 匹配用户含有root或data 区分大小写!
|
||||
/root|data/i 匹配用户含有root或data 不区分大小写!
|
||||
/^admin.+/ 匹配admin开头的任意用账号,但不匹配admin
|
||||
/^admin.*/ 同上,但匹配admin本身
|
||||
支持多行,一行一条规则!
|
||||
|
||||
举例中的表达式解释:
|
||||
^ 匹配开头位置
|
||||
$ 匹配结尾位置
|
||||
| 或者
|
||||
. 匹配换行符以外的任何字符
|
||||
+ 匹配前一个字符一次或多次
|
||||
* 匹配前一个字符零次或多次
|
||||
更多语法请自行百度
|
||||
|
||||
注:错误的规则可能会造成程序异常,如需帮助请联系技术支持QQ:271152681或技术交流群695720839
|
||||
</pre>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn layui-btn-warm" type="button" id="close" >关闭</button>
|
||||
<button class="layui-btn layui-btn-normal" lay-submit lay-filter="save_username_retain" id ='save_username_retain'>保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -1,31 +1,39 @@
|
||||
<?php
|
||||
if($USER_DB['UserGroup'] != 'root'){$content='您没有权限访问此页面'; require(DIR.'/templates/admin/page/404.php');exit;}
|
||||
$title='授权管理';require(dirname(__DIR__).'/header.php');
|
||||
$subscribe = unserialize(get_db('global_config','v',["k" => "s_subscribe"])); ?>
|
||||
$subscribe = unserialize(get_db('global_config','v',["k" => "s_subscribe"]));
|
||||
$HTTP_HOST = preg_replace('/:\d+$/','',$_SERVER['HTTP_HOST']); //去除端口号
|
||||
?>
|
||||
<body>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<div class="layui-form layuimini-form layui-form-pane">
|
||||
<h3 style = "margin-bottom:1em;">当前域名:<font color="red"><?php echo $_SERVER['HTTP_HOST']; ?></font> (订阅时填写)</h3>
|
||||
<blockquote class="layui-elem-quote layui-text">
|
||||
<li>1. 查询授权时当前域名必须和订阅填写一致</li>
|
||||
<li>2. 其他二级域名使用时请手动输入订单号/邮箱保存</li>
|
||||
<li>3. 授权未绑定邮箱时邮箱留空,已绑定时请输入正确邮箱</li>
|
||||
<li>4. 如有其他疑问联系技术支持</li>
|
||||
</blockquote>
|
||||
<h3 style = "margin-bottom:1em;">当前域名:<font color="red"><?php echo $HTTP_HOST; ?></font> (订阅时填写)</h3>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">订单号</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" id = "order_id" name="order_id" value = "<?php echo $subscribe['order_id']; ?>" required autocomplete="off" placeholder="请输入订单号" class="layui-input">
|
||||
<input type="text" id = "order_id" name="order_id" value="<?php echo $subscribe['order_id']; ?>" required autocomplete="off" placeholder="请输入订单号" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">订阅邮箱</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="email" id = "email" value = "<?php echo $subscribe['email']; ?>" required autocomplete="off" placeholder="订阅邮箱" class="layui-input">
|
||||
<input type="text" name="email" id ="email" value="<?php echo $subscribe['email']; ?>" required autocomplete="off" placeholder="订阅邮箱" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" style = "display:none;">
|
||||
<label class="layui-form-label">域名</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="domain" id = "domain" value = "<?php echo $_SERVER['HTTP_HOST']; ?>" autocomplete="off" placeholder="网站域名" class="layui-input">
|
||||
<input type="text" name="domain" id ="domain" value="<?php echo $HTTP_HOST; ?>" autocomplete="off" placeholder="网站域名" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -39,9 +47,10 @@ $subscribe = unserialize(get_db('global_config','v',["k" => "s_subscribe"])); ?>
|
||||
<div class="layui-btn-group">
|
||||
<button class="layui-btn layui-btn-normal" lay-submit lay-filter="set_subscribe">保存设置</button>
|
||||
<button class="layui-btn layui-btn-warm" lay-submit lay-filter="reset_subscribe">删除</button>
|
||||
<button class="layui-btn layui-btn-danger" lay-submit lay-filter="buy">购买授权</button>
|
||||
<button class="layui-btn layui-btn-danger" id="help" sort_id="7968669">购买授权</button>
|
||||
<button class="layui-btn" lay-submit lay-filter="get_subscribe">查询授权</button>
|
||||
</div>
|
||||
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top:30px;"><legend>授权用户专享</legend></fieldset>
|
||||
<blockquote class="layui-elem-quote layui-text">
|
||||
<li>1. 可使用一键更新功能</li>
|
||||
@@ -59,6 +68,7 @@ $subscribe = unserialize(get_db('global_config','v',["k" => "s_subscribe"])); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src = "<?php echo $libs;?>/jquery/jquery-3.6.0.min.js"></script>
|
||||
<script src = "./templates/admin/js/public.js?v=<?php echo $Ver;?>"></script>
|
||||
<?php load_static('js.layui');?>
|
||||
<script>
|
||||
@@ -75,7 +85,6 @@ layui.use(['jquery','form'], function () {
|
||||
if(data.code == 200) {
|
||||
$("#order_id").val(data.data.order_id);
|
||||
$("#end_time").val(timestampToTime(data.data.end_time));
|
||||
//$("#email").attr({"lay-verify":"email"});
|
||||
layer.msg(data.msg, {icon: 1,time: 10000});
|
||||
}else{
|
||||
layer.msg(data.msg, {icon: 5,time: 10000});
|
||||
@@ -109,7 +118,6 @@ layui.use(['jquery','form'], function () {
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
//清空订阅信息
|
||||
form.on('submit(reset_subscribe)', function(data){
|
||||
var order_id = data.field.order_id;
|
||||
@@ -121,11 +129,10 @@ layui.use(['jquery','form'], function () {
|
||||
layer.closeAll('loading');
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
//存储到数据库中
|
||||
function set_subscribe(order_id,email,end_time,domain) {
|
||||
$.post("./index.php?c=api&method=write_subscribe&u=<?php echo $u;?>",{order_id:order_id,email:email,end_time:end_time,domain:domain},function(data,status){
|
||||
$.post(get_api('write_subscribe'),{order_id:order_id,email:email,end_time:end_time,domain:domain},function(data,status){
|
||||
if(data.code == 1) {
|
||||
layer.msg(data.msg, {icon: 1});
|
||||
}else{
|
||||
@@ -133,12 +140,6 @@ layui.use(['jquery','form'], function () {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//购买订阅
|
||||
form.on('submit(buy)', function (data) {
|
||||
window.open("https://gitee.com/tznb/TwoNav/wikis/pages?sort_id=7934408&doc_id=3674619","target");
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -141,6 +141,7 @@
|
||||
</div>
|
||||
</form>
|
||||
</ul>
|
||||
<script src = "<?php echo $libs;?>/jquery/jquery-3.6.0.min.js"></script>
|
||||
<script src = "./templates/admin/js/public.js?v=<?php echo $Ver;?>"></script>
|
||||
<script src = "<?php echo $libs?>/Other/ClipBoard.min.js"></script>
|
||||
<?php load_static('js');?>
|
||||
@@ -148,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();
|
||||
@@ -199,7 +200,7 @@ layui.use(['form','table','laydate','tableSelect'], function () {
|
||||
,{field:'id',title:'ID',width:60,sort:true,hide:true}
|
||||
,{title: '操作',toolbar: '#tablebar',align:'center',width:140}
|
||||
,{field:'sid',title:'标识',width:118,align:'center',templet:function(d){
|
||||
return '<a style="color:#3c78d8" href = "./index.php?share='+d.sid+'" target = "_blank" title = "点击打开">'+d.sid+'</a>';
|
||||
return '<a style="color:#3c78d8" href = "./index.php?u='+u+'&share='+d.sid+'" target = "_blank" title = "点击打开">'+d.sid+'</a>';
|
||||
}}
|
||||
,{field:'name',title:'名称',width:180}
|
||||
,{field:'pwd',title:'提取码',width:160}
|
||||
@@ -330,7 +331,7 @@ layui.use(['form','table','laydate','tableSelect'], function () {
|
||||
});
|
||||
}else if(obj.event === 'copy'){
|
||||
if(isSupported){
|
||||
ClipboardJS.copy(baseUrl + "index.php?share=" + data.sid +(data.pwd != '' ? '&pwd=' + data.pwd:''));
|
||||
ClipboardJS.copy(baseUrl + "index.php?u="+u+"&share=" + data.sid +(data.pwd != '' ? '&pwd=' + data.pwd:''));
|
||||
layer.msg('复制成功', {icon: 1});
|
||||
}else{
|
||||
layer.msg('复制失败,浏览器不支持', {icon: 5});
|
||||
@@ -338,16 +339,17 @@ layui.use(['form','table','laydate','tableSelect'], function () {
|
||||
}else if(obj.event === 'edit'){
|
||||
form.val('data', data);
|
||||
form.val('data', {'pv':data.pv == 1});
|
||||
console.log(data.data);
|
||||
data.data = ts_selected_format(data.data,/"/g);
|
||||
let ts = ts_selected_format(data.data);
|
||||
if(data.type == '1'){
|
||||
$('#category_data').val(data.data);
|
||||
$('#category_data').attr("ts-selected",data.data.replace('[', '').replace(']', ''));
|
||||
$('#category_data').attr("ts-selected",ts);
|
||||
type = 'category';
|
||||
$('#cf').show();
|
||||
$('#lf').hide();
|
||||
}else if(data.type == '2'){
|
||||
$('#link_data').val(data.data);
|
||||
$('#link_data').attr("ts-selected",data.data.replace('[', '').replace(']', ''));
|
||||
$('#link_data').attr("ts-selected",ts);
|
||||
type = 'link';
|
||||
$('#cf').hide();
|
||||
$('#lf').show();
|
||||
@@ -357,7 +359,9 @@ layui.use(['form','table','laydate','tableSelect'], function () {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function ts_selected_format(v,z = /"|\[|\]/g){
|
||||
return v.replace(z,'')
|
||||
}
|
||||
|
||||
//书签选择
|
||||
function load_tableSelect(searchPlaceholder,name,url,elem,limit,limits){ tableSelect.render({
|
||||
@@ -385,7 +389,7 @@ layui.use(['form','table','laydate','tableSelect'], function () {
|
||||
id.push(item.id);
|
||||
})
|
||||
elem.val(id.join(","));
|
||||
$(elem).val(JSON.stringify(id));
|
||||
$(elem).val(ts_selected_format(JSON.stringify(id),/"/g) );
|
||||
}
|
||||
})}
|
||||
load_tableSelect('分类名称搜索','分类名',get_api('read_share','categorys'),'#category_data',9999,[9999]);
|
||||
|
||||
84
templates/admin/page/theme_guide.php
Normal file
84
templates/admin/page/theme_guide.php
Normal 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>
|
||||
@@ -7,6 +7,7 @@
|
||||
max-height: 100%;
|
||||
aspect-ratio:16/9;
|
||||
}
|
||||
#default #del {display: none;}
|
||||
</style>
|
||||
<body>
|
||||
<div class="layuimini-container">
|
||||
@@ -17,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;" >
|
||||
@@ -51,6 +52,7 @@ $color = ($s_templates['home_pc'] == $key || $s_templates['home_pad'] == $key ?"
|
||||
<div class="layui-card-header" style="height: auto;" id="home">
|
||||
<div class="layui-btn-group" id="<?php echo $key;?>">
|
||||
<?php
|
||||
$theme_set = check_purview('theme_set',1);
|
||||
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){ //如果有更新则同时显示下载和使用
|
||||
@@ -63,7 +65,7 @@ $color = ($s_templates['home_pc'] == $key || $s_templates['home_pad'] == $key ?"
|
||||
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'){ //支持配置的主题显示配置
|
||||
if($theme['info']['config'] == '1' && $theme_set){ //支持配置的主题显示配置
|
||||
echo $Space.'<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" id="config">配置</button>'."\n";
|
||||
}
|
||||
if($USER_DB['UserGroup'] === 'root' && !$online){ //管理员&本地主题>显示删除
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
max-height: 100%;
|
||||
aspect-ratio:16/9;
|
||||
}
|
||||
#default #del {display: none;}
|
||||
</style>
|
||||
<body>
|
||||
<div class="layuimini-container">
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
max-height: 100%;
|
||||
aspect-ratio:16/9;
|
||||
}
|
||||
#default #del {display: none;}
|
||||
</style>
|
||||
<body>
|
||||
<div class="layuimini-container">
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
max-height: 100%;
|
||||
aspect-ratio:16/9;
|
||||
}
|
||||
#default #del {display: none;}
|
||||
</style>
|
||||
<body>
|
||||
<div class="layuimini-container">
|
||||
|
||||
@@ -2,6 +2,134 @@
|
||||
<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.17-20230428</h4>
|
||||
<ul>
|
||||
<li>[优化] 删除用户时支持同时删除用户文件夹 ( 图标/留言等数据 ) 和备份数据</li>
|
||||
<li>[优化] 链接列表 > 检测功能的准确性</li>
|
||||
<li>[优化] 系统日志按新旧排序,支持记录邮件发送日志</li>
|
||||
<li>[修复] 用户注册初始数据可能复制失败</li>
|
||||
<li>[新增] <a href="https://gitee.com/tznb/TwoNav/wikis/pages?sort_id=7993451&doc_id=3767990" target="_blank">ATool工具箱</a>支持修改用户名 ( 建议修改前先备份数据 ) </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">
|
||||
<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">
|
||||
<h4 class="layui-timeline-title">v2.0.15-20230422</h4>
|
||||
<ul>
|
||||
<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">
|
||||
<h4 class="layui-timeline-title">v2.0.14-20230420</h4>
|
||||
<ul>
|
||||
<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">
|
||||
<h4 class="layui-timeline-title">v2.0.13-20230418</h4>
|
||||
<ul>
|
||||
<li>修复链接模式不受控的问题(上个版本造成)</li>
|
||||
<li>网站管理/系统设置新增强制私有选项</li>
|
||||
<li>修复书签分享的链接可能无法访问</li>
|
||||
<li>修复扩展字段输入html代码可能造成页面渲染异常的问题</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<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.12-20230417</h4>
|
||||
<ul>
|
||||
<li>优化书签分享的兼容性</li>
|
||||
<li>新增链接自定义扩展信息(用于自定义过渡页模板)</li>
|
||||
<li>[数据库更新] 调整MySQL字符集编码(utf8改为utf8mb4,使其兼容Emoji字符)</li>
|
||||
<li>[数据库更新] 用户组权限列表新增3个选项</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">
|
||||
<h4 class="layui-timeline-title">v2.0.11-20230414</h4>
|
||||
<ul>
|
||||
<li>修复热门网址/最新网址的一些问题</li>
|
||||
<li>新增Atool工具 (应急工具),用于强行修改密码/配置等 <a href="https://gitee.com/tznb/TwoNav/wikis/pages?sort_id=7993451&doc_id=3767990" target="_blank">使用说明</a></li>
|
||||
<li>调整安装脚本session_name避免特定环境冲突</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<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.10-20230413</h4>
|
||||
<ul>
|
||||
<li>支持删除注册管理生成的注册码</li>
|
||||
<li>站点设置增加设为默认用户按钮(储存在浏览器Cookie,不影响其他用户)</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">
|
||||
<h4 class="layui-timeline-title">v2.0.09-20230410</h4>
|
||||
<ul>
|
||||
<li>优化兼容性/细节调整</li>
|
||||
<li>放宽授权验证规则</li>
|
||||
<li>修复前端调用添加链接页面没有分类的bug</li>
|
||||
<li>修复默认主题删除链接提示ID不存在的bug</li>
|
||||
<li>修复下载更新时temp目录不存在时未自动创建导致下载失败的bug</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">
|
||||
<h4 class="layui-timeline-title">v2.0.08-20230406</h4>
|
||||
<ul>
|
||||
<li>增加一些使用说明</li>
|
||||
<li>优化兼容性(php8.0.0 getdir函数重名)</li>
|
||||
<li>调整主题模板默认主题不显示删除按钮(因为不允许删除默认模板)</li>
|
||||
<li>精简部分静态资源,Medoo框架更新到2.1.8</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li class="layui-timeline-item">
|
||||
<i class="layui-icon layui-timeline-axis"></i>
|
||||
<div class="layui-timeline-content layui-text">
|
||||
|
||||
78
templates/guide/default/config.php
Normal file
78
templates/guide/default/config.php
Normal 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>
|
||||
39
templates/guide/default/index.php
Normal file
39
templates/guide/default/index.php
Normal 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>
|
||||
13
templates/guide/default/info.json
Normal file
13
templates/guide/default/info.json
Normal 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":""
|
||||
}
|
||||
}
|
||||
419
templates/guide/default/main.css
Normal file
419
templates/guide/default/main.css
Normal file
File diff suppressed because one or more lines are too long
BIN
templates/guide/default/screenshot.jpg
Normal file
BIN
templates/guide/default/screenshot.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 38 KiB |
@@ -212,7 +212,7 @@
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">背景图URL</label>
|
||||
<div class="layui-input-inline" style="width: 73%;">
|
||||
<input type="url" id="backgroundURL" name="backgroundURL" value="<?php echo $theme_config['backgroundURL'];?>" placeholder="存在时其他背景色无效,请输入图片URL" autocomplete="off" class="layui-input">
|
||||
<input type="url" name="backgroundURL" value="<?php echo $theme_config['backgroundURL'];?>" placeholder="存在时其他背景色无效,请输入图片URL" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -282,13 +282,13 @@
|
||||
<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 src="./templates/admin/js/lay-config.js?v=<?php echo $Ver;?>" charset="utf-8"></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','colorpicker','element','dropdown'], function(){
|
||||
layui.use(['form','colorpicker','element','dropdown','background'], function(){
|
||||
var form = layui.form;
|
||||
var colorpicker = layui.colorpicker;
|
||||
var dropdown = layui.dropdown;
|
||||
@@ -328,93 +328,8 @@ dropdown.render({elem: '#OtherBackgroundColor-input',data:BackgroundColor ,click
|
||||
dropdown.render({elem: '#SidebarBackgroundColor-input',data:BackgroundColor ,click: function(obj){this.elem.val(obj.code);},style: 'width: 225px;'});
|
||||
|
||||
//背景图下拉菜单
|
||||
dropdown.render({
|
||||
elem: '#backgroundURL'
|
||||
,data: [{
|
||||
title: '博天(自适应/动漫)'
|
||||
,url: 'https://api.btstu.cn/sjbz/api.php?lx=dongman&method=zsy'
|
||||
,author:'https://api.btstu.cn/doc/sjbz.php'
|
||||
},{
|
||||
title: '博天(自适应/妹子)'
|
||||
,url: 'https://api.btstu.cn/sjbz/api.php?lx=meizi&method=zsy'
|
||||
,author:'https://api.btstu.cn/doc/sjbz.php'
|
||||
},{
|
||||
title: '博天(自适应/风景)'
|
||||
,url: 'https://api.btstu.cn/sjbz/api.php?lx=fengjing&method=zsy'
|
||||
,author:'https://api.btstu.cn/doc/sjbz.php'
|
||||
},{
|
||||
title: '博天(自适应/随机)'
|
||||
,url: 'https://api.btstu.cn/sjbz/api.php?lx=suiji&method=zsy'
|
||||
,author:'https://api.btstu.cn/doc/sjbz.php'
|
||||
},{
|
||||
title: '姬长信(PC/每日必应)'
|
||||
,url: 'https://api.isoyu.com/bing_images.php'
|
||||
,author:'https://api.isoyu.com'
|
||||
,n:'姬长信'
|
||||
},{
|
||||
title: '樱花(PC/动漫)'
|
||||
,url: 'https://www.dmoe.cc/random.php'
|
||||
,author:'https://www.dmoe.cc'
|
||||
},{
|
||||
title: '梁炯灿(PC/动漫)'
|
||||
,url: 'https://tuapi.eees.cc/api.php?category=dongman&type=302'
|
||||
,author:'https://tuapi.eees.cc'
|
||||
},{
|
||||
title: '梁炯灿(PC/风景)'
|
||||
,url: 'https://tuapi.eees.cc/api.php?category=fengjing&type=302'
|
||||
,author:'https://tuapi.eees.cc'
|
||||
},{
|
||||
title: '梁炯灿(PC/必应)'
|
||||
,url: 'https://tuapi.eees.cc/api.php?category=biying&type=302'
|
||||
,author:'https://tuapi.eees.cc'
|
||||
},{
|
||||
title: '梁炯灿(PC/美女)'
|
||||
,url: 'https://tuapi.eees.cc/api.php?category=meinv&type=302'
|
||||
,author:'https://tuapi.eees.cc'
|
||||
},{
|
||||
title: '苏晓晴(PC/动漫)'
|
||||
,url: 'https://acg.toubiec.cn/random.php'
|
||||
,author:'https://acg.toubiec.cn'
|
||||
},{
|
||||
title: '墨天逸(PC/动漫)'
|
||||
,url: 'https://api.mtyqx.cn/api/random.php'
|
||||
,author:'https://api.mtyqx.cn/'
|
||||
},{
|
||||
title: '小歪(PC/动漫)'
|
||||
,url: 'https://api.ixiaowai.cn/api/api.php'
|
||||
,author:'https://api.ixiaowai.cn'
|
||||
},{
|
||||
title: '小歪(PC/MC酱)'
|
||||
,url: 'https://api.ixiaowai.cn/mcapi/mcapi.php'
|
||||
,author:'https://api.ixiaowai.cn'
|
||||
},{
|
||||
title: '小歪(PC/风景)'
|
||||
,url: 'https://api.ixiaowai.cn/gqapi/gqapi.php'
|
||||
,author:'https://api.ixiaowai.cn'
|
||||
},{
|
||||
title: '保罗(PC/动漫)'
|
||||
,url: 'https://api.paugram.com/wallpaper/?source=sina'
|
||||
,author:'https://api.paugram.com/help/wallpaper'
|
||||
,n:'保罗'
|
||||
},{
|
||||
title: '樱道(PC/动漫)'
|
||||
,url: 'https://api.r10086.com/img-api.php?type=动漫综合1'
|
||||
,author:'https://img.r10086.com/'
|
||||
,n:'樱道'
|
||||
}]
|
||||
,click: function(obj){
|
||||
if (obj.n == '樱道'){
|
||||
layeropen('官方还有很多分类哦<br />感兴趣的自己去看<br />访问速度比较慢<br />友链有个镜像接口比较快','https://img.r10086.com/');
|
||||
}else if (obj.n == '保罗'){
|
||||
layeropen('官方还有其他接口<br />感兴趣的自己去看<br />有缓存','https://api.paugram.com/help/wallpaper');
|
||||
}else if (obj.n == '姬长信'){
|
||||
layeropen('官方还有其他接口<br />感兴趣的自己去看<br />慢且不稳','https://api.isoyu.com/#/壁纸模块');
|
||||
}
|
||||
this.elem.val(obj.url);
|
||||
}
|
||||
,style: 'width: 235px;'
|
||||
});
|
||||
|
||||
layui.background.render("input[name='backgroundURL']");
|
||||
|
||||
function layeropen(content,url){
|
||||
layer.open({
|
||||
type: 1
|
||||
|
||||
@@ -36,7 +36,7 @@ if ($DescrRowNumber <= 0 ){
|
||||
<link rel='stylesheet' href='<?php echo $libs?>/ContextMenu/2.9.2/jquery.contextMenu.min.css'>
|
||||
<link rel="stylesheet" href="<?php echo $libs?>/Font-awesome/4.7.0/css/font-awesome.css">
|
||||
<link rel="stylesheet" href="<?php echo $libs?>/Layui/v2.6.8/css/layui-icon.css">
|
||||
<link rel="stylesheet" href="<?php echo $theme_dir?>/static/style<?php echo $theme_config['CardNum'];?>.css?v=<?php echo $version; ?>">
|
||||
<link rel="stylesheet" href="<?php echo $theme_dir?>/static/style<?php echo $theme_config['CardNum'];?>.css?v=<?php echo $theme_ver; ?>">
|
||||
<link rel="shortcut icon" href="<?php echo $favicon;?>">
|
||||
<style>
|
||||
<?php $SBC = $theme_config['SidebarBackgroundColor']; if( empty($night) ) {?>
|
||||
@@ -242,7 +242,7 @@ var is_login = <?php echo is_login?'true':'false'; ?>;
|
||||
<script src = "<?php echo $libs?>/MDUI/v1.0.1/js/mdui.min.js"></script>
|
||||
<script src = "<?php echo $libs?>/Other/holmes.js"></script>
|
||||
<script src = "<?php echo $libs; ?>/jquery/jquery.qrcode.min.js"></script>
|
||||
<script src = "<?php echo $theme_dir?>/static/embed.js?v=<?php echo $version.time(); ?>"></script>
|
||||
<script src = "<?php echo $theme_dir?>/static/embed.js?v=<?php echo $theme_ver;?>"></script>
|
||||
<?php
|
||||
// 如果Key不为空,则加载天气插件!
|
||||
if ($WeatherPosition != 0){
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
"name":"默认主题(加强)",
|
||||
"description":"默认主题(加强)",
|
||||
"homepage":"https://gitee.com/tznb/OneNav",
|
||||
"version":"2.0.0",
|
||||
"update":"2023/03/15",
|
||||
"version":"2.0.1",
|
||||
"update":"2023/04/25",
|
||||
"author":"落幕",
|
||||
"screenshot":"https://s3.bmp.ovh/imgs/2022/04/17/8cac968a8cc8135c.png",
|
||||
"config": {
|
||||
|
||||
@@ -46,7 +46,7 @@ var menu = {
|
||||
link_id = link_id.replace('id_','');
|
||||
mdui.confirm('确认删除?'
|
||||
,function(){
|
||||
$.post(get_api('write_link','del'),{id:link_id},function(data,status){
|
||||
$.post(get_api('write_link','del'),{lid:link_id},function(data,status){
|
||||
if(data.code == 1) {
|
||||
$("#id_" + link_id).remove();
|
||||
}else{
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<meta name="format-detection" content="telephone=no">
|
||||
<link rel="stylesheet" href="<?php echo $libs?>/Layui/v2.6.8/css/layui.css">
|
||||
<link rel="stylesheet" href="<?php echo $libs?>/Other/login.css">
|
||||
<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon">
|
||||
<!--[if lt IE 9]>
|
||||
<script src="<?php echo $libs?>/Other/html5.min.js"></script>
|
||||
<script src="<?php echo $libs?>/Other/respond.min.js"></script>
|
||||
@@ -42,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>';
|
||||
}
|
||||
?>
|
||||
@@ -90,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});
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "默认",
|
||||
"description": "默认",
|
||||
"homepage": "https://gitee.com/tznb/TwoNav",
|
||||
"version": "2.0.1",
|
||||
"update": "2023/04/01",
|
||||
"version": "2.0.2",
|
||||
"update": "2023/04/25",
|
||||
"author": "TwoNav"
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 275 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.7 KiB |
@@ -1,4 +1,10 @@
|
||||
<?php if(!defined('DIR')){header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit;}?>
|
||||
<?php if(!defined('DIR')){header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit;}
|
||||
|
||||
$mail_config = get_db("global_config","v",["k"=>"mail_config"]);
|
||||
if(!empty($mail_config)){
|
||||
$mail_config = unserialize($mail_config);
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
@@ -11,7 +17,7 @@
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="format-detection" content="telephone=no">
|
||||
<link rel="stylesheet" href="<?php echo $libs?>/Layui/v2.6.8/css/layui.css">
|
||||
<link rel="stylesheet" href="./templates/register/default/main.css">
|
||||
<link rel="stylesheet" href="<?php echo $libs?>/Other/login.css">
|
||||
<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon">
|
||||
<!--[if lt IE 9]>
|
||||
<script src="<?php echo $libs?>/Other/html5.min.js"></script>
|
||||
@@ -33,17 +39,26 @@
|
||||
<input type="text" name="User" lay-verify="required" placeholder="请输入账号">
|
||||
</div>
|
||||
|
||||
<div class="item">
|
||||
<span class="icon layui-icon layui-icon-release"></span>
|
||||
<input type="text" name="Email" lay-verify="required|email" placeholder="请输入邮箱">
|
||||
</div>
|
||||
|
||||
<div class="item">
|
||||
<span class="icon layui-icon layui-icon-password"></span>
|
||||
<input type="password" name="Password" lay-verify="required" placeholder="请输入密码">
|
||||
<span class="bind-password icon icon-4"></span>
|
||||
</div>
|
||||
|
||||
<div class="item">
|
||||
<span class="icon layui-icon layui-icon-email"></span>
|
||||
<input type="text" name="Email" lay-verify="required|email" placeholder="请输入邮箱">
|
||||
</div>
|
||||
|
||||
<?php if($mail_config['verify_email'] == 1){ ?>
|
||||
<div class="item" style="width: 150px;">
|
||||
<span class="icon layui-icon layui-icon-auz"></span>
|
||||
<input type="text" name="code" placeholder="请输入验证码">
|
||||
<div style="display: inline-block;position: absolute;right: 0px;">
|
||||
<span><a class="layui-btn layui-btn-normal" lay-submit="" lay-filter="getcode" id="getcode">获取验证码</a></span>
|
||||
</div>
|
||||
</div>
|
||||
<?php }?>
|
||||
<div class="item" <?php echo $global_config['RegOption'] == 2 ?'':'style = "display:none;"'?>>
|
||||
<span class="icon layui-icon layui-icon-fonts-code"></span>
|
||||
<input type="text" name="regcode" placeholder="请输入注册码" value="<?php echo $_GET['key'];?>">
|
||||
@@ -88,8 +103,27 @@
|
||||
$("input[name='Password']").attr('type', 'text');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
//获取验证码
|
||||
form.on('submit(getcode)', function (data) {
|
||||
data = data.field;
|
||||
data.Password = $.md5(data.Password);
|
||||
if( /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(data.Email)){
|
||||
layer.load(1, {shade:[0.3,'#fff']});
|
||||
layer.msg('正在发送中..', {icon: 16,time: 1000*300});
|
||||
$.post('./index.php?c=<?php echo $c; ?>&u='+data.User+"&type=getcode",data,function(re,status){
|
||||
layer.closeAll();
|
||||
if(re.code == 1) {
|
||||
layer.msg("发送成功", {icon: 1});
|
||||
}else{
|
||||
layer.msg(re.msg, {icon: 5});
|
||||
}
|
||||
});
|
||||
}else{
|
||||
layer.msg('请输入正确的邮箱', {icon: 5});
|
||||
}
|
||||
});
|
||||
|
||||
// 进行注册操作
|
||||
form.on('submit(login)', function (data) {
|
||||
$("*").blur();
|
||||
@@ -119,7 +153,6 @@ function Get_Invitation($base64) {
|
||||
var content =decodeURIComponent(escape(window.atob($base64)));
|
||||
if (content.substr(0,4) =='http'){
|
||||
window.open(content);
|
||||
//window.location.href = content;
|
||||
}else{
|
||||
layer.open({title:'获取注册码',content:content});
|
||||
}
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
.main-body {top:50%;left:50%;position:absolute;-webkit-transform:translate(-50%,-50%);-moz-transform:translate(-50%,-50%);-ms-transform:translate(-50%,-50%);-o-transform:translate(-50%,-50%);transform:translate(-50%,-50%);overflow:hidden;}
|
||||
.login-main .login-bottom .center .item input {display:inline-block;width:227px;height:22px;padding:0;position:absolute;border:0;outline:0;font-size:14px;letter-spacing:0;}
|
||||
.login-main .login-bottom .center .item .icon-1 {background:url(icon-login.png) no-repeat 1px 0;}
|
||||
.login-main .login-bottom .center .item .icon-2 {background:url(icon-login.png) no-repeat -54px 0;}
|
||||
.login-main .login-bottom .center .item .icon-3 {background:url(icon-login.png) no-repeat -106px 0;}
|
||||
.login-main .login-bottom .center .item .icon-4 {background:url(icon-login.png) no-repeat 0 -43px;position:absolute;right:-10px;cursor:pointer;}
|
||||
.login-main .login-bottom .center .item .icon-5 {background:url(icon-login.png) no-repeat -55px -43px;}
|
||||
.login-main .login-bottom .center .item .icon-6 {background:url(icon-login.png) no-repeat 0 -93px;position:absolute;right:-10px;margin-top:8px;cursor:pointer;}
|
||||
.login-main .login-bottom .tip .icon-nocheck {display:inline-block;width:10px;height:10px;border-radius:2px;border:solid 1px #9abcda;position:relative;top:2px;margin:1px 8px 1px 1px;cursor:pointer;}
|
||||
.login-main .login-bottom .tip .icon-check {margin:0 7px 0 0;width:14px;height:14px;border:none;background:url(icon-login.png) no-repeat -111px -48px;}
|
||||
.login-main .login-bottom .center .item .icon {display:inline-block;width:33px;height:22px;}
|
||||
.login-main .login-bottom .center .item {width:288px;height:35px;border-bottom:1px solid #dae1e6;margin-bottom:35px;}
|
||||
.login-main {width:428px;position:relative;float:left;}
|
||||
.login-main .login-top {height:117px;background-color:#148be4;border-radius:12px 12px 0 0;font-family:SourceHanSansCN-Regular;font-size:30px;font-weight:400;font-stretch:normal;letter-spacing:0;color:#fff;line-height:117px;text-align:center;overflow:hidden;-webkit-transform:rotate(0);-moz-transform:rotate(0);-ms-transform:rotate(0);-o-transform:rotate(0);transform:rotate(0);}
|
||||
.login-main .login-top .bg1 {display:inline-block;width:74px;height:74px;background:#fff;opacity:.1;border-radius:0 74px 0 0;position:absolute;left:0;top:43px;}
|
||||
.login-main .login-top .bg2 {display:inline-block;width:94px;height:94px;background:#fff;opacity:.1;border-radius:50%;position:absolute;right:-16px;top:-16px;}
|
||||
.login-main .login-bottom {width:428px;background:#fff;border-radius:0 0 12px 12px;padding-bottom:53px;}
|
||||
.login-main .login-bottom .center {width:288px;margin:0 auto;padding-top:40px;padding-bottom:15px;position:relative;}
|
||||
.login-main .login-bottom .tip {clear:both;height:16px;line-height:16px;width:288px;margin:0 auto;}
|
||||
body {background:url(bg.png) 0% 0% / cover no-repeat;position:static;font-size:12px;}
|
||||
input::-webkit-input-placeholder {color:#a6aebf;}
|
||||
input::-moz-placeholder {/* Mozilla Firefox 19+ */ color:#a6aebf;}
|
||||
input:-moz-placeholder {/* Mozilla Firefox 4 to 18 */ color:#a6aebf;}
|
||||
input:-ms-input-placeholder {/* Internet Explorer 10-11 */ color:#a6aebf;}
|
||||
input:-webkit-autofill {/* 取消Chrome记住密码的背景颜色 */ -webkit-box-shadow:0 0 0 1000px white inset !important;}
|
||||
html {height:100%;}
|
||||
.login-main .login-bottom .tip {clear:both;height:16px;line-height:16px;width:288px;margin:0 auto;}
|
||||
.login-main .login-bottom .tip .login-tip {font-family:MicrosoftYaHei;font-size:12px;font-weight:400;font-stretch:normal;letter-spacing:0;color:#9abcda;cursor:pointer;}
|
||||
.login-main .login-bottom .tip .forget {font-stretch:normal;letter-spacing:0;color:#1391ff;text-decoration:none;position:absolute;right:62px;}
|
||||
.login-main .login-bottom .login-btn {width:288px;height:40px;background-color:#1E9FFF;border-radius:16px;margin:24px auto 0;text-align:center;line-height:40px;color:#fff;font-size:14px;letter-spacing:0;cursor:pointer;border:none;}
|
||||
.login-main .login-bottom .center .item .validateImg {position:absolute;right:1px;cursor:pointer;height:36px;border:1px solid #e6e6e6;}
|
||||
.footer {left:0;bottom:0;color:#fff;width:100%;position:absolute;text-align:center;line-height:30px;padding-bottom:10px;text-shadow:#000 0.1em 0.1em 0.1em;font-size:14px;}
|
||||
.padding-5 {padding:5px !important;}
|
||||
.footer a,.footer span {color:#fff;}
|
||||
@media screen and (max-width:428px) {.login-main {width:360px !important;}
|
||||
.login-main .login-top {width:360px !important;}
|
||||
.login-main .login-bottom {width:360px !important;}
|
||||
}
|
||||
@@ -58,7 +58,7 @@
|
||||
<div class="layui-form-item" style="padding-top: 10px;">
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
|
||||
过渡页使用说明,请参考:<a href="https://dwz.ovh/mrkx1" target = "_blank" title = "过渡页使用说明">https://dwz.ovh/mrkx1</a>
|
||||
<a href="https://gitee.com/tznb/TwoNav/wikis/pages?sort_id=7968712&doc_id=3767990" target = "_blank" >过渡页使用说明</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -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 } ?>
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
"name":"OneNav1",
|
||||
"description":"OneNav旧版过渡页",
|
||||
"homepage":"https://www.xiaoz.me",
|
||||
"version":"2.0.0",
|
||||
"update":"2023/03/15",
|
||||
"version":"2.0.1",
|
||||
"update":"2023/04/05",
|
||||
"author":"xiaoz",
|
||||
"screenshot":"https://s3.bmp.ovh/imgs/2022/04/17/8cac968a8cc8135c.png",
|
||||
"config": {
|
||||
|
||||
Reference in New Issue
Block a user