Work-around for LESS-Stylesheets
authorAlexander Ebert <ebert@woltlab.com>
Tue, 13 Mar 2012 15:20:23 +0000 (16:20 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 13 Mar 2012 15:20:23 +0000 (16:20 +0100)
wcfsetup/install/files/lib/acp/page/LessStylesheetsPage.class.php
wcfsetup/install/files/lib/page/LessStylesheetsPage.class.php

index 33ee166077925baeaf635f57e3fb623faabe94bd..399660af0272399f8c53549222f145def73eeaae 100644 (file)
@@ -1,21 +1,4 @@
 <?php
 namespace wcf\acp\page;
-use wcf\page\AbstractPage;
 
-class LessStylesheetsPage extends AbstractPage {
-       public function show() {
-               if (defined('LESS_FILES') && LESS_FILES) {
-                       @header('Content-Type: text/css');
-                       
-                       foreach (explode("\n", LESS_FILES) as $stylesheet) {
-                               $path = WCF_DIR . 'style/'.$stylesheet.'.less';
-                               if (!file_exists($path)) {
-                                       echo "\n\nFILE NOT FOUND: ".$path."\n\n\n";
-                               }
-                               else {
-                                       readfile($path);
-                               }
-                       }
-               }
-       }
-}
\ No newline at end of file
+class LessStylesheetsPage extends \wcf\page\LessStylesheetsPage { }
index cc247728d1ed9ff3fd28a77401cf72c7fbfe11e9..f0dec89d985228449dae0df94923adff1e92b4b9 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace wcf\page;
+use wcf\system\application\ApplicationHandler;
 
 class LessStylesheetsPage extends AbstractPage {
        public function show() {
@@ -12,9 +13,17 @@ class LessStylesheetsPage extends AbstractPage {
                                        echo "\n\nFILE NOT FOUND: ".$path."\n\n\n";
                                }
                                else {
-                                       readfile($path);
+                                       $content = file_get_contents($path);
+                                       
+                                       // use absolute path for url()
+                                       $application = ApplicationHandler::getInstance()->getApplication('wcf');
+                                       $absolutePath = $application->domainName . $application->domainPath;
+                                       
+                                       preg_replace('~url\(\'..\/~', 'url(\''.$absolutePath, $content);
+                                       
+                                       echo $content;
                                }
                        }
                }
        }
-}
\ No newline at end of file
+}