mirror of https://gitee.com/karson/fastadmin.git
优化检测的URL默认值
parent
3549e95ea1
commit
d2c275e20a
|
|
@ -502,13 +502,17 @@ if (!function_exists('check_url_allowed')) {
|
||||||
* @param string $url URL
|
* @param string $url URL
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function check_url_allowed($url = null)
|
function check_url_allowed($url = '')
|
||||||
{
|
{
|
||||||
//允许的主机列表
|
//允许的主机列表
|
||||||
$allowedHostArr = [
|
$allowedHostArr = [
|
||||||
strtolower(request()->host())
|
strtolower(request()->host())
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (empty($url)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
//如果是站内相对链接则允许
|
//如果是站内相对链接则允许
|
||||||
if (preg_match("/^[\/a-z][a-z0-9][a-z0-9\.\/]+\$/i", $url) && substr($url, 0, 2) !== '//') {
|
if (preg_match("/^[\/a-z][a-z0-9][a-z0-9\.\/]+\$/i", $url) && substr($url, 0, 2) !== '//') {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue