From: hickert Date: Thu, 9 Aug 2007 11:00:39 +0000 (+0000) Subject: Updated Post handling X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d8558fa1d5166165f79c75288471a00992d0d6cd;p=gosa.git Updated Post handling git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@7028 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/systems/class_dhcpAdvanced.inc b/plugins/admin/systems/class_dhcpAdvanced.inc index 271c4ed6e..74094f73c 100644 --- a/plugins/admin/systems/class_dhcpAdvanced.inc +++ b/plugins/admin/systems/class_dhcpAdvanced.inc @@ -43,12 +43,12 @@ class dhcpAdvanced extends plugin { /* Check for interaction */ if (isset($_POST['add_statement']) && $_POST['addstatement'] != ""){ - $key= preg_replace('/^([a-z0-9-]+)\s(.*)$/', '\\1', $_POST['addstatement']); - $val= preg_replace("/^$key\s*/", '', $_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; } if (isset($_POST['delete_statement']) && isset($_POST['dhcpstatements'])){ - $key= preg_replace('/([a-z0-9-]+)\s(.*)$/', '\\1', $_POST['dhcpstatements']); + $key= preg_replace('/([a-z0-9-]+)\s(.*)$/', '\\1', get_post('dhcpstatements')); if (in_array($key, $this->autoStatements)){ print_red(_("Can't delete automatic statements. Please use the fields above.")); } else { @@ -56,12 +56,12 @@ class dhcpAdvanced extends plugin } } if (isset($_POST['add_option']) && $_POST['addoption'] != ""){ - $key= preg_replace('/^([a-z0-9-]+)\s(.*)$/', '\\1', $_POST['addoption']); - $val= preg_replace("/^$key\s*/", '', $_POST['addoption']); + $key= preg_replace('/^([a-z0-9-]+)\s(.*)$/', '\\1', get_post('addoption')); + $val= preg_replace("/^$key\s*/", '', get_post('addoption')); $this->options[$key]= $val; } if (isset($_POST['delete_option']) && isset($_POST['dhcpoptions'])){ - $key= preg_replace('/([a-z0-9-]+)\s(.*)$/', '\\1', $_POST['dhcpoptions']); + $key= preg_replace('/([a-z0-9-]+)\s(.*)$/', '\\1', get_post('dhcpoptions')); if (in_array($key, $this->autoOptions)){ print_red(_("Can't delete automatic options. Please use the fields above.")); } else { diff --git a/plugins/admin/systems/class_dhcpGroup.inc b/plugins/admin/systems/class_dhcpGroup.inc index 38c842197..7e90215bf 100644 --- a/plugins/admin/systems/class_dhcpGroup.inc +++ b/plugins/admin/systems/class_dhcpGroup.inc @@ -69,7 +69,7 @@ class dhcpGroup extends dhcpPlugin { /* Save cn */ if (isset($_POST['cn'])){ - $this->cn= validate($_POST['cn']); + $this->cn= validate(get_post('cn')); } /* Handle global saving */ diff --git a/plugins/admin/systems/class_dhcpHost.inc b/plugins/admin/systems/class_dhcpHost.inc index 2adb6990a..5e9e00d22 100644 --- a/plugins/admin/systems/class_dhcpHost.inc +++ b/plugins/admin/systems/class_dhcpHost.inc @@ -35,6 +35,8 @@ class dhcpHost extends dhcpPlugin $this->dhcpHWaddress= $attrs['dhcpHWAddress'][0]; } + print_a($this); + $this->advanced->setAutoOptions(array("host-name")); $this->advanced->setAutoStatements(array("fixed-address")); } @@ -95,12 +97,12 @@ class dhcpHost extends dhcpPlugin if (isset($_POST['hwtype'])){ /* Assemble hwAddress */ - $this->dhcpHWAddress= $_POST['hwtype']." ".$_POST['dhcpHWAddress']; - $this->cn= validate($_POST['cn']); + $this->dhcpHWAddress= get_post('hwtype')." ".get_post('dhcpHWAddress'); + $this->cn= validate(get_post('cn')); /* Save fixed address */ if ($_POST['fixedaddr'] != ""){ - $this->statements['fixed-address']= $_POST['fixedaddr']; + $this->statements['fixed-address']= get_post('fixedaddr'); } else { unset ($this->statements['fixed-address']); } diff --git a/plugins/admin/systems/class_dhcpNetwork.inc b/plugins/admin/systems/class_dhcpNetwork.inc index 9cef322e7..76cc6fe9a 100644 --- a/plugins/admin/systems/class_dhcpNetwork.inc +++ b/plugins/admin/systems/class_dhcpNetwork.inc @@ -38,7 +38,7 @@ class dhcpNetwork extends plugin { /* Check for iteraction */ if (isset($_POST['add_dns']) && $_POST['addserver'] != ""){ - if (!preg_match('/^[0-9a-z.-]+$/', $_POST['addserver'])){ + if (!preg_match('/^[0-9a-z.-]+$/', get_post('addserver'))){ print_red(_("The name of the DNS server your're going to add is not valid!")); } else { $servers= array(); @@ -47,7 +47,7 @@ class dhcpNetwork extends plugin $servers[$val]= $val; } } - $servers[$_POST['addserver']]= $_POST['addserver']; + $servers[get_post('addserver')]= get_post('addserver'); $tmp= ""; foreach($servers as $val){ $tmp.= $val.","; @@ -56,7 +56,7 @@ class dhcpNetwork extends plugin } } if (isset($_POST['delete_dns']) && isset($_POST['dnsserver'])){ - $tmp= preg_replace("/(\s*,\s*)?".$_POST['dnsserver']."/i", '', + $tmp= preg_replace("/(\s*,\s*)?".get_post('dnsserver')."/i", '', $this->options['domain-name-servers']); $tmp= preg_replace("/(\s*)?,(\s*)?$/", '', $tmp); if ($tmp != ""){ @@ -160,7 +160,7 @@ class dhcpNetwork extends plugin if ($_POST["$val"] == ''){ unset($this->options["$key"]); } else { - $this->options["$key"]= $_POST["$val"]; + $this->options["$key"]= get_post("$val"); } } @@ -169,7 +169,7 @@ class dhcpNetwork extends plugin if ($_POST["$val"] == ''){ unset($this->statements["$key"]); } else { - $this->statements["$key"]= '"'.$_POST["$val"].'"'; + $this->statements["$key"]= '"'.get_post("$val").'"'; } } diff --git a/plugins/admin/systems/class_dhcpPool.inc b/plugins/admin/systems/class_dhcpPool.inc index d1c016d58..1083a7872 100644 --- a/plugins/admin/systems/class_dhcpPool.inc +++ b/plugins/admin/systems/class_dhcpPool.inc @@ -81,9 +81,9 @@ class dhcpPool extends dhcpPlugin function save_object() { if (isset($_POST['cn'])){ - $this->cn= validate($_POST['cn']); - $this->range_start= validate($_POST['range_start']); - $this->range_stop= validate($_POST['range_stop']); + $this->cn= validate(get_post('cn')); + $this->range_start= validate(get_post('range_start')); + $this->range_stop= validate(get_post('range_stop')); } dhcpPlugin::save_object(); diff --git a/plugins/admin/systems/class_dhcpService.inc b/plugins/admin/systems/class_dhcpService.inc index c4a0a7e2c..6faa7caa3 100644 --- a/plugins/admin/systems/class_dhcpService.inc +++ b/plugins/admin/systems/class_dhcpService.inc @@ -115,7 +115,7 @@ 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($_POST[$val]); + $this->statements[$tval]= validate(get_post($val)); } else { unset ($this->statements[$tval]); } diff --git a/plugins/admin/systems/class_dhcpSharedNetwork.inc b/plugins/admin/systems/class_dhcpSharedNetwork.inc index 0f9e54e9e..03154b340 100644 --- a/plugins/admin/systems/class_dhcpSharedNetwork.inc +++ b/plugins/admin/systems/class_dhcpSharedNetwork.inc @@ -101,13 +101,13 @@ class dhcpSharedNetwork extends dhcpPlugin function save_object() { if (isset($_POST['cn'])){ - $this->cn= validate($_POST['cn']); + $this->cn= validate(get_post('cn')); dhcpPlugin::save_object(); foreach (array("server-identifier", "default-lease-time", "max-lease-time", "min-lease-time") as $attr){ if (isset($_POST[$attr]) && $_POST[$attr] != ""){ - $this->statements[$attr]= $_POST[$attr]; + $this->statements[$attr]= get_post($attr); } else { unset($this->statements[$attr]); } diff --git a/plugins/admin/systems/class_dhcpSubnet.inc b/plugins/admin/systems/class_dhcpSubnet.inc index 2620a7be0..0f3c712b0 100644 --- a/plugins/admin/systems/class_dhcpSubnet.inc +++ b/plugins/admin/systems/class_dhcpSubnet.inc @@ -103,15 +103,15 @@ class dhcpSubnet extends dhcpPlugin { if(isset($_POST['dhcp_subnet_posted'])){ if (isset($_POST['cn'])){ - $this->cn= validate($_POST['cn']); + $this->cn= validate(get_post('cn')); } if (isset($_POST['dhcp_netmask'])){ - $this->dhcpNetMask= validate($_POST['dhcp_netmask']); + $this->dhcpNetMask= validate(get_post('dhcp_netmask')); } if (isset($_POST['use_range'])){ $this->use_range= TRUE; - $this->range_start= validate($_POST['range_start']); - $this->range_stop= validate($_POST['range_stop']); + $this->range_start= validate(get_post('range_start')); + $this->range_stop= validate(get_post('range_stop')); } else { $this->use_range= FALSE; }