X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fsystems%2Fclass_servDNSeditZone.inc;h=4d499e951f9f8b419ba6d0ee28aa1cdb3595eedf;hb=7a6a428eb1c6534e448094d51bc6a542fe832bb9;hp=9ec9c3ad0f2f66e13381be7d68081eae4825507b;hpb=da27c0bde3991ad4e9939b3d79ecfbec72cdd152;p=gosa.git diff --git a/plugins/admin/systems/class_servDNSeditZone.inc b/plugins/admin/systems/class_servDNSeditZone.inc index 9ec9c3ad0..4d499e951 100644 --- a/plugins/admin/systems/class_servDNSeditZone.inc +++ b/plugins/admin/systems/class_servDNSeditZone.inc @@ -40,6 +40,8 @@ class servdnseditZone extends plugin var $isNew = true; + var $ZoneObject = array(); + function servdnseditZone ($config, $dn= NULL,$attrs = array()) { plugin::plugin ($config, $dn); @@ -56,6 +58,8 @@ class servdnseditZone extends plugin $this->InitialzoneName = "";//$attrs['InitialzoneName']; $this->InitialReverseZone = "";//$attrs['InitialReverseZone']; }else{ + $this->ZoneObject = $attrs; + $this->OldZoneName = $attrs['zoneName']; $this->OldReverseZone = $attrs['ReverseZone']; @@ -174,11 +178,15 @@ class servdnseditZone extends plugin $smarty= get_smarty(); $display= ""; - /* Open Zone Entry Edit Dialog */ - if(isset($_POST['EditZoneEntries'])){ - $this->dialog= new servDNSeditZoneEntries($this->config,$this->dn,$this->InitialzoneName,$this->FlipIp($this->InitialReverseZone)); + if(!count($this->ZoneObject)){ + $smarty->assign("AllowZoneEdit" , false); + }else{ + $smarty->assign("AllowZoneEdit" , true); + if(isset($_POST['EditZoneEntries'])){ + $this->dialog= new servDNSeditZoneEntries($this->config,$this->dn,$this->ZoneObject); + } } /* Save Zone Entry Edit Dialog @@ -333,16 +341,26 @@ class servdnseditZone extends plugin /* Check supplied data */ function check() { - $message= array(); + /* Call common method to give check the hook */ + $message= plugin::check(); + /* Check if zoneName is already in use */ $usedZones = $this->getUsedZoneNames(); if(($this->isNew == true)||($this->zoneName != $this->InitialzoneName)||($this->ReverseZone != $this->InitialReverseZone)){ - if((isset($usedZones[$this->zoneName]))&&($this->zoneName != $this->InitialzoneName)){ + /* if((isset($usedZones[$this->zoneName]))&&($this->zoneName != $this->InitialzoneName)){ $message[] =_("This zoneName is already in use"); } if((in_array($this->ReverseZone,$usedZones))&&($this->ReverseZone != $this->InitialReverseZone)){ $message[] =_("This reverse zone is already in use"); - } + }*/ + } + + if(empty($this->zoneName)){ + $message[] =sprintf(_("Please choose a valid zone name.")); + } + + if(empty($this->ReverseZone)){ + $message[] =sprintf(_("Please choose a valid reverse zone name.")); } if(!preg_match("/\.$/",$this->sOAprimary)){ @@ -405,7 +423,7 @@ class servdnseditZone extends plugin if(preg_match("/in-addr\.arpa/",$attr['zoneName'][0])){ if(isset($attr['tXTRecord'][0])){ $zn = preg_replace("/zoneName\=/","",$attr['tXTRecord'][0]); - $ret[$zn] = $this->FlipIp(preg_replace("/\.in-addr\.arpa/","",$attr['zoneName'][0])); + $ret[$zn] =FlipIp(preg_replace("/\.in-addr\.arpa/","",$attr['zoneName'][0])); } }else{ $ret[$attr['zoneName'][0]]=""; @@ -414,22 +432,6 @@ class servdnseditZone extends plugin return($ret); } - /* this is used to flip the ip address for example - 12.3.45 -> 54.3.12 - Because some entries (like zones) are store like that 54.3.12.in-addr.arpa - but we want to display 12.3.45. - */ - function FlipIp($ip) - { - $tmp = array_reverse(split("\.",$ip)); - $new = ""; - foreach($tmp as $section){ - $new .= $section."."; - } - return(preg_replace("/.$/","",$new)); - } - - /* Save to LDAP */ function save() {