From: Alexander Ebert Date: Mon, 29 Oct 2012 00:53:29 +0000 (+0100) Subject: Fix handling of empty LESS variable values X-Git-Tag: 2.0.0_Beta_1~832 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=160bfe444f688925d2b6f6c2bddcbda08dad68d6;p=GitHub%2FWoltLab%2FWCF.git Fix handling of empty LESS variable values --- diff --git a/wcfsetup/install/files/lib/data/style/Style.class.php b/wcfsetup/install/files/lib/data/style/Style.class.php index bb38bd4161..0d256e7ddd 100644 --- a/wcfsetup/install/files/lib/data/style/Style.class.php +++ b/wcfsetup/install/files/lib/data/style/Style.class.php @@ -84,7 +84,12 @@ class Style extends DatabaseObject { $statement->execute(array($this->styleID)); while ($row = $statement->fetchArray()) { $variableName = $row['variableName']; - $this->variables[$variableName] = (isset($row['variableValue'])) ? $row['variableValue'] : $row['defaultValue']; + $variableValue = (isset($row['variableValue'])) ? $row['variableValue'] : $row['defaultValue']; + if (empty($variableValue)) { + $variableValue = '~""'; + } + + $this->variables[$variableName] = $variableValue; // provide an empty value for LESS-compiler if (empty($this->variables[$variableName])) { diff --git a/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php b/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php index 40812b2429..88bdb3a671 100644 --- a/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php +++ b/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php @@ -95,7 +95,12 @@ class StyleCompiler extends SingletonFactory { $statement->execute(); $variables = array(); while ($row = $statement->fetchArray()) { - $variables[$row['variableName']] = $row['defaultValue']; + $value = $row['defaultValue']; + if (empty($value)) { + $value = '~""'; + } + + $variables[$row['variableName']] = $value; } $this->compileStylesheet( diff --git a/wcfsetup/setup/db/install.sql b/wcfsetup/setup/db/install.sql index 805c98f0db..259a24a0ac 100644 --- a/wcfsetup/setup/db/install.sql +++ b/wcfsetup/setup/db/install.sql @@ -1019,6 +1019,6 @@ INSERT INTO wcf1_style_variable (variableName, defaultValue) VALUES ('wcfMainMen INSERT INTO wcf1_style_variable (variableName, defaultValue) VALUES ('wcfUserPanelHoverBackgroundColor', 'rgba(60, 60, 60, 1)'); INSERT INTO wcf1_style_variable (variableName, defaultValue) VALUES ('wcfMarkedBackgroundColor', 'rgba(255, 255, 200, 1)'); INSERT INTO wcf1_style_variable (variableName, defaultValue) VALUES ('useFluidLayout', '1'); -INSERT INTO wcf1_style_variable (variableName, defaultValue) VALUES ('pageLogo', '~""'); -INSERT INTO wcf1_style_variable (variableName, defaultValue) VALUES ('individualLess', '~""'); -INSERT INTO wcf1_style_variable (variableName, defaultValue) VALUES ('overrideLess', '~""'); +INSERT INTO wcf1_style_variable (variableName, defaultValue) VALUES ('pageLogo', ''); +INSERT INTO wcf1_style_variable (variableName, defaultValue) VALUES ('individualLess', ''); +INSERT INTO wcf1_style_variable (variableName, defaultValue) VALUES ('overrideLess', '');