Fix .htaccess when used with MultiViews
[phorkie.git] / www / www-header.php
index 9aa873240aa2a3dff64a909f1c57b2c50e391f75..cda7047b9b94d01cb4018e0006b9158e5101878b 100644 (file)
@@ -68,6 +68,14 @@ $twig = new \Twig_Environment(
         'debug' => true
     )
 );
+$twig->addFunction('ntext', new \Twig_Function_Function('\phorkie\ntext'));
+function ntext($value, $singular, $plural)
+{
+    if (abs($value) == 1) {
+        return sprintf($singular, $value);
+    }
+    return sprintf($plural, $value);
+}
 //$twig->addExtension(new \Twig_Extension_Debug());
 
 if (!isset($noSecurityCheck) || $noSecurityCheck !== true) {
@@ -76,6 +84,10 @@ if (!isset($noSecurityCheck) || $noSecurityCheck !== true) {
 
 function render($tplname, $vars = array())
 {
+    $vars['baseurl'] = '/';
+    if (!empty($GLOBALS['phorkie']['cfg']['baseurl'])) {
+        $vars['baseurl'] = $GLOBALS['phorkie']['cfg']['baseurl'];
+    }
     $vars['css'] = $GLOBALS['phorkie']['cfg']['css'];
     $vars['title'] = $GLOBALS['phorkie']['cfg']['title'];
     $vars['topbar'] = $GLOBALS['phorkie']['cfg']['topbar'];