www/www-header.php - FIX: non-set _SESSION variables causing 'undefined index' in...
[phorkie.git] / www / www-header.php
index 72a2e670578149cc5ac97d6430bb5390550b4c38..74863e1637f18b011a31ec2609eb38105e0bbea2 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace phorkie;
+session_start();
 set_include_path(
     __DIR__ . '/../src/'
     . PATH_SEPARATOR . get_include_path()
@@ -63,6 +64,11 @@ function render($tplname, $vars)
     $vars['css'] = $GLOBALS['phorkie']['cfg']['css'];
     $vars['title'] = $GLOBALS['phorkie']['cfg']['title'];
     $vars['topbar'] = $GLOBALS['phorkie']['cfg']['topbar'];
+    if (isset($_SESSION['identity'])) {
+        $vars['identity'] = $_SESSION['identity'];
+        $vars['name'] = $_SESSION['name'];
+        $vars['email'] = $_SESSION['email'];
+    }
     $vars['db'] = new Database();
 
     $template = $GLOBALS['twig']->loadTemplate($tplname . '.htm');
@@ -73,4 +79,4 @@ function redirect($target)
     header('Location: ' . $target);
     exit();
 }
-?>
\ No newline at end of file
+?>