From efe1f83a7cc419df700dfe36ef11da20607d8eae Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Sun, 8 Nov 2015 14:40:30 +0100 Subject: implement mandator handling, supporting different styles per mandantor --- lib/helper.php | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/helper.php b/lib/helper.php index eb9fc6d..0d4d868 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -18,14 +18,14 @@ function baseurl() if(startswith('//', $base)) $base = proto().':'.$base; - return forceslash($base.'/'.$GLOBALS['CLIENT']); + return forceslash(forceslash($base).@$GLOBALS['MANDATOR']); } $base = ssl() ? 'https://' : 'http://'; $base .= $_SERVER['HTTP_HOST']; $base .= forceslash(dirname($_SERVER['SCRIPT_NAME'])); - return forceslash($base.$GLOBALS['CLIENT']); + return forceslash(forceslash($base).@$GLOBALS['MANDATOR']); } function forceslash($url) @@ -41,3 +41,23 @@ function startswith($needle, $haystack) { return substr($haystack, 0, strlen($needle)) == $needle; } + +function handle_lesscss_request($lessfile, $relative_path) +{ + $dir = forceslash(sys_get_temp_dir()); + + $css_file = Less_Cache::Get([ + $lessfile => $relative_path, + ], [ + 'sourceMap' => true, + 'compress' => true, + 'relativeUrls' => true, + + 'cache_dir' => $dir, + ]); + + $css = file_get_contents($dir.$css_file); + header('Content-Type: text/css'); + header('Content-Length: '.strlen($css)); + print($css); +} -- cgit v1.2.3