diff --git a/plugins/admin/systems/class_servDNSeditZone.inc b/plugins/admin/systems/class_servDNSeditZone.inc
index b60c9a55218d9c53346ac10fee401b854b71dfd3..d5df0871d9bbbb912ec1699716255342ccb2b451 100644 (file)
var $dialog = false;
+ var $zoneEditor = NULL;
+
var $isNew = true;
var $ZoneObject = array();
- function servdnseditZone ($config, $dn= NULL,$attrs = array())
+ function servdnseditZone (&$config, $dn= NULL,$attrs = array())
{
plugin::plugin ($config, $dn);
}else{
$this->ZoneObject = $attrs;
-
+ if(isset($attrs['zoneEditor'])){
+ $this->zoneEditor = $attrs['zoneEditor'];
+ }
$this->OldZoneName = $attrs['zoneName'];
$this->OldReverseZone = $attrs['ReverseZone'];
$tmp2[$tmp[0]] = $rec;
unset($this->Records[$key]);
}
+ if($rec['type'] == "nSRecord"){
+ unset($this->Records[$key]);
+ }
}
if(count($tmp2) != 0){
reset($tmp2);
/* Detect Network class */
if(!empty($this->ReverseZone)){
- $dots = count(split(".",$this->ReverseZone));
- if($dots == 0){
+ $dots = count(split("\.",$this->ReverseZone));
+ if($dots == 1){
$this->NetworkClass = "A";
$this->ReverseZone .= ".0.0.0";
- }elseif($dots == 1){
+ }elseif($dots == 2){
$this->NetworkClass = "B";
$this->ReverseZone .= ".0.0";
}else{
plugin::execute();
+
/* Fill templating stuff */
$smarty= get_smarty();
+ $ui = get_userinfo();
+
+ $smarty->assign("ACLs",$this->parent->getacl(""));
$display= "";
/* Open Zone Entry Edit Dialog
}else{
$smarty->assign("AllowZoneEdit" , true);
if(isset($_POST['EditZoneEntries'])){
- $this->dialog= new servDNSeditZoneEntries($this->config,$this->dn,$this->ZoneObject);
+ if($this->zoneEditor == NULL){
+ $this->zoneEditor= new servDNSeditZoneEntries($this->config,$this->dn,$this->ZoneObject);
+ $this->zoneEditor->parent = $this;
+ }
+ $this->dialog = $this->zoneEditor;
}
}
print_red($msg);
}
}else{
- $this->dialog->save();
- $this->dialog = false;
+ $this->zoneEditor = clone $this->dialog;
+ $this->dialog = FALSE;
+# $rev = FlipIp(getNameFromMix($this->InitialReverseZone)).".in-addr.arpa";
+# $for = getNameFromMix($this->InitialzoneName);
+#
+# $this->parent->handle_post_events("modify",array("dn" => $this->dn,"zoneName" => $rev));
+# $this->parent->handle_post_events("modify",array("dn" => $this->dn,"zoneName" => $for));
+# $this->dialog = false;
}
}
/* Display any type of open dialogs
*/
- if($this->dialog){
+ if(is_object($this->dialog)){
$this->dialog->save_object();
return($this->dialog->execute());
}
}
- $div = new DivSelectBox("MxRecords");
+ $div = new divSelectBox("MxRecords");
$div->setHeight(120);
$recs = $this->mXRecords;
}
/* 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.");
switch($this->NetworkClass){
case 'A': {
if(!preg_match("/^[0-9]*\.0\.0\.0$/",$addr)){
- $message[] = sprintf(_("The specified network address is not matching with the specified zone class, try it this was x.0.0.0"));
+ $message[] = sprintf(_("The specified network address is not matching with the specified zone class, try it this way x.0.0.0"));
}
}
break;
case 'B': {
if(!preg_match("/^[0-9]*\.[0-9]*\.0\.0$/",$addr)){
- $message[] = sprintf(_("The specified network address is not matching with the specified zone class, try it this was x.x.0.0"));
+ $message[] = sprintf(_("The specified network address is not matching with the specified zone class, try it this way x.x.0.0"));
}
}
break;
case 'C': {
if(!preg_match("/^[0-9]*\.[0-9]*\.[0-9]*\.0$/",$addr)){
- $message[] = sprintf(_("The specified network address is not matching with the specified zone class, try it this was x.x.x.0"));
+ $message[] = sprintf(_("The specified network address is not matching with the specified zone class, try it this way x.x.x.0"));
}
}
break;
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']) ;
+
+ $ret['zoneEditor'] = $this->zoneEditor;
return($ret);
}