From 2c47fd2c96827f2d200e4606c13ff4d0d2fd0baa Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Fri, 15 Aug 2014 12:50:10 +0200 Subject: [PATCH] Allow relative paths in style variables --- .../install/files/lib/data/style/ActiveStyle.class.php | 5 +++-- .../install/files/lib/system/style/StyleCompiler.class.php | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/lib/data/style/ActiveStyle.class.php b/wcfsetup/install/files/lib/data/style/ActiveStyle.class.php index 1feb82055d..9dadc58fbb 100644 --- a/wcfsetup/install/files/lib/data/style/ActiveStyle.class.php +++ b/wcfsetup/install/files/lib/data/style/ActiveStyle.class.php @@ -2,6 +2,7 @@ namespace wcf\data\style; use wcf\data\DatabaseObjectDecorator; use wcf\system\WCF; +use wcf\util\FileUtil; /** * Represents the active user style. @@ -31,10 +32,10 @@ class ActiveStyle extends DatabaseObjectDecorator { } if ($this->imagePath && file_exists(WCF_DIR.$this->imagePath.$image)) { - return WCF::getPath().$this->imagePath.$image; + return FileUtil::getRealPath(WCF::getPath().$this->imagePath.$image); } - return WCF::getPath().'images/'.$image; + return FileUtil::getRealPath(WCF::getPath().'images/'.$image); } /** diff --git a/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php b/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php index 0958c47446..6e1f97f5a8 100644 --- a/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php +++ b/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php @@ -191,6 +191,13 @@ class StyleCompiler extends SingletonFactory { * @param \wcf\system\Callback $callback */ protected function compileStylesheet($filename, array $files, array $variables, $individualLess, Callback $callback) { + foreach ($variables as &$value) { + if (StringUtil::startsWith($value, '../')) { + $value = '~"'.$value.'"'; + } + } + unset($value); + // add options as LESS variables if (PACKAGE_ID) { foreach (Option::getOptions() as $constantName => $option) { -- 2.20.1