[TASK] Make file_upload.php dispatched 07/32407/3
authorWouter Wolters <typo3@wouterwolters.nl>
Tue, 26 Aug 2014 19:47:31 +0000 (21:47 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Mon, 15 Sep 2014 19:54:31 +0000 (21:54 +0200)
Use dispatching for file_upload.php

Resolves: #61217
Releases: 6.3
Change-Id: I82adcc68e6583628255ac8442f4d5b24389a195f
Reviewed-on: http://review.typo3.org/32407
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
Reviewed-by: Alexander Opitz <opitz.alexander@googlemail.com>
Tested-by: Alexander Opitz <opitz.alexander@googlemail.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/file_upload.php
typo3/sysext/backend/Classes/ClickMenu/ClickMenu.php
typo3/sysext/backend/Modules/File/Upload/conf.php [new file with mode: 0644]
typo3/sysext/backend/Modules/File/Upload/index.php [new file with mode: 0644]
typo3/sysext/backend/ext_tables.php
typo3/sysext/filelist/Classes/Controller/FileListController.php

index 88ed183..2356e2d 100644 (file)
  */
 require __DIR__ . '/init.php';
 
+\TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog(
+       'Uploading a file is moved to an own module. Please use BackendUtility::getModuleUrl(\'file_upload\') to link to this script. This script will be removed.'
+);
+
 $fileUploadController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Controller\\File\\FileUploadController');
 $fileUploadController->main();
-$fileUploadController->printContent();
+$fileUploadController->printContent();
\ No newline at end of file
index 2f1ba41..5ab72d0 100644 (file)
@@ -969,7 +969,7 @@ class ClickMenu {
         * @todo Define visibility
         */
        public function FILE_upload($path) {
-               $script = 'file_upload.php';
+               $script = 'file_upload';
                $type = 'upload';
                $image = 'upload.gif';
                return $this->FILE_launch($path, $script, $type, $image, TRUE);
diff --git a/typo3/sysext/backend/Modules/File/Upload/conf.php b/typo3/sysext/backend/Modules/File/Upload/conf.php
new file mode 100644 (file)
index 0000000..5be50e9
--- /dev/null
@@ -0,0 +1,5 @@
+<?php
+//required for mod.php
+$MCONF['name'] = 'file_upload';
+$MCONF['script'] = '_DISPATCH';
+$MCONF['access'] = '';
\ No newline at end of file
diff --git a/typo3/sysext/backend/Modules/File/Upload/index.php b/typo3/sysext/backend/Modules/File/Upload/index.php
new file mode 100644 (file)
index 0000000..2966a55
--- /dev/null
@@ -0,0 +1,17 @@
+<?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!
+ */
+
+$fileUploadController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Controller\\File\\FileUploadController');
+$fileUploadController->main();
+$fileUploadController->printContent();
\ No newline at end of file
index 86dd48c..2405ff2 100644 (file)
@@ -26,6 +26,12 @@ if (TYPO3_MODE === 'BE') {
                \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Modules/File/Rename/'
        );
 
+       // Register file_rename
+       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
+               'file_upload',
+               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Modules/File/Upload/'
+       );
+
        // Register edit wizard
        \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
                'wizard_edit',
index f624578..a1edbd5 100644 (file)
@@ -456,7 +456,14 @@ class FileListController {
                $buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'filelist_module', $GLOBALS['BACK_PATH'], '', TRUE);
                // Upload button (only if upload to this directory is allowed)
                if ($this->folderObject && $this->folderObject->getStorage()->checkUserActionPermission('add', 'File') && $this->folderObject->checkActionPermission('write')) {
-                       $buttons['upload'] = '<a href="' . $GLOBALS['BACK_PATH'] . 'file_upload.php?target=' . rawurlencode($this->folderObject->getCombinedIdentifier()) . '&amp;returnUrl=' . rawurlencode($this->filelist->listURL()) . '" id="button-upload" title="' . $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.upload', TRUE)) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-upload') . '</a>';
+                       $buttons['upload'] = '<a href="' . htmlspecialchars($GLOBALS['BACK_PATH']
+                               . BackendUtility::getModuleUrl(
+                                       'file_upload',
+                                       array(
+                                               'target' => $this->folderObject->getCombinedIdentifier(),
+                                               'returnUrl' => $this->filelist->listURL(),
+                                       )
+                               )) . '" id="button-upload" title="' . $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:cm.upload', TRUE)) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-upload') . '</a>';
                }
                // New folder button
                if ($this->folderObject && $this->folderObject->checkActionPermission('write')
@@ -474,4 +481,4 @@ class FileListController {
                return $buttons;
        }
 
-}
+}
\ No newline at end of file