From d0faaf3753731bfeeaff541e98ca13e1e9611d0a Mon Sep 17 00:00:00 2001 From: mrdrogdrog <tilman.vatteroth@udo.edu> Date: Tue, 6 Oct 2015 11:12:54 +0200 Subject: [PATCH] Less-Compiler findet jetzt selber den Pfad anstatt ihn aus einer config.php auszulesen. (wenig getestet :s) --- .htaccess | 2 +- config/config.php | 3 --- less/style.php | 16 ++++++++++++---- 3 files changed, 13 insertions(+), 8 deletions(-) delete mode 100644 config/config.php diff --git a/.htaccess b/.htaccess index 83f9f9c..f15fcb7 100644 --- a/.htaccess +++ b/.htaccess @@ -4,4 +4,4 @@ </IfModule> RewriteEngine on -RewriteRule ^(.*).less$ less/style.php?name=$1.less +RewriteRule ^(.*).less$ less/style.php?name=$1.less \ No newline at end of file diff --git a/config/config.php b/config/config.php deleted file mode 100644 index 163f2a6..0000000 --- a/config/config.php +++ /dev/null @@ -1,3 +0,0 @@ -<?php -const ROOT_DIR="/infoscreen"; -?> diff --git a/less/style.php b/less/style.php index ca41f72..63e3d4b 100644 --- a/less/style.php +++ b/less/style.php @@ -12,9 +12,17 @@ if (!isset($_GET["name"])) { $less_file = $_GET["name"]; //"panels/departure/style.less"; $debug=isset($_GET["debug"]); -include "config/config.php"; -echo ROOT_DIR; - +/*find root dir*/ +$url_arr = explode("/",$_SERVER["PHP_SELF"]); +$url_arr_size = sizeof($url_arr); +$ROOT_DIR = ""; +for ($i=1;$i<($url_arr_size-2);$i++) +{ + $ROOT_DIR.="/".$url_arr[$i]; +} +if ($debug) + echo $ROOT_DIR; +/*end finding*/ $panel = null; @@ -73,6 +81,6 @@ if ($debug) { else echo $content; } else { - header("Location: ".ROOT_DIR."/$cache_file"); + header("Location: ".$ROOT_DIR."/$cache_file"); } -- GitLab