From ff09db2830ccc6f605c7e5ef763a7bb2fe815327 Mon Sep 17 00:00:00 2001 From: Benni Mack Date: Wed, 30 Dec 2015 20:29:46 +0100 Subject: [PATCH] [TASK] Remove global option BACK_PATH As BACK_PATH is empty at any time now the option is removed from the core. However, the backPath variable is still needed when accessing typo3/index.php for getting proper images, solving this will be part of another issue. Resolves: #72491 Releases: master Change-Id: I9c31de8ac38e986b6d820b7c89cab99eef52022c Reviewed-on: https://review.typo3.org/45525 Reviewed-by: Morton Jonuschat Tested-by: Morton Jonuschat Reviewed-by: Wouter Wolters Tested-by: Wouter Wolters --- .../Classes/Controller/EditDocumentController.php | 5 ++--- .../Repository/Module/BackendModuleRepository.php | 2 +- .../Classes/Http/BackendModuleRequestHandler.php | 3 --- .../Classes/Module/AbstractFunctionModule.php | 3 ++- .../backend/Classes/Module/BaseScriptClass.php | 2 -- .../backend/Classes/Template/DocumentTemplate.php | 8 ++++---- .../backend/Resources/Public/JavaScript/backend.js | 5 ++--- typo3/sysext/core/Classes/Database/QueryView.php | 2 +- typo3/sysext/core/Classes/Page/PageRenderer.php | 2 +- .../core/Classes/Resource/ResourceCompressor.php | 14 +------------- .../Classes/TypoScript/ExtendedTemplateService.php | 3 +-- typo3/sysext/sys_action/Classes/ActionTask.php | 12 +++--------- 12 files changed, 18 insertions(+), 43 deletions(-) diff --git a/typo3/sysext/backend/Classes/Controller/EditDocumentController.php b/typo3/sysext/backend/Classes/Controller/EditDocumentController.php index fb5cd53aaa54..a332458f900c 100644 --- a/typo3/sysext/backend/Classes/Controller/EditDocumentController.php +++ b/typo3/sysext/backend/Classes/Controller/EditDocumentController.php @@ -776,10 +776,9 @@ class EditDocumentController extends AbstractModule var TS = new typoSetup(); // Info view: - function launchView(table,uid,bP) { // - var backPath= bP ? bP : ""; + function launchView(table,uid) { // var thePreviewWindow = window.open( - backPath+' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('show_item') . '&table=') . ' + encodeURIComponent(table) + "&uid=" + encodeURIComponent(uid), + ' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('show_item') . '&table=') . ' + encodeURIComponent(table) + "&uid=" + encodeURIComponent(uid), "ShowItem" + TS.uniqueID, "height=300,width=410,status=0,menubar=0,resizable=0,location=0,directories=0,scrollbars=1,toolbar=0" ); diff --git a/typo3/sysext/backend/Classes/Domain/Repository/Module/BackendModuleRepository.php b/typo3/sysext/backend/Classes/Domain/Repository/Module/BackendModuleRepository.php index c8cc08aed014..493ec471b929 100644 --- a/typo3/sysext/backend/Classes/Domain/Repository/Module/BackendModuleRepository.php +++ b/typo3/sysext/backend/Classes/Domain/Repository/Module/BackendModuleRepository.php @@ -377,7 +377,7 @@ class BackendModuleRepository implements \TYPO3\CMS\Core\SingletonInterface protected function getModuleIconAbsolute($iconFilename) { if (!GeneralUtility::isAbsPath($iconFilename)) { - $iconFilename = $GLOBALS['BACK_PATH'] . $iconFilename; + $iconFilename = PATH_typo3 . $iconFilename; } return $iconFilename; } diff --git a/typo3/sysext/backend/Classes/Http/BackendModuleRequestHandler.php b/typo3/sysext/backend/Classes/Http/BackendModuleRequestHandler.php index c648db97139d..27f2ea28169f 100644 --- a/typo3/sysext/backend/Classes/Http/BackendModuleRequestHandler.php +++ b/typo3/sysext/backend/Classes/Http/BackendModuleRequestHandler.php @@ -82,9 +82,6 @@ class BackendModuleRequestHandler implements RequestHandlerInterface throw new Exception('The CSRF protection token for the requested module is missing or invalid', 1417988921); } - // Set to empty as it is not needed / always coming from typo3/index.php - $GLOBALS['BACK_PATH'] = ''; - $this->backendUserAuthentication = $GLOBALS['BE_USER']; $moduleName = (string)$this->request->getQueryParams()['M']; diff --git a/typo3/sysext/backend/Classes/Module/AbstractFunctionModule.php b/typo3/sysext/backend/Classes/Module/AbstractFunctionModule.php index 7b036cc8d98e..cff57ed32db4 100644 --- a/typo3/sysext/backend/Classes/Module/AbstractFunctionModule.php +++ b/typo3/sysext/backend/Classes/Module/AbstractFunctionModule.php @@ -288,10 +288,11 @@ abstract class AbstractFunctionModule /** * @return string + * @deprecated since TYPO3 v8, will be removed in TYPO3 v9 */ protected function getBackPath() { - return $GLOBALS['BACK_PATH']; + return ''; } /** diff --git a/typo3/sysext/backend/Classes/Module/BaseScriptClass.php b/typo3/sysext/backend/Classes/Module/BaseScriptClass.php index fb57913c6ec5..e701589b5594 100644 --- a/typo3/sysext/backend/Classes/Module/BaseScriptClass.php +++ b/typo3/sysext/backend/Classes/Module/BaseScriptClass.php @@ -50,8 +50,6 @@ use TYPO3\CMS\Lang\LanguageService; * public function main() { * TYPICALLY THE INTERNAL VAR, $this->doc is instantiated like this: * $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class); - * TYPICALLY THE INTERNAL VAR, $this->backPath is set like this: - * $this->backPath = $this->doc->backPath = $GLOBALS['BACK_PATH']; * ... AND OF COURSE A LOT OF OTHER THINGS GOES ON - LIKE PUTTING CONTENT INTO $this->content * $this->content=''; * } diff --git a/typo3/sysext/backend/Classes/Template/DocumentTemplate.php b/typo3/sysext/backend/Classes/Template/DocumentTemplate.php index dd9971a45d6f..edc7e901be03 100644 --- a/typo3/sysext/backend/Classes/Template/DocumentTemplate.php +++ b/typo3/sysext/backend/Classes/Template/DocumentTemplate.php @@ -326,7 +326,7 @@ function jumpToUrl(URL) { // Add all JavaScript files defined in $this->jsFiles to the PageRenderer foreach ($this->jsFilesNoConcatenation as $file) { $this->pageRenderer->addJsFile( - $GLOBALS['BACK_PATH'] . $file, + $file, 'text/javascript', true, false, @@ -336,7 +336,7 @@ function jumpToUrl(URL) { } // Add all JavaScript files defined in $this->jsFiles to the PageRenderer foreach ($this->jsFiles as $file) { - $this->pageRenderer->addJsFile($GLOBALS['BACK_PATH'] . $file); + $this->pageRenderer->addJsFile($file); } if ((int)$GLOBALS['TYPO3_CONF_VARS']['BE']['debug'] === 1) { $this->pageRenderer->enableDebugMode(); @@ -903,13 +903,13 @@ function jumpToUrl(URL) { { // Calculation needed, when TYPO3 source is used via a symlink // absolute path to the stylesheets - $filePath = dirname(GeneralUtility::getIndpEnv('SCRIPT_FILENAME')) . '/' . $GLOBALS['BACK_PATH'] . $path; + $filePath = GeneralUtility::getFileAbsFileName($path, false, true); // Clean the path $resolvedPath = GeneralUtility::resolveBackPath($filePath); // Read all files in directory and sort them alphabetically $files = GeneralUtility::getFilesInDir($resolvedPath, 'css', false, 1); foreach ($files as $file) { - $this->pageRenderer->addCssFile($GLOBALS['BACK_PATH'] . $path . $file, 'stylesheet', 'all'); + $this->pageRenderer->addCssFile($path . $file, 'stylesheet', 'all'); } } diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/backend.js b/typo3/sysext/backend/Resources/Public/JavaScript/backend.js index ba5c2c22e9f6..8b8f5c115682 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/backend.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/backend.js @@ -110,9 +110,8 @@ function str_replace(match,replace,string) { // /** * Launcing information window for records/files (fileref as "table" argument) */ -function launchView(table, uid, bP) { - var thePreviewWindow = ""; - thePreviewWindow = window.open(TYPO3.settings.ShowItem.moduleUrl + '&table=' + encodeURIComponent(table) + "&uid=" + encodeURIComponent(uid), +function launchView(table, uid) { + var thePreviewWindow = window.open(TYPO3.settings.ShowItem.moduleUrl + '&table=' + encodeURIComponent(table) + "&uid=" + encodeURIComponent(uid), "ShowItem" + TS.uniqueID, "width=650,height=600,status=0,menubar=0,resizable=0,location=0,directories=0,scrollbars=1,toolbar=0"); if (thePreviewWindow && thePreviewWindow.focus) { diff --git a/typo3/sysext/core/Classes/Database/QueryView.php b/typo3/sysext/core/Classes/Database/QueryView.php index 9e5b7b66a7fc..643d21151023 100644 --- a/typo3/sysext/core/Classes/Database/QueryView.php +++ b/typo3/sysext/core/Classes/Database/QueryView.php @@ -569,7 +569,7 @@ class QueryView ], 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') . GeneralUtility::implodeArrayForUrl('SET', (array)GeneralUtility::_POST('SET')) ]); - $out .= '' . $this->iconFactory->getIcon('actions-document-info', Icon::SIZE_SMALL)->render() . ''; + $out .= '' . $this->iconFactory->getIcon('actions-document-info', Icon::SIZE_SMALL)->render() . ''; $out .= '' . $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . ''; } else { $out .= '' . LF . '/**/' . LF . '' . LF diff --git a/typo3/sysext/core/Classes/Resource/ResourceCompressor.php b/typo3/sysext/core/Classes/Resource/ResourceCompressor.php index b3f12cf1adcc..6c7c50ac98c9 100644 --- a/typo3/sysext/core/Classes/Resource/ResourceCompressor.php +++ b/typo3/sysext/core/Classes/Resource/ResourceCompressor.php @@ -103,18 +103,6 @@ class ResourceCompressor { $this->setInitialRelativePath(); $this->setInitialRootPath(); - $this->setInitialBackPath(); - } - - /** - * Sets relative back path - * - * @return void - */ - protected function setInitialBackPath() - { - $backPath = TYPO3_MODE === 'BE' ? $GLOBALS['BACK_PATH'] : ''; - $this->setBackPath($backPath); } /** @@ -135,7 +123,7 @@ class ResourceCompressor */ protected function setInitialRelativePath() { - $relativePath = TYPO3_MODE === 'BE' ? $GLOBALS['BACK_PATH'] . '../' : ''; + $relativePath = TYPO3_MODE === 'BE' ? '../' : ''; $this->setRelativePath($relativePath); } diff --git a/typo3/sysext/core/Classes/TypoScript/ExtendedTemplateService.php b/typo3/sysext/core/Classes/TypoScript/ExtendedTemplateService.php index 4aace4b50352..989e592179b5 100644 --- a/typo3/sysext/core/Classes/TypoScript/ExtendedTemplateService.php +++ b/typo3/sysext/core/Classes/TypoScript/ExtendedTemplateService.php @@ -1109,8 +1109,7 @@ class ExtendedTemplateService extends TemplateService } elseif (substr($imgConf, 0, 4) == 'EXT:') { $iFile = GeneralUtility::getFileAbsFileName($imgConf); if ($iFile) { - $f = PathUtility::stripPathSitePrefix($iFile); - $tFile = $GLOBALS['BACK_PATH'] . '../' . $f; + $tFile = '../' . PathUtility::stripPathSitePrefix($iFile); } } if ($iFile !== null) { diff --git a/typo3/sysext/sys_action/Classes/ActionTask.php b/typo3/sysext/sys_action/Classes/ActionTask.php index 5115de658558..cc376791d7b2 100644 --- a/typo3/sysext/sys_action/Classes/ActionTask.php +++ b/typo3/sysext/sys_action/Classes/ActionTask.php @@ -809,7 +809,6 @@ class ActionTask implements \TYPO3\CMS\Taskcenter\TaskInterface // Initialize the dblist object: $dblist = GeneralUtility::makeInstance(\TYPO3\CMS\SysAction\ActionList::class); $dblist->script = GeneralUtility::getIndpEnv('REQUEST_URI'); - $dblist->backPath = $GLOBALS['BACK_PATH']; $dblist->calcPerms = $this->getBackendUser()->calcPerms($this->pageinfo); $dblist->thumbs = $this->getBackendUser()->uc['thumbnailsByDefault']; $dblist->returnUrl = $this->taskObject->returnUrl; @@ -886,14 +885,9 @@ class ActionTask implements \TYPO3\CMS\Taskcenter\TaskInterface $content .= '
' . $dblist->HTMLcode . '
'; // If a listing was produced, create the page footer with search form etc: - if ($dblist->HTMLcode) { - // Making field select box (when extended view for a single table is enabled): - if ($dblist->table) { - $tmpBackpath = $GLOBALS['BACK_PATH']; - $GLOBALS['BACK_PATH'] = ''; - $content .= $dblist->fieldSelectBox($dblist->table); - $GLOBALS['BACK_PATH'] = $tmpBackpath; - } + // Making field select box (when extended view for a single table is enabled): + if ($dblist->HTMLcode && $dblist->table) { + $content .= $dblist->fieldSelectBox($dblist->table); } } else { // Not enough rights to access the list view or the page -- 2.20.1