From 901bea7d59bca76ab6687e3431d3dd439d3edfbd Mon Sep 17 00:00:00 2001 From: Karson Date: Wed, 30 Aug 2023 16:20:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dcheck=5Furl=5Fallowed?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E4=B8=8D=E5=85=A8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/common.php b/application/common.php index 02592488..03771aea 100755 --- a/application/common.php +++ b/application/common.php @@ -520,7 +520,7 @@ if (!function_exists('check_url_allowed')) { } //如果是站外链接则需要判断HOST是否允许 - if (preg_match("/((http[s]?:\/\/)+(?>[a-z\-0-9]{2,}\.){1,}[a-z]{2,8})(?:\s|\/)/i", $url)) { + if (preg_match("/((http[s]?:\/\/)+((?>[a-z\-0-9]{2,}\.)+[a-z]{2,8}|((?>([0-9]{1,3}\.)){3}[0-9]{1,3}))(:[0-9]{1,5})?)(?:\s|\/)/i", $url)) { $chkHost = parse_url(strtolower($url), PHP_URL_HOST); if ($chkHost && in_array($chkHost, $allowedHostArr)) { return true;