mirror of
https://github.com/tznb1/TwoNav.git
synced 2025-08-10 08:51:49 +00:00
Compare commits
5 Commits
v2.0.34-20
...
v2.0.38-20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98cf84b16c | ||
|
|
0d7353e692 | ||
|
|
1fe39f83f4 | ||
|
|
5c7136ff0f | ||
|
|
86be0ca786 |
@@ -8,5 +8,10 @@ RewriteRule '^login$' ./index.php?c=login [L]
|
||||
RewriteRule '^admin$' ./index.php?c=admin [L]
|
||||
RewriteRule '^ico/(.+)' ./index.php?c=icon&url=$1 [L]
|
||||
RewriteRule '^([A-Za-z0-9]+)$' ./index.php?u=$1 [L]
|
||||
RewriteRule '^(.+)/click/([A-Za-z0-9]+)$' ./index.php?c=$2&id=$3&u=$1 [L]
|
||||
RewriteRule '^(.+)/click/(.+)' ./$3 [L]
|
||||
RewriteRule '^([A-Za-z0-9]+).html$' ./index.php?u=$1 [L]
|
||||
RewriteRule '^([a-zA-Z0-9]+)/(click|article)/([A-Za-z0-9]+)$' ./index.php?c=$2&id=$3&u=$1 [L]
|
||||
RewriteRule '^([a-zA-Z0-9]+)/(click|article)/([A-Za-z0-9]+)\.html$' ./index.php?c=$2&id=$3&u=$1 [L]
|
||||
RewriteRule '^([a-zA-Z0-9]+)/(click|article)/(templates|static|data|system)/(.+)' /$3/$4 [L]
|
||||
RewriteRule '^([a-zA-Z0-9]+)/(click|article)/favicon\.ico' /favicon.ico [L]
|
||||
# 站点地图(可选)
|
||||
RewriteRule '^sitemap.xml$' ./index.php?c=sitemap [L]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
TwoNav 是一款开源免费的书签(导航)管理程序,界面简洁,安装简单,使用方便。TwoNav可帮助你将浏览器书签集中式管理,解决跨设备、跨平台、跨浏览器之间同步和访问困难问题,做到一处部署,随处访问。
|
||||
TwoNav 是一款开源的书签(导航)管理程序,界面简洁,安装简单,使用方便,基础功能免费。TwoNav可帮助你将浏览器书签集中式管理,解决跨设备、跨平台、跨浏览器之间同步和访问困难问题,做到一处部署,随处访问。
|
||||
|
||||
- **演示站**: [http://two.lm21.top](http://two.lm21.top)
|
||||
- **仅供体验,定期清理数据** 账号密码`admin`
|
||||
|
||||
@@ -66,7 +66,12 @@ if(!in_array($c,[$global_config["Register"],'ico','icon'])){
|
||||
}
|
||||
|
||||
session_name('TwoNavSID');
|
||||
if(defined('UID')){
|
||||
define('is_login',is_login()); $is_login = is_login;
|
||||
}
|
||||
|
||||
if(empty($c) || $c == 'index'){
|
||||
$c = 'index';
|
||||
require "./system/index.php";//主页
|
||||
}elseif($c == $global_config["Register"]){
|
||||
require "./system/Register.php";//注册
|
||||
@@ -74,7 +79,7 @@ if(empty($c) || $c == 'index'){
|
||||
require "./system/login.php";//登陆
|
||||
}elseif(in_array($c,['admin','click','api','ico','icon','verify'])){
|
||||
require "./system/{$c}.php";
|
||||
}elseif(in_array($c,['apply','guestbook','article'])){
|
||||
}elseif(in_array($c,['apply','guestbook','article','sitemap'])){
|
||||
if($global_config['Maintenance'] != 0){Amsg(-1,'网站正在进行维护,请稍后再试!');}
|
||||
require "./system/expand/{$c}.php";
|
||||
}else{
|
||||
|
||||
30
rewrite.php
Normal file
30
rewrite.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php //负责接管和处理Nginx伪静态规则
|
||||
|
||||
define('URI',$_SERVER['REQUEST_URI']);
|
||||
|
||||
//登录页和管理员(默认)
|
||||
if (URI === '/login' || URI === '/admin') {
|
||||
$_GET['c'] = substr(URI, 1);
|
||||
//本地图标
|
||||
}elseif(preg_match('/^\/ico\/(.+)$/', URI, $matches)){
|
||||
$_GET['c'] = 'icon';
|
||||
$_GET['url'] = $matches[1];
|
||||
//用户主页
|
||||
}elseif (preg_match('/^\/([A-Za-z0-9]+)(\.html)?$/', URI, $matches)) {
|
||||
$_GET['u'] = $matches[1];
|
||||
//过渡/文章
|
||||
}elseif(preg_match('/^\/([A-Za-z0-9]+)\/(click|article)\/([A-Za-z0-9]+)(\.html)?$/', URI, $matches)) {
|
||||
$_GET['u'] = $matches[1];
|
||||
$_GET['c'] = $matches[2];
|
||||
$_GET['id'] = $matches[3];
|
||||
//站点地图
|
||||
}elseif(URI === '/sitemap.xml'){
|
||||
$_GET['c'] = 'sitemap';
|
||||
//匹配失败
|
||||
}else{
|
||||
header("HTTP/1.0 404 Not Found");
|
||||
exit("404 Not Found.");
|
||||
}
|
||||
|
||||
include 'index.php';
|
||||
exit;
|
||||
@@ -165,6 +165,14 @@ if(!empty($_GET['type'])){
|
||||
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,'操作成功']);
|
||||
}elseif($_GET['type'] == 'del_otp'){
|
||||
$user_data = get_db('global_user','*',['ID'=>$_POST['ID']]);
|
||||
$LoginConfig = unserialize($user_data['LoginConfig']);
|
||||
if(empty($LoginConfig['totp_key'])){
|
||||
msgA(['code'=>-1,'msg'=>'当前账号未开启OTP双重验证']);
|
||||
}
|
||||
$LoginConfig['totp_key'] = '';
|
||||
update_db("global_user", ["LoginConfig" => $LoginConfig], ["ID" => $_POST['ID']],[1,'操作成功']);
|
||||
}
|
||||
|
||||
msgA(['code'=>-1,'msg'=>'请求类型错误']);
|
||||
@@ -267,6 +275,7 @@ function echo_Atool(){
|
||||
<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>
|
||||
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="del_otp" title="移除OTP登录验证">删OTP</a>
|
||||
</div>
|
||||
</script>
|
||||
<script src="../static/Layui/v2.8.10/layui.js"></script>
|
||||
@@ -280,7 +289,7 @@ function echo_Atool(){
|
||||
var table = layui.table;
|
||||
var cols = [[
|
||||
{field:'ID',title:'ID',width:60,sort:true}
|
||||
,{title:'操作',toolbar:'#tablebar',width:175}
|
||||
,{title:'操作',toolbar:'#tablebar',width:220}
|
||||
,{field:'User',title:'账号',minWidth:120,templet:function(d){
|
||||
return '<a style="color:#3c78d8" title="打开用户主页" target="_blank" href="../?u='+d.User+'">'+d.User+'</a>'
|
||||
}}
|
||||
@@ -359,6 +368,14 @@ function echo_Atool(){
|
||||
}
|
||||
});
|
||||
});
|
||||
}else if(obj.event == 'del_otp'){
|
||||
$.post('./ATool.php?type=del_otp',{ID:data.ID},function(data,status){
|
||||
if(data.code == 1) {
|
||||
layer.msg(data.msg, {icon: 1});
|
||||
}else{
|
||||
layer.msg(data.msg, {icon: 5});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
$('.set').click(function () {
|
||||
|
||||
@@ -4,21 +4,10 @@ if($global_config['Maintenance'] != 0){Amsg(-1,'网站正在进行维护,请稍
|
||||
$global_templates = unserialize(get_db("global_config",'v', ["k" => "s_templates"]));
|
||||
//如果是Get请求则载入登录模板
|
||||
if($_SERVER['REQUEST_METHOD'] === 'GET'){
|
||||
$t_name = $global_templates['register'];
|
||||
$t_dir = "./templates/register/".$t_name; //模板目录
|
||||
$t_path = "./templates/register/{$t_name}/index.php"; //模板路径
|
||||
//如果不存在则使用默认模板
|
||||
if(!file_exists($t_path)){
|
||||
$t_name = 'default';
|
||||
$t_dir ='./templates/register/default';
|
||||
$t_path = './templates/register/default/index.php';
|
||||
$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'];
|
||||
$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;
|
||||
//通用数据初始化
|
||||
require DIR."/system/templates.php";
|
||||
$reg_tips = get_db('global_config','v',['k'=>'reg_tips']); //注册提示
|
||||
require $index_path;
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,14 +4,15 @@ $page = trim($_GET['page']); //获取请求参数
|
||||
$Ver = !Debug?SysVer:SysVer.'.'.time(); //版本
|
||||
$LoginConfig = unserialize($USER_DB['LoginConfig']); //登录配置
|
||||
define('offline',$global_config['offline'] == 1); //是否离线模式
|
||||
define('is_login',is_login()); //是否已登录
|
||||
//未登录,载入登录提示页
|
||||
if(!is_login){
|
||||
require(DIR.'/templates/admin/page/LoginPrompt.php');
|
||||
exit;
|
||||
}//已登录,检查是否需要验证二级密码
|
||||
elseif(!empty($LoginConfig['Password2']) && !Check_Password2($LoginConfig)){
|
||||
require DIR.'/templates/admin/other/verify_pwd2.php';
|
||||
$c = 'verify';$_GET['c'] = 'pwd2';
|
||||
require DIR."/system/templates.php";
|
||||
require $index_path;
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -64,7 +65,7 @@ if($page == 'config_home'){
|
||||
$theme_config = empty($theme_config['config']) ? []:$theme_config['config'];
|
||||
|
||||
//读取用户主题配置
|
||||
if(!in_array($_GET['fn'],['home','login','register','transit','guide','article'])){
|
||||
if(!in_array($_GET['fn'],['home','login','register','transit','guide','article','verify','guestbook','apply'])){
|
||||
msg(-1,"参数错误");
|
||||
}
|
||||
$theme_config_db = get_db('user_config','v',['t'=>'theme_'.$_GET['fn'],'k'=>$theme,'uid'=>UID]);
|
||||
@@ -178,64 +179,6 @@ if( $page == 'theme_home' || $page == 'theme_login' || $page == 'theme_transit'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//菜单接口
|
||||
if ($page == 'menu') {
|
||||
$menu = [];
|
||||
if(check_purview('site_info',1)){
|
||||
array_push($menu,['title'=>'站点设置','href'=>'SiteSetting','icon'=>'fa fa-cog']);
|
||||
}
|
||||
if(check_purview('theme_in',1)){
|
||||
array_push($menu,['title'=>'主题设置','href'=>'theme_home','icon'=>'fa fa-magic']);
|
||||
}
|
||||
array_push($menu,
|
||||
['title'=>'分类管理','href'=>'category_list','icon'=>'fa fa-list-ul'],
|
||||
['title'=>'加密管理','href'=>'pwd_group','icon'=>'fa fa-lock'],
|
||||
['title'=>'链接管理','icon'=>'fa fa-folder-open-o','href'=>'','child'=>
|
||||
[
|
||||
['title'=>'链接列表','href'=>'link_list','icon'=>'fa fa-link'],
|
||||
['title'=>'添加链接','href'=>'link_add','icon'=>'fa fa-plus-square-o'],
|
||||
['title'=>'书签分享','href'=>'share','icon'=>'fa fa-external-link'],
|
||||
['title'=>'导出导入','href'=>'data_control','icon'=>'fa fa-retweet'],
|
||||
]
|
||||
]);
|
||||
|
||||
//扩展功能
|
||||
$extend = [];
|
||||
if($global_config['apply'] == 1 && check_purview('apply',1)){
|
||||
array_push($extend,['title'=>'收录管理','href'=>'expand/apply-admin','icon'=>'fa fa-pencil']);
|
||||
}
|
||||
if($global_config['guestbook'] == 1 && check_purview('guestbook',1)){
|
||||
array_push($extend,['title'=>'留言管理','href'=>'expand/guestbook-admin','icon'=>'fa fa-commenting-o']);
|
||||
}
|
||||
if($global_config['article'] == 1 && check_purview('article',1)){
|
||||
array_push($extend,['title'=>'文章管理','href'=>'expand/article-list','icon'=>'fa fa-file-text-o']);
|
||||
}
|
||||
if(!empty($extend)){
|
||||
$extend = ['title'=>'扩展功能','icon'=>'fa fa-folder-open-o','href'=>'','child'=> $extend];
|
||||
array_push($menu,$extend);
|
||||
}
|
||||
|
||||
//如果是管理员则追加菜单
|
||||
if($USER_DB['UserGroup'] == 'root'){
|
||||
array_push($menu,
|
||||
['title'=>'网站管理','icon'=>'fa fa-wrench','href'=>'','child'=>
|
||||
[
|
||||
['title'=>'系统设置','href'=>'root/sys_setting','icon'=>'fa fa-gears'],
|
||||
['title'=>'授权管理','href'=>'root/vip','icon'=>'fa fa-diamond'],
|
||||
//['title'=>'默认设置','href'=>'root/default_setting','icon'=>'fa fa-heart-o'],
|
||||
['title'=>'用户管理','href'=>'root/user_control','icon'=>'fa fa-user'],
|
||||
['title'=>'用户分组','href'=>'root/users_control','icon'=>'fa fa-users'],
|
||||
['title'=>'注册管理','href'=>'root/reg_control','icon'=>'fa fa-user-plus'],
|
||||
['title'=>'站长工具','href'=>'root/tool','icon'=>'fa fa-exclamation-triangle'],
|
||||
]
|
||||
]);
|
||||
}
|
||||
$init = array( 'homeInfo'=>['title'=>'概要','href'=>'home'],'logoInfo'=>['title'=>'TwoNav','image'=>'./templates/admin/img/logo.png','href'=>'./?u='.U],'menuInfo'=>$menu);
|
||||
header('Content-Type:application/json; charset=utf-8');
|
||||
exit(json_encode($init));
|
||||
}
|
||||
|
||||
//不带参数是载入框架
|
||||
if(empty($page)){
|
||||
$site = unserialize(get_db('user_config','v',['uid'=>UID,'k'=>'s_site']));
|
||||
|
||||
329
system/api.php
329
system/api.php
@@ -441,6 +441,16 @@ function write_link(){
|
||||
}
|
||||
//插入数据库
|
||||
insert_db('user_links',$data);
|
||||
//读取站点地图配置并判断是否需要更新
|
||||
$sitemap_config = unserialize( get_db("global_config", "v", ["k" => "sitemap_config"]));
|
||||
if(isset($sitemap_config['zhudong']) && $sitemap_config['zhudong'] == '1'){
|
||||
$sitemap_path = DIR . "/data/user/{$u}/sitemap.php";
|
||||
require DIR .'/system/expand/sitemap_create.php';
|
||||
if(is_Update_Sitemap($sitemap_config,$sitemap_path)){
|
||||
create_sitemap($sitemap_config,$sitemap_path,$u);
|
||||
}
|
||||
}
|
||||
|
||||
msgA(['code'=>1,'msg'=>'添加成功','id'=>$lid]);
|
||||
//上传图标
|
||||
}elseif($_GET['type'] === 'upload_images'){
|
||||
@@ -680,10 +690,6 @@ function write_link(){
|
||||
update_db('user_links',['weight'=>$key[1]],['uid'=>UID,'lid'=>$key[0]]);
|
||||
}
|
||||
msg(1,'保存成功');
|
||||
|
||||
msg(-1,'未支持');
|
||||
|
||||
|
||||
//私有切换
|
||||
}elseif($_GET['type'] === 'property_sw' ){
|
||||
update_db('user_links',['property'=>intval($_POST['property']) ],['uid'=>UID,'lid'=>intval($_POST['lid']) ],[1,'保存成功']);
|
||||
@@ -1175,20 +1181,21 @@ function write_transit_setting(){
|
||||
'admin_stay_time'=>['int'=>true,'min'=>0,'max'=>60,'msg'=>'管理员停留时间范围0-60'],
|
||||
'default_keywords'=>['int'=>true,'min'=>0,'max'=>1,'msg'=>'默认关键字参数错误']
|
||||
];
|
||||
|
||||
foreach ($datas as $key => $data){
|
||||
if($data['int']){
|
||||
$s[$key] = ($_POST[$key] >= $data['min'] && $_POST[$key] <= $data['max'])?intval($_POST[$key]):msg(-1,$data['msg']);
|
||||
}elseif(isset($data['v'])){
|
||||
$s[$key] = in_array($_POST[$key],$data['v']) ? $_POST[$key]:msg(-1,$data['msg']);
|
||||
}else{
|
||||
$s[$key] = $data['empty']?$_POST[$key]:(!empty($_POST[$key])?$_POST[$key]:msg(-1,$data['msg']));
|
||||
}
|
||||
}
|
||||
$s = Post_data_filter($datas);
|
||||
write_user_config('s_transition_page',$s,'config','过渡页配置');
|
||||
msg(1,"保存成功!");
|
||||
}
|
||||
|
||||
//写验证页配置
|
||||
function write_verify_page(){
|
||||
$datas = [
|
||||
'link_tip'=>['empty'=>true],
|
||||
'share_tip'=>['empty'=>true]
|
||||
];
|
||||
$s = Post_data_filter($datas);
|
||||
write_user_config('s_verify_page',$s,'config','验证页配置');
|
||||
msg(1,"保存成功!");
|
||||
}
|
||||
|
||||
//修改密码
|
||||
function write_user_password(){
|
||||
@@ -1358,10 +1365,137 @@ function other_testing_link(){
|
||||
msgA(['code' => 0 ,'StatusCode'=> $code]);
|
||||
}
|
||||
|
||||
//读主题信息
|
||||
function read_theme(){
|
||||
global $global_config;
|
||||
global $USER_DB;
|
||||
// 检查权限
|
||||
if(!check_purview('theme_in',1)){
|
||||
msg(-1,'无权限');
|
||||
}
|
||||
|
||||
$check_dirs = ['home','login','transit','register','guide','article','apply','verify','guestbook'];
|
||||
$request_dir = $_GET['dir'];
|
||||
if(in_array($request_dir,$check_dirs)){
|
||||
if(in_array($request_dir,['register','guide']) && $USER_DB['UserGroup'] != 'root' ){
|
||||
msg(-1,'管理此模板需管理员权限');
|
||||
}
|
||||
}else{
|
||||
msg(-1,'dir参数错误');
|
||||
}
|
||||
$son_dirs = get_dir_list(DIR.'/templates/'.$request_dir);
|
||||
|
||||
foreach ($son_dirs as $son_dir) {
|
||||
$path = DIR.'/templates/'.$request_dir.'/'.$son_dir; //目录完整路径
|
||||
//没有信息文件则跳过
|
||||
if(!is_file($path.'/info.json') ) {continue;}
|
||||
//读取主题信息
|
||||
$themes[$son_dir] = json_decode(@file_get_contents($path.'/info.json'),true);
|
||||
//是否支持配置
|
||||
$themes[$son_dir]['config'] = is_file($path.'/config.php') ? '1':'0';
|
||||
//预览图优先顺序:png>jpg>info>default
|
||||
if(is_file($path.'/screenshot.jpg')){
|
||||
$themes[$son_dir]['screenshot'] = "./templates/$request_dir/$son_dir/screenshot.jpg";
|
||||
}elseif(is_file($path.'/screenshot.png')){
|
||||
$themes[$son_dir]['screenshot'] = "./templates/$request_dir/$son_dir/screenshot.png";
|
||||
}elseif(empty($themes[$son_dir]['screenshot'])){
|
||||
$themes[$son_dir]['screenshot'] = "./templates/admin/static/42ed3ef2c4a50f6d.png";
|
||||
}
|
||||
}
|
||||
|
||||
function filter($arr){
|
||||
foreach($arr as $key => $data){
|
||||
$new[$key]['name'] = $data['name'] ?? 'null';
|
||||
$new[$key]['description']= $data['description'] ?? 'null';
|
||||
$new[$key]['homepage']= $data['homepage'] ?? 'null';
|
||||
$new[$key]['version']= $data['version'] ?? 'null';
|
||||
$new[$key]['update']= $data['update'] ?? 'null';
|
||||
$new[$key]['author']= $data['author'] ?? 'null';
|
||||
$new[$key]['screenshot']= $data['screenshot'] ?? 'null';
|
||||
$new[$key]['config'] = $data['config'] ?? '0';
|
||||
$new[$key]['state'] = $data['up'] == 1 ? 'up' : (empty($data['dir']) ? 'local' : 'dw');
|
||||
}
|
||||
return $new;
|
||||
}
|
||||
|
||||
//在线主题处理
|
||||
if ( !$global_config['offline'] && $USER_DB['UserGroup'] === 'root'){
|
||||
|
||||
if(preg_match('/^v.+-(\d{8})$/i',SysVer,$matches)){
|
||||
$sysver = intval( $matches[1] );//取版本中的日期
|
||||
}else{
|
||||
msg(-1,'获取程序版本异常');
|
||||
}
|
||||
|
||||
//读取缓存
|
||||
$page = 'theme_'.$request_dir;
|
||||
$template = get_db('global_config','v',['k'=>$page.'_cache']);
|
||||
if(!empty($template)){
|
||||
$data = json_decode($template, true);
|
||||
}
|
||||
|
||||
//没有缓存 或 禁止缓存 或 缓存过时
|
||||
if(empty($template) || $_GET['cache'] === 'no' || time() - $data["time"] > 1800 ){
|
||||
$urls = [
|
||||
"lm21" => "https://update.lm21.top/TwoNav/{$request_dir}_template.json",
|
||||
"gitee" => "https://gitee.com/tznb/twonav_updata/raw/master/{$request_dir}_template.json"
|
||||
];
|
||||
$Source = $global_config['Update_Source'] ?? '';
|
||||
if (!empty($Source) && isset($urls[$Source])) {
|
||||
$urls = [$Source => $urls[$Source]];
|
||||
}
|
||||
}else{
|
||||
$cache = true;
|
||||
}
|
||||
//读取超时参数
|
||||
$overtime = !isset($global_config['Update_Overtime']) ? 3 : ($global_config['Update_Overtime'] < 3 || $global_config['Update_Overtime'] > 60 ? 3 : $global_config['Update_Overtime']);
|
||||
//远程获取
|
||||
foreach($urls as $key => $url){
|
||||
$Res = ccurl($url,$overtime);
|
||||
$data = json_decode($Res["content"], true);
|
||||
if($data["code"] == 200 ){ //如果获取成功
|
||||
$data["time"] = time(); //记录当前时间
|
||||
write_global_config($page.'_cache',json_encode($data),$request_dir.'_模板缓存');
|
||||
break; //跳出循环.
|
||||
}
|
||||
}
|
||||
//解析
|
||||
foreach($data["data"] as $key){
|
||||
$path = DIR.'/templates/'.$request_dir.'/'.$key["dir"];
|
||||
if( is_dir($path) ) { //本地存在
|
||||
$value = $key["dir"];
|
||||
//检查是否可以更新
|
||||
$update = str_replace('/','',$themes[$value]['update']); //本地主题版本
|
||||
$update_new = str_replace('/','',$key["update"]); //远程主题版本
|
||||
if( $sysver >= intval($key["low"]) && $sysver <= intval($key["high"]) && $update < $update_new ){
|
||||
$themes[$value]['up'] = '1';
|
||||
}
|
||||
}else{
|
||||
//判断是否适配当前系统版本
|
||||
if( $sysver >= intval($key["low"]) && $sysver <= intval($key["high"]) ){
|
||||
$value = $key["dir"];
|
||||
$themes[$value] = json_decode(json_encode($key),true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//取正在使用的模板
|
||||
$s_templates = unserialize(get_db("user_config", "v", ["uid"=>UID,"k"=>"s_templates"]));
|
||||
if($request_dir == 'home'){
|
||||
$current['home_pad'] = $s_templates['home_pad'] ?? 'default';
|
||||
$current['home_pc'] = $s_templates['home_pc'] ?? 'default';
|
||||
}else{
|
||||
$current[$request_dir] = $s_templates[$request_dir] ?? 'default';
|
||||
}
|
||||
|
||||
$themes = filter($themes);
|
||||
msgA(['code'=>1,'data'=>$themes,'current'=>$current,'referrer'=>($data['referrer'] ?? '')]);
|
||||
}
|
||||
//主题下载/更新/删除
|
||||
function write_theme(){
|
||||
global $global_config;
|
||||
$fn = $_POST['fn'];if($_GET['type'] != 'config' && !in_array($fn,['home','login','transit','register','guide','article'])){msg(-1,'fn参数错误');}
|
||||
$fn = $_POST['fn'];if($_GET['type'] != 'config' && !in_array($fn,['home','login','transit','register','guide','article','verify','guestbook','apply'])){msg(-1,'fn参数错误');}
|
||||
if($_GET['type'] == 'download'){
|
||||
is_root();
|
||||
if($global_config['offline']){msg(-1,"离线模式禁止下载主题!");} //离线模式
|
||||
@@ -1466,6 +1600,11 @@ function write_theme(){
|
||||
|
||||
//读取用户模板配置
|
||||
require DIR."/system/templates.php";
|
||||
if($fn == 'register' || $fn == 'guide'){
|
||||
$global_templates[$fn] = $name;
|
||||
update_db('global_config',['v'=>$global_templates],['k'=>'s_templates'],[1,'操作成功']);
|
||||
}
|
||||
|
||||
//判断设置的类型
|
||||
if($fn == 'home'){
|
||||
if( $type == 'PC/Pad'){
|
||||
@@ -1478,18 +1617,8 @@ function write_theme(){
|
||||
}else{
|
||||
msg(-1,'参数错误');
|
||||
}
|
||||
}elseif($fn == 'login'){
|
||||
$s_templates['login'] = $name;
|
||||
}elseif($fn == 'transit'){
|
||||
$s_templates['transit'] = $name;
|
||||
}elseif($fn == 'article'){
|
||||
$s_templates['article'] = $name;
|
||||
}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,'引导页模板设置成功']);
|
||||
}else{
|
||||
$s_templates[$fn] = $name;
|
||||
}
|
||||
//更新数据
|
||||
update_db('user_config',['v'=>$s_templates],['uid'=>UID,'k'=>'s_templates'],[1,'设置成功']);
|
||||
@@ -1508,7 +1637,7 @@ function write_theme(){
|
||||
msg(-1,"获取模板类型错误");
|
||||
}
|
||||
$fn = empty($GET['fn']) ? $_GET['template_type'] : $GET['fn'];
|
||||
if(!in_array($fn,['home','login','register','transit','guide','article'])){
|
||||
if(!in_array($fn,['home','login','transit','register','guide','article','verify','guestbook','apply'])){
|
||||
msg(-1,"参数错误");
|
||||
}
|
||||
//0420 END
|
||||
@@ -1704,6 +1833,9 @@ function read_data(){
|
||||
msgA( ['code'=>1,'data'=>[$category_count,$link_count,$index_count,$click_count] ]);
|
||||
//连通测试
|
||||
}elseif($_GET['type'] == 'connectivity_test'){
|
||||
if($GLOBALS['global_config']['offline'] == '1'){
|
||||
msg(1,'您已开启离线模式,无法使用该功能!');
|
||||
}
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $_POST['url']);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
||||
@@ -1820,6 +1952,75 @@ function read_data(){
|
||||
|
||||
$data = ['dates'=>$dates,'day_data'=>$day_data];
|
||||
msgA(['code'=>1,'data'=>$data]);
|
||||
}elseif($_GET['type'] == 'tongji_ip_list'){
|
||||
$days = isset($_GET['date']) && !empty($_GET['date']) ? $_GET['date'] : 7;
|
||||
$dates = [];
|
||||
for ($i = 0; $i < $days; $i++) {
|
||||
$date = date('Ymd', strtotime("-$i days"));
|
||||
$dates[] = $date;
|
||||
}
|
||||
|
||||
$dates = array_reverse($dates);
|
||||
$day_data = [];
|
||||
foreach ($dates as $date) {
|
||||
$list = get_db('user_count', 'e', ['uid' => UID, 'k' => $date, 't' => 'ip_list']);
|
||||
$list = unserialize($list);
|
||||
$day_data[$date] = empty($list) ? [] : $list ;
|
||||
}
|
||||
msgA(['code'=>1,'data'=>$day_data]);
|
||||
}elseif($_GET['type'] == 'menu'){
|
||||
global $global_config;
|
||||
$menu = [];
|
||||
if(check_purview('site_info',1)){
|
||||
array_push($menu,['title'=>'站点设置','href'=>'SiteSetting','icon'=>'fa fa-cog']);
|
||||
}
|
||||
if(check_purview('theme_in',1)){
|
||||
array_push($menu,['title'=>'主题管理','href'=>'theme','icon'=>'fa fa-magic']);
|
||||
}
|
||||
array_push($menu,
|
||||
['title'=>'分类管理','href'=>'category_list','icon'=>'fa fa-list-ul'],
|
||||
['title'=>'加密管理','href'=>'pwd_group','icon'=>'fa fa-lock'],
|
||||
['title'=>'链接管理','icon'=>'fa fa-folder-open-o','href'=>'','child'=>
|
||||
[
|
||||
['title'=>'链接列表','href'=>'link_list','icon'=>'fa fa-link'],
|
||||
['title'=>'添加链接','href'=>'link_add','icon'=>'fa fa-plus-square-o'],
|
||||
['title'=>'书签分享','href'=>'share','icon'=>'fa fa-external-link'],
|
||||
['title'=>'导出导入','href'=>'data_control','icon'=>'fa fa-retweet'],
|
||||
]
|
||||
]);
|
||||
|
||||
//扩展功能
|
||||
$extend = [];
|
||||
if($global_config['apply'] == 1 && check_purview('apply',1)){
|
||||
array_push($extend,['title'=>'收录管理','href'=>'expand/apply-admin','icon'=>'fa fa-pencil']);
|
||||
}
|
||||
if($global_config['guestbook'] == 1 && check_purview('guestbook',1)){
|
||||
array_push($extend,['title'=>'留言管理','href'=>'expand/guestbook-admin','icon'=>'fa fa-commenting-o']);
|
||||
}
|
||||
if($global_config['article'] > 0 && check_purview('article',1)){
|
||||
array_push($extend,['title'=>'文章管理','href'=>'expand/article-list','icon'=>'fa fa-file-text-o']);
|
||||
}
|
||||
if(!empty($extend)){
|
||||
$extend = ['title'=>'扩展功能','icon'=>'fa fa-folder-open-o','href'=>'','child'=> $extend];
|
||||
array_push($menu,$extend);
|
||||
}
|
||||
|
||||
//如果是管理员则追加菜单
|
||||
if($USER_DB['UserGroup'] == 'root'){
|
||||
array_push($menu,
|
||||
['title'=>'网站管理','icon'=>'fa fa-wrench','href'=>'','child'=>
|
||||
[
|
||||
['title'=>'系统设置','href'=>'root/sys_setting','icon'=>'fa fa-gears'],
|
||||
['title'=>'授权管理','href'=>'root/vip','icon'=>'fa fa-diamond'],
|
||||
['title'=>'用户管理','href'=>'root/user_control','icon'=>'fa fa-user'],
|
||||
['title'=>'用户分组','href'=>'root/users_control','icon'=>'fa fa-users'],
|
||||
['title'=>'注册管理','href'=>'root/reg_control','icon'=>'fa fa-user-plus'],
|
||||
['title'=>'站长工具','href'=>'root/tool','icon'=>'fa fa-exclamation-triangle'],
|
||||
]
|
||||
]);
|
||||
}
|
||||
$init = array( 'homeInfo'=>['title'=>'概要','href'=>'home'],'logoInfo'=>['title'=>'TwoNav','image'=>'./templates/admin/img/logo.png','href'=>'./?u='.U],'menuInfo'=>$menu);
|
||||
msgA($init);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1838,7 +2039,63 @@ function write_article(){
|
||||
require DIR . '/system/api_article.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
//百度推送
|
||||
function other_baidu_push(){
|
||||
global $u,$global_config;
|
||||
if ( $global_config['offline'] == '1'){
|
||||
msg(-1,"离线模式无法使用此功能");
|
||||
}
|
||||
if(!is_subscribe('bool')){
|
||||
msg(-1,"未检测到有效授权,无法使用该功能!");
|
||||
}
|
||||
if(empty($_POST['push_api'])){
|
||||
msg(-1,'请输入接口地址');
|
||||
}
|
||||
if(empty($_POST['id'])){
|
||||
msg(-1,'请提交链接ID');
|
||||
}
|
||||
$host = $_SERVER['HTTP_HOST']; // 获取主机名
|
||||
$port = isset($_SERVER['SERVER_PORT']) ? ($_SERVER['SERVER_PORT'] == 80 ? '' : ':'.$_SERVER['SERVER_PORT']) : ''; // 获取端口号
|
||||
$scheme = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https://' : 'http://'; // 获取协议
|
||||
$host = $scheme.$host.$port;
|
||||
$ids = json_decode($_POST['id']) ?? 0;
|
||||
if(count($ids)<1){
|
||||
msg(-1,'解析数据失败,请检查格式是否正确');
|
||||
}
|
||||
$urls=[];
|
||||
if($_POST['type'] == 'link'){
|
||||
foreach($ids as $id){
|
||||
$urls[] = "{$host}/{$u}/click/{$id}.html";
|
||||
}
|
||||
}elseif($_POST['type'] == 'article'){
|
||||
foreach($ids as $id){
|
||||
$urls[] = "{$host}/{$u}/article/{$id}.html";
|
||||
}
|
||||
}else{
|
||||
msg(-1,'无效类型');
|
||||
}
|
||||
|
||||
if(!empty($urls)){
|
||||
$api = $_POST['push_api'];
|
||||
write_user_config('baidu_push_api',$api,'config','百度推送API');
|
||||
$ch = curl_init();
|
||||
$options = array(
|
||||
CURLOPT_URL => $api,
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_POSTFIELDS => implode("\n", $urls),
|
||||
CURLOPT_HTTPHEADER => array('Content-Type: text/plain'),
|
||||
);
|
||||
curl_setopt_array($ch, $options);
|
||||
$result = curl_exec($ch);
|
||||
$result = json_decode($result,true) ?? '';
|
||||
if(empty($result)){
|
||||
msg(-1,'推送失败');
|
||||
}else{
|
||||
msgA(['code'=>curl_getinfo($ch, CURLINFO_HTTP_CODE),'data'=>$result]);
|
||||
}
|
||||
}
|
||||
}
|
||||
//获取链接信息
|
||||
function other_get_link_info(){
|
||||
global $global_config;
|
||||
@@ -1871,3 +2128,17 @@ function other_get_link_info(){
|
||||
$link['description'] = $info['site_description'];
|
||||
msgA(['code'=>1,'data'=>$link]);
|
||||
}
|
||||
|
||||
//POST数据过滤
|
||||
function Post_data_filter($datas){
|
||||
foreach ($datas as $key => $data){
|
||||
if($data['int']){
|
||||
$s[$key] = ($_POST[$key] >= $data['min'] && $_POST[$key] <= $data['max'])?intval($_POST[$key]):msg(-1,$data['msg']);
|
||||
}elseif(isset($data['v'])){
|
||||
$s[$key] = in_array($_POST[$key],$data['v']) ? $_POST[$key]:msg(-1,$data['msg']);
|
||||
}else{
|
||||
$s[$key] = $data['empty']?$_POST[$key]:(!empty($_POST[$key])?$_POST[$key]:msg(-1,$data['msg']));
|
||||
}
|
||||
}
|
||||
return $s;
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
$type = htmlspecialchars(trim($_GET['type']),ENT_QUOTES);
|
||||
|
||||
if (function_exists($type) ) {
|
||||
if($GLOBALS['global_config']['article'] != 1 || !check_purview('article',1)){
|
||||
if($GLOBALS['global_config']['article'] < 1 || !check_purview('article',1)){
|
||||
msg(-1,'无权限');
|
||||
}
|
||||
$type();
|
||||
|
||||
@@ -352,6 +352,25 @@ function write_user_info(){
|
||||
delete_db('global_user',["ID" => $uids]);
|
||||
msg(1,'删除成功');
|
||||
break;
|
||||
//删除OTP验证
|
||||
case "Del_OTP":
|
||||
$uids = json_decode($_POST['ID']);
|
||||
$USER_S = select_db('global_user',['LoginConfig','ID','User'],['ID'=>$uids]);
|
||||
$fail = 0;
|
||||
foreach($USER_S as $USER){
|
||||
$LoginConfig = unserialize($USER['LoginConfig']);
|
||||
if(empty($LoginConfig['totp_key'])){
|
||||
$fail ++;
|
||||
continue;
|
||||
}
|
||||
$LoginConfig['totp_key'] = '';
|
||||
update_db("global_user", ["LoginConfig" => $LoginConfig], ["ID" => $USER['ID']]);
|
||||
}
|
||||
if($fail > 0){
|
||||
msg(1,'操作完毕,有'.$fail.'个账号未开启OTP双重验证');
|
||||
}
|
||||
msg(1,'操作成功');
|
||||
break;
|
||||
//设用户组
|
||||
case "set_UserGroup":
|
||||
if(empty($_POST['UserGroup'])){
|
||||
@@ -555,7 +574,7 @@ function write_sys_settings(){
|
||||
'apply'=>['int'=>true,'min'=>0,'max'=>1,'msg'=>'收录管理参数错误'],
|
||||
'guestbook'=>['int'=>true,'min'=>0,'max'=>1,'msg'=>'留言管理参数错误'],
|
||||
'link_extend'=>['int'=>true,'min'=>0,'max'=>1,'msg'=>'链接扩展参数错误'],
|
||||
'article'=>['int'=>true,'min'=>0,'max'=>1,'msg'=>'文章管理参数错误']
|
||||
'article'=>['int'=>true,'min'=>0,'max'=>2,'msg'=>'文章管理参数错误']
|
||||
];
|
||||
$o_config = [];
|
||||
foreach ($datas as $key => $data){
|
||||
@@ -779,6 +798,12 @@ function other_root(){
|
||||
}
|
||||
|
||||
msg(1,'操作成功');
|
||||
}elseif($_GET['type'] == 'write_sitemap_config'){
|
||||
if(!is_subscribe('bool')){
|
||||
msg(-1,'未检测到有效授权');
|
||||
}
|
||||
write_global_config('sitemap_config',$_POST,'站点地图配置');
|
||||
msg(1,'保存成功');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ $id = intval($_GET['id']);
|
||||
//IP数统计
|
||||
count_ip();
|
||||
//如果id为空,则显示404
|
||||
if(empty($id)){Not_Found();}
|
||||
if(empty($id)) Not_Found();
|
||||
|
||||
//查询链接信息
|
||||
$where['lid'] = $id;
|
||||
@@ -13,18 +13,7 @@ $where['status'] = 1;
|
||||
$link = get_db('user_links','*',$where);
|
||||
|
||||
//查找失败时显示404
|
||||
if(empty($link)){Not_Found();}
|
||||
|
||||
//站点设置和站点图标
|
||||
$site = unserialize(get_db('user_config','v',['uid'=>UID,'k'=>'s_site']));
|
||||
$site['Title'] = $site['title'].(empty($site['subtitle'])?'':' - '.$site['subtitle']);
|
||||
//免费用户请保留版权,谢谢!
|
||||
$copyright = empty($global_config['copyright'])?'<a target="_blank" href="https://gitee.com/tznb/TwoNav">Copyright © TwoNav</a>':$global_config['copyright'];
|
||||
$ICP = empty($global_config['ICP'])?'':'<a target="_blank" href="https://beian.miit.gov.cn">'.$global_config['ICP'].'</a>';
|
||||
$favicon = ( !empty($site['site_icon_file'])) ? $site['site_icon'] : './favicon.ico';
|
||||
|
||||
//取登录状态
|
||||
$is_login = is_login();
|
||||
if(empty($link)) Not_Found();
|
||||
|
||||
//取父分类和祖分类信息
|
||||
$info_c = ['cid','fid','property','status','pid'];
|
||||
@@ -72,7 +61,9 @@ if(!$is_login){
|
||||
$verify_type = 'link_pwd';
|
||||
$password = get_db('user_pwd_group','password',['uid'=>UID,'pid'=>$link['pid']]);
|
||||
if($_SESSION['verify']['link'][$link['lid']] != $password){
|
||||
require DIR.'/templates/admin/other/verify_link_pwd.php';
|
||||
$c = 'verify';
|
||||
require DIR."/system/templates.php";
|
||||
require $index_path;
|
||||
exit();
|
||||
}
|
||||
}
|
||||
@@ -81,7 +72,9 @@ if(!$is_login){
|
||||
$verify_type = 'category_pwd';
|
||||
$password = get_db('user_pwd_group','password',['uid'=>UID,'pid'=>$category_parent['pid']]);
|
||||
if($_SESSION['verify']['category'][$category_parent['cid']] != $password){
|
||||
require DIR.'/templates/admin/other/verify_link_pwd.php';
|
||||
$c = 'verify';
|
||||
require DIR."/system/templates.php";
|
||||
require $index_path;
|
||||
exit();
|
||||
}
|
||||
}
|
||||
@@ -90,39 +83,22 @@ if(!$is_login){
|
||||
$verify_type = 'category_pwd';
|
||||
$password = get_db('user_pwd_group','password',['uid'=>UID,'pid'=>$category_ancestor['pid']]);
|
||||
if($_SESSION['verify']['category'][$category_ancestor['cid']] != $password){
|
||||
require DIR.'/templates/admin/other/verify_link_pwd.php';
|
||||
$c = 'verify';
|
||||
require DIR."/system/templates.php";
|
||||
require $index_path;
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//取模板信息
|
||||
require DIR ."/system/templates.php";
|
||||
$dir_path = DIR.'/templates/transit/'.$s_templates['transit'];
|
||||
$theme_dir = str_replace(DIR.'/templates/transit',"./templates/transit",$dir_path);
|
||||
$transit_path = $dir_path.'/index.php';
|
||||
//检查是否存在,不存在则使用默认
|
||||
if(!is_file($transit_path)){
|
||||
$transit_path= DIR.'/templates/transit/default/index.php';
|
||||
}
|
||||
|
||||
//统计点击数
|
||||
write_user_count(date('Ym'),'click_Ym');
|
||||
write_user_count(date('Ymd'),'click_Ymd');
|
||||
update_db("user_links", ["click[+]"=>1],['uid'=>UID,'lid'=>$id]);
|
||||
|
||||
|
||||
|
||||
//读取用户主题配置
|
||||
$theme_config_db = unserialize(get_db('user_config','v',['t'=>'theme_transit','k'=>$s_templates['transit'],'uid'=>UID]));
|
||||
|
||||
//读取默认主题配置
|
||||
$theme_info = json_decode(@file_get_contents($dir_path.'/info.json'),true);
|
||||
$theme_config = empty($theme_info['config']) ? []:$theme_info['config'];
|
||||
$theme_ver = !Debug?$theme_info['version']:$theme_info['version'].'.'.time();
|
||||
|
||||
//合并配置数据
|
||||
$theme_config = empty($theme_config_db) ? $theme_config : array_merge ($theme_config??[],$theme_config_db??[]);
|
||||
//通用数据初始化
|
||||
require DIR."/system/templates.php";
|
||||
|
||||
//如果主题信息声明支持扩展字段
|
||||
if($global_config['link_extend'] == 1 && check_purview('link_extend',1) && in_array($theme_info['support']['link_extend'],["true","1"])){
|
||||
@@ -154,11 +130,11 @@ if(!empty($link['url_standby'])) {
|
||||
if(in_array(intval($code),[200,301,302,401]) ){
|
||||
$site['link_model'] = $site['link_model'] == 'direct' ? '302' : $site['link_model'];
|
||||
}else{
|
||||
require $transit_path;
|
||||
require $index_path;
|
||||
exit;
|
||||
}
|
||||
}else{
|
||||
require $transit_path;
|
||||
require $index_path;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -185,11 +161,6 @@ if ($site['link_model'] == '302'){ //302重定向(临时)
|
||||
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;
|
||||
}else{ //Transition 过渡页
|
||||
require $transit_path;
|
||||
require $index_path;
|
||||
exit;
|
||||
}
|
||||
|
||||
//返回404
|
||||
function Not_Found() {
|
||||
header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,8 @@ if ( $apply['apply'] == 0 ){
|
||||
}
|
||||
//get请求载入页面
|
||||
if($_SERVER['REQUEST_METHOD'] === 'GET'){
|
||||
require DIR.'/templates/admin/page/expand/apply-user.php';
|
||||
require DIR."/system/templates.php";
|
||||
require($index_path);
|
||||
exit;
|
||||
}
|
||||
//载入提示页
|
||||
|
||||
@@ -1,65 +1,28 @@
|
||||
<?php if(!defined('DIR')){Not_Found();}AccessControl();
|
||||
if($global_config['article'] == 0 | !check_purview('article',1)){
|
||||
Not_Found();
|
||||
}
|
||||
|
||||
$id = intval($_GET['id']);
|
||||
//判断全局开关和用户权限
|
||||
if($global_config['article'] < 1 || !check_purview('article',1)) Not_Found();
|
||||
|
||||
//IP数统计
|
||||
count_ip();
|
||||
//如果id为空,则显示404
|
||||
if(empty($id)){Not_Found();}
|
||||
|
||||
//查询文章
|
||||
$where['uid'] = UID;
|
||||
if(!is_login()){
|
||||
$where['state'] = 1; //状态筛选
|
||||
}
|
||||
$where['id'] = $id;
|
||||
$data = get_db('user_article_list','*',$where);
|
||||
//取GET参数中的id
|
||||
$id = intval($_GET['id']);
|
||||
|
||||
//如果id为空,则显示404
|
||||
if(empty($id)) Not_Found();
|
||||
|
||||
//通用数据初始化
|
||||
require DIR."/system/templates.php";
|
||||
|
||||
//读取文章内容
|
||||
$data = get_article_content($id);
|
||||
|
||||
//查找失败时显示404
|
||||
if(empty($data)){Not_Found();}
|
||||
|
||||
//var_dump($data);
|
||||
//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'];
|
||||
$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";
|
||||
$dir_path = DIR.'/templates/article/'.$s_templates['article'];
|
||||
$theme_dir = str_replace(DIR.'/templates/article',"./templates/article",$dir_path);
|
||||
$path = $dir_path.'/index.php';
|
||||
//检查是否存在,不存在则使用默认
|
||||
if(!is_file($path)){
|
||||
$path= DIR.'/templates/article/default/index.php';
|
||||
$theme_dir = './templates/article/default';
|
||||
}
|
||||
if(empty($data)) Not_Found();
|
||||
|
||||
//统计点击数
|
||||
update_db("user_article_list", ["browse_count[+]"=>1],['uid'=>UID,'id'=>$id]);
|
||||
|
||||
//读取用户主题配置
|
||||
$theme_config_db = unserialize(get_db('user_config','v',['t'=>'theme_article','k'=>$s_templates['article'],'uid'=>UID]));
|
||||
|
||||
//读取默认主题配置
|
||||
$theme_info = json_decode(@file_get_contents($theme_dir.'/info.json'),true);
|
||||
$theme_config = empty($theme_info['config']) ? []:$theme_info['config'];
|
||||
$theme_ver = !Debug?$theme_info['version']:$theme_info['version'].'.'.time();
|
||||
|
||||
//合并配置数据
|
||||
$theme_config = empty($theme_config_db) ? $theme_config : array_merge ($theme_config??[],$theme_config_db??[]);
|
||||
|
||||
require $path;
|
||||
exit;
|
||||
|
||||
//返回404
|
||||
function Not_Found() {
|
||||
header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit;
|
||||
}
|
||||
//载入模板
|
||||
require $index_path;
|
||||
|
||||
@@ -16,23 +16,23 @@ if(!Check_Path("data/user/{$u}/MessageBoard")){
|
||||
|
||||
//POST提交留言
|
||||
if($_SERVER['REQUEST_METHOD'] === 'POST'){
|
||||
if($s['allow'] != '1'){ msg(-1015,'提交失败,当前禁止留言!'); }
|
||||
if($s['allow'] != '1'){ msg(-1,'提交失败,当前禁止留言!'); }
|
||||
$type = $_POST['type']; //类型
|
||||
$contact = $_POST['contact']; //联系方式
|
||||
$title = $_POST['title']; //标题
|
||||
$content = $_POST['content']; //内容
|
||||
if(empty($type)){
|
||||
msg(-1015,'提交失败,类型不能为空');
|
||||
msg(-1,'提交失败,类型不能为空');
|
||||
}elseif(empty($contact)){
|
||||
msg(-1015,'提交失败,联系方式不能为空');
|
||||
msg(-1,'提交失败,联系方式不能为空');
|
||||
}elseif(empty($title)){
|
||||
msg(-1015,'提交失败,标题不能为空');
|
||||
msg(-1,'提交失败,标题不能为空');
|
||||
}elseif(empty($content)){
|
||||
msg(-1015,'提交失败,内容不能为空');
|
||||
msg(-1,'提交失败,内容不能为空');
|
||||
}elseif(strlen($type) >= 32 || strlen($contact) >= 64 || strlen($title) >= 128 || strlen($content) >= 2048){
|
||||
msg(-1015,'提交失败,长度超限');
|
||||
msg(-1,'提交失败,长度超限');
|
||||
}elseif(ShuLiang("data/user/{$u}/MessageBoard/") > 256){
|
||||
msg(-1015,'提交失败,留言太多了请稍后再试');
|
||||
msg(-1,'提交失败,留言太多了请稍后再试');
|
||||
}
|
||||
|
||||
$json_arr = array(
|
||||
@@ -48,9 +48,9 @@ if($_SERVER['REQUEST_METHOD'] === 'POST'){
|
||||
$json = json_encode($json_arr);
|
||||
$path = "data/user/{$u}/MessageBoard/".time().'_'.crc32($json).'.json';
|
||||
if( Check_Path("data/user/{$u}/MessageBoard") && file_put_contents($path, $json)){
|
||||
msg(0,'提交成功');
|
||||
msg(1,'提交成功');
|
||||
}else{
|
||||
msg(-1015,'系统错误,提交失败'); //创建目录或写入文件失败,请检查权限
|
||||
msg(-1,'系统错误,提交失败'); //创建目录或写入文件失败,请检查权限
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,5 +67,8 @@ function ShuLiang($path){
|
||||
}
|
||||
return $sl;
|
||||
}
|
||||
require DIR.'/templates/admin/page/expand/guestbook-user.php';
|
||||
|
||||
//通用数据初始化
|
||||
require DIR."/system/templates.php";
|
||||
require $index_path;
|
||||
exit;
|
||||
46
system/expand/sitemap.php
Normal file
46
system/expand/sitemap.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
if(!is_subscribe('bool')){exit;}
|
||||
|
||||
//设置协议头
|
||||
header('Content-Type: application/xml');
|
||||
|
||||
//读取配置
|
||||
$sitemap_config = unserialize( get_db("global_config", "v", ["k" => "sitemap_config"]));
|
||||
|
||||
//储存路径
|
||||
$sitemap_path = DIR . "/data/user/{$u}/sitemap.php";
|
||||
|
||||
//载入生成脚本
|
||||
require 'sitemap_create.php';
|
||||
|
||||
//是否为手动生成
|
||||
if(!empty($_GET['mode'])){
|
||||
if($sitemap_config['switch'] != '1'){
|
||||
msg(-1,'请将功能开关设为开启并保存');
|
||||
}else{
|
||||
create_sitemap($sitemap_config,$sitemap_path,$u);
|
||||
msg(1,'生成完毕');
|
||||
}
|
||||
}else{
|
||||
//未开启被动请求时,如果有缓存文件则返回
|
||||
if($sitemap_config['beidong'] != '1'){
|
||||
if(file_exists($sitemap_path)){
|
||||
exit(file_get_contents($sitemap_path) ?? '');
|
||||
}
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
//未开启功能时不输出任何数据
|
||||
if($sitemap_config['switch'] != '1'){
|
||||
exit;
|
||||
}
|
||||
|
||||
//判断是否需要更新
|
||||
if(is_Update_Sitemap($sitemap_config,$sitemap_path)){
|
||||
exit (create_sitemap($sitemap_config,$sitemap_path,$u));
|
||||
}else{
|
||||
exit(file_get_contents($sitemap_path) ?? '');
|
||||
}
|
||||
|
||||
?>
|
||||
134
system/expand/sitemap_create.php
Normal file
134
system/expand/sitemap_create.php
Normal file
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
//判断是否需要更新缓存
|
||||
function is_Update_Sitemap($sitemap_config,$sitemap_path){
|
||||
if (file_exists($sitemap_path)) {
|
||||
$up_time = filemtime($sitemap_path);
|
||||
$timeIntervals = [
|
||||
'monthly' => 30 * 24 * 60 * 60, // 30天
|
||||
'weekly' => 7 * 24 * 60 * 60, // 7天
|
||||
'daily' => 24 * 60 * 60, // 1天
|
||||
'hourly' => 60 * 60, // 1小时
|
||||
'minute' => 60, //1分钟
|
||||
'second' => 1 //1秒
|
||||
];
|
||||
|
||||
$interval_seconds = $timeIntervals[$sitemap_config['changefreq']] ?? 86400; //间隔秒
|
||||
if (time() - $up_time >= $interval_seconds){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
//缓存文件不存在时重新创建地图
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//创建地图数据函数
|
||||
function create_sitemap($sitemap_config,$sitemap_path,$u){
|
||||
//创建一个空的 XML 文档
|
||||
$xml = new DOMDocument('1.0', 'UTF-8');
|
||||
$xml->formatOutput = true;
|
||||
//创建根元素
|
||||
$urlset = $xml->createElement('urlset');
|
||||
$urlset->setAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');
|
||||
$xml->appendChild($urlset);
|
||||
//今天
|
||||
$today = date("Y-m-d\TH:i:s", time());
|
||||
//域名
|
||||
$host = $_SERVER['HTTP_HOST']; // 获取主机名
|
||||
$port = isset($_SERVER['SERVER_PORT']) ? ($_SERVER['SERVER_PORT'] == 80 ? '' : ':'.$_SERVER['SERVER_PORT']) : ''; // 获取端口号
|
||||
$scheme = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https://' : 'http://'; // 获取协议
|
||||
$host = $scheme.$host.$port;
|
||||
//用户主页 0.关闭 1.动态地址 2.静态地址 3.二级域名
|
||||
if($sitemap_config['user_homepage'] > 0){
|
||||
//读取用户列表
|
||||
$user_list = select_db('global_user','User','');
|
||||
if($sitemap_config['user_homepage'] == '3'){
|
||||
$strings = explode('.',$_SERVER['HTTP_HOST']);
|
||||
if(count($strings) == 3){
|
||||
$root_domain = "{$strings[1]}.{$strings[2]}";
|
||||
}elseif(count($strings) == 2){
|
||||
$root_domain = $_SERVER['HTTP_HOST'];
|
||||
}else{
|
||||
$sitemap_config['user_homepage'] == '1';
|
||||
}
|
||||
}
|
||||
//遍历用户列表
|
||||
foreach($user_list as $user){
|
||||
if($sitemap_config['user_homepage'] == '2'){
|
||||
$locurl = "{$host}/{$user}.html";
|
||||
}elseif($sitemap_config['user_homepage'] == '3'){
|
||||
$locurl = "{$scheme}{$user}.{$root_domain}";
|
||||
}else{
|
||||
$locurl = "{$host}/index.php?u={$user}";
|
||||
}
|
||||
//生成数据
|
||||
$url = createUrlElement($xml, $locurl, $today, $sitemap_config['user_homepage_changefreq'], $sitemap_config['user_homepage_weight']);
|
||||
$urlset->appendChild($url);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//过度页面 0.关闭 1.动态 2.静态
|
||||
if($sitemap_config['click_page'] > 0){
|
||||
$category_parent = []; //父分类
|
||||
$categorys = []; //全部分类
|
||||
//查找条件 - 分类
|
||||
$where['uid'] = UID;
|
||||
$where['fid'] = 0;
|
||||
$where['pid'] = 0;
|
||||
$where['status'] = 1;
|
||||
$where['ORDER'] = ['weight'=>'ASC'];
|
||||
$where['property'] = 0;
|
||||
//查找一级分类
|
||||
$category_parent = select_db('user_categorys','cid',$where);
|
||||
//遍历二级分类
|
||||
foreach ($category_parent as $cid) {
|
||||
$where['fid'] = $cid;
|
||||
$category_subitem = select_db('user_categorys','cid',$where);
|
||||
array_push($categorys,$cid);
|
||||
$categorys = array_merge ($categorys,$category_subitem);
|
||||
}
|
||||
|
||||
//遍历链接
|
||||
foreach ($categorys as $cid) {
|
||||
$where['fid'] = $cid;
|
||||
$links = select_db('user_links',['lid','up_time'],$where);
|
||||
foreach ($links as $link) {
|
||||
if($sitemap_config['click_page'] == '2'){
|
||||
$locurl = "{$host}/{$u}/click/{$link['lid']}.html";
|
||||
}else{
|
||||
$locurl = "{$host}/index.php?c=click&id={$link['lid']}&u={$u}";
|
||||
}
|
||||
$url = createUrlElement($xml, $locurl, date("Y-m-d\TH:i:s", $link['up_time']), $sitemap_config['click_page_changefreq'], $sitemap_config['click_page_weight']);
|
||||
$urlset->appendChild($url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//保存 XML 内容到文件
|
||||
$xml->save($sitemap_path);
|
||||
|
||||
//返回内容
|
||||
return $xml->saveXML();
|
||||
}
|
||||
|
||||
// 生成URL元素
|
||||
function createUrlElement($xml, $loc, $lastmod, $changefreq, $priority) {
|
||||
$url = $xml->createElement('url');
|
||||
|
||||
$locElem = $xml->createElement('loc', htmlspecialchars($loc));
|
||||
$url->appendChild($locElem);
|
||||
|
||||
$lastmodElem = $xml->createElement('lastmod', $lastmod);
|
||||
$url->appendChild($lastmodElem);
|
||||
|
||||
$changefreqElem = $xml->createElement('changefreq', $changefreq);
|
||||
$url->appendChild($changefreqElem);
|
||||
|
||||
$priorityElem = $xml->createElement('priority', $priority);
|
||||
$url->appendChild($priorityElem);
|
||||
|
||||
return $url;
|
||||
}
|
||||
168
system/index.php
168
system/index.php
@@ -1,6 +1,60 @@
|
||||
<?php if(!defined('DIR')){header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit;}AccessControl();
|
||||
//主页入口
|
||||
define('is_login',is_login());
|
||||
|
||||
//是否载入引导页
|
||||
if(@$global_config['default_page'] == 2){
|
||||
if(empty(Get('u')) && empty($_COOKIE['Default_User'])){
|
||||
$c = 'guide';
|
||||
require DIR."/system/templates.php";
|
||||
require $index_path;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
//书签分享
|
||||
$share = Get('share');
|
||||
if(!empty($share)){
|
||||
$share = get_db('user_share','*',['uid'=>UID,'sid'=>$share]);
|
||||
if(empty($share)){
|
||||
$content = '分享已被删除,请联系作者!';
|
||||
require DIR.'/templates/admin/page/404.php';
|
||||
exit;
|
||||
}
|
||||
//判断是否过期
|
||||
if(time() > $share['expire_time']){
|
||||
$content = '分享已过期,请联系作者!';
|
||||
require DIR.'/templates/admin/page/404.php';;
|
||||
exit;
|
||||
}
|
||||
//判断是否加密
|
||||
if(!empty($share['pwd']) && !is_login()){
|
||||
session_start();
|
||||
if($_SESSION['verify']['share'][$share['id']] != $share['pwd']){
|
||||
$c = 'verify';$_GET['c'] = 'share';
|
||||
require DIR."/system/templates.php";
|
||||
require $index_path;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$data = json_decode($share['data']);
|
||||
//判断分享类型(1.分类 2.链接)
|
||||
if($share['type'] == 1){
|
||||
$where['cid'] = $data;
|
||||
if($share['pv'] == 1){
|
||||
unset($where['property']);
|
||||
}
|
||||
}else if($share['type'] == 2){
|
||||
$category_parent = [['name' => $share['name'] ,"font_icon" =>"fa fa-bookmark-o" , "id" => 'share' ,"description" => "书签分享"]];
|
||||
$categorys = $category_parent;
|
||||
}
|
||||
|
||||
//浏览计次
|
||||
update_db("user_share", ["views[+]"=>1],['uid'=>UID,'id'=>$share['id']]);
|
||||
}
|
||||
|
||||
|
||||
//通用数据初始化
|
||||
require DIR."/system/templates.php";
|
||||
|
||||
//判断用户组,是否允许未登录时访问主页
|
||||
if(!is_login && ($global_config['Privacy'] == 1 || !check_purview('Common_home',1))){
|
||||
@@ -8,73 +62,10 @@ if(!is_login && ($global_config['Privacy'] == 1 || !check_purview('Common_home',
|
||||
header("Location: ./?c=admin&u=".U);
|
||||
exit;
|
||||
}
|
||||
//载入站点设置
|
||||
$site = unserialize(get_db('user_config','v',['uid'=>UID,'k'=>'s_site']));
|
||||
//如果没有权限则清除自定义代码
|
||||
if(!check_purview('header',1)){$site['custom_header'] = '';}
|
||||
if(!check_purview('footer',1)){$site['custom_footer'] = '';}
|
||||
|
||||
$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';
|
||||
//例外主题,不支持热门网址/最新网址/输出上限
|
||||
$site['ex_theme'] = in_array($theme,['snail-nav','heimdall']);
|
||||
|
||||
//读取默认模板信息
|
||||
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) && check_purview('theme_in',1)){
|
||||
$dir_path = DIR.'/templates/home/'.$theme;
|
||||
$index_path = $dir_path.'/index.php';
|
||||
}else{
|
||||
$is_Pad = preg_match('/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i',$_SERVER['HTTP_USER_AGENT']);
|
||||
$theme = $is_Pad?$s_templates['home_pad']:$s_templates['home_pc'];
|
||||
$dir_path = DIR.'/templates/home/'.$theme;
|
||||
$index_path = $dir_path.'/index.php';
|
||||
}
|
||||
//检查是否存在,不存在则使用默认
|
||||
if(!is_file($index_path)){
|
||||
$dir_path= DIR.'/templates/home/default';
|
||||
$index_path = $dir_path.'/index.php';
|
||||
}
|
||||
//相对路径
|
||||
$theme_dir = str_replace(DIR.'/templates/home',"./templates/home",$dir_path);
|
||||
//主题信息
|
||||
$theme_info = json_decode(@file_get_contents($dir_path.'/info.json'),true);
|
||||
//支持属性
|
||||
$support_subitem = $theme_info['support']['subitem']??0; //0.不支持子分类 1.分类栏支持 2.链接栏支持 3.都支持
|
||||
$support_category_svg = $theme_info['support']['category_svg']??0; //0.不支持 1.支持
|
||||
//主题配置(默认)
|
||||
$theme_config = empty($theme_info['config']) ? []:$theme_info['config'];
|
||||
//主题配置(用户)
|
||||
$theme_config_db = get_db('user_config','v',['t'=>'theme_home','k'=>$theme,'uid'=>UID]);
|
||||
$theme_config_db = unserialize($theme_config_db);
|
||||
//合并配置数据
|
||||
$theme_config = empty($theme_config_db) ? $theme_config : array_merge ($theme_config,$theme_config_db);
|
||||
//主题版本(调试时追加时间戳)
|
||||
$theme_ver = !Debug?$theme_info['version']:$theme_info['version'].'.'.time();
|
||||
$site['ex_theme'] = in_array($theme,['snail-nav','heimdall']); //例外主题,不支持热门网址/最新网址/输出上限
|
||||
//分类查找条件
|
||||
$categorys = []; //声明一个空数组
|
||||
$content = ['cid(id)','fid','name','property','font_icon','icon','description'];//需要的内容
|
||||
@@ -129,7 +120,6 @@ function get_links($fid) {
|
||||
$where['ORDER']['lid'] = 'ASC';
|
||||
if(!is_login){
|
||||
$where['property'] = 0;
|
||||
|
||||
}
|
||||
//书签分享>私有可见
|
||||
if(isset($share['pv']) && $share['pv'] == 1){
|
||||
@@ -220,7 +210,7 @@ function get_links($fid) {
|
||||
}else{ //首字
|
||||
$icon = './system/ico.php?text='.mb_strtoupper(mb_substr($article['title'], 0, 1));
|
||||
}
|
||||
$article_link = ['type'=>'article','id'=>0,'title'=>$article['title'],'url'=>$url,'real_url'=>$url,'description'=>$article['summary'],'ico'=>$icon,'icon'=>$icon];
|
||||
$article_link = ['type'=>'article','id'=>0,'title'=>htmlspecialchars($article['title'],ENT_QUOTES),'url'=>$url,'real_url'=>$url,'description'=> htmlspecialchars($article['summary'],ENT_QUOTES),'ico'=>$icon,'icon'=>$icon];
|
||||
//判断靠前还是靠后
|
||||
if($site['article_visual'] == '1'){
|
||||
array_unshift($links,$article_link);
|
||||
@@ -240,45 +230,7 @@ function get_links($fid) {
|
||||
return $links;
|
||||
}
|
||||
|
||||
//书签分享
|
||||
$share = Get('share');
|
||||
if(!empty($share)){
|
||||
$share = get_db('user_share','*',['uid'=>UID,'sid'=>$share]);
|
||||
if(empty($share)){
|
||||
$content = '分享已被删除,请联系作者!';
|
||||
require DIR.'/templates/admin/page/404.php';
|
||||
exit;
|
||||
}
|
||||
//判断是否过期
|
||||
if(time() > $share['expire_time']){
|
||||
$content = '分享已过期,请联系作者!';
|
||||
require DIR.'/templates/admin/page/404.php';;
|
||||
exit;
|
||||
}
|
||||
//判断是否加密
|
||||
if(!empty($share['pwd']) && !is_login){
|
||||
session_start();
|
||||
if($_SESSION['verify']['share'][$share['id']] != $share['pwd']){
|
||||
require DIR.'/templates/admin/other/verify_share_pwd.php';
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$data = json_decode($share['data']);
|
||||
//判断分享类型(1.分类 2.链接)
|
||||
if($share['type'] == 1){
|
||||
$where['cid'] = $data;
|
||||
if($share['pv'] == 1){
|
||||
unset($where['property']);
|
||||
}
|
||||
}else if($share['type'] == 2){
|
||||
$category_parent = [['name' => $share['name'] ,"font_icon" =>"fa fa-bookmark-o" , "id" => 'share' ,"description" => "书签分享"]];
|
||||
$categorys = $category_parent;
|
||||
}
|
||||
|
||||
//浏览计次
|
||||
update_db("user_share", ["views[+]"=>1],['uid'=>UID,'id'=>$share['id']]);
|
||||
}
|
||||
|
||||
|
||||
//如果为空则查找分类
|
||||
if($category_parent == []){
|
||||
|
||||
@@ -161,7 +161,8 @@ $db_config = array(
|
||||
'port' => $_POST['db_port'],
|
||||
'database' => $_POST['db_name'],
|
||||
'username' => $_POST['db_user'],
|
||||
'password' => $_POST['db_password']
|
||||
'password' => $_POST['db_password'],
|
||||
'charset' => 'utf8mb4'
|
||||
]);
|
||||
|
||||
//判断版本,目前基于5.6.50开发,其他版本兼容性未知,若您需要强制安装请屏蔽检测
|
||||
@@ -287,8 +288,8 @@ function Write_Config(){
|
||||
$o_config['RegOption'] = '0'; //注册配置
|
||||
$o_config['Libs'] = './static'; //静态库路径
|
||||
$o_config['Default_User'] = $_POST['User']; //默认用户
|
||||
$o_config['XSS_WAF'] = '1'; //防XSS脚本
|
||||
$o_config['SQL_WAF'] = '1'; //防SQL注入
|
||||
$o_config['XSS_WAF'] = '0'; //防XSS脚本
|
||||
$o_config['SQL_WAF'] = '0'; //防SQL注入
|
||||
$o_config['offline'] = '0'; //离线模式
|
||||
$o_config['Debug'] = '0'; //调试模式
|
||||
$o_config['Maintenance'] = '0'; //维护模式
|
||||
|
||||
@@ -2,15 +2,8 @@
|
||||
|
||||
//如果是Get请求则载入登录模板
|
||||
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'];
|
||||
$ICP = empty($global_config['ICP'])?'':'<a target="_blank" href="https://beian.miit.gov.cn">'.$global_config['ICP'].'</a>';
|
||||
//检查是否存在,不存在则使用默认
|
||||
if(!is_file($t_path)){
|
||||
$t_path = DIR.'/templates/login/default/index.php';
|
||||
}
|
||||
require $t_path;
|
||||
require DIR."/system/templates.php";
|
||||
require $index_path;
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
@@ -713,10 +713,10 @@ function send_email($config){
|
||||
$mail->SMTPSecure = $config['secure'];
|
||||
$mail->Port = intval($config['port']);
|
||||
|
||||
if(preg_match('/(.+)<(.+)>/', $config['sender'], $match)){
|
||||
if(preg_match('/(.+)<(.+@.+)>$/', $config['sender'], $match)){
|
||||
$mail->setFrom($match[2],$match[1]);
|
||||
}else{
|
||||
$mail->setFrom($config['sender']);
|
||||
$mail->setFrom($config['user'],empty($config['sender'])?'TwoNav':$config['sender']);
|
||||
}
|
||||
|
||||
$mail->addAddress($config['addressee']); //收件人
|
||||
|
||||
@@ -3,99 +3,195 @@
|
||||
//读取全局模板配置
|
||||
$global_templates = unserialize(get_db("global_config",'v', ["k" => "s_templates"]));
|
||||
|
||||
//读取用户模板配置
|
||||
$s_templates = unserialize(get_db("user_config", "v", ["uid"=>UID,"k"=>"s_templates"]));
|
||||
|
||||
//没找到用户模板配置
|
||||
if(empty($s_templates)){
|
||||
//将全局默认模板配置写到用户配置
|
||||
$s_templates = $global_templates;
|
||||
insert_db("user_config", ["uid" => UID,"k"=>"s_templates","v"=>$global_templates,"t"=>"config","d" => '默认模板']);
|
||||
if(defined('UID')){
|
||||
//读取用户模板配置
|
||||
$s_templates = unserialize(get_db("user_config", "v", ["uid"=>UID,"k"=>"s_templates"]));
|
||||
//没找到用户模板配置
|
||||
if(empty($s_templates)){
|
||||
$s_templates = $global_templates;
|
||||
insert_db("user_config", ["uid" => UID,"k"=>"s_templates","v"=>$global_templates,"t"=>"config","d" => '默认模板']);
|
||||
}
|
||||
}
|
||||
|
||||
//载入辅助函数
|
||||
if(empty($c) || in_array($c,['index','click','article'])){
|
||||
//将URL转换为base64编码
|
||||
function base64($url){
|
||||
$urls = parse_url($url);
|
||||
$scheme = empty( $urls['scheme'] ) ? 'http://' : $urls['scheme'].'://'; //获取请求协议
|
||||
$host = $urls['host']; //获取主机名
|
||||
$port = empty( $urls['port'] ) ? '' : ':'.$urls['port']; //获取端口
|
||||
$new_url = $scheme.$host.$port;
|
||||
return base64_encode($new_url);
|
||||
//根据请求来读取模板名
|
||||
if($c == 'index'){
|
||||
$theme = trim(@$_GET['theme']); //主题预览
|
||||
if (empty($theme)){
|
||||
$is_Pad = preg_match('/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i',$_SERVER['HTTP_USER_AGENT']);
|
||||
$theme = $is_Pad ? $s_templates['home_pad'] : $s_templates['home_pc'];
|
||||
}
|
||||
//是否启用收录
|
||||
function is_apply(){
|
||||
global $global_config;
|
||||
$apply_user = unserialize( get_db("user_config", "v", ["k" => "apply","uid"=>UID]));
|
||||
return ($global_config['apply'] == 1 && $apply_user['apply'] == 1);
|
||||
}
|
||||
//是否启用留言
|
||||
function is_guestbook(){
|
||||
global $global_config;
|
||||
$guestbook_user = unserialize( get_db("user_config", "v", ["k" => "guestbook","uid"=>UID]) );
|
||||
return ($global_config['guestbook'] == 1 && $guestbook_user['allow'] == 1);
|
||||
|
||||
}
|
||||
//获取图标URL
|
||||
function geticourl($icon,$link){
|
||||
if( !empty( $link['icon']) ){
|
||||
if(substr($link['icon'], 0,4) == '<svg'){
|
||||
return('data:image/svg+xml;base64,'.base64_encode($link['icon']));
|
||||
}else{
|
||||
return($link['icon']);
|
||||
}
|
||||
}
|
||||
if ($site['link_icon'] == 'default'){
|
||||
return($GLOBALS['libs'].'/Other/default.ico');
|
||||
}elseif ($icon ==20){
|
||||
return('./index.php?c=icon&url='.base64_encode($link['real_url']));
|
||||
}elseif ($icon ==21){
|
||||
return('./ico/'.base64_encode($link['real_url']));
|
||||
}elseif($icon ==2){
|
||||
return('//favicon.png.pub/v1/'.base64($link['real_url']));
|
||||
}elseif($icon ==4){
|
||||
return('//api.15777.cn/get.php?url='.$link['real_url']);
|
||||
}elseif($icon ==5){
|
||||
return('//favicon.cccyun.cc/'.$link['real_url']);
|
||||
}elseif($icon ==6){
|
||||
return('//api.iowen.cn/favicon/'.parse_url($link['real_url'])['host'].'.png');
|
||||
}elseif($icon ==7){
|
||||
return('https://toolb.cn/favicon/'.parse_url($link['real_url'])['host']);
|
||||
}elseif($icon ==8){
|
||||
return('https://apis.jxcxin.cn/api/Favicon?url='.$link['real_url']);
|
||||
}elseif($icon ==0){
|
||||
return('./system/ico.php?text='.mb_strtoupper(mb_substr($link['title'], 0, 1)));
|
||||
}else{
|
||||
return('./favicon/index2.php?url='.$link['real_url']);
|
||||
}//如果参数错误则使用本地服务器
|
||||
}
|
||||
//取分类图标(六零系主题在用)
|
||||
function get_category($content){ //抽风的命名..过度几个版本后删除
|
||||
return get_category_icon($content);
|
||||
}
|
||||
function get_category_icon($content){
|
||||
if(empty($content)){
|
||||
return '';
|
||||
}
|
||||
if(substr($content, 0,4) == '<svg'){
|
||||
return 'data:image/svg+xml;base64,'.base64_encode($content);
|
||||
}else{
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
//获取公开分类(返回数组cid)
|
||||
function get_open_category(){
|
||||
$where['uid'] = UID;
|
||||
$where['fid'] = 0;
|
||||
$where['status'] = 1;
|
||||
$where['property'] = 0;
|
||||
$categorys = select_db('user_categorys','cid',$where);
|
||||
$where['fid'] = $categorys;
|
||||
$categorys = array_merge ($categorys,select_db('user_categorys','cid',$where));
|
||||
return $categorys;
|
||||
$dir_path = DIR.'/templates/home';
|
||||
}elseif($c == 'click'){ //过渡
|
||||
$theme = $s_templates['transit'];
|
||||
$dir_path = DIR.'/templates/transit';
|
||||
}elseif($c == 'verify'){ //验证
|
||||
if($_GET['c'] == 'click'){
|
||||
$data['title'] = $link['title'];
|
||||
$data['tip'] = '查看加密链接';
|
||||
$data['input_tip'] = '请输入密码';
|
||||
$data['post_url'] = "./index.php?c=verify&type=link_pwd&u={$u}&id={$_GET['id']}";
|
||||
$config = unserialize(get_db("user_config", "v", ["k" => "s_verify_page","uid"=>$USER_DB['ID']]));
|
||||
$data['get_tip'] = $config['link_tip'];
|
||||
}elseif($_GET['c'] == 'share'){
|
||||
$data['title'] = $share['name'];
|
||||
$data['tip'] = '查看分享书签';
|
||||
$data['input_tip'] = '请输入提取码';
|
||||
$data['post_url'] = "./index.php?c=verify&type=share_pwd&u={$u}&share={$_GET['share']}";
|
||||
$config = unserialize(get_db("user_config", "v", ["k" => "s_verify_page","uid"=>$USER_DB['ID']]));
|
||||
$data['get_tip'] = $config['share_tip'];
|
||||
}elseif($_GET['c'] == 'pwd2'){
|
||||
$data['title'] = '验证二级密码';
|
||||
$data['tip'] = '验证二级密码';
|
||||
$data['input_tip'] = '请输入二级密码';
|
||||
$data['post_url'] = "./index.php?c=verify&type=pwd2&u={$u}";
|
||||
}
|
||||
$theme = $s_templates['verify'];
|
||||
$dir_path = DIR.'/templates/verify';
|
||||
}elseif($c == 'article'){ //文章
|
||||
$theme = $s_templates['article'];
|
||||
$dir_path = DIR.'/templates/article';
|
||||
}elseif($c == 'guestbook'){ //留言
|
||||
$theme = $s_templates['guestbook'];
|
||||
$dir_path = DIR.'/templates/guestbook';
|
||||
}elseif($c == 'apply'){ //收录
|
||||
$theme = $s_templates['apply'];
|
||||
$dir_path = DIR.'/templates/apply/';
|
||||
}elseif($c == $global_config['Login'] || $c == $USER_DB['Login']){ //登录
|
||||
$theme = $s_templates['login'];
|
||||
$dir_path = DIR.'/templates/login';
|
||||
}elseif($c == $global_config["Register"] ){ //注册
|
||||
$theme = $global_templates['register'];
|
||||
$dir_path = DIR.'/templates/register';
|
||||
}elseif($c == 'guide'){ //引导页,由主页修改$c
|
||||
$theme = $global_templates['guide'];
|
||||
$dir_path = DIR.'/templates/guide';
|
||||
}
|
||||
|
||||
//模板类型(用于读取配置)
|
||||
$templates_type = substr($dir_path, strrpos($dir_path, "/") + 1) ;
|
||||
|
||||
//无权限或不存在使用默认
|
||||
if( !check_purview('theme_in',1) || !is_file("{$dir_path}/{$theme}/index.php")){
|
||||
$theme = 'default';
|
||||
$dir_path .= '/default';
|
||||
$index_path = $dir_path.'/index.php';
|
||||
}else{
|
||||
$dir_path .= '/'.$theme;
|
||||
$index_path = $dir_path.'/index.php';
|
||||
}
|
||||
|
||||
//相对路径
|
||||
$theme_dir = str_replace(DIR,'.',$dir_path);
|
||||
//主题信息
|
||||
$theme_info = json_decode(@file_get_contents($dir_path.'/info.json'),true);
|
||||
//主题配置(默认)
|
||||
$theme_config = empty($theme_info['config']) ? []:$theme_info['config'];
|
||||
|
||||
|
||||
if(defined('UID')){
|
||||
//主题配置(用户)
|
||||
$theme_config_db = get_db('user_config','v',['t'=>"theme_{$templates_type}",'k'=>$theme,'uid'=>UID]);
|
||||
$theme_config_db = unserialize($theme_config_db);
|
||||
}else{
|
||||
//主题配置(用户)
|
||||
$theme_config_db = get_db('global_config','v',['t'=>"theme_{$templates_type}",'k'=>$theme]);
|
||||
$theme_config_db = unserialize($theme_config_db);
|
||||
}
|
||||
|
||||
//合并配置数据
|
||||
$theme_config = empty($theme_config_db) ? $theme_config : array_merge ($theme_config,$theme_config_db);
|
||||
//主题版本
|
||||
$theme_ver = Debug ? "{$theme_info['version']}.".time() : $theme_info['version'];
|
||||
|
||||
if(defined('UID')){
|
||||
//载入站点设置
|
||||
$site = unserialize(get_db('user_config','v',['uid'=>UID,'k'=>'s_site']));
|
||||
//如果没有权限则清除自定义代码
|
||||
if(!check_purview('header',1)){$site['custom_header'] = '';}
|
||||
if(!check_purview('footer',1)){$site['custom_footer'] = '';}
|
||||
|
||||
//主页标题( 主标题 - 副标题 )
|
||||
$site['Title'] = $site['title'].(empty($site['subtitle'])?'':' - '.$site['subtitle']);
|
||||
|
||||
//站点图标
|
||||
$favicon = ( !empty($site['site_icon_file'])) ? $site['site_icon'] : './favicon.ico';
|
||||
}else{
|
||||
//站点图标
|
||||
$favicon = './favicon.ico';
|
||||
}
|
||||
|
||||
//版权信息
|
||||
$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>';
|
||||
|
||||
//是否启用收录
|
||||
function is_apply(){
|
||||
$apply_user = unserialize( get_db("user_config", "v", ["k" => "apply","uid"=>UID]));
|
||||
return ($GLOBALS['global_config']['apply'] == 1 && $apply_user['apply'] > 0);
|
||||
}
|
||||
//是否启用留言
|
||||
function is_guestbook(){
|
||||
$guestbook_user = unserialize( get_db("user_config", "v", ["k" => "guestbook","uid"=>UID]) );
|
||||
return ($GLOBALS['global_config']['guestbook'] == 1 && $guestbook_user['allow'] == 1);
|
||||
}
|
||||
|
||||
//取URL域名
|
||||
function get_url_host($url, $get_scheme = false, $get_port = false){
|
||||
$urls = parse_url($url);
|
||||
$host = $urls['host']; //获取主机名
|
||||
$port = $get_port === true ? ( empty( $urls['port'] ) ? '' : ':'.$urls['port']) : '';
|
||||
$scheme = $get_port === true ? ( empty( $urls['scheme'] ) ? 'http://' : $urls['scheme'].'://') : ''; //获取请求协议
|
||||
return $scheme.$host.$port;
|
||||
}
|
||||
//获取图标URL
|
||||
function geticourl($icon,$link){
|
||||
if( !empty( $link['icon']) ){
|
||||
if(substr($link['icon'], 0,4) == '<svg'){
|
||||
return('data:image/svg+xml;base64,'.base64_encode($link['icon']));
|
||||
}else{
|
||||
return($link['icon']);
|
||||
}
|
||||
}
|
||||
if ($site['link_icon'] == 'default'){
|
||||
return($GLOBALS['libs'].'/Other/default.ico');
|
||||
}elseif ($icon ==20){
|
||||
return('./index.php?c=icon&url='.base64_encode($link['real_url']));
|
||||
}elseif ($icon ==21){
|
||||
return('./ico/'.base64_encode($link['real_url']));
|
||||
}elseif($icon ==2){
|
||||
return('https://favicon.png.pub/v1/'.base64_encode(get_url_host($link['real_url'],true,true)));
|
||||
}elseif($icon ==4){
|
||||
return('https://api.15777.cn/get.php?url='.$link['real_url']);
|
||||
}elseif($icon ==5){
|
||||
return('https://favicon.cccyun.cc/'.$link['real_url']);
|
||||
}elseif($icon ==6){
|
||||
return('https://api.iowen.cn/favicon/'.parse_url($link['real_url'])['host'].'.png');
|
||||
}elseif($icon ==7){
|
||||
return('https://toolb.cn/favicon/'.parse_url($link['real_url'])['host']);
|
||||
}elseif($icon ==8){
|
||||
return('https://apis.jxcxin.cn/api/Favicon?url='.$link['real_url']);
|
||||
}else{
|
||||
return('./system/ico.php?text='.mb_strtoupper(mb_substr($link['title'], 0, 1)));
|
||||
}
|
||||
}
|
||||
|
||||
//取分类图标
|
||||
function get_category_icon($content = ''){
|
||||
return empty($content) ? '' : ( substr($content, 0,4) == '<svg' ? 'data:image/svg+xml;base64,'.base64_encode($content) : $content);
|
||||
}
|
||||
|
||||
//获取公开分类(返回数组cid)
|
||||
function get_open_category(){
|
||||
$where['uid'] = UID;
|
||||
$where['fid'] = 0;
|
||||
$where['status'] = 1;
|
||||
$where['property'] = 0;
|
||||
$categorys = select_db('user_categorys','cid',$where);
|
||||
$where['fid'] = $categorys;
|
||||
$categorys = array_merge ($categorys,select_db('user_categorys','cid',$where));
|
||||
return $categorys;
|
||||
}
|
||||
|
||||
//获取文章列表
|
||||
@@ -106,7 +202,6 @@ function get_article_list($category = 0,$limit = 0){
|
||||
}else{
|
||||
$where['AND']['OR']['state'] = [1,2]; //状态筛选
|
||||
}
|
||||
|
||||
//分类筛选
|
||||
if($category > 0){
|
||||
$where['AND']['category'] = $category;
|
||||
@@ -126,19 +221,22 @@ function get_article_list($category = 0,$limit = 0){
|
||||
//为文章添加分类名称
|
||||
foreach ($datas as &$data) {
|
||||
$data['category_name'] = $categorys[$data['category']] ?? 'Null';
|
||||
$data['title'] = htmlspecialchars($data['title'],ENT_QUOTES);
|
||||
$data['summary'] = htmlspecialchars($data['summary'],ENT_QUOTES);
|
||||
}
|
||||
return ['data'=>$datas,'count'=>$count];
|
||||
}
|
||||
|
||||
//根据文章id获取内容
|
||||
function get_article_content($id){
|
||||
$where['uid'] = UID;
|
||||
if(!is_login()){
|
||||
$where['AND']['state'] = 1; //状态筛选
|
||||
}else{
|
||||
$where['AND']['OR']['state'] = [1,2]; //状态筛选
|
||||
$where['state'] = 1; //状态筛选
|
||||
}
|
||||
$where['id'] = $id;
|
||||
$data = get_db('user_article_list','*',$where);
|
||||
$data['title'] = htmlspecialchars($data['title'],ENT_QUOTES);
|
||||
$data['summary'] = htmlspecialchars($data['summary'],ENT_QUOTES);
|
||||
$data['category_name'] = get_db('user_categorys','name',['uid'=>UID,'cid'=>$data['category']]);
|
||||
return $data;
|
||||
}
|
||||
@@ -177,4 +275,9 @@ function get_category_list($layer = false){
|
||||
}
|
||||
}
|
||||
return $categorys;
|
||||
}
|
||||
|
||||
//返回404
|
||||
function Not_Found() {
|
||||
header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit;
|
||||
}
|
||||
@@ -23,8 +23,8 @@ switch ($type) {
|
||||
break;
|
||||
case "pwd2":
|
||||
$LoginConfig = unserialize($USER_DB['LoginConfig']);
|
||||
if($_POST['Password2'] === $LoginConfig['Password2']){
|
||||
setcookie($USER_DB['User'].'_Password2', md5($USER_DB['Password'].$_COOKIE[U.'_key'].$_POST['Password2']), 0,'','',false,true);
|
||||
if($_POST['Password'] === $LoginConfig['Password2']){
|
||||
setcookie($USER_DB['User'].'_Password2', md5($USER_DB['Password'].$_COOKIE[U.'_key'].$_POST['Password']), 0,'','',false,true);
|
||||
msg(1,'二级密码正确!');
|
||||
}else{
|
||||
msg(-1,'二级密码错误!');
|
||||
@@ -32,7 +32,7 @@ switch ($type) {
|
||||
break;
|
||||
case "link_pwd":
|
||||
//读取链接信息
|
||||
$link = get_db('user_links',['pid','fid','property'],['uid'=>UID,'lid'=>$_POST['id'],'status'=>1]);
|
||||
$link = get_db('user_links',['pid','fid','property'],['uid'=>UID,'lid'=>$_GET['id'],'status'=>1]);
|
||||
if(empty($link)){
|
||||
msg(-1,'链接不存在'); //查找链接失败
|
||||
}
|
||||
@@ -44,7 +44,7 @@ switch ($type) {
|
||||
}
|
||||
if($password == $_POST['Password']){
|
||||
session_start();
|
||||
$_SESSION['verify']['link'][$_POST['id']] = $password;
|
||||
$_SESSION['verify']['link'][$_GET['id']] = $password;
|
||||
msg(1,'验证通过');
|
||||
}else{
|
||||
msg(-1,'密码错误!');
|
||||
|
||||
@@ -1 +1 @@
|
||||
v2.0.34-20230809
|
||||
v2.0.38-20230906
|
||||
@@ -82,7 +82,7 @@ layui.config({version:"<?php echo $Ver;?>"});
|
||||
layui.use(['layer','miniAdmin'], function () {
|
||||
var layer = layui.layer;
|
||||
layui.miniAdmin.render({
|
||||
iniUrl: "./index.php?c=admin&page=menu&u="+u,
|
||||
iniUrl: "./index.php?c=api&method=read_data&type=menu&u="+u,
|
||||
urlHashLocation: true,
|
||||
bgColorDefault: false,
|
||||
menuChildOpen: true,
|
||||
|
||||
@@ -270,45 +270,6 @@ layui.use(['form','table','dropdown','miniTab'], function () {
|
||||
return true;
|
||||
}
|
||||
})
|
||||
}else if(event === 'icon_pull'){
|
||||
layer.alert('存在链接图标时如何处理 ?', {icon: 3, title:'请选择',btn: ['保持原样', '重新拉取', '取消'],
|
||||
btnAlign: 'c',
|
||||
btn1: function(){icon_pull_test('0')}, //跳过
|
||||
btn2: function(){icon_pull_test('1')} //覆盖
|
||||
});
|
||||
function icon_pull_test(cover){
|
||||
let i = 0;
|
||||
let success = 0;
|
||||
let skip = 0;
|
||||
let fail = 0;
|
||||
let total = checkStatus.data.length;
|
||||
layer.load(1, {shade:[0.5,'#fff']});//加载层
|
||||
let msg_id = layer.msg('正在拉取中', {icon: 16,time: 1000*300});
|
||||
icon_pull(i);
|
||||
function icon_pull(id){
|
||||
if(i >= total){
|
||||
layer.closeAll();
|
||||
layer.alert('总计:' + total +',成功:' + success + ',失败:'+ fail + (skip > 0 ? (',跳过:' + skip):'' ),{icon:1,title:'信息',anim: 2,shadeClose: false,closeBtn: 0});
|
||||
return true;
|
||||
}
|
||||
$("#layui-layer"+ msg_id+" .layui-layer-padding").html('<i class="layui-layer-face layui-icon layui-icon layui-icon-loading layui-anim layui-anim-rotate layui-anim-loop"></i>[ ' + i + ' / ' + total + ' ] 正在拉取图标');
|
||||
$.post(get_api('write_link','icon_pull'),{id:checkStatus.data[i].lid,cover:cover},function(data,status){
|
||||
if(data.msg == 'success'){
|
||||
success ++;
|
||||
}else if(data.msg == 'fail'){
|
||||
fail ++;
|
||||
}else if(data.msg == 'skip'){
|
||||
skip ++;
|
||||
}else{
|
||||
layer.closeAll();
|
||||
layer.alert(data.msg,{icon:2,title:'信息',anim: 2,shadeClose: false,closeBtn: 0});
|
||||
return true;
|
||||
}
|
||||
i ++;
|
||||
icon_pull(i);
|
||||
});
|
||||
}
|
||||
}
|
||||
}else if(event === 'link_extend'){
|
||||
extend_data = '';
|
||||
index = layer.open({type: 1,scrollbar: false,shadeClose: true,title: '编辑扩展字段',area : ['100%', '100%'],content: $('.link_extend')});
|
||||
@@ -322,6 +283,8 @@ layui.use(['form','table','dropdown','miniTab'], function () {
|
||||
});
|
||||
}else if(event === 'msg_pull'){
|
||||
index = layer.open({type: 1,scrollbar: false,shadeClose: true,title: '批量识别链接信息',area : ['100%', '100%'],content: $('.msg_pull')});
|
||||
}else if(event === 'push'){
|
||||
index = layer.open({type: 1,scrollbar: false,shadeClose: true,title: '推送工具',area : ['100%', '100%'],content: $('.push')});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -359,6 +322,23 @@ layui.use(['form','table','dropdown','miniTab'], function () {
|
||||
return false;
|
||||
});
|
||||
|
||||
//开始推送
|
||||
$('#start_push').click(function () {
|
||||
let checkStatus = table.checkStatus('table');
|
||||
tableIds = checkStatus.data.map(function (value) {return value.lid;});
|
||||
tableIds = JSON.stringify(tableIds);
|
||||
$.post(get_api('other_baidu_push'),{'type':'link','push_api':$('#push_api').val(),'id':tableIds},function(data,status){
|
||||
if(data.code == -1){
|
||||
layer.msg(data.msg,{icon: 5});
|
||||
}else if(data.code == 200){
|
||||
layer.alert('成功推送的条数: ' + data.data.success + '<br />当天剩余的可推送条数: ' + data.data.remain + (data.data.not_same_site && data.data.not_same_site.length > 0 ? "<br />未处理的条数(非本站URL): " + data.data.not_same_site.length:'') + (data.data.not_valid && data.data.not_valid.length > 0 ? "<br />不合法的URL条数: " + data.data.not_valid.length:''));
|
||||
}else{
|
||||
layer.alert('错误代码: ' + data.data.error + '<br />错误描述: ' + data.data.message);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
table.render({
|
||||
elem: '#link_extend_list'
|
||||
,height: 'full-150'
|
||||
|
||||
@@ -1,140 +1,307 @@
|
||||
|
||||
layui.use(['form','miniTab'], function () {
|
||||
var form = layui.form,
|
||||
layer = layui.layer,
|
||||
miniTab = layui.miniTab;
|
||||
miniTab.listen();
|
||||
layer.photos({photos: '.img-list',anim: 5});
|
||||
layui.use(function(){
|
||||
var datas,local_theme,active;
|
||||
var buttons = [
|
||||
{'name':'主页模板','dir':'home','display':true},
|
||||
{'name':'过渡模板','dir':'transit','display':true},
|
||||
{'name':'登录模板','dir':'login','display':true},
|
||||
{'name':'验证模板','dir':'verify','display':true},
|
||||
{'name':'收录模板','dir':'apply','display':apply},
|
||||
{'name':'留言模板','dir':'guestbook','display':guestbook},
|
||||
{'name':'文章模板','dir':'article','display':article},
|
||||
{'name':'注册模板','dir':'register','display':is_admin},
|
||||
{'name':'引导页模板','dir':'guide','display':is_admin}
|
||||
];
|
||||
var $tab = $('#tab');
|
||||
$tab.append('<button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm" id="refresh" title="刷新数据"><i class="layui-icon layui-icon-refresh"></i></button>');
|
||||
$tab.append('<button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm" id="tips" title="提示信息"><i class="layui-icon layui-icon-tips"></i></button>');
|
||||
$tab.append('<button class="layui-btn layui-btn-primary layui-border-green layui-btn-sm" style="display: none;" id="set_up" title="设置"><i class="layui-icon layui-icon-set"></i></button>');
|
||||
buttons.forEach(item => {
|
||||
if(item.display){
|
||||
$tab.append(`<button class="layui-btn layui-btn-sm layui-btn-primary dir" dir="${item.dir}">${item.name}</button>`);
|
||||
}
|
||||
});
|
||||
|
||||
//监听按钮
|
||||
$(".layui-btn-group .layui-btn").click(function () {
|
||||
var dir= $(this).parent().attr("id");//取目录名key
|
||||
var fn= $(this).parent().parent().attr("id");//取模板类型
|
||||
var type = $(this).attr("id");//取事件类型
|
||||
var data = datas[dir].info;
|
||||
//console.log(data);alert('目录:'+dir+',类型:'+type+',模板类型:'+fn);
|
||||
|
||||
if(type === 'dw' || type === 'up' ){ //下载或更新
|
||||
if (data.desc != null && data.desc.length != 0){ //存在描述时弹窗显示描述
|
||||
layer.open({title:data.name,content: data.desc,btn: ['下载', '取消']
|
||||
,yes: function(index, layero){
|
||||
theme_download(dir,data.name,data.desc,fn);
|
||||
},btn2: function(index, layero){
|
||||
return true;
|
||||
},cancel: function(){
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}else{
|
||||
theme_download(dir,data.name,data.desc,fn);
|
||||
}
|
||||
}else if(type === 'del' ){ //删除
|
||||
layer.confirm('确认删除?',{icon: 3, title:'温馨提示'}, function(index){
|
||||
theme_del(dir,fn);
|
||||
var tag_btns = $('#tab .dir');
|
||||
local_theme = localStorage.getItem(u + "_theme_active") || 'home';
|
||||
local_theme = tag_btns.filter('[dir="' + local_theme + '"]');
|
||||
active = local_theme.length > 0 ? local_theme : tag_btns.first();
|
||||
$(active).addClass('layui-this'); //激活第一个
|
||||
active = $(active).attr('dir'); //取激活的dir
|
||||
load_data(active); //加载数据
|
||||
//刷新按钮
|
||||
$('#refresh').click(function() {
|
||||
load_data(active,true);
|
||||
});
|
||||
//预览按钮
|
||||
$("#preview").click(function() {
|
||||
window.open(`./index.php?c=${loginAddress}&u=${u}`);
|
||||
});
|
||||
//提示信息
|
||||
$("#tips").click(function() {
|
||||
let tip,url;
|
||||
let title = $("#tab .layui-this:first").text();
|
||||
if(active == 'home'){
|
||||
tip = '部分模板来自其它开源项目, 本程序仅做适配 <br />主题版权归原作者所有, 如有问题请联系! <br />注意: 部分模板可能不支持书签分享';
|
||||
}else if(active == 'login'){
|
||||
tip = '只有使用您的专属登录入口时才会生效,即:概要页面中的专属地址>登录';
|
||||
url = `./index.php?c=${loginAddress}&u=${u}`;
|
||||
}else if(active == 'verify'){
|
||||
tip = '验证加密链接/加密分类/二级密码的页面样式';
|
||||
}else if(active == 'apply'){
|
||||
tip = '收录页面的样式,需在收录管理>设置>申请收录>开启';
|
||||
url = `./index.php?c=apply&u=${u}`;
|
||||
}else if(active == 'guestbook'){
|
||||
tip = '留言板的页面样式,需在留言管理>当前设置>允许留言(点击蓝字切换)';
|
||||
url = `./index.php?c=guestbook&u=${u}`;
|
||||
}else if(active == 'article'){
|
||||
tip = '浏览文章页面的样式,前端显示样式与后端编辑器不一致属正常现象!';
|
||||
}else if(active == 'register'){
|
||||
tip = '注册页面的样式';
|
||||
}else if(active == 'guide'){
|
||||
tip = '引导页面的样式,需将系统设置>默认页面>改为引导页面 <br />未登录时直接访问域名显示引导页 <br />登录后将显示用户主页';
|
||||
}
|
||||
if(url != undefined){
|
||||
layer.alert(tip, {title:title,shadeClose: true,anim: 2,closeBtn: 0,
|
||||
btn: ['预览', '确定'],btn1: function(){
|
||||
layer.closeAll();
|
||||
setTimeout(function() { window.open(url) }, 288);
|
||||
}
|
||||
});
|
||||
|
||||
}else if(type === 'config' ){ //配置
|
||||
theme_config(dir,data.name,fn);
|
||||
}else if(type === 'preview' ){ //预览
|
||||
if(fn == 'home'){
|
||||
window.open('./index.php?theme='+dir+'&u='+u);
|
||||
}else{
|
||||
layer.msg('不支持预览此模板', {icon: 3});return;
|
||||
}else{
|
||||
layer.alert(tip,{title:title,shadeClose: true,anim: 2,closeBtn: 0});
|
||||
}
|
||||
});
|
||||
|
||||
//设置(目前仅用于过渡页)
|
||||
$('#set_up').click(function() {
|
||||
if(active == 'transit'){
|
||||
layer_open2('过渡页面设置',`/?c=admin&page=set_transit&u=${u}`);
|
||||
}else if(active == 'verify'){
|
||||
layer_open2('过渡页面设置',`/?c=admin&page=set_verify&u=${u}`);
|
||||
}
|
||||
});
|
||||
|
||||
//切换tab按钮
|
||||
tag_btns.click(function() {
|
||||
const dir = $(this).attr('dir');
|
||||
if(active == dir) return;
|
||||
active = dir;
|
||||
tag_btns.removeClass('layui-this').filter(this).addClass('layui-this');
|
||||
load_data(active);
|
||||
localStorage.setItem(u + "_theme_active",active);
|
||||
});
|
||||
|
||||
function layer_open2(title,url) {
|
||||
layer.open({type: 2,title: title,shadeClose: true,area : ['100%','100%'],scrollbar: false,resize: false,content: url});
|
||||
}
|
||||
//加载数据
|
||||
function load_data(dir,cache = false) {
|
||||
const set_up = (dir == 'transit' || dir == 'verify');
|
||||
$("#set_up")[ set_up ? "show" : "hide"]();
|
||||
$("#tips")[ !set_up ? "show" : "hide"]();
|
||||
layer.load(1, {shade: [0.5,'#fff']});//加载层
|
||||
layer.msg('正在获取数据..', {icon: 16,time: 1000*300});
|
||||
$.post(`./index.php?c=api&method=read_theme&dir=${dir}&u=${u}&cache=${cache ? 'no':'yes'}`, function (r, status) {
|
||||
layer.closeAll();
|
||||
if (r.code == 1) {
|
||||
datas = r.data;
|
||||
render_data(r);
|
||||
} else {
|
||||
layer.alert("获取数据失败,请重试!",{icon:5,title:'错误',anim: 2,closeBtn: 0,btn: ['刷新页面']},function () {location.reload();});
|
||||
}
|
||||
}).fail(function () {
|
||||
layer.alert("获取数据异常,请重试!",{icon:5,title:'错误',anim: 2,closeBtn: 0,btn: ['刷新页面']},function () {location.reload();});
|
||||
});
|
||||
}
|
||||
|
||||
//渲染数据
|
||||
function render_data(d){
|
||||
$row = $('.layui-row');
|
||||
$row.html('');
|
||||
for (const key in d.data) {
|
||||
const t = d.data[key];
|
||||
let upordw = '';
|
||||
if(is_admin){
|
||||
if(t.state == 'dw' || t.state == 'up'){
|
||||
upordw = `<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" id="${t.state}">${t.state == 'dw' ? '下载' : '更新' }</button>`;
|
||||
}
|
||||
}
|
||||
|
||||
}else if(type === 'set' ){ //使用
|
||||
if(fn == 'home'){
|
||||
set_theme(dir,data.name,fn);
|
||||
}else{
|
||||
set_theme2(dir,'',fn);
|
||||
}
|
||||
|
||||
}else if(type === 'detail' ){ //详情
|
||||
theme_detail(data);
|
||||
let html =
|
||||
`<div class="layui-col-xs layui-col-sm4 layui-col-md3" id="col_${key}">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
<div clas="left" style="float:left; cursor:pointer;" title="${key}" id="t_${key}">${t.name}</div>
|
||||
<div style="float:right;cursor:pointer;" title="${t.update}">${t.version}</div>
|
||||
</div>
|
||||
<div class="layui-card-body">
|
||||
<div class="img-list"><img class="screenshot" layer-src="${t.screenshot}" data-original="${t.screenshot}"></div>
|
||||
</div>
|
||||
<div class="layui-card-header" style="height: 1px;"></div>
|
||||
<div class="layui-card-header" style="height: auto;" id="${active}">
|
||||
<div class="layui-btn-group" id="${key}">
|
||||
${upordw}
|
||||
${t.state == 'local' || t.state == 'up' ? '<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" id="set">使用</button>':''}
|
||||
<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" id="detail">详情</button>
|
||||
${(t.state == 'local' || t.state == 'up') && active == 'home' ? '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" id="preview">预览</button>':''}
|
||||
${t.config == '1' && theme_set == true ? '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" id="config">配置</button>':''}
|
||||
${(t.state == 'local' || t.state == 'up' ) && is_admin == true ? '<button type="button" class="layui-btn layui-btn-sm layui-btn-danger" id="del">删除</button>':''}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
$row.append(html);
|
||||
}
|
||||
|
||||
//监听End
|
||||
})
|
||||
//标记当前模板,使用中靠前显示
|
||||
if(active == 'home'){
|
||||
var current1 = $(`#t_${d.current.home_pc}`);
|
||||
current1.css('color','#03a9f4');
|
||||
current1.prepend('</i><i class="fa fa-tv" title="PC终端正在使用此主题"></i> ');
|
||||
$(`#col_${d.current.home_pc}`).prependTo($row);
|
||||
var current2 = $(`#t_${d.current.home_pad}`);
|
||||
current2.css('color','#03a9f4');
|
||||
current2.prepend('<i class="layui-icon layui-icon-cellphone" title="移动终端正在使用此主题"> ');
|
||||
$(`#col_${d.current.home_pad}`).prependTo($row);
|
||||
//if(current1.is(current2)){ $("#set:first").remove(); }
|
||||
|
||||
}else{
|
||||
if(d.current[active] !== null && d.current[active] !== undefined && d.current[active].length > 0){
|
||||
var current = $(`#t_${d.current[active]}`);
|
||||
current.css('color','#03a9f4');
|
||||
current.prepend('<i class="fa fa-magic" style="color: #03a9f4;" title="正在使用"></i> ');
|
||||
$(`#col_${d.current[active]}`).prependTo($row);
|
||||
//$("#set:first").remove();
|
||||
}
|
||||
}
|
||||
$(`#col_default`).prependTo($row);
|
||||
//点击图片放大
|
||||
layer.photos({photos: '.img-list',anim: 5});
|
||||
|
||||
//懒加载预览图
|
||||
$('.screenshot').lazyload({placeholder:"./templates/admin/img/loading.gif",threshold : 600});
|
||||
|
||||
//监听按钮
|
||||
$(".layui-btn-group .layui-btn").click(function () {
|
||||
var dir= $(this).parent().attr("id");//取目录名key
|
||||
var fn= $(this).parent().parent().attr("id");//取模板类型
|
||||
var type = $(this).attr("id");//取事件类型
|
||||
var data = datas[dir];
|
||||
//console.log('目录:'+dir+',类型:'+type+',模板类型:'+fn);
|
||||
if(type === 'dw' || type === 'up' ){ //下载或更新
|
||||
if (data.desc != null && data.desc.length != 0){ //存在描述时弹窗显示描述
|
||||
layer.open({title:data.name,content: data.desc,btn: ['下载', '取消']
|
||||
,yes: function(index, layero){
|
||||
theme_download(dir,data.name,data.desc,fn);
|
||||
},btn2: function(index, layero){
|
||||
return true;
|
||||
},cancel: function(){
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}else{
|
||||
theme_download(dir,data.name,data.desc,fn);
|
||||
}
|
||||
}else if(type === 'del' ){ //删除
|
||||
layer.confirm('确认删除?',{icon: 3, title:'温馨提示'}, function(index){
|
||||
theme_del(dir,fn);
|
||||
});
|
||||
}else if(type === 'config' ){ //配置
|
||||
theme_config(dir,data.name,fn);
|
||||
}else if(type === 'preview' ){ //预览
|
||||
if(fn == 'home'){
|
||||
window.open('./index.php?theme='+dir+'&u='+u);
|
||||
}else{
|
||||
layer.msg('不支持预览此模板', {icon: 3});return;
|
||||
}
|
||||
}else if(type === 'set' ){ //使用
|
||||
if(fn == 'home'){
|
||||
set_theme(dir,data.name,fn);
|
||||
}else{
|
||||
set_theme2(dir,'',fn);
|
||||
}
|
||||
}else if(type === 'detail' ){ //详情
|
||||
theme_detail(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//下载主题
|
||||
function theme_download(dir,name,desc,fn){
|
||||
layer.msg('下载安装中,请稍后..', {shade:[0.5,'black'],anim: 1,icon: 16,time: 1000*300});
|
||||
$.post(get_api('write_theme','download'),{dir:dir,name:name,fn:fn},function(data,status){
|
||||
layer.closeAll();
|
||||
if( data.code == 1 ) {
|
||||
layer.msg(data.msg, {icon: 1});
|
||||
setTimeout(() => {load_data(active);}, 800);
|
||||
}else{
|
||||
layer.alert(data.msg,{icon:5,title:"错误",anim: "slideDown",shadeClose: true,closeBtn: 0,btn: ['知道了']});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
//懒加载预览图
|
||||
$('.screenshot').lazyload({placeholder:"./templates/admin/img/loading.gif",threshold : 600});
|
||||
|
||||
//下载主题
|
||||
function theme_download(dir,name,desc,fn){
|
||||
layer.load(1, {shade:[0.1,'#fff']});//加载层
|
||||
layer.msg('下载安装中,请稍后..', {offset: 'b',anim: 1,time: 60*1000});
|
||||
$.post(get_api('write_theme','download'),{dir:dir,name:name,fn:fn},function(data,status){
|
||||
layer.closeAll();
|
||||
if( data.code == 1 ) {
|
||||
layer.msg(data.msg, {icon: 1});
|
||||
setTimeout(() => {location.reload();}, 500);//延迟刷新
|
||||
}else{
|
||||
//layer.msg(data.msg, {icon: 5});
|
||||
layer.alert(data.msg,{icon:5,title:"错误",anim: "slideDown",shadeClose: true,closeBtn: 0,btn: ['知道了']});
|
||||
}
|
||||
});
|
||||
}
|
||||
//删除主题
|
||||
function theme_del(dir,fn){
|
||||
layer.load(1, {shade:[0.1,'#fff']});//加载层
|
||||
layer.msg('正在删除,请稍后..', {offset: 'b',anim: 1,time: 60*1000});
|
||||
$.post(get_api('write_theme','del'),{dir:dir,fn:fn},function(data,status){
|
||||
layer.closeAll();
|
||||
if( data.code == 1 ) {
|
||||
layer.msg(data.msg, {icon: 1});
|
||||
setTimeout(() => {location.reload();}, 500);
|
||||
}else{
|
||||
layer.msg(data.msg, {icon: 5});
|
||||
}
|
||||
});
|
||||
}
|
||||
//载入主题配置
|
||||
function theme_config(key,name,fn){
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: name + ' - 主题配置',
|
||||
shadeClose: true,
|
||||
area : [( $(window).width() < 768 ? '100%' : '568px' ),'100%'],
|
||||
scrollbar: false,
|
||||
resize: false,
|
||||
offset: 'rt',
|
||||
content: './index.php?c=admin&page=config_home&u='+u+'&theme='+key+'&fn='+fn+'&source=admin',
|
||||
});
|
||||
}
|
||||
//使用主题提示框
|
||||
function set_theme(key,name,fn) {
|
||||
layer.open({
|
||||
title:name
|
||||
,content: '请选择要应用的设备类型 ?'
|
||||
,btn: ['全部', 'PC', 'Pad']
|
||||
,yes: function(index, layero){
|
||||
set_theme2(key,'PC/Pad',fn);
|
||||
},btn2: function(index, layero){
|
||||
set_theme2(key,'PC',fn);
|
||||
},btn3: function(index, layero){
|
||||
set_theme2(key,'Pad',fn);
|
||||
},cancel: function(){
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
//使用主题
|
||||
function set_theme2(name,type,fn) {
|
||||
console.log(type,name);
|
||||
$.post(get_api('write_theme','set'),{type:type,name:name,fn:fn},function(data,status){
|
||||
if( data.code == 1 ) {
|
||||
layer.msg(data.msg, {icon: 1});
|
||||
setTimeout(() => {location.reload();}, 500);
|
||||
}else{
|
||||
layer.msg(data.msg, {icon: 5});
|
||||
}
|
||||
});
|
||||
}
|
||||
//主题详情
|
||||
function theme_detail(data){
|
||||
layer.open({type: 1,scrollbar: false,maxmin: false,shadeClose: true,resize: false,title: data.name + ' - 主题详情',area: ['60%', '59%'],content: '<body class="layui-fluid"><div class="layui-row" style = "margin-top:1em;"><div class="layui-col-sm9" style = "border-right:1px solid #e2e2e2;"><div style = "margin-left:1em;margin-right:1em;"><img src="'+data.screenshot+'" alt="" style = "max-width:100%;"></div></div><div class="layui-col-sm3"><div style = "margin-left:1em;margin-right:1em;"><h1>'+data.name+'</h1><p>描述:'+data.description+'</p><p>版本:'+data.version+'</p><p>更新时间:'+data.update+'</p><p>作者:'+data.author+'</p><p>主页:<a style = "color:#01AAED;" href="'+data.homepage+'" target="_blank" rel = "nofollow">访问主页</a></p></div></div></div></body>'});
|
||||
|
||||
}
|
||||
//删除主题
|
||||
function theme_del(dir,fn){
|
||||
layer.load(1, {shade:[0.5,'black']});//加载层
|
||||
layer.msg('正在删除,请稍后..', {offset: 'b',anim: 1,time: 60*1000});
|
||||
$.post(get_api('write_theme','del'),{dir:dir,fn:fn},function(data,status){
|
||||
layer.closeAll();
|
||||
if( data.code == 1 ) {
|
||||
layer.msg(data.msg, {icon: 1});
|
||||
setTimeout(() => {load_data(active);}, 800);
|
||||
}else{
|
||||
layer.msg(data.msg, {icon: 5});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//载入主题配置
|
||||
function theme_config(key,name,fn){
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: name + ' - 主题配置',
|
||||
shadeClose: true,
|
||||
area : [( $(window).width() < 768 ? '100%' : '666px' ),'100%'],
|
||||
scrollbar: false,
|
||||
resize: false,
|
||||
offset: 'rt',
|
||||
content: './index.php?c=admin&page=config_home&u='+u+'&theme='+key+'&fn='+fn+'&source=admin',
|
||||
});
|
||||
}
|
||||
|
||||
//使用主题提示框
|
||||
function set_theme(key,name,fn) {
|
||||
layer.open({
|
||||
title:name
|
||||
,content: '请选择要应用的设备类型 ?'
|
||||
,btn: ['全部', 'PC', 'Pad']
|
||||
,yes: function(index, layero){
|
||||
set_theme2(key,'PC/Pad',fn);
|
||||
},btn2: function(index, layero){
|
||||
set_theme2(key,'PC',fn);
|
||||
},btn3: function(index, layero){
|
||||
set_theme2(key,'Pad',fn);
|
||||
},cancel: function(){
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//使用主题
|
||||
function set_theme2(name,type,fn) {
|
||||
$.post(get_api('write_theme','set'),{type:type,name:name,fn:fn},function(data,status){
|
||||
if( data.code == 1 ) {
|
||||
layer.msg(data.msg, {icon: 1});
|
||||
setTimeout(() => {load_data(active);}, 800);
|
||||
}else{
|
||||
layer.msg(data.msg, {icon: 5});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//主题详情
|
||||
function theme_detail(data){
|
||||
layer.open({type: 1,scrollbar: false,maxmin: false,shadeClose: true,resize: false,title: data.name + ' - 主题详情',area: ['60%', '59%'],content: '<body class="layui-fluid"><div class="layui-row" style = "margin-top :1em;"><div class="layui-col-sm9" style = "border-right:1px solid #e2e2e2;"><div style = "margin-left:1em;margin-right:1em;"><img src="'+data.screenshot+'" alt="" style = "max-width:100%;"></div></div><div class ="layui-col-sm3"><div style = "margin-left:1em;margin-right:1em;"><h1>'+data.name+'</h1><p>描述:'+data.description+'</p><p>版本:'+data.version+'</p><p>更新时间:'+data.update+'</p><p>作者:'+data.author+'</p><p >主页:<a style = "color:#01AAED;" href="'+data.homepage+'" target="_blank" rel = "nofollow">访问主页</a></p></div></div></div></body>'});
|
||||
|
||||
}
|
||||
});
|
||||
@@ -69,15 +69,16 @@
|
||||
<label class="layui-form-label">链接图标</label>
|
||||
<div class="layui-input-inline" >
|
||||
<select name="link_icon">
|
||||
<option value="0" selected>离线图标</option>
|
||||
<option value="0" selected>离线图标(首字图标)</option>
|
||||
<option value="20" >本地服务</option>
|
||||
<option value="21" >本地服务(伪静态)</option>
|
||||
<option value="2" >favicon.png.pub (小图标)</option>
|
||||
<option value="4" >api.15777.cn</option>
|
||||
<option value="5" >favicon.cccyun.cc</option>
|
||||
<!--<option value="4" >api.15777.cn</option>-->
|
||||
<!--<option value="5" >favicon.cccyun.cc</option>-->
|
||||
<option value="6" >api.iowen.cn</option>
|
||||
<!--<option value="7" >toolb.cn</option>-->
|
||||
<!--<option value="8" >apis.jxcxin.cn</option>-->
|
||||
<!--<option value="9" >ico.kucat.cn</option>-->
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">所有API接口均由其他大佬提供!若有异常请尝试更换接口!</div>
|
||||
|
||||
@@ -1,8 +1,25 @@
|
||||
<?php
|
||||
if($global_config['article'] != 1 || !check_purview('article',1)){
|
||||
if($global_config['article'] < 1 || !check_purview('article',1)){
|
||||
require(DIR.'/templates/admin/page/404.php');
|
||||
exit;
|
||||
}
|
||||
// if($global_config['article'] == 2 ){
|
||||
// if(is_file(DIR.'/static/UEditor/ueditor.all.min.js')){
|
||||
// require('article-edit-2.php');
|
||||
// exit;
|
||||
// }else{
|
||||
// $content = '未检测到UEditor资源';
|
||||
// require DIR.'/templates/admin/page/404.php';
|
||||
// exit;
|
||||
// }
|
||||
// }
|
||||
|
||||
if(!is_file(DIR.'/static/wangEditor/wangEditor.css') || !is_file(DIR.'/static/wangEditor/wangEditor.js')){
|
||||
$content = '由于缺少静态资源,当前无法加载编辑器!<br />如果您是站长,请在系统设置页面点击确定保存,系统将自动下载相关资源!<br />如果您是用户,请联系站长处理或耐心等候!';
|
||||
require DIR.'/templates/admin/page/404.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
$article_id = Get('id');
|
||||
$mode = empty($article_id) ? 'add' : 'edit' ;
|
||||
|
||||
@@ -45,7 +62,7 @@ require dirname(__DIR__).'/header.php' ?>
|
||||
<div class="layui-form-item ">
|
||||
<label class="layui-form-label w40">标题:</label>
|
||||
<div class="layui-input-block">
|
||||
<input class="layui-input" name="title" placeholder='请输入文章标题' autocomplete="off" value="<?php echo $data['title'];?>">
|
||||
<input class="layui-input" name="title" placeholder='请输入文章标题' autocomplete="off" value="<?php echo htmlspecialchars($data['title'],ENT_QUOTES);?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -73,7 +90,7 @@ require dirname(__DIR__).'/header.php' ?>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label w40">摘要:</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="summary" rows ="2" placeholder="文章摘要,留空时自动获取" class="layui-textarea" style="min-height: 45px;"><?php echo $data['summary'];?></textarea>
|
||||
<textarea name="summary" rows ="2" placeholder="文章摘要,留空时自动获取" class="layui-textarea" style="min-height: 45px;"><?php echo htmlspecialchars($data['summary'],ENT_QUOTES);?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -82,7 +99,7 @@ require dirname(__DIR__).'/header.php' ?>
|
||||
<div class="layui-input-block" id="editor—wrapper">
|
||||
<div id="toolbar-container"></div>
|
||||
<div id="editor-container"></div>
|
||||
<textarea name="content" id="content" class="layui-textarea layui-hide"><?php echo $data['content'] ?? '<p><br></p>';?></textarea>
|
||||
<textarea name="content" id="content" class="layui-textarea layui-hide"><?php echo htmlspecialchars($data['content'],ENT_QUOTES) ?? '<p><br></p>';?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -199,6 +216,7 @@ const toolbar = createToolbar({
|
||||
})
|
||||
|
||||
|
||||
|
||||
layui.use(['form','upload'], function () {
|
||||
var form = layui.form,
|
||||
upload = layui.upload;
|
||||
@@ -291,6 +309,18 @@ layui.use(['form','upload'], function () {
|
||||
});
|
||||
return false;
|
||||
});
|
||||
$(".content").dblclick(function(){
|
||||
layer.prompt({
|
||||
formType: 2,
|
||||
value: editor.getHtml(),
|
||||
maxlength:9999999,
|
||||
title: 'HTML代码编辑',
|
||||
area: ['800px', '350px']
|
||||
}, function(value, index, elem){
|
||||
editor.setHtml(value);
|
||||
layer.close(index); // 关闭层
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function truncateString(str,n) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
if($global_config['article'] != 1 || !check_purview('article',1)){
|
||||
if($global_config['article'] < 1 || !check_purview('article',1)){
|
||||
require(DIR.'/templates/admin/page/404.php');
|
||||
exit;
|
||||
}
|
||||
@@ -131,6 +131,30 @@ require dirname(__DIR__).'/header.php' ?>
|
||||
</pre>
|
||||
</form>
|
||||
</ul>
|
||||
<ul class="push" style="margin-top: 18px;display:none;padding-right: 10px;padding-left: 10px;">
|
||||
<form class="layui-form layuimini-form" lay-filter="push">
|
||||
<pre class="layui-code" >使用API推送功能会达到怎样效果
|
||||
及时发现:可以缩短百度爬虫发现您站点新链接的时间,使新发布的页面可以在第一时间被百度收录
|
||||
保护原创:对于网站的最新原创内容,使用API推送功能可以快速通知到百度,使内容可以在转发之前被百度发现
|
||||
百度官方说明: https://ziyuan.baidu.com/linksubmit/index
|
||||
注意事项: 推送的URL是静态格式,所以请务必正确配置好伪静态!
|
||||
伪静态配置: 请前往站长工具>生成伪静态,并复制内容配置到服务器 (仅针对Nginx)
|
||||
</pre>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">接口地址</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="push_api" id="push_api" placeholder="请输入接口调用地址如 http://data.zz.baidu.com/urls?site=lm21.top&token=xxxxxx"
|
||||
value="<?php echo get_db("user_config", "v", ["k" => "baidu_push_api","uid"=>UID]); ?>" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<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="start_push" id="start_push">开始</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</ul>
|
||||
<script>
|
||||
layui.use(['form','table','dropdown','miniTab'], function () {
|
||||
var $ = layui.jquery;
|
||||
@@ -145,7 +169,7 @@ layui.use(['form','table','dropdown','miniTab'], function () {
|
||||
{type:'checkbox'} //开启复选框
|
||||
,{ title:'操作', toolbar: '#tablebar',width:110}
|
||||
,{field: 'title', title: '标题', minWidth:200,templet: function(d){
|
||||
return '<a style="color:#3c78d8" target="_blank" href="./?c=article&id=' +d.id + '&u=' + u + '" title="' + d.summary + '">'+d.title+'</a>'
|
||||
return '<a style="color:#3c78d8" target="_blank" href="./?c=article&id=' +d.id + '&u=' + u + '" title="' + htmlspecialchars(d.summary) + '">'+htmlspecialchars(d.title)+'</a>'
|
||||
}}
|
||||
,{field:'category',title:'分类',width:100,templet: function(d){
|
||||
return d.category_name;
|
||||
@@ -215,6 +239,9 @@ layui.use(['form','table','dropdown','miniTab'], function () {
|
||||
},{
|
||||
title: '批量删除',
|
||||
id: 'del_article'
|
||||
},{
|
||||
title: '百度推送',
|
||||
id: 'push'
|
||||
}],
|
||||
click: function(obj){
|
||||
let checkStatus = table.checkStatus('table').data;
|
||||
@@ -248,11 +275,32 @@ layui.use(['form','table','dropdown','miniTab'], function () {
|
||||
layer.msg(data.msg || '未知错误',{icon: 5});
|
||||
}
|
||||
});
|
||||
}else if(obj.id == 'push'){
|
||||
index = layer.open({type: 1,scrollbar: false,shadeClose: true,title: '推送工具',area : ['100%', '100%'],content: $('.push')});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//开始推送
|
||||
$('#start_push').click(function () {
|
||||
let checkStatus = table.checkStatus('table');
|
||||
tableIds = checkStatus.data.map(function (value) {return value.id;});
|
||||
tableIds = JSON.stringify(tableIds);
|
||||
$.post(get_api('other_baidu_push'),{'type':'article','push_api':$('#push_api').val(),'id':tableIds},function(data,status){
|
||||
if(data.code == -1){
|
||||
layer.msg(data.msg,{icon: 5});
|
||||
}else if(data.code == 200){
|
||||
layer.alert('成功推送的条数: ' + data.data.success + '<br />当天剩余的可推送条数: ' + data.data.remain + (data.data.not_same_site && data.data.not_same_site.length > 0 ? "<br />未处理的条数(非本站URL): " + data.data.not_same_site.length:'') + (data.data.not_valid && data.data.not_valid.length > 0 ? "<br />不合法的URL条数: " + data.data.not_valid.length:''));
|
||||
}else{
|
||||
layer.alert('错误代码: ' + data.data.error + '<br />错误描述: ' + data.data.message);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
//关闭按钮
|
||||
$(document).on('click', '#close', function() {
|
||||
layer.close(index);//关闭当前页
|
||||
});
|
||||
//输入框回车事件和搜索按钮点击事件
|
||||
$('#keyword, #search').on('keydown click', function(e) {
|
||||
if ( (e.target.id === 'keyword' && e.keyCode === 13) || (e.target.id === 'search' && e.type === 'click') ) {
|
||||
@@ -383,6 +431,9 @@ layui.use(['form','table','dropdown','miniTab'], function () {
|
||||
return false;
|
||||
});
|
||||
|
||||
function htmlspecialchars(str) {
|
||||
return $('<div/>').text(str).html();
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
214
templates/admin/page/expand/sitemap.php
Normal file
214
templates/admin/page/expand/sitemap.php
Normal file
@@ -0,0 +1,214 @@
|
||||
<?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="">
|
||||
2023.09.05 新增功能 (授权用户专享),如有问题请及时反馈 ! <br />
|
||||
URL格式: 静态地址需配置伪静态,二级域名需配置DNS泛解析和服务器绑定并已开启功能<br />
|
||||
<?php if(preg_match('/nginx/i',$_SERVER['SERVER_SOFTWARE']) ){ ?>
|
||||
注意: 此功能依赖伪静态,请前往站长工具>生成伪静态,并复制内容配置到服务器
|
||||
<?php } ?>
|
||||
</blockquote>
|
||||
<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="switch">
|
||||
<option value="0" selected>关闭</option>
|
||||
<option value="1">开启</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">关闭后将禁止生成和读取站点地图</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="beidong">
|
||||
<option value="0">不生成</option>
|
||||
<option value="1">生成</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">当请求根目录的<a href="./sitemap.xml" target="_blank">sitemap.xml</a>是否生成地图数据(需配置伪静态),受更新频率的限制</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">主动更新</label>
|
||||
<div class="layui-input-inline" >
|
||||
<select name="zhudong">
|
||||
<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">更新频率</label>
|
||||
<div class="layui-input-inline" >
|
||||
<select name="changefreq">
|
||||
<option value="monthly">每月</option>
|
||||
<option value="weekly">每周</option>
|
||||
<option value="daily" selected>每天</option>
|
||||
<option value="hourly">每小时</option>
|
||||
<option value="minute">每分钟(不推荐)</option>
|
||||
<option value="second">每秒钟(仅用于测试)</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">根据自己站点的更新频率设置</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">URL格式</label>
|
||||
<div class="layui-input-block" >
|
||||
<select name="user_homepage">
|
||||
<option value="0" >不生成</option>
|
||||
<option value="1" selected="">动态地址 | http://example.com/index.php?u=user</option>
|
||||
<option value="2" >静态地址 | http://example.com/user.html</option>
|
||||
<option value="3" >二级域名 | http://user.example.com</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">权重</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="user_homepage_weight" lay-verify="required" value="0.9" 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="user_homepage_changefreq"></select>
|
||||
</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">URL格式</label>
|
||||
<div class="layui-input-block" >
|
||||
<select name="click_page">
|
||||
<option value="0" >不生成</option>
|
||||
<option value="1" selected="">动态地址 | http://example.com/index.php?c=click&id=1&u=user</option>
|
||||
<option value="2" >静态地址 | http://example.com/user/click/1.html</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">权重</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="click_page_weight" lay-verify="required" value="0.8" 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="click_page_changefreq"></select>
|
||||
</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">URL格式</label>-->
|
||||
<!-- <div class="layui-input-block" >-->
|
||||
<!-- <select name="article_page">-->
|
||||
<!-- <option value="0" >不生成</option>-->
|
||||
<!-- <option value="1" selected="">动态地址 | http://example.com/index.php?c=article&id=1&u=user</option>-->
|
||||
<!-- <option value="2" >静态地址 | http://example.com/user/article/1.html</option>-->
|
||||
<!-- </select>-->
|
||||
<!-- </div>-->
|
||||
<!--</div>-->
|
||||
|
||||
<!--<div class="layui-form-item">-->
|
||||
<!-- <label class="layui-form-label">权重</label>-->
|
||||
<!-- <div class="layui-input-inline">-->
|
||||
<!-- <input type="text" name="article_page_weight" lay-verify="required" value="0.8" 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="article_page_changefreq"></select>-->
|
||||
<!-- </div>-->
|
||||
<!--</div>-->
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn layui-btn-normal" lay-submit lay-filter="save">保存配置</button>
|
||||
<button class="layui-btn layui-btn-normal" lay-submit lay-filter="generate">手动生成</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;
|
||||
const changefreq_Map = {"always": "始终","hourly": "每小时","daily": "每天","weekly": "每周","monthly": "每月","yearly": "每年","never": "从不"};
|
||||
|
||||
//给更新频率下拉框添加选项
|
||||
$("select[name$='_changefreq']").each(function() {
|
||||
const select = $(this);
|
||||
$.each(changefreq_Map, function(optionValue, optionText) {
|
||||
select.append($("<option>").text(optionText).val(optionValue));
|
||||
});
|
||||
select.val('daily'); //默认值改为每天
|
||||
});
|
||||
//刷新组件
|
||||
layui.form.render('select');
|
||||
|
||||
//表单赋值
|
||||
form.val('form', <?php echo json_encode(unserialize( get_db("global_config", "v", ["k" => "sitemap_config"])));?>);
|
||||
|
||||
//监听提交
|
||||
form.on('submit(save)', function (data) {
|
||||
$.post(get_api('other_root','write_sitemap_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(generate)', function (data) {
|
||||
layer.load(1, {shade:[0.3,'#fff']});
|
||||
layer.msg('正在处理中..', {icon: 16,time: 1000*300});
|
||||
$.post('./?c=sitemap&mode=manual',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>
|
||||
@@ -202,7 +202,7 @@ require 'header.php';
|
||||
</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">
|
||||
<a href="javascript:;" layuimini-content-href="theme" data-title="主题设置" data-icon="fa fa-magic">
|
||||
<i class="fa fa-magic"></i>
|
||||
<cite>主题设置</cite>
|
||||
</a>
|
||||
@@ -242,7 +242,7 @@ require 'header.php';
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-header">
|
||||
<div style="display: flex; justify-content: space-between;">
|
||||
<div><i class="fa fa-line-chart icon"></i>报表统计</div>
|
||||
<div id="tongji" style="cursor: pointer;"><i class="fa fa-line-chart icon" ></i>报表统计</div>
|
||||
<div>
|
||||
<button class="layui-btn layui-btn-primary echarts" style="border: none;display:none;"><span>最近7天</span><i class="layui-icon layui-icon-down layui-font-12"></i></button>
|
||||
</div>
|
||||
@@ -359,6 +359,27 @@ if($USER_DB['UserGroup'] == 'root'){
|
||||
}
|
||||
});
|
||||
|
||||
$('#tongji').on('click', function(){
|
||||
$.post('./index.php?c=api&method=read_data&date='+home_echarts+'&type=tongji_ip_list&u='+u,function(data,status){
|
||||
if(data.code == 1){
|
||||
var content = '<table class="layui-table" border="1"><thead><tr><th>日期</th><th>IP列表</th></tr></thead><tbody>';
|
||||
$.each(data.data, function (date, ipAddresses) {
|
||||
content += '<tr><td>' + date + '</td><td>';
|
||||
ipAddresses.sort((ip1, ip2) => ip1.localeCompare(ip2, undefined, { numeric: true })); //IP排序
|
||||
$.each(ipAddresses, function (index, ipAddress) {
|
||||
content += ipAddress + '<br>';
|
||||
});
|
||||
content += '</td></tr>';
|
||||
});
|
||||
content += '</tbody></table>';
|
||||
layer.open({
|
||||
title: '访问IP列表',
|
||||
content: content,
|
||||
area: ['100%', '100%']
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
//加载报表统计
|
||||
function load_echarts(){
|
||||
var echartsRecords = echarts.init(document.getElementById('echarts-records'), 'walden');
|
||||
|
||||
@@ -73,8 +73,9 @@
|
||||
<?php }?>
|
||||
<?php if($global_config['offline'] != 1 ){ ?>
|
||||
<button class="layui-btn layui-btn-sm layui-btn-normal layui-btn-danger layui-hide-xs" lay-event="testing" id="testing">检测</button>
|
||||
<?php }?>
|
||||
<button class="layui-btn layui-btn-sm layui-btn-normal layui-btn-danger layui-hide-xs" lay-event="msg_pull" id="msg_pull">识别</button>
|
||||
<button class="layui-btn layui-btn-sm layui-btn-normal layui-btn-danger layui-hide-xs" lay-event="push" id="push">推送</button>
|
||||
<?php }?>
|
||||
<button class="layui-btn layui-btn-sm layui-btn-normal layui-btn-danger" layuimini-content-href="link_sort" data-title="链接排序">排序模式</button>
|
||||
</div>
|
||||
</script>
|
||||
@@ -113,6 +114,7 @@
|
||||
</div>
|
||||
</script>
|
||||
</ul>
|
||||
<?php if($global_config['offline'] != 1 ){ ?>
|
||||
<ul class="msg_pull" style="margin-top: 18px;display:none;padding-right: 10px;padding-left: 10px;">
|
||||
<form class="layui-form layuimini-form" lay-filter="msg_pull">
|
||||
<pre class="layui-code" id="tip" >提示: 自动识别仅针对http/https有效,且不能保证百分百成功!未成功识别时不会对链接信息进行修改!大批量识别前建议先备份数据,效果不理想时可以回退!</pre>
|
||||
@@ -163,5 +165,30 @@
|
||||
</div>
|
||||
</form>
|
||||
</ul>
|
||||
<ul class="push" style="margin-top: 18px;display:none;padding-right: 10px;padding-left: 10px;">
|
||||
<form class="layui-form layuimini-form" lay-filter="push">
|
||||
<pre class="layui-code" >使用API推送功能会达到怎样效果
|
||||
及时发现:可以缩短百度爬虫发现您站点新链接的时间,使新发布的页面可以在第一时间被百度收录
|
||||
保护原创:对于网站的最新原创内容,使用API推送功能可以快速通知到百度,使内容可以在转发之前被百度发现
|
||||
百度官方说明: https://ziyuan.baidu.com/linksubmit/index
|
||||
注意事项: 推送的URL是静态格式,所以请务必正确配置好伪静态!
|
||||
伪静态配置: 请前往站长工具>生成伪静态,并复制内容配置到服务器 (仅针对Nginx)
|
||||
</pre>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">接口地址</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="push_api" id="push_api" placeholder="请输入接口调用地址如 http://data.zz.baidu.com/urls?site=lm21.top&token=xxxxxx"
|
||||
value="<?php echo get_db("user_config", "v", ["k" => "baidu_push_api","uid"=>UID]); ?>" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<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="start_push" id="start_push">开始</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</ul>
|
||||
<?php }?>
|
||||
</body>
|
||||
</html>
|
||||
@@ -56,9 +56,9 @@ $title='系统设置';require(dirname(__DIR__).'/header.php');
|
||||
<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">
|
||||
<input type="text" name="sender" lay-verify="required" lay-reqtext="发送人名称不能为空" placeholder='' autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">例如: TwoNav书签<test@qq.com></div>
|
||||
<div class="layui-form-mid layui-word-aux">例如: TwoNav</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
|
||||
@@ -12,6 +12,7 @@ $title='系统设置';require(dirname(__DIR__).'/header.php');
|
||||
<button type="button" class="layui-btn" layuimini-content-href="root/default_setting" data-title="默认设置">默认设置</button>
|
||||
<button type="button" class="layui-btn" layuimini-content-href="root/mail_set" data-title="邮件配置">邮件配置</button>
|
||||
<button type="button" class="layui-btn" layuimini-content-href="root/icon_set" data-title="图标配置">图标配置</button>
|
||||
<button type="button" class="layui-btn" layuimini-content-href="expand/sitemap" data-title="站点地图">站点地图</button>
|
||||
</div>
|
||||
<form class="layui-form" lay-filter="form">
|
||||
<div class="layui-form layuimini-form layui-form-pane">
|
||||
@@ -119,7 +120,7 @@ $title='系统设置';require(dirname(__DIR__).'/header.php');
|
||||
<option value="1" >开启</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">开启将禁止服务器访问互联网,部分功能将被禁用(如:更新提示,公告,在线主题,链接识别,书签克隆等)</div>
|
||||
<div class="layui-form-mid layui-word-aux">开启将禁止服务器访问互联网,部分功能将被禁用(如:更新提示,公告,在线主题,链接识别等)</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
|
||||
@@ -133,16 +133,35 @@ layui.use(['layer','form','miniTab'], function () {
|
||||
$('.rewrite').on('click', function(){
|
||||
let pathname = window.location.pathname;
|
||||
$("#console_log").text("");
|
||||
//$("#console_log").append(`#更新时间: 2023.09.05\n`);
|
||||
//$("#console_log").append(`#安全规则(必选)\n`);
|
||||
//$("#console_log").append(`location ^~ ${pathname}data/ {location ~* \\.(db|db3|php|sql|tar|gz|zip|info|log|json)$ {return 403;}}\n`);
|
||||
//$("#console_log").append(`location ^~ ${pathname}templates/ {location ~* \\.(php|tar|gz|zip|info|log|json)$ {return 403;}}\n`);
|
||||
//$("#console_log").append(`#重写规则(可选)\n`);
|
||||
//$("#console_log").append(`rewrite ^${pathname}login$ ${pathname}index.php?c=login break;\n`);
|
||||
//$("#console_log").append(`rewrite ^${pathname}admin$ ${pathname}index.php?c=admin break;\n`);
|
||||
//$("#console_log").append(`rewrite ^${pathname}ico/(.+) ${pathname}index.php?c=icon&url=$1 break;\n`);
|
||||
//$("#console_log").append(`rewrite ^${pathname}([A-Za-z0-9]+)$ ${pathname}index.php?u=$1 break;\n`);
|
||||
//$("#console_log").append(`rewrite ^${pathname}([A-Za-z0-9]+)\\.html$ ${pathname}index.php?u=$1 break;\n`);
|
||||
//$("#console_log").append(`rewrite ^${pathname}(.+)/(click|article)/([A-Za-z0-9]+)$ ${pathname}index.php?c=$2&id=$3&u=$1 break;\n`);
|
||||
//$("#console_log").append(`rewrite ^${pathname}(.+)/(click|article)/([A-Za-z0-9]+)\\.html$ ${pathname}index.php?c=$2&id=$3&u=$1 break;\n`);
|
||||
////路径修正(解决使用伪静态链接访问时路径错误的问题)
|
||||
//$("#console_log").append(`rewrite ^${pathname}(.+)/(click|article)/(templates|static|data|system)/(.+) ${pathname}$3/$4 break;\n`);
|
||||
//$("#console_log").append(`rewrite ^${pathname}(.+)/(click|article)/favicon\\.ico ${pathname}favicon.ico break;\n`);
|
||||
//$("#console_log").append(`#站点地图(可选)\n`);
|
||||
//$("#console_log").append(`rewrite ^${pathname}sitemap.xml$ ${pathname}index.php?c=sitemap break;\n`);
|
||||
|
||||
$("#console_log").append(`#安全规则(必选)\n`);
|
||||
$("#console_log").append(`location ^~ ${pathname}data/ {location ~* \\.(db|db3|php|sql|tar|gz|zip|info|log|json)$ {return 403;}}\n`);
|
||||
$("#console_log").append(`location ^~ ${pathname}templates/ {location ~* \\.(php|tar|gz|zip|info|log|json)$ {return 403;}}\n`);
|
||||
$("#console_log").append(`#重写规则(可选)\n`);
|
||||
$("#console_log").append(`rewrite ^${pathname}login$ ${pathname}index.php?c=login break;\n`);
|
||||
$("#console_log").append(`rewrite ^${pathname}admin$ ${pathname}index.php?c=admin break;\n`);
|
||||
$("#console_log").append(`rewrite ^${pathname}ico/(.+) ${pathname}index.php?c=icon&url=$1 break;\n`);
|
||||
$("#console_log").append(`rewrite ^${pathname}([A-Za-z0-9]+)$ ${pathname}index.php?u=$1 break;\n`);
|
||||
$("#console_log").append(`rewrite ^${pathname}(.+)/(click)/([A-Za-z0-9]+)$ ${pathname}index.php?c=$2&id=$3&u=$1 break;\n`);
|
||||
$("#console_log").append(`rewrite ^${pathname}(.+)/(click)/(.+) ${pathname}$3 break;\n`);
|
||||
if(pathname == '/'){
|
||||
$("#console_log").append(`#重写规则(可选)\n`);
|
||||
$("#console_log").append(`location / {\n if ($uri ~* ^/index\.php$) { break; }\n if ($uri ~* ^/(templates|static|data|system)/) { break; }\n try_files $uri $uri/ /rewrite.php?$query_string;\n}\n`);
|
||||
$("#console_log").append(`rewrite ^/[a-zA-Z0-9]+/[a-zA-Z]+/(templates|static|data|system)/(.+) /$1/$2 break;\n`);
|
||||
$("#console_log").append(`rewrite ^/[a-zA-Z0-9]+/[a-zA-Z]+/favicon\\.ico /favicon.ico break;\n`);
|
||||
}else{
|
||||
$("#console_log").append(`#检测到程序运行在非根目录,此环境仅提供安全规则!部分与伪静态相关的功能将不可用!\n`);
|
||||
}
|
||||
|
||||
});
|
||||
//清理缓存
|
||||
|
||||
@@ -35,6 +35,7 @@ $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 layui-btn-danger" lay-event="Del_OTP" title="移除OTP双重验证">移除OTP验证</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>
|
||||
@@ -163,6 +164,16 @@ layui.use(['table','layer','form'], function () {
|
||||
}else if(event == 'set_UserGroup'){
|
||||
IDs = tableIds;
|
||||
index = layer.open({type: 1,scrollbar: false,shadeClose: true,title: '修改用户组',area : ['100%', '100%'],content: $('.set_UserGroup')});
|
||||
}else if(event == 'Del_OTP'){
|
||||
layer.alert("以下账号将被移除OTP双重验证,确定继续吗?<br />"+table_Users,{icon:3,title:'确认操作',anim: 2,closeBtn: 0,btn: ['确定','取消']},function () {
|
||||
$.post(get_api('write_user_info','Del_OTP'),{ID:tableIds},function(data,status){
|
||||
if(data.code == 1){
|
||||
layer.msg(data.msg,{icon: 1})
|
||||
} else{
|
||||
layer.msg(data.msg,{icon: 5});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
//行工具
|
||||
|
||||
@@ -3,18 +3,16 @@ if($USER_DB['UserGroup'] != 'root'){$content='您没有权限访问此页面'; r
|
||||
$title='授权管理';require(dirname(__DIR__).'/header.php');
|
||||
$subscribe = unserialize(get_db('global_config','v',["k" => "s_subscribe"]));
|
||||
$HTTP_HOST = preg_replace('/:\d+$/','',$_SERVER['HTTP_HOST']); //去除端口号
|
||||
$Notice = get_db('global_config','v',['k'=>'notice']);
|
||||
if(!empty($Notice)){
|
||||
$data = json_decode($Notice, true);
|
||||
}
|
||||
?>
|
||||
<body>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<div class="layui-form layuimini-form layui-form-pane">
|
||||
<blockquote class="layui-elem-quote layui-text">
|
||||
<li>1. 查询授权时当前域名必须和订阅填写一致</li>
|
||||
<li>2. 其他二级域名使用时请手动输入订单号/邮箱保存</li>
|
||||
<li>3. 授权未绑定邮箱时邮箱留空,已绑定时请输入正确邮箱</li>
|
||||
<li>4. 如有其他疑问联系技术支持</li>
|
||||
</blockquote>
|
||||
<h3 style = "margin-bottom:1em;">当前域名:<font color="red"><?php echo $HTTP_HOST; ?></font> (订阅时填写)</h3>
|
||||
<h3 style = "margin-bottom:1em;">当前域名:<font color="red"><?php echo $HTTP_HOST; ?></font></h3>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">订单号</label>
|
||||
@@ -47,23 +45,34 @@ $HTTP_HOST = preg_replace('/:\d+$/','',$_SERVER['HTTP_HOST']); //去除端口号
|
||||
<div class="layui-btn-group">
|
||||
<button class="layui-btn layui-btn-normal" lay-submit lay-filter="set_subscribe">保存设置</button>
|
||||
<button class="layui-btn layui-btn-warm" lay-submit lay-filter="reset_subscribe">删除</button>
|
||||
<button class="layui-btn layui-btn-danger" id="help" sort_id="7968669">购买授权</button>
|
||||
<button class="layui-btn layui-btn-danger" lay-submit lay-filter="buy_vip" data-url="<?php echo empty($data['pay_rul']) ?'':$data['pay_rul']?>" >购买授权</button>
|
||||
<button class="layui-btn" lay-submit lay-filter="get_subscribe">查询授权</button>
|
||||
</div>
|
||||
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top:30px;"><legend>授权用户专享</legend></fieldset>
|
||||
<blockquote class="layui-elem-quote layui-text">
|
||||
<li>1. 可使用一键更新功能</li>
|
||||
<li>2. 可使用二级域名绑定账号功能</li>
|
||||
<li>3. 可使用链接检测功能</li>
|
||||
<li>4. 可自定义版权/用户组/默认配置等</li>
|
||||
<li>5. 可使用邀请码注册功能</li>
|
||||
<li>6. 可使用本地备份功能</li>
|
||||
<li>7. 可无限次数下载主题和系统更新</li>
|
||||
<li>8. 解锁全部功能和服务</li>
|
||||
<li>9. 更多专属功能开发中</li>
|
||||
<li>10. 可帮助TwoNav持续发展</li>
|
||||
<li>#. 技术支持:QQ 271152681 </li>
|
||||
<ul>
|
||||
<li>在线更新系统 ( 免费只能手动更新 )</li>
|
||||
<li>在线下载和更新主题模板</li>
|
||||
<li>批量更新链接标题/关键字/描述/图标</li>
|
||||
<li>批量识别链接是否可以访问</li>
|
||||
<li>可使用本地备份功能支持回滚等操作</li>
|
||||
<li>扩展功能:收录管理/留言管理/文章管理/链接扩展字段</li>
|
||||
<li>可配置邮件服务用于注册时发送验证</li>
|
||||
<li>可配置初始设置 (新用户注册后的默认配置) </li>
|
||||
<li>可配置本地获取图标服务并支持缓存防盗链等配置</li>
|
||||
<li>可开启全站私有模式降低因用户添加违规链接导致封站的风险</li>
|
||||
<li>可自定义用户组权限,对不可信的用户禁止使用高危功能(如自定义代码)</li>
|
||||
<li>可自定义主页版权信息,可使用二级域名直接访问用户主页</li>
|
||||
<li>可自定义全局header代码和footer代码</li>
|
||||
<li>可限制用户添加链接标题描述等长度</li>
|
||||
<li>可设置保留账号,支持正字表达式 (保留账号列表不可以被用户注册)</li>
|
||||
<li>可设置生成注册码/配置注册提示等 (如需关注公众号或付费购买注册码才可以注册)</li>
|
||||
<li>支持生成sitemap.xml网站地图用于优化SEO,提高收录效果</li>
|
||||
<li>支持百度推送API(链接列表和文章列表),提高收录效果</li>
|
||||
<li>还有其他细节就不逐一举例了,TwoNav的发展离不开大家的支持</li>
|
||||
<li>未来还会增加更多专属功能, 技术支持:QQ 271152681 </li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
</div>
|
||||
</div>
|
||||
@@ -117,6 +126,13 @@ layui.use(['jquery','form'], function () {
|
||||
console.log(data.field)
|
||||
return false;
|
||||
});
|
||||
//购买授权
|
||||
form.on('submit(buy_vip)', function(data){
|
||||
let url = $(this).attr('data-url');
|
||||
url = url.length > 0 ? url : 'https://gitee.com/tznb/TwoNav/wikis/pages?sort_id=7968669&doc_id=3767990';
|
||||
window.open($(this).attr('data-url'));
|
||||
return false;
|
||||
});
|
||||
|
||||
//清空订阅信息
|
||||
form.on('submit(reset_subscribe)', function(data){
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<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">注意: 存在备用链接时停留时间可能无效!</blockquote>
|
||||
<blockquote class="layui-elem-quote layui-text">注意: 存在备用链接时停留时间可能无效,需模板支持!</blockquote>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">访客停留</label>
|
||||
<div class="layui-input-inline">
|
||||
@@ -33,7 +33,7 @@
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block"><button class="layui-btn layui-btn-normal" lay-submit lay-filter="save">保存</button></div>
|
||||
<div 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">保存</button></div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -60,6 +60,10 @@ layui.use(['jquery','form'], function () {
|
||||
});
|
||||
return false;
|
||||
});
|
||||
//关闭按钮
|
||||
$(document).on('click', '#close', function() {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
58
templates/admin/page/set_verify.php
Normal file
58
templates/admin/page/set_verify.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php $title='验证页面 - 设置'; require '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">注意事项: 需模板支持,提示内容以http开头则打开网页,其他内容则弹出提示<br />使用场景: 加密链接/加密分类/二级密码/书签分享等</blockquote>
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">加密链接</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="link_tip" class="layui-textarea" placeholder='查看加密链接或分类时提示如何获取密码,可为空'></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">书签分享</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="share_tip" class="layui-textarea" placeholder='获取书签分享提取码的提示,可为空'></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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">保存</button></div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script src = "<?php echo $libs;?>/jquery/jquery-3.6.0.min.js"></script>
|
||||
<?php load_static('js.layui');?>
|
||||
<script>
|
||||
layui.use(['jquery','form'], function () {
|
||||
var form = layui.form,
|
||||
layer = layui.layer;
|
||||
|
||||
//表单赋值
|
||||
form.val('form', <?php echo json_encode(unserialize( get_db("user_config", "v", ["k" => "s_verify_page","uid"=>$USER_DB['ID']]) ));?>);
|
||||
|
||||
//监听提交
|
||||
form.on('submit(save)', function (data) {
|
||||
$.post('./index.php?c=api&method=write_verify_page&u='+u,data.field,function(data,status){
|
||||
if(data.code == 1) {
|
||||
layer.msg(data.msg, {icon: 1});
|
||||
}else{
|
||||
layer.msg(data.msg, {icon: 5});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
//关闭按钮
|
||||
$(document).on('click', '#close', function() {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
36
templates/admin/page/theme.php
Normal file
36
templates/admin/page/theme.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php $title='主题管理';$awesome=true; require 'header.php';?>
|
||||
<style>
|
||||
.tab-header .layui-btn.layui-this{border-color: #1E9FFF; color: #1E9FFF;}
|
||||
.screenshot{
|
||||
width: 99%;
|
||||
height: 99%;
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
aspect-ratio:16/9;
|
||||
}
|
||||
.layui-btn-container .layui-btn {
|
||||
margin-right: 5px;
|
||||
}
|
||||
#default #del {display: none;}
|
||||
</style>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<div class="tab-header layui-btn-container" id="tab" style="margin-left: 5px;"></div>
|
||||
<div class="layui-bg-gray" style="padding: 1px;" >
|
||||
<div class="layui-row layui-col-space15"></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 src="./templates/admin/js/theme.js?v=<?php echo $Ver;?>"></script>
|
||||
<script>
|
||||
const is_admin = <?php echo $USER_DB['UserGroup'] === 'root' ? 'true' : 'false'; ?>;
|
||||
const theme_set = <?php echo check_purview('theme_set',1) ? 'true' : 'false'; ?>;
|
||||
const apply = <?php echo check_purview('apply',1) ? 'true' : 'false'; ?>;
|
||||
const guestbook = <?php echo check_purview('guestbook',1) ? 'true' : 'false'; ?>;
|
||||
const article = <?php echo check_purview('article',1) ? 'true' : 'false'; ?>;
|
||||
const loginAddress = '<?php echo $USER_DB['Login']; ?>';
|
||||
</script>
|
||||
@@ -2,6 +2,68 @@
|
||||
<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.38-20230906</h4>
|
||||
<ul>
|
||||
<li>[变更] 初始化安装默认关闭防XSS和SQL(个人使用没必要开启,会导致自定义代码时被拦截)</li>
|
||||
<li>[变更] 后台概要页获取IP列表时对IP进行排序,以方便观察非正常访问的IP(如爬虫)</li>
|
||||
<li>[变更] Nginx部分伪静态规则由程序接管,避免更新规则时用户需手动配置伪静态 (需将生成的规则重新配置到服务器)</li>
|
||||
<li>[变更] 授权管理页面内容更新</li>
|
||||
<li>[新增] 系统设置中新增站点地图入口,可配置生成sitemap.xml站点地图的参数! (首次使用请看顶部说明)</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.37-20230831</h4>
|
||||
<ul>
|
||||
<li>[变更] 优化前端前置处理代码,让模板调用数据更加灵活</li>
|
||||
<li>[新增] 支持更换验证模板/收录模板/留言模板</li>
|
||||
<li>[新增] 验证模板支持设置提示内容,如获取密码的提示</li>
|
||||
<li>[新增] 挽风导航V1的收录模板和留言模板</li>
|
||||
<li>[新增] 4个简约风格的验证模板</li>
|
||||
<li>[修复] 文章编辑器输入HTML代码时在编辑存在异常的问题</li>
|
||||
<li>[修复] 文章标题/摘要存在HTML标签时被解析的问题</li>
|
||||
<li>[修复] WebStack-Hugo主页模板4个已知问题</li>
|
||||
<li>[修复] 特定情况下安装时使用MySQL数据库可能乱码的问题</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.36-20230824</h4>
|
||||
<ul>
|
||||
<li>[修复] 判断是否显示收录的逻辑错误(导致设为无需审核时不显示)</li>
|
||||
<li>[变更] 移除2个链接图标API,因稳定性欠佳</li>
|
||||
<li>[修复] WebStack-Hugo主页模板悬停提示不显示</li>
|
||||
<li>[新增] 挽风导航主页模板(内置文章模板/拟态风格),注:内置文章模板在预览状态下是不生效的!</li>
|
||||
<li>[新增] 挽风导航登录模板/过度模板</li>
|
||||
<li>[新增] 后台概要页可以点击报表统计获取访问的IP列表</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.35-20230816</h4>
|
||||
<ul>
|
||||
<li>[新增] Atool工具箱增加关闭OTP双重验证选项(删OTP),用于解决站长丢失OTP令牌造成无法登录</li>
|
||||
<li>[新增] 用户管理支持关闭OTP双重验证选项,用于站长帮助用户关闭OTP双重验证</li>
|
||||
<li>[优化] 邮件配置发送人只填发送人名称未按要求格式填写邮箱时由系统自动完成拼接</li>
|
||||
<li>[优化] 文章管理特定情况造成缺少资源时提醒用户如何解决</li>
|
||||
<li>[模板] 新增爱导航V1主页模板,轻量化设计简洁不卡顿/支持缓存/自适应/站内搜索,适合书签多的用户使用</li>
|
||||
<li>[模板] WebStack-Hugo主页模板新增:夜间背景图/炫彩横幅</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">
|
||||
|
||||
107
templates/apply/default/index.php
Normal file
107
templates/apply/default/index.php
Normal file
@@ -0,0 +1,107 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-cn">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>申请收录</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<link rel='stylesheet' href='<?php echo $layui['css']; ?>'>
|
||||
<style>
|
||||
body{background-color:rgba(0, 0, 51, 0.8);}
|
||||
.title{max-width: 400px;height: auto;margin-left: auto;margin-right: auto;margin-top:5em;}
|
||||
.title h1{color:#FFFFFF;text-align: center;}
|
||||
.required {color: red;margin-left: 5px;float: right;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="layui-container">
|
||||
<div class="layui-row">
|
||||
<div class="title">
|
||||
<h1>申请收录</h1>
|
||||
</div>
|
||||
<div class="layui-col-lg6 layui-col-md-offset3" style ="margin-top:3em;">
|
||||
<form class="layui-form layui-form-pane" action="" lay-filter="apply">
|
||||
|
||||
<div class="layui-form-item" style="color: #fbfbfb;">
|
||||
<?php echo $apply['Notice'];?>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">网站标题<span class="required">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="title" required lay-verify="required" placeholder="例如 百度一下" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">网站链接<span class="required">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<input type="url" name="url" required lay-verify="required|url" placeholder="例如 https://www.baidu.com" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">网站分类<span class="required">*</span></label>
|
||||
<div class="layui-input-block">
|
||||
<select name="category_id" lay-verify="required" lay-search>
|
||||
<option ></option>
|
||||
<?php echo_category(false);//输出公开分类 ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">网站图标</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="url" name="iconurl" lay-verify="url" placeholder="例如 https://www.baidu.com/favicon.ico" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">网站描述</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="description" placeholder="例如 搜索引擎" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">联系邮箱</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="email" placeholder="例如 admin@qq.com" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<button class="layui-btn" lay-submit lay-filter="submit" style = "width:100%;">提交</button>
|
||||
</div>
|
||||
</form>
|
||||
<?php if( is_login() ) { echo
|
||||
'<div class="layui-form-item"><button class="layui-btn" lay-submit lay-filter="test" style = "width:100%;">生成测试数据 (自己登录时才显示此按钮)</button></div>'
|
||||
;} ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src='<?php echo $layui['js']; ?>'></script>
|
||||
<script>
|
||||
layui.use(['form','layer'], function(){
|
||||
var form = layui.form;
|
||||
var $ = layui.jquery;
|
||||
|
||||
form.on('submit(submit)', function(data){
|
||||
$.post('',data.field,function(re,status){
|
||||
if(re.code == 1) {
|
||||
layer.msg(re.msg, {icon: 1});
|
||||
}else{
|
||||
layer.msg(re.msg, {icon: 5});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});<?php if( is_login() ) { echo '
|
||||
//生成测试数据
|
||||
form.on("submit(test)", function(data){
|
||||
form.val("apply", {
|
||||
"title": "百度一下"
|
||||
,"url": "https://"+ Math.round(new Date()) +".baidu.com"
|
||||
,"iconurl": "https://www.baidu.com/favicon.ico"
|
||||
,"description": "搜索引擎"
|
||||
,"email": "admin@qq.com"
|
||||
});
|
||||
return false;
|
||||
});' ;} ?>
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
8
templates/apply/default/info.json
Normal file
8
templates/apply/default/info.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "默认模板",
|
||||
"description": "默认",
|
||||
"homepage": "https://gitee.com/tznb/TwoNav",
|
||||
"version": "2.0.0",
|
||||
"update": "2023/08/25",
|
||||
"author": "TwoNav"
|
||||
}
|
||||
BIN
templates/apply/default/screenshot.jpg
Normal file
BIN
templates/apply/default/screenshot.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name":"默认",
|
||||
"name":"默认模板",
|
||||
"description":"系统默认的文章模板,支持代码段上色,支持自适应!",
|
||||
"homepage":"https://gitee.com/tznb/TwoNav",
|
||||
"version":"2.0.0",
|
||||
|
||||
87
templates/guestbook/default/index.php
Normal file
87
templates/guestbook/default/index.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php ?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title><?php echo $site['title'];?> - 极简留言板</title>
|
||||
<link rel='stylesheet' href='<?php echo $layui['css']; ?>'>
|
||||
<style>
|
||||
.layui-form-item {
|
||||
margin-bottom: 10px;
|
||||
height: 38px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<!-- 内容主体区域 -->
|
||||
|
||||
<div class="layui-row" style = "margin-top:18px;">
|
||||
|
||||
<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>极简留言板</legend></fieldset>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">反馈类型</label>
|
||||
<div class="layui-input-inline">
|
||||
<select lay-verify="required" id="type" name="type" lay-search >
|
||||
<option value="投诉建议" >投诉建议</option>
|
||||
<option value="问题反馈" selected="" >问题反馈</option>
|
||||
<option value="商务合作" >商务合作</option>
|
||||
<option value="其他" >其他</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">联系方式</label>
|
||||
<div class="layui-input-inline" >
|
||||
<input id = "contact" name="contact" value = "" placeholder="仅管理员可见" required lay-verify="required" class="layui-input" maxlength="64">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">标题</label>
|
||||
<div class="layui-input-block" >
|
||||
<input id = "title" name="title" value = "" placeholder="" required lay-verify="required" class="layui-input" maxlength="128">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-text">
|
||||
<label class="layui-form-label">内容</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea id = "content" name="content" rows = "10" class="layui-textarea" required lay-verify="required" maxlength="2048"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item" style="padding-top: 10px;">
|
||||
<div class="layui-input-block">
|
||||
<?php if($s['allow'] == '1'){ echo '<button class="layui-btn" lay-submit lay-filter="Submit">提交</button>';} ?>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
|
||||
<legend><?php echo $copyright;?></legend>
|
||||
<!--非订阅用户请勿去除版权,谢谢-->
|
||||
</fieldset>
|
||||
</div>
|
||||
<!-- 内容主题区域END -->
|
||||
</div>
|
||||
<script src = '<?php echo $libs?>/jquery/jquery-3.6.0.min.js'></script>
|
||||
<script src = '<?php echo $layui['js']; ?>'></script>
|
||||
<script>
|
||||
layui.use(['form'], function(){
|
||||
var form = layui.form;
|
||||
form.on('submit(Submit)', function(data){
|
||||
$.post('',data.field,function(data,status){
|
||||
if(data.code == 1) {
|
||||
layer.msg(data.msg, {icon: 1});
|
||||
setTimeout(() => {location.reload();}, 1000);
|
||||
}else{
|
||||
layer.msg(data.msg, {icon: 5});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
8
templates/guestbook/default/info.json
Normal file
8
templates/guestbook/default/info.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "默认模板",
|
||||
"description": "默认",
|
||||
"homepage": "https://gitee.com/tznb/TwoNav",
|
||||
"version": "2.0.0",
|
||||
"update": "2023/08/25",
|
||||
"author": "TwoNav"
|
||||
}
|
||||
BIN
templates/guestbook/default/screenshot.jpg
Normal file
BIN
templates/guestbook/default/screenshot.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "默认",
|
||||
"name": "默认模板",
|
||||
"description": "模板来自于html5up.net",
|
||||
"homepage": "https://gitee.com/tznb/TwoNav",
|
||||
"version": "2.0.0",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "默认",
|
||||
"name": "默认模板",
|
||||
"description": "默认",
|
||||
"homepage": "https://gitee.com/tznb/TwoNav",
|
||||
"version": "2.0.4",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "默认",
|
||||
"name": "默认模板",
|
||||
"description": "默认",
|
||||
"homepage": "https://gitee.com/tznb/TwoNav",
|
||||
"version": "2.0.0",
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-cn" xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta charset="utf-8">
|
||||
<title><?php echo $link['title']; ?> - <?php echo $site['title']; ?></title>
|
||||
<meta name="keywords" content="<?php echo $link['keywords']; ?>" />
|
||||
<meta name="description" content="<?php echo $link['description']; ?>" />
|
||||
<meta name="keywords" content="<?php echo $link['keywords']; ?>">
|
||||
<meta name="description" content="<?php echo $link['description']; ?>">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="<?php echo $libs?>/bootstrap4/css/bootstrap.min.css" type="" media=""/>
|
||||
<meta http-equiv = "X-UA-Compatible" content = "IE=edge" >
|
||||
<link rel="stylesheet" href="<?php echo $libs?>/bootstrap4/css/bootstrap.min.css" crossorigin="anonymous">
|
||||
<link rel="shortcut icon" href="<?php echo $favicon;?>">
|
||||
<!--<script src="<?php echo $libs?>/jquery/jquery-2.2.4.min.js"></script>-->
|
||||
<!--<script src="<?php echo $libs?>/bootstrap4/js/bootstrap.min.js"></script>-->
|
||||
<script src="<?php echo $libs?>/jquery/jquery-2.2.4.min.js"></script>
|
||||
<script src="<?php echo $libs?>/bootstrap4/js/bootstrap.min.js" crossorigin="anonymous"></script>
|
||||
<style>
|
||||
.a_d img{
|
||||
max-width:100%;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name":"OneNav1",
|
||||
"name":"默认模板",
|
||||
"description":"OneNav旧版过渡页",
|
||||
"homepage":"https://www.xiaoz.me",
|
||||
"version":"2.0.2",
|
||||
|
||||
91
templates/verify/default/index.php
Normal file
91
templates/verify/default/index.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php if(!defined('DIR')){header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit;}?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title><?php echo $data['title'];?> - <?php echo $site['subtitle']?></title>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta http-equiv="Access-Control-Allow-Origin" content="*">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="format-detection" content="telephone=no">
|
||||
<link rel="stylesheet" href="<?php echo $layui['css']; ?>">
|
||||
<link rel="stylesheet" href="<?php echo $libs?>/Other/login.css">
|
||||
<link rel="shortcut icon" href="<?php echo $favicon;?>">
|
||||
</head>
|
||||
<body>
|
||||
<div class="main-body">
|
||||
<div class="login-main">
|
||||
<div class="login-top">
|
||||
<span><?php echo $data['tip'];?></span>
|
||||
<span class="bg1"></span>
|
||||
<span class="bg2"></span>
|
||||
</div>
|
||||
<form class="layui-form login-bottom">
|
||||
<div class="center">
|
||||
<div class="item">
|
||||
<span class="icon icon-3"></span>
|
||||
<input type="password" name="Password" id="Password" lay-verify="required" placeholder="<?php echo $data['input_tip'];?>" value="<?php echo $_GET['pwd'];?>">
|
||||
<span class="bind-password icon icon-4"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tip">
|
||||
<?php if(!empty($data['get_tip'])){ ?>
|
||||
<a href="javascript:;" onclick="showInfo('<?php echo base64_encode($data['get_tip'])?>')">如何获取?</a>
|
||||
<?php }?>
|
||||
</div>
|
||||
<div class="layui-form-item" style="text-align:center; width:100%;height:100%;margin:0px;">
|
||||
<button class="login-btn"id="verify">验证</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer"><?php echo $copyright;?></div>
|
||||
<script src="<?php echo $libs?>/jquery/jquery-3.6.0.min.js"></script>
|
||||
<script type="text/javascript" src="<?php echo $libs?>/Layer/v3.3.0/layer.js"></script>
|
||||
<script>
|
||||
$('#verify').on('click', function () {
|
||||
Password = $("#Password").val();
|
||||
if( Password == ''){
|
||||
layer.msg("<?php echo $data['input_tip'];?>", {icon: 5});
|
||||
$('#Password').focus();
|
||||
return false;
|
||||
}
|
||||
$.post('<?php echo $data['post_url']; ?>',{'Password':Password},function(re,status){
|
||||
if(re.code == 1) {
|
||||
layer.msg('正在验证..', {icon: 16,shade: [0.1, '#f5f5f5'],scrollbar: false,offset: 'auto',time: 888,
|
||||
end: function() {
|
||||
window.location.reload();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}else{
|
||||
layer.msg(re.msg, {icon: 5});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
// 显示密码
|
||||
$('.bind-password').on('click', function () {
|
||||
if ($(this).hasClass('icon-5')) {
|
||||
$(this).removeClass('icon-5');
|
||||
$("input[name='Password']").attr('type', 'password');
|
||||
} else {
|
||||
$(this).addClass('icon-5');
|
||||
$("input[name='Password']").attr('type', 'text');
|
||||
}
|
||||
});
|
||||
function showInfo($base64) {
|
||||
var content =decodeURIComponent(escape(window.atob($base64)));
|
||||
if(content.startsWith("http")){
|
||||
window.open(content);
|
||||
return false;
|
||||
}
|
||||
layer.open({type: 1,title: '如何获取',btn: ['知道了'],
|
||||
content: '<div style="padding: 20px; line-height: 22px; font-weight: 300;"><?php echo $data['get_tip'];?></div>'
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
8
templates/verify/default/info.json
Normal file
8
templates/verify/default/info.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "默认模板",
|
||||
"description": "默认",
|
||||
"homepage": "https://gitee.com/tznb/TwoNav",
|
||||
"version": "2.0.0",
|
||||
"update": "2023/08/25",
|
||||
"author": "TwoNav"
|
||||
}
|
||||
BIN
templates/verify/default/screenshot.jpg
Normal file
BIN
templates/verify/default/screenshot.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 58 KiB |
Reference in New Issue
Block a user