From d409e4fa81165708ffa600ee68715627a7936b14 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sat, 10 Aug 2013 14:20:54 +0200 Subject: [PATCH] Fixed overridden variables being persistent Fixes #1450 --- .../files/lib/acp/form/StyleAddForm.class.php | 3 --- .../files/lib/system/style/StyleCompiler.class.php | 12 ++++++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php b/wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php index d5614cc740..b2043d1a41 100644 --- a/wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/StyleAddForm.class.php @@ -332,9 +332,6 @@ class StyleAddForm extends AbstractForm { 'text' => $matches[1] ); } - else { - $this->variables[$matches[1]] = $matches[2]; - } } else { // not valid diff --git a/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php b/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php index fa5c052a63..25d19ac05d 100644 --- a/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php +++ b/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php @@ -7,6 +7,7 @@ use wcf\system\Callback; use wcf\system\SingletonFactory; use wcf\system\WCF; use wcf\util\FileUtil; +use wcf\util\StringUtil; use wcf\util\StyleUtil; /** @@ -65,6 +66,17 @@ class StyleCompiler extends SingletonFactory { unset($variables['individualLess']); } + // apply overrides + if (isset($variables['overrideLess'])) { + $lines = explode("\n", StringUtil::unifyNewlines($variables['overrideLess'])); + foreach ($lines as $line) { + if (preg_match('~^@([a-zA-Z]+): ?([@a-zA-Z0-9 ,\.\(\)\%\#-]+);$~', $line, $matches)) { + $variables[$matches[1]] = $matches[2]; + } + } + unset($variables['overrideLess']); + } + $this->compileStylesheet( WCF_DIR.'style/style-'.$style->styleID, $files, -- 2.20.1