Update jQuery from 1.12.4 to 3.7.1
[phorkie.git] / www / www-header.php
index 5381eed67a4f01e89b528ad7a47a8630d6031d9d..859d797a094c45486b3edcb07ab3571bbe7ced78 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 namespace phorkie;
-error_reporting(error_reporting() & ~E_STRICT);
+error_reporting(error_reporting() & ~E_STRICT & ~E_DEPRECATED);
 session_set_cookie_params(14 * 86400);//2 weeks session expiry time
 session_start();
 
@@ -50,6 +50,12 @@ if (file_exists($cfgFilePath)) {
 
 if ($GLOBALS['phorkie']['cfg']['baseurl'] === null) {
     $GLOBALS['phorkie']['cfg']['baseurl'] = Tools::detectBaseUrl();
+    if (substr($GLOBALS['phorkie']['cfg']['git']['public'], 0, 9) == '%BASEURL%') {
+        //make autoconfig work
+        $GLOBALS['phorkie']['cfg']['git']['public'] = Tools::fullUrlNoPhar(
+            substr($GLOBALS['phorkie']['cfg']['git']['public'], 9)
+        );
+    }
 }
 
 // Set/Get git commit session variables
@@ -85,7 +91,7 @@ if (!isset($noSecurityCheck) || $noSecurityCheck !== true) {
     require __DIR__ . '/www-security.php';
 }
 
-function render($tplname, $vars = array())
+function render($tplname, $vars = array(), $return = false)
 {
     $vars['baseurl'] = '/';
     if (!empty($GLOBALS['phorkie']['cfg']['baseurl'])) {
@@ -99,6 +105,10 @@ function render($tplname, $vars = array())
         $vars['identity'] = $_SESSION['identity'];
         $vars['name'] = $_SESSION['name'];
         $vars['email'] = $_SESSION['email'];
+    } else if (isset($_COOKIE['lastopenid'])
+        && !isset($_COOKIE['tried-autologin'])
+    ) {
+        $vars['autologin'] = true;
     }
     $vars['db'] = new Database();
     if (!isset($vars['htmlhelper'])) {
@@ -107,8 +117,14 @@ function render($tplname, $vars = array())
     $vars['suggestSetupCheck'] = $GLOBALS['phorkie']['suggestSetupCheck'];
 
     $template = $GLOBALS['twig']->loadTemplate($tplname . '.htm');
-    echo $template->render($vars);
+
+    if ($return) {
+        return $template->render($vars);
+    } else {
+        echo $template->render($vars);
+    }
 }
+
 function redirect($target)
 {
     header('Location: ' . $target);