mirror of
https://github.com/tznb1/TwoNav.git
synced 2025-08-10 08:51:49 +00:00
v2.0.38-20230906
This commit is contained in:
@@ -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]
|
||||
|
||||
@@ -79,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;
|
||||
@@ -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'){
|
||||
@@ -1823,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);
|
||||
@@ -2026,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;
|
||||
|
||||
@@ -798,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,'保存成功');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -288,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'; //维护模式
|
||||
|
||||
@@ -55,7 +55,7 @@ if($c == 'index'){
|
||||
$dir_path = DIR.'/templates/guestbook';
|
||||
}elseif($c == 'apply'){ //收录
|
||||
$theme = $s_templates['apply'];
|
||||
$dir_path = DIR.'/templates/guestbook/';
|
||||
$dir_path = DIR.'/templates/apply/';
|
||||
}elseif($c == $global_config['Login'] || $c == $USER_DB['Login']){ //登录
|
||||
$theme = $s_templates['login'];
|
||||
$dir_path = DIR.'/templates/login';
|
||||
|
||||
@@ -1 +1 @@
|
||||
v2.0.37-20230830
|
||||
v2.0.38-20230906
|
||||
@@ -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'
|
||||
|
||||
@@ -143,7 +143,7 @@ layui.use(function(){
|
||||
${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' && active == 'home' ? '<button type="button" class="layui-btn layui-btn-sm layui-btn-normal" id="preview">预览</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>
|
||||
|
||||
@@ -216,6 +216,7 @@ const toolbar = createToolbar({
|
||||
})
|
||||
|
||||
|
||||
|
||||
layui.use(['form','upload'], function () {
|
||||
var form = layui.form,
|
||||
upload = layui.upload;
|
||||
@@ -308,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) {
|
||||
|
||||
@@ -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;
|
||||
@@ -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') ) {
|
||||
|
||||
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>
|
||||
@@ -365,6 +365,7 @@ if($USER_DB['UserGroup'] == 'root'){
|
||||
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>';
|
||||
});
|
||||
|
||||
@@ -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>
|
||||
@@ -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`);
|
||||
}
|
||||
|
||||
});
|
||||
//清理缓存
|
||||
|
||||
@@ -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){
|
||||
|
||||
@@ -5,7 +5,22 @@
|
||||
<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-20230830</h4>
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user