Code

Fixed ldap problem
[gosa.git] / gosa-plugins / goto / admin / systems / goto / class_workstationStartup.inc
index 4b3164c40fb27f7d8860505b0f7930d793f33135..fc29543b07e6e34eb6ff4f57dfb75e50cec0f1b2 100644 (file)
@@ -103,6 +103,8 @@ class workstartup extends plugin
         $this->gotoLdapServers[] = preg_replace("/^[0-9]*:/","",$value);
       }
     } 
+    natcasesort($this->gotoLdapServerList);
+
     if(!count($this->gotoLdapServers) && $this->member_of_ogroup){ 
       $this->gotoLdap_inherit = TRUE;
     }
@@ -369,7 +371,7 @@ class workstartup extends plugin
         }
 
         if((isset($this->FAIclassInfo[$_POST['FAIclassesSel']]['FAIpartitionTable']))&&($found>0)){
-          msg_dialog(_("Error"), _("There is already a profile containing a partition table in your configuration!") , ERROR_DIALOG);
+          msg_dialog::display(_("Error"), _("There is already a profile containing a partition table in your configuration!") , ERROR_DIALOG);
         }else{
           $this->FAIclass[$_POST['FAIclassesSel']]=$_POST['FAIclassesSel'];
         }
@@ -477,7 +479,7 @@ class workstartup extends plugin
     if((isset($_POST['gotoShareAdd'])) && ($this->acl_is_writeable("gotoShare"))) {
       /* We assign a share to this user, if we don't know where to mount the share */
       if((!isset($_POST['gotoShareMountPoint']))||(empty($_POST['gotoShareMountPoint']))||(preg_match("/[\|]/i",$_POST['gotoShareMountPoint']))){
-        msg_dialog(_("Error"), msgPool::required(_("Mount point")), ERROR_DIALOG);
+        msg_dialog::display(_("Error"), msgPool::required(_("Mount point")), ERROR_DIALOG);
       }else{
         if(count($this->gotoAvailableShares)){
           $a_share = $this->gotoAvailableShares[$_POST['gotoShareSelection']];
@@ -556,7 +558,7 @@ class workstartup extends plugin
       }
 
       /* Convert old style entry */
-      if (!preg_match('%:ldap://%', $server)){
+      if (!preg_match('%:ldaps?://%', $server)){
         $server= "ldap://".preg_replace('/^([^:]+):/', '\1/', $server);
 
       /* Beautify new style entries */
@@ -584,7 +586,7 @@ class workstartup extends plugin
       if(!in_array($entry,$this->gotoLdapServers)){
 
         /* Convert old style entry */
-        if (!preg_match('%:ldap://%', $entry)){
+        if (!preg_match('%:ldap[s]*://%', $entry)){
           $entry= "ldap://".preg_replace('/^([^:]+):/', '\1/', $entry);
 
         /* Beautify new style entries */
@@ -904,8 +906,13 @@ class workstartup extends plugin
         $this->attrs['FAIclass']        = array();
         $this->attrs['FAIdebianMirror'] = array();
       }
-    }
+    }else{
 
+      /* Don't touch FAI objects if something went wrong with the si daemon.
+       */
+      if(isset($this->attrs['FAIclass'])) unset($this->attrs['FAIclass']);
+      if(isset($this->attrs['FAIdebianMirror'])) unset($this->attrs['FAIdebianMirror']);
+    }
 
     /* prepare share settings */
     $tmp = array();
@@ -1318,9 +1325,9 @@ class workstartup extends plugin
       $res = shell_exec($cmd);
       $res2 = trim($res);
       if((!$res)){
-        msg_dialog(_("Configuration error"), msgPool::cmdexecfailed("REPOSITORY_HOOK", $cmd), ERROR_DIALOG);
+        msg_dialog::display(_("Configuration error"), msgPool::cmdexecfailed("REPOSITORY_HOOK", $cmd), ERROR_DIALOG);
       }elseif(empty($res2)){
-        msg_dialog(_("Configuration error"), _("REPOSITORY_HOOK returned no result!"), ERROR_DIALOG);
+        msg_dialog::display(_("Configuration error"), _("REPOSITORY_HOOK returned no result!"), ERROR_DIALOG);
       }else{
         $tmp = split("\n",$res);
         foreach($tmp as $line){