From: Marcel Werk Date: Thu, 21 Mar 2019 16:32:19 +0000 (+0100) Subject: Allow import of media X-Git-Tag: 5.2.0_Alpha_1~194 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ebcaae9c0d779fe7df703eeff44fb1e54dc39bd2;p=GitHub%2FWoltLab%2FWCF.git Allow import of media Closes #2874 --- diff --git a/wcfsetup/install/files/lib/system/importer/MediaImporter.class.php b/wcfsetup/install/files/lib/system/importer/MediaImporter.class.php index c2ce19def2..bf32652ee8 100644 --- a/wcfsetup/install/files/lib/system/importer/MediaImporter.class.php +++ b/wcfsetup/install/files/lib/system/importer/MediaImporter.class.php @@ -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