[BUGFIX] "Show page" does not use a proper URL scheme
authorDmitry Dulepov <dmitry@typo3.org>
Mon, 21 Nov 2011 12:16:35 +0000 (14:16 +0200)
committerDmitry Dulepov <dmitry@typo3.org>
Mon, 6 Feb 2012 12:40:28 +0000 (13:40 +0100)
"Show page" context menu and Web>View do not use proper scheme if
that is set in the page properties. They always use the scheme of
the Backend.

Change-Id: I0fc117d3ef81c5f9da81f9573c330fa6ff3a4279
Fixes: #31959
Releases: 4.7, 4.6, 4.5
Reviewed-on: http://review.typo3.org/7413
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Dmitry Dulepov
Tested-by: Dmitry Dulepov
t3lib/class.t3lib_befunc.php
typo3/sysext/viewpage/view/index.php

index cce331a..655ba1e 100644 (file)
@@ -2620,8 +2620,16 @@ final class t3lib_BEfunc {
                if (count($rootLine) > 0) {
                        $urlParts = parse_url($domain);
                        if (self::getDomainStartPage($urlParts['host'], $urlParts['path'])) {
-                               $protocol = t3lib_div::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://';
-                               $domain = $protocol . self::firstDomainRecord($rootLine);
+                               /** @var t3lib_pageSelect $sysPage */
+                               $sysPage = t3lib_div::makeInstance('t3lib_pageSelect');
+
+                               $page = (array)$sysPage->getPage($pageId);
+                               $protocol = 'http';
+                               if ($page['url_scheme'] == t3lib_utility_Http::SCHEME_HTTPS || ($page['url_scheme'] == 0 && t3lib_div::getIndpEnv('TYPO3_SSL'))) {
+                                       $protocol = 'https';
+                               }
+
+                               $domain = $protocol . '://' . self::firstDomainRecord($rootLine);
                        }
                }
 
@@ -4403,4 +4411,4 @@ final class t3lib_BEfunc {
        }
 }
 
-?>
\ No newline at end of file
+?>
index 0eece7d..e9c9108 100755 (executable)
@@ -99,6 +99,7 @@ class SC_mod_web_view_index {
 
                        // preview of mount pages
                $sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
+               /** @var t3lib_pageSelect $sys_page */
                $sys_page->init(FALSE);
                $mountPointInfo = $sys_page->getMountPointInfo($this->id);
                if ($mountPointInfo && $mountPointInfo['overlay']) {
@@ -106,8 +107,15 @@ class SC_mod_web_view_index {
                        $addCmd .= '&MP=' . $mountPointInfo['MPvar'];
                }
 
+               $page = (array)$sys_page->getPage($this->id);
+
+               $urlScheme = 'http';
+               if ($page['url_scheme'] == 2 || $page['url_scheme'] == 0 && t3lib_div::getIndpEnv('TYPO3_SSL')) {
+                       $urlScheme = 'https';
+               }
+
                $this->url .= ($dName
-                       ? (t3lib_div::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://') . $dName
+                       ? $urlScheme . '://' . $dName
                        : $GLOBALS['BACK_PATH'] . '..') . '/index.php?id=' . $this->id .
                                ($this->type ? '&type='.$this->type : '') . $addCmd;
        }