v2.0.37-20230830

This commit is contained in:
MI15\Win
2023-08-30 12:49:45 +08:00
parent 5c7136ff0f
commit 1fe39f83f4
37 changed files with 1278 additions and 573 deletions

View File

@@ -4,7 +4,7 @@ $id = intval($_GET['id']);
//IP数统计
count_ip();
//如果id为空,则显示404
if(empty($id)){Not_Found();}
if(empty($id)) Not_Found();
//查询链接信息
$where['lid'] = $id;
@@ -13,18 +13,7 @@ $where['status'] = 1;
$link = get_db('user_links','*',$where);
//查找失败时显示404
if(empty($link)){Not_Found();}
//站点设置和站点图标
$site = unserialize(get_db('user_config','v',['uid'=>UID,'k'=>'s_site']));
$site['Title'] = $site['title'].(empty($site['subtitle'])?'':' - '.$site['subtitle']);
//免费用户请保留版权,谢谢!
$copyright = empty($global_config['copyright'])?'<a target="_blank" href="https://gitee.com/tznb/TwoNav">Copyright © TwoNav</a>':$global_config['copyright'];
$ICP = empty($global_config['ICP'])?'':'<a target="_blank" href="https://beian.miit.gov.cn">'.$global_config['ICP'].'</a>';
$favicon = ( !empty($site['site_icon_file'])) ? $site['site_icon'] : './favicon.ico';
//取登录状态
$is_login = is_login();
if(empty($link)) Not_Found();
//取父分类和祖分类信息
$info_c = ['cid','fid','property','status','pid'];
@@ -72,7 +61,9 @@ if(!$is_login){
$verify_type = 'link_pwd';
$password = get_db('user_pwd_group','password',['uid'=>UID,'pid'=>$link['pid']]);
if($_SESSION['verify']['link'][$link['lid']] != $password){
require DIR.'/templates/admin/other/verify_link_pwd.php';
$c = 'verify';
require DIR."/system/templates.php";
require $index_path;
exit();
}
}
@@ -81,7 +72,9 @@ if(!$is_login){
$verify_type = 'category_pwd';
$password = get_db('user_pwd_group','password',['uid'=>UID,'pid'=>$category_parent['pid']]);
if($_SESSION['verify']['category'][$category_parent['cid']] != $password){
require DIR.'/templates/admin/other/verify_link_pwd.php';
$c = 'verify';
require DIR."/system/templates.php";
require $index_path;
exit();
}
}
@@ -90,39 +83,22 @@ if(!$is_login){
$verify_type = 'category_pwd';
$password = get_db('user_pwd_group','password',['uid'=>UID,'pid'=>$category_ancestor['pid']]);
if($_SESSION['verify']['category'][$category_ancestor['cid']] != $password){
require DIR.'/templates/admin/other/verify_link_pwd.php';
$c = 'verify';
require DIR."/system/templates.php";
require $index_path;
exit();
}
}
}
//取模板信息
require DIR ."/system/templates.php";
$dir_path = DIR.'/templates/transit/'.$s_templates['transit'];
$theme_dir = str_replace(DIR.'/templates/transit',"./templates/transit",$dir_path);
$transit_path = $dir_path.'/index.php';
//检查是否存在,不存在则使用默认
if(!is_file($transit_path)){
$transit_path= DIR.'/templates/transit/default/index.php';
}
//统计点击数
write_user_count(date('Ym'),'click_Ym');
write_user_count(date('Ymd'),'click_Ymd');
update_db("user_links", ["click[+]"=>1],['uid'=>UID,'lid'=>$id]);
//读取用户主题配置
$theme_config_db = unserialize(get_db('user_config','v',['t'=>'theme_transit','k'=>$s_templates['transit'],'uid'=>UID]));
//读取默认主题配置
$theme_info = json_decode(@file_get_contents($dir_path.'/info.json'),true);
$theme_config = empty($theme_info['config']) ? []:$theme_info['config'];
$theme_ver = !Debug?$theme_info['version']:$theme_info['version'].'.'.time();
//合并配置数据
$theme_config = empty($theme_config_db) ? $theme_config : array_merge ($theme_config??[],$theme_config_db??[]);
//通用数据初始化
require DIR."/system/templates.php";
//如果主题信息声明支持扩展字段
if($global_config['link_extend'] == 1 && check_purview('link_extend',1) && in_array($theme_info['support']['link_extend'],["true","1"])){
@@ -154,11 +130,11 @@ if(!empty($link['url_standby'])) {
if(in_array(intval($code),[200,301,302,401]) ){
$site['link_model'] = $site['link_model'] == 'direct' ? '302' : $site['link_model'];
}else{
require $transit_path;
require $index_path;
exit;
}
}else{
require $transit_path;
require $index_path;
exit;
}
}
@@ -185,11 +161,6 @@ if ($site['link_model'] == '302'){ //302重定向(临时)
echo '<html lang="zh-ch"><head><title>正在保护您的隐私..</title><meta name="referrer" content="same-origin"><meta http-equiv="refresh" content="0;url='.$link['url'].'"></head>';
exit;
}else{ //Transition 过渡页
require $transit_path;
require $index_path;
exit;
}
//返回404
function Not_Found() {
header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit;
}