diff --git a/system/api.php b/system/api.php index 5794d72..53f69b3 100644 --- a/system/api.php +++ b/system/api.php @@ -1506,6 +1506,7 @@ function read_data(){ $log .= in_array("Phar",$ext) ? "" : "Phar:不支持 (在线更新/主题下载)\n"; $log .= in_array("hash",$ext) ? "" : "hash:不支持 (书签分享/生成注册码)\n"; $log .= in_array("session",$ext) ? "" : "session:不支持 (影响较大)\n"; + $log .= in_array("intl",$ext) ? "" : "intl:不支持 (使用中文域名时可能会导致异常)\n"; $log .= "可用模块:".implode(" ",$ext)."\n"; $updatadb_logs = select_db('updatadb_logs','file_name',['file_name[!]'=>'install.sql']); $log .= "数据库更新记录:".(empty($updatadb_logs)?'无':"\n".implode("\n",$updatadb_logs))."\n"; @@ -1643,9 +1644,8 @@ function other_get_link_info(){ msg(-1010,'URL不能为空!'); }elseif(!preg_match("/^(http:\/\/|https:\/\/).*/",$url)){ msg(-1010,'只支持识别http/https协议的链接!'); - }elseif( !filter_var($url, FILTER_VALIDATE_URL) ) { - msg(-1010,'URL无效!'); } + $url = process_url_idn($url); //获取网站标题 (HTML/JS跳转无法识别) $c = curl_init(); curl_setopt($c, CURLOPT_URL, $url); diff --git a/system/click.php b/system/click.php index c2e9b9b..7aee6bd 100644 --- a/system/click.php +++ b/system/click.php @@ -86,7 +86,9 @@ if(!empty($link['url_standby']) || $site['link_model'] == 'Transition'){ if(!empty($link['url_standby'])) { $link['url_standby'] = unserialize($link['url_standby']); //主链优先模式 - if(!empty($site['main_link_priority']) && $site['link_model'] != 'Transition'){ + if($site['main_link_priority'] == '3'){ + $site['link_model'] = $site['link_model'] == 'direct' ? '302' : $site['link_model']; + }elseif($site['main_link_priority'] > 0 && $site['link_model'] != 'Transition'){ $code = get_http_code($link['url'],3,($site['main_link_priority'] == 1)); if(in_array(intval($code),[200,301,302,401]) ){ $site['link_model'] = $site['link_model'] == 'direct' ? '302' : $site['link_model']; @@ -110,9 +112,11 @@ if ($site['link_model'] == '302'){ //302重定向(临时) exit; }elseif($site['link_model'] == 'Privacy'){ //隐私保护_header header("Content-type: text/html; charset=utf-8"); + if(preg_match('/[\x{4e00}-\x{9fa5}]/u', $link['url']) > 0){ + exit ('正在保护您的隐私..'); + } header("Refresh:0;url=".$link['url']); - echo '正在保护您的隐私..'; - exit; + exit ('正在保护您的隐私..'); }elseif($site['link_model'] == 'Privacy_js'){ //隐私保护_js header("Content-type: text/html; charset=utf-8"); echo '正在保护您的隐私..'; diff --git a/system/public.php b/system/public.php index 6fdea0b..4c0854a 100644 --- a/system/public.php +++ b/system/public.php @@ -775,4 +775,12 @@ function get_OEM(){ //返回404 function Not_Found() { header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit; +} + +function process_url_idn($url) { + $parsed_url = parse_url($url); + if(!preg_match('/[\x{4e00}-\x{9fa5}]/u', $parsed_url['host'])){ + return $url; + } + return substr_replace($url, idn_to_ascii($parsed_url['host']), strpos($url, "//") + 2, strlen($parsed_url['host'])); } \ No newline at end of file diff --git a/system/version.txt b/system/version.txt index 3813250..e188c50 100644 --- a/system/version.txt +++ b/system/version.txt @@ -1 +1 @@ -v2.1.09-20231220 \ No newline at end of file +v2.1.11-20240119 \ No newline at end of file diff --git a/templates/admin/page/updatelog.php b/templates/admin/page/updatelog.php index 5f4084a..1bcca60 100644 --- a/templates/admin/page/updatelog.php +++ b/templates/admin/page/updatelog.php @@ -2,6 +2,18 @@
+
  • + +
    +

    v2.1.11-20240119

    +
      +
    • [修复] 链接识别遇到中文域名时提示URL无效
    • +
    • [修复] 链接模式为隐私保护(header)时中文域名无法跳转
    • +
    • [修复] 主链优先设为强制优先时不起作用
    • +
    • [优化] 一键诊断缺少intl扩展模块时给出提醒
    • +
    +
    +