part of #34: store last openid and pre-fill URL field
[phorkie.git] / www / www-header.php
index c8403152105d86e350f123340af274a4ad2c2f0d..41b5e4731889961080f511e2a5474473ea4bb49e 100644 (file)
@@ -1,8 +1,6 @@
 <?php
 namespace phorkie;
-if (session_id() == "") {
-    session_start();
-}
+session_start();
 
 set_include_path(
     __DIR__ . '/../src/'
@@ -70,8 +68,20 @@ $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) {
+    require __DIR__ . '/www-security.php';
+}
+
 function render($tplname, $vars = array())
 {
     $vars['css'] = $GLOBALS['phorkie']['cfg']['css'];