From 32fb334a0533af879d0738b6d623b444006fcc0a Mon Sep 17 00:00:00 2001 From: "aj.adams" Date: Wed, 1 Apr 2020 11:10:50 -0700 Subject: [PATCH] fixing domain-serch format in output --- build_isc_dhcp.inc.php | 11 +++++++++++ plugin_info.php | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/build_isc_dhcp.inc.php b/build_isc_dhcp.inc.php index 8dea21a..b7bfa34 100644 --- a/build_isc_dhcp.inc.php +++ b/build_isc_dhcp.inc.php @@ -190,6 +190,17 @@ function format_tag ($dhcp_entry=array()) { $formatted_entry = ltrim($dhcp_entry['value']); } } + // Special case for domain-search + else if ($dhcp_entry['name'] == 'domain-search') { + // clean comma space + $dhcp_entry['value'] = preg_replace('/,\s+/', ',', ltrim($dhcp_entry['value'])); + // clean space comma + $dhcp_entry['value'] = preg_replace('/\s,+/', ',', ltrim($dhcp_entry['value'])); + // clean just a comma + $dhcp_entry['value'] = preg_replace('/,+/', '","', ltrim($dhcp_entry['value'])); + // clean all whitespace and wrap final quotes around it all + $formatted_entry = '"' . preg_replace('/\s+/', '","', ltrim($dhcp_entry['value'])) . '"'; + } else if ($dhcp_entry['type'] == 'S') { // If it is a string then quote it $formatted_entry = '"' . $dhcp_entry['value'] . '"'; diff --git a/plugin_info.php b/plugin_info.php index a87a445..5bf21e9 100644 --- a/plugin_info.php +++ b/plugin_info.php @@ -5,7 +5,7 @@ $plug_name = basename(dirname(__FILE__)); $plugin_description = 'Build ISC DHCP server configurations.'; -$plugin_version = '1.5'; +$plugin_version = '1.6'; $plugin_help_url = 'https://github.com/opennetadmin/'.$plug_name.'/wiki';