Commit 5a09adb1 authored by Wouter Wolters's avatar Wouter Wolters Committed by Helmut Hummel
Browse files

[TASK] Make tce_file.php dispatched

Use dispatching for tce_file.php

Resolves: #64692
Releases: master
Change-Id: Ia71d781a4fd4bfe829691598db039db8a7afe690
Reviewed-on: http://review.typo3.org/36520


Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent d6e3b7d3
......@@ -1018,7 +1018,7 @@ class ClickMenu {
} else {
$conf = '1==1';
}
$editOnClick = 'if(' . $loc . ' && ' . $conf . ' ){' . $loc . '.location.href=top.TS.PATH_typo3+\'tce_file.php?redirect=\'+top.rawurlencode(' . $this->frameLocation(($loc . '.document')) . '.pathname+' . $this->frameLocation(($loc . '.document')) . '.search)+\'' . '&file[delete][0][data]=' . rawurlencode($path) . '&vC=' . $this->backendUser->veriCode() . BackendUtility::getUrlToken('tceAction') . '\';};';
$editOnClick = 'if(' . $loc . ' && ' . $conf . ' ){' . $loc . '.location.href=top.TS.PATH_typo3+\'' . BackendUtility::getModuleUrl('tce_file') . '&redirect=\'+top.rawurlencode(' . $this->frameLocation(($loc . '.document')) . '.pathname+' . $this->frameLocation(($loc . '.document')) . '.search)+\'' . '&file[delete][0][data]=' . rawurlencode($path) . '&vC=' . $this->backendUser->veriCode() . BackendUtility::getUrlToken('tceAction') . '\';};';
return $this->linkItem($this->label('delete'), IconUtility::getSpriteIcon('actions-edit-delete'), $editOnClick . 'return false;');
}
......@@ -1132,7 +1132,7 @@ class ClickMenu {
*/
public function dragDrop_copymovefolder($srcPath, $dstPath, $action) {
$loc = 'top.content.list_frame';
$editOnClick = 'if(' . $loc . '){' . $loc . '.document.location=top.TS.PATH_typo3+"tce_file.php?redirect="+top.rawurlencode(' . $this->frameLocation(($loc . '.document')) . '.pathname+' . $this->frameLocation(($loc . '.document')) . '.search)+"' . '&file[' . $action . '][0][data]=' . $srcPath . '&file[' . $action . '][0][target]=' . $dstPath . '&prErr=1&vC=' . $this->backendUser->veriCode() . BackendUtility::getUrlToken('tceAction') . '";};top.nav.refresh();';
$editOnClick = 'if(' . $loc . '){' . $loc . '.document.location=top.TS.PATH_typo3+"' . BackendUtility::getModuleUrl('tce_file') . '&redirect="+top.rawurlencode(' . $this->frameLocation(($loc . '.document')) . '.pathname+' . $this->frameLocation(($loc . '.document')) . '.search)+"' . '&file[' . $action . '][0][data]=' . $srcPath . '&file[' . $action . '][0][target]=' . $dstPath . '&prErr=1&vC=' . $this->backendUser->veriCode() . BackendUtility::getUrlToken('tceAction') . '";};top.nav.refresh();';
return $this->linkItem($this->label($action . 'Folder_into'), IconUtility::getSpriteIcon('apps-pagetree-drag-move-into'), $editOnClick . 'return false;', 0);
}
......
......@@ -565,7 +565,7 @@ class Clipboard {
* @return string
*/
public function pasteUrl($table, $uid, $setRedirect = TRUE, array $update = NULL) {
$rU = $this->backPath . ($table == '_FILE' ? 'tce_file.php' . '?' : BackendUtility::getModuleUrl('tce_db') . '&') .
$rU = $this->backPath . ($table == '_FILE' ? BackendUtility::getModuleUrl('tce_file') . '&' : BackendUtility::getModuleUrl('tce_db') . '&') .
($setRedirect ? 'redirect=' . rawurlencode(GeneralUtility::linkThisScript(array('CB' => ''))) : '') .
'&vC=' . $GLOBALS['BE_USER']->veriCode() .
'&prErr=1&uPT=1' .
......@@ -584,7 +584,7 @@ class Clipboard {
* @return string
*/
public function deleteUrl($setRedirect = 1, $file = 0) {
$rU = $this->backPath . ($file ? 'tce_file.php' . '?' : BackendUtility::getModuleUrl('tce_db') . '&') . ($setRedirect ? 'redirect=' . rawurlencode(GeneralUtility::linkThisScript(array('CB' => ''))) : '') . '&vC=' . $GLOBALS['BE_USER']->veriCode() . '&prErr=1&uPT=1' . '&CB[delete]=1' . '&CB[pad]=' . $this->current . BackendUtility::getUrlToken('tceAction');
$rU = $this->backPath . ($file ? BackendUtility::getModuleUrl('tce_file') . '&' : BackendUtility::getModuleUrl('tce_db') . '&') . ($setRedirect ? 'redirect=' . rawurlencode(GeneralUtility::linkThisScript(array('CB' => ''))) : '') . '&vC=' . $GLOBALS['BE_USER']->veriCode() . '&prErr=1&uPT=1' . '&CB[delete]=1' . '&CB[pad]=' . $this->current . BackendUtility::getUrlToken('tceAction');
return $rU;
}
......
......@@ -146,7 +146,7 @@ class CreateFolderController {
$pageContent = $this->doc->header($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:file_newfolder.php.pagetitle'));
if ($this->folderObject->checkActionPermission('add')) {
$code = '<form role="form" action="tce_file.php" method="post" name="editform">';
$code = '<form role="form" action="' . BackendUtility::getModuleUrl('tce_file') . '" method="post" name="editform">';
// Making the selector box for the number of concurrent folder-creations
$this->number = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->number, 1, 10);
$code .= '
......@@ -184,7 +184,7 @@ class CreateFolderController {
}
if ($this->folderObject->getStorage()->checkUserActionPermission('add', 'File')) {
$pageContent .= '<form action="tce_file.php" method="post" name="editform2">';
$pageContent .= '<form action="' . BackendUtility::getModuleUrl('tce_file') . '" method="post" name="editform2">';
// Create a list of allowed file extensions with the nice format "*.jpg, *.gif" etc.
$fileExtList = array();
$textfileExt = GeneralUtility::trimExplode(',', $GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], TRUE);
......
......@@ -118,7 +118,7 @@ class EditFileController {
top.goToModule("file_list");
}
');
$this->doc->form = '<form action="tce_file.php" method="post" name="editform">';
$this->doc->form = '<form action="' . BackendUtility::getModuleUrl('tce_file') . '" method="post" name="editform">';
}
/**
......
......@@ -110,7 +110,7 @@ class FileUploadController {
$this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
$this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/file_upload.html');
$this->doc->backPath = $GLOBALS['BACK_PATH'];
$this->doc->form = '<form action="tce_file.php" method="post" name="editform" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '">';
$this->doc->form = '<form action="' . BackendUtility::getModuleUrl('tce_file') . '" method="post" name="editform" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '">';
}
/**
......
......@@ -136,7 +136,7 @@ class RenameFileController {
} else {
$fileIdentifier = $this->fileOrFolderObject->getUid();
}
$pageContent .= '<form action="tce_file.php" method="post" name="editform" role="form">';
$pageContent .= '<form action="' . BackendUtility::getModuleUrl('tce_file') . '" method="post" name="editform" role="form">';
// Making the formfields for renaming:
$pageContent .= '
......
<?php
// Required for mod.php
$MCONF['name'] = 'tce_file';
$MCONF['script'] = '_DISPATCH';
\ No newline at end of file
<?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!
*/
/**
* Gateway for TCE (TYPO3 Core Engine) file-handling through POST forms.
* This script serves as the fileadministration part of the TYPO3 Core Engine.
* Basically it includes two libraries which are used to manipulate files on the server.
*
* For syntax and API information, see the document 'TYPO3 Core APIs'
*
* @author Kasper Skårhøj <kasperYYYY@typo3.com>
*/
$fileController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Controller\File\FileController::class);
$formprotection = \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get();
if ($formprotection->validateToken(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('formToken'), 'tceAction')) {
$fileController->main();
}
$fileController->finish();
\ No newline at end of file
......@@ -44,6 +44,12 @@ if (TYPO3_MODE === 'BE') {
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Modules/File/Database/'
);
// Register tce_file
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
'tce_file',
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Modules/File/Administration/'
);
// Register edit wizard
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
'wizard_edit',
......
......@@ -909,7 +909,7 @@ class FileList extends AbstractRecordList {
$confirmationCheck = '1 == 1';
}
$removeOnClick = 'if (' . $confirmationCheck . ') { top.content.list_frame.location.href=top.TS.PATH_typo3+\'tce_file.php?file[delete][0][data]=' . rawurlencode($fileOrFolderObject->getCombinedIdentifier()) . '&vC=' . $this->getBackendUser()->veriCode() . BackendUtility::getUrlToken('tceAction') . '&redirect=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);};';
$removeOnClick = 'if (' . $confirmationCheck . ') { top.content.list_frame.location.href=top.TS.PATH_typo3+\'' . BackendUtility::getModuleUrl('tce_file') .'&file[delete][0][data]=' . rawurlencode($fileOrFolderObject->getCombinedIdentifier()) . '&vC=' . $this->getBackendUser()->veriCode() . BackendUtility::getUrlToken('tceAction') . '&redirect=\'+top.rawurlencode(top.content.list_frame.document.location.pathname+top.content.list_frame.document.location.search);};';
$cells['delete'] = '<a href="#" class="btn" onclick="' . htmlspecialchars($removeOnClick) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:cm.delete') . '">' . IconUtility::getSpriteIcon('actions-edit-delete') . '</a>';
} else {
......
......@@ -2490,7 +2490,7 @@ class ElementBrowser {
<!--
Form, for uploading files:
-->
<form action="' . $GLOBALS['BACK_PATH'] . 'tce_file.php" method="post" name="editform"'
<form action="' . $GLOBALS['BACK_PATH'] . BackendUtility::getModuleUrl('tce_file') . '" method="post" name="editform"'
. ' id="typo3-uplFilesForm" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '">
<table border="0" cellpadding="0" cellspacing="0" id="typo3-uplFiles">
<tr>
......@@ -2561,7 +2561,7 @@ class ElementBrowser {
<!--
Form, for creating new folders:
-->
<form action="' . $GLOBALS['BACK_PATH'] . 'tce_file.php" method="post" name="editform2" id="typo3-crFolderForm">
<form action="' . $GLOBALS['BACK_PATH'] . BackendUtility::getModuleUrl('tce_file') . '" method="post" name="editform2" id="typo3-crFolderForm">
<table border="0" cellpadding="0" cellspacing="0" id="typo3-crFolder">
<tr>
<td>' . $this->barheader($lang->sL(
......
......@@ -23,6 +23,10 @@
*/
require __DIR__ . '/init.php';
\TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog(
'File handling entry point was moved an own module. Please use BackendUtility::getModuleUrl(\'tce_file\') to link to tce_file.php. This script will be removed in TYPO3 CMS 8.'
);
$fileController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Controller\File\FileController::class);
$formprotection = \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get();
......@@ -30,4 +34,4 @@ if ($formprotection->validateToken(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('
$fileController->main();
}
$fileController->finish();
\ No newline at end of file
$fileController->finish();
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment