diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2008-10-24 21:58:27 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2008-10-24 21:58:27 +0000 |
commit | b4f8a42a350136d642a8bf51f6579a2ffea5a660 (patch) | |
tree | 6e5486b87368285e2493aaf747d4a2f06d66df79 | |
parent | 9e33c9f87440c576e43b6a9f12ecac02be8b9699 (diff) | |
download | pfsense-packages-b4f8a42a350136d642a8bf51f6579a2ffea5a660.tar.gz pfsense-packages-b4f8a42a350136d642a8bf51f6579a2ffea5a660.tar.bz2 pfsense-packages-b4f8a42a350136d642a8bf51f6579a2ffea5a660.zip |
Do not write out blank items
-rw-r--r-- | packages/tinydns/new_zone_wizard.xml | 75 |
1 files changed, 45 insertions, 30 deletions
diff --git a/packages/tinydns/new_zone_wizard.xml b/packages/tinydns/new_zone_wizard.xml index dc573e24..55b41614 100644 --- a/packages/tinydns/new_zone_wizard.xml +++ b/packages/tinydns/new_zone_wizard.xml @@ -118,40 +118,55 @@ <stepsubmitbeforesave> <![CDATA[ - $tmp = array(); - $tmp['hostname'] = $_POST['domainname']; - $tmp['recordtype'] = "SOA"; - $tmp['ipaddress'] = $_POST['primarynameserver']; - $config['installedpackages']['tinydnsdomains']['config'][] = $tmp; - unset($tmp); + $changed = false; + + if($_POST['domainname']) { + $tmp = array(); + $tmp['hostname'] = $_POST['domainname']; + $tmp['recordtype'] = "SOA"; + $tmp['ipaddress'] = $_POST['primarynameserver']; + $config['installedpackages']['tinydnsdomains']['config'][] = $tmp; + unset($tmp); + $changed = true; + } - $tmp = array(); - $tmp['hostname'] = $_POST['domainname']; - $tmp['recordtype'] = "SOA"; - $tmp['ipaddress'] = $_POST['secondarynameserver']; - $config['installedpackages']['tinydnsdomains']['config'][] = $tmp; - unset($tmp); + if($_POST['domainname']) { + $tmp = array(); + $tmp['hostname'] = $_POST['domainname']; + $tmp['recordtype'] = "SOA"; + $tmp['ipaddress'] = $_POST['secondarynameserver']; + $config['installedpackages']['tinydnsdomains']['config'][] = $tmp; + unset($tmp); + $changed = true; + } - $tmp = array(); - $tmp['hostname'] = $_POST['firstarecordhostname']; - $tmp['recordtype'] = "A"; - $tmp['ipaddress'] = $_POST['firstarecordipaddress']; - $config['installedpackages']['tinydnsdomains']['config'][] = $tmp; - unset($tmp); + if($_POST['firstarecordhostname']) { + $tmp = array(); + $tmp['hostname'] = $_POST['firstarecordhostname']; + $tmp['recordtype'] = "A"; + $tmp['ipaddress'] = $_POST['firstarecordipaddress']; + $config['installedpackages']['tinydnsdomains']['config'][] = $tmp; + unset($tmp); + $changed = true; + } - $tmp = array(); - $tmp['hostname'] = $_POST['secondarecordiphostname']; - $tmp['recordtype'] = "A"; - $tmp['ipaddress'] = $_POST['secondarecordipaddress']; - $config['installedpackages']['tinydnsdomains']['config'][] = $tmp; - unset($tmp); + if($_POST['secondarecordiphostname']) { + $tmp = array(); + $tmp['hostname'] = $_POST['secondarecordiphostname']; + $tmp['recordtype'] = "A"; + $tmp['ipaddress'] = $_POST['secondarecordipaddress']; + $config['installedpackages']['tinydnsdomains']['config'][] = $tmp; + unset($tmp); + $changed = true; + } - write_config("new_zone_wizard.xml is creating a new zone {$_POST['domainname']}"); - - require_once("/usr/local/pkg/tinydns.inc"); - tinydns_create_zone_file(); - tinydns_setup_ping_items(); - tinydns_sync_on_changes(); + if($changed) { + write_config("new_zone_wizard.xml is creating a new zone {$_POST['domainname']}"); + require_once("/usr/local/pkg/tinydns.inc"); + tinydns_create_zone_file(); + tinydns_setup_ping_items(); + tinydns_sync_on_changes(); + } Header("Location: /tinydns_status.php"); ]]> |