Url: Fix external url detection

refs #5600
This commit is contained in:
Johannes Meyer 2015-09-22 16:18:27 +02:00
parent 81e13109fc
commit 5193fce1dd
1 changed files with 5 additions and 7 deletions

View File

@ -143,17 +143,15 @@ class Url
}
$urlParts = parse_url($url);
if (isset($urlParts['scheme']) && $urlParts['scheme'] !== $request->getScheme()) {
if (isset($urlParts['scheme']) && (
$urlParts['scheme'] !== $request->getScheme()
|| (isset($urlParts['host']) && $urlParts['host'] !== $request->getServer('SERVER_NAME'))
|| (isset($urlParts['port']) && $urlParts['port'] != $request->getServer('SERVER_PORT')))
) {
$baseUrl = $urlParts['scheme'] . '://' . $urlParts['host'] . (isset($urlParts['port'])
? (':' . $urlParts['port'])
: '');
$urlObject->setIsExternal();
} elseif (
(isset($urlParts['host']) && $urlParts['host'] !== $request->getServer('SERVER_NAME'))
|| (isset($urlParts['port']) && $urlParts['port'] != $request->getServer('SERVER_PORT'))
) {
$baseUrl = $urlParts['host'] . (isset($urlParts['port']) ? (':' . $urlParts['port']) : '');
$urlObject->setIsExternal();
} else {
$baseUrl = '';
}