From 62d53cd5d870f34ecf2c91101a5456ee383fbd23 Mon Sep 17 00:00:00 2001 From: camer0n Date: Mon, 7 Apr 2025 15:22:17 -0700 Subject: [PATCH] Issue #5458 Make sure 'www.' version of host is accepted. --- e107_handlers/e107_class.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php index 354b888d0..389d2db14 100644 --- a/e107_handlers/e107_class.php +++ b/e107_handlers/e107_class.php @@ -5647,6 +5647,8 @@ class e107 { $siteurl = self::getPref('siteurl'); $defaultHost = (array) parse_url($siteurl, PHP_URL_HOST); + $defaultHost = preg_replace('/^www\./', '', $defaultHost); + $hosts = !empty($this->hosts) ? $this->hosts : $defaultHost; if(self::isCli()) @@ -5693,8 +5695,16 @@ class e107 return true; // Allowed if no hosts. } + $httpHost = preg_replace('/^www\./', '', $httpHost); + foreach ($allowedHosts as $host) { + if(empty($host)) + { + continue; + } + + $host = preg_replace('/^www\./', '', $host); if ($httpHost === $host || str_ends_with($httpHost, '.' . $host)) { return true;