aboutsummaryrefslogtreecommitdiff
path: root/lib/helper.php
diff options
context:
space:
mode:
authorMaZderMind2015-11-08 14:40:30 +0100
committerMaZderMind2015-11-08 14:40:30 +0100
commitefe1f83a7cc419df700dfe36ef11da20607d8eae (patch)
tree409bea306e44a8decbb8b5fee127b863e0c5e99f /lib/helper.php
parent4c52028f555c361c232cbee166fa62522c66af5b (diff)
implement mandator handling, supporting different styles per mandantor
Diffstat (limited to '')
-rw-r--r--lib/helper.php24
1 files changed, 22 insertions, 2 deletions
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);
+}