From dccac62117f3e4b34ad9ee324b327942c93f2c8b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 11 Mar 2014 14:58:31 +0100 Subject: [PATCH] Normalize protocol of internal URLs --- .../lib/system/application/ApplicationHandler.class.php | 6 ++++-- wcfsetup/install/files/lib/util/StringUtil.class.php | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/lib/system/application/ApplicationHandler.class.php b/wcfsetup/install/files/lib/system/application/ApplicationHandler.class.php index 5e3ba638ba..2b97324d11 100644 --- a/wcfsetup/install/files/lib/system/application/ApplicationHandler.class.php +++ b/wcfsetup/install/files/lib/system/application/ApplicationHandler.class.php @@ -3,6 +3,7 @@ namespace wcf\system\application; use wcf\data\application\ApplicationAction; use wcf\data\application\ApplicationList; use wcf\system\cache\builder\ApplicationCacheBuilder; +use wcf\system\Regex; use wcf\system\SingletonFactory; /** @@ -144,14 +145,15 @@ class ApplicationHandler extends SingletonFactory { * @return boolean */ public function isInternalURL($url) { + $protocolRegex = new Regex('^https(?=://)'); if (empty($this->pageURLs)) { foreach ($this->getApplications() as $application) { - $this->pageURLs[] = $application->getPageURL(); + $this->pageURLs[] = $protocolRegex->replace($application->getPageURL(), 'http'); } } foreach ($this->pageURLs as $pageURL) { - if (stripos($url, $pageURL) === 0) { + if (stripos($protocolRegex->replace($url, 'http'), $pageURL) === 0) { return true; } } diff --git a/wcfsetup/install/files/lib/util/StringUtil.class.php b/wcfsetup/install/files/lib/util/StringUtil.class.php index bba035994d..2b3727e1d2 100644 --- a/wcfsetup/install/files/lib/util/StringUtil.class.php +++ b/wcfsetup/install/files/lib/util/StringUtil.class.php @@ -1,6 +1,7 @@ isInternalURL($url)) { $external = false; + $url = preg_replace('~^https?://~', RouteHandler::getProtocol(), $url); } // cut visible url -- 2.20.1