From 4e1f8018775411afc7e90733e570c4195ce1cada Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reinhard=20F=C3=BChricht?= <rf@typoheads.at> Date: Sat, 16 Jan 2016 12:10:02 +0100 Subject: [PATCH] [BUGFIX] Import/Export Various Exceptions happening Fixed exception shown when 1) uploading an existing file without "Overwrite" setting activated 2) opening export module as a non-admin 3) opening import module as a non-admin without permission to access an available file storage Also improved error message for missing default file upload folder. Resolves: #72765 Releases: master Change-Id: Id1133d1a8adc6c28088ef85730fe01145b4fa3a2 Reviewed-on: https://review.typo3.org/45998 Reviewed-by: Martin Kutschker <martin.kutschker@ymail.com> Tested-by: Martin Kutschker <martin.kutschker@ymail.com> Reviewed-by: Georg Ringer <georg.ringer@gmail.com> Tested-by: Georg Ringer <georg.ringer@gmail.com> --- .../Controller/ImportExportController.php | 16 ++++++++++++---- .../Resources/Private/Language/locallang.xlf | 5 ++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/typo3/sysext/impexp/Classes/Controller/ImportExportController.php b/typo3/sysext/impexp/Classes/Controller/ImportExportController.php index 4cedcaec8596..b9c08611eda2 100644 --- a/typo3/sysext/impexp/Classes/Controller/ImportExportController.php +++ b/typo3/sysext/impexp/Classes/Controller/ImportExportController.php @@ -172,7 +172,9 @@ class ImportExportController extends BaseScriptClass $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class); $this->doc->bodyTagId = 'imp-exp-mod'; $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause); - $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo); + if(is_array($this->pageinfo)) { + $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo); + } // Setting up the context sensitive menu: $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu'); $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Impexp/ImportExport'); @@ -817,18 +819,24 @@ class ImportExportController extends BaseScriptClass $this->standaloneView->assign('inData', $inData); $this->standaloneView->assign('fileSelectOptions', $selectOptions); - $this->standaloneView->assign('importPath', sprintf($this->lang->getLL('importdata_fromPathS', true), $path ? $path->getCombinedIdentifier() : $this->lang->getLL('importdata_no_accessible_file_mount', true))); + if ($path) { + $this->standaloneView->assign('importPath', sprintf($this->lang->getLL('importdata_fromPathS', true), $path->getCombinedIdentifier())); + } else { + $this->standaloneView->assign('importPath', $this->lang->getLL('importdata_no_default_upload_folder', true)); + } $this->standaloneView->assign('isAdmin', $beUser->isAdmin()); // Upload file: $tempFolder = $this->getDefaultImportExportFolder(); - $this->standaloneView->assign('tempFolder', $tempFolder->getCombinedIdentifier()); if ($tempFolder) { + $this->standaloneView->assign('tempFolder', $tempFolder->getCombinedIdentifier()); $this->standaloneView->assign('hasTempUploadFolder', true); if (GeneralUtility::_POST('_upload')) { $this->standaloneView->assign('submitted', GeneralUtility::_POST('_upload')); $this->standaloneView->assign('noFileUploaded', $this->fileProcessor->internalUploadMap[1]); - $this->standaloneView->assign('uploadedFile', $this->uploadedFiles[0]->getName()); + if($this->uploadedFiles[0]) { + $this->standaloneView->assign('uploadedFile', $this->uploadedFiles[0]->getName()); + } } } diff --git a/typo3/sysext/impexp/Resources/Private/Language/locallang.xlf b/typo3/sysext/impexp/Resources/Private/Language/locallang.xlf index d29ca3b7b3f5..f4ab7b0f3e20 100644 --- a/typo3/sysext/impexp/Resources/Private/Language/locallang.xlf +++ b/typo3/sysext/impexp/Resources/Private/Language/locallang.xlf @@ -331,7 +331,10 @@ <source>Structure has been imported, here is the result:</source> </trans-unit> <trans-unit id="importdata_no_accessible_file_mount"> - <source>No accessible file_mount</source> + <source>No accessible filemount</source> + </trans-unit> + <trans-unit id="importdata_no_default_upload_folder"> + <source>No default upload folder</source> </trans-unit> <trans-unit id="filterpage_structureToBeImported"> <source>Structure to be imported:</source> -- GitLab