[TASK] Remove thumbnail functionality of EXT:impexp 65/45965/2
authorGeorg Ringer <georg.ringer@gmail.com>
Thu, 14 Jan 2016 12:34:32 +0000 (13:34 +0100)
committerMarkus Klein <markus.klein@typo3.org>
Fri, 15 Jan 2016 20:20:19 +0000 (21:20 +0100)
Previously it was possible to add additional thumbnails to
exports of the EXT:impexp. This functionality is completely
outdated and not needed anymore.

Change-Id: I48964b56ecb707f3f47f70efcf080c603702f913
Resolves: #72697
Releases: master, 7.6
Reviewed-on: https://review.typo3.org/45965
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/core/Documentation/Changelog/master/Important-72697-RemoveThumbnailFunctionalityOfImpexp.rst [new file with mode: 0644]
typo3/sysext/impexp/Classes/Controller/ImportExportController.php
typo3/sysext/impexp/Classes/ImportExport.php
typo3/sysext/impexp/Resources/Private/Language/locallang.xlf
typo3/sysext/impexp/Resources/Private/Language/locallang_csh.xlf

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Important-72697-RemoveThumbnailFunctionalityOfImpexp.rst b/typo3/sysext/core/Documentation/Changelog/master/Important-72697-RemoveThumbnailFunctionalityOfImpexp.rst
new file mode 100644 (file)
index 0000000..bd82e8e
--- /dev/null
@@ -0,0 +1,8 @@
+============================================================
+Important: #72697 - Remove thumbnail functionality of impexp
+============================================================
+
+Description
+===========
+
+Previously it was possible to add additional thumbnails to exports of the EXT:impexp. This functionality is completely outdated and not needed anymore.
\ No newline at end of file
index ca9ee95..161325a 100644 (file)
@@ -173,10 +173,6 @@ class ImportExportController extends BaseScriptClass
         switch ((string)$inData['action']) {
             case 'export':
                 $this->shortcutName = $this->lang->getLL('title_export');
-                // Finally: If upload went well, set the new file as the thumbnail in the $inData array:
-                if (!empty($this->uploadedFiles[0])) {
-                    $inData['meta']['thumbnail'] = $this->uploadedFiles[0]->getCombinedIdentifier();
-                }
                 // Call export interface
                 $this->exportData($inData);
                 break;
@@ -362,12 +358,6 @@ class ImportExportController extends BaseScriptClass
             $beUser->user['realName'],
             $beUser->user['email']
         );
-        if ($inData['meta']['thumbnail']) {
-            $theThumb = $this->getFile($inData['meta']['thumbnail']);
-            if ($theThumb !== null && $theThumb->exists()) {
-                $this->export->addThumbnail($theThumb->getForLocalProcessing(false));
-            }
-        }
         // Configure which records to export
         if (is_array($inData['record'])) {
             foreach ($inData['record'] as $ref) {
@@ -929,18 +919,6 @@ class ImportExportController extends BaseScriptClass
                        <tr class="tableheader bgColor5">
                                <td colspan="2">' . $this->lang->getLL('makesavefo_outputOptions', true) . '</td>
                        </tr>';
-        // Meta data:
-        $thumbnailFiles = array();
-        foreach ($this->getThumbnailFiles() as $thumbnailFile) {
-            $thumbnailFiles[$thumbnailFile->getCombinedIdentifier()] = $thumbnailFile->getName();
-        }
-        if (!empty($thumbnailFiles)) {
-            array_unshift($thumbnailFiles, '');
-        }
-        $thumbnail = null;
-        if (!empty($inData['meta']['thumbnail'])) {
-            $thumbnail = $this->getFile($inData['meta']['thumbnail']);
-        }
         $saveFolder = $this->getDefaultImportExportFolder();
 
         $row[] = '
@@ -954,12 +932,7 @@ class ImportExportController extends BaseScriptClass
                                                        <input type="text" name="tx_impexp[meta][description]" value="' . htmlspecialchars($inData['meta']['description']) . '" /><br/>
                                                        ' . $this->lang->getLL('makesavefo_notes', true) . ' <br/>
                                                        <textarea name="tx_impexp[meta][notes]">' . htmlspecialchars($inData['meta']['notes']) . '</textarea><br/>
-                                                       ' . (!empty($thumbnailFiles) ? '
-                                                       ' . $this->lang->getLL('makesavefo_thumbnail', true) . '<br/>
-                                                       ' . $this->renderSelectBox('tx_impexp[meta][thumbnail]', $inData['meta']['thumbnail'], $thumbnailFiles) : '') . '<br/>
-                                                       ' . ($thumbnail ? '<img src="' . htmlspecialchars($thumbnail->getPublicUrl(true)) . '" vspace="5" style="border: solid black 1px;" alt="" /><br/>' : '') . '
-                                                       ' . $this->lang->getLL('makesavefo_uploadThumbnail', true) . '<br/>
-                                                       ' . ($saveFolder ? '<input type="file" name="upload_1"  size="30" /><br/>
+                                                       ' . ($saveFolder ? '
                                                                <input type="hidden" name="file[upload][1][target]" value="' . htmlspecialchars($saveFolder->getCombinedIdentifier()) . '" />
                                                                <input type="hidden" name="file[upload][1][data]" value="1" /><br />' : '') . '
                                                </td>
@@ -1258,29 +1231,6 @@ class ImportExportController extends BaseScriptClass
                                                ' . $this->lang->getLL('importdata_email', true) . ' '
                         . $import->dat['header']['meta']['packager_email'] . '</td>
                                        </tr>';
-                // Thumbnail icon:
-                if (is_array($import->dat['header']['thumbnail'])) {
-                    $pI = pathinfo($import->dat['header']['thumbnail']['filename']);
-                    $extension = strtolower($pI['extension']);
-                    if ($extension === 'jpg' || $extension === 'jpeg' || $extension === 'gif' || $extension === 'png') {
-                        // Construct filename and write it:
-                        $fileName = PATH_site . 'typo3temp/importthumb.' . $pI['extension'];
-                        GeneralUtility::writeFile($fileName, $import->dat['header']['thumbnail']['content']);
-                        // Check that the image really is an image and not a malicious PHP script...
-                        if (getimagesize($fileName)) {
-                            // Create icon tag:
-                            $iconTag = '<img src="../' . PathUtility::stripPathSitePrefix($fileName)
-                                . '" ' . $import->dat['header']['thumbnail']['imgInfo'][3]
-                                . ' vspace="5" style="border: solid black 1px;" alt="" />';
-                            $trow[] = '<tr class="bgColor4">
-                                                               <td><strong>' . $this->lang->getLL('importdata_icon', true) . '</strong></td>
-                                                               <td>' . $iconTag . '</td>
-                                                               </tr>';
-                        } else {
-                            GeneralUtility::unlink_tempfile($fileName);
-                        }
-                    }
-                }
                 $menuItems[] = array(
                     'label' => $this->lang->getLL('importdata_metaData_1387'),
                     'content' => '
@@ -1517,30 +1467,6 @@ class ImportExportController extends BaseScriptClass
     }
 
     /**
-     * Gets thumbnail files.
-     *
-     * @throws \InvalidArgumentException
-     * @return array|\TYPO3\CMS\Core\Resource\File[]
-     */
-    protected function getThumbnailFiles()
-    {
-        $thumbnailFiles = array();
-        $defaultTemporaryFolder = $this->getDefaultImportExportFolder();
-
-        if ($defaultTemporaryFolder === null) {
-            return $thumbnailFiles;
-        }
-
-        /** @var $filter FileExtensionFilter */
-        $filter = GeneralUtility::makeInstance(FileExtensionFilter::class);
-        $filter->setAllowedFileExtensions(array('png', 'gif', 'jpg'));
-        $defaultTemporaryFolder->getStorage()->addFileAndFolderNameFilter(array($filter, 'filterFileList'));
-        $thumbnailFiles = $defaultTemporaryFolder->getFiles();
-
-        return $thumbnailFiles;
-    }
-
-    /**
      * Gets all export files.
      *
      * @throws \InvalidArgumentException
index 1e4fc9b..bca0581 100644 (file)
@@ -562,29 +562,6 @@ class ImportExport
         $this->saveFilesOutsideExportFile = $saveFilesOutsideExportFile;
     }
 
-    /**
-     * Sets a thumbnail image to the exported file
-     *
-     * @param string $imgFilepath Filename reference, gif, jpg, png. Absolute path.
-     * @return void
-     */
-    public function addThumbnail($imgFilepath)
-    {
-        if (@is_file($imgFilepath)) {
-            $imgInfo = @getimagesize($imgFilepath);
-            if (is_array($imgInfo)) {
-                $fileContent = GeneralUtility::getUrl($imgFilepath);
-                $this->dat['header']['thumbnail'] = array(
-                    'imgInfo' => $imgInfo,
-                    'content' => $fileContent,
-                    'filesize' => strlen($fileContent),
-                    'filemtime' => filemtime($imgFilepath),
-                    'filename' => PathUtility::basename($imgFilepath)
-                );
-            }
-        }
-    }
-
     /**************************
      * Export / Init Page tree
      *************************/
index e53fd86..d29ca3b 100644 (file)
                        <trans-unit id="makesavefo_notes">
                                <source>Notes:</source>
                        </trans-unit>
-                       <trans-unit id="makesavefo_thumbnail">
-                               <source>Thumbnail:</source>
-                       </trans-unit>
-                       <trans-unit id="makesavefo_uploadThumbnail">
-                               <source>Upload thumbnail:</source>
-                       </trans-unit>
                        <trans-unit id="makesavefo_t3dFileCompressed">
                                <source>T3D file / compressed</source>
                        </trans-unit>
index c6b0f05..26b5ba6 100644 (file)
@@ -243,8 +243,7 @@ Presets from the task center.</source>
                        <trans-unit id="metadata.details" xml:space="preserve">
                                <source>The meta data will help users of your exported files to know what they can expect to be inside and what things they should be aware of and take into account during import.
 The "Title" and "Description" should contain the basic information about the export.
-The "Notes" field can be used for additional details, especially remarks about intensions or requirements that apply.
-The thumbnail field is used for thumbnails if you need that for your export. This is very useful when export files are used as page templates where the template selector can take advantage of the thumbnail. The format should be a web-format like jpg, gif or png and the dimensions should fit exactly the final display dimensions intended; so don't upload very large images!</source>
+The "Notes" field can be used for additional details, especially remarks about intensions or requirements that apply.</source>
                        </trans-unit>
                        <trans-unit id="_metadata.image">
                                <source>EXT:impexp/Resources/Public/Images/cshimages/metadata.png</source>