Code

Fiyes broken login if schema files are not readable.
[gosa.git] / html / index.php
index 18c9bed5bbc1f9d60c74875c5626caf69f31ffd4..160fd7b5f5d91847d37eed308d8c0616b1e8d838 100644 (file)
@@ -80,11 +80,15 @@ function displayLogin()
     exit();
 }
 
+session_start();
 
+/* Destroy old session if exists.
+    Else you will get your old session back, if you not logged out correctly. */
+if(is_array($_SESSION) && count($_SESSION)){
+  session_destroy();
+  session_start();
+}
 
-/* Set error handler to own one, initialize time calculation
-   and start session. */
-session_start ();
 $username= "";
 
 /* Reset errors */
@@ -213,8 +217,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['login'])){
     require_once("functions_setup.inc");
     if(!is_schema_readable($config->current['SERVER'],$config->current['ADMIN'],$config->current['PASSWORD'])){
       print_red(_("GOsa cannot retrieve information about the installed schema files. Please make sure, that this is possible."));
-      $smarty->display(get_template_path('headers.tpl'));
-      echo "<body>".$_SESSION['errors']."</body></html>";
+      displayLogin();
       exit();
     }else{
       $str = (schema_check($config->current['SERVER'],$config->current['ADMIN'],$config->current['PASSWORD'],0,TRUE));
@@ -222,8 +225,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['login'])){
       foreach($str as $tr){
         if(isset($tr['needonstartup'])){
           print_red($tr['msg']."<br>"._("Your ldap setup contains old schema definitions. Please re-run the setup."));
-          $smarty->display(get_template_path('headers.tpl'));
-          echo "<body>".$_SESSION['errors']."</body></html>";
+          displayLogin();
           exit();
         }
       }