v2.1.01-20231002

This commit is contained in:
MI15\Win
2023-10-04 16:30:28 +08:00
parent 91950de997
commit 979295c684
61 changed files with 1079 additions and 1116 deletions

View File

@@ -2,16 +2,4 @@
RewriteEngine On
# 安全规则(必选)
RewriteRule ^templates/.*\.(php|tar|gz|zip|info|log|json)$ - [F]
RewriteRule ^data/.*\.(db|db3|php|sql|tar|gz|zip|info|log|json)$ - [F]
# 重写规则(可选)
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 '^([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]
RewriteRule ^data/.*\.(db|db3|php|sql|tar|gz|zip|info|log|json)$ - [F]

View File

@@ -7,6 +7,19 @@ TwoNav 是一款开源的书签(导航)管理程序,界面简洁,安装
* [安装教程](https://gitee.com/tznb/TwoNav/wikis/pages?sort_id=7968668&doc_id=3767990) | [使用说明](https://gitee.com/tznb/TwoNav/wikis) | [下载TwoNav](https://gitee.com/tznb/TwoNav/releases)
* [OneNav Extend 升级到 TwoNav](https://gitee.com/tznb/OneNav/wikis/pages?sort_id=7955135&doc_id=2439895)
### 作者声明
* 本程序没有二开版、除了下面的项目地址均为盗版。
* 使用盗版软件存在法律风险且没有任何保障。
* 未经许可禁止用于商业用途、转载请保留作品出处。
### 项目由来
```
起初只是搭建一个自己的书签站、网上找了一圈看中了小z的OneNav。
因功能无法满足我,开始基于ONeNav各种魔改、然后就有了OneNav Extend、这个名字还是小z给取的。
后来和小z都开始收费后、由于用户容易搞混等各种原因、于是我重写代码并改名为TwoNav。
其中一些OneNav的特色依旧是保留下来、并兼容OneNav的一些插件。
```
### 项目地址
- [https://gitee.com/tznb/TwoNav](https://gitee.com/tznb/TwoNav)
- [https://github.com/tznb1/TwoNav](https://github.com/tznb1/TwoNav)

View File

@@ -1 +1 @@
临时目录,可删除
临时目录,可删除

View File

@@ -39,9 +39,22 @@ $layui['css'] = $libs.'/Layui/v2.8.17/css/layui.css';
define('libs',$global_config['Libs']);
define('SysVer',Get_Version());
define('Debug',$global_config['Debug'] == 1);
define('static_link',$global_config['static_link'] > 0);
if(!in_array($c,[$global_config["Register"],'ico','icon'])){
if($global_config['static_link'] > 0 && !empty($UUID)){
$_GET['u'] = $global_config['static_link'] == 2 ? get_db("global_user", "User", ["ID"=>$UUID]) : $UUID;
}
$u = Get('u');
if(empty($u) && $global_config['Sub_domain'] == 1 && is_subscribe('bool')){
$cut = explode('.',$_SERVER["HTTP_HOST"]);
if(count($cut) == 3){
$USER_DB = get_db("global_user", "*", ["User"=>reset($cut)]);
if(!empty($USER_DB) && check_purview('Sub_domain',1)){
$_COOKIE['Default_User'] = $USER_DB['User'];unset($cut);
}
}
}
$u = !empty($u)?$u:(!empty($_COOKIE['Default_User'])?$_COOKIE['Default_User']:(!empty($global_config['Default_User'])?$global_config['Default_User']:'admin'));//优先级:Get>Host>Cookie>默认用户>admin
$USER_DB = get_db("global_user", "*", ["User"=>$u]);
//没找到账号显示404

View File

@@ -2,25 +2,45 @@
define('URI',$_SERVER['REQUEST_URI']);
//登录页和管理员(默认)
if (URI === '/login' || URI === '/admin') {
//登录/管理/注册页面(不带html)
if (URI === '/login' || URI === '/admin' || URI == '/register') {
$_GET['c'] = substr(URI, 1);
//管理页面
}elseif (preg_match('/^\/admin-([A-Za-z0-9]+)\.html?$/', URI, $matches)) {
$_GET['c'] = 'admin';
$UUID = $matches[1];
//专属登录页面
}elseif (preg_match('/^\/login-([A-Za-z0-9]+)-([A-Za-z0-9]+)\.html?$/', URI, $matches)) {
$UUID = $matches[1];
$_GET['c'] = $matches[2];
//收录和留言
}elseif (preg_match('/^\/(apply|guestbook)-([A-Za-z0-9]+)\.html?$/', URI, $matches)) {
$_GET['c'] = $matches[1];
$UUID = $matches[2];
//本地图标
}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]+)\.html?$/', URI, $matches)) {
$UUID = $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];
}elseif(preg_match('/^\/(click|article)-([A-Za-z0-9]+)-(\d+)\.html?$/', URI, $matches)) {
$_GET['c'] = $matches[1];
$UUID = $matches[2];
$_GET['id'] = $matches[3];
//分类页面
}elseif(preg_match('/^\/category-([A-Za-z0-9]+)-(\d+)\.html?$/', URI, $matches)) {
$_GET['c'] = 'index';
$UUID = $matches[1];
$_GET['oc'] = $matches[2];
//站点地图
}elseif(URI === '/sitemap.xml'){
$_GET['c'] = 'sitemap';
//匹配失败
}else{
header("HTTP/1.0 404 Not Found");
exit("404 Not Found.");
exit("404 Not Found.<br>".URI);
}
include 'index.php';

View File

@@ -37,7 +37,7 @@ class PHPGangsta_GoogleAuthenticator
}
$secretkey = $this->_base32Decode($secret);
$time = chr(0).chr(0).chr(0).chr(0).pack('N*', $timeSlice);
$time = chr(0). chr(0) .chr(0). chr(0) .pack('N*', $timeSlice);
$hm = hash_hmac('SHA1', $time, $secretkey, true);
$offset = ord(substr($hm, -1)) & 0x0F;
$hashpart = substr($hm, $offset, 4);

18
system/MySQL/20230917.php Normal file
View File

@@ -0,0 +1,18 @@
<?php if(!defined('DIR')){header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit;}
// 检测是否已授权
if(is_subscribe('bool')){
//读取授权信息,判断是否存在秘钥
$subscribe = unserialize(get_db('global_config','v',["k" => "s_subscribe"]));
if(!isset($subscribe['public']) || empty($subscribe['public'])){
//尝试从服务器下载秘钥
$Res = ccurl("https://service.twonav.cn/api.php?fn=get_subscribe&order_id={$subscribe['order_id']}&email={$subscribe['email']}&domain={$subscribe['domain']}&mark=20230917",30,true);
$data = json_decode($Res["content"], true);
// 获取成功
if($data["code"] == 200){
$subscribe['public'] = $data['data']['public'];
$subscribe['type'] = $data['data']['type'];
$subscribe['type_name'] = $data['data']['type_name'];
write_global_config('s_subscribe',$subscribe,'订阅信息');
}
}
}

View File

@@ -57,49 +57,6 @@ if(!preg_match('/^[A-Za-z0-9]{4,13}$/', $user)){
msg(-1,'该账号已被站长保留!');
}
//读取邮件配置
$mail_config = get_db("global_config","v",["k"=>"mail_config"]);
if(!empty($mail_config)){
$mail_config = unserialize($mail_config);
if($mail_config['verify_email'] == 1 && $_GET['type'] == 'getcode'){
//判断是否频繁发送
$send_interval = intval($mail_config['send_interval']);
if($send_interval > 0 && has_db('user_log',['type'=>'send_email','ip'=>$IP,'time[>]'=>time() - $send_interval])){
msg(-1,'请勿频繁获取验证码');
}
$mail_config['addressee'] = $_POST['Email'];
$mail_config['Subject'] = '验证码';
$code = mt_rand(100000,999999);
if(!strstr($mail_config['verify_template'],'$code')){
$mail_config['verify_template'] = '您的验证:$code';
}
$mail_config['Body'] = empty($mail_config['verify_template']) ? '您的验证:'.$code:str_replace('$code', $code, $mail_config['verify_template']);
$mail_config['return']='bool';
if(send_email($mail_config)){
session_start();
$_SESSION["{$_POST['Email']}"]['code'] = "$code";
$_SESSION["{$_POST['Email']}"]['time'] = time();
insert_db("user_log", ["uid" => 0,"user"=>$user,"ip"=>$IP,"time"=>time(),"type" => 'send_email',"content"=>Get_Request_Content(),"description"=>"发送注册验证码:".$code.', 接收邮箱: '.$_POST['Email']]);
msg(1,'发送成功');
}else{
msg(-1,'发送失败');
}
exit;
}
}
//验证码效验
if(!empty($mail_config['verify_email']) && $mail_config['verify_email'] == 1){
session_start();
if(empty($_POST['code'])){
msg(-1,'请输入验证码');
}elseif ($_POST['code'] != $_SESSION["{$_POST['Email']}"]['code']) {
msg(-1,'验证码错误'.$_SESSION["{$_POST['Email']}"]['code']);
}elseif($_SESSION["{$_POST['Email']}"]['time'] + 300 < time()){
msg(-1,'验证码已过期');
}
unset($_SESSION["{$_POST['Email']}"]);
}
//插入用户表和创建初始数据库
$RegTime = time();
$PassMD5 = Get_MD5_Password($pass,$RegTime);

View File

@@ -0,0 +1,18 @@
<?php if(!defined('DIR')){header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit;}
// 检测是否已授权
if(is_subscribe('bool')){
//读取授权信息,判断是否存在秘钥
$subscribe = unserialize(get_db('global_config','v',["k" => "s_subscribe"]));
if(!isset($subscribe['public']) || empty($subscribe['public'])){
//尝试从服务器下载秘钥
$Res = ccurl("https://service.twonav.cn/api.php?fn=get_subscribe&order_id={$subscribe['order_id']}&email={$subscribe['email']}&domain={$subscribe['domain']}&mark=20230917",30,true);
$data = json_decode($Res["content"], true);
// 获取成功
if($data["code"] == 200){
$subscribe['public'] = $data['data']['public'];
$subscribe['type'] = $data['data']['type'];
$subscribe['type_name'] = $data['data']['type_name'];
write_global_config('s_subscribe',$subscribe,'订阅信息');
}
}
}

View File

@@ -18,7 +18,7 @@ if($_GET['type'] == 'upload'){
//取后缀并判断是否支持
$suffix = strtolower(end(explode('.',$_FILES["file"]["name"])));
if(!preg_match('/^(db3|html)$/i',$suffix)){
if(!preg_match('/^(db3|html|itabdata)$/i',$suffix)){
@unlink($_FILES["file"]["tmp_name"]);
msg(-1,'文件格式不被支持!');
}
@@ -384,6 +384,87 @@ if($_GET['type'] == 'upload'){
}
}
msg(-1,'导入失败.');
}elseif($_GET['type'] == 'itabdata'){
$temp_path = $_SESSION['upload_bookmark'][UID][$sid];
$content = file_get_contents($temp_path);
$data = json_decode($content, true);
if(!isset($data['navConfig']) || empty($data['navConfig'])){
msg(-1,'数据解析失败,请确认导入的是iTab备份的数据,且导出内容包含图标');
}
$time = time();
$success = 0; $fail = 0; $total = 0;$res = '';
$res='<table class="layui-table" lay-even><colgroup><col width="200"><col width="250"><col></colgroup><thead><tr><th>标题</th><th>URL</th><th>失败原因</th></tr></thead><tbody>';
foreach($data['navConfig'] as $key => $category){
if(!isset($category['children']) || empty($category['children'])){
continue; //分类下没数据则跳过
}
//分类名称不错在时创建
if(!has_db('user_categorys',['name'=>$category['name']]) ){
insert_db('user_categorys',[
'uid'=>UID,
'cid'=>get_maxid('category_id'),
'fid'=>0,
'pid'=>0,
'status'=>1,
'property'=>1,
'name'=>$category['name'],
'add_time'=>$time,
'up_time'=>$time,
'weight'=>0,
'description'=>'',
'font_icon'=>'fa fa-user',
'icon'=>''
]
);
}
// 读取分类ID
$category_id = get_db('user_categorys','cid',['uid'=>UID,'name'=>$category['name']]);
if(empty($category_id)){
msg(-1,'意外结束:创建或读取分类信息失败!');
}
$total += count($category['children']);
//遍历链接
foreach($category['children'] as $link){
$id = get_db('user_links','id',['uid'=>UID,'url'=>$link['url'] ]);
if(!empty($id)){
$res=$res.'<tr><td>'.mb_substr($link['name'], 0, 30).'</td><td>'.mb_substr($link['url'], 0, 40).'</td><td>URL重复'.'</td></tr>';
$fail++;
continue;
}
if(empty($id) && strpos($link['url'], "http") === 0 ){
insert_db('user_links',[
'uid' => UID,
'lid' => get_maxid('link_id'),
'fid' => $category_id,
'add_time' => $time,
'up_time' => $time,
'weight' => 0,
'title' => $link['name'] ,
'url' => $link['url'],
'property' => 0,
'icon' => '', // "{$link['src']}",
'status' => 1
]);
$success++;
}else{
$res=$res.'<tr><td>'.mb_substr($link['name'], 0, 30).'</td><td>'.mb_substr($link['url'], 0, 40).'</td><td>'.$link['name'].' >> 不是链接'.'</td></tr>';
$fail++;
}
}
}
$data = [
'code' => 1,
'msg' => '总数:'.$total.' 成功:'.$success.' 失败:'.$fail,
'res' => $res.'</tbody></table>',
'fail' => $fail
];
//删除文件和变量
unlink($temp_path);
unset($_SESSION['upload_bookmark'][UID][$sid]);
msgA($data);
}elseif($_GET['type'] == 'data_empty'){
//验证密码
global $USER_DB;

View File

@@ -4,8 +4,5 @@ if(!defined('DIR')){
header("status: 404 Not Found");
exit;
}else{
if(!is_subscribe('bool')){
msg(-1,"未检测到有效授权,无法使用该功能!");
}
msg(1,'请更新系统后再试');
msg_tip();
}

View File

@@ -47,7 +47,7 @@ if(in_array($api_model,['compatible','compatible+open']) && in_array($method,$co
}
//站长相关方法名
$root = ['write_subscribe','write_sys_settings','write_default_settings','read_user_list','write_user_info','read_purview_list','read_users_list','write_users','read_regcode_list','write_regcode','other_upsys','read_log','other_root'];
$root = ['write_subscribe','write_sys_settings','write_default_settings','read_user_list','write_user_info','read_purview_list','read_users_list','write_users','read_regcode_list','write_regcode','other_upsys','read_log','other_root','other_services'];
if(in_array($method,$root)){
require('api_root.php');
//非站长接口则判断是否加载防火墙
@@ -526,36 +526,7 @@ function write_link(){
}
//扩展上传图片
}elseif($_GET['type'] == 'extend_up_img'){
//权限检测
if(!check_purview('Upload_icon',1)){
msg(-1,'您的用户组无权限上传图片');
}elseif(empty($_FILES["file"]) || $_FILES["file"]["error"] > 0){
msg(-1,'文件上传失败');
}
//取后缀并判断是否支持
$suffix = strtolower(end(explode('.',$_FILES["file"]["name"])));
if(!preg_match('/^(jpg|jpeg|png|ico|bmp|svg)$/',$suffix)){
@unlink($_FILES["file"]["tmp_name"]);
msg(-1,'文件格式不被支持!');
}
//限制文件大小
if(filesize($_FILES["file"]["tmp_name"]) > 1 * 1024 * 1024){
msg(-1,'文件大小超限');
}
//文件临时路径
$path = DIR . "/data/user/{$u}/upload";
//检测目录,不存在则创建!
if(!Check_Path($path)){
msg(-1,'创建upload目录失败,请检查权限');
}
$tmp_name = 'LE_'.uniqid().'.'.$suffix;
//移动文件
if(!move_uploaded_file($_FILES["file"]["tmp_name"],"{$path}/{$tmp_name}")) {
msg(-1,'上传失败,请检查目录权限');
}else{
msgA(['code'=>1,'msg'=>'上传成功','url'=>"./data/user/".U.'/upload/'.$tmp_name]);
}
msg_tip();
//删除图标
}elseif($_GET['type'] === 'del_images'){
@@ -744,147 +715,15 @@ function write_link(){
update_db('user_links',['fid'=>$fid],['uid'=>UID ,"lid" => json_decode($_POST['lid']) ],[1,'设置成功']);
//检测是否满足要求
}elseif($_GET['type'] === 'msg_pull_check'){
if($global_config['offline']){
msg(-1,"离线模式不可用");
}
if(!is_subscribe('bool')){
msg(-1,"未检测到有效授权,无法使用该功能!");
}
msg(-1,'请更新系统后再试');
msg_tip();
}elseif($_GET['type'] === 'msg_pull'){
session_start();
$key = $_POST['key'];
if(empty($key) || !$_SESSION['msg_pull']["$key"]){
msg(-1,'key验证失败,请重试!');
}elseif(empty($_POST['link_id'])){
msg(-1,'链接ID不能为空');
}
//读取信息
$link = get_db('user_links','*',['uid'=>UID ,'lid'=>$_POST['link_id'] ]);
//检查链接
if(empty($link)){
msg(-1,'链接ID不存在');
}elseif(!preg_match("/^(http:\/\/|https:\/\/).*/",$link['url'])){
msg(-1,'只支持识别http/https协议的链接!');
}elseif( !filter_var($link['url'], FILTER_VALIDATE_URL) ) {
msg(-1,'URL无效!');
}
//是否获取站点信息
if( ( intval($_POST['title']) + intval($_POST['keywords']) + intval($_POST['description']) ) > 0 ){
//读取长度限制配置
$length_limit = unserialize(get_db("global_config","v",["k"=>"length_limit"]));
//获取网站标题
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $link['url']);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($c, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($c, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36');
curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($c , CURLOPT_TIMEOUT, 10);
$data = curl_exec($c);
curl_close($c);
require (DIR .'/system/get_page_info.php');
$info = get_page_info($data);
$new = [];
if(intval($_POST['title']) > 0 && !empty($info['site_title'])){
$new['title'] = $info['site_title'];
if($length_limit['l_name'] > 0 && strlen($new['title']) > $length_limit['l_name'] ){
$new['title'] = mb_substr($new['title'], 0, $length_limit['l_name'], 'utf-8');
}
}
if(intval($_POST['keywords']) > 0 && !empty($info['site_keywords'])){
$new['keywords'] = (empty($link['keywords']) || $_POST['keywords'] == '2') ? $info['site_keywords'] : $link['keywords'];
if($length_limit['l_key'] > 0 && strlen($new['keywords']) > $length_limit['l_key'] ){
$new['keywords'] = mb_substr($new['keywords'], 0, $length_limit['l_key'], 'utf-8');
}
}
if(intval($_POST['description']) > 0 && !empty($info['site_description'])){
$new['description'] = (empty($link['description']) || $_POST['description'] == '2') ? $info['site_description'] : $link['description'];
if($length_limit['l_desc'] > 0 && strlen($new['description']) > $length_limit['l_desc'] ){
$new['description'] = mb_substr($new['description'], 0, $length_limit['l_desc'], 'utf-8');
}
}
if(empty($new)){
$r['info'] = 'fail';
}else{
update_db('user_links',$new,['uid'=>UID ,"lid" => $link['lid'] ]);
$r['info'] = 'success';
}
}
//是否获取图标
if(intval($_POST['icon']) > 0){
//检查跳过已存在图标的链接
if($_POST['icon'] == '1' && !empty($link['icon'])){
$r['icon'] = 'skip';
}
$api = Get_Index_URL().'?c=icon&url='.base64_encode($link['url']);
$res = ccurl($api,30,true);
$data = get_db('global_icon','*',['url_md5'=>md5($link['url'])]);
if(empty($data)){
$r['icon'] = 'fail';
}
$new_path = "./data/user/".U.'/favicon/'.$data['file_name'];
if(copy("./data/icon/{$data['file_name']}",$new_path)){
update_db('user_links',['icon'=>$new_path],['uid'=>UID ,"lid" => $link['lid'] ]);
$r['icon'] = 'success';
}else{
$r['icon'] = 'fail';
}
}
msg(1,$r);
msg_tip();
//图标拉取
}elseif($_GET['type'] === 'icon_pull'){
if($global_config['offline']){
msg(-1,"离线模式不可用");
}
if(!is_subscribe('bool')){
msg(-1,"未检测到有效授权,无法使用该功能!");
}
msg(-1,'请更新系统后再试');
msg_tip();
}elseif($_GET['type'] == 'extend_list'){
if($GLOBALS['global_config']['link_extend'] != 1 ||!check_purview('link_extend',1)){
msg(-1,'无权限');
}
$lists = json_decode($_POST['list'],true);
$weight = [];
foreach ($lists as $data ){
if(empty($data['weight']) || !preg_match('/^\d$/', $data['weight'])){
msgA( ['code' => -1,'msg' => '序号错误,请输入正整数'] );
}
if(empty($data['title']) || check_xss($data['title'])){
msgA( ['code' => -1,'msg' => '标题不能为空'] );
}
if(empty($data['name']) || check_xss($data['name']) || !preg_match('/^[A-Za-z0-9]{3,18}$/',$data['name'])){
msgA( ['code' => -1,'msg' => '字段名错误,请输入长度3-18的字母/数字'] );
}
if(!in_array($data['type'],['text','textarea','up_img'])){
msgA( ['code' => -1,'msg' => '类型错误'] );
}
}
if(is_Duplicated($lists,'weight')){
msg(-1,'序号不能重复');
}elseif(is_Duplicated($lists,'title')){
msg(-1,'标题不能重复');
}elseif(is_Duplicated($lists,'name')){
msg(-1,'字段名不能重复');
}
$datas = [];
foreach ($lists as $key => $data ){
array_push($datas,['title'=>$data['title'],'name'=>$data['name'],'weight'=>$data['weight'],'type'=>$data['type'],'default'=> "{$data['default']}",'tip'=>$data['tip']]);
}
//根据序号排序
usort($datas, function($a, $b) {
return $a['weight'] - $b['weight'];
});
write_user_config('s_extend_list',$datas,'config','链接扩展字段');
msgA( ['code' => 1,'msg' => '保存成功','datas'=>$datas] );
msg_tip();
}
msg(-1,'操作类型错误');
@@ -901,6 +740,7 @@ function write_security_setting(){
}
$datas = [
'admin_inlet'=>['v'=>['display','hide','condition1'],'msg'=>'管理入口参数错误'],
'Session'=>['int'=>true,'min'=>0,'max'=>360,'msg'=>'登录保持参数错误'],
'HttpOnly'=>['int'=>true,'min'=>0,'max'=>1,'msg'=>'HttpOnly参数错误'],
'KeySecurity'=>['int'=>true,'min'=>0,'max'=>2,'msg'=>'Key安全参数错误'],
@@ -943,47 +783,18 @@ function write_security_setting(){
//写收录配置
function write_apply(){
msg(-1,'免费版不支持此功能,请购买授权版');
msg_tip();
}
//读收录列表
function read_apply_list(){
msgA(['code'=>-1,'msg'=>'免费版不支持此功能,请购买授权版','count'=>0,'data'=>[]]);
msg_tip();
}
//写站点设置
function write_site_setting(){
//图标上传
if(!empty($_FILES["file"])){
check_purview('Upload_icon',2);
if ($_FILES["file"]["error"] > 0){
msg(-1,'文件上传失败,error:'.$_FILES["file"]["error"]);
}
//获取文件名后缀
$suffix = strtolower(end(explode('.',$_FILES["file"]["name"])));
if(!preg_match('/^(jpg|jpeg|png|bmp|gif|ico|svg)$/',$suffix)){
@unlink($_FILES["file"]["tmp_name"]);
msg(-1,'文件上传失败,文件格式不被支持!');
}
//文件路径
$path = 'data/user/'.U.'/favicon/favicon.'.$suffix;
//检查并创建目录
if(!Check_Path(dirname($path))){
msg(-1,'创建目录失败,请检查权限');
}
$site = unserialize(get_db('user_config','v',['uid'=>UID,'k'=>'s_site']));
//存在旧图标则先删除
if(!empty($site['site_icon_file']) && is_file($site['site_icon_file'])){
@unlink($site['site_icon_file']);
}
//转移临时文件
if(move_uploaded_file($_FILES["file"]["tmp_name"],$path)) {
$site['site_icon_file'] = 'data/user/'.U.'/favicon/favicon.'.$suffix; //储存路径
$site['site_icon'] = './'.$site['site_icon_file']; //前端请求路径
update_db("user_config", ["v" =>$site], ['uid'=>UID,'k'=>'s_site'],[1,'上传成功']);
}else{
msg(-1,'上传失败,请检查目录权限');
}
msg_tip();
}
check_purview('site_info',2);
if(!empty($_POST['custom_header']) && !check_purview('header',1)){
@@ -1187,36 +998,13 @@ function read_pwd_group_list(){
}
//写加密分组 考虑要不要限制特殊字符
function write_pwd_group(){
check_purview('link_pwd',2);
if($_GET['type'] === 'del'){
//判断有没有被使用
if(!empty(get_db('user_links','id',['uid'=>UID,'pid'=>intval($_POST['pid'])]))){
msg(-1,'正在被链接使用,无法删除!');
}else if(!empty(get_db('user_categorys','id',['uid'=>UID,'pid'=>intval($_POST['pid'])]))){
msg(-1,'正在被分类使用,无法删除!');
}
delete_db('user_pwd_group',['uid'=>UID,'pid'=>intval($_POST['pid'])],[1,'删除成功']);
}elseif($_GET['type'] == 'add'){
//$pid = intval(max_db('user_pwd_group','pid',['uid'=>UID])) +1;
$pid = get_maxid('pwd_group_id');
insert_db('user_pwd_group',['name' => $_POST['name'],'password' =>$_POST['password'],'description'=>$_POST['description'],'uid'=>UID,'pid'=>$pid],[1,'操作成功']);
}elseif($_GET['type'] === 'edit'){
update_db('user_pwd_group',['name' => $_POST['name'],'password' =>$_POST['password'],'description'=>$_POST['description']],['uid'=>UID,'pid'=>intval($_POST['pid'])],[1,'操作成功']);
}
msgA(['code' => 1 ,'msg'=> '1111']);
msg_tip();
}
//检测链接是否有效
function other_testing_link(){
global $global_config;
if ( $global_config['offline'] == '1'){ msg(-1,"离线模式无法使用此功能"); }
$code = get_http_code($_POST['url']);
if($code != 200 && $code != 302 && $code != 301){
$code = ccurl($_POST['url'],30)['code'];
}
msgA(['code' => 0 ,'StatusCode'=> $code]);
msg_tip();
}
//读主题信息
@@ -1274,13 +1062,7 @@ function read_theme(){
//在线主题处理
if ( !$global_config['offline'] && $USER_DB['UserGroup'] === 'root'){
if(preg_match('/^v.+-(\d{8})$/i',SysVer,$matches)){
$sysver = intval( $matches[1] );//取版本中的日期
}else{
msg(-1,'获取程序版本异常');
}
$sysver = get_SysVer();
//读取缓存
$page = 'theme_'.$request_dir;
$template = get_db('global_config','v',['k'=>$page.'_cache']);
@@ -1332,27 +1114,33 @@ function read_theme(){
}
//取正在使用的模板
$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';
if(in_array($request_dir,['register','guide'])){
$global_templates = unserialize(get_db("global_config",'v', ["k" => "s_templates"]));
$current[$request_dir] = $global_templates[$request_dir] ?? 'default';
}else{
$current[$request_dir] = $s_templates[$request_dir] ?? 'default';
$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 msg_tip(){
msg(-1,'免费版不支持此功能,购买授权版<br /> <a href="https://gitee.com/tznb/TwoNav/wikis/pages?sort_id=7968669&doc_id=3767990" target="_blank" style="color: #1e9fff;">点击此处前往购买页面</a>');
}
//主题下载/更新/删除
function write_theme(){
global $global_config;
$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,"离线模式禁止下载主题!");} //离线模式
if(!is_subscribe('bool')){msg(-1,"未检测到有效授权,无法使用该功能!");}
msg(-1,'请更新系统后再试');
msg_tip();
//删除主题
}elseif($_GET['type'] == 'del'){
is_root();
@@ -1782,11 +1570,19 @@ function read_data(){
//扩展功能
$extend = [];
array_push($extend,['title'=>'收录管理','href'=>'expand/apply-admin','icon'=>'fa fa-pencil']);
array_push($extend,['title'=>'留言管理','href'=>'expand/guestbook-admin','icon'=>'fa fa-commenting-o']);
array_push($extend,['title'=>'文章管理','href'=>'expand/article-list','icon'=>'fa fa-file-text-o']);
$extend = ['title'=>'扩展功能','icon'=>'fa fa-folder-open-o','href'=>'','child'=> $extend];
array_push($menu,$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'){
@@ -1802,7 +1598,8 @@ function read_data(){
]
]);
}
$init = array( 'homeInfo'=>['title'=>'概要','href'=>'home'],'logoInfo'=>['title'=>'TwoNav','image'=>'./templates/admin/img/logo.png','href'=>'./?u='.U],'menuInfo'=>$menu);
$logo_url = static_link ? get_surl('{UUID}.html'):"./?u={$USER_DB['User']}";
$init = array( 'homeInfo'=>['title'=>'概要','href'=>'home'],'logoInfo'=>['title'=>'TwoNav','image'=>'./templates/admin/img/logo.png','href'=>$logo_url],'menuInfo'=>$menu);
msgA($init);
}
}

View File

@@ -1,2 +1,20 @@
<?php if(!defined('DIR')){header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit;}
msg(-1,'未检测到有效授权,无法使用该功能');
$type = htmlspecialchars(trim($_GET['type']),ENT_QUOTES);
if (function_exists($type) ) {
if($GLOBALS['global_config']['article'] < 1 || !check_purview('article',1)){
msg_tip();
}
$type();
}else{
Amsg(-1,'请求类型错误 >> '.$type);
}
//获取文章列表
function article_list(){
msg_tip();
}

View File

@@ -58,7 +58,8 @@ function other_upsys(){
$overtime = !isset($GLOBALS['global_config']['Update_Overtime']) ? 3 : ($GLOBALS['global_config']['Update_Overtime'] < 3 || $GLOBALS['global_config']['Update_Overtime'] > 60 ? 3 : $GLOBALS['global_config']['Update_Overtime']);
//请求获取更新包
$Res = ccurl("http://service.twonav.cn/service.php",30,true,data_encryption('updateSystem',['sysver'=>$_SESSION['upsys']['sysver']]));
$node = intval($GLOBALS['global_config']['Update_Source']);
$Res = ccurl("http://service.twonav.cn/service.php",30,true,data_encryption('updateSystem',['node'=>$node]));
$data = json_decode($Res["content"], true);
if($data["code"] != '200'){
@@ -78,7 +79,6 @@ function other_upsys(){
}else{
msg(-1,'下载更新包失败');
}
msg(1,'success');
}
@@ -98,13 +98,13 @@ function other_upsys(){
} catch (Exception $e) {
msg(-1,'释放更新包,请检查写入权限');//解压出问题了
}
clean_cache();
usleep(1000*300);
msg(1,'success');
}
//检测是否需要更新数据库
if($_POST['i'] == 4){
clean_cache();
set_time_limit(5*60);
try {
//根据数据库类型扫描不同目录,并声明执行SQL语句的函数
@@ -236,90 +236,31 @@ function read_purview_list(){
//读用户组列表
function read_users_list(){
if(!is_subscribe('bool')){
msg(-1,'未检测到有效授权');
}
msg(1,'请更新系统后再试');
msg_tip();
}
//写用户组
function write_users(){
//验证代号是否合规
if(!preg_match('/^[A-Za-z0-9]+$/',$_POST['code'])){
msg(-1,'分组代号只能是字母和数字');
}elseif($_POST['code'] == 'root' || $_POST['code'] == 'default'){
msg(-1,'不能使用系统预设的代号');
}elseif(htmlspecialchars(trim($_POST['name'])) != $_POST['name']){
msg(-1,'分组名称不能含有特殊字符');
}
if(!is_subscribe('bool')){
msg(-1,'未检测到有效授权');
}
msg(1,'请更新系统后再试');
msg_tip();
}
//写用户信息
function write_user_info(){
msg(-1,'未检测到有效授权,无法使用该功能');
msg_tip();
}
//读注册码列表
function read_regcode_list(){
if(!is_subscribe('bool')){
msg(-1,'未检测到有效授权');
}
msg(1,'请更新系统后再试');
msgA(['code'=>1,'msg'=>'获取成功','count'=>$count,'data'=>$datas]);
msg_tip();
}
//写注册码
function write_regcode(){
global $db;
if(!is_subscribe('bool')){
msg(-1,'未检测到有效授权');
}
msg(1,'请更新系统后再试');
msg_tip();
}
//写订阅信息
function write_subscribe(){
global $USER_DB;
$data = $_POST;
$data['host'] = $_SERVER['HTTP_HOST']; //当前域名
if(empty($data['order_id']) && empty($data['email']) && empty($data['end_time'])){
write_global_config('s_subscribe','','订阅信息');
msg(1,'清除成功');
}
if($data['end_time'] < time()){
msg(-1,"您的订阅已过期!");
}
//判断是否为IP
if(preg_match("/^(\d+\.\d+\.\d+\.\d+):*\d*$/",$data['host'],$host)) {
$data['host'] = $host[1]; //取出IP(不含端口)
}else{
$host = explode(".", $data['host']);
$count = count($host);
if($count != 2){
$data['host'] = $host[$count-2].'.'.$host[$count-1];
//如果存在端口则去除
if(preg_match("/(.+):\d+/",$data['host'],$host)) {
$data['host'] = $host[1];
}
}
}
if(stristr($data['domain'],$data['host'])){
write_global_config('s_subscribe',$data,'订阅信息');
clean_cache();
msg(1,'保存成功');
}else{
msg(-1,"您的订阅不支持当前域名 >> ".$_SERVER['HTTP_HOST']);
}
}
// 写系统设置
function write_sys_settings(){
global $USER_DB;
@@ -333,6 +274,16 @@ function write_sys_settings(){
msg(-1,'默认账号不存在');
}elseif(!empty($_POST['default_UserGroup']) && empty(get_db('user_group','code',['code' => $_POST['default_UserGroup']]))){
msg(-1,'默认分组代号不存在');
}elseif($_POST['Sub_domain'] == 1){
if(preg_match('/\.(com|net|org|gov|edu)\.cn$/', $_SERVER["HTTP_HOST"])){
msg(-1,'不支持此类域名');
}
if(filter_var($_SERVER["HTTP_HOST"], FILTER_VALIDATE_IP) != false){
msg(-1,'不支持IP访问开启二级域名');
}
if(preg_match('/\.(\d+|:\d+)$/', preg_replace('/:\d+$/','',$_SERVER['HTTP_HOST'])) || substr_count($_SERVER["HTTP_HOST"],':') > 2){
msg(-1,'不支持IP访问开启二级域名,如有误判请联系技术支持!');
}
}
//自定义登录入口和注册入口检测
@@ -343,7 +294,12 @@ function write_sys_settings(){
if(in_array($_POST['Register'],$prohibits)){
msg(-1,'此注册入口名已被系统使用');
}
//长度限制
foreach (['c_name','c_desc','l_name','l_url','l_key','l_desc'] as $name){
$length_limit[$name] = is_subscribe('bool') ? intval($_POST[$name]) : 0;
}
write_global_config("length_limit",$length_limit,'长度限制');
//全局配置
$datas = [
'Login'=>['empty'=>false,'msg'=>'登录入口不能为空'],
@@ -358,14 +314,22 @@ function write_sys_settings(){
'offline'=>['int'=>true,'min'=>0,'max'=>1,'msg'=>'离线模式参数错误'],
'Debug'=>['int'=>true,'min'=>0,'max'=>1,'msg'=>'调试模式参数错误'],
'Maintenance'=>['int'=>true,'min'=>0,'max'=>1,'msg'=>'维护模式参数错误'],
'Sub_domain'=>['int'=>true,'min'=>0,'max'=>1,'msg'=>'二级域名参数错误'],
'Privacy'=>['int'=>true,'min'=>0,'max'=>1,'msg'=>'强制私有参数错误'],
'default_page'=>['int'=>true,'min'=>0,'max'=>2,'msg'=>'默认页面参数错误'],
'global_header'=>['empty'=>true],
'global_footer'=>['empty'=>true],
'api_extend'=>['empty'=>true],
'c_code'=>['int'=>true,'min'=>0,'max'=>1,'msg'=>'自定义代码参数错误'],
'static_link'=>['int'=>true,'min'=>0,'max'=>2,'msg'=>'静态链接参数错误'],
//更新设置
'Update_Source'=>['empty'=>true],
'Update_Overtime'=>['int'=>true,'min'=>3,'max'=>60,'msg'=>'资源超时参数错误'],
//扩展功能-(全局开关)
'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'=>2,'msg'=>'文章管理参数错误']
];
$o_config = [];
foreach ($datas as $key => $data){
@@ -377,18 +341,24 @@ function write_sys_settings(){
$o_config[$key] = $data['empty']?$_POST[$key]:(!empty($_POST[$key])?$_POST[$key]:msg(-1,$data['msg']));
}
}
update_db("global_config", ["v" => $o_config], ["k" => "o_config"],[1,"免费版可用功能配置已保存!"]);
if(!is_subscribe('bool')){
if($_POST['Sub_domain'] == 1){$o_config['Sub_domain'] = 0;$filter = true;}
if($_POST['Privacy'] == 1){$o_config['Privacy'] = 0;$filter = true;}
if(!empty($_POST['copyright'])){$o_config['copyright'] = "";$filter = true;}
if(!empty($_POST['global_header'])){$o_config['global_header'] = "";$filter = true;}
if(!empty($_POST['global_footer'])){$o_config['global_footer'] = "";$filter = true;}
if($_POST['apply'] == 1){$o_config['apply'] = 0;$filter = true;}
if($_POST['guestbook'] == 1){$o_config['guestbook'] = 0;$filter = true;}
if($_POST['link_extend'] == 1){$o_config['link_extend'] = 0;$filter = true;}
if($_POST['article'] == 1){$o_config['article'] = 0;$filter = true;}
if($_POST['static_link'] == 1){$o_config['static_link'] = 0;$filter = true;}
}
update_db("global_config", ["v" => $o_config], ["k" => "o_config"],[1,($filter ?"保存成功,未检测到有效授权,带*号的配置无法为你保存":"保存成功")]);
}
//写默认设置
function write_default_settings(){
global $USER_DB;
if(!is_subscribe('bool')){
msg(-1,'未检测到有效授权');
}
msg(1,'请更新系统后再试');
msg_tip();
}
//读日志
function read_log(){
@@ -443,22 +413,13 @@ function other_root(){
$data = get_db("global_config", "v", ["k" => "username_retain"]);
msgA(['code'=>1,'msg'=>'获取成功','data'=>$data]);
}elseif($_GET['type'] == 'write_username_retain'){
if(!is_subscribe('bool')){
msg(-1,'未检测到有效授权');
}
msg(1,'请更新系统后再试');
msg_tip();
}elseif($_GET['type'] == 'write_mail_config'){
if($GLOBALS['global_config']['offline'] == '1'){msg(-1,"离线模式无法使用此功能");}
if(!is_subscribe('bool')){msg(-1,"未检测到有效授权,无法使用该功能!");}
msg(1,'请更新系统后再试');
msg_tip();
}elseif($_GET['type'] == 'write_mail_test'){
$_POST['Subject'] = 'TwoNav 测试邮件' . time();
$_POST['Body'] = '<h1>TwoNav 测试邮件</h1>' . date('Y-m-d H:i:s');
send_email($_POST);
msg_tip();
}elseif($_GET['type'] == 'write_icon_config'){
if($GLOBALS['global_config']['offline'] == '1'){msg(-1,"离线模式无法使用此功能");}
if(!is_subscribe('bool')){msg(-1,"未检测到有效授权,无法使用该功能!");}
msg(1,'请更新系统后再试');
msg_tip();
}elseif($_GET['type'] == 'write_icon_del_cache'){
//删除数据库缓存信息
if(empty(count_db('global_icon','*'))){
@@ -478,7 +439,100 @@ function other_root(){
}
msg(1,'操作成功');
}elseif($_GET['type'] == 'write_sitemap_config'){
msg_tip();
}
}
// 通用类请求官方服务器
function other_services(){
// 生成请求数据
$domain = preg_replace('/:\d+$/','',$_SERVER['HTTP_HOST']);
$post = [
'domain' => $domain,
'referer' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "",
'email' => isset($_POST['email']) ? $_POST['email'] : "",
'order_id' => isset($_POST['order_id']) ? $_POST['order_id'] : "",
'sysver' => SysVer,
'ip' => Get_IP(),
'method' => $_GET['type']
];
$overtime = !isset($global_config['Update_Overtime']) ? 3 : ($global_config['Update_Overtime'] < 3 || $global_config['Update_Overtime'] > 60 ? 3 : $global_config['Update_Overtime']);
// 判断操作类型
if($_GET['type'] == 'query_key' || $_GET['type'] == 'save_key'){
$Res = ccurl("http://service.twonav.cn/service.php",$overtime,true,$post);
if($Res['code'] != 200){
msg(-1,'请求官方服务器失败,请稍后再试');
}
$data = json_decode($Res["content"], true);
// 如果是保存设置
if($_GET['type'] == 'save_key'){
$data = $data['data'];
if(!isset($data['order_id']) || empty($data['order_id'])){
msg(-1,'保存失败,请核对信息是否有误');
}
//判断是否为IP
if(preg_match("/^(\d+\.\d+\.\d+\.\d+):*\d*$/",$domain,$host)) {
$data['host'] = $host[1]; //取出IP(不含端口)
}else{
$host = explode(".", $domain);
$count = count($host);
if($count != 2){
$data['host'] = $host[$count-2].'.'.$host[$count-1];
//如果存在端口则去除
if(preg_match("/(.+):\d+/",$data['host'],$host)) {
$data['host'] = $host[1];
}
}
}
write_global_config('s_subscribe',$data,'订阅信息');
clean_cache();
msgA(['code'=>200,'msg'=>'保存成功','data'=>['order_id'=>$data['order_id'],'end_time'=>$data['end_time'],'type_name'=>$data['type_name']]]);
}
msgA($data);
}elseif($_GET['type'] == 'del_key'){
$subscribe = unserialize(get_db('global_config','v',["k" => "s_subscribe"]));
if(!isset($subscribe['order_id']) || empty($subscribe['order_id'])){
msg(200,'清除成功');
}
ccurl("http://service.twonav.cn/service.php",$overtime,true,$post);
write_global_config('s_subscribe','','订阅信息');
clean_cache();
msg(200,'删除成功');
}elseif($_GET['type'] == 'validate'){
$Res = ccurl("http://service.twonav.cn/service.php",$overtime,true,data_encryption('validate'));
$data = json_decode($Res["content"], true);
if($data["code"] != '200'){
msg(-1,$data['msg'] ?? '验证失败');
}
msgA($data);
}elseif($_GET['type'] == 'get_notice'){
//读取缓存数据
$Notice = get_db('global_config','v',['k'=>'notice']);$data=[];
//如果不为空,则解析数据
if(!empty($Notice)){
$data = json_decode($Notice, true);
$cache_time = 60; //缓存时间(秒);
$reload = time() > $data["download_time"] + $cache_time; //是否更新
}else{
$reload = true; //需要刷新
}
// 判断是否刷新数据
if(!$global_config['offline'] && $reload){
if(is_subscribe('bool')){
$Res = ccurl('http://service.twonav.cn/service.php',$overtime,true,data_encryption('get_new_ver',['ver'=>SysVer]));
}else{
$Res = ccurl('http://tznb.gitee.io/twonav_resource/Notice.json',$overtime);
}
$new_data = json_decode($Res['content'], true);
if($new_data["code"] == 200 ){
$new_data['download_time'] = time();
$new_data['version'] = version_compare($new_data['version'],SysVer,'<') ? SysVer : $new_data['version'];
write_global_config('notice',json_encode($new_data),'官方公告(缓存)');
$data = $new_data;
}
}
msgA($data);
}
}

View File

@@ -55,40 +55,6 @@ if(!$is_login){
if($category_ancestor['property'] == 1 && !$pv){
exit('很抱歉,页面所属的祖分类是私有的!您无权限查看,如果您是管理员,请先登录!');
}
//判断链接是否加密
if(!empty($link['pid'])){
$verify_type = 'link_pwd';
$password = get_db('user_pwd_group','password',['uid'=>UID,'pid'=>$link['pid']]);
if($_SESSION['verify']['link'][$link['lid']] != $password){
$c = 'verify';
require DIR."/system/templates.php";
require $index_path;
exit();
}
}
//判断父分类是否加密
if(empty($link['pid']) && !empty($category_parent['pid'])){
$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){
$c = 'verify';
require DIR."/system/templates.php";
require $index_path;
exit();
}
}
//判断祖分类是否加密
if(empty($link['pid']) && empty($category_parent['pid']) && !empty($category_ancestor['pid'])){
$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){
$c = 'verify';
require DIR."/system/templates.php";
require $index_path;
exit();
}
}
}
@@ -100,11 +66,6 @@ update_db("user_links", ["click[+]"=>1],['uid'=>UID,'lid'=>$id]);
//通用数据初始化
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"])){
$extend = empty($link['extend']) ? [] : unserialize($link['extend']);
}
//载入过渡页设置
$transition_page = unserialize(get_db("user_config", "v", ["uid"=>UID,"k"=>"s_transition_page"]));

View File

@@ -1,6 +1,11 @@
<?php
//get请求载入页面
if($_SERVER['REQUEST_METHOD'] === 'GET'){
exit('当前为免费版,不支持此功能');
require DIR."/system/templates.php";
require($index_path);
exit;
}
msg(-1,'当前为免费版,不支持此功能');
msg(-1,'免费版不支持此功能');
?>

View File

@@ -1,28 +1,3 @@
<?php if(!defined('DIR')){Not_Found();}AccessControl();
//判断全局开关和用户权限
if($global_config['article'] < 1 || !check_purview('article',1)) Not_Found();
//IP数统计
count_ip();
//取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();
//统计点击数
update_db("user_article_list", ["browse_count[+]"=>1],['uid'=>UID,'id'=>$id]);
//载入模板
require $index_path;
exit('免费版不支持此功能');

View File

@@ -1,6 +1,11 @@
<?php
if($_SERVER['REQUEST_METHOD'] === 'GET'){
exit('当前为免费版,不支持此功能');
}
msg(-1,'当前为免费版,不支持此功能');
?>
//POST提交留言
if($_SERVER['REQUEST_METHOD'] === 'POST'){
msg(-1,'免费版不支持此功能');
}
//通用数据初始化
require DIR."/system/templates.php";
require $index_path;
exit;

View File

@@ -0,0 +1,8 @@
<?php
if(!is_subscribe('bool')){exit;}
//设置协议头
header('Content-Type: application/xml');
exit;
?>

View File

@@ -0,0 +1 @@
<?php

View File

@@ -1,254 +1,6 @@
<?php
//读取配置
$config = unserialize( get_db("global_config", "v", ["k" => "icon_config"])) ?? [];
$config['analysis_timeout'] = (intval($config['analysis_timeout']) >= 3 && intval($config['analysis_timeout']) <= 20) ? intval($config['analysis_timeout']) : 6; //解析超时
$config['download_timeout'] = (intval($config['download_timeout']) >= 3 && intval($config['download_timeout']) <= 20) ? intval($config['download_timeout']) : 6; //下载超时
$config['icon_size'] = (intval($config['icon_size']) >= 5 && intval($config['icon_size']) <= 1024) ? intval($config['icon_size']) : 256; //大小限制
$favicon_url = '';
//防盗链
if($config['referer_test'] == 1){
if(empty($_SERVER['HTTP_REFERER']) || !strstr($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST'])){
header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit('404 Not Found');
}
}
//获取URL
$url = base64_decode($_GET['url']);
$url_md5 = md5($url);
//维护模式/离线模式/关闭服务 > 输出固定图标
if($global_config['Maintenance'] != 0 || $global_config['offline'] == '1' || $config['o_switch'] == '0' || !is_subscribe('bool')){
echo_link_type_icon();
}
//如果不是http(s)则根据类型输出固定图标
if(!preg_match("/^(http:\/\/|https:\/\/)/",$url)){
echo_link_type_icon();
}else{
$uri_part = parse_url($url);
$url_root = $uri_part['scheme'] . '://' . $uri_part['host'] . (isset($uri_part['port']) ? ':' . $uri_part['port'] : '');
}
//检查目录 > 不存在则自动创建 > 创建失败显示错误图标
if(!Check_Path(DIR.'/data/icon')){
echo_icon(DIR . '/templates/admin/img/error.svg',$config);
}
//读取缓存 > 存在且可用则输出
$cache_data = get_db('global_icon','*',['url_md5'=>$url_md5]);
if(!empty($cache_data) && $cache_data['update_time'] > time() - intval($config['server_cache_time']) && is_file(DIR . '/data/icon/' . $cache_data['file_name'])){
echo_icon(DIR . '/data/icon/' . $cache_data['file_name'],$config,$cache_data);
}
//缓存不可用
//获取URL的html内容
$html = get_html($url,$config['analysis_timeout']);
//获取html失败
if(empty($html)){
backup_api($url,$config); //调用备选接口
}
//html获取成功>尝试解析
try {
$doc = new DOMDocument();
@$doc->loadHTML($html);
$links = $doc->getElementsByTagName('link');
//后续可以考虑将所有声明的图标加入数组,然后按特定规则排序,实现多图标时获取较大尺寸的图标
foreach ($links as $link) {
if (in_array($link->getAttribute('rel'),['shortcut icon','icon','alternate icon','apple-touch-icon'])) {
$favicon_url = $link->getAttribute('href');
break;
}
}
}catch (Exception $e) {
//解析异常,不做处理!下面继续尝试其他方法获取!
}
//解析失败(可能是未设置图标)
if(empty($favicon_url)){
//尝试获取根目录的favicon.ico
$res = down_ico($url_root.'/favicon.ico','./data/icon/',$url,$config['download_timeout']);
if($res){
echo_icon(DIR . '/data/icon/'.$url_md5.".ico",$config);
}
//调用备选接口
backup_api($url,$config);
}
//解析到图标
$favicon_url = url_patch($favicon_url,$url);
//if 如果图标类型是base64或者svg则不需要下载
//匹配图标类型>下载>输出
$suffix = strtolower(end(explode('.',$favicon_url)));
$suffix = strtolower(reset(explode('?',$suffix)));
$suffix = preg_match('/^(jpg|jpeg|png|ico|bmp|svg|webp)$/i',$suffix) ? $suffix : 'ico';
//下载图标 > 成功则输出
$res = down_ico($favicon_url,'./data/icon/',$url,$config['download_timeout']);
if($res){
echo_icon(DIR . '/data/icon/'.$url_md5.".$suffix",$config);
}else{
echo_link_type_icon();
}
//使用备用接口
function backup_api($url,$config){
global $uri_part,$url_root;
//未设置时直接输出ie图标
$backup_api = intval($config['backup_api']);
if($backup_api == 0){
echo_icon(DIR . '/templates/admin/img/ie.svg',$config);
}elseif($backup_api == 6){
$res = down_ico('https://api.iowen.cn/favicon/'.parse_url($url)['host'].'.png','./data/icon/','',$config['download_timeout']);
if($res){
echo_icon(DIR . '/data/icon/'.$GLOBALS['url_md5'].".png",$config);
}
}elseif($backup_api == 2){
$res = down_ico('https://favicon.png.pub/v1/'.base64_encode($url_root),'./data/icon/','',$config['download_timeout']);
if($res){
echo_icon(DIR . '/data/icon/'.$GLOBALS['url_md5'].".png",$config);
}
}
//如果都失败,则输出默认图标
echo_icon(DIR . '/templates/admin/img/ie.svg',$config);
}
//检测URL自动补全
function url_patch($favicon_url,$url){
global $uri_part,$url_root;
//包含协议表示URL完整,直接返回
if(strpos($favicon_url, '://')){
return $favicon_url;
}
//忽略协议的绝对路径
if(strpos($favicon_url, '//') === 0 ) {
return $uri_part['scheme'] . ':' . $favicon_url;
}
//位于根目录
if(strpos($favicon_url, '/') === 0 ){
return $url_root.$favicon_url;
}
//当前目录
if(strpos($favicon_url, './') === 0){
return $url_root . $uri_part['path'] . substr($favicon_url, 2);
}
//向上N级目录
if(strpos($favicon_url, '../') === 0){
$N = substr_count($favicon_url,'../');
$url_temp = $uri_part['path'];
for ($i = 0; $i < $N; $i++) {
$url_temp = dirname($url_temp);
$favicon_url = preg_replace('/^\.\.\//', '', $favicon_url);
}
return $url_root . $url_temp . $favicon_url;
}
//base64
//SVG
//默认路径
return $url_root . $uri_part['path'] . $favicon_url;
}
//获取html
function get_html($url,$TIMEOUT = 5){
try {
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $url);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_FAILONERROR, 1);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($c, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($c, CURLOPT_TIMEOUT, $TIMEOUT);
curl_setopt($c, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36');
$data = curl_exec($c);
//如果是gzip则解压
$prefix = dechex(ord($data[0])) . dechex(ord($data[1]));
if(strtolower($prefix) == '1f8b'){
$data = gzdecode($data);
}
curl_close($c);
return $data;
}catch (Exception $e) {
return false;
}
}
function down_ico($ico_url, $savePath = './data/temp/',$referer = '',$TIMEOUT = 60){
$suffix = strtolower(end(explode('.',$ico_url)));
$suffix = strtolower(reset(explode('?',$suffix))); //截取?前面的
if(!preg_match('/^(jpg|jpeg|png|ico|bmp|svg|webp)$/i',$suffix)){
$suffix = 'ico'; //没匹配到后缀名则默认为ico
}
$file = "{$GLOBALS['url_md5']}.{$suffix}";
$c = curl_init();
curl_setopt($c, CURLOPT_URL, $ico_url);
curl_setopt($c, CURLOPT_TIMEOUT, $TIMEOUT);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_HEADER, FALSE);
curl_setopt($c, CURLOPT_NOBODY, FALSE);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($c, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($c, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($c, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36');
if(!empty($referer)){
curl_setopt($c, CURLOPT_REFERER, $referer);
}
try{
$res = curl_exec($c);
}finally{
$code = curl_getinfo($c, CURLINFO_HTTP_CODE);
curl_close($c);
}
if ($code == '200') { //状态码正常
//十六进制取文件头
$prefix = strtolower( dechex(ord($res[0])) . dechex(ord($res[1])) );
//根据头判断类型
if($prefix == '1f8b'){ //gzip解码
$res = gzdecode($res);
}elseif( $prefix != '3c73' && strpos($prefix, '3c') === 0){ // <开头视为文本 <?开头是svg除外
return false;
}
//3c73>svg 3c21>html 1f8b>gzip
//文件大小限制
if((strlen($res) / 1024)> $GLOBALS['config']['icon_size']){
return false;
}
$fullName = rtrim($savePath, '/') . '/' . $file;
$type = ['jpg'=>'jpeg','jpeg'=>'jpeg','svg'=>'svg+xml','ico'=>'x-icon']; //类型表
$mime = $type[$suffix] ?? 'x-icon';
//黑名单(后期考虑使用在线名单缓存到本地,以便以更好的维护)
$_md5 = md5($res);
if($_md5 == 'c531ffbdad1ba93bd84f2398052958dc') return false; //阿里云
if($_md5 == '05231fb6b69aff47c3f35efe09c11ba0') return false; //一为默认
if($_md5 == '3ca64f83fdcf25135d87e08af65e68c9') return false; //小z默认
$data = ['update_time'=>time(),'file_name'=>$file,'file_mime'=>$mime,'ico_url'=>$ico_url,'extend'=>''];
if(!has_db('global_icon',['url_md5'=>$GLOBALS['url_md5']])){
$data['url_md5'] = $GLOBALS['url_md5'];
$data['url'] = $GLOBALS['url'];
$data['add_time'] = time();
insert_db('global_icon',$data);
}else{
update_db('global_icon',$data,['url_md5'=>$GLOBALS['url_md5']]);
}
return file_put_contents($fullName, $res);
}else{
return false;
}
}
echo_link_type_icon();
function echo_icon($path,$config,$db = false){
//文件不存在时输出固定图标(理论上执行到这里不会出现文件不存在)

View File

@@ -154,7 +154,8 @@ function get_links($fid) {
$max_link = true;
}
$links = select_db('user_links',['lid(id)','fid','property','title','url(real_url)','url_standby','description','icon','click','pid','extend'],$where);
foreach ($links as $key => $link) {
$UUID = ($GLOBALS['global_config']['static_link'] == 2 ? UID : U);
foreach ($links as &$link) {
$click = false; $lock = false;
//直连模式,但存在备用链接
@@ -174,25 +175,20 @@ function get_links($fid) {
}
if($click || $site['link_model'] != 'direct'){
if($GLOBALS['global_config']['static_link'] == 1){
$links[$key]['url'] = "/{$u}/click/{$link['id']}.html";
}else{
$links[$key]['url'] = "./index.php?c=click&id={$link['id']}&u=".U;
}
$link['url'] = static_link ? "{$GLOBALS['HOST']}/click-{$UUID}-{$link['id']}.html" : "./index.php?c=click&id={$link['id']}&u={$u}";
if($lock){
$links[$key]['real_url'] = $links[$key]['url']; //篡改真实URL,防止泄密
$link['real_url'] = $link['url']; //篡改真实URL,防止泄密
if(isset($share['sid'])){
$links[$key]['url'] .='&share='.$share['sid'];
$link['url'] .='&share='.$share['sid'];
}
}
}else{
$links[$key]['url'] = $link['real_url'];
$link['url'] = $link['real_url'];
}
//获取图标链接
$links[$key]['ico'] = $lock ? $GLOBALS['libs'].'/Other/lock.svg' : geticourl($site['link_icon'],$link);
$links[$key]['type'] = 'link';
$link['ico'] = $lock ? $GLOBALS['libs'].'/Other/lock.svg' : geticourl($site['link_icon'],$link);
$link['type'] = 'link';
}
//处理扩展信息
if($GLOBALS['global_config']['link_extend'] == 1 && check_purview('link_extend',1) && in_array($GLOBALS['theme_info']['support']['link_extend'],["true","1"])){
@@ -203,36 +199,9 @@ function get_links($fid) {
}
}
//生成文章链接, 条件:非隐藏,且主题未声明不显示文章
if( intval($site['article_visual'] ?? '1') > 0 && $GLOBALS['theme_info']['support']['article'] != 'notdisplay'){
$articles = get_article_list($fid);
foreach ($articles['data'] as $article) {
if($GLOBALS['global_config']['static_link'] == 1){
$url = "/{$u}/article/{$article['id']}.html";
}else{
$url = "./index.php?c=article&id={$article['id']}&u={$u}";
}
if($site['article_icon'] == '1'){ //站点图标
$icon = $GLOBALS['favicon'];
}elseif($site['article_icon'] == '2' && !empty($article['cover'])){ //封面
$icon = $article['cover'];
}else{ //首字
$icon = './system/ico.php?text='.mb_strtoupper(mb_substr($article['title'], 0, 1));
}
$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);
}else{
array_push($links,$article_link);
}
}
}
if($max_link && $count > $site['max_link']){
$oc_url = "./index.php?u={$u}&oc={$fid}" . (empty($_GET['theme']) ? '':"&theme={$_GET['theme']}");
$oc_url = static_link ? "{$GLOBALS['HOST']}/category-{$UUID}-{$fid}.html" : "./index.php?u={$u}&oc={$fid}";
array_push($links,['id'=>0,'title'=>'查看全部','url'=>$oc_url,'real_url'=>$oc_url,'description'=>'该分类共有'.$count.'条数据','ico'=>'./favicon.ico']);
}
@@ -284,5 +253,6 @@ if(empty($_GET['share']) && !$site['ex_theme']){
write_user_count(date('Ym'),'index_Ym');
write_user_count(date('Ymd'),'index_Ymd');
count_ip();
//载入模板
require($index_path);

View File

@@ -560,7 +560,7 @@ function ccurl($url,$overtime = 3,$Referer = false,$post_data = false){
return $Res;
}
function downFile($url, $file = '', $savePath = './data/temp/',$referer = '',$TIMEOUT = 60){
function downFile($url, $file = '', $savePath = './data/temp/',$referer = '',$TIMEOUT = 60,$post_data = false){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_TIMEOUT, $TIMEOUT); //超时/秒
@@ -570,6 +570,10 @@ function downFile($url, $file = '', $savePath = './data/temp/',$referer = '',$TI
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); //允许重定向(适应网盘下载)
if(!empty($post_data)){
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
}
if(!empty($referer)){
curl_setopt($ch, CURLOPT_REFERER, $referer);
}
@@ -579,14 +583,14 @@ function downFile($url, $file = '', $savePath = './data/temp/',$referer = '',$TI
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
}
if ($code == '200') { //状态码正常
if(empty($file)){ //如果文件名为空
$file = date('Ymd_His').'.tmp';
}
$fullName = rtrim($savePath, '/') . '/' . $file;
return file_put_contents($fullName, $res);
return file_put_contents($fullName, $res) > 0;
}elseif($code == '202'){
return $res;
}else{
return false;
}
@@ -652,6 +656,9 @@ function is_Duplicated($array, $field){
//检查权限(有权限返回true 没有权限时根传递参数1是返回false 2是直接返回错误信息)
function check_purview($name,$return_type){
global $USER_DB;
if($USER_DB == null){
return true;
}
//230705新增,禁止判断默认用户是否可以使用自定义代码
if($USER_DB['UserGroup'] == 'default' && $GLOBALS['global_config']['c_code'] != '1' && ( $name == 'header' || $name == 'footer' )){
return false;
@@ -675,10 +682,11 @@ function check_purview($name,$return_type){
function data_encryption($method,$extend = []){
$subscribe = unserialize(get_db('global_config','v',["k" => "s_subscribe"]));
if(!isset($subscribe['public']) || empty($subscribe['public'])){
msg(-1,'未检测到授权秘钥,如果已经获取授权,请在授权管理页面点击保存设置后在重试!');
msg(-1,'未检测到授权秘钥,如果已经获取授权,请在授权管理页面点击保存设置后在重试!');
}
$data['key'] = $subscribe['order_id'];
$data['host'] = $_SERVER['HTTP_HOST'];
$data['sysver'] = SysVer;
$data['time'] = time();
$data['ip'] = Get_IP();
$data['method'] = $method;
@@ -789,4 +797,31 @@ function clean_cache(){
foreach(['home','login','transit','register','guide','article','apply','verify','guestbook'] as $v){
write_global_config($v.'_cache','',$v.'_模板缓存');
}
}
//取系统版本(日期)
function get_SysVer(){
if(preg_match('/^v.+-(\d{8})$/i',SysVer,$matches)){
return $matches[1];
}else{
return 19990101;
}
}
function get_HOST(){
return (((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 'https://' :'http://').$_SERVER['HTTP_HOST'];
}
function get_UUID(){
return ($GLOBALS['global_config']['static_link'] == 2 ? UID : U);
}
function get_surl($input,$id=''){
return get_HOST().'/'.strtr($input, ['{UUID}'=>get_UUID(),'{id}'=>$id]);
}
function get_OEM(){
$OEM['program_name'] = "TwoNav";
return $OEM;
}
//返回404
function Not_Found() {
header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit;
}

View File

@@ -101,6 +101,19 @@ $theme_config = empty($theme_config_db) ? $theme_config : array_merge ($theme_co
//主题版本
$theme_ver = Debug ? "{$theme_info['version']}.".time() : $theme_info['version'];
//版权信息
$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>';
//访问域名(伪静态用)
$HOST = get_HOST();
$OEM = get_OEM();
//静态链接
define('static_link',$global_config['static_link'] > 0);
$urls['login'] = static_link ? "$HOST/login":"./?c=login";
$urls['register'] = static_link ? "$HOST/register":"./?c=register";
if($config_type == 'user'){
//载入站点设置
$site = unserialize(get_db('user_config','v',['uid'=>UID,'k'=>'s_site']));
@@ -113,17 +126,17 @@ if($config_type == 'user'){
//站点图标
$favicon = ( !empty($site['site_icon_file'])) ? $site['site_icon'] : './favicon.ico';
//相关入口
$UUID = get_UUID();
$urls['home'] = static_link ? "$HOST/{$UUID}.html":"./?u={$u}";
$urls['admin'] = static_link ? "$HOST/admin-{$UUID}.html":"./?c=admin&u={$u}";
$urls['apply'] = static_link ? "$HOST/apply-{$UUID}.html":"./?c=apply&u={$u}";
$urls['guestbook'] = static_link ? "$HOST/guestbook-{$UUID}.html":"./?c=guestbook&u={$u}";
}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]));
@@ -194,6 +207,9 @@ function get_open_category(){
//获取文章列表
function get_article_list($category = 0,$limit = 0){
if($GLOBALS['global_config']['article'] < 1){
return ['data'=>[],'count'=>0];
}
$where['uid'] = UID;
if(!is_login()){
$where['AND']['state'] = 1; //状态筛选
@@ -212,7 +228,8 @@ function get_article_list($category = 0,$limit = 0){
}
//获取文章列表
$datas = select_db('user_article_list','*',$where);
$host = get_HOST();
$uuid = get_UUID();
//查询分类
$categorys = select_db('user_categorys',['cid(id)','name'],['uid'=>UID]);
$categorys = array_column($categorys,'name','id');
@@ -221,10 +238,10 @@ function get_article_list($category = 0,$limit = 0){
$data['category_name'] = $categorys[$data['category']] ?? 'Null';
$data['title'] = htmlspecialchars($data['title'],ENT_QUOTES);
$data['summary'] = htmlspecialchars($data['summary'],ENT_QUOTES);
if($GLOBALS['global_config']['static_link'] == 1){
$data['url'] = "/{$GLOBALS['u']}/article/{$data['id']}.html";
if(static_link){
$data['url'] = "{$host}/article-{$uuid}-{$data['id']}.html";
}else{
$data['url'] = "./index.php?c=article&id={$data['id']}&u={$GLOBALS['u']}";
$data['url'] = "./index.php?c=article&id={$data['id']}&u={$u}";
}
}
return ['data'=>$datas,'count'=>$count];
@@ -232,6 +249,9 @@ function get_article_list($category = 0,$limit = 0){
//根据文章id获取内容
function get_article_content($id){
if($GLOBALS['global_config']['article'] < 1){
return ['data'=>[],'count'=>0];
}
$where['uid'] = UID;
if(!is_login()){
$where['state'] = 1; //状态筛选
@@ -280,7 +300,68 @@ 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;
function get_links2($fid,$limit = 0) {
global $site,$u;
$fid_s = select_db('user_categorys',['cid','fid','pid'],['uid'=>UID,'status'=>1]);
$fid_s = array_column($fid_s,null,'cid');
$where['uid'] = UID;
$where['fid'] = intval($fid);
$where['status'] = 1;
$where['ORDER']['weight'] = 'ASC';
$where['ORDER']['lid'] = 'ASC';
if($limit > 0){
$where['LIMIT'] = [0,$limit];
}
if(!is_login){
$where['property'] = 0;
}
$links = select_db('user_links',['lid(id)','fid','property','title','url(real_url)','url_standby','description','icon','click','pid','extend'],$where);
$UUID = ($GLOBALS['global_config']['static_link'] == 2 ? UID : U);
foreach ($links as &$link) {
$click = false; $lock = false;
//直连模式,但存在备用链接
if ($site['link_model'] == 'direct' && $site['main_link_priority'] != '3' && !empty($link['url_standby'])){
$click = true;
}
//未登录,判断是否加密
if(!is_login){
//链接加密了
if(!empty($link['pid'])){
$click = true; $lock = true;
//父分类加密了 或 祖分类加密了
}elseif(!empty($fid_s[$link['fid']]['pid']) || (!empty($fid_s[$link['fid']]['fid']) && !empty($fid_s[$fid_s[$link['fid']]['fid']]['pid'])) ){
$click = true; $lock = true;
}
}
if($click || $site['link_model'] != 'direct'){
$link['url'] = static_link ? "{$GLOBALS['HOST']}/click-{$UUID}-{$link['id']}.html" : "./index.php?c=click&id={$link['id']}&u={$u}";
if($lock){
$link['real_url'] = $link['url'];
}
}else{
$link['url'] = $link['real_url'];
}
//获取图标链接
$link['ico'] = $lock ? $GLOBALS['libs'].'/Other/lock.svg' : geticourl($site['link_icon'],$link);
}
return $links;
}
function admin_inlet() {
global $USER_DB;
$v = unserialize($USER_DB['LoginConfig'])['admin_inlet'];
if($v == 'display'){
return true;
}elseif($v == 'hide'){
return false;
}elseif($v == 'condition1'){
return is_login();
}else{
return true;
}
}

View File

@@ -1 +1 @@
v2.0.40-20230917
v2.1.01-20231002

View File

@@ -3,93 +3,114 @@ layui.use(['layer','miniTab'], function(){
var $ = layui.$;
var miniTab = layui.miniTab;
//获取最新版本
let latest_version = $("#new_ver").text();
//console.log(latest_version);
$("#new_ver").append('<span id="sysup" style="cursor:pointer;color:darkgray;">&nbsp;更新系统&nbsp;</span> ');
$("#new_ver").append('<i class="fa fa-spinner fa-spin update" style="cursor:pointer;color: rgb(127 137 141);" title="正在检测更新中"></i>');
//获取当前版本
let current_version = $("#ver").text();
//console.log(current_version);
let pattern = /\d{8}/;
current_version = pattern.exec(current_version)[0];
latest_version = pattern.exec(latest_version)[0];
//如果当前版本小于最新版本,则提示更新
if( current_version < latest_version ) {
$("#new_ver").append(' <span id="sysup" style="cursor:pointer;color:red;">&nbsp;更新系统</span>');
if($("#layuiminiHomeTabId",parent.document).attr('class') == 'layui-this'){
$('html,body').animate({scrollTop : $("#msg").offset().top - 20});
layer.tips("点击此处更新到最新版","#sysup",{tips: [3, "#ff5722"],time: 60*1000,anim: 6});
layer.msg(' 检测到新版本,请尽快更新 ', {offset: 'b',anim: 6,time: 60*1000});
}
//点击更新事件
$('#sysup').on('click', function(){
let tip = layer.open({
title:"系统更新"
,content: "1.更新有风险请备份后再更新<br />2.更新后检查主题是否可更新<br />3.更新时请勿有其他操作<br />4.更新时请勿刷新或关闭页面<br />5.确保所有文件(夹)是可写权限"
,btn: ['确定更新', '更新内容', '取消']
,yes: function(index, layero){
let fail = false;
let up_info = {'code':0};
let i=0;
layer.close(tip);
layer.load(1, {shade:[0.3,'#fff']});//加载层
let msg_id = layer.msg('正在准备更新,请勿操作.', {icon: 16,time: 1000*300});
//设置同步模式
$.ajaxSetup({ async : false });
//获取更新信息
$.post(get_api("other_upsys"),{"i":0}, function(data, status) {
up_info = data;
});
//如果失败
if(up_info.code != 1){
layer.closeAll();
layer.alert(up_info.msg || "错误代码404",{icon:2,title:'更新失败',anim: 2,shadeClose: false,closeBtn: 0,btn: ['知道了']});
return;
}
//设为异步模式
$.ajaxSetup({ async : true });
//开始请求更新
request_update(); let msg = '';
function request_update(){
if( i >= up_info.info.length){
layer.closeAll();
layer.alert('更新完毕,请刷新页面!',{icon:1,title:'更新成功',anim: 2,shadeClose: false,closeBtn: 0,btn: ['刷新页面']},function () {parent.location.reload();});
return;
}else{
i++;
}
$("#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 + ' / ' + up_info.info.length + ' ] ' + up_info.info[i-1]);
$.post(get_api("other_upsys"),{"i":i}, function(data, status) {
if (data.code == 1) {
request_update();
}else{
layer.closeAll();
layer.alert(data.msg || "未知错误,请联系开发者!",{icon:5,title:up_info.info[i-1],anim: 2,shadeClose: false,closeBtn: 0,btn: ['知道了']});
}
});
}
},btn2: function(index, layero){
window.open("https://gitee.com/tznb/TwoNav/releases");
},btn3: function(index, layero){
return true;
},cancel: function(){
return true;
}
// 获取最新信息
$.post(get_api('other_services','get_notice'),function(data,status){
console.log(data );
if(data.code == 200) {
$("#new_ver a").text(data.version);
$('#notice_link').text('');
data.notice.forEach(notice => {
$('#notice_link').append(`<div class="layuimini-notice"><div class="layuimini-notice-title"><a href="${notice.url}" target="_blank">${notice.title}</a></div></div>`);
});
});
}else{
$("#new_ver").append(' <span id="sysup" style="cursor:pointer;color: rgb(1, 170, 237);">&nbsp;更新系统</span>');
$('#sysup').on('click', function(){
layer.alert("暂无可用更新,当前为最新版本",{icon:1,title:"更新系统",anim: "slideDown",shadeClose: true,closeBtn: 0,btn: ['知道了']});
});
}
$('#notice_text').html(data.message);
}
init_update();
$(".update").remove();
}).fail(function () {
$(".update").remove();
layer.msg('请求失败', {icon: 5});
});
function init_update(){
//获取最新版本
let latest_version = $("#new_ver").text();
//获取当前版本
let current_version = $("#ver").text();
let pattern = /\d{8}/;
current_version = pattern.exec(current_version)[0];
latest_version = pattern.exec(latest_version)[0];
//如果当前版本小于最新版本,则提示更新
if( current_version < latest_version ) {
$("#sysup").css("color", "red");
if($("#layuiminiHomeTabId",parent.document).attr('class') == 'layui-this'){
$('html,body').animate({scrollTop : $("#msg").offset().top - 20});
layer.tips("点击此处更新到最新版","#sysup",{tips: [3, "#ff5722"],time: 60*1000,anim: 6});
layer.msg(' 检测到新版本,请尽快更新 ', {offset: 'b',anim: 6,time: 60*1000});
}
//点击更新事件
$('#sysup').on('click', function(){
let tip = layer.open({
title:"系统更新"
,content: "1.更新有风险请备份后再更新<br />2.更新后检查主题是否可更新<br />3.更新时请勿有其他操作<br />4.更新时请勿刷新或关闭页面<br />5.确保所有文件(夹)是可写权限"
,btn: ['确定更新', '更新内容', '取消']
,yes: function(index, layero){
let fail = false;
let up_info = {'code':0};
let i=0;
layer.close(tip);
layer.load(1, {shade:[0.3,'#fff']});//加载层
let msg_id = layer.msg('正在准备更新,请勿操作.', {icon: 16,time: 1000*300});
//设置同步模式
$.ajaxSetup({ async : false });
//获取更新信息
$.post(get_api("other_upsys"),{"i":0}, function(data, status) {
up_info = data;
});
//如果失败
if(up_info.code != 1){
layer.closeAll();
layer.alert(up_info.msg || "错误代码404",{icon:2,title:'更新失败',anim: 2,shadeClose: false,closeBtn: 0,btn: ['知道了']});
return;
}
//设为异步模式
$.ajaxSetup({ async : true });
//开始请求更新
request_update(); let msg = '';
function request_update(){
if( i >= up_info.info.length){
layer.closeAll();
layer.alert('更新完毕,请刷新页面!',{icon:1,title:'更新成功',anim: 2,shadeClose: false,closeBtn: 0,btn: ['刷新页面']},function () {parent.location.reload();});
return;
}else{
i++;
}
$("#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 + ' / ' + up_info.info.length + ' ] ' + up_info.info[i-1]);
$.post(get_api("other_upsys"),{"i":i}, function(data, status) {
if (data.code == 1) {
request_update();
}else{
layer.closeAll();
layer.alert(data.msg || "未知错误,请联系开发者!",{icon:5,title:up_info.info[i-1],anim: 2,shadeClose: false,closeBtn: 0,btn: ['知道了']});
}
});
}
},btn2: function(index, layero){
window.open("https://gitee.com/tznb/TwoNav/releases");
},btn3: function(index, layero){
return true;
},cancel: function(){
return true;
}
});
});
}else{
$("#sysup").css("color", "rgb(1, 170, 237)");
$('#sysup').on('click', function(){
layer.alert("暂无可用更新,当前为最新版本",{icon:1,title:"更新系统",anim: "slideDown",shadeClose: true,closeBtn: 0,btn: ['知道了']});
});
}
}
//查看更新日志
$('#ver').css({"cursor":"pointer","color":"#01AAED"}); //设置鼠标形状和字体颜色
$('#ver').attr("title","点击查看更新日志");
@@ -99,7 +120,6 @@ layui.use(['layer','miniTab'], function(){
title:"更新日志",
});
});
});
function get_api(method,type=null){

View File

@@ -74,7 +74,7 @@ function Get_baseUrl() {
}
function Authorization_Prompt() {
layer.alert("您正在使用的是免费版,此功能需购买授权才可使用<br />如果您已购买授权,请在授权管理页面输入并保存<br />然后在更新系统即可解锁全部功能!")
layer.alert("您正在使用的是免费版,此功能需购买授权才可使用<br />如果您已购买授权,请在授权管理页面输入并保存<br />然后在更新系统即可解锁全部功能!");
}
//帮助

View File

@@ -107,10 +107,10 @@ layui.use(function(){
datas = r.data;
render_data(r);
} else {
layer.alert("获取数据失败,请重试!",{icon:5,title:'错误',anim: 2,closeBtn: 0,btn: ['刷新页面']},function () {location.reload();});
layer.alert("获取数据失败,请重试!",{icon:5,title:'错误',anim: 2,closeBtn: 1,btn: ['刷新页面']},function () {location.reload();});
}
}).fail(function () {
layer.alert("获取数据异常,请重试!",{icon:5,title:'错误',anim: 2,closeBtn: 0,btn: ['刷新页面']},function () {location.reload();});
layer.alert("获取数据异常,请重试!",{icon:5,title:'错误',anim: 2,closeBtn: 1,btn: ['刷新页面']},function () {location.reload();});
});
}

View File

@@ -25,7 +25,17 @@ $LoginConfig['totp_key'] = empty($LoginConfig['totp_key']) ? '0':'1';?>
</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="admin_inlet" >
<option value="display" selected>显示</option>
<option value="hide">隐藏</option>
<option value="condition1">登录时显示</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" >
@@ -89,7 +99,6 @@ $LoginConfig['totp_key'] = empty($LoginConfig['totp_key']) ? '0':'1';?>
</div>
<div class="layui-form-mid layui-word-aux">部分主题和插件需设为兼容 <a href="javascript:;" layuimini-content-href="Token" data-title="Token"><font color="red"> 获取API ( Token )</font></a></div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">登录后</label>
<div class="layui-input-inline" >

View File

@@ -267,7 +267,7 @@ layui.use(['layer','element','upload','form','table'], function(){
var up_bookmark = upload.render({
elem: '#up_html'
,url: get_api('write_data_control','upload')
,exts: 'html|db3'
,exts: 'html|db3|itabdata'
,accept: 'file'
,size: 1024 * 10
,data: {"page_sid":page_sid}
@@ -290,6 +290,12 @@ layui.use(['layer','element','upload','form','table'], function(){
$("#property").hide();
$("#attr").show();
$("#source").show();
}else if(suffix == 'itabdata'){
$("#fid").hide();
$("#AutoClass").hide();
$("#property").hide();
$("#attr").hide();
$("#source").hide();
}else{
$("#fid").show();
$("#AutoClass").show();

View File

@@ -95,7 +95,18 @@ layui.use(['form'], function(){
}
});
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>

View File

@@ -1,9 +1,5 @@
<?php
$content = '免费版不支持此功能,请购买授权';
require DIR.'/templates/admin/page/404.php';
exit;
$article_id = Get('id');
$mode = empty($article_id) ? 'add' : 'edit' ;
@@ -15,6 +11,7 @@ if($mode == 'edit'){
}else{
$mode = 'add';
}
}
$title = $mode == 'add' ? '添加文章' : '编辑文章';

View File

@@ -1,9 +1,5 @@
<?php
//读取设置
$set['visual'] = $s_site['article_visual'] ?? '1';
$set['icon'] = $s_site['article_icon'] ?? '1';
$title='文章列表';
require dirname(__DIR__).'/header.php' ?>
<body>
<div class="layuimini-container">
@@ -240,7 +236,40 @@ layui.use(['form','table','dropdown','miniTab'], function () {
id: 'push'
}],
click: function(obj){
Authorization_Prompt();
let checkStatus = table.checkStatus('table').data;
if( checkStatus.length == 0 ) {
layer.msg('未选中任何数据!');
return;
}
//获取被选ID并格式化
tableIds = checkStatus.map(function (value) {return value.id;});
tableIds = JSON.stringify(tableIds);
//删除文章
if(obj.id == 'del_article'){
layer.confirm('确认删除?',{icon: 3, title:'温馨提示'}, function(index){
$.post(get_api('write_article','del_article'),{id:tableIds},function(data,status){
if(data.code == 1) {
search();
layer.msg(data.msg, {icon: 1});
}else{
layer.msg(data.msg, {icon: 5});
}
});
});
}else if(obj.id == 'up_category'){
index = layer.open({type: 1,scrollbar: false,shadeClose: true,title: false ,area : ['100%', '100%'],closeBtn:0,content: $('.batch_category')});
}else if(obj.id == 'up_state'){
$.post(get_api('write_article','up_state'),{'id':tableIds,'state_id':obj.value},function(data,status){
if(data.code == 1) {
search();
layer.msg('操作成功', {icon: 1});
}else{
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')});
}
}
});
}
@@ -272,18 +301,56 @@ layui.use(['form','table','dropdown','miniTab'], function () {
}
//监听工具栏
table.on('toolbar(table)', function (obj) {
if(obj.event == 'set'){ //设置
var btn = obj.event;
if (btn == 'add_article') { //添加文章
Authorization_Prompt();
}else if(btn == 'set'){ //设置
index = layer.open({type: 1,scrollbar: false,shadeClose: true,title: false ,area : ['100%', '100%'],closeBtn:0,content: $('.set')});
return false;
}else{ //综合批量操作
//取选中数据
var checkStatus = table.checkStatus(obj.config.id);
if( checkStatus.data.length == 0 && ['LAYTABLE_COLS','LAYTABLE_EXPORT','LAYTABLE_PRINT'].indexOf(btn) == -1 ) {
layer.msg('未选中任何数据!');
return;
}
//批量删除
if(btn == 'batch_del'){
tableIds = checkStatus.data.map(function (value) {return value.id;});
tableIds = JSON.stringify(tableIds);
layer.confirm('确认删除?',{icon: 3, title:'温馨提示'}, function(index){
$.post(get_api('write_article','del_article'),{id:tableIds},function(data,status){
if(data.code == 1) {
search();
layer.msg(data.msg, {icon: 1});
}else{
layer.msg(data.msg, {icon: 5});
}
});
});
}
}
Authorization_Prompt();
});
//监听行工具
table.on('tool(table)', function (obj) {
Authorization_Prompt();
let btn = obj.event;
let data = obj.data;
if (btn === 'del') {
layer.confirm('确认删除?',{icon: 3, title:'温馨提示'}, function(index){
$.post(get_api('write_article','del_article'),{id:'['+data.id+']'},function(data,status){
if(data.code == 1) {
obj.del();
layer.msg(data.msg, {icon: 1});
}else{
layer.msg(data.msg, {icon: 5});
}
});
});
}else if(btn === 'edit'){
Authorization_Prompt();
}
});
//设置相关
form.val('set_form', <?php echo json_encode($set);?>);

View File

@@ -1,5 +1,6 @@
<?php
$s = unserialize( get_db("user_config", "v", ["k" => "guestbook","uid"=>UID]) );
if(empty($s)){
$s = [];
@@ -10,27 +11,9 @@ if(!Check_Path("data/user/{$u}/MessageBoard")){
$dir = DIR."/data/user/{$u}/MessageBoard/";
if($_POST['type'] == 'set'){
$s['allow'] = $_POST['set'];
write_user_config('guestbook',$s,'config','留言板配置');
msg(1,'操作成功');
msg(-1,'免费不支持此功能');
}elseif($_POST['type'] == 'del'){
if($_POST['name'] == 'help'){
$s['help'] = 'del';
write_user_config('guestbook',$s,'config','留言板配置');
msg(1,'删除成功');
}
//文件名检测
if( !preg_match_all('/^\d+_\d+\.json$/',$_POST['name']) ) {
msg(-1,'数据库名称不合法!');
}
$path = DIR."/data/user/{$u}/MessageBoard/".$_POST['name'];
if(!file_exists($path)){
msg(-1,'文件不存在');
}else if(unlink($path)){
msg(1,'删除成功');
}else{
msg(-1,'删除失败');
}
msg(-1,'免费不支持此功能');
}
@@ -100,7 +83,7 @@ $title='留言管理';require dirname(__DIR__).'/header.php';
<body>
<div class="layuimini-container">
<div class="layuimini-main">
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;"><legend><a style="cursor:pointer;" title="点击打开客户留言页面" rel = "nofollow" href="./?c=guestbook&u=<?php echo U;?>" target="_blank">TowNav 极简留言板</a></legend></fieldset>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;"><legend><a style="cursor:pointer;" title="点击打开客户留言页面" rel = "nofollow" href="<?php echo (static_link ? get_surl("guestbook-{UUID}.html"):"./?c=guestbook&u={$u}") ;?>" target="_blank">TowNav 极简留言板</a></legend></fieldset>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
<legend>当前设置:<a style="cursor:pointer;" title="点击切换" rel = "nofollow" onclick = "set('<?php echo $s['allow']== '1'?'0':'1';?>')"><?php echo $s['allow']== '1'?'允许留言':'禁止留言';?></a>
</legend>
@@ -136,11 +119,24 @@ $('.click').click(function (event) {
});
function del(name) {
Authorization_Prompt();
$.post('',{'type':'del','name':name},function(data,status){
if(data.code == 1) {
layer.msg("删除成功", {icon: 1});
setTimeout(() => {location.reload();}, 500);
}else{
layer.msg(data.msg, {icon: 5});
}
});
}
function set(key){
Authorization_Prompt();
$.post('',{'type':'set','set':key},function(data,status){
if(data.code == 1) {
location.reload();
}else{
layer.msg(data.msg, {icon: 5});
}
});
}
</script>

View File

@@ -54,7 +54,7 @@
</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>';} ?>
<button class="layui-btn" lay-submit lay-filter="Submit">提交</button>
</div>
</div>
</form>

View File

@@ -100,6 +100,7 @@ $title='站点地图';require(dirname(__DIR__).'/header.php');
<option value="0" >不生成</option>
<option value="1" >动态地址 | http://example.com/index.php?c=click&id=1&u=user</option>
<option value="2" selected="">静态地址 | http://example.com/user/click/1.html</option>
<option value="2" selected="">静态地址 | http://example.com/click-user-1.html</option>
</select>
</div>
</div>
@@ -125,7 +126,7 @@ $title='站点地图';require(dirname(__DIR__).'/header.php');
<select name="article_page">
<option value="0" >不生成</option>
<option value="1" >动态地址 | http://example.com/index.php?c=article&id=1&u=user</option>
<option value="2" selected="">静态地址 | http://example.com/user/article/1.html</option>
<option value="2" selected="">静态地址 | http://example.com/article-user-1.html</option>
</select>
</div>
</div>
@@ -179,7 +180,17 @@ layui.use(['jquery','form'], function () {
//监听提交
form.on('submit(save)', function (data) {
Authorization_Prompt();
$.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;
});
//测试

View File

@@ -4,70 +4,26 @@ $awesome=true;
//读取缓存数据
$Notice = get_db('global_config','v',['k'=>'notice']);
//如果不为空,则解析数据
if(!empty($Notice)){
$data = json_decode($Notice, true);
$cache_time = 60; //缓存时间(秒);
$reload = time() > $data["download_time"] + $cache_time; //是否更新公告
}else{
$reload = true; //需要刷新
}
//是否下载数据
if(!offline && $reload){
$overtime = !isset($global_config['Update_Overtime']) ? 3 : ($global_config['Update_Overtime'] < 3 || $global_config['Update_Overtime'] > 60 ? 3 : $global_config['Update_Overtime']);
if(!is_subscribe('bool')){
$urls = ["gitee" => "http://tznb.gitee.io/twonav_resource/Notice.json"];
}else{
$urls = ["twonav" => "http://service.twonav.cn/service.php"];
}
$Source = $global_config['Update_Source'] ?? '';
if (!empty($Source) && isset($urls[$Source])) {
$urls = [$Source => $urls[$Source]];
}
foreach($urls as $key => $url){
if($key == 'gitee'){
$Res = ccurl($url,$overtime);
}else{
$Res = ccurl($url,30,true,data_encryption('get_new_ver',['ver'=>SysVer]));
}
$new_data = json_decode($Res['content'], true);unset($Res);
if($new_data["code"] == 200 ){ //下载成功,写入缓存
$new_data['download_time'] = time();
write_global_config('notice',json_encode($new_data),'官方公告(缓存)');
$data = $new_data;
unset($new_data);
break;
}
}
}
//判断是否为空
if(empty($data['version'])){
$data['version'] = SysVer; //获取失败时=当前版本
}else{
//比较远程版本
if(version_compare($data['version'],SysVer,'<')){
$data['version'] = SysVer; //远程版本比当前旧是最新版本显示当前版本
}
}
$data = empty($Notice)?[]:json_decode($Notice, true);
//输出公告
function echo_notice($data){
//输出最新动态
function echo_notice_link($data){
if(empty($data["notice"])){
return;
}
echo '<div class="layui-card"><div class="layui-card-header"><i class="fa fa-bullhorn icon"></i>最新动态</div><div class="layui-card-body layui-text">';
echo '<div class="layui-card"><div class="layui-card-header"><i class="fa fa-bullhorn icon"></i>最新动态</div><div class="layui-card-body layui-text" id="notice_link">';
foreach($data["notice"] as $value){
echo "<div class=\"layuimini-notice\"><div class=\"layuimini-notice-title\"><a href=\"{$value['url']}\" target=\"_blank\">{$value['title']}</a></div></div>";
}
echo '</div></div>';
}
//输出作者心语
function echo_message($data){
//输出官方公告
function echo_notice_text($data){
if(empty($data["message"])){
return;
}
echo '<div class="layui-card"><div class="layui-card-header"><i class="fa fa-paper-plane-o icon"></i>作者心语</div><div class="layui-card-body layui-text layadmin-text">';
echo '<div class="layui-card"><div class="layui-card-header"><i class="fa fa-bell-o icon"></i>官方公告</div><div class="layui-card-body layui-text layadmin-text" id="notice_text">';
echo $data['message'];
echo '</div></div>';
}
@@ -82,12 +38,9 @@ if( $global_config['Sub_domain'] == 1 && check_purview('Sub_domain',1)){
}
}
if(!isset($_h)){
$_h = './?u='.U;
$_l = './?c='.$USER_DB['Login'].'&u='.U;
$_h = static_link ? get_surl('{UUID}.html'):"./?u={$u}";
$_l = static_link ? get_surl("login-{UUID}-{$USER_DB['Login']}.html"):"./c={$USER_DB['Login']}&u={$u}" ;
}
require 'header.php';
?>
<style>
@@ -232,9 +185,9 @@ require 'header.php';
</a>
</div>
<div class="layui-col-xs3 layuimini-qiuck-module">
<a href="javascript:;" layuimini-content-href="UserPassword" data-title="修改密码" data-icon="fa fa-key">
<i class="fa fa-key"></i>
<cite>修改密码</cite>
<a href="https://gitee.com/tznb/TwoNav/wikis/pages?sort_id=7968669&doc_id=3767990" target="_blank">
<i class="fa fa-diamond"></i>
<cite>购买授权</cite>
</a>
</div>
</div>
@@ -314,8 +267,8 @@ require 'header.php';
</table>
</div>
</div>
<?php echo_notice($data); //官方公告?>
<?php echo_message($data); //作者心语?>
<?php echo_notice_link($data); //最新动态 ?>
<?php echo_notice_text($data); //官方公告 ?>
</div>
</div>
</div>

View File

@@ -141,11 +141,10 @@ $LoginConfig = unserialize( get_db("global_config", "v", ["k" => "LoginConfig"])
<label class="layui-form-label">链接图标</label>
<div class="layui-input-inline" >
<select name="link_icon">
<option value="0" selected>离线图标</option>
<!--<option value="1" >本地服务(支持缓存)</option>-->
<option value="2" >favicon.rss.ink (小图标)</option>
<option value="4" >api.15777.cn</option>
<option value="5" >favicon.cccyun.cc</option>
<option value="0" selected>离线图标(首字图标)</option>
<option value="20" >本地服务</option>
<option value="21" >本地服务(伪静态)</option>
<option value="2" >favicon.png.pub (小图标)</option>
<option value="6" >api.iowen.cn</option>
</select>
</div>

View File

@@ -112,14 +112,37 @@ layui.use(['jquery','form'], function () {
var form = layui.form;
var layer = layui.layer;
var $ = layui.jquery;
//表单赋值
form.val('form', <?php echo json_encode(unserialize( get_db("global_config", "v", ["k" => "mail_config"])));?>);
//监听提交
form.on('submit(save)', function (data) {
Authorization_Prompt();
$.post(get_api('other_root','write_mail_config'),data.field,function(data,status){
if(data.code == 1) {
if(data.msg!="保存成功"){
layer.alert(data.msg)
}else{
layer.msg(data.msg, {icon: 1});
}
}else{
layer.msg(data.msg, {icon: 5});
}
});
return false;
});
//测试
form.on('submit(send_test)', function (data) {
Authorization_Prompt();
layer.load(1, {shade:[0.3,'#fff']});
layer.msg('正在发送中..', {icon: 16,time: 1000*300});
$.post(get_api('other_root','write_mail_test'),data.field,function(data,status){
layer.closeAll();
if(data.code == 1) {
layer.alert(data.msg);
}else{
layer.msg(data.msg, {icon: 5});
}
});
return false;
});

View File

@@ -123,6 +123,27 @@ $title='系统设置';require(dirname(__DIR__).'/header.php');
<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="Update_Source">
<option value="0" selected="">自动</option>
<option value="1">国内-1</option>
<option value="2">国内-2</option>
<option value="3">海外-3</option>
</select>
</div>
<div class="layui-form-mid layui-word-aux">默认为自动 (非必要请勿修改)</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">请求超时</label>
<div class="layui-input-inline">
<input type="number" name="Update_Overtime" autocomplete="off" value="3" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">默认3秒,范围3-60 (非必要请勿修改)</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">调试模式</label>
<div class="layui-input-inline">
@@ -150,10 +171,11 @@ $title='系统设置';require(dirname(__DIR__).'/header.php');
<div class="layui-input-inline">
<select name="static_link">
<option value="0" selected="">关闭</option>
<option value="1" >开启</option>
<option value="1" >开启-UN</option>
<option value="2" >开启-UID</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">
@@ -210,26 +232,6 @@ $title='系统设置';require(dirname(__DIR__).'/header.php');
</div>
<div class="layui-form-mid layui-word-aux">请勿开启!请勿开启!请勿开启!</div>
</div>
<div class="layui-form-item layui-hide">
<label class="layui-form-label">资源接口</label>
<div class="layui-input-inline">
<select name="Update_Source">
<option value="0" selected="">自动</option>
<option value="lm21">主线路</option>
<option value="gitee">备用线路(gitee)</option>
</select>
</div>
<div class="layui-form-mid layui-word-aux">备用资源不定期更新,非必要请勿使用!</div>
</div>
<div class="layui-form-item layui-hide">
<label class="layui-form-label">资源超时</label>
<div class="layui-input-inline">
<input type="number" name="Update_Overtime" autocomplete="off" value="3" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">默认3秒,范围3-60</div>
</div>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;"><legend>扩展功能</legend></fieldset>
<blockquote class="layui-elem-quote layui-text" style="">注:开关后请刷新整个页面</blockquote>

View File

@@ -20,7 +20,7 @@ require(dirname(__DIR__).'/header.php');
<div class="layui-btn-container">
<button type="button" class="layui-btn copy_log">复制内容</button>
<button type="button" class="layui-btn diagnose">一键诊断</button>
<button type="button" class="layui-btn connectivity_test">网络检测</button>
<button type="button" class="layui-btn connectivity_test">连通测试</button>
<button type="button" class="layui-btn phpinfo">phpinfo</button>
<?php if(preg_match('/nginx/i',$_SERVER['SERVER_SOFTWARE']) ){ ?>
<button type="button" class="layui-btn rewrite">生成伪静态</button>
@@ -84,7 +84,7 @@ layui.use(['layer','form','miniTab'], function () {
$("#console_log").append("客户端时间:" + timestampToTime(Math.round(new Date() / 1000) ) +"\n");
var urls = [
['资源节点-码云', 'http://tznb.gitee.io/twonav_resource/connectivity_test.json']
['资源节点-码云', 'https://gitee.com/tznb/TwoNav_Resource/raw/master/connectivity_test.txt']
];
urls.forEach(function(route) {
var routeName = route[0];
@@ -132,23 +132,6 @@ 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`);
@@ -156,8 +139,6 @@ layui.use(['layer','form','miniTab'], function () {
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`);
}

View File

@@ -58,13 +58,22 @@ layui.use(['table','layer','form'], function () {
var limit = localStorage.getItem(u + "_limit") || 50;
var api = get_api('read_user_list','list');
var IDs = [];
var static_link = 0;
var cols = [[
{type:'checkbox'} //开启复选框
,{field:'ID',title:'ID',width:60,sort:true,event:'login_entry',style:'cursor: pointer;color: #3c78d8;'}
,{title:'操作',toolbar:'#line_tool',width:70}
,{field:'User',title:'账号',minWidth:120,sort:true,templet:function(d){
return '<a style="color:#3c78d8" title="打开用户主页" target="_blank" href="./?u='+d.User+'">'+d.User+'</a>'
if(static_link == 1){
url = `./${d.User}.html`;
}else if(static_link == 2){
url = `./${d.ID}.html`;
}else{
url = `./index.php?&u=${d.User}`;
}
return '<a style="color:#3c78d8" title="打开用户主页" target="_blank" href="'+url+'">'+d.User+'</a>'
}}
,{field:'UserGroupName',title:'用户组',minWidth:90,sort:true}
,{field:'Email',title:'Email',minWidth:170,sort:true,event:'set_email',style:'cursor: pointer;color: #3c78d8;'}
@@ -203,9 +212,13 @@ layui.use(['table','layer','form'], function () {
});
});
}else if(obj.event == 'login_entry'){
window.open('./index.php?c=' + data.Login + '&u=' + data.User);
}else if(obj.event == 'homepage'){
window.open('./index.php?&u=' + data.User);
if(static_link == 1){
window.open(`./login-${data.User}-${data.Login}.html`);
}else if(static_link == 2){
window.open(`./login-${data.ID}-${data.Login}.html`);
}else{
window.open('./index.php?c=' + data.Login + '&u=' + data.User);
}
}else if(obj.event == 'ip'){
query_ip(data.RegIP);
}

View File

@@ -12,20 +12,12 @@ if(!empty($Notice)){
<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. 如果没有提示更新或无法更新,请等待1分钟后在重试</li>
<li>5. 长时间未提示更新则检查服务器网络</li>
<li>6. 其他疑问请联系客服QQ 271152681</li>
</blockquote>
<h3 style = "margin-bottom:1em;">当前域名:<font color="red"><?php echo $HTTP_HOST; ?></font></h3>
<div class="layui-form-item">
<label class="layui-form-label">授权卡密</label>
<div class="layui-input-block">
<input type="text" id = "order_id" name="order_id" value="<?php echo $subscribe['order_id']; ?>" required autocomplete="off" placeholder="请输入授权单号卡密" class="layui-input">
<input type="text" id = "order_id" name="order_id" value="<?php echo $subscribe['order_id']; ?>" required autocomplete="off" placeholder="请输入授权单号/卡密" class="layui-input">
</div>
</div>
@@ -49,18 +41,26 @@ if(!empty($Notice)){
<input type="text" name="end_time" id = "end_time" readonly="readonly" value = "<?php echo date("Y-m-d H:i:s",$subscribe['end_time']); ?>" autocomplete="off" placeholder="订阅到期时间" class="layui-input">
</div>
</div>
<div class="layui-form-item" style = "">
<label class="layui-form-label">授权类型</label>
<div class="layui-input-block">
<input type="text" name="type_name" id ="type_name" value="<?php echo $subscribe['type_name'] ?? ''; ?>" autocomplete="off" placeholder="若未正确显示请点击保存设置" class="layui-input">
</div>
</div>
<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-normal" lay-submit lay-filter="save_key">保存设置</button>
<button class="layui-btn layui-btn-warm" lay-submit lay-filter="del_key">删除</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>
<button class="layui-btn" lay-submit lay-filter="query_key">查询授权</button>
<button class="layui-btn layui-bg-purple" type="button" id="validate" style="<?php echo empty($subscribe['order_id']) ? 'display:none;':''; ?>">正版验证</button>
</div>
<fieldset class="layui-elem-field layui-field-title" style="margin-top:30px;"><legend>授权用户专享</legend></fieldset>
<blockquote class="layui-elem-quote layui-text">
<ul>
<li>在线更新系统 ( 免费只能手动更新 )</li>
<li>在线更新系统 ( 免费只能手动更新 )</li>
<li>在线下载和更新主题模板</li>
<li>批量更新链接标题/关键字/描述/图标</li>
<li>批量识别链接是否可以访问</li>
@@ -93,25 +93,45 @@ layui.use(['jquery','form'], function () {
var form = layui.form;
var layer = layui.layer;
var $ = layui.jquery;
var vcode;
//查询订阅
form.on('submit(get_subscribe)', function(data){
form.on('submit(query_key)', function(data){
vcode = randomnum(6);
index = layer.prompt({formType: 0,value: '',title: '请输入验证码: ' + vcode,shadeClose: false,"success":function(){
$("input.layui-layer-input").on('keydown',function(e){
if(e.which == 13) {
query_key(data);
}
});
}},function(){
query_key(data)
});
});
function query_key(data) {
layer.close(index);
if($("input.layui-layer-input").val() != vcode){
layer.msg('验证码错误', {icon: 5});
return false;
}
layer.load(2, {shade: [0.1,'#fff']});
$.get('//service.twonav.cn/api.php?fn=get_subscribe',data.field,function(data,status){
$.post(get_api('other_services','query_key'),{'order_id':data.field.order_id,'email':data.field.email},function(data,status){
layer.closeAll('loading');
if(data.code == 200) {
$("#order_id").val(data.data.order_id);
$("#end_time").val(timestampToTime(data.data.end_time));
$("#type_name").val(data.data.type_name);
layer.msg(data.msg, {icon: 1,time: 10000});
}else{
layer.msg(data.msg, {icon: 5,time: 10000});
layer.alert(data.msg,{icon:5,title:'查询结果',anim: 2,closeBtn: 0,btn: ['我知道了']});
}
}).fail(function () {
layer.msg('请求失败', {icon: 5});
});
return false;
});
}
//保存订阅
form.on('submit(set_subscribe)', function(data){
form.on('submit(save_key)', function(data){
var order_id = data.field.order_id;
if(order_id.length < 20){
layer.msg('订单号错误,请核对', {icon: 5});
@@ -122,18 +142,21 @@ layui.use(['jquery','form'], function () {
return false;
}
layer.load(2, {shade: [0.1,'#fff']});
$.get('//service.twonav.cn/api.php?fn=check_subscribe',data.field,function(data,status){
$.post(get_api('other_services','save_key'),{'order_id':data.field.order_id,'email':data.field.email},function(data,status){
layer.closeAll('loading');
if(data.code == 200) {
$("#order_id").val(data.data.order_id);
$("#end_time").val(timestampToTime(data.data.end_time));
set_subscribe(data.data);
$("#type_name").val(data.data.type_name);
layer.msg(data.msg, {icon: 1,time: 10000});
}else{
layer.msg(data.msg, {icon: 5});
layer.alert(data.msg,{icon:5,title:'保存结果',anim: 2,closeBtn: 0,btn: ['我知道了']});
}
}).fail(function () {
layer.msg('请求失败', {icon: 5});
});
console.log(data.field)
return false;
});
//购买授权
form.on('submit(buy_vip)', function(data){
let url = $(this).attr('data-url');
@@ -143,28 +166,79 @@ layui.use(['jquery','form'], function () {
});
//清空订阅信息
form.on('submit(reset_subscribe)', function(data){
var order_id = data.field.order_id;
layer.load(2, {shade: [0.1,'#fff']});
$("#order_id").val('');
$("#email").val('');
$("#end_time").val('1970-01-01 08:00:00');
set_subscribe('');
layer.closeAll('loading');
form.on('submit(del_key)', function(data){
vcode = randomnum(6);
index = layer.prompt({formType: 0,value: '',title: '请输入验证码: ' + vcode,shadeClose: false,"success":function(){
$("input.layui-layer-input").on('keydown',function(e){
if(e.which == 13) {
del_key(data);
}
});
}},function(){
del_key(data)
});
return false;
});
//存储到数据库中
function set_subscribe(data) {
$.post(get_api('write_subscribe'),data,function(data,status){
if(data.code == 1) {
layer.msg(data.msg, {icon: 1});
function del_key(data){
layer.close(index);
if($("input.layui-layer-input").val() != vcode){
layer.msg('验证码错误', {icon: 5});
return false;
}
var order_id = data.field.order_id;
if(order_id.length < 20){
layer.msg('订单号错误,请核对', {icon: 5});
return false;
}
if(data.field.email.length == 0){
layer.msg('邮箱不能为空,请核对', {icon: 5});
return false;
}
layer.load(2, {shade: [0.1,'#fff']});
$.post(get_api('other_services','del_key'),{'order_id':data.field.order_id,'email':data.field.email},function(data,status){
layer.closeAll('loading');
if(data.code == 200) {
$("#order_id").val('');
$("#email").val('');
$("#end_time").val('1970-01-01 08:00:00');
$("#type_name").val('');
layer.msg(data.msg, {icon: 1,time: 10000});
}else{
layer.msg(data.msg, {icon: 5});
layer.alert(data.msg,{icon:5,title:'保存结果',anim: 2,closeBtn: 0,btn: ['我知道了']});
}
}).fail(function () {
layer.msg('请求失败', {icon: 5});
});
}
// 正版验证
$('#validate').on('click', function(){
vcode = randomnum(6);
index = layer.prompt({formType: 0,value: '',title: '请输入验证码: ' + vcode,shadeClose: false,"success":function(){
$("input.layui-layer-input").on('keydown',function(e){
if(e.which == 13) {
validate();
}
});
}},function(){
validate()
});
});
function validate() {
layer.close(index);
if($("input.layui-layer-input").val() != vcode){
layer.msg('验证码错误', {icon: 5});
return false;
}
$.post(get_api('other_services','validate'),function(data,status){
layer.closeAll('loading');
layer.alert(data.msg,{icon:(data.code == 200 ? 1 : 5),title:'验证结果',anim: 2,closeBtn: 0,btn: ['我知道了']});
}).fail(function () {
layer.msg('请求失败', {icon: 5});
});
}
});
</script>
</body>

View File

@@ -5,10 +5,44 @@
<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.40-20230917</h4>
<h4 class="layui-timeline-title">v2.1.01-20231002</h4>
<ul>
<li>[优化] 优化资源节点,提高系统更新速度,主题下载速度,预览图加载速度! </li>
<li>[优化] 系统响应速度,修复已知问题</li>
<li>[优化] 已部署国内服务器并接入了CDN加速和3个资源节点</li>
<li>[新增] 系统设置>资源节点,可选自动/国内1/国内2/海外1</li>
<li>[新增] 系统设置>请求超时,默认为3秒,范围3-60</li>
<li>[新增] 后台>安全设置(右上角账号下拉)>新增管理入口选项,可选隐藏/显示/登录时显示</li>
<li>[优化] 静态链接(伪静态)处理方案,支持选择UN(用户名)或UID(用户ID)作为用户标识</li>
<li>[优化] 百度推送/站点地图静态链接格式调整</li>
<li>[优化] 后台的部分前台链接支持伪静态链接</li>
<li>[修复] 注册模板无法切换、其他已知的bug</li>
<li>[模板] 所有模板更新至2.1.0</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.41-20230921</h4>
<ul>
<li>[优化] 后台>概要页面改为异步加载,避免因网络不好时出现页面打开慢的问题</li>
<li>[新增] 后台>授权管理页面新增正版验证按钮/显示授权类型/相关验证逻辑调整</li>
<li>[修复] 文章功能全局开关为关闭时前台依然输出文章链接的bug</li>
<li>[修复] 从免费版升级到授权版时未自动清理缓存造成不好的体验</li>
</ul>
</div>
</li>
<li class="layui-timeline-item">
<i class="layui-icon layui-timeline-axis"></i>
<div class="layui-timeline-content layui-text">
<h4 class="layui-timeline-title">v2.0.40-20230919</h4>
<ul>
<li>[变更] 优化资源节点,提高系统更新速度,主题下载速度,预览图加载速度! </li>
<li>[变更] 为保障授权用户的权益,本版开始请求下载主题/更新系统时服务器将验证授权</li>
<li>[变更] 开源版(免费版)与授权版(标准版/高级版)将分开维护,以避免某些人非法获取权限,这对付费用户是极不公平的</li>
<li>[新增] 特定操作时清理缓存,避免因版本不一致造成的问题</li>
<li>[新增] 请求服务器时携带本地系统版本号以便于服务器返回相匹配的资源</li>
<li>[新增] 导出导入页面的导入功能支持iTab的数据( 扩展名为: itabdata )</li>
</ul>
</div>
</li>

View File

@@ -2,7 +2,7 @@
"name": "默认模板",
"description": "默认",
"homepage": "https://gitee.com/tznb/TwoNav",
"version": "2.0.0",
"update": "2023/08/25",
"version": "2.1.0",
"update": "2023/09/28",
"author": "TwoNav"
}

View File

@@ -19,7 +19,7 @@
<span class="mdui-btn mdui-btn-icon mdui-ripple mdui-ripple-white" mdui-drawer="{target: '#main-drawer', swipe: true}">
<i class="mdui-icon material-icons">menu</i>
</span>
<a href="" class="mdui-typo-headline mdui-hidden-xs"><?php echo $site['logo'];?></a>
<a href="<?php echo $urls['home'];?>" class="mdui-typo-headline mdui-hidden-xs"><?php echo $site['logo'];?></a>
<a href="" class="mdui-typo-title"><?php echo $data['title'];?></a>
<div class="mdui-toolbar-spacer"></div>
</div>

View File

@@ -2,8 +2,8 @@
"name":"默认模板",
"description":"系统默认的文章模板,支持代码段上色,支持自适应!",
"homepage":"https://gitee.com/tznb/TwoNav",
"version":"2.0.0",
"update":"2023/07/01",
"version":"2.1.0",
"update":"2023/09/28",
"author":"TwoNav",
"screenshot":"https://img.lm21.top/article_default.jpg",
"config": {

View File

@@ -54,7 +54,7 @@
</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>';} ?>
<button class="layui-btn" lay-submit lay-filter="Submit">提交</button>
</div>
</div>
</form>

View File

@@ -2,7 +2,7 @@
"name": "默认模板",
"description": "默认",
"homepage": "https://gitee.com/tznb/TwoNav",
"version": "2.0.0",
"update": "2023/08/25",
"version": "2.1.0",
"update": "2023/09/28",
"author": "TwoNav"
}

View File

@@ -2,8 +2,8 @@
"name": "默认模板",
"description": "模板来自于html5up.net",
"homepage": "https://gitee.com/tznb/TwoNav",
"version": "2.0.0",
"update": "2023/04/25",
"version": "2.1.0",
"update": "2023/09/28",
"author": "TwoNav",
"config": {
"title":"",

View File

@@ -21,7 +21,6 @@ if ($DescrRowNumber <= 0 ){
}else{
$DescrRowNumber = 2; $DescrHeight= 48; $Card = 120; // 超出范围则设为2行
}
?>
<!DOCTYPE html>
<html lang="zh-ch">
@@ -141,20 +140,22 @@ body{
<?php } ?>
<div class="mdui-divider"></div>
<?php if(is_guestbook()){ ?>
<a href="./index.php?c=guestbook&u=<?php echo $u?>" target="_blank">
<a href="<?php echo $urls['guestbook']?>" target="_blank">
<li class="mdui-list-item mdui-ripple">
<div class="mdui-list-item-content category-name"><i class="fa fa-commenting-o"></i> 在线留言</div>
</li>
</a>
<?php } ?>
<?php if (is_apply()) { ?>
<a href="./index.php?c=apply&u=<?php echo $u?>" target="_blank">
<a href="<?php echo $urls['apply']?>" target="_blank">
<li class="mdui-list-item mdui-ripple">
<div class="mdui-list-item-content category-name"><i class="fa fa-pencil"></i> 申请收录</div>
</li>
</a>
<?php } ?>
<a href="./index.php?c=admin&u=<?php echo $u?>"><li class="mdui-list-item mdui-ripple"><div class="mdui-list-item-content category-name CFC"><i class="fa fa-user-circle"></i>系统管理</div></li></a>
<?php if (admin_inlet()) { ?>
<a href="<?php echo $urls['admin']?>"><li class="mdui-list-item mdui-ripple"><div class="mdui-list-item-content category-name CFC"><i class="fa fa-user-circle"></i>系统管理</div></li></a>
<?php } ?>
</ul>
</div>
@@ -228,8 +229,7 @@ body{
<!-- footerend -->
<script>
var u = '<?php echo $u?>';
var t = '<?php echo str_replace("./templates/", "", $theme);?>';
var u = '<?php echo is_login ? $u : ''?>';
var is_login = <?php echo is_login?'true':'false'; ?>;
</script>
<script src = "<?php echo $libs?>/jquery/jquery-3.6.0.min.js"></script>

View File

@@ -2,8 +2,8 @@
"name":"默认主题(加强)",
"description":"默认主题(加强)",
"homepage":"https://gitee.com/tznb/TwoNav",
"version":"2.0.3",
"update":"2023/07/31",
"version":"2.1.0",
"update":"2023/09/28",
"author":"落幕",
"screenshot":"https://s3.bmp.ovh/imgs/2022/04/17/8cac968a8cc8135c.png",
"config": {

View File

@@ -109,7 +109,7 @@ $("#config").click(function(){
area : ['550px' , '99%'],
anim: 5,
offset: 'rt',
content: './index.php?c=admin&page=config_home&u='+u+'&theme='+t+'&fn=home'
content: './index.php?c=admin&page=config_home&u='+u+'&theme=default&fn=home'
});
});

View File

@@ -4,7 +4,7 @@ $LoginConfig = unserialize($USER_DB['LoginConfig']);?>
<html>
<head>
<meta charset="UTF-8">
<title>TwoNav - 登录</title>
<title><?php echo $OEM['program_name'];?> - 登录</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">
@@ -12,7 +12,7 @@ $LoginConfig = unserialize($USER_DB['LoginConfig']);?>
<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="stylesheet" href="<?php echo $libs?>/Other/login.css?v=<?php echo SysVer; ?>">
<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon">
<!--[if lt IE 9]>
<script src="<?php echo $libs?>/Other/html5.min.js"></script>
@@ -23,7 +23,7 @@ $LoginConfig = unserialize($USER_DB['LoginConfig']);?>
<div class="main-body">
<div class="login-main">
<div class="login-top">
<span>TwoNav 系统管理</span>
<span><?php echo $OEM['program_name'];?> 系统管理</span>
<span class="bg1"></span>
<span class="bg2"></span>
</div>
@@ -50,7 +50,7 @@ $LoginConfig = unserialize($USER_DB['LoginConfig']);?>
<?php
//若为默认值则显示注册入口
if($global_config['Register'] == 'register' && $global_config['RegOption'] > 0){
echo '<a href="./?c=register" class="forget">没有账号?立即注册</a>';
echo '<a href="'.$urls['register'].'" class="forget">没有账号?立即注册</a>';
}
?>
</div>

View File

@@ -2,7 +2,7 @@
"name": "默认模板",
"description": "默认",
"homepage": "https://gitee.com/tznb/TwoNav",
"version": "2.0.4",
"update": "2023/08/09",
"version": "2.1.0",
"update": "2023/09/28",
"author": "TwoNav"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 57 KiB

View File

@@ -9,7 +9,7 @@ if(!empty($mail_config)){
<html>
<head>
<meta charset="UTF-8">
<title>TwoNav - 注册</title>
<title><?php echo $OEM['program_name'];?> - 注册</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">
@@ -28,7 +28,7 @@ if(!empty($mail_config)){
<div class="main-body">
<div class="login-main">
<div class="login-top">
<span>TwoNav 注册账号</span>
<span><?php echo $OEM['program_name'];?> 注册账号</span>
<span class="bg1"></span>
<span class="bg2"></span>
</div>
@@ -72,7 +72,7 @@ if(!empty($mail_config)){
if($global_config['RegOption'] == 2 && !empty($reg_tips)){
echo ' <a href="javascript:;" onclick = "Get_Invitation(\''.base64_encode($reg_tips).'\')">获取注册码</a>'."\n";
}
echo ' <a href="./?c=login" class="forget">已有账号?立即登录</a>'."\n";
echo ' <a href="'.$urls['login'].'" class="forget">已有账号?立即登录</a>'."\n";
}
?>
</div>

View File

@@ -2,7 +2,7 @@
"name": "默认模板",
"description": "默认",
"homepage": "https://gitee.com/tznb/TwoNav",
"version": "2.0.0",
"update": "2023/03/15",
"version": "2.1.0",
"update": "2023/09/28",
"author": "TwoNav"
}

View File

@@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<title><?php echo $link['title']; ?> - <?php echo $site['title']; ?></title>
<meta name="keywords" content="<?php echo $link['keywords']; ?>">
<meta name="keywords" content="<?php echo $link['keywords'] ?? $link['title']; ?>">
<meta name="description" content="<?php echo $link['description']; ?>">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv = "X-UA-Compatible" content = "IE=edge" >
@@ -55,7 +55,7 @@ if( empty($link['url_standby']) ) {
<div class = "row">
<div class="col-sm-8 offset-sm-2">
<nav class="navbar navbar-expand-md bg-dark navbar-dark">
<a class="navbar-brand" href="./?u=<?php echo U; ?>"><?php echo $site['title']; ?></a>
<a class="navbar-brand" href="<?php echo $urls['home']; ?>"><?php echo $site['title']; ?></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
<span class="navbar-toggler-icon"></span>
</button>

View File

@@ -2,8 +2,8 @@
"name":"默认模板",
"description":"OneNav旧版过渡页",
"homepage":"https://www.xiaoz.me",
"version":"2.0.2",
"update":"2023/07/16",
"version":"2.1.0",
"update":"2023/09/28",
"author":"xiaoz",
"screenshot":"https://s3.bmp.ovh/imgs/2022/04/17/8cac968a8cc8135c.png",
"config": {

View File

@@ -2,7 +2,7 @@
"name": "默认模板",
"description": "默认",
"homepage": "https://gitee.com/tznb/TwoNav",
"version": "2.0.0",
"update": "2023/08/25",
"version": "2.1.0",
"update": "2023/09/28",
"author": "TwoNav"
}