[TASK] Make dummy.php dispatched 78/38378/3
authorWouter Wolters <typo3@wouterwolters.nl>
Tue, 31 Mar 2015 17:05:02 +0000 (19:05 +0200)
committerMarkus Klein <klein.t3@reelworx.at>
Wed, 1 Apr 2015 14:22:17 +0000 (16:22 +0200)
Use dispatching for dummy.php

Resolves: #65290
Releases: master
Change-Id: I4ead54c227ab4713143617782b93a3eda256bd92
Reviewed-on: http://review.typo3.org/38378
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
12 files changed:
typo3/dummy.php
typo3/sysext/backend/Classes/Controller/EditDocumentController.php
typo3/sysext/backend/Classes/Controller/LoginFramesetController.php
typo3/sysext/backend/Classes/Controller/Wizard/ColorpickerController.php
typo3/sysext/backend/Classes/Domain/Repository/Module/BackendModuleRepository.php
typo3/sysext/backend/Classes/Module/ModuleLoader.php
typo3/sysext/backend/Classes/View/ModuleMenuView.php
typo3/sysext/backend/Modules/Dummy/conf.php [new file with mode: 0644]
typo3/sysext/backend/Modules/Dummy/index.php [new file with mode: 0644]
typo3/sysext/backend/ext_tables.php
typo3/sysext/core/Documentation/Changelog/master/Deprecation-65290-DeprecateDummyEntrypoint.rst [new file with mode: 0644]
typo3/sysext/recordlist/Classes/Controller/ElementBrowserFramesetController.php

index 8faba78..bb60cc6 100644 (file)
  */
 require __DIR__ . '/init.php';
 
+\TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog(
+       'The entry point to the dummy window was moved to an own module. Please use BackendUtility::getModuleUrl(\'dummy\') to link to dummy.php. This script will be removed in TYPO3 CMS 8.'
+);
+
 $dummyController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Controller\DummyController::class);
 $dummyController->main();
 $dummyController->printContent();
index 042f233..a42da63 100644 (file)
@@ -441,7 +441,7 @@ class EditDocumentController {
                        $this->defVals = $this->overrideVals;
                }
                // Setting return URL
-               $this->retUrl = $this->returnUrl ?: 'dummy.php';
+               $this->retUrl = $this->returnUrl ?: BackendUtility::getModuleUrl('dummy');
                // Fix $this->editconf if versioning applies to any of the records
                $this->fixWSversioningInEditConf();
                // Make R_URL (request url) based on input GETvars:
@@ -565,7 +565,7 @@ class EditDocumentController {
                                                                $newEditConf[$tableName][$editId] = 'edit';
                                                        }
                                                        // Traverse all new records and forge the content of ->editconf so we can continue to EDIT these records!
-                                                       if ($tableName == 'pages' && $this->retUrl != 'dummy.php' && $this->returnNewPageId) {
+                                                       if ($tableName == 'pages' && $this->retUrl != BackendUtility::getModuleUrl('dummy') && $this->returnNewPageId) {
                                                                $this->retUrl .= '&id=' . $tce->substNEWwithIDs[$key];
                                                        }
                                                }
@@ -1482,7 +1482,7 @@ class EditDocumentController {
                        BackendUtility::setUpdateSignal('OpendocsController::updateNumber', count($this->docHandler));
                }
                // If ->returnEditConf is set, then add the current content of editconf to the ->retUrl variable: (used by other scripts, like wizard_add, to know which records was created or so...)
-               if ($this->returnEditConf && $this->retUrl != 'dummy.php') {
+               if ($this->returnEditConf && $this->retUrl != BackendUtility::getModuleUrl('dummy')) {
                        $this->retUrl .= '&returnEditConf=' . rawurlencode(json_encode($this->editconf));
                }
                // If code is NOT set OR set to 1, then make a header location redirect to $this->retUrl
@@ -1502,8 +1502,8 @@ class EditDocumentController {
         * @param string $retUrl Alternative/Default retUrl
         * @return void
         */
-       public function setDocument($currentDocFromHandlerMD5 = '', $retUrl = 'dummy.php') {
-               if ($retUrl === 'dummy.php') {
+       public function setDocument($currentDocFromHandlerMD5 = '', $retUrl = '') {
+               if ($retUrl === '') {
                        return;
                }
                if (!$this->modTSconfig['properties']['disableDocSelector'] && is_array($this->docHandler) && count($this->docHandler)) {
index ae6eff1..2837a43 100644 (file)
@@ -40,7 +40,7 @@ class LoginFramesetController {
                $this->content = $GLOBALS['TBE_TEMPLATE']->getPageRenderer()->render(\TYPO3\CMS\Core\Page\PageRenderer::PART_HEADER) . '
                        <frameset rows="*,1">
                                <frame name="login" src="index.php?loginRefresh=1" marginwidth="0" marginheight="0" scrolling="no" noresize="noresize" />
-                               <frame name="dummy" src="dummy.php" marginwidth="0" marginheight="0" scrolling="auto" noresize="noresize" />
+                               <frame name="dummy" src="' . htmlspecialchars(\TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('dummy')) . '" marginwidth="0" marginheight="0" scrolling="auto" noresize="noresize" />
                        </frameset>
                </html>';
        }
index ebf73a8..e5fcd07 100644 (file)
@@ -295,7 +295,7 @@ class ColorpickerController extends AbstractWizardController {
                $this->content = $this->getDocumentTemplate()->getPageRenderer()->render(\TYPO3\CMS\Core\Page\PageRenderer::PART_HEADER) . '
                        <frameset rows="*,1" framespacing="0" frameborder="0" border="0">
                                <frame name="content" src="' . htmlspecialchars($url) . '" marginwidth="0" marginheight="0" frameborder="0" scrolling="auto" noresize="noresize" />
-                               <frame name="menu" src="dummy.php" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" noresize="noresize" />
+                               <frame name="menu" src="' . htmlspecialchars(BackendUtility::getModuleUrl('dummy')) . '" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" noresize="noresize" />
                        </frameset>
                </html>';
        }
index 7847502..5fd3d85 100644 (file)
@@ -230,7 +230,7 @@ class BackendModuleRepository implements \TYPO3\CMS\Core\SingletonInterface {
 
                // Unset modules that are meant to be hidden from the menu.
                $loadedModules = $this->removeHiddenModules($loadedModules);
-
+               $dummyScript = BackendUtility::getModuleUrl('dummy');
                foreach ($loadedModules as $moduleName => $moduleData) {
                        $moduleLink = '';
                        if (!is_array($moduleData['sub'])) {
@@ -247,7 +247,7 @@ class BackendModuleRepository implements \TYPO3\CMS\Core\SingletonInterface {
                                'link' => $moduleLink,
                                'description' => $GLOBALS['LANG']->moduleLabels['labels'][$moduleKey . 'label']
                        );
-                       if (!is_array($moduleData['sub']) && $moduleData['script'] !== 'dummy.php') {
+                       if (!is_array($moduleData['sub']) && $moduleData['script'] !== $dummyScript) {
                                // Work around for modules with own main entry, but being self the only submodule
                                $modules[$moduleKey]['subitems'][$moduleKey] = array(
                                        'name' => $moduleName,
index b32262b..092d6e0 100644 (file)
@@ -310,7 +310,7 @@ class ModuleLoader {
                } elseif ($setupInformation['configuration']['script'] && file_exists($setupInformation['path'] . '/' . $setupInformation['configuration']['script'])) {
                        $finalModuleConfiguration['script'] = $this->getRelativePath(PATH_typo3, $fullPath . '/' . $setupInformation['configuration']['script']);
                } else {
-                       $finalModuleConfiguration['script'] = 'dummy.php';
+                       $finalModuleConfiguration['script'] = BackendUtility::getModuleUrl('dummy');
                }
 
                // Navigation Frame Script (GET params could be added)
index 342e0c7..428e958 100644 (file)
@@ -102,10 +102,11 @@ class ModuleMenuView {
                $data = array('success' => TRUE, 'root' => array());
                $rawModuleData = $this->getRawModuleData();
                $index = 0;
+               $dummyLink = BackendUtility::getModuleUrl('dummy');
                foreach ($rawModuleData as $moduleKey => $moduleData) {
                        $key = substr($moduleKey, 8);
                        $num = count($data['root']);
-                       if ($moduleData['link'] != 'dummy.php' || $moduleData['link'] == 'dummy.php' && is_array($moduleData['subitems'])) {
+                       if ($moduleData['link'] != $dummyLink || $moduleData['link'] == $dummyLink && is_array($moduleData['subitems'])) {
                                $data['root'][$num]['key'] = $key;
                                $data['root'][$num]['menuState'] = $GLOBALS['BE_USER']->uc['moduleData']['menuState'][$moduleKey];
                                $data['root'][$num]['label'] = $moduleData['title'];
@@ -201,7 +202,7 @@ class ModuleMenuView {
 
                // Unset modules that are meant to be hidden from the menu.
                $this->unsetHiddenModules();
-
+               $dummyScript = BackendUtility::getModuleUrl('dummy');
                foreach ($this->loadedModules as $moduleName => $moduleData) {
                        $moduleLink = '';
                        if (!is_array($moduleData['sub'])) {
@@ -218,7 +219,7 @@ class ModuleMenuView {
                                'link' => $moduleLink,
                                'description' => $GLOBALS['LANG']->moduleLabels['labels'][$moduleKey . 'label']
                        );
-                       if (!is_array($moduleData['sub']) && $moduleData['script'] != 'dummy.php') {
+                       if (!is_array($moduleData['sub']) && $moduleData['script'] != $dummyScript) {
                                // Work around for modules with own main entry, but being self the only submodule
                                $modules[$moduleKey]['subitems'][$moduleKey] = array(
                                        'name' => $moduleName,
diff --git a/typo3/sysext/backend/Modules/Dummy/conf.php b/typo3/sysext/backend/Modules/Dummy/conf.php
new file mode 100644 (file)
index 0000000..31bd84d
--- /dev/null
@@ -0,0 +1,4 @@
+<?php
+// Required for mod.php
+$MCONF['name'] = 'dummy';
+$MCONF['script'] = '_DISPATCH';
\ No newline at end of file
diff --git a/typo3/sysext/backend/Modules/Dummy/index.php b/typo3/sysext/backend/Modules/Dummy/index.php
new file mode 100644 (file)
index 0000000..77fbbe5
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+/**
+ * Dummy document - displays nothing but background color.
+ *
+ * @author Kasper Skårhøj <kasperYYYY@typo3.com>
+ */
+
+$dummyController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Controller\DummyController::class);
+$dummyController->main();
+$dummyController->printContent();
\ No newline at end of file
index 7386976..4f437b5 100644 (file)
@@ -158,4 +158,10 @@ if (TYPO3_MODE === 'BE') {
                'browser',
                \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Modules/Browser/'
        );
+
+       // Register dummy window
+       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
+               'dummy',
+               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Modules/Dummy/'
+       );
 }
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-65290-DeprecateDummyEntrypoint.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-65290-DeprecateDummyEntrypoint.rst
new file mode 100644 (file)
index 0000000..1ffdbef
--- /dev/null
@@ -0,0 +1,25 @@
+=================================================
+Deprecation: #65290 - Deprecate dummy entry point
+=================================================
+
+Description
+===========
+
+The following entry point has been marked as deprecated:
+
+* typo3/dummy.php
+
+
+Impact
+======
+
+Using this entry point in a backend module will throw a deprecation message.
+
+
+Migration
+=========
+
+Use ``\TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl()`` instead with the according module name.
+
+typo3/dummy.php
+``\TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('dummy')``
\ No newline at end of file
index a9480ba..4806294 100644 (file)
@@ -70,7 +70,7 @@ class ElementBrowserFramesetController {
                $this->content = $documentTemplate->getPageRenderer()->render(PageRenderer::PART_HEADER) .
                        '<frameset rows="*,1" framespacing="0" frameborder="0" border="0">
                                <frame name="content" src="' . htmlspecialchars($url) . '" marginwidth="0" marginheight="0" frameborder="0" scrolling="auto" noresize="noresize" />
-                               <frame name="menu" src="' . $GLOBALS['BACK_PATH'] . 'dummy.php" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" noresize="noresize" />
+                               <frame name="menu" src="' . htmlspecialchars(BackendUtility::getModuleUrl('dummy')) . '" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" noresize="noresize" />
                        </frameset>
                </html>
                ';