Code

Multiple edit
[gosa.git] / html / index.php
index 8a569a87408ea7944daa67cfd98e8df4d70790b7..67d3c08267dc230d6dda57a2c48c82c9bef30bc5 100644 (file)
@@ -126,7 +126,7 @@ if(isset($_POST['javascript']) && $_POST['javascript'] == "true") {
 
 /* Check if gosa.conf (.CONFIG_FILE) is accessible */
 if (!is_readable(CONFIG_DIR."/".CONFIG_FILE)){
-  echo sprintf(_("GOsa configuration %s/%s is not readable. Aborted."), CONFIG_DIR,CONFIG_FILE);
+  msg_dialog::display(_("Configuration accessibility"),sprintf(_("GOsa configuration %s/%s is not readable. Aborted."), CONFIG_DIR,CONFIG_FILE),FATAL_ERROR_DIALOG);
   exit();
 }
 
@@ -152,8 +152,8 @@ $smarty->assign ('nextfield', 'username');
 
 /* Check for compile directory */
 if (!(is_dir($smarty->compile_dir) && is_writable($smarty->compile_dir))){
-  echo sprintf(_("Directory '%s' specified as compile directory is not accessible!"),
-      $smarty->compile_dir);
+  msg_dialog::display(_("Smarty"),sprintf(_("Directory '%s' specified as compile directory is not accessible!"),
+    $smarty->compile_dir),FATAL_ERROR_DIALOG);
   exit();
 }
 
@@ -260,7 +260,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['login'])){
 
   /* Check for valid input */
   $username= $_POST["username"];
-  if (!ereg("^[A-Za-z0-9_.-]+$", $username)){
+  if (!ereg("^[@A-Za-z0-9_.-]+$", $username)){
     $message= _("Please specify a valid username!");
   } elseif (mb_strlen($_POST["password"], 'UTF-8') == 0){
     $message= _("Please specify your password!");
@@ -295,12 +295,25 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['login'])){
       /* Restore filter settings from cookie, if available 
        */
       if(isset($config->data['MAIN']['SAVE_FILTER']) && preg_match("/true/",$config->data['MAIN']['SAVE_FILTER'])){
-        $cookie_vars= array("MultiDialogFilters","CurrentMainBase");
-        foreach($cookie_vars as $var){
-          if(isset($_COOKIE[$var])){
-            $_SESSION[$var] = unserialize(base64_decode($_COOKIE[$var]));
-          }elseif(isset($HTTP_COOKIE_VARS[$var])){
-            $_SESSION[$var] = unserialize(base64_decode($HTTP_COOKIE_VARS[$var]));
+
+        if(isset($_COOKIE['GOsa_Filter_Settings']) || isset($HTTP_COOKIE_VARS['GOsa_Filter_Settings'])){
+
+          if(isset($_COOKIE['GOsa_Filter_Settings'])){
+            $cookie_all = unserialize(base64_decode($_COOKIE['GOsa_Filter_Settings']));
+          }else{
+            $cookie_all = unserialize(base64_decode($HTTP_COOKIE_VARS['GOsa_Filter_Settings']));
+          }
+          if(isset($cookie_all[$ui->dn])){
+            $cookie = $cookie_all[$ui->dn];
+            $cookie_vars= array("MultiDialogFilters","CurrentMainBase","plug");
+            foreach($cookie_vars as $var){
+              if(isset($cookie[$var])){
+                $_SESSION[$var] = $cookie[$var];
+              }
+            }
+            if(isset($cookie['plug'])){
+              $plug =$cookie['plug'];
+            }
           }
         }
       }
@@ -326,18 +339,16 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['login'])){
             }
           }
         }
-
-        /* Not account expired or password forced change go to main page */
-        new log("security","login","",array(),"User \"$username\" logged in successfully") ;
-        header ("Location: main.php?global_check=1");
-        exit;
-
-      } else {
-        /* Go to main page */
-        new log("security","login","",array(),"User \"$username\" logged in successfully") ;
+      }
+      /* Not account expired or password forced change go to main page */
+      new log("security","login","",array(),"User \"$username\" logged in successfully") ;
+      $plist= new pluglist($config, $ui);
+      if(isset($plug) && isset($plist->dirlist[$plug])){
+        header ("Location: main.php?plug=".$plug."&global_check=1");
+      }else{
         header ("Location: main.php?global_check=1");
-        exit;
       }
+      exit;
     }
   }
 }