Code

Backport from trunk
[gosa.git] / gosa-plugins / goto / personal / environment / class_environment.inc
index b6ccc948efff0083a34865c1e23a60d3e1c5d8e5..9c7fccefae5762a32e3b32960a267f8b11d09f4a 100644 (file)
@@ -2,10 +2,12 @@
 
 class environment extends plugin
 {
+  var $plIcon = "plugins/goto/images/plugin.png";
+
   /* attribute list for save action */
   var $ignore_account       = FALSE;
-  var $plHeadline           = "Environment";
-  var $plDescription        = "This does something";
+  var $plHeadline           = "Desktop";
+  var $plDescription        = "Manage desktop settings";
   var $dialog               = false;    // Indicates that we are currently editing in an seperate dialog
   
   var $in_dialog            = false;
@@ -13,7 +15,7 @@ class environment extends plugin
 
   var $is_group             = false;
   var $view_logged = FALSE;
-  
+
   /* Attribute definition
    */
 
@@ -62,13 +64,13 @@ class environment extends plugin
   /* general settings */
   // Sets the attributes which will kept on page reload, which will be saved, ...
 
-  var $CopyPasteVars      = array("gotoHotplugDevices","gotoAvailableShares","gotoShareSelections","gotoPrinterSel","gotoProfileFlagL","gotoXResolutions","gotoProfileFlagC","gotoProfileServers","useProfile","is_group","in_dialog","OrigCn","gotoKioskProfile_Server","gotoKioskProfile_Profile");
+  var $CopyPasteVars      = array("gotoHotplugDevices","gotoAvailableShares","gotoShareSelections","gotoPrinterSel","gotoProfileFlagL","gotoXResolutions","gotoProfileFlagC","gotoProfileServers","useProfile","is_group","in_dialog","OrigCn","gotoKioskProfile_Server","gotoKioskProfile_Profile", "gotoLogonScripts","gotoLogonScript","gotoShare","gotoShares");
 
   var $attributes         = array("uid","gotoProfileServer","gotoProfileFlags","gotoHotplugDeviceDN",
       "gotoXResolution","gotoProfileQuota",
-      "gotoLogonScripts","gotoLogonScript",
+      "gotoLogonScript","gotoLogonScripts","gotoHotplugDevices",
       "gotoPrinter", "gosaDefaultPrinter",
-      "gotoShares","gotoShare",
+      "gotoShare",
       "gotoKioskProfile");
   var $objectclasses      = array("gotoEnvironment"); // Specifies the objectClass which contains the attributes edited here 
   var $cn;
@@ -78,6 +80,8 @@ class environment extends plugin
   var $multiple_support =TRUE;
 
   var $use_gotoPrinter;
+  var $shareList = NULL;
+
 
   function environment (&$config, $dn= NULL)
   {
@@ -145,7 +149,7 @@ class environment extends plugin
       unset($this->attrs['gotoLogonScript']['count']);
       foreach($this->attrs['gotoLogonScript'] as $device){
         $tmp = $tmp2 = array();
-        $tmp = split("\|",$device);
+        $tmp = explode("|",$device);
         $tmp2['LogonName']        = $tmp[0]; 
         $tmp2['LogonPriority']    = $tmp[2]; 
         if(preg_match("/O/i",$tmp[1])){
@@ -169,7 +173,7 @@ class environment extends plugin
       unset($this->attrs['gotoShare']['count']);
       foreach($this->attrs['gotoShare'] as $share){
         $tmp = $tmp2 = array();
-        $tmp = split("\|",$share);
+        $tmp = explode("|",$share);
         $tmp2['server']      =$tmp[0];
         $tmp2['name']        =$tmp[1];
 
@@ -215,12 +219,12 @@ class environment extends plugin
                                     "1280x768"  =>  "1280x768",
                                     "1280x1024" =>  "1280x1024");
 
-    if(isset($this->config->data['MAIN']['RESOLUTION_HOOK'])){
-      $file = $this->config->data['MAIN']['RESOLUTION_HOOK'];
+    if($this->config->get_cfg_value("environment","resolutions") != ""){
+      $file = $this->config->get_cfg_value("environment","resolutions");
 
       if(is_readable($file)){
         $str = file_get_contents($file);
-        $lines = split("\n",$str);
+        $lines = preg_split("/\n/",$str);
         foreach($lines as $line){
           $line = trim($line);
           if(!empty($line)){
@@ -236,52 +240,89 @@ class environment extends plugin
     $this->gotoProfileServers= $config->getShareServerList() ;
     $this->gotoShareSelections= $config->getShareList(true);
     $this->gotoAvailableShares= $config->getShareList(false);  
+  
+    /* Ensure that a currently selected server will stay selected, even if the list of profile servers
+        is empty due to insufficient permissions.
+     */
+    if(count($this->gotoProfileServers) && !empty($this->gotoProfileServer)){
 
+      /* The currently selected profile server is outdated/no longer available */
+      if(!isset($this->gotoProfileServers[$this->gotoProfileServer])){
+
+      }else{
+        $c = $this->gotoProfileServers[$this->gotoProfileServer];
+        if(!preg_match("/r/",$c['ACL'])){
+
+          /* We are not allowed to read to currently selected server.
+             But to ensure that the selection will be kept after saving the account, we 
+              override the current ACL tag.
+           */          
+          $this->gotoProfileServers[$this->gotoProfileServer]['ACL'] .= "r";
+        }
+      }
+    }
     $this->update_kiosk_profiles();
+
+    // Prepare lists
+    $this->shareList = new sortableListing();
+    $this->shareList->setDeleteable(false);
+    $this->shareList->setEditable(false);
+    $this->shareList->setWidth("100%");
+    $this->shareList->setHeight("120px");
+    $this->shareList->setHeader(array(_("Server"),_("Share name"),_("Mount point"), 
+            _("User"), _("Type"), _("Action")));
+    $this->shareList->setDefaultSortColumn(1);
   }
 
 
   function update_kiosk_profiles()
   { 
+    $this->gotoKioskProfile_Server = preg_replace("/^.*:\/\/([^\/]*).*$/","\\1",$this->gotoKioskProfile);
+    $this->gotoKioskProfile_Profile= preg_replace("/^.*\//","",$this->gotoKioskProfile);
+
     $tmp1  = array("none" => array(_("disabled")));
     $tmp2  = array("none" => _("disabled"));
+    $tmp3  = array();
     $ldap = $this->config->get_ldap_link();
     $ldap->cd($this->config->current['BASE']);
     $ldap->search("(&(objectClass=goEnvironmentServer)(gotoKioskProfile=*)(cn=*))",array("cn","gotoKioskProfile"));
     $cnt = 0;
+    $ui = get_userinfo();
     while($attrs = $ldap->fetch()){
+      $acl = $ui->get_permissions($attrs['dn'],"server/goKioskService","");
       for($i = 0 ; $i < $attrs['gotoKioskProfile']['count'] ; $i ++){
-        $name = preg_replace("/^.*\//","",$attrs['gotoKioskProfile'][$i]);
-        $tmp1[$attrs['cn'][0]][] = $name;
+        if(preg_match("/r/",$acl) || $this->gotoKioskProfile_Server == $attrs['cn'][0]){
+          $name = preg_replace("/^.*\//","",$attrs['gotoKioskProfile'][$i]);
+          $tmp1[$attrs['cn'][0]][] = $name;
+          $tmp3[$attrs['cn'][0]][$name] = $attrs['gotoKioskProfile'][$i];
+          $tmp2[$attrs['cn'][0]]= $attrs['cn'][0];
+          $cnt ++;
+        }
       }
-      $tmp2[$attrs['cn'][0]]= $attrs['cn'][0];
-      $cnt ++;
     }
 
-    if($cnt && $this->config->search("environment","kioskpath",array('menu','tabs'))){
+    $tmp = $this->config->get_cfg_value("environment","kioskPath");
+    if($cnt && !empty($tmp)){
       $this->kiosk_enabled = TRUE;
     }
 
     $this->gotoKioskProfiles['BY_SERVER'] = $tmp1;
     $this->gotoKioskProfiles['SERVERS']   = $tmp2;
+    $this->gotoKioskProfiles['MAP']       = $tmp3;
   
-    $this->gotoKioskProfile_Server = preg_replace("/^.*:\/\/([^\/]*).*$/","\\1",$this->gotoKioskProfile);
-    $this->gotoKioskProfile_Profile= preg_replace("/^.*\//","",$this->gotoKioskProfile);
-
     $error = false;
-    if(!in_array($this->gotoKioskProfile_Server, $this->gotoKioskProfiles['SERVERS'])){
-      $this->gotoKioskProfile_Server = key($this->gotoKioskProfiles['SERVERS']);
+    if(!isset($this->gotoKioskProfiles['SERVERS'][$this->gotoKioskProfile_Server])){
       $error = true;
-    }
-  
-    if(!in_array($this->gotoKioskProfile_Profile, $this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server])){
-      $this->gotoKioskProfile_Profile = $this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server][0];
+    }elseif(!in_array_strict($this->gotoKioskProfile_Profile, $this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server])){
       $error = true;
     }
     if($error && !empty($this->gotoKioskProfile)){
+      msg_dialog::display(_("Warning"), sprintf(_("Kiosk profile '%s' located on server '%s' is not available anymore. Kiosk profile will be disabled!"), $this->gotoKioskProfile_Profile, $this->gotoKioskProfile_Server), WARNING_DIALOG);
+      $this->gotoKioskProfile_Server ="none";
+      $this->gotoKioskProfile_Profile="";
+    }elseif(empty($this->gotoKioskProfile)){
       $this->gotoKioskProfile_Server ="none";
       $this->gotoKioskProfile_Profile="";
-      msg_dialog::display(_("Warning"), sprintf(_("Kiosk profile '%s' located on server '%s' is not available anymore. Kiosk profile will be disabled!"), $this->gotoKioskProfile_Profile, $this->gotoKioskProfile_Server), WARNING_DIALOG);
     }
   }
 
@@ -307,19 +348,19 @@ class environment extends plugin
     /* Log view */
     if($this->is_account && !$this->view_logged){
       $this->view_logged = TRUE;
-      if(isset($this->parent->by_object['user']) || (isset($this->attrs['objectClass']) &&in_array("gosaAccount",$this->attrs['objectClass']))){
+      if(isset($this->parent->by_object['user']) || (isset($this->attrs['objectClass']) &&in_array_strict("gosaAccount",$this->attrs['objectClass']))){
         new log("view","users/".get_class($this),$this->dn);
       }else{
         new log("view","groups/".get_class($this),$this->dn);
       }
     }
 
-    /* Are we editing from MyAccount and not editing a user */
-    $WriteOnly = (!isset($this->parent)|| !$this->parent) && !session::is_set('edit');
-
     /* Check profile server */
-    if($this->acl_is_writeable("gotoProfileServer",$WriteOnly)){
+    if($this->acl_is_writeable("gotoProfileServer")){
+
       if(!empty($this->gotoProfileServer) && !isset($this->gotoProfileServers[$this->gotoProfileServer])){
+
+
         if(count($this->gotoProfileServers)){
 
           /* Get First Profile */
@@ -348,7 +389,7 @@ class environment extends plugin
     /* Prepare all variables for smarty */
     foreach($this->attributes as $s_attr){
       /* Set value*/
-      $smarty->assign($s_attr,$this->$s_attr);
+      $smarty->assign($s_attr,set_post($this->$s_attr));
 
       /* Set checkbox state*/
       if(empty($this->$s_attr)){
@@ -356,9 +397,11 @@ class environment extends plugin
       }else{
         $smarty->assign($s_attr."CHK"," checked ");
       }
+    }
 
-      /* Prepare ACL settings*/
-      $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly));
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $val => $desc){
+      $smarty->assign("$val"."ACL", $this->getacl($val));
     }
 
     /* Is accout enabled | are we editing from usermenu or admin menu 
@@ -399,21 +442,25 @@ class environment extends plugin
       }
       /* Group Dialog with enabled environment options */
       if ($this->is_account){
-        $display= $this->show_enable_header(msgPool::removeFeaturesButton(_("Environment")),
-            msgPool::featuresEnabled(_("Environment")));
+        $display= $this->show_disable_header(msgPool::removeFeaturesButton(_("Desktop")),
+            msgPool::featuresEnabled(_("Desktop")));
       } else {
 
         /* Environment is disabled 
            If theres is no posixAccount enabled, you won't be able to enable 
            environment extensions
          */
-        if((isset($this->parent->by_object['group']))||(isset($this->attrs['objectClass']))&&((in_array("posixAccount",$this->attrs['objectClass'])))){
-          $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Environment")),
-              msgPool::featuresDisabled(_("Environment")));
+        if((isset($this->parent->by_object['group']))||(isset($this->attrs['objectClass']))&&((in_array_strict("posixAccount",$this->attrs['objectClass'])))){
+          $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Desktop")),
+              msgPool::featuresDisabled(_("Desktop")));
+          return $display;
+        }elseif((isset($this->parent->by_object['ogroup']))){
+          $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Desktop")),
+              msgPool::featuresDisabled(_("Desktop")));
           return $display;
         }else{
-          $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Environment")),
-              msgPool::featuresDisabled(_("Environment"), _("POSIX")), TRUE);
+          $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Desktop")),
+              msgPool::featuresDisabled(_("Desktop"), _("POSIX")), TRUE);
           return $display;
         }
       }
@@ -435,17 +482,17 @@ class environment extends plugin
 
         // 3. Account enabled . Editing from adminmenu
         if ($this->is_account){
-          $display= $this->show_enable_header(msgPool::removeFeaturesButton(_("Environment")),
-              msgPool::featuresEnabled(_("Environment")));
+          $display= $this->show_disable_header(msgPool::removeFeaturesButton(_("Desktop")),
+              msgPool::featuresEnabled(_("Desktop")));
         } else {
 
           if($this->parent->by_object['posixAccount']->is_account==true){
-            $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Environment")),
-                msgPool::featuresDisabled(_("Environment")));
+            $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Desktop")),
+                msgPool::featuresDisabled(_("Desktop")));
             return $display;
           }else{
-            $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Environment")),
-                msgPool::featuresDisabled(_("Environment"), _("POSIX")), TRUE);
+            $display= $this->show_enable_header(msgPool::addFeaturesButton(_("Desktop")),
+                msgPool::featuresDisabled(_("Desktop"), _("POSIX")), TRUE);
             return $display;
           }
         }
@@ -464,7 +511,7 @@ class environment extends plugin
     /* Prepare all variables for smarty */
     foreach($this->attributes as $s_attr){
       /* Set value*/
-      $smarty->assign($s_attr,$this->$s_attr);
+      $smarty->assign($s_attr,set_post($this->$s_attr));
 
       /* Set checkbox state*/
       if(empty($this->$s_attr)){
@@ -472,16 +519,18 @@ class environment extends plugin
       }else{
         $smarty->assign($s_attr."CHK"," checked ");
       }
+    }
 
-      /* Prepare ACL settings*/
-      $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly));
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $val => $desc){
+      $smarty->assign("$val"."ACL", $this->getacl($val));
     }
 
-    foreach(array("gotoHotplugDevice","gotoProfileFlagC","gotoProfileFlagL") as $s_attr){
-      $smarty->assign($s_attr."ACL",$this->getacl($s_attr,$WriteOnly));
+    foreach(array("gotoProfileFlagC","gotoProfileFlagL") as $s_attr){
+      $smarty->assign($s_attr."ACL",$this->getacl($s_attr));
     }
 
-    if($WriteOnly) {
+    if($this->read_only) {
       $smarty->assign("gotoPrinterACL","r");
     }else{
       $smarty->assign("gotoPrinterACL","rw");
@@ -491,15 +540,15 @@ class environment extends plugin
     $smarty->assign("useProfile",$this->useProfile);
     if(empty($this->useProfile) && !$this->multiple_support_active){
       $smarty->assign("useProfileCHK","");
-      $smarty->assign("gotoProfileServerACL" , preg_replace("/w/","",$this->getacl("gotoProfileServer",$WriteOnly)));
-      $smarty->assign("gotoProfileQuotaACL" , preg_replace("/w/","",$this->getacl("gotoProfileQuota",$WriteOnly)));
-      $smarty->assign("gotoProfileFlagCACL" , preg_replace("/w/","",$this->getacl("gotoProfileFlagC",$WriteOnly)));
+      $smarty->assign("gotoProfileServerACL" , preg_replace("/w/","",$this->getacl("gotoProfileServer")));
+      $smarty->assign("gotoProfileQuotaACL" , preg_replace("/w/","",$this->getacl("gotoProfileQuota")));
+      $smarty->assign("gotoProfileFlagCACL" , preg_replace("/w/","",$this->getacl("gotoProfileFlagC")));
     }else{
       $smarty->assign("useProfileCHK"," checked ");
     }
     
-    $smarty->assign("gotoProfileServerWriteable", $this->acl_is_writeable("gotoProfileServer",$WriteOnly));
-    $smarty->assign("gotoProfileACL", $this->getacl("gotoProfileServer",$WriteOnly).$this->getacl("gotoProfileQuota",$WriteOnly));
+    $smarty->assign("gotoProfileServerWriteable", $this->acl_is_writeable("gotoProfileServer"));
+    $smarty->assign("gotoProfileACL", $this->getacl("gotoProfileServer").$this->getacl("gotoProfileQuota"));
 
     /* HANDLE Profile Settings here 
      * Assign available Quota and resolution settings
@@ -521,20 +570,19 @@ class environment extends plugin
     }
 
 
-    $smarty->assign("gotoXResolutions"    , $this->gotoXResolutions);
-    $smarty->assign("gotoXResolutionKeys" , array_flip($this->gotoXResolutions));
+    $smarty->assign("gotoXResolutions"    , set_post($this->gotoXResolutions));
+    $smarty->assign("gotoXResolutionKeys" , set_post(array_flip($this->gotoXResolutions)));
 
-    $smarty->assign("gotoProfileServers",$this->gotoProfileServers);
+    $smarty->assign("gotoProfileServers", set_post($this->gotoProfileServers));
     if(!is_array($this->gotoProfileServers)){
       $this->gotoProfileServers =array();
     }
-    $smarty->assign("gotoProfileServerKeys",array_flip($this->gotoProfileServers));
 
     /* Handle kiosk profiles*/
-    $smarty->assign("kiosk_servers" , $this->gotoKioskProfiles['SERVERS']);
-    $smarty->assign("kiosk_server" ,  $this->gotoKioskProfile_Server);
-    $smarty->assign("kiosk_profiles" , $this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server]);
-    $smarty->assign("kiosk_profile" ,  $this->gotoKioskProfile_Profile);
+    $smarty->assign("kiosk_servers" , set_post($this->gotoKioskProfiles['SERVERS']));
+    $smarty->assign("kiosk_server" ,  set_post($this->gotoKioskProfile_Server));
+    $smarty->assign("kiosk_profiles", set_post($this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server]));
+    $smarty->assign("kiosk_profile" , set_post($this->gotoKioskProfile_Profile));
   
 
     /* Logonscript Management
@@ -546,7 +594,7 @@ class environment extends plugin
     if(isset($_POST['LogonSave'])){
 
       if(!$this->acl_is_writeable("gotoLogonScript")){
-        msg_dialog::display(_("Permission error"), msgPool::permModify(_("Logon scripts")), ERROR_DIALOG);
+        msg_dialog::display(_("Permission error"), msgPool::permModify(_("Log on scripts")), ERROR_DIALOG);
         unset($this->dialog);
         $this->dialog=FALSE;
         $this->is_dialog=false;
@@ -601,7 +649,7 @@ class environment extends plugin
        * There must be an entry selected to perform edit request.
        */
       if((isset($_POST['gotoLogonScriptEdit']))&&(isset($_POST['gotoLogonScript']))){
-        $is_entry = $this->gotoLogonScripts[$_POST['gotoLogonScript']];
+        $is_entry = $this->gotoLogonScripts[get_post('gotoLogonScript')];
         $this->is_dialog = true;
         $this->dialog = new logonManagementDialog($this->config,$this->dn,$is_entry);
       }
@@ -609,12 +657,12 @@ class environment extends plugin
 
     /* Append List to smarty*/
     if($this->multiple_support_active){
-      $smarty->assign("gotoLogonScripts",  $this->gotoLogonScripts);
-      $smarty->assign("gotoLogonScriptKeysCnt",count($this->gotoLogonScripts));
+      $smarty->assign("gotoLogonScripts",       set_post($this->gotoLogonScripts));
+      $smarty->assign("gotoLogonScriptKeysCnt", count($this->gotoLogonScripts));
     }else{
       $ls = $this->printOutLogonScripts();
-      $smarty->assign("gotoLogonScripts",  $ls);
-      $smarty->assign("gotoLogonScriptKeys",array_flip($ls));
+      $smarty->assign("gotoLogonScripts",  set_post($ls));
+      $smarty->assign("gotoLogonScriptKeys",set_post(array_flip($ls)));
       $smarty->assign("gotoLogonScriptKeysCnt",count($ls));
     }
 
@@ -623,11 +671,11 @@ class environment extends plugin
      *  and attach this combination to his setup.
      */
 
-    $smarty->assign("gotoShareSelections",    $this->gotoShareSelections);
+    $smarty->assign("gotoShareSelections",    set_post($this->gotoShareSelections));
     if(!is_array($this->gotoShareSelections)){
       $this->gotoShareSelections = array();
     }
-    $smarty->assign("gotoShareSelectionKeys", array_flip($this->gotoShareSelections));
+    $smarty->assign("gotoShareSelectionKeys", set_post(array_flip($this->gotoShareSelections)));
 
     /* if $_POST['gotoShareAdd'] is set, we will try to add a new entry 
      * This entry will be, a combination of mountPoint and sharedefinitions 
@@ -653,9 +701,9 @@ class environment extends plugin
           ){
         msg_dialog::display(_("Error"), msgPool::invalid(_("Mount point")), ERROR_DIALOG);
       }else{
-        $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']];
-        $s_mount = $_POST['gotoShareMountPoint'];
-        $s_user  = $_POST['ShareUser'];
+        $a_share = $this->gotoAvailableShares[get_post('gotoShareSelection')];
+        $s_mount = get_post('gotoShareMountPoint');
+        $s_user  = get_post('ShareUser');
         /* Preparing the new assignment */ 
         $this->gotoShares[$a_share['name']."|".$a_share['server']]=$a_share;
         $this->gotoShares[$a_share['name']."|".$a_share['server']]['Username']=$s_user;
@@ -677,8 +725,7 @@ class environment extends plugin
         if((preg_match("/^gotoShareDel_/",$name)) && ($once)){
           $once = false;  
           $key  = preg_replace("/^gotoShareDel_/","",$name);
-          $key  = preg_replace("/_+[xy]$/","",$key);
-          $key  = base64_decode($key);
+          $key  = postDecode($key);
           if(isset($this->gotoShares[$key])) {
             unset($this->gotoShares[$key]);
           }
@@ -693,8 +740,7 @@ class environment extends plugin
         if((preg_match("/^gotoShareResetPwd_/",$name)) && ($once)){
           $once = false;
           $key  = preg_replace("/^gotoShareResetPwd_/","",$name);
-          $key  = preg_replace("/_+[xy]$/","",$key);
-          $key  = base64_decode($key);
+          $key  = postDecode($key);
           $this->gotoShares[$key]['PwdHash'] = "";
           if(preg_match("/^!/",$this->gotoShares[$key]['server'])){
             unset($this->gotoShares[$key]);
@@ -702,30 +748,23 @@ class environment extends plugin
         }
       }
     }
-    $divlistShares = new divSelectBox("gotoShares");
-    $divlistShares->SetHeight(100);
-
-
-    $tmp = array();
-    if($this->acl_is_readable("gotoShares")){
-      $tmp = $this->printOutAssignedShares();
-    }
 
-    
-    foreach($tmp as $key => $value){
+    // Build up share list
+    $data = $lData = array(); 
+    foreach($this->gotoShares as $key => $entry){
       $img = "";
 
-      /* Skip apssword only entries */
-      if( empty($this->gotoShares[$key]['server']) && 
-          empty($this->gotoShares[$key]['name']) &&
-          empty($this->gotoShares[$key]['mountPoint']) &&
-          empty($this->gotoShares[$key]['Username'])){
+      // Skip password only entries
+      if( empty($entry['server']) && empty($entry['name']) &&
+          empty($entry['mountPoint']) && empty($entry['Username'])){
         continue;
       } 
 
+      // While editing mutlipe users at once we've to seperate 
+      //  entries used by all users and those used by only some.
       $color = "";
       if($this->multiple_support_active){
-        if($this->gotoShares[$key]['UsedByAllUsers']){
+        if($entry['UsedByAllUsers']){
           $value .= "&nbsp;(<b>"._("Used by all users")."</b>)";
         }else{
           $color = "color: #999999;";
@@ -733,35 +772,44 @@ class environment extends plugin
         }
       }
 
-      /* Check if entry starts with an ! */
+      // Create password reset image button 
+      if($entry['PwdHash'] != ""){
+          $img.= 
+              image('plugins/goto/images/list_reset_password.png',
+                      'gotoShareResetPwd_'.postEncode($key),
+                      _("Reset password hash"));
+      }
+
+      // Build up list entries - Handle entries starting with '!' here.
+      $data[$key]=$key;
       if(preg_match("/^!/",$this->gotoShares[$key]['server'])){
 
-        /* If we are currently editing groups environment, skip those ! entries */ 
+        // If we are currently editing groups environment, skip those ! entries */ 
         if($this->is_group) continue;
 
-        /* Create pwd reset images */
-        if($this->gotoShares[$key]['PwdHash'] != ""){
-          $img.= "<input type='image' name='gotoShareResetPwd_".base64_encode($key)." 'src='images/list_reset_password.png' alt='"._("Reset password hash")."' 
-            title='"._("Reset password hash")."'>";
-        }
-        $field1 = array("string" => "<font style=\"color:#C0C0C0\">".$value."</font>" , "attach" => "style='".$color."'");
-        $field2 = array("string" => $img   , "attach" => "style='border-right:0px;'");
+        $lData[$key] = array('data' => array(
+                    $entry['server']."://",
+                    $entry['name'], 
+                    "",
+                    "",
+                    image("plugins/groups/images/select_group.png","",_("Group share")),
+                    $img));
       }else{
 
-        /* Create pwd reset img && delete image */
-        if($this->gotoShares[$key]['PwdHash'] != ""){
-          $img.= "<input type='image' name='gotoShareResetPwd_".base64_encode($key)." 'src='images/list_reset_password.png' alt='"._("Reset password hash")."' 
-            title='"._("Reset password hash")."'>";
-          $img.= "&nbsp;";
-        }
-        $img.= "<input type='image' name='gotoShareDel_".base64_encode($key)." 'src='images/edittrash.png' alt='".msgPool::delButton()."' 
-          title='"._("Delete share entry")."'>";
-        $field1 = array("string" => $value , "attach" => "style='".$color."'");
-        $field2 = array("string" => $img   , "attach" => "style='border-right:0px;'");
+        $img.= image('images/lists/trash.png',"gotoShareDel_".postEncode($key),msgPool::delButton());
+        $lData[$key] = array('data' => array(
+                    $entry['server']."://",
+                    $entry['name'], 
+                    $entry['mountPoint'], 
+                    $entry['Username'], 
+                    image("plugins/users/images/select_user.png","",_("User share")),
+                    $img));
       }
-      $divlistShares->AddEntry(array($field1,$field2));
     }
-    $smarty->assign("divlistShares",$divlistShares->DrawList());
+    $this->shareList->setListData($data,$lData);
+    $this->shareList->update();
+    $this->shareList->setAcl($this->getacl("gotoShare"));
+    $smarty->assign("shareList",$this->shareList->render());
 
     /* Hotplug devices will be handled here 
      * There are 3 possible methods for this feature
@@ -771,8 +819,8 @@ class environment extends plugin
      */
 
     /* We have to delete the selected hotplug from the list*/
-    if((isset($_POST['gotoHotplugDeviceDel']))&&(isset($_POST['gotoHotplugDevice_post'])) && $this->acl_is_writeable("gotoHotplugDevice")){
-      if($this->acl_is_writeable("gotoHotplugDevice")){
+    if((isset($_POST['gotoHotplugDeviceDel']))&&(isset($_POST['gotoHotplugDevice_post'])) && $this->acl_is_writeable("gotoHotplugDeviceDN")){
+      if($this->acl_is_writeable("gotoHotplugDeviceDN")){
         foreach($_POST['gotoHotplugDevice_post'] as $name){
           unset($this->gotoHotplugDevices[$name]);
         }
@@ -780,53 +828,57 @@ class environment extends plugin
     }
 
     /* There are already defined hotplugs from other users we could use */
-    if(isset($_POST['gotoHotplugDeviceUse']) && $this->acl_is_writeable("gotoHotplugDevice")){
+    if(isset($_POST['gotoHotplugDeviceUse']) && $this->acl_is_writeable("gotoHotplugDeviceDN")){
       $tmp  =array();
       foreach($this->gotoHotplugDevices as $plugs){
         $tmp[] = $plugs['name'];
       }
-      $this->dialog = new hotplugDialog($this->config,$tmp);
+      $this->dialog = new hotplugSelect($this->config, get_userinfo());
       $this->is_dialog = true;
     }
 
     /* Dialog Aborted */
-    if(isset($_POST['HotPlugCancel'])){
-      unset($this->dialog);
+    if(isset($_POST['hotplugSelect_cancel'])){
       $this->dialog= FALSE;
       $this->is_dialog = false;
     }
 
     /* Dialod saved */
-    if(isset($_POST['HotPlugSave'])){
-
-      $this->dialog->save_object();
-      if(count($this->dialog->check())!=0){
-        foreach($this->dialog->check() as $msg){
-          msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
-        }
-      }else{
-        $this->dialog->save_object();
-        $a_tmp = $this->dialog->save();
-
-        if(is_array($a_tmp)){
-          foreach($a_tmp as $name => $hotplug){
-            if($this->multiple_support_active){
-              $hotplug['UsedByAllUsers'] = TRUE;
-            }
-            $this->gotoHotplugDevices[$name]= $hotplug; 
-          }
+    if(isset($_POST['hotplugSelect_save'])){
+
+      $res = $this->dialog->save();
+      foreach($res as $hotplug){
+        $name = $hotplug['cn'][0];
+        $entry['dn'] = $hotplug['dn'];
+
+        /* Set class values */
+        $tmp = preg_split("/\|/",$hotplug['gotoHotplugDevice'][0]);
+        $entry['name']          = $hotplug['cn'][0];
+        $entry['description'] = $tmp[0];
+        $entry['id']       = $tmp[1];
+        $entry['produkt']      = $tmp[2];
+        $entry['vendor']     = $tmp[3];
+        if($this->multiple_support_active){
+          $entry['UsedByAllUsers'] = TRUE;
         }
-        unset($this->dialog);
-        $this->dialog= FALSE;
-        $this->is_dialog = false;
+        $this->gotoHotplugDevices[$name]= $entry; 
       }
+      $this->dialog= FALSE;
+      $this->is_dialog = false;
+    }
+
+    if($this->dialog instanceOf hotplugSelect){
+    
+      // Build up blocklist
+      session::set('filterBlacklist', array('cn' => array_keys($this->gotoHotplugDevices)));
+      return($this->dialog->execute());
     }
 
     if($this->multiple_support_active){
-      $smarty->assign("gotoHotplugDevices",$this->gotoHotplugDevices);
+      $smarty->assign("gotoHotplugDevices", set_post($this->gotoHotplugDevices));
     }else{
-      $smarty->assign("gotoHotplugDevices",$this->printOutHotPlugDevices());
-      $smarty->assign("gotoHotplugDeviceKeys",array_flip($this->printOutHotPlugDevices()));
+      $smarty->assign("gotoHotplugDevices", set_post($this->printOutHotPlugDevices()));
+      $smarty->assign("gotoHotplugDeviceKeys",set_post(array_flip($this->printOutHotPlugDevices())));
     }
 
     /* Printer Assignment will managed below 
@@ -838,34 +890,27 @@ class environment extends plugin
 
     /* First handle Add Post. Open a dialog that allows us to select a printer or two */ 
     if(isset($_POST['gotoPrinterAdd'])){
-
+      $this->dialog = new printerSelect($this->config,get_userinfo());
       $this->is_dialog=true;
-      $this->dialog = new selectPrinterDialog($this->config,$this->dn,$this->gotoPrinter);
     }
 
-    if(isset($_POST['PrinterCancel'])){
+    if(isset($_POST['printerSelect_cancel']) && $this->dialog instanceOf printerSelect){
       $this->is_dialog=false;
-      unset($this->dialog);
       $this->dialog=FALSE;
     }
 
-    if(isset($_POST['PrinterSave'])){
-      if(count($this->dialog->check())!=0){
-        $tmp = $this->dialog->check();
-        foreach($tmp as $msg){
-          msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
-        } 
-      }else{
-        $this->dialog->save_object();
-        $tmp = $this->dialog->save();
-        $tmp2= $this->dialog->getPrinter(true);
+    if(isset($_POST['printerSelect_save'])  && $this->dialog instanceOf printerSelect){
+
+      $res = $this->dialog->save();
+        foreach($res as $printer){
 
-        foreach($tmp as $pname){
-          $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$tmp2[$pname]['dn'],"printer");
-          $printerObj->set_acl_base($tmp2[$pname]['dn']);
+          $pname = $printer['cn'][0];
+          $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'], $printer['dn'],"printer");
+          $printerObj->set_acl_base($printer['dn']);
 
           $type = false;
 
+          
           if($this->is_group){
             if($this->dn == "new"){  
               $type = "AddGroup";
@@ -879,13 +924,15 @@ class environment extends plugin
               $type = "AddUser";
             }elseif(isset($this->NewDeletedPrinters[$pname])){
               $type = "AddUser";
+            }elseif($this->dn == "new"){  
+              $type = "AddUser";
             }elseif($printerObj->by_object['printgeneric']->AddMember("AddUser",$this->dn)){
               $type = "AddUser";
             }
           }
 
           if($type){
-            $this->gotoPrinter[$pname]=$tmp2[$pname];
+            $this->gotoPrinter[$pname]=$printer;
             $this->gotoPrinter[$pname]['mode']="user";
             $this->add_del_printer_member_was_called = true;
 
@@ -899,11 +946,19 @@ class environment extends plugin
         $this->is_dialog=false;
         unset($this->dialog);
         $this->dialog   =FALSE;
-      }
     }
 
+    // Display printer selection dialog 
+    if($this->dialog instanceOf printerSelect){
+
+      // Build up blocklist
+      session::set('filterBlacklist',array('cn' => array_keys($this->gotoPrinter)));
+      return($this->dialog->execute());
+    }
+
+
     if((isset($_POST['gotoPrinterDel']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
-      $printer = $_POST['gotoPrinterSel'];
+      $printer = get_post('gotoPrinterSel');
       foreach($printer as $pname){
 
         $printerObj = new printtabs($this->config,$this->config->data['TABS']['PRINTTABS'],$this->gotoPrinter[$pname]['dn'],"printer");
@@ -936,7 +991,7 @@ class environment extends plugin
     }
 
     if((isset($_POST['gotoPrinterEdit']))&&(isset($_POST['gotoPrinterSel']))&&(!empty($_POST['gotoPrinterSel']))){
-      $printers = $_POST['gotoPrinterSel'];
+      $printers = get_post('gotoPrinterSel');
       $this->add_del_printer_member_was_called = true;
       foreach($printers as $printer){
         if($this->gotoPrinter[$printer]['mode']=="user"){
@@ -959,8 +1014,7 @@ class environment extends plugin
       }
     }
 
-    $smarty->assign("gotoPrinter",$this->printOutPrinterDevices());
-    $smarty->assign("gotoPrinterKeys",array_flip($this->printOutPrinterDevices()));
+    $smarty->assign("gotoPrinter", set_post($this->printOutPrinterDevices()));
 
     /* General behavior */
     if(is_object($this->dialog)){
@@ -973,7 +1027,7 @@ class environment extends plugin
     foreach(array("gotoPrinter","kiosk_server","gotoProfileFlagL","gotoXResolution",
                   "useProfile","gotoProfileServer","gotoProfileQuota","gotoProfileFlagC") as $box){
       $ubox ="use_".$box;
-      if(in_array($box,$this->multi_boxes)){
+      if(in_array_strict($box,$this->multi_boxes)){
         $smarty->assign($ubox,TRUE);
       }else{
         $smarty->assign($ubox,FALSE);
@@ -1034,21 +1088,20 @@ class environment extends plugin
     /* Get all Posted vars 
      * Setup checkboxes 
      */
-    $WriteOnly = (!isset($this->parent)|| !$this->parent) && !session::is_set('edit');
     if(isset($_POST['iamposted'])){
 
-      $PACL =  $this->getacl("gotoProfileServer",$WriteOnly).$this->getacl("gotoProfileQuota",$WriteOnly);
+      $PACL =  $this->getacl("gotoProfileServer").$this->getacl("gotoProfileQuota");
 
       if(isset($_POST['kiosk_server'])){
-        $tmp = $_POST['kiosk_server'];
+        $tmp = get_post('kiosk_server');
         if(isset($this->gotoKioskProfiles['SERVERS'][$tmp])){
-          $this->gotoKioskProfile_Server = $_POST['kiosk_server'];
+          $this->gotoKioskProfile_Server = get_post('kiosk_server');
         }
       }
       if(isset($_POST['kiosk_profile'])){
-        $tmp = $_POST['kiosk_profile'];
-        if(in_array($tmp,$this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server])){
-          $this->gotoKioskProfile_Profile = $_POST['kiosk_profile'];
+        $tmp = get_post('kiosk_profile');
+        if(in_array_strict($tmp,$this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server])){
+          $this->gotoKioskProfile_Profile = get_post('kiosk_profile');
         }
       }
 
@@ -1062,7 +1115,7 @@ class environment extends plugin
 
       if($this->acl_is_writeable("gotoProfileFlagC")){
         if(isset($_POST['gotoProfileFlagC'])){
-          $this->gotoProfileFlagC = $_POST['gotoProfileFlagC'];
+          $this->gotoProfileFlagC = get_post('gotoProfileFlagC');
         }else{
           $this->gotoProfileFlagC = false;
         }
@@ -1070,7 +1123,7 @@ class environment extends plugin
 
       if($this->acl_is_writeable("gotoProfileFlagL")){
         if(isset($_POST['gotoProfileFlagL'])){
-          $this->gotoProfileFlagL = $_POST['gotoProfileFlagL'];
+          $this->gotoProfileFlagL = get_post('gotoProfileFlagL');
         }else{
           $this->gotoProfileFlagL = false;
         }
@@ -1079,12 +1132,12 @@ class environment extends plugin
       plugin::save_object();
       foreach($this->attributes as $s_attr){
         if((!isset($_POST[$s_attr])) || 
-            in_array($s_attr,array("gosaDefaultPrinter","gotoShares","gotoHotplugDevices","gotoPrinter","gotoLogonScripts","uid"))) continue;
+            in_array_strict($s_attr,array("gosaDefaultPrinter","gotoShare","gotoHotplugDevices","gotoPrinter","gotoLogonScripts","uid"))) continue;
         if(!$this->acl_is_writeable($s_attr)){
           continue;
         }else{ 
           if(isset($_POST[$s_attr])){
-            $this->$s_attr = $_POST[$s_attr];
+            $this->$s_attr = get_post($s_attr);
           }else{
             $this->$s_attr = false;
           }
@@ -1109,8 +1162,8 @@ class environment extends plugin
       $this->attrs['objectClass']=array();
     } 
     if(!$this->is_group){
-      if((!((in_array("posixAccount",$this->attrs['objectClass']))||($this->parent->by_object['posixAccount']->is_account==true)))&&(!$this->is_group)){
-        $message[]= msgPool::featuresDisabled(_("environemnt"),_("POSIX"));  
+      if((!((in_array_strict("posixAccount",$this->attrs['objectClass']))||($this->parent->by_object['posixAccount']->is_account==true)))&&(!$this->is_group)){
+        $message[]= msgPool::featuresDisabled(_("environment"),_("POSIX"));  
       }
     }
     return ($message);
@@ -1124,11 +1177,7 @@ class environment extends plugin
      */ 
     /* only save changed variables ....*/
     if ($this->gotoKioskProfile_Server != "none"){
-      if(preg_match("/https/i",$_SERVER['HTTP_REFERER'])){
-        $method="https://".$this->gotoKioskProfile_Server."/kiosk/".$this->gotoKioskProfile_Profile;
-      }else{
-        $method="http://".$this->gotoKioskProfile_Server."/kiosk/".$this->gotoKioskProfile_Profile;
-      }
+      $method = $this->gotoKioskProfiles['MAP'][$this->gotoKioskProfile_Server][$this->gotoKioskProfile_Profile];
       $this->gotoKioskProfile= $method;
     }else{
       $this->gotoKioskProfile= array();
@@ -1169,6 +1218,7 @@ class environment extends plugin
       }
 
       /* Remove old entries */
+      $ldap->cd($this->config->current['BASE']);;
       $ldap->search("(&(objectClass=gotoPrinter)(goto".$s_suffix."Printer=".$this->$useVar."))",array("*"));
       while($attr = $ldap->fetch()){
         $printerObj = NULL;
@@ -1178,6 +1228,7 @@ class environment extends plugin
         $printerObj->by_object['printgeneric']->save();
       }
 
+      $ldap->cd($this->config->current['BASE']);;
       $ldap->search("(&(objectClass=gotoPrinter)(goto".$s_suffix."AdminPrinter=".$this->$useVar."))",array("*"));
       while($attr = $ldap->fetch()){
         $printerObj = NULL;
@@ -1207,7 +1258,7 @@ class environment extends plugin
     /* Prepare HotPlug devices */
     $this->attrs['gotoHotplugDeviceDN'] = array();
     foreach($this->gotoHotplugDevices as $name => $device){
-      $this->attrs['gotoHotplugDeviceDN'][]= $device['dn'];
+      $this->attrs['gotoHotplugDeviceDN'][]= LDAP::fix($device['dn']);
     }
 
     /* Prepare LogonScripts */
@@ -1284,24 +1335,6 @@ class environment extends plugin
     $this->handle_post_events($mode,array("uid"=>$this->uid));
   }
 
-  /* Generate ListBox frindly output for the defined shares 
-   * Possibly Add or remove an attribute here, 
-   */
-  function printOutAssignedShares()
-  {
-    $a_return = array();
-    if(is_array($this->gotoShares)){
-      foreach($this->gotoShares as $share){
-        if(preg_match("/^!/",$share['server'])){
-          $a_return[$share['name']."|".$share['server']]= preg_replace("/^!/","",$share['server'])."://".$share['name']." - "._("group share"); 
-        }else{
-          $a_return[$share['name']."|".$share['server']]= $share['server']."://".$share['name']." on ".$share['mountPoint']." as ".$share['Username'];
-        }
-      }
-      natcasesort($a_return);
-    }
-    return($a_return);
-  }
 
   /* Generate ListBox frindly output for the definedhotplugs 
    * Possibly Add or remove an attribute here,
@@ -1323,22 +1356,20 @@ class environment extends plugin
   function printOutPrinterDevices()
   {
     $a_return = array();
-    
-    if($this->acl_is_readable("gotoPrinter")){
 
-      if(is_array($this->gotoPrinter)){
-        foreach($this->gotoPrinter as $printer){
-          if($printer['mode'] == "admin"){
-            $a_return[$printer['cn'][0]]= $printer['cn'][0]." - "._("Administrator");
-          }else{
-            $a_return[$printer['cn'][0]]= $printer['cn'][0]; 
-          }
-          if ($printer['cn'][0] == $this->gosaDefaultPrinter){
-            $a_return[$printer['cn'][0]].=" - "._("Default printer");
-          }
+    if(is_array($this->gotoPrinter)){
+      foreach($this->gotoPrinter as $printer){
+        if($printer['mode'] == 'admin'){
+          $a_return[$printer['cn'][0]]= $printer['cn'][0]." - "._("Administrator");
+        }else{
+          $a_return[$printer['cn'][0]]= $printer['cn'][0]; 
+        }
+        if ($printer['cn'][0] == $this->gosaDefaultPrinter){
+          $a_return[$printer['cn'][0]].=" - "._("Default printer");
         }
       }
     }
+               asort($a_return);
     return($a_return);
   }
 
@@ -1358,8 +1389,8 @@ class environment extends plugin
   function saveCopyDialog()
   {
     if(isset($_POST['cn'])){
-      $this->cn = $_POST['cn'];
-      $this->uid = $_POST['cn'];
+      $this->cn = get_post('cn');
+      $this->uid = get_post('cn');
     }
   }
 
@@ -1397,7 +1428,7 @@ class environment extends plugin
       unset($this->multi_attrs_all['gotoShare']['count']);
       foreach($this->multi_attrs_all['gotoShare'] as $share){
         $tmp = $tmp2 = array();
-        $tmp = split("\|",$share);
+        $tmp = explode("|",$share);
         $tmp2['server']      =$tmp[0];
         $tmp2['name']        =$tmp[1];
 
@@ -1428,7 +1459,7 @@ class environment extends plugin
       unset($this->multi_attrs['gotoShare']['count']);
       foreach($this->multi_attrs['gotoShare'] as $share){
         $tmp = $tmp2 = array();
-        $tmp = split("\|",$share);
+        $tmp = explode("|",$share);
         $tmp2['server']      =$tmp[0];
         $tmp2['name']        =$tmp[1];
 
@@ -1460,7 +1491,7 @@ class environment extends plugin
       unset($this->multi_attrs_all['gotoLogonScript']['count']);
       foreach($this->multi_attrs_all['gotoLogonScript'] as $device){
         $tmp = $tmp2 = array();
-        $tmp = split("\|",$device);
+        $tmp = explode("|",$device);
         $tmp2['LogonName']        = $tmp[0];
         $tmp2['LogonPriority']    = $tmp[2];
         if(preg_match("/O/i",$tmp[1])){
@@ -1485,7 +1516,7 @@ class environment extends plugin
       unset($this->multi_attrs['gotoLogonScript']['count']);
       foreach($this->multi_attrs['gotoLogonScript'] as $device){
         $tmp = $tmp2 = array();
-        $tmp = split("\|",$device);
+        $tmp = explode("|",$device);
         $tmp2['LogonName']        = $tmp[0];
         $tmp2['LogonPriority']    = $tmp[2];
         if(preg_match("/O/i",$tmp[1])){
@@ -1635,7 +1666,7 @@ class environment extends plugin
     $ret['gotoLogonScripts'] = $this->gotoLogonScripts;
     $ret['gotoHotplugDevices'] = $this->gotoHotplugDevices;
   
-    if(in_array("gotoPrinter",$this->multi_boxes)){
+    if(in_array_strict("gotoPrinter",$this->multi_boxes)){
       $ret['gotoPrinter'] = $this->gotoPrinter;
       $ret['gotoPrinterSel'] = $this->gotoPrinterSel;
       $ret['gosaDefaultPrinter'] = $this->gosaDefaultPrinter;
@@ -1644,26 +1675,26 @@ class environment extends plugin
       $ret['add_del_printer_member_was_called'] = TRUE;
     }
   
-    if(in_array("gotoProfileFlagL",$this->multi_boxes)){
+    if(in_array_strict("gotoProfileFlagL",$this->multi_boxes)){
       $ret['gotoProfileFlagL'] = $this->gotoProfileFlagL;
     }
 
-    if(in_array("useProfile",$this->multi_boxes)){
+    if(in_array_strict("useProfile",$this->multi_boxes)){
       $ret['useProfile']=$this->useProfile;
-      if(in_array("gotoProfileServer",$this->multi_boxes)){
+      if(in_array_strict("gotoProfileServer",$this->multi_boxes)){
         $ret['gotoProfileServer']=$this->gotoProfileServer;
       }
-      if(in_array("gotoProfileQuota",$this->multi_boxes)){
+      if(in_array_strict("gotoProfileQuota",$this->multi_boxes)){
         $ret['gotoProfileQuota']=$this->gotoProfileQuota;
       }
-      if(in_array("gotoProfileFlagC",$this->multi_boxes)){
+      if(in_array_strict("gotoProfileFlagC",$this->multi_boxes)){
         $ret['gotoProfileFlagC'] = $this->gotoProfileFlagC;
       }
     }
-    if(in_array("gotoXResolution",$this->multi_boxes)){
+    if(in_array_strict("gotoXResolution",$this->multi_boxes)){
       $ret['gotoXResolution'] = $this->gotoXResolution;
     }
-    if(in_array("kiosk_server",$this->multi_boxes)){
+    if(in_array_strict("kiosk_server",$this->multi_boxes)){
       $ret['gotoKioskProfile_Server'] = $this->gotoKioskProfile_Server;
       $ret['gotoKioskProfile_Profile'] = $this->gotoKioskProfile_Profile;
     }
@@ -1676,7 +1707,7 @@ class environment extends plugin
     $message = plugin::multiple_check();
     $this->detect_grouptype();
 
-    if(preg_match("/[^0-9]/",$this->gotoProfileQuota) && in_array("gotoProfileQuota",$this->multi_boxes)) {
+    if(preg_match("/[^0-9]/",$this->gotoProfileQuota) && in_array_strict("gotoProfileQuota",$this->multi_boxes)) {
       $message[] = msgPool::invalid(_("Profile quota"),$this->gotoProfileQuota,"/[0-9]/") ;
     }
     return($message);
@@ -1694,13 +1725,13 @@ class environment extends plugin
         $this->useProfile = false;
       }
       if(isset($_POST['gotoProfileFlagC'])){
-        $this->gotoProfileFlagC = $_POST['gotoProfileFlagC'];
+        $this->gotoProfileFlagC = get_post('gotoProfileFlagC');
       }else{
         $this->gotoProfileFlagC = false;
       }
 
       if(isset($_POST['gotoProfileFlagL'])){
-        $this->gotoProfileFlagL = $_POST['gotoProfileFlagL'];
+        $this->gotoProfileFlagL = get_post('gotoProfileFlagL');
       }else{
         $this->gotoProfileFlagL = false;
       }
@@ -1713,15 +1744,15 @@ class environment extends plugin
         }
       }
       if(isset($_POST['kiosk_server'])){
-        $tmp = $_POST['kiosk_server'];
+        $tmp = get_post('kiosk_server');
         if(isset($this->gotoKioskProfiles['SERVERS'][$tmp])){
-          $this->gotoKioskProfile_Server = $_POST['kiosk_server'];
+          $this->gotoKioskProfile_Server = get_post('kiosk_server');
         }
       }
       if(isset($_POST['kiosk_profile'])){
-        $tmp = $_POST['kiosk_profile'];
-        if(in_array($tmp,$this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server])){
-          $this->gotoKioskProfile_Profile = $_POST['kiosk_profile'];
+        $tmp = get_post('kiosk_profile');
+        if(in_array_strict($tmp,$this->gotoKioskProfiles['BY_SERVER'][$this->gotoKioskProfile_Server])){
+          $this->gotoKioskProfile_Profile = get_post('kiosk_profile');
         }
       }
 
@@ -1732,33 +1763,59 @@ class environment extends plugin
 #FIXME these ACLs should work for groups too */ 
   static function plInfo()
   {
-    return (array("plShortName"     => _("Environment"),
-          "plDescription"   => _("Environment settings"),         // Description
-          "plSelfModify"    => TRUE,                              
-          "plDepends"       => array("user", "posixAccount"),     // This plugin depends on 
-          "plPriority"      => 3,                                 // Position in tabs 
-          "plSection"     => array("personal" => _("My account")),
-          "plCategory"    => array("users",
-                                   "groups"),
-          "plOptions"       => array("resolution_hook" => array("type" => "string",
-              "description" => _("Command to extend the list of possible screen resolutions"))),
-
-          "plProvidedAcls"  => array(
-
-            "gotoProfileFlagL"    => _("Resolution changeable during session") ,
-            "gotoProfileFlagC"    => _("Cache profile localy") ,
-
-            "gotoProfileQuota"    => _("Profile quota") ,
-            "gotoProfileServer"   => _("Profile server") ,
-
-            "gotoXResolution"     => _("Resolution") ,
-            "gotoKioskProfile"    => _("Kiosk profile") ,
-
-            "gosaDefaultPrinter"  => _("Default printer") ,
-            "gotoLogonScript"     => _("Logon script") ,
-            "gotoHotplugDevice"   => _("Hotplug devices"),
-            "gotoShare"           => _("Shares"))
-            ));
+      return (array("plShortName"     => _("Desktop"),
+                  "plDescription"   => _("Desktop settings"),         // Description
+                  "plSelfModify"    => TRUE,                              
+                  "plDepends"       => array("user", "posixAccount"),     // This plugin depends on 
+                  "plPriority"      => 3,                                 // Position in tabs 
+                  "plSection"     => array("personal" => _("My account")),
+                  "plCategory"    => array("users",
+                      "groups","ogroups"),
+                  "plOptions"       => array("resolution_hook" => array("type" => "string",
+                          "description" => _("Command to extend the list of possible screen resolutions"))),
+                  "plRequirements"=> array(
+                      'ldapSchema' => array('gotoEnvironment' => '>=2.7'),
+                      'onFailureDisablePlugin' => array(get_class())
+                      ),
+                  "plProperties" => array(
+
+                      array(
+                          "name"          => "resolutions",
+                          "type"          => "file",
+                          "default"       => "",
+                          "description"   => _("File containing additional resolutions for workstations and thin clients."),
+                          "check"         => "gosaProperty::isReadableFile",
+                          "migrate"       => "",
+                          "group"         => "environment",
+                          "mandatory"     => FALSE
+                          ),
+                      array(
+                          "name"          => "kioskPath",
+                          "type"          => "path",
+                          "default"       => "/var/spool/kiosk",
+                          "description"   => _("Directory to store KDE kiosk profiles."),
+                          "check"         => "gosaProperty::isWriteablePath",
+                          "migrate"       => "",
+                          "group"         => "environment",
+                          "mandatory"     => FALSE
+                          )
+                      ),
+
+
+                  "plProvidedAcls"  => array(
+
+                          "gotoPrinter"         => _("Printer") ,
+                          "gotoProfileServer"   => _("Profile server") ,
+                          "gosaDefaultPrinter"  => _("Default printer"),
+                          "gotoProfileQuota"    => _("Profile quota") ,
+                          "gotoProfileFlagC"    => _("Cache profile locally") ,
+                          "gotoShare"          => _("Shares"),
+                          "gotoHotplugDeviceDN" => _("Hot-plug devices"),
+                          "gotoKioskProfile"    => _("Kiosk profile") ,
+                          "gotoProfileFlagL"    => _("Resolution changeable during session") ,
+                          "gotoXResolution"     => _("Resolution") ,
+                          "gotoLogonScript"     => _("Log on script"))
+                      ));
   }
 }