diff --git a/plugins/admin/systems/class_servDNSeditZone.inc b/plugins/admin/systems/class_servDNSeditZone.inc
index 9ec9c3ad0f2f66e13381be7d68081eae4825507b..f8866b2defa0f5970a56d455ec87748b6178d77f 100644 (file)
var $isNew = true;
+ var $ZoneObject = array();
+
function servdnseditZone ($config, $dn= NULL,$attrs = array())
{
plugin::plugin ($config, $dn);
$this->InitialzoneName = "";//$attrs['InitialzoneName'];
$this->InitialReverseZone = "";//$attrs['InitialReverseZone'];
}else{
+ $this->ZoneObject = $attrs;
+
$this->OldZoneName = $attrs['zoneName'];
$this->OldReverseZone = $attrs['ReverseZone'];
$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
/* 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)){
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]]="";
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()
{