Code

Fiyes broken login if schema files are not readable.
[gosa.git] / html / index.php
index 0fcd72b632de0294c1b3515e803bfb66abb8ff35..160fd7b5f5d91847d37eed308d8c0616b1e8d838 100644 (file)
@@ -46,7 +46,7 @@ function displayLogin()
 
     /* Displasy SSL mode warning? */
     if ($ssl != "" && $config->data['MAIN']['WARNSSL'] == 'true'){
-      $smarty->assign ("ssl", "<b>"._("Warning").":</b> "._("Session will not be encrypted.")." <a style=\"color:red;\" href=\"$ssl\"><b>"._("Enter SSL session")."</b></a>!");
+      $smarty->assign ("ssl", "<b>"._("Warning").":<\/b> "._("Session will not be encrypted.")." <a style=\"color:red;\" href=\"$ssl\"><b>"._("Enter SSL session")."<\/b></a>!");
     } else {
       $smarty->assign ("ssl", "");
     }
@@ -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();
         }
       }
@@ -328,13 +330,13 @@ $smarty->assign ("message", $message);
 
 /* Displasy SSL mode warning? */
 if ($ssl != "" && $config->data['MAIN']['WARNSSL'] == 'true'){
-  $smarty->assign ("ssl", "<b>"._("Warning").":</b> "._("Session will not be encrypted.")." <a style=\"color:red;\" href=\"$ssl\"><b>"._("Enter SSL session")."</b></a>!");
+  $smarty->assign ("ssl", "<b>"._("Warning").":<\/b> "._("Session will not be encrypted.")." <a style=\"color:red;\" href=\"$ssl\"><b>"._("Enter SSL session")."<\/b></a>!");
 } else {
   $smarty->assign ("ssl", "");
 }
 
 /* Translation of cookie-warning. Whether to display it, is determined by JavaScript */
-$smarty->assign ("cookies", "<b>"._("Warning").":</b> "._("Your browser has cookies disabled. Please enable cookies and reload this page before logging in!"));
+$smarty->assign ("cookies", "<b>"._("Warning").":<\/b> "._("Your browser has cookies disabled. Please enable cookies and reload this page before logging in!"));
 
 
 /* Generate server list */