Code

Updated translation, fixed some typo/errors
[gosa.git] / plugins / admin / systems / class_termDNS.inc
index 52085344260c021228343d77ca7056f6106e7e77..065a6e1129204b5aab84c4447748bf8400edd2cb 100644 (file)
@@ -247,7 +247,7 @@ class termDNS extends plugin
     $smarty->assign("dhcp_is_Account",$this->dhcp_is_Account);
     $smarty->assign("dhcpParentNode", $this->dhcpParentNode);
     $smarty->assign("dhcpParentNodes",$this->dhcpParentNodes);
-
+    $smarty->assign("dhcpParentNodeCnt",count($this->dhcpParentNodes));
 
     /* There is no dns available 
      */
@@ -311,6 +311,7 @@ class termDNS extends plugin
 
       $smarty->assign("DNSAccount",$this->DNS_is_account);
       $smarty->assign("Zones",$this->Zones);
+      $smarty->assign("ZoneCnt",count($this->Zones));
       $smarty->assign("ZoneKeys",($this->Zones));
       $smarty->assign("IPisMust",(($this->IPisMust)||($this->DNS_is_account)));
 
@@ -415,8 +416,8 @@ class termDNS extends plugin
     /* Call common method to give check the hook */
     $message= plugin::check();
 
-    if($this->dhcpEnabled && $this->dhcpParentNode != "" && count($this->dhcpHostEntry) == 0){
-      $message[] =_("You haven not configured your dhcp settings yet.");
+    if($this->dhcpEnabled && $this->dhcp_is_Account && $this->dhcpParentNode != "" && count($this->dhcpHostEntry) == 0){
+      $message[] =_("You have not configured your dhcp settings yet.");
     }
 
     /* Check if ip must be given
@@ -765,22 +766,26 @@ class termDNS extends plugin
     while($attr = $ldap->fetch()){
       $dhcp_dns[$attr['dn']] = $attr['dhcpPrimaryDN'][0];
     }
-  
     foreach($dhcp_dns as $key => $pri_dns){
       $ldap->cat($pri_dns,array("cn"));
       $tmp = $ldap->fetch();
-      $dhcp_dns[$key] = $tmp['cn'][0];
+      if(isset($tmp['cn'][0])){
+        $dhcp_dns[$key] = $tmp['cn'][0];
+      }else{
+        unset($dhcp_dns[$key]);
+      }
     }
+
+    $tmp = $tmp2 = array();
     foreach($dhcp_dns as $dn => $cn){
       $ldap->cd($dn);
       $ldap->search("(|(objectClass=dhcpService)(objectClass=dhcpGroup)".
                     "(objectClass=dhcpSubnet)(objectClass=dhcpSharedNetwork))",array("cn"));
-      $tmp = array();
       while($attr = $ldap->fetch()){
         $tmp[$attr['dn']] = $attr['cn'][0];
       }
-      $tmp2 = $this->create_tree($tmp,preg_replace("/^[^,]+,/i","",$dn),"(".$cn.") ");
+      $tmp2 = array_merge($tmp2,$this->create_tree($tmp,preg_replace("/^[^,]+,/i","",$dn),"(".$cn.") "));
     }
     return($tmp2);
   }
@@ -789,7 +794,7 @@ class termDNS extends plugin
   /* this function returns the default ptr record entry */
   function get_pTRRecord()
   {
-    if(!empty($this->ipHostNumber) && isset($this->dnsEntry['zoneName'])){
+    if(!empty($this->ipHostNumber) && isset($this->dnsEntry['zoneName']) && !empty($this->dnsEntry['zoneName'])){
       $ldap = $this->config->get_ldap_link();
       $ldap->cat(getDNSZoneDN($this->config,$this->dnsEntry['zoneName']));
       $attrs = $ldap->fetch();