diff options
author | Stephen Beaver <sbeaver@netgate.com> | 2015-12-14 11:19:23 -0500 |
---|---|---|
committer | Stephen Beaver <sbeaver@netgate.com> | 2015-12-14 11:19:50 -0500 |
commit | 39609bf9959f77394943f05352d4cab095a8a2c6 (patch) | |
tree | 8cc537a0f4cff6e37aea3c52ff8af3725a1933a2 /src/usr/local/www/services_unbound_host_edit.php | |
parent | fd6cd92bc4225bb6b41487b32e533e2544d18163 (diff) | |
download | pfsense-39609bf9959f77394943f05352d4cab095a8a2c6.zip pfsense-39609bf9959f77394943f05352d4cab095a8a2c6.tar.gz |
Fixed #5638
Diffstat (limited to 'src/usr/local/www/services_unbound_host_edit.php')
-rw-r--r-- | src/usr/local/www/services_unbound_host_edit.php | 67 |
1 files changed, 36 insertions, 31 deletions
diff --git a/src/usr/local/www/services_unbound_host_edit.php b/src/usr/local/www/services_unbound_host_edit.php index 7a4d696..7bea45c 100644 --- a/src/usr/local/www/services_unbound_host_edit.php +++ b/src/usr/local/www/services_unbound_host_edit.php @@ -106,7 +106,7 @@ if (isset($id) && $a_hosts[$id]) { } if ($_POST) { - +print_r($_POST); unset($input_errors); $pconfig = $_POST; @@ -136,43 +136,45 @@ if ($_POST) { /* collect aliases */ $aliases = array(); - foreach ($_POST as $key => $value) { - $entry = ''; - if (!substr_compare('aliashost', $key, 0, 9)) { - $entry = substr($key, 9); - $field = 'host'; - } elseif (!substr_compare('aliasdomain', $key, 0, 11)) { - $entry = substr($key, 11); - $field = 'domain'; - } elseif (!substr_compare('aliasdescription', $key, 0, 16)) { - $entry = substr($key, 16); - $field = 'description'; - } - if (ctype_digit($entry)) { - $aliases[$entry][$field] = $value; + if (!empty($_POST['aliashost0'])) { + foreach ($_POST as $key => $value) { + $entry = ''; + if (!substr_compare('aliashost', $key, 0, 9)) { + $entry = substr($key, 9); + $field = 'host'; + } elseif (!substr_compare('aliasdomain', $key, 0, 11)) { + $entry = substr($key, 11); + $field = 'domain'; + } elseif (!substr_compare('aliasdescription', $key, 0, 16)) { + $entry = substr($key, 16); + $field = 'description'; + } + if (ctype_digit($entry)) { + $aliases[$entry][$field] = $value; + } } - } - $pconfig['aliases']['item'] = $aliases; + $pconfig['aliases']['item'] = $aliases; - /* validate aliases */ - foreach ($aliases as $idx => $alias) { - $aliasreqdfields = array('aliasdomain' . $idx); - $aliasreqdfieldsn = array(gettext("Alias Domain")); + /* validate aliases */ + foreach ($aliases as $idx => $alias) { + $aliasreqdfields = array('aliasdomain' . $idx); + $aliasreqdfieldsn = array(gettext("Alias Domain")); - do_input_validation($_POST, $aliasreqdfields, $aliasreqdfieldsn, $input_errors); + do_input_validation($_POST, $aliasreqdfields, $aliasreqdfieldsn, $input_errors); - if ($alias['host']) { - if (!is_hostname($alias['host'])) { - $input_errors[] = gettext("Hostnames in an alias list can only contain the characters A-Z, 0-9 and '-'. They may not start or end with '-'."); - } else { - if (!is_unqualified_hostname($alias['host'])) { - $input_errors[] = gettext("A valid alias hostname is specified, but the domain name part should be omitted"); + if ($alias['host']) { + if (!is_hostname($alias['host'])) { + $input_errors[] = gettext("Hostnames in an alias list can only contain the characters A-Z, 0-9 and '-'. They may not start or end with '-'."); + } else { + if (!is_unqualified_hostname($alias['host'])) { + $input_errors[] = gettext("A valid alias hostname is specified, but the domain name part should be omitted"); + } } } - } - if (($alias['domain'] && !is_domain($alias['domain']))) { - $input_errors[] = gettext("A valid domain must be specified in alias list."); + if (($alias['domain'] && !is_domain($alias['domain']))) { + $input_errors[] = gettext("A valid domain must be specified in alias list."); + } } } @@ -235,6 +237,9 @@ $pgtitle = array(gettext("Services"),gettext("DNS Resolver"),gettext("Edit Host $shortcut_section = "resolver"; include("head.inc"); +if ($input_errors) + print_input_errors($input_errors); + $form = new Form(); $section = new Form_Section('Host override options'); |