[BUGFIX] Import/Export Various Exceptions happening 15/46015/2
authorReinhard Führicht <rf@typoheads.at>
Sat, 16 Jan 2016 11:10:02 +0000 (12:10 +0100)
committerGeorg Ringer <georg.ringer@gmail.com>
Sat, 16 Jan 2016 14:24:29 +0000 (15:24 +0100)
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/46015
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/impexp/Classes/Controller/ImportExportController.php
typo3/sysext/impexp/Resources/Private/Language/locallang.xlf

index 23fbd8f..9c3a21b 100644 (file)
@@ -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');
@@ -829,18 +831,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());
+                    }
                 }
             }
 
index d29ca3b..f4ab7b0 100644 (file)
                                <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>