Duplicate logo on import of pageLogo = pageLogoMobile
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 4 Aug 2020 14:57:48 +0000 (16:57 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 4 Aug 2020 14:57:48 +0000 (16:57 +0200)
Fixes #3478

wcfsetup/install/files/lib/data/style/StyleEditor.class.php

index 166aeaa17c5fff99e8b88d92c3653cf71ed1ddc8..7158e8781f3cfdce2849d8d7f0459f155d8f8668 100644 (file)
@@ -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);
                                        }