Allow import of media
authorMarcel Werk <burntime@woltlab.com>
Thu, 21 Mar 2019 16:32:19 +0000 (17:32 +0100)
committerMarcel Werk <burntime@woltlab.com>
Thu, 21 Mar 2019 16:32:19 +0000 (17:32 +0100)
Closes #2874

wcfsetup/install/files/lib/system/importer/MediaImporter.class.php

index c2ce19def26ac59a1b71bb5dc604097ed72f6f35..bf32652ee86def4aee635a7a301acbb3b76832ab 100644 (file)
@@ -34,25 +34,27 @@ class MediaImporter extends AbstractImporter {
                $data['userID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['userID']);
                
                $contents = [];
-               foreach ($additionalData['contents'] as $languageCode => $contentData) {
-                       $languageID = 0;
-                       if (!$languageCode) {
-                               if (($language = LanguageFactory::getInstance()->getLanguageByCode($languageCode)) !== null) {
-                                       $languageID = $language->languageID;
-                               }
-                               else {
-                                       continue;
+               if (!empty($additionalData['contents'])) {
+                       foreach ($additionalData['contents'] as $languageCode => $contentData) {
+                               $languageID = 0;
+                               if (!$languageCode) {
+                                       if (($language = LanguageFactory::getInstance()->getLanguageByCode($languageCode)) !== null) {
+                                               $languageID = $language->languageID;
+                                       }
+                                       else {
+                                               continue;
+                                       }
                                }
+                               
+                               $contents[$languageID] = [
+                                       'title' => (!empty($contentData['title']) ? $contentData['title'] : ''),
+                                       'caption' => (!empty($contentData['caption']) ? $contentData['caption'] : ''),
+                                       'altText' => (!empty($contentData['altText']) ? $contentData['altText'] : '')
+                               ];
+                       }
+                       if (count($contents) > 1) {
+                               $data['isMultilingual'] = 1;
                        }
-                       
-                       $contents[$languageID] = [
-                               'title' => (!empty($contentData['title']) ? $contentData['title'] : ''),
-                               'caption' => (!empty($contentData['caption']) ? $contentData['caption'] : ''),
-                               'altText' => (!empty($contentData['altText']) ? $contentData['altText'] : '')
-                       ];
-               }
-               if (count($contents) > 1) {
-                       $data['isMultilingual'] = 1;
                }
                
                // handle language