2 declare(strict_types = 1);
18 use Psr\Http\Message\ResponseInterface;
19 use Psr\Http\Message\ServerRequestInterface;
51 'flags' =>
'Using $flags of class SimpleDataHandlerController from the outside is discouraged, as this variable is only used for internal storage.',
52 'data' =>
'Using $data of class SimpleDataHandlerController from the outside is discouraged, as this variable is only used for internal storage.',
53 'cmd' =>
'Using $cmd of class SimpleDataHandlerController from the outside is discouraged, as this variable is only used for internal storage.',
54 'mirror' =>
'Using $mirror of class SimpleDataHandlerController from the outside is discouraged, as this variable is only used for internal storage.',
55 'cacheCmd' =>
'Using $cacheCmd of class SimpleDataHandlerController from the outside is discouraged, as this variable is only used for internal storage.',
56 'redirect' =>
'Using $redirect of class SimpleDataHandlerController from the outside is discouraged, as this variable is only used for internal storage.',
57 'CB' =>
'Using $CB of class SimpleDataHandlerController from the outside is discouraged, as this variable is only used for internal storage.',
58 'tce' =>
'Using $tce of class SimpleDataHandlerController from the outside is discouraged, as this variable is only used for internal storage.',
137 public function mainAction(ServerRequestInterface $request): ResponseInterface
143 $this->tce->printLogErrorMessages();
144 if ($this->redirect) {
145 return new RedirectResponse(GeneralUtility::locationHeaderUrl($this->redirect), 303);
163 $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
172 $this->tce->printLogErrorMessages();
174 $messages = $flashMessageService->getMessageQueueByIdentifier()->getAllMessagesAndFlush();
175 if (!empty($messages)) {
176 foreach ($messages as $message) {
177 $content[
'messages'][] = [
178 'title' => $message->getTitle(),
179 'message' => $message->getMessage(),
180 'severity' => $message->getSeverity()
183 $content[
'hasErrors'] =
true;
187 return new JsonResponse($content);
195 public function init(ServerRequestInterface $request =
null): void
197 if ($request ===
null) {
199 trigger_error(
'SimpleDataHandlerController->init() will be set to protected in TYPO3 v10.0. Do not call from other extension.', E_USER_DEPRECATED);
205 $parsedBody = $request->getParsedBody();
206 $queryParams = $request->getQueryParams();
209 $this->flags = $parsedBody[
'flags'] ?? $queryParams[
'flags'] ??
null;
210 $this->data = $parsedBody[
'data'] ?? $queryParams[
'data'] ??
null;
211 $this->cmd = $parsedBody[
'cmd'] ?? $queryParams[
'cmd'] ??
null;
212 $this->mirror = $parsedBody[
'mirror'] ?? $queryParams[
'mirror'] ??
null;
213 $this->cacheCmd = $parsedBody[
'cacheCmd'] ?? $queryParams[
'cacheCmd'] ??
null;
214 $redirect = $parsedBody[
'redirect'] ?? $queryParams[
'redirect'] ??
'';
215 $this->redirect = GeneralUtility::sanitizeLocalUrl(
$redirect);
216 $this->CB = $parsedBody[
'CB'] ?? $queryParams[
'CB'] ??
null;
218 $this->tce = GeneralUtility::makeInstance(DataHandler::class);
220 if ($beUser->uc[
'recursiveDelete']) {
222 $this->tce->deleteTree = 1;
224 if ($beUser->uc[
'copyLevels']) {
228 if ($beUser->uc[
'neverHideAtCopy']) {
229 $this->tce->neverHideAtCopy = 1;
232 if ($this->flags[
'reverseOrder']) {
233 $this->tce->reverseOrder = 1;
244 trigger_error(
'SimpleDataHandlerController->initClipboard() will be replaced by protected method initializeClipboard() in TYPO3 v10.0. Do not call from other extension.', E_USER_DEPRECATED);
253 public function main()
255 trigger_error(
'SimpleDataHandlerController->main() will be replaced by protected method processRequest() in TYPO3 v10.0. Do not call from other extension.', E_USER_DEPRECATED);
264 if (is_array($this->CB)) {
265 $clipObj = GeneralUtility::makeInstance(Clipboard::class);
266 $clipObj->initializeClipboard();
267 if ($this->CB[
'paste']) {
268 $clipObj->setCurrentPad($this->CB[
'pad']);
269 $this->cmd = $clipObj->makePasteCmdArray(
272 $this->CB[
'update'] ??
null
275 if ($this->CB[
'delete']) {
276 $clipObj->setCurrentPad($this->CB[
'pad']);
277 $this->cmd = $clipObj->makeDeleteCmdArray($this->cmd);
288 $this->tce->start($this->data, $this->cmd);
289 if (is_array($this->mirror)) {
290 $this->tce->setMirror($this->mirror);
293 $this->tce->process_uploads($_FILES);
295 $this->tce->process_datamap();
296 $this->tce->process_cmdmap();
298 if (!empty($this->cacheCmd)) {
299 $this->tce->clear_cacheCmd($this->cacheCmd);
302 if (isset($this->data[
'pages']) || isset($this->cmd[
'pages'])) {