mirror of
https://github.com/tznb1/TwoNav.git
synced 2025-08-10 08:51:49 +00:00
Compare commits
5 Commits
v2.0.12-20
...
v2.0.17-20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
689dcb2e94 | ||
|
|
5b6925aafa | ||
|
|
ccae67f236 | ||
|
|
87566c39f3 | ||
|
|
5cae5af159 |
@@ -38,7 +38,7 @@ define('libs',$global_config['Libs']);
|
||||
define('SysVer',Get_Version());
|
||||
define('Debug',$global_config['Debug'] == 1);
|
||||
|
||||
if($c !== $global_config["Register"]){
|
||||
if($c != $global_config["Register"]){
|
||||
$u = Get('u');
|
||||
if(empty($u) && $global_config['Sub_domain'] == 1 && is_subscribe('bool')){
|
||||
$cut = explode('.',$_SERVER["HTTP_HOST"]);
|
||||
@@ -73,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);
|
||||
|
||||
@@ -119,7 +119,54 @@ if(!empty($_GET['type'])){
|
||||
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{
|
||||
//判断是否已验证
|
||||
@@ -174,7 +221,7 @@ function echo_Atool(){
|
||||
<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: 900px;margin: 0 auto;padding: 0 15px;}
|
||||
.page-wrapper {width: 1200px;margin: 0 auto;padding: 0 15px;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -219,6 +266,7 @@ function echo_Atool(){
|
||||
<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>
|
||||
@@ -232,7 +280,7 @@ function echo_Atool(){
|
||||
var table = layui.table;
|
||||
var cols = [[
|
||||
{field:'ID',title:'ID',width:60,sort:true}
|
||||
,{title:'操作',toolbar:'#tablebar',width:130}
|
||||
,{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>'
|
||||
}}
|
||||
@@ -299,6 +347,18 @@ function echo_Atool(){
|
||||
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 () {
|
||||
|
||||
@@ -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>');
|
||||
}
|
||||
}
|
||||
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']);
|
||||
@@ -42,7 +42,8 @@ CREATE TABLE IF NOT EXISTS `updatadb_logs` (
|
||||
UNIQUE KEY `file_name` (`file_name`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
INSERT INTO "updatadb_logs" ("id", "file_name", "update_time", "status", "extra") VALUES ('1', '20230417.php', '1681719049', 'TRUE', '');
|
||||
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`;
|
||||
|
||||
@@ -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,'注册成功');
|
||||
|
||||
|
||||
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,7 +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" ("id", "file_name", "update_time", "status", "extra") VALUES ('1', '20230417.php', '1681719049', 'TRUE', '');
|
||||
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" (
|
||||
|
||||
@@ -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 = get_dir_list(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,16 +79,19 @@ 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 = get_dir_list(DIR.'/templates/'.$fn);
|
||||
|
||||
@@ -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,7 +172,6 @@ if( $page == 'theme_home' || $page == 'theme_login' || $page == 'theme_transit'
|
||||
define('referrer',$data['referrer']);
|
||||
}
|
||||
}
|
||||
//var_dump($themes);exit;
|
||||
}
|
||||
|
||||
|
||||
@@ -230,7 +210,6 @@ if ($page == 'menu') {
|
||||
array_push($menu,$extend);
|
||||
}
|
||||
|
||||
|
||||
//如果是管理员则追加菜单
|
||||
if($USER_DB['UserGroup'] == 'root'){
|
||||
array_push($menu,
|
||||
@@ -251,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']));
|
||||
@@ -271,7 +249,6 @@ if(!empty($page)){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//加载静态库
|
||||
function load_static($type){
|
||||
if($type == 'css'){
|
||||
|
||||
@@ -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'];
|
||||
@@ -1098,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,"离线模式禁止下载主题!");} //离线模式
|
||||
@@ -1191,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";
|
||||
//判断设置的类型
|
||||
@@ -1219,6 +1227,9 @@ function write_theme(){
|
||||
}elseif($fn == 'register'){
|
||||
$global_templates['register'] = $name;
|
||||
update_db('global_config',['v'=>$global_templates],['k'=>'s_templates'],[1,'注册模板设置成功']);
|
||||
}elseif($fn == 'guide'){
|
||||
$global_templates['guide'] = $name;
|
||||
update_db('global_config',['v'=>$global_templates],['k'=>'s_templates'],[1,'引导页模板设置成功']);
|
||||
}
|
||||
//更新数据
|
||||
update_db('user_config',['v'=>$s_templates],['uid'=>UID,'k'=>'s_templates'],[1,'设置成功']);
|
||||
@@ -1231,10 +1242,22 @@ function write_theme(){
|
||||
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']);
|
||||
|
||||
@@ -42,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);
|
||||
@@ -321,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;
|
||||
//设用户组
|
||||
@@ -499,9 +514,12 @@ 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'=>'留言管理参数错误'],
|
||||
@@ -519,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 ?"保存成功,未检测到有效授权,带*号的配置无法为你保存":"保存成功")]);
|
||||
@@ -605,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);
|
||||
//返回
|
||||
@@ -631,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']));
|
||||
$favicon = ( !empty($site['site_icon_file'])) ? $site['site_icon'] : './favicon.ico';
|
||||
$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,21 +105,15 @@ 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>';
|
||||
|
||||
|
||||
//统计点击数
|
||||
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]));
|
||||
|
||||
|
||||
//读取用户主题配置
|
||||
$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);
|
||||
@@ -143,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;
|
||||
|
||||
@@ -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,7 +64,7 @@ $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);
|
||||
@@ -133,10 +153,11 @@ function get_links($fid) {
|
||||
$where['LIMIT'] = $site['new_link'];
|
||||
}
|
||||
$where['ORDER']['lid'] = 'DESC';
|
||||
//输出上限&不在子页面&例外主题
|
||||
}elseif($site['max_link'] > 0 && empty(Get('oc')) && !$site['ex_theme']){
|
||||
//输出上限&不在子页面&例外主题&书签分享
|
||||
}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);
|
||||
foreach ($links as $key => $link) {
|
||||
@@ -173,7 +194,7 @@ function get_links($fid) {
|
||||
//获取图标链接
|
||||
$links[$key]['ico'] = $lock ? $GLOBALS['libs'].'/Other/lock.svg' : geticourl($site['link_icon'],$link);
|
||||
}
|
||||
if($site['max_link'] > 0 && $count > $site['max_link'] && empty(Get('oc')) && !$site['ex_theme']){
|
||||
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']);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ 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;
|
||||
@@ -51,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);
|
||||
@@ -76,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]);
|
||||
@@ -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 ) ;
|
||||
@@ -638,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,'发送失败');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,10 @@ if(empty($c) || in_array($c,['index','click'])){
|
||||
}//如果参数错误则使用本地服务器
|
||||
}
|
||||
//取分类图标(六零系主题在用)
|
||||
function get_category($content){
|
||||
function get_category($content){ //抽风的命名..过度几个版本后删除
|
||||
return get_category_icon($content);
|
||||
}
|
||||
function get_category_icon($content){
|
||||
if(empty($content)){
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
v2.0.12-20230417
|
||||
v2.0.17-20230428
|
||||
@@ -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: ['知道了']});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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">';
|
||||
|
||||
@@ -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();
|
||||
//渲染表格
|
||||
|
||||
@@ -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'} //开启单选框
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -134,9 +134,9 @@
|
||||
|
||||
<?php } ?>
|
||||
<div class="layui-form-item">
|
||||
<button class="layui-btn layui-btn-primary layui-border-black" id="help" sort_id="7968924">帮助</button>
|
||||
<button type="button" class="layui-btn layui-btn-primary layui-border-black" id="help" sort_id="7968924">帮助</button>
|
||||
<?php if($global_config['Default_User'] != U ){ ?>
|
||||
<button class="layui-btn layui-btn-primary layui-border-black" id="sdhp" data=>设为默认主页</button>
|
||||
<button type="button" class="layui-btn layui-btn-primary layui-border-black" id="sdhp" data=>设为默认主页</button>
|
||||
<?php } ?>
|
||||
<button class="layui-btn layui-btn-normal" lay-submit lay-filter="save">保存</button>
|
||||
</div>
|
||||
@@ -184,7 +184,7 @@ layui.use(['jquery','form','upload'], function () {
|
||||
$.removeCookie("Default_User");
|
||||
$("#sdhp").text('设为默认主页')
|
||||
}else{
|
||||
$.cookie("Default_User",u);
|
||||
$.cookie("Default_User",u,{expires: 360});
|
||||
$("#sdhp").text('取消默认主页')
|
||||
}
|
||||
layer.msg("设置成功", {icon: 1});
|
||||
|
||||
@@ -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();});
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -171,12 +171,14 @@ require 'header.php';
|
||||
<cite>站点设置</cite>
|
||||
</a>
|
||||
</div>
|
||||
<?php if(check_purview('theme_in',1)){ ?>
|
||||
<div class="layui-col-xs3 layuimini-qiuck-module">
|
||||
<a href="javascript:;" layuimini-content-href="theme_home" data-title="主题设置" data-icon="fa fa-magic">
|
||||
<i class="fa fa-magic"></i>
|
||||
<cite>主题设置</cite>
|
||||
</a>
|
||||
</div>
|
||||
<?php }?>
|
||||
<div class="layui-col-xs3 layuimini-qiuck-module">
|
||||
<a href="javascript:;" layuimini-content-href="category_list" data-title="分类管理" data-icon="fa fa-list-ul">
|
||||
<i class="fa fa-list-ul"></i>
|
||||
|
||||
@@ -25,7 +25,7 @@ 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 $data['value']?>" class="layui-input">
|
||||
<input type="text" name="_<?php echo $data['name']?>" autocomplete="off" value="<?php echo htmlentities($data['value'])?>" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
@@ -35,7 +35,7 @@ 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 $data['value']?></textarea>
|
||||
<textarea name="_<?php echo $data['name']?>" class="layui-textarea"><?php echo htmlentities($data['value'])?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
@@ -29,7 +29,7 @@ layui.use(['form','table'], function () {
|
||||
var table = layui.table;
|
||||
var form = layui.form;
|
||||
var api = get_api('read_pwd_group_list'); //列表接口
|
||||
var limit = localStorage.getItem(u + "_limit")??50;
|
||||
var limit = localStorage.getItem(u + "_limit") || 50;
|
||||
|
||||
var load_list = function () {
|
||||
table.render({
|
||||
|
||||
@@ -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>
|
||||
@@ -78,7 +78,7 @@ layui.use(['table','layer','form'], function(){
|
||||
var table = layui.table;
|
||||
var form = layui.form;
|
||||
var layer = layui.layer;
|
||||
var limit = localStorage.getItem(u + "_limit")??50;
|
||||
var limit = localStorage.getItem(u + "_limit") || 50;
|
||||
|
||||
|
||||
var cols=[[ //表头
|
||||
|
||||
@@ -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>
|
||||
@@ -221,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>
|
||||
|
||||
@@ -51,7 +51,6 @@ $HTTP_HOST = preg_replace('/:\d+$/','',$_SERVER['HTTP_HOST']); //去除端口号
|
||||
<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>
|
||||
|
||||
@@ -149,7 +149,7 @@
|
||||
layui.use(['form','table','laydate','tableSelect'], function () {
|
||||
var $ = layui.jquery,table = layui.table,form = layui.form,laydate = layui.laydate,tableSelect = layui.tableSelect;
|
||||
var api = get_api('read_share','share_list');
|
||||
var limit = localStorage.getItem(u + "_limit")??50;
|
||||
var limit = localStorage.getItem(u + "_limit") || 50;
|
||||
var index,temp_date,type='category';
|
||||
var isSupported = ClipboardJS.isSupported();
|
||||
var baseUrl = Get_baseUrl();
|
||||
@@ -200,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}
|
||||
@@ -331,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});
|
||||
|
||||
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>
|
||||
@@ -18,7 +18,7 @@
|
||||
<a href="javascript:;" layuimini-content-href="theme_login" data-title="登录模板">登录模板</a>
|
||||
<a href="javascript:;" layuimini-content-href="theme_transit" data-title="过渡模板">过渡模板</a>
|
||||
<?php if($USER_DB['UserGroup'] === 'root'){echo '<a href="javascript:;" layuimini-content-href="theme_register" data-title="注册模板">注册模板</a>';} ?>
|
||||
|
||||
<?php if($USER_DB['UserGroup'] === 'root'){echo '<a href="javascript:;" layuimini-content-href="theme_guide" data-title="引导页模板">引导页模板</a>';} ?>
|
||||
</span>
|
||||
</blockquote>
|
||||
<div class="layui-bg-gray" style="padding: 1px;" >
|
||||
|
||||
@@ -2,6 +2,71 @@
|
||||
<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">
|
||||
|
||||
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 |
@@ -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": {
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
<div class="tip">
|
||||
<?php
|
||||
//若为默认值则显示注册入口
|
||||
if($global_config['Register'] == 'register' && $global_config['RegOption'] == 1){
|
||||
if($global_config['Register'] == 'register' && $global_config['RegOption'] > 0){
|
||||
echo '<a href="./?c=register" class="forget">没有账号?立即注册</a>';
|
||||
}
|
||||
?>
|
||||
@@ -91,7 +91,7 @@
|
||||
data.Password = $.md5(data.Password);
|
||||
$.post('./index.php?c=<?php echo $c; ?>&u='+data.User,data,function(re,status){
|
||||
if(re.code == 1) {
|
||||
window.location.href = re.url ?? './index.php?c=admin&u='+ data.User;
|
||||
window.location.href = re.url;
|
||||
}else{
|
||||
layer.msg(re.msg, {icon: 5});
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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>
|
||||
@@ -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});
|
||||
}
|
||||
|
||||
@@ -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 } ?>
|
||||
|
||||
Reference in New Issue
Block a user