Allow relative paths in style variables
authorMatthias Schmidt <gravatronics@live.com>
Fri, 15 Aug 2014 10:50:10 +0000 (12:50 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Fri, 15 Aug 2014 10:50:10 +0000 (12:50 +0200)
wcfsetup/install/files/lib/data/style/ActiveStyle.class.php
wcfsetup/install/files/lib/system/style/StyleCompiler.class.php

index 1feb82055d50a7779cc9accd6675bc0075fafba2..9dadc58fbba333ff8e89031dba4a2ba0c6a3697e 100644 (file)
@@ -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);
        }
        
        /**
index 0958c474467baff6f1c1b8c32fde662b0839e788..6e1f97f5a88f2e13a2c960b7fe064726dd4f6550 100644 (file)
@@ -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) {