Lead users to setup check page when no config file given
authorChristian Weiske <christian.weiske@netresearch.de>
Fri, 4 Jul 2014 09:11:53 +0000 (11:11 +0200)
committerChristian Weiske <christian.weiske@netresearch.de>
Fri, 4 Jul 2014 09:11:53 +0000 (11:11 +0200)
data/templates/base.htm
www/www-header.php

index 90ccc0a..86c79e6 100644 (file)
   <div class="container">
    <div class="row">
     <div class="span9">
   <div class="container">
    <div class="row">
     <div class="span9">
+     {% if suggestSetupCheck %}
+     <div class="alert alert-error">
+       It seems phorkie is not setup properly.
+       Visit the <a href="setup">setup check page</a> for more information.
+     </div>
+     {% endif %}
      {% block content %}{% endblock %}
     </div>
     <div class="span3">
      {% block content %}{% endblock %}
     </div>
     <div class="span3">
index 3fa4e0e..5381eed 100644 (file)
@@ -40,9 +40,12 @@ if ($pharFile == '') {
     $cfgFilePath = substr($pharFile, 7) . '.config.php';
 }
 $GLOBALS['phorkie']['cfgfiles'][$cfgFilePath] = false;
     $cfgFilePath = substr($pharFile, 7) . '.config.php';
 }
 $GLOBALS['phorkie']['cfgfiles'][$cfgFilePath] = false;
+$GLOBALS['phorkie']['suggestSetupCheck'] = false;
 if (file_exists($cfgFilePath)) {
     $GLOBALS['phorkie']['cfgfiles'][$cfgFilePath] = true;
     require_once $cfgFilePath;
 if (file_exists($cfgFilePath)) {
     $GLOBALS['phorkie']['cfgfiles'][$cfgFilePath] = true;
     require_once $cfgFilePath;
+} else if ($GLOBALS['phorkie']['cfg']['setupcheck']) {
+    $GLOBALS['phorkie']['suggestSetupCheck'] = true;
 }
 
 if ($GLOBALS['phorkie']['cfg']['baseurl'] === null) {
 }
 
 if ($GLOBALS['phorkie']['cfg']['baseurl'] === null) {
@@ -101,6 +104,7 @@ function render($tplname, $vars = array())
     if (!isset($vars['htmlhelper'])) {
         $vars['htmlhelper'] = new HtmlHelper();
     }
     if (!isset($vars['htmlhelper'])) {
         $vars['htmlhelper'] = new HtmlHelper();
     }
+    $vars['suggestSetupCheck'] = $GLOBALS['phorkie']['suggestSetupCheck'];
 
     $template = $GLOBALS['twig']->loadTemplate($tplname . '.htm');
     echo $template->render($vars);
 
     $template = $GLOBALS['twig']->loadTemplate($tplname . '.htm');
     echo $template->render($vars);