Code

Updated trunk dns plugins.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 28 Aug 2007 13:55:19 +0000 (13:55 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 28 Aug 2007 13:55:19 +0000 (13:55 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7157 594d385d-05f5-0310-b6e9-bd551577e9d8

include/functions_dns.inc
plugins/admin/systems/class_servDNS.inc
plugins/admin/systems/class_servDNSeditZone.inc

index f24ec32473c67c3d1415e0ff87a0bdffc832efa6..42f0519647412c8e4c6efa0ee0bd5f1c4fdad17f 100644 (file)
@@ -247,6 +247,7 @@ function getDNSZoneEntriesDiff($config,$newZones,$HostDn)
       $soa.=" ".$zone[$attr];
     }  
     $obj['sOARecord'] = trim($soa);
+    $obj['nSRecord'] = $zone['sOAprimary'];
 
     /* If reverse zone was renamed, move entry 
      */
@@ -273,6 +274,9 @@ function getDNSZoneEntriesDiff($config,$newZones,$HostDn)
     /* Add new Records 
      */
     foreach($zone['RECORDS'] as $rec){
+      if(!isset($obj[$rec['type']])||!is_array($obj[$rec['type']])){
+        $obj[$rec['type']] = array();
+      }
       $obj[$rec['type']][] = $rec['value'];
     }
 
@@ -567,7 +571,7 @@ function getDNSHostEntriesDiff($config,$oldName,$newEntry,$newName)
       $ptrObj = $baseObj;
       $reverseName = getNameFromMix($reverseNameMix);
       $ptrObj['zoneName']           = $reverseName;
-      $ptrObj['pTRRecord']          = $newName.".".$zoneName.".";
+      $ptrObj['pTRRecord']          = preg_replace("/\.\.$/",".",$newName.".".$zoneName.".");
       $ptrObj['relativeDomainName'] = $rec['value'];
     
       $add[$PTRdn] = $ptrObj;
index d2ebb5d8e091ed5578c872220dbbdf5c763975c7..34af08f036d34feaa0d3c684b86d4427693ea521 100644 (file)
@@ -157,6 +157,13 @@ class servdns extends goService
       }
     }
 
+    if(isset($_GET['act']) && $_GET['act'] == "edit" && isset($_GET['id'])){
+      $id = base64_decode($_GET['id']);
+      if(isset($this->Zones[$id])){
+         $this->dialog= new servdnseditZone($this->config,$this->dn,$this->Zones[$id]);
+      }
+    }
+
     /* Show dialog 
      */
     if($this->dialog!= NULL){
@@ -177,10 +184,9 @@ class servdns extends goService
 
     $link = "<a href='?plug=".$_GET['plug']."&act=edit&id=%s'>%s</a>";
     foreach($this->Zones as $zone => $values ){
-
       $ZoneList->AddEntry(array(
-            array("string" => sprintf($link,base64_encode($zone),$zone)),
-            array("string" => sprintf($link,base64_encode($zone),_("Reverse zone")." : ".$values['ReverseZone'])),
+            array("string" => sprintf($link,base64_encode($zone),($zone))),
+            array("string" => sprintf($link,base64_encode($zone),_("Reverse zone")." : ".($values['ReverseZone']))),
             array("string" => _("TTL")." : ".$values['sOAttl']),
             array("string" => _("Class")." : ".$values['dNSClass']),
             array("string" =>str_replace("%s",base64_encode($zone),$editImg))
index af3803fe2f801f00adf917d527a67c9c3a80d2c5..500739c2de922f341798d697f82088087a136dad 100644 (file)
@@ -91,6 +91,9 @@ class servdnseditZone extends plugin
             $tmp2[$tmp[0]] = $rec;
             unset($this->Records[$key]);
           }
+          if($rec['type'] == "nSRecord"){
+            unset($this->Records[$key]);
+          }
         }
         if(count($tmp2) != 0){
           reset($tmp2);
@@ -424,8 +427,8 @@ class servdnseditZone extends plugin
     }
 
     /* Check class for given Zone Address */
-    $addr = preg_replace("/^[^\/]+\//","",$this->ReverseZone);
-
+    $addr = preg_replace("/^[^\/]*+\//","",$this->ReverseZone);
+  
     /* Check for valid&complete IP address */
     if(!is_ip($addr)){
       $message[] = _("The given network address is not a valid, please specify a valid IP address.");
@@ -509,10 +512,13 @@ class servdnseditZone extends plugin
 
     foreach(array("sOAprimary","zoneName","sOAmail") as $attr){
       if(!preg_match("/\.$/",$ret[$attr])){
-        $ret[$attr] = $ret[$attr].".";
+        if(!is_ip($ret[$attr])){
+          $ret[$attr] = $ret[$attr].".";
+        }
       }
     }
 
+    $ret['RECORDS'][] = array("type" => "nSRecord","value" => $ret['sOAprimary']) ;
     return($ret);
   }