From c0509fbfd6a2b6debc0585560bce59fe923a488e Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 12 Sep 2007 07:23:40 +0000 Subject: [PATCH] Updated zone editor git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7275 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../systems/class_servDNSeditZoneEntries.inc | 66 ++++++++++++------- 1 file changed, 42 insertions(+), 24 deletions(-) diff --git a/plugins/admin/systems/class_servDNSeditZoneEntries.inc b/plugins/admin/systems/class_servDNSeditZoneEntries.inc index 30e268273..bb6213504 100644 --- a/plugins/admin/systems/class_servDNSeditZoneEntries.inc +++ b/plugins/admin/systems/class_servDNSeditZoneEntries.inc @@ -36,6 +36,10 @@ class servDNSeditZoneEntries extends plugin if(isset($this->RecordTypes['nSRecord'])){ unset($this->RecordTypes['nSRecord']); } + /* Remove nSRecord from listed types */ + if(isset($this->RecordTypes['pTRRecord'])){ + unset($this->RecordTypes['pTRRecord']); + } /* Get ldap connection */ @@ -63,8 +67,6 @@ class servDNSeditZoneEntries extends plugin { plugin::execute(); - - /* Fill templating stuff */ $smarty= get_smarty(); $display= ""; @@ -86,6 +88,7 @@ class servDNSeditZoneEntries extends plugin /* Check posts for operations ... */ $once = true; + $ptr_updates = array(); foreach($_POST as $name => $value){ /* Add a new Record in given object @@ -125,22 +128,6 @@ class servDNSeditZoneEntries extends plugin unset($this->Devices[$Name]['RECORDS'][$RecordID]); } } - - /* Add PTR record - */ - if((preg_match("/^AddPtr_/",$name)) && ($once)){ - $once = false; - if(isset($this->Devices[$Name]['RECORDS'][$RecordID])){ - $tmp = $this->Devices[$Name]['RECORDS'][$RecordID]; - $ip = $tmp['value']; - $match = preg_replace("/^[^\/]*+\//","",$this->reverseName); - $ip = preg_replace("/^".normalizePreg($match)."/","",$ip); - $ip = preg_replace("/^\./","",$ip); - $tmp['type'] = "pTRRecord"; - $tmp['value'] = $ip; - $this->Devices[$Name]['RECORDS'][] = $tmp; - } - } } /* Possible attributes posted @@ -161,7 +148,33 @@ class servDNSeditZoneEntries extends plugin */ if(preg_match("/ValueSelection_/",$name)){ if(isset($this->Devices[$Name]['RECORDS'][$RecordID])){ + + /* Update value */ + $old = $this->Devices[$Name]['RECORDS'][$RecordID]['value']; $this->Devices[$Name]['RECORDS'][$RecordID]['value'] = $value; + + /* Handle pTRRecord */ + if(!isset($ptr_updates[$Name]) && $this->Devices[$Name]['RECORDS'][$RecordID]['type'] == "aRecord"){ + + $found = false; + $ip = $value; + $match = preg_replace("/^[^\/]*+\//","",$this->reverseName); + $ip = preg_replace("/^".normalizePreg($match)."/","",$ip); + $ip = preg_replace("/^\./","",$ip); + + foreach($this->Devices[$Name]['RECORDS'] as $key => $dev){ + if($dev['type'] == "pTRRecord"){ + $ptr_updates[$Name] = $Name; + $this->Devices[$Name]['RECORDS'][$key]['value'] = $ip; + $found = true; + break; + } + } + if(!$found){ + $dev = array('type'=> 'pTRRecord', 'value' => $ip); + $this->Devices[$Name]['RECORDS'][] = $dev; + } + } } } @@ -396,6 +409,11 @@ class servDNSeditZoneEntries extends plugin $str.= ""; foreach($obj['RECORDS'] as $id => $record){ + /* Skip not selectable entries */ + if(!isset($this->RecordTypes [$record['type']])) { + continue; + } + /* Create unique post name */ $name = base64_encode($objKey)."|".$id; @@ -424,12 +442,12 @@ class servDNSeditZoneEntries extends plugin "; - if($record['type'] == "aRecord"){ - $str .=""; - }else{ - $str .= ""; - } +# if($record['type'] == "aRecord"){ +# $str .=""; +# }else{ +# $str .= ""; +# } $str.= " -- 2.30.2