Code

Updated Post handling
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 9 Aug 2007 11:00:39 +0000 (11:00 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 9 Aug 2007 11:00:39 +0000 (11:00 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@7028 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_dhcpAdvanced.inc
plugins/admin/systems/class_dhcpGroup.inc
plugins/admin/systems/class_dhcpHost.inc
plugins/admin/systems/class_dhcpNetwork.inc
plugins/admin/systems/class_dhcpPool.inc
plugins/admin/systems/class_dhcpService.inc
plugins/admin/systems/class_dhcpSharedNetwork.inc
plugins/admin/systems/class_dhcpSubnet.inc

index 271c4ed6e2f8b92a3501042f4ba6fa0292df3720..74094f73c83c421e4ab14fe723028893fec284cc 100644 (file)
@@ -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 {
index 38c8421970ff27fe6e39c0a06ea30f8b6355d073..7e90215bfca6d1dd36fa9c398d36b77c45b6d8f8 100644 (file)
@@ -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 */
index 2adb6990af72c075d5070e60b708413f9133747b..5e9e00d22db84de518bae095f48336483cd8e601 100644 (file)
@@ -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']);
       }
index 9cef322e7e4eb4611d56565e62c5399974d8a3ef..76cc6fe9ac061c17a39feba63cbd1ff794fd018d 100644 (file)
@@ -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").'"';
         }
       }
 
index d1c016d58b3b3c385f84ae61fe06714bb6d252c3..1083a7872283d6bf57124b9c974e72ed073ca6f1 100644 (file)
@@ -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();
index c4a0a7e2cd391ce6296735cbe067b3500c1a8426..6faa7caa33c31389ebdb14ffd609cc6b074c054c 100644 (file)
@@ -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]);
       }
index 0f9e54e9e39dc7eb3b0491b0f7b6bba3fea65cc1..03154b3401dc870e3151a83b1972432714586f54 100644 (file)
@@ -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]);
         }
index 2620a7be0b411084d43088f88daa081f3649a6ed..0f3c712b00573d93ae2e0ddf4c140d6f2024da1a 100644 (file)
@@ -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;
       }