From 56e37f5976a5b30197567ce94de930bd747771d1 Mon Sep 17 00:00:00 2001 From: Georg Ringer Date: Sun, 4 Aug 2019 16:32:29 +0200 Subject: [PATCH] [TASK] Latest adoptions --- Classes/Hooks/LinkHook.php | 13 +++++++------ ext_emconf.php | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Classes/Hooks/LinkHook.php b/Classes/Hooks/LinkHook.php index f2d8952..6b46fc7 100644 --- a/Classes/Hooks/LinkHook.php +++ b/Classes/Hooks/LinkHook.php @@ -100,7 +100,7 @@ protected function isInLocalDomain($url) $host = $parsedUrl['host']; if (version_compare(TYPO3_version, '9.0', '<')) { - $result = $this->checkSysDomains($parsedUrl, $host); + $result = $this->checkSysDomains($parsedUrl); } else { try { $siteFinder = GeneralUtility::makeInstance(SiteFinder::class); @@ -111,7 +111,7 @@ protected function isInLocalDomain($url) } } } catch (SiteNotFoundException $e) { - $result = $this->checkSysDomains($parsedUrl, $host); + $result = $this->checkSysDomains($parsedUrl); } } } @@ -121,14 +121,15 @@ protected function isInLocalDomain($url) } /** - * @param string $parsedUrl + * @param array $parsedUrl * @param string $host * @return bool */ - protected function checkSysDomains($parsedUrl, $host): bool + protected function checkSysDomains($parsedUrl): bool { + $result = false; // Removes the last path segment and slash sequences like /// (if given): - $path = preg_replace('#/+[^/]*$#', '', $parsedUrl['path'] ?? ''); + $path = preg_replace('#/+[^/]*$#', '', $parsedUrl['host'] ?? ''); $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('sys_domain'); $queryBuilder->setRestrictions(GeneralUtility::makeInstance(FrontendRestrictionContainer::class)); @@ -141,7 +142,7 @@ protected function checkSysDomains($parsedUrl, $host): bool foreach ($localDomains as $localDomain) { // strip trailing slashes (if given) $domainName = rtrim($localDomain['domainName'], '/'); - if (GeneralUtility::isFirstPartOfStr($host . $path . '/', $domainName . '/')) { + if ($domainName === $path) { $result = true; break; } diff --git a/ext_emconf.php b/ext_emconf.php index ceffac4..8d5fd38 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -8,7 +8,7 @@ 'author_email' => 'mail@ringer.it', 'state' => 'beta', 'clearCacheOnLoad' => true, - 'version' => '0.1.0', + 'version' => '1.0.0', 'constraints' => [ 'depends' => [ 'typo3' => '8.7.0-9.5.99'