v2.0.13-20230418

This commit is contained in:
MI15\Win
2023-04-18 13:17:09 +08:00
parent fa292ba2ab
commit 5cae5af159
10 changed files with 52 additions and 32 deletions

View File

@@ -499,6 +499,7 @@ function write_sys_settings(){
'Debug'=>['int'=>true,'min'=>0,'max'=>1,'msg'=>'调试模式参数错误'],
'Maintenance'=>['int'=>true,'min'=>0,'max'=>1,'msg'=>'维护模式参数错误'],
'Sub_domain'=>['int'=>true,'min'=>0,'max'=>1,'msg'=>'二级域名参数错误'],
'Privacy'=>['int'=>true,'min'=>0,'max'=>1,'msg'=>'强制私有参数错误'],
'copyright'=>['empty'=>true],
'global_header'=>['empty'=>true],
'global_footer'=>['empty'=>true],
@@ -519,11 +520,13 @@ function write_sys_settings(){
}
if(!is_subscribe('bool')){
if($_POST['Sub_domain'] == 1){$o_config['Sub_domain'] = 0;$filter = true;}
if($_POST['Privacy'] == 1){$o_config['Privacy'] = 0;$filter = true;}
if(!empty($_POST['copyright'])){$o_config['copyright'] = "";$filter = true;}
if(!empty($_POST['global_header'])){$o_config['global_header'] = "";$filter = true;}
if(!empty($_POST['global_footer'])){$o_config['global_footer'] = "";$filter = true;}
if(!empty($_POST['apply'])){$o_config['apply'] = 0;$filter = true;}
if(!empty($_POST['guestbook'])){$o_config['guestbook'] = 0;$filter = true;}
if($_POST['apply'] == 1){$o_config['apply'] = 0;$filter = true;}
if($_POST['guestbook'] == 1){$o_config['guestbook'] = 0;$filter = true;}
if($_POST['link_extend'] == 1){$o_config['link_extend'] = 0;$filter = true;}
}
update_db("global_config", ["v" => $o_config], ["k" => "o_config"],[1,($filter ?"保存成功,未检测到有效授权,带*号的配置无法为你保存":"保存成功")]);

View File

@@ -8,17 +8,20 @@ if(empty($id)){Not_Found();}
//查询链接信息
$where['lid'] = $id;
$where['uid'] = UID;
//$where['status'] = 1;
$where['status'] = 1;
$link = get_db('user_links','*',$where);
//查找失败时显示404
if(empty($link)){
Not_Found();
}
if(empty($link)){Not_Found();}
//站点设置和站点图标
$site = unserialize(get_db('user_config','v',['uid'=>UID,'k'=>'s_site']));
$favicon = ( !empty($site['site_icon_file'])) ? $site['site_icon'] : './favicon.ico';
$site['Title'] = $site['title'].(empty($site['subtitle'])?'':' - '.$site['subtitle']);
//免费用户请保留版权,谢谢!
$copyright = empty($global_config['copyright'])?'<a target="_blank" href="https://gitee.com/tznb/twonav">Copyright © TwoNav</a>':$global_config['copyright'];
$ICP = empty($global_config['ICP'])?'':'<a target="_blank" href="https://beian.miit.gov.cn">'.$global_config['ICP'].'</a>';
$favicon = ( !empty($site['site_icon_file'])) ? $site['site_icon'] : './favicon.ico';
//取登录状态
$is_login = is_login();
@@ -39,7 +42,6 @@ if(!$is_login){
$pv = empty($share['pwd']) || $_SESSION['verify']['share'][$share['id']] == $share['pwd'];
}
}
//判断链接是否停用/私有
if($link['status'] == 0){
@@ -64,7 +66,6 @@ if(!$is_login){
exit('很抱歉,页面所属的祖分类是私有的!您无权限查看,如果您是管理员,请先登录!');
}
//判断链接是否加密
if(!empty($link['pid'])){
$verify_type = 'link_pwd';
@@ -94,9 +95,6 @@ if(!$is_login){
}
}
//取模板信息
require DIR ."/system/templates.php";
$dir_path = DIR.'/templates/transit/'.$s_templates['transit'];
@@ -107,18 +105,12 @@ if(!is_file($transit_path)){
$transit_path= DIR.'/templates/transit/default/index.php';
}
//免费用户请保留版权,谢谢!
$copyright = empty($global_config['copyright'])?'<a target="_blank" href="https://gitee.com/tznb/twonav">Copyright © TwoNav</a>':$global_config['copyright'];
$ICP = empty($global_config['ICP'])?'':'<a target="_blank" href="https://beian.miit.gov.cn">'.$global_config['ICP'].'</a>';
//统计点击数
write_user_count(date('Ym'),'click_Ym');
write_user_count(date('Ymd'),'click_Ymd');
update_db("user_links", ["click[+]"=>1],['uid'=>UID,'lid'=>$id]);
//读取过渡页设置
$transition_page = unserialize(get_db("user_config","v",["t"=>"config","k"=>"s_transition_page","uid"=>UID]));
//读取用户主题配置
$theme_config_db = unserialize(get_db('user_config','v',['t'=>'theme','k'=>$s_templates['transit'],'uid'=>UID]));
@@ -143,24 +135,24 @@ if(!empty($link['url_standby'])) {
exit;
}
if ($s_site['link_model'] == '302'){ //302重定向
if ($site['link_model'] == '302'){ //302重定向
header("HTTP/1.1 302 Moved Permanently");
header("Location: ".$link['url']);
exit;
}elseif($s_site['link_model'] == '301'){ //301重定向
}elseif($site['link_model'] == '301'){ //301重定向
header("HTTP/1.1 301 Moved Permanently");
header("Location: ".$link['url']);
exit;
}elseif($s_site['link_model'] == 'Privacy'){ //隐私保护_header
}elseif($site['link_model'] == 'Privacy'){ //隐私保护_header
header("Content-type: text/html; charset=utf-8");
header("Refresh:0;url=".$link['url']);
echo '<html lang="zh-ch"><head><title>正在保护您的隐私..</title><meta name="referrer" content="same-origin"></head>';
exit;
}elseif($s_site['link_model'] == 'Privacy_js'){ //隐私保护_js
}elseif($site['link_model'] == 'Privacy_js'){ //隐私保护_js
header("Content-type: text/html; charset=utf-8");
echo '<html lang="zh-ch"><head><title>正在保护您的隐私..</title><meta name="referrer" content="same-origin"><script>window.location.href="'.$link['url'].'"</script></head>';
exit;
}elseif($s_site['link_model'] == 'Privacy_meta'){ //隐私保护_meta
}elseif($site['link_model'] == 'Privacy_meta'){ //隐私保护_meta
header("Content-type: text/html; charset=utf-8");
echo '<html lang="zh-ch"><head><title>正在保护您的隐私..</title><meta name="referrer" content="same-origin"><meta http-equiv="refresh" content="0;url='.$link['url'].'"></head>';
exit;

View File

@@ -1,10 +1,9 @@
<?php if(!defined('DIR')){header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit;}
//主页入口
define('is_login',is_login());
//var_dump($global_config['offline']);
//判断用户组,是否允许未登录时访问主页
if(!is_login && !check_purview('Common_home',1)){
if(!is_login && ($global_config['Privacy'] == 1 || !check_purview('Common_home',1))){
header("HTTP/1.1 302 Moved Permanently");
header("Location: ./?c=admin");
exit;

View File

@@ -1 +1 @@
v2.0.12-20230417
v2.0.13-20230418