From 9162e16f1faedcd3c977e4210430c97c4ff429c5 Mon Sep 17 00:00:00 2001 From: cajus Date: Thu, 9 Aug 2007 07:38:27 +0000 Subject: [PATCH] Updated plugin git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@7014 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_dhcpPlugin.inc | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/include/class_dhcpPlugin.inc b/include/class_dhcpPlugin.inc index c0da9bf10..93c5b507a 100644 --- a/include/class_dhcpPlugin.inc +++ b/include/class_dhcpPlugin.inc @@ -46,7 +46,11 @@ class dhcpPlugin extends plugin if (isset($attrs['dhcpOption'])){ foreach ($attrs['dhcpOption'] as $opt){ $idx= preg_replace('/\s.+$/', '', $opt); - $value= preg_replace('/^[^\s]+\s/', '', $opt); + if ($idx == $opt){ + $value= ""; + } else { + $value= preg_replace('/^[^\s]+\s/', '', $opt); + } $this->options[$idx]= $value; } } @@ -55,7 +59,11 @@ class dhcpPlugin extends plugin if (isset($attrs['dhcpStatements'])){ foreach ($attrs['dhcpStatements'] as $opt){ $idx= preg_replace('/\s.+$/', '', $opt); - $value= preg_replace('/^[^\s]+\s/', '', $opt); + if ($idx == $opt){ + $value= ""; + } else { + $value= preg_replace('/^[^\s]+\s/', '', $opt); + } $this->statements[$idx]= $value; } } @@ -166,6 +174,30 @@ class dhcpPlugin extends plugin return ($this->attrs); } + + function removeAttrs($name, $type) + { + $new= array(); + foreach ($this->attrs[$type] as $value){ + if (!preg_match("/^$name /", $value)){ + $new[]= $value; + } + } + $this->attrs[$type]= $new; + } + + + function removeOption($name) + { + $this->removeAttrs($name, 'dhcpOption'); + } + + + function removeStatement($name) + { + $this->removeAttrs($name, 'dhcpStatement'); + } + } ?> -- 2.30.2