1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 11:50:30 +02:00

Issue #5458 Make sure 'www.' version of host is accepted.

This commit is contained in:
camer0n
2025-04-07 15:22:17 -07:00
parent 9f40b4d8a9
commit 62d53cd5d8

View File

@@ -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;