From 35e3a1340511263c6f99410a8d6595d407059f3c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 4 Aug 2020 16:57:48 +0200 Subject: [PATCH] Duplicate logo on import of pageLogo = pageLogoMobile Fixes #3478 --- .../files/lib/data/style/StyleEditor.class.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/wcfsetup/install/files/lib/data/style/StyleEditor.class.php b/wcfsetup/install/files/lib/data/style/StyleEditor.class.php index 166aeaa17c..7158e8781f 100644 --- a/wcfsetup/install/files/lib/data/style/StyleEditor.class.php +++ b/wcfsetup/install/files/lib/data/style/StyleEditor.class.php @@ -512,6 +512,13 @@ class StyleEditor extends DatabaseObjectEditor implements IEditableCachedObject } } + $duplicateLogo = false; + // duplicate logo if logo matches mobile logo + if (!empty($styleData['variables']['pageLogo']) && !empty($styleData['variables']['pageLogoMobile']) && $styleData['variables']['pageLogo'] == $styleData['variables']['pageLogoMobile']) { + $styleData['variables']['pageLogoMobile'] = 'm-'.basename($styleData['variables']['pageLogo']); + $duplicateLogo = true; + } + // save style if ($style === null) { $styleData['packageID'] = $packageID; @@ -584,6 +591,11 @@ class StyleEditor extends DatabaseObjectEditor implements IEditableCachedObject continue; } + // duplicate pageLogo for mobile version + if ($duplicateLogo && $val['filename'] == $styleData['variables']['pageLogo']) { + $imagesTar->extract($key, $style->getAssetPath().'m-'.basename($targetFile)); + } + $imagesTar->extract($key, $targetFile); FileUtil::makeWritable($targetFile); } -- 2.20.1