diff --git a/classes/module/ModuleHandler.class.php b/classes/module/ModuleHandler.class.php index e9bf10d518..5dbd4f8377 100644 --- a/classes/module/ModuleHandler.class.php +++ b/classes/module/ModuleHandler.class.php @@ -218,6 +218,8 @@ function init() $dbInfo = Context::getDBInfo(); $defaultUrlInfo = parse_url($dbInfo->default_url); $defaultHost = $defaultUrlInfo['host']; + $siteDomain = parse_url($site_module_info->domain); + $siteDomain = $siteDomain['host']; foreach($urls as $url) { @@ -229,14 +231,13 @@ function init() $urlInfo = parse_url(urldecode($url)); $host = $urlInfo['host']; - if((!$urlInfo || !$host) && preg_match("/^(https?|[a-z0-9])+\:(\/)*/i", $uri) === 0) + if($host && ($host !== $defaultHost && ($host !== $site_module_info->domain || $host !== $siteDomain))) { - throw new Exception('msg_invalid_request'); + throw new Exception('msg_default_url_is_null'); } - - if($host && ($host != $defaultHost && $host != $site_module_info->domain)) + else if((!$host || !$urlInfo || !$urlInfo['scheme']) && preg_match("/^(https?|[a-z0-9])+\:(\/)*/i", urldecode($url))) { - throw new Exception('msg_default_url_is_null'); + throw new exception('msg_invalid_request'); } }