[BUGFIX] Allow frontend requests from different document root 64/34264/3
authorHelmut Hummel <helmut.hummel@typo3.org>
Mon, 17 Nov 2014 10:57:37 +0000 (11:57 +0100)
committerMarkus Klein <klein.t3@reelworx.at>
Thu, 4 Dec 2014 01:02:29 +0000 (02:02 +0100)
With a specially prepared index.php and using a page renderer hook
it is in general possible to deliver frontend requests
from a dedicated web folder.

However there are a few (hard coded) issues in TYPO3 which makes this impossible.

Change GeneralUtility::getIndpEnv('TYPO3_SITE_URL') to check for
a TYPO3_PATH_WEB constant defined in a specially prepared index.php
in a "Web/" folder and provide the fluid stand alone view with
an absolute path (which is meant like that in the API anyways).

This change has no impact on a TYPO3 installation with a traditional
directory structure, but enables users to have a more secure setup
in an appropriate environment.

Resolves: #63025
Releases: 6.2, master
Change-Id: I571ceb6224c8030d1f5f99a45903cda3a8171313
Reviewed-on: http://review.typo3.org/34264
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Cedric Ziel <cedric@cedric-ziel.com>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Xavier Perseguers <xavier@typo3.org>
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
typo3/sysext/core/Classes/Utility/GeneralUtility.php
typo3/sysext/frontend/Classes/ContentObject/FluidTemplateContentObject.php

index ac52bb3..5805703 100755 (executable)
@@ -3506,9 +3506,12 @@ Connection: close
                                $retVal = self::getIndpEnv('TYPO3_REQUEST_HOST') . self::dirname(self::getIndpEnv('SCRIPT_NAME')) . '/';
                                break;
                        case 'TYPO3_SITE_URL':
-                               if (defined('PATH_thisScript') && defined('PATH_site')) {
+                               $url = self::getIndpEnv('TYPO3_REQUEST_DIR');
+                               // This can only be set by external entry scripts
+                               if (defined('TYPO3_PATH_WEB')) {
+                                       $retVal = $url;
+                               } elseif (defined('PATH_thisScript') && defined('PATH_site')) {
                                        $lPath = PathUtility::stripPathSitePrefix(dirname(PATH_thisScript)) . '/';
-                                       $url = self::getIndpEnv('TYPO3_REQUEST_DIR');
                                        $siteUrl = substr($url, 0, -strlen($lPath));
                                        if (substr($siteUrl, -1) != '/') {
                                                $siteUrl .= '/';
index d2fd32d..b9f4ae4 100644 (file)
@@ -113,7 +113,7 @@ class FluidTemplateContentObject extends AbstractContentObject {
                        /** @var $templateService \TYPO3\CMS\Core\TypoScript\TemplateService */
                        $templateService = $GLOBALS['TSFE']->tmpl;
                        $templatePathAndFilename = $templateService->getFileName($file);
-                       $this->view->setTemplatePathAndFilename($templatePathAndFilename);
+                       $this->view->setTemplatePathAndFilename(PATH_site . $templatePathAndFilename);
                }
        }