From be0cb1e405fae1daf1eeb6963c31ce2aaefb26de Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 29 Jun 2009 09:46:59 +0000 Subject: [PATCH] Updated dhcp class -Use the same way to store statements like used to store options. -No array Merge anymore. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13814 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../services/dhcp/class_dhcpAdvanced.inc | 31 ++++++----- .../systems/services/dhcp/class_dhcpGroup.inc | 31 ++++------- .../systems/services/dhcp/class_dhcpHost.inc | 23 ++------ .../services/dhcp/class_dhcpNetwork.inc | 36 +++++-------- .../services/dhcp/class_dhcpPlugin.inc | 48 ++++------------- .../systems/services/dhcp/class_dhcpPool.inc | 11 ---- .../services/dhcp/class_dhcpService.inc | 53 ++++++------------- .../services/dhcp/class_dhcpSharedNetwork.inc | 52 +++++++----------- .../services/dhcp/class_dhcpSubnet.inc | 11 ---- 9 files changed, 94 insertions(+), 202 deletions(-) diff --git a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpAdvanced.inc b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpAdvanced.inc index 46eda0f6e..1f40f9a6e 100644 --- a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpAdvanced.inc +++ b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpAdvanced.inc @@ -22,7 +22,7 @@ class dhcpAdvanced extends plugin { /* Used attributes */ var $options= null; - var $statements= array(); + var $statements= null; var $show_advanced= FALSE; var $autoStatements= array(); var $autoOptions= array(); @@ -48,14 +48,15 @@ class dhcpAdvanced extends plugin if ($acl_writeable && isset($_POST['add_statement']) && $_POST['addstatement'] != ""){ $key= preg_replace('/^([a-z0-9-]+)\s(.*)$/', '\\1', get_post('addstatement')); $val= preg_replace("/^$key\s*/", '', get_post('addstatement')); - $this->statements[$key]= $val; + $this->statements->add($key,$val); } if ($acl_writeable && isset($_POST['delete_statement']) && isset($_POST['dhcpstatements'])){ - $key= preg_replace('/([a-z0-9-]+)\s(.*)$/', '\\1', get_post('dhcpstatements')); - if (in_array($key, $this->autoStatements)){ - msg_dialog::display(_("Error"), _("Cannot delete automatic statements!"), ERROR_DIALOG); + $name = preg_replace('/_[0-9]*$/', '', get_post('dhcpstatements')); + $key = preg_replace('/^.*_/', '', get_post('dhcpstatements')); + if (in_array($name, $this->autoStatements)){ + msg_dialog::display(_("Error"), _("Cannot delete automatic statements!"), ERROR_DIALOG); } else { - unset($this->statements[$key]); + $this->statements->remove($name,$key); } } if ($acl_writeable && isset($_POST['add_option']) && $_POST['addoption'] != ""){ @@ -75,19 +76,25 @@ class dhcpAdvanced extends plugin $smarty= get_smarty(); - /* Assign ACLs */ - $smarty->assign("acl",$this->parent->getacl("")); + /* Assign ACLs */ + $smarty->assign("acl",$this->parent->getacl("")); - /* Assign arrays */ + /* Assign statements */ $statements= array(); - foreach ($this->statements as $key => $val){ + foreach ($this->statements->getAll() as $key => $val){ if (in_array($key, $this->autoStatements)){ - $statements[$key]= "$key $val ["._("automatic")."]"; + foreach($val as $id => $entry){ + $statements[$key."_".$id]= "$key $entry ["._("automatic")."]"; + } } else { - $statements[$key]= "$key $val"; + foreach($val as $id => $entry){ + $statements[$key."_".$id]= "$key $entry"; + } } } $smarty->assign("dhcpstatements", $statements); + + /* Assign options */ $options= array(); foreach ($this->options->getAll() as $key => $val){ if (in_array($key, $this->autoOptions)){ diff --git a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpGroup.inc b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpGroup.inc index 29148fdf9..809a1cba0 100644 --- a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpGroup.inc +++ b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpGroup.inc @@ -34,32 +34,21 @@ class dhcpGroup extends dhcpPlugin $smarty= get_smarty(); $smarty->assign("cn", $this->cn); - /* Assign ACLs */ - $smarty->assign("acl",$this->parent->getacl("")); + /* Assign ACLs */ + $smarty->assign("acl",$this->parent->getacl("")); /* Show main page */ - $display= $smarty->fetch (get_template_path('dhcp_group.tpl', TRUE, dirname(__FILE__))).$this->network->execute(); - - /* Merge arrays for advanced view */ - foreach (array("statements") as $type){ - $this->advanced->$type= $this->$type + $this->network->$type; - } - + $display= $smarty->fetch (get_template_path('dhcp_group.tpl', TRUE, + dirname(__FILE__))).$this->network->execute(); $display.= $this->advanced->execute(); - /* Merge back for removals */ - foreach (array("statements") as $type){ - $this->$type= $this->advanced->$type; - $this->network->$type= $this->advanced->$type; + /* Add footer */ + $display.= "
"; + if(preg_match("/w/",$this->parent->getacl(""))){ + $display.= " "; } - - /* Add footer */ - $display.= "
"; - if(preg_match("/w/",$this->parent->getacl(""))){ - $display.= " "; - } - $display.= ""; - $display.= "
"; + $display.= ""; + $display.= "
"; return ($display); } diff --git a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpHost.inc b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpHost.inc index 12f4f559e..c3168ada7 100644 --- a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpHost.inc +++ b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpHost.inc @@ -39,7 +39,7 @@ class dhcpHost extends dhcpPlugin $this->advanced->setAutoOptions(array("host-name")); $this->advanced->setAutoStatements(array("fixed-address")); - $this->realGosaHost = $host_exists_in_gosa; + $this->realGosaHost = $host_exists_in_gosa; } function execute() @@ -53,11 +53,7 @@ class dhcpHost extends dhcpPlugin $smarty->assign("acl",$this->parent->getacl("")); /* Create fixed address */ - if (isset($this->statements['fixed-address'])){ - $smarty->assign("fixedaddr", $this->statements['fixed-address']); - } else { - $smarty->assign("fixedaddr", ""); - } + $smarty->assign("fixedaddr", $this->statements->get('fixed-address')); /* Prepare hw type selector */ $hwtype= preg_replace('/\s.*$/', '', $this->dhcpHWAddress); @@ -68,18 +64,9 @@ class dhcpHost extends dhcpPlugin /* Show main page */ $display= $smarty->fetch(get_template_path('dhcp_host.tpl', TRUE,dirname(__FILE__))).$this->network->execute(); - /* Merge arrays for advanced view */ - foreach (array("statements") as $type){ - $this->advanced->$type= $this->$type + $this->network->$type; - } + /* Get advanced options */ $display.= $this->advanced->execute(); - /* Merge back for removals */ - foreach (array("statements") as $type){ - $this->$type= $this->advanced->$type; - $this->network->$type= $this->advanced->$type; - } - /* Add footer */ $display.= "
"; # if(preg_match("/w/",$this->parent->getacl(""))){ @@ -115,9 +102,9 @@ class dhcpHost extends dhcpPlugin /* Save fixed address */ if(!$this->realGosaHost){ if ($_POST['fixedaddr'] != ""){ - $this->statements['fixed-address']= get_post('fixedaddr'); + $this->statements->set('fixed-address', get_post('fixedaddr')); } else { - unset ($this->statements['fixed-address']); + $this->statements->removeAll('fixed-address'); } } $this->options->set('host-name',$this->cn); diff --git a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpNetwork.inc b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpNetwork.inc index a1980bf15..44227cb2b 100644 --- a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpNetwork.inc +++ b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpNetwork.inc @@ -22,7 +22,7 @@ class dhcpNetwork extends plugin { /* Used attributes */ var $options= null; - var $statements= array(); + var $statements= null; /* attribute list for save action */ var $attributes= array(); @@ -106,27 +106,19 @@ class dhcpNetwork extends plugin $smarty->assign("broadcast_address", $this->options->get('broadcast-address')); /* Boot stuff */ - if (isset($this->statements['filename'])){ - $smarty->assign("filename", trim($this->statements['filename'], '"')); - } else { - $smarty->assign("filename", ""); - } - if (isset($this->statements['next-server'])){ - $smarty->assign("nextserver", $this->statements['next-server']); - } else { - $smarty->assign("nextserver", ""); - } + $smarty->assign("filename", $this->statements->get('filename')); + $smarty->assign("nextserver", $this->statements->get('next-server')); /* Set flags */ $smarty->assign("autohost", ""); - if (isset($this->statements['get-lease-hostnames'])){ - if (preg_match('/^(true|on|yes)$/', $this->statements['get-lease-hostnames'])){ + if ($this->statements->exists('get-lease-hostnames')){ + if (preg_match('/^(true|on|yes)$/', $this->statements->get('get-lease-hostnames'))){ $smarty->assign("autohost", "checked"); } } $smarty->assign("autohostdecl", ""); - if (isset($this->statements['use-host-decl-names'])){ - if (preg_match('/^(true|on|yes)$/', $this->statements['use-host-decl-names'])){ + if ($this->statements->exists('use-host-decl-names')){ + if (preg_match('/^(true|on|yes)$/', $this->statements->get('use-host-decl-names'))){ $smarty->assign("autohostdecl", "checked"); } } @@ -162,28 +154,28 @@ class dhcpNetwork extends plugin /* Statements */ foreach (array("filename" => "filename", "next-server" => "nextserver") as $key => $val){ if ($_POST["$val"] == ''){ - unset($this->statements["$key"]); + $this->statements->removeAll($key); } else { /* Only quote filename values */ if(in_array($key,array("filename"))){ - $this->statements["$key"]= '"'.get_post("$val").'"'; + $this->statements->set($key,'"'.trim(get_post($val),"\"").'"'); }else{ - $this->statements["$key"]= get_post("$val"); + $this->statements->set($key,get_post($val)); } } } /* Flags */ if (isset ($_POST['autohost'])){ - $this->statements['get-lease-hostnames']= "true"; + $this->statements->set('get-lease-hostnames',"true"); } else { - unset($this->statements['get-lease-hostnames']); + $this->statements->removeAll('get-lease-hostnames'); } if (isset ($_POST['autohostdecl'])){ - $this->statements['use-host-decl-names']= "on"; + $this->statements->set('use-host-decl-names', "on"); } else { - unset($this->statements['use-host-decl-names']); + $this->statements->removeAll('use-host-decl-names'); } } } diff --git a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpPlugin.inc b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpPlugin.inc index f0e3f8dc5..bef932108 100644 --- a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpPlugin.inc +++ b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpPlugin.inc @@ -39,6 +39,7 @@ class dhcpPlugin extends plugin $this->parent = $parent; $this->options = new dhcpOption(); + $this->statements = new dhcpOption(); /* Load statements / options */ if (is_array($attrs)){ @@ -55,19 +56,8 @@ class dhcpPlugin extends plugin /* Load statements */ if (isset($attrs['dhcpStatements'])){ - foreach ($attrs['dhcpStatements'] as $opt){ - $idx= preg_replace('/\s.+$/', '', $opt); - if ($idx == $opt){ - $value= ""; - } else { - $value= preg_replace('/^[^\s]+\s/', '', $opt); - } - - if(preg_match("/^allow\s/",$opt) || preg_match("/^deny\s/",$opt)){ - $this->statements[$opt]= ""; - }else{ - $this->statements[$idx]= $value; - } + foreach($attrs['dhcpStatements'] as $opt){ + $this->statements->add(trim($opt)); } } } else { @@ -79,10 +69,10 @@ class dhcpPlugin extends plugin /* Load network module */ $this->network= new dhcpNetwork(); $this->network->options= &$this->options; - $this->network->statements= $this->statements; + $this->network->statements= &$this->statements; $this->advanced= new dhcpAdvanced(); $this->advanced->options= &$this->options; - $this->advanced->statements= $this->statements; + $this->advanced->statements= &$this->statements; $this->network->parent = $parent; $this->advanced->parent = $parent; @@ -105,18 +95,14 @@ class dhcpPlugin extends plugin /* Save data to object */ function save_object() { - foreach (array("filename", "next-server","get-lease-hostnames","use-host-decl-names") as $toberemoved){ - unset($this->statements[$toberemoved]); - } + # // CHECK + # foreach (array("filename", "next-server","get-lease-hostnames","use-host-decl-names") as $toberemoved){ + # unset($this->statements[$toberemoved]); + # } /* Save sub-objects */ $this->network->save_object(); $this->advanced->save_object(); - - /* Merge arrays for advanced view */ - foreach (array("statements") as $type){ - $this->advanced->$type= $this->$type + $this->network->$type;; - } } @@ -131,11 +117,6 @@ class dhcpPlugin extends plugin /* Save to LDAP */ function save() { - /* Merge arrays for network and advanced view */ - foreach (array("statements") as $type){ - $this->$type= $this->$type + $this->network->$type + $this->advanced->$type; - } - /* Add cn if we're new */ if ($this->new){ $this->dn= "cn=".$this->cn.",".$this->dn; @@ -147,16 +128,7 @@ class dhcpPlugin extends plugin $this->attrs['dhcpOption']= $this->options->save(); /* Assemble new entry - statements */ - $this->attrs['dhcpStatements']= array(); - if (isset ($this->statements) && count ($this->statements)){ - foreach ($this->statements as $key => $val){ - if ($val != ""){ - $this->attrs['dhcpStatements'][]= "$key $val"; - } else { - $this->attrs['dhcpStatements'][]= "$key"; - } - } - } + $this->attrs['dhcpStatements']= $this->statements->save(); /* Move dn to the result */ $this->attrs['dn']= $this->dn; diff --git a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpPool.inc b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpPool.inc index 4d0a5c791..96870e7c5 100644 --- a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpPool.inc +++ b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpPool.inc @@ -55,19 +55,8 @@ class dhcpPool extends dhcpPlugin /* Show main page */ $display= $smarty->fetch(get_template_path('dhcp_pool.tpl', TRUE, dirname(__FILE__))).$this->network->execute(); - /* Merge arrays for advanced view */ - foreach (array("statements") as $type){ - $this->advanced->$type= $this->$type + $this->network->$type;; - } - $display.= $this->advanced->execute(); - /* Merge back for removals */ - foreach (array("statements") as $type){ - $this->$type= $this->advanced->$type; - $this->network->$type= $this->advanced->$type; - } - /* Add footer */ $display.= "
"; if(preg_match("/w/",$this->parent->getacl(""))){ diff --git a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpService.inc b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpService.inc index 36ca95763..925e6ac50 100644 --- a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpService.inc +++ b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpService.inc @@ -39,14 +39,15 @@ class dhcpService extends dhcpPlugin $this->dhcpPrimaryDN= $attrs['dhcpPrimaryDN'][0]; } else { /* We keep the parent dn here if it's new */ - $this->statements['default-lease-time']= 600; - $this->statements['max-lease-time']= 1700; - $this->statements['authoritative']= TRUE; - $this->statements['ddns-update-style']= 'none'; + $this->statements->set('default-lease-time', 600); + $this->statements->set('max-lease-time', 1700); + $this->statements->set('authoritative', TRUE); + $this->statements->set('ddns-update-style', 'none'); } - $this->advanced->setAutoStatements(array("default-lease-time", "max-lease-time", "authoritative", "server-identifier", "ddns-update-style")); $this->advanced->setAutoOptions(array("server-name")); + $this->advanced->setAutoStatements(array("default-lease-time", "max-lease-time", + "authoritative", "server-identifier", "ddns-update-style")); /* Save for later action */ $this->orig_dhcpPrimaryDN= $this->dhcpPrimaryDN; @@ -63,35 +64,16 @@ class dhcpService extends dhcpPlugin $smarty->assign('ddns_styles', $this->ddns_styles); foreach (array('max_lease_time', 'default_lease_time', 'ddns_update_style') as $value){ - if (isset($this->statements[preg_replace('/_/', '-', $value)])){ - $smarty->assign("$value", $this->statements[preg_replace('/_/', '-', $value)]); - } else { - $smarty->assign("$value", ""); - } + $smarty->assign("$value", $this->statements->get(preg_replace('/_/', '-', $value))); } - if (isset($this->statements['authoritative'])){ - $smarty->assign("authoritative", "checked"); - } else { - $smarty->assign("authoritative", ""); - } + $smarty->assign("authoritative", $this->statements->get('authoritative')); /* Show main page */ $display= $smarty->fetch(get_template_path('dhcp_service.tpl', TRUE, dirname(__FILE__))).$this->network->execute(); - /* Merge arrays for advanced view */ - foreach (array("statements") as $type){ - $this->advanced->$type= $this->$type + $this->network->$type;; - } - $display.= $this->advanced->execute(); - /* Merge back for removals */ - foreach (array("statements") as $type){ - $this->$type= $this->advanced->$type; - $this->network->$type= $this->advanced->$type; - } - /* Add footer */ $display.= "
"; if(preg_match("/w/",$this->parent->getacl(""))){ @@ -119,15 +101,15 @@ class dhcpService extends dhcpPlugin foreach (array('max_lease_time', 'default_lease_time', 'ddns_update_style') as $val){ $tval= preg_replace('/_/', '-', $val); if ($_POST[$val] != ""){ - $this->statements[$tval]= validate(get_post($val)); + $this->statements->set($tval,validate(get_post($val))); } else { - unset ($this->statements[$tval]); + $this->statements->removeAll($tval); } } if (isset($_POST['authoritative'])){ - $this->statements['authoritative']= ""; + $this->statements->set('authoritative', ""); } else { - unset($this->statements['authoritative']); + $this->statements->removeAll('authoritative'); } } @@ -140,13 +122,13 @@ class dhcpService extends dhcpPlugin { $message= array(); - if (!tests::is_id($this->statements['default-lease-time'])){ - $message[]= msgPool::invalid(_("Lease time"),$this->statements['default-lease-time'],"/[0-9]/"); + if (!tests::is_id($this->statements->get('default-lease-time'))){ + $message[]= msgPool::invalid(_("Lease time"),$this->statements->get('default-lease-time'),"/[0-9]/"); } - if (!tests::is_id($this->statements['max-lease-time'])){ - $message[]= msgPool::invalid(_("Max lease time"),$this->statements['max-lease-time'],"/[0-9]/"); + if (!tests::is_id($this->statements->get('max-lease-time'))){ + $message[]= msgPool::invalid(_("Max lease time"),$this->statements->get('max-lease-time'),"/[0-9]/"); } - if ($this->statements['default-lease-time'] > $this->statements['max-lease-time']){ + if ($this->statements->get('default-lease-time') > $this->statements->get('max-lease-time')){ $message[]= msgPool::toobig(_("Default lease time"),_("Maximum lease time")); } @@ -154,7 +136,6 @@ class dhcpService extends dhcpPlugin $net= $this->network->check(); $adv= $this->advanced->check(); $message= array_merge($message, $net, $adv); - return $message; } diff --git a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpSharedNetwork.inc b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpSharedNetwork.inc index b60ebdd33..6f7964832 100644 --- a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpSharedNetwork.inc +++ b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpSharedNetwork.inc @@ -44,28 +44,25 @@ class dhcpSharedNetwork extends dhcpPlugin /* Fill template */ $smarty->assign ("cn", $this->cn); foreach (array("server-identifier", "default-lease-time", "max-lease-time", "min-lease-time") as $attr){ - if (isset($this->statements[$attr])){ - $smarty->assign(preg_replace('/-/', '_', $attr), $this->statements[$attr]); - } else { - $smarty->assign(preg_replace('/-/', '_', $attr), ""); - } + $name = preg_replace('/-/', '_', $attr); + $smarty->assign($name, $this->statements->get($attr)); } - if (isset($this->statements["authoritative"])){ + if ($this->statements->exists("authoritative")){ $smarty->assign("authoritative", "checked"); } else { $smarty->assign("authoritative", ""); } - if (!isset($this->statements["deny unknown-clients"])){ + if (!$this->statements->exists("deny unknown-clients")){ $smarty->assign("allow_unknown_state", "checked"); } else { $smarty->assign("allow_unknown_state", ""); } - if (!isset($this->statements["deny bootp"])){ + if (!$this->statements->exists("deny bootp")){ $smarty->assign("allow_bootp_state", "checked"); } else { $smarty->assign("allow_bootp_state", ""); } - if (!isset($this->statements["deny booting"])){ + if (!$this->statements->exists("deny booting")){ $smarty->assign("allow_booting_state", "checked"); } else { $smarty->assign("allow_booting_state", ""); @@ -79,24 +76,13 @@ class dhcpSharedNetwork extends dhcpPlugin foreach(array("deny unknown-clients", "deny bootp", "deny booting", "allow unknown-clients", "allow bootp", "allow booting") as $name){ - if(isset($this->advanced->statements[$name])){ - unset($this->advanced->statements[$name]); - unset($this->network->statements[$name]); + if($this->statements->exists($name)){ + $this->statements->remove($name); } } - foreach (array("statements") as $type){ - $this->advanced->$type= $this->$type + $this->network->$type; - } - $display.= $this->advanced->execute(); - /* Merge back for removals */ - foreach (array("statements") as $type){ - $this->$type= $this->advanced->$type; - $this->network->$type= $this->advanced->$type; - } - /* Add footer */ $display.= "
"; if(preg_match("/w/",$this->parent->getacl(""))){ @@ -129,25 +115,25 @@ class dhcpSharedNetwork extends dhcpPlugin foreach (array("server-identifier", "default-lease-time", "max-lease-time", "min-lease-time") as $attr){ if (isset($_POST[$attr]) && $_POST[$attr] != ""){ - $this->statements[$attr]= get_post($attr); + $this->statements->set($attr,get_post($attr)); } else { - unset($this->statements[$attr]); + $this->statements->removeAll($attr); } } if (isset($_POST["authoritative"])){ - $this->statements["authoritative"]= ""; + $this->statements->set("authoritative", ""); } else { - unset ($this->statements["authoritative"]); + $this->statements->removeAll("authoritative"); } foreach(array("unknown-clients", "bootp", "booting") as $name){ if (isset($_POST[$name])){ - $this->statements["allow $name"]= ""; - unset($this->statements["deny $name"]); + $this->statements->removeAll("deny $name"); + $this->statements->set("allow $name",""); } else { - $this->statements["deny $name"]= ""; - unset($this->statements["allow $name"]); + $this->statements->removeAll("allow $name"); + $this->statements->set("deny $name",""); } } } @@ -170,9 +156,9 @@ class dhcpSharedNetwork extends dhcpPlugin foreach (array("default-lease-time" => _("Default lease time"), "max-lease-time" => _("Max. lease time"), "min-lease-time" => _("Min. lease time")) as $key => $val){ - if (isset($this->statements[$key]) && $this->statements[$key] != "" && - !tests::is_id($this->statements[$key])){ - $message[]= msgPool::invalid($val,$this->statements[$key],"/[0-9]/"); + if ($this->statements->exists($key) && $this->statements->get($key) != "" && + !tests::is_id($this->statements->get($key))){ + $message[]= msgPool::invalid($val,$this->statements->get($key),"/[0-9]/"); } } diff --git a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpSubnet.inc b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpSubnet.inc index 1a900cdf6..8a8131c15 100644 --- a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpSubnet.inc +++ b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpSubnet.inc @@ -74,19 +74,8 @@ class dhcpSubnet extends dhcpPlugin /* Show main page */ $display= $smarty->fetch(get_template_path('dhcp_subnet.tpl', TRUE, dirname(__FILE__))).$this->network->execute(); - /* Merge arrays for advanced view */ - foreach (array("statements") as $type){ - $this->advanced->$type= $this->$type + $this->network->$type; - } - $display.= $this->advanced->execute(); - /* Merge back for removals */ - foreach (array("statements") as $type){ - $this->$type= $this->advanced->$type; - $this->network->$type= $this->advanced->$type; - } - /* Add footer */ $display.= "
"; if(preg_match("/w/",$this->parent->getacl(""))){ -- 2.30.2