17 use Psr\Http\Message\ResponseInterface;
18 use Psr\Http\Message\ServerRequestInterface;
65 'pageinfo' =>
'Using ImportExportController::$pageinfo is deprecated and will not be possible anymore in TYPO3 v10.0.',
66 'id' =>
'Using ImportExportController::$id is deprecated and will not be possible anymore in TYPO3 v10.0.',
67 'perms_clause' =>
'Using ImportExportController::$perms_clause is deprecated and will not be possible anymore in TYPO3 v10.0.',
68 'extObj' =>
'Using ImportExportController::$extObj is deprecated, the property will be removed in TYPO3 v10.0.',
69 'doc' =>
'Using ImportExportController::$doc is deprecated, the property will be removed in TYPO3 v10.0.',
70 'content' =>
'Using ImportExportController::$content is deprecated, the property will be removed in TYPO3 v10.0.',
71 'extClassConf' =>
'Using ImportExportController::$extClassConf is deprecated, the property will be removed in TYPO3 v10.0.',
72 'modMenu_setDefaultList' =>
'Using ImportExportController::$modMenu_setDefaultList is deprecated, the property will be removed in TYPO3 v10.0.',
73 'modMenu_dontValidateList' =>
'Using ImportExportController::$modMenu_dontValidateList is deprecated, the property will be removed in TYPO3 v10.0.',
74 'modMenu_type' =>
'Using ImportExportController::$modMenu_type is deprecated, the property will be removed in TYPO3 v10.0.',
75 'modTSconfig' =>
'Using ImportExportController::$modTSconfig is deprecated, the property will be removed in TYPO3 v10.0.',
76 'MOD_SETTINGS' =>
'Using ImportExportController::$MOD_SETTINGS is deprecated, the property will be removed in TYPO3 v10.0.',
77 'MOD_MENU' =>
'Using ImportExportController::MOD_MENU is deprecated, the property will be removed in TYPO3 v10.0.',
78 'CMD' =>
'Using ImportExportController::$CMD is deprecated, the property will be removed in TYPO3 v10.0.',
79 'MCONF' =>
'Using ImportExportController::$MCONF is deprecated, the property will be removed in TYPO3 v10.0.',
86 'init' =>
'Using ImportExportController::init() is deprecated and will not be possible anymore in TYPO3 v10.0.',
87 'main' =>
'Using ImportExportController::main() is deprecated and will not be possible anymore in TYPO3 v10.0.',
88 'exportData' =>
'Using ImportExportController::exportData() is deprecated and will not be possible anymore in TYPO3 v10.0.',
89 'addRecordsForPid' =>
'Using ImportExportController::addRecordsForPid() is deprecated and will not be possible anymore in TYPO3 v10.0.',
90 'exec_listQueryPid' =>
'Using ImportExportController::exec_listQueryPid() is deprecated and will not be possible anymore in TYPO3 v10.0.',
91 'makeConfigurationForm' =>
'Using ImportExportController::makeConfigurationForm() is deprecated and will not be possible anymore in TYPO3 v10.0.',
92 'makeAdvancedOptionsForm' =>
'Using ImportExportController::makeAdvancedOptionsForm() is deprecated and will not be possible anymore in TYPO3 v10.0.',
93 'makeSaveForm' =>
'Using ImportExportController::makeSaveForm() is deprecated and will not be possible anymore in TYPO3 v10.0.',
94 'importData' =>
'Using ImportExportController::importData() is deprecated and will not be possible anymore in TYPO3 v10.0.',
95 'checkUpload' =>
'Using ImportExportController::checkUpload() is deprecated and will not be possible anymore in TYPO3 v10.0.',
96 'getTableSelectOptions' =>
'Using ImportExportController::getTableSelectOptions() is deprecated and will not be possible anymore in TYPO3 v10.0.',
97 'filterPageIds' =>
'Using ImportExportController::filterPageIds() is deprecated and will not be possible anymore in TYPO3 v10.0.',
98 'getExtObjContent' =>
'Using ImportExportController::getExtObjContent() is deprecated, the method will be removed in TYPO3 v10.0.',
99 'extObjContent' =>
'Using ImportExportController::extObjContent() is deprecated, the method will be removed in TYPO3 v10.0.',
100 'extObjHeader' =>
'Using ImportExportController::extObjHeader() is deprecated, the method will be removed in TYPO3 v10.0.',
101 'checkSubExtObj' =>
'Using ImportExportController::checkSubExtObj() is deprecated, the method will be removed in TYPO3 v10.0.',
102 'checkExtObj' =>
'Using ImportExportController::checkExtObj() is deprecated, the method will be removed in TYPO3 v10.0.',
103 'getExternalItemConfig' =>
'Using ImportExportController::getExternalItemConfig() is deprecated, the method will be removed in TYPO3 v10.0.',
104 'handleExternalFunctionValue' =>
'Using ImportExportController::handleExternalFunctionValue() is deprecated, the method will be removed in TYPO3 v10.0.',
105 'mergeExternalItems' =>
'Using ImportExportController::mergeExternalItems() is deprecated, the method will be removed in TYPO3 v10.0.',
106 'menuConfig' =>
'Using ImportExportController::menuConfig() is deprecated, the method will be removed in TYPO3 v10.0.',
324 $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class);
325 $this->moduleTemplate = GeneralUtility::makeInstance(ModuleTemplate::class);
326 $this->presetRepository = GeneralUtility::makeInstance(PresetRepository::class);
330 $this->standaloneView = GeneralUtility::makeInstance(StandaloneView::class);
331 $this->standaloneView->setTemplateRootPaths([$templatePath .
'Templates/ImportExport/']);
332 $this->standaloneView->setLayoutRootPaths([$templatePath .
'Layouts/']);
333 $this->standaloneView->setPartialRootPaths([$templatePath .
'Partials/']);
334 $this->standaloneView->getRequest()->setControllerExtensionName(
'impexp');
340 protected function init()
345 $this->CMD = GeneralUtility::_GP(
'CMD');
347 $this->
id = (int)GeneralUtility::_GP(
'id');
349 $this->returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP(
'returnUrl'));
360 protected function main()
362 $this->lang->includeLLFile(
'EXT:impexp/Resources/Private/Language/locallang.xlf');
366 $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
367 $this->doc->bodyTagId =
'imp-exp-mod';
370 if (is_array($this->pageinfo)) {
371 $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo);
374 $this->moduleTemplate->getPageRenderer()->loadRequireJsModule(
'TYPO3/CMS/Backend/ContextMenu');
375 $this->moduleTemplate->getPageRenderer()->loadRequireJsModule(
'TYPO3/CMS/Impexp/ImportExport');
376 $this->moduleTemplate->addJavaScriptCode(
378 'if (top.fsMod) top.fsMod.recentIds["web"] = ' . (
int)$this->
id .
';'
382 $inData = GeneralUtility::_GP(
'tx_impexp');
383 if ($inData ===
null) {
387 'action' =>
'import',
389 $flashMessage = GeneralUtility::makeInstance(
391 $this->lang->getLL(
'importdata_upload_nodata'),
392 $this->lang->getLL(
'importdata_upload_error'),
395 $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
396 $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
397 $defaultFlashMessageQueue->enqueue($flashMessage);
399 if (!array_key_exists(
'excludeDisabled', $inData)) {
401 $inData[
'excludeDisabled'] = 1;
403 $uriBuilder = GeneralUtility::makeInstance(\
TYPO3\CMS\Backend\Routing\UriBuilder::class);
404 $this->standaloneView->assign(
'moduleUrl', (
string)$uriBuilder->buildUriFromRoute(
'xMOD_tximpexp'));
405 $this->standaloneView->assign(
'id', $this->
id);
406 $this->standaloneView->assign(
'inData', $inData);
408 switch ((
string)$inData[
'action']) {
410 $this->shortcutName = $this->lang->getLL(
'title_export');
413 $this->standaloneView->setTemplate(
'Export.html');
417 $isEnabledForNonAdmin = (bool)($backendUser->getTSConfig()[
'options.'][
'impexp.'][
'enableImportForNonAdminUser'] ??
false);
418 if (!$backendUser->isAdmin() && !$isEnabledForNonAdmin) {
419 throw new \RuntimeException(
420 'Import module is disabled for non admin users and '
421 .
'userTsConfig options.impexp.enableImportForNonAdminUser is not enabled.',
425 $this->shortcutName = $this->lang->getLL(
'title_import');
426 if (GeneralUtility::_POST(
'_upload')) {
430 if (!empty($this->uploadedFiles[0])) {
432 $extension = $this->uploadedFiles[0]->getExtension();
433 if ($extension ===
't3d' || $extension ===
'xml') {
434 $inData[
'file'] = $this->uploadedFiles[0]->getCombinedIdentifier();
439 $this->standaloneView->setTemplate(
'Import.html');
481 public function mainAction(ServerRequestInterface $request): ResponseInterface
488 $this->moduleTemplate->setContent($this->standaloneView->render());
489 return new HtmlResponse($this->moduleTemplate->renderContent());
497 $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
499 $shortcutButton = $buttonBar->makeShortcutButton()
500 ->setGetVariables([
'tx_impexp'])
501 ->setDisplayName($this->shortcutName)
502 ->setModuleName($this->moduleName);
503 $buttonBar->addButton($shortcutButton);
506 if ($this->returnUrl) {
507 $backButton = $buttonBar->makeLinkButton()
508 ->setHref($this->returnUrl)
509 ->setTitle($this->lang->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.goBack'))
510 ->setIcon($this->moduleTemplate->getIconFactory()->getIcon(
'actions-view-go-back',
Icon::SIZE_SMALL));
511 $buttonBar->addButton($backButton);
514 $inData = GeneralUtility::_GP(
'tx_impexp');
515 if ((
string)$inData[
'action'] ===
'import') {
516 if ($this->
id && is_array($this->pageinfo) || $this->
getBackendUser()->isAdmin() && !$this->
id) {
517 if (is_array($this->pageinfo) && $this->pageinfo[
'uid']) {
520 $this->pageinfo[
'uid'],
524 $viewButton = $buttonBar->makeLinkButton()
525 ->setTitle($this->lang->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.showPage'))
528 ->setOnClick($onClick);
529 $buttonBar->addButton($viewButton);
551 $inData[
'filename'] = trim(preg_replace(
'/[^[:alnum:]._-]*/',
'', preg_replace(
'/\\.(t3d|xml)$/',
'', $inData[
'filename'])));
552 if (strlen($inData[
'filename'])) {
553 $inData[
'filename'] .= $inData[
'filetype'] ===
'xml' ?
'.xml' :
'.t3d';
556 if (!is_array($inData[
'exclude'])) {
557 $inData[
'exclude'] = [];
560 $this->presetRepository->processPresets($inData);
562 $this->export = GeneralUtility::makeInstance(Export::class);
563 $this->export->init(0);
564 $this->export->excludeMap = (array)$inData[
'exclude'];
565 $this->export->softrefCfg = (array)$inData[
'softrefCfg'];
566 $this->export->extensionDependencies = ($inData[
'extension_dep'] ===
'') ? [] : (array)$inData[
'extension_dep'];
567 $this->export->showStaticRelations = $inData[
'showStaticRelations'];
568 $this->export->includeExtFileResources = !$inData[
'excludeHTMLfileResources'];
569 $this->excludeDisabledRecords = (bool)$inData[
'excludeDisabled'];
570 $this->export->setExcludeDisabledRecords($this->excludeDisabledRecords);
573 if (is_array($inData[
'external_static'][
'tables'])) {
574 $this->export->relStaticTables = $inData[
'external_static'][
'tables'];
577 if (is_array($inData[
'external_ref'][
'tables'])) {
578 $this->export->relOnlyTables = $inData[
'external_ref'][
'tables'];
580 $saveFilesOutsideExportFile =
false;
581 if (isset($inData[
'save_export']) && isset($inData[
'saveFilesOutsideExportFile']) && $inData[
'saveFilesOutsideExportFile'] ===
'1') {
582 $this->export->setSaveFilesOutsideExportFile(
true);
583 $saveFilesOutsideExportFile =
true;
585 $this->export->setHeaderBasics();
589 $this->export->setMetaData(
590 $inData[
'meta'][
'title'],
591 $inData[
'meta'][
'description'],
592 $inData[
'meta'][
'notes'],
593 $beUser->user[
'username'],
594 $beUser->user[
'realName'],
595 $beUser->user[
'email']
598 if (is_array($inData[
'record'])) {
599 foreach ($inData[
'record'] as $ref) {
600 $rParts = explode(
':', $ref);
605 if (is_array($inData[
'list'])) {
606 foreach ($inData[
'list'] as $ref) {
607 $rParts = explode(
':', $ref);
608 if ($beUser->check(
'tables_select', $rParts[0])) {
610 while ($subTrow = $statement->fetch()) {
611 $this->export->export_addRecord($rParts[0], $subTrow);
617 if (isset($inData[
'pagetree'][
'id'])) {
620 if ($inData[
'pagetree'][
'levels'] == -1) {
621 $pagetree = GeneralUtility::makeInstance(ExportPageTreeView::class);
622 if ($this->excludeDisabledRecords) {
625 $tree = $pagetree->ext_tree($inData[
'pagetree'][
'id'], $this->
filterPageIds($this->export->excludeMap));
626 $this->treeHTML = $pagetree->printTree($tree);
627 $idH = $pagetree->buffer_idH;
628 } elseif ($inData[
'pagetree'][
'levels'] == -2) {
629 $this->
addRecordsForPid($inData[
'pagetree'][
'id'], $inData[
'pagetree'][
'tables']);
634 if (!$inData[
'pagetree'][
'id'] && $beUser->isAdmin()) {
642 if (is_array($sPage)) {
643 $pid = $inData[
'pagetree'][
'id'];
644 $tree = GeneralUtility::makeInstance(PageTreeView::class);
645 $initClause =
'AND ' . $this->perms_clause . $this->
filterPageIds($this->export->excludeMap);
646 if ($this->excludeDisabledRecords) {
649 $tree->init($initClause);
650 $HTML = $this->iconFactory->getIconForRecord(
'pages', $sPage,
Icon::SIZE_SMALL)->render();
651 $tree->tree[] = [
'row' => $sPage,
'HTML' => $HTML];
652 $tree->buffer_idH = [];
653 if ($inData[
'pagetree'][
'levels'] > 0) {
654 $tree->getTree($pid, $inData[
'pagetree'][
'levels'],
'');
657 $idH[$pid][
'uid'] = $pid;
658 if (!empty($tree->buffer_idH)) {
659 $idH[$pid][
'subrow'] = $tree->buffer_idH;
661 $pagetree = GeneralUtility::makeInstance(ExportPageTreeView::class);
662 $this->treeHTML = $pagetree->printTree($tree->tree);
663 $this->shortcutName .=
' (' . $sPage[
'title'] .
')';
668 if (is_array($idH)) {
670 $flatList = $this->export->setPageTree($idH);
671 foreach ($flatList as $k => $value) {
678 for ($a = 0; $a < 10; $a++) {
679 $addR = $this->export->export_addDBRelations($a);
686 $this->export->export_addFilesFromRelations();
688 $this->export->export_addFilesFromSysFilesRecords();
691 if ($inData[
'download_export'] || $inData[
'save_export']) {
692 switch ((
string)$inData[
'filetype']) {
694 $out = $this->export->compileMemoryToFileContent(
'xml');
698 $this->export->dontCompress = 1;
702 $out = $this->export->compileMemoryToFileContent();
703 $fExt = ($this->export->doOutputCompress() ?
'-z' :
'') .
'.t3d';
706 $dlFile = $inData[
'filename'];
708 $exportName = substr(preg_replace(
'/[^[:alnum:]_]/',
'-', $inData[
'download_export_name']), 0, 20);
709 $dlFile =
'T3D_' . $exportName .
'_' . date(
'Y-m-d_H-i') . $fExt;
713 if ($inData[
'download_export']) {
714 $mimeType =
'application/octet-stream';
715 header(
'Content-Type: ' . $mimeType);
716 header(
'Content-Length: ' . strlen($out));
722 if ($inData[
'save_export']) {
725 if ($saveFolder !==
false && $saveFolder->checkActionPermission(
'write')) {
726 $temporaryFileName = GeneralUtility::tempnam(
'export');
727 GeneralUtility::writeFile($temporaryFileName, $out);
728 $file = $saveFolder->addFile($temporaryFileName, $dlFile,
'replace');
729 if ($saveFilesOutsideExportFile) {
730 $filesFolderName = $dlFile .
'.files';
731 $filesFolder = $saveFolder->createFolder($filesFolderName);
732 $temporaryFilesForExport = GeneralUtility::getFilesInDir($this->export->getTemporaryFilesPathForExport(),
'',
true);
733 foreach ($temporaryFilesForExport as $temporaryFileForExport) {
734 $filesFolder->addFile($temporaryFileForExport);
735 GeneralUtility::unlink_tempfile($temporaryFileForExport);
737 GeneralUtility::rmdir($this->export->getTemporaryFilesPathForExport());
741 $flashMessage = GeneralUtility::makeInstance(
743 sprintf(
$lang->
getLL(
'exportdata_savedInSBytes'), $file->getPublicUrl(), GeneralUtility::formatSize(strlen($out))),
749 $flashMessage = GeneralUtility::makeInstance(
751 sprintf(
$lang->
getLL(
'exportdata_badPathS'), $saveFolder->getPublicUrl()),
757 $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
759 $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
760 $defaultFlashMessageQueue->enqueue($flashMessage);
770 $this->standaloneView->assign(
'errors', $this->export->errorLog);
773 $this->standaloneView->assign(
775 $this->export->displayContentOverview()
788 if (!is_array($tables)) {
791 foreach (
$GLOBALS[
'TCA'] as $table => $value) {
792 if ($table !==
'pages' && (in_array($table, $tables) || in_array(
'_ALL', $tables))) {
794 if ($maxNumber !==
null) {
801 while ($subTrow = $statement->fetch()) {
802 $this->export->export_addRecord($table, $subTrow);
820 if ($limit !==
null) {
822 'The third argument of addRecordsForPid() and exec_listQueryPid() has been'
823 .
' deprecated, do not limit exports anymore. The parameter will be removed in TYPO3 v10.0.',
828 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table);
830 $orderBy =
$GLOBALS[
'TCA'][$table][
'ctrl'][
'sortby'] ?:
$GLOBALS[
'TCA'][$table][
'ctrl'][
'default_sortby'];
831 $queryBuilder->getRestrictions()->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class));
833 if ($this->excludeDisabledRecords ===
false) {
834 $queryBuilder->getRestrictions()
836 ->add(GeneralUtility::makeInstance(DeletedRestriction::class))
837 ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class));
840 $queryBuilder->select(
'*')
843 $queryBuilder->expr()->eq(
845 $queryBuilder->createNamedParameter($pid, \PDO::PARAM_INT)
850 if ($limit !==
null) {
851 $queryBuilder->setMaxResults($limit);
855 list($fieldName, $order) = $orderPair;
856 $queryBuilder->addOrderBy($fieldName, $order);
859 $statement = $queryBuilder->execute();
862 if ($limit !==
null && $statement->rowCount() == $limit) {
863 $limitWarning = sprintf($this->lang->getLL(
'makeconfig_anSqlQueryReturned'), $limit);
865 $flashMessage = GeneralUtility::makeInstance(
867 $this->lang->getLL(
'execlistqu_maxNumberLimit'),
872 $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
874 $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
875 $defaultFlashMessageQueue->enqueue($flashMessage);
888 $nameSuggestion =
'';
890 if (isset($inData[
'pagetree'][
'id'])) {
891 $this->standaloneView->assign(
'treeHTML', $this->treeHTML);
894 '-2' => $this->lang->getLL(
'makeconfig_tablesOnThisPage'),
895 '-1' => $this->lang->getLL(
'makeconfig_expandedTree'),
896 '0' => $this->lang->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_0'),
897 '1' => $this->lang->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_1'),
898 '2' => $this->lang->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_2'),
899 '3' => $this->lang->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_3'),
900 '4' => $this->lang->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_4'),
901 '999' => $this->lang->sL(
'LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.depth_infi'),
903 $this->standaloneView->assign(
'levelSelectOptions', $opt);
905 $nameSuggestion .=
'tree_PID' . $inData[
'pagetree'][
'id'] .
'_L' . $inData[
'pagetree'][
'levels'];
908 if (is_array($inData[
'record'])) {
910 foreach ($inData[
'record'] as $ref) {
911 $rParts = explode(
':', $ref);
914 $nameSuggestion .= $tName .
'_' . $rUid;
918 'icon' => $this->iconFactory->getIconForRecord($tName, $rec,
Icon::SIZE_SMALL)->render(),
920 'tableName' => $tName,
925 $this->standaloneView->assign(
'records', $records);
928 if (is_array($inData[
'list'])) {
932 foreach ($inData[
'list'] as $reference) {
933 $referenceParts = explode(
':', $reference);
934 $tableName = $referenceParts[0];
938 if ($referenceParts[1] ===
'0') {
939 $iconAndTitle = $this->iconFactory->getIcon(
'apps-pagetree-root',
Icon::SIZE_SMALL)->render() .
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'sitename'];
942 $iconAndTitle = $this->iconFactory->getIconForRecord(
'pages', $record,
Icon::SIZE_SMALL)->render()
947 'iconAndTitle' => sprintf($this->lang->getLL(
'makeconfig_tableListEntry'), $tableName, $iconAndTitle),
948 'reference' => $reference
952 $this->standaloneView->assign(
'tableList', $tableList);
957 $this->standaloneView->assign(
'nameSuggestion', $nameSuggestion);
968 $loadedExtensions = array_combine($loadedExtensions, $loadedExtensions);
969 $this->standaloneView->assign(
'extensions', $loadedExtensions);
970 $this->standaloneView->assign(
'inData', $inData);
980 $opt = $this->presetRepository->getPresets((
int)$inData[
'pagetree'][
'id']);
982 $this->standaloneView->assign(
'presetSelectOptions', $opt);
986 $this->standaloneView->assign(
'saveFolder', $saveFolder->getCombinedIdentifier());
991 $opt[
'xml'] = $this->lang->getLL(
'makesavefo_xml');
992 if ($this->export->compress) {
993 $opt[
't3d_compressed'] = $this->lang->getLL(
'makesavefo_t3dFileCompressed');
995 $opt[
't3d'] = $this->lang->getLL(
'makesavefo_t3dFile');
997 $this->standaloneView->assign(
'filetypeSelectOptions', $opt);
1001 $this->standaloneView->assign(
'saveFolder', $saveFolder->getPublicUrl());
1002 $this->standaloneView->assign(
'hasSaveFolder',
true);
1004 $this->standaloneView->assign(
'fileName', $fileName);
1021 $access = is_array($this->pageinfo);
1023 if ($this->
id && $access || $beUser->isAdmin() && !$this->id) {
1024 if ($beUser->isAdmin() && !$this->id) {
1025 $this->pageinfo = [
'title' =>
'[root-level]',
'uid' => 0,
'pid' => 0];
1027 if ($inData[
'new_import']) {
1028 unset($inData[
'import_mode']);
1031 $import = GeneralUtility::makeInstance(Import::class);
1033 $import->update = $inData[
'do_update'];
1034 $import->import_mode = $inData[
'import_mode'];
1035 $import->enableLogging = $inData[
'enableLogging'];
1036 $import->global_ignore_pid = $inData[
'global_ignore_pid'];
1037 $import->force_all_UIDS = $inData[
'force_all_UIDS'];
1038 $import->showDiff = !$inData[
'notShowDiff'];
1039 $import->allowPHPScripts = $inData[
'allowPHPScripts'];
1040 $import->softrefInputValues = $inData[
'softrefInputValues'];
1049 $this->shortcutName .=
' (' . $this->pageinfo[
'title'] .
')';
1052 $selectOptions = [
''];
1053 foreach ($exportFiles as $file) {
1054 $selectOptions[$file->getCombinedIdentifier()] = $file->getPublicUrl();
1057 $this->standaloneView->assign(
'import',
$import);
1058 $this->standaloneView->assign(
'inData', $inData);
1059 $this->standaloneView->assign(
'fileSelectOptions', $selectOptions);
1062 $this->standaloneView->assign(
'importPath', sprintf($this->lang->getLL(
'importdata_fromPathS'), $path->getCombinedIdentifier()));
1064 $this->standaloneView->assign(
'importPath', $this->lang->getLL(
'importdata_no_default_upload_folder'));
1066 $this->standaloneView->assign(
'isAdmin', $beUser->isAdmin());
1071 $this->standaloneView->assign(
'tempFolder', $tempFolder->getCombinedIdentifier());
1072 $this->standaloneView->assign(
'hasTempUploadFolder',
true);
1073 if (GeneralUtility::_POST(
'_upload')) {
1074 $this->standaloneView->assign(
'submitted', GeneralUtility::_POST(
'_upload'));
1075 $this->standaloneView->assign(
'noFileUploaded', $this->fileProcessor->internalUploadMap[1]);
1076 if ($this->uploadedFiles[0]) {
1077 $this->standaloneView->assign(
'uploadedFile', $this->uploadedFiles[0]->getName());
1083 $inFile = $this->
getFile($inData[
'file']);
1084 if ($inFile !==
null && $inFile->exists()) {
1085 $this->standaloneView->assign(
'metaDataInFileExists',
true);
1086 $importInhibitedMessages = [];
1089 if ($inData[
'import_file']) {
1090 if (empty($importInhibitedMessages)) {
1099 if (!empty($importInhibitedMessages)) {
1100 $flashMessageQueue = GeneralUtility::makeInstance(FlashMessageService::class)->getMessageQueueByIdentifier(
'impexp.errors');
1101 foreach ($importInhibitedMessages as $message) {
1102 $flashMessageQueue->addMessage(GeneralUtility::makeInstance(
1103 FlashMessage::class,
1112 $this->standaloneView->assign(
'errors',
$import->errorLog);
1129 $defaultImportExportFolder =
null;
1132 if ($defaultTemporaryFolder !==
null) {
1133 $importExportFolderName =
'importexport';
1134 $createFolder = !$defaultTemporaryFolder->hasFolder($importExportFolderName);
1135 if ($createFolder ===
true) {
1137 $defaultImportExportFolder = $defaultTemporaryFolder->createFolder($importExportFolderName);
1138 }
catch (Exception $folderAccessException) {
1141 $defaultImportExportFolder = $defaultTemporaryFolder->getSubfolder($importExportFolderName);
1145 return $defaultImportExportFolder;
1156 $file = GeneralUtility::_GP(
'file');
1158 $this->fileProcessor = GeneralUtility::makeInstance(ExtendedFileUtility::class);
1159 $this->fileProcessor->setActionPermissions();
1162 $this->fileProcessor->start($file);
1163 $result = $this->fileProcessor->processData();
1164 if (!empty($result[
'upload'])) {
1180 if (!GeneralUtility::inList($excludeList,
'_ALL')) {
1181 $optValues[
'_ALL'] =
'[' . $this->lang->getLL(
'ALL_tables') .
']';
1183 foreach (
$GLOBALS[
'TCA'] as $table => $_) {
1184 if ($this->
getBackendUser()->check(
'tables_select', $table) && !GeneralUtility::inList($excludeList, $table)) {
1185 $optValues[$table] = $table;
1201 $exclude = array_keys($exclude);
1204 foreach ($exclude as $element) {
1205 list($table, $uid) = explode(
':', $element);
1206 if ($table ===
'pages') {
1207 $pageIds[] = (int)$uid;
1211 if (!empty($pageIds)) {
1212 return ' AND uid NOT IN (' . implode(
',', $pageIds) .
')';
1244 if ($folder !==
null) {
1247 $filter = GeneralUtility::makeInstance(FileExtensionFilter::class);
1248 $filter->setAllowedFileExtensions([
't3d',
'xml']);
1249 $folder->getStorage()->addFileAndFolderNameFilter([$filter,
'filterFileList']);
1251 $exportFiles = $folder->getFiles();
1254 return $exportFiles;
1263 protected function getFile($combinedIdentifier)
1267 }
catch (\Exception $exception) {
1286 $this->MOD_MENU[
'function'] = $this->
mergeExternalItems($this->MCONF[
'name'],
'function', $this->MOD_MENU[
'function']);
1287 $blindActions = $this->modTSconfig[
'properties'][
'menu.'][
'function.'] ?? [];
1288 foreach ($blindActions as $key => $value) {
1289 if (!$value && array_key_exists($key, $this->MOD_MENU[
'function'])) {
1290 unset($this->MOD_MENU[
'function'][$key]);
1293 $this->MOD_SETTINGS =
BackendUtility::getModuleData($this->MOD_MENU, GeneralUtility::_GP(
'SET'), $this->MCONF[
'name'], $this->modMenu_type, $this->modMenu_dontValidateList, $this->modMenu_setDefaultList);
1309 $mergeArray =
$GLOBALS[
'TBE_MODULES_EXT'][$modName][
'MOD_MENU'][$menuKey];
1310 if (is_array($mergeArray)) {
1311 foreach ($mergeArray as $k => $v) {
1312 if (((
string)$v[
'ws'] ===
'' || $this->
getBackendUser()->workspace === 0 && GeneralUtility::inList($v[
'ws'],
'online')) || $this->
getBackendUser()->workspace === -1 && GeneralUtility::inList($v[
'ws'],
'offline') || $this->
getBackendUser()->workspace > 0 && GeneralUtility::inList($v[
'ws'],
'custom')) {
1330 if ($MS_value ===
null) {
1331 $MS_value = $this->MOD_SETTINGS[$MM_key];
1349 if (isset(
$GLOBALS[
'TBE_MODULES_EXT'][$modName])) {
1350 return (
string)$value !==
'' ?
$GLOBALS[
'TBE_MODULES_EXT'][$modName][
'MOD_MENU'][$menuKey][$value] :
$GLOBALS[
'TBE_MODULES_EXT'][$modName][
'MOD_MENU'][$menuKey];
1366 if (is_array($this->extClassConf) && $this->extClassConf[
'name']) {
1367 $this->extObj = GeneralUtility::makeInstance($this->extClassConf[
'name']);
1368 $this->extObj->init($this, $this->extClassConf);
1370 $this->MOD_SETTINGS =
BackendUtility::getModuleData($this->MOD_MENU, GeneralUtility::_GP(
'SET'), $this->MCONF[
'name'], $this->modMenu_type, $this->modMenu_dontValidateList, $this->modMenu_setDefaultList);
1381 if (is_object($this->extObj)) {
1382 $this->extObj->checkExtObj();
1395 if (is_callable([$this->extObj,
'head'])) {
1396 $this->extObj->head();
1407 if ($this->extObj ===
null) {
1408 $flashMessage = GeneralUtility::makeInstance(
1409 FlashMessage::class,
1410 $this->
getLanguageService()->sL(
'LLL:EXT:backend/Resources/Private/Language/locallang.xlf:no_modules_registered'),
1414 $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
1416 $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
1417 $defaultFlashMessageQueue->enqueue($flashMessage);
1419 $this->extObj->pObj = $this;
1420 if (is_callable([$this->extObj,
'main'])) {
1421 $this->content .= $this->extObj->main();
1435 $this->content =
'';
1438 $this->content = $savedContent;