From 483816313924f87707bca0aa983c73064bd52371 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Sun, 31 Jul 2016 10:21:57 +0200 Subject: Allow URLs for TFTP Server (Bug #6634) is_URL() from util.inc is way too limited for this purpose. --- src/usr/local/www/services_dhcp.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/usr/local/www/services_dhcp.php') diff --git a/src/usr/local/www/services_dhcp.php b/src/usr/local/www/services_dhcp.php index f04b824..74d9746 100644 --- a/src/usr/local/www/services_dhcp.php +++ b/src/usr/local/www/services_dhcp.php @@ -329,8 +329,8 @@ if (isset($_POST['save'])) { if (($_POST['domain'] && !is_domain($_POST['domain']))) { $input_errors[] = gettext("A valid domain name must be specified for the DNS domain."); } - if ($_POST['tftp'] && !is_ipaddrv4($_POST['tftp']) && !is_domain($_POST['tftp']) && !is_URL($_POST['tftp'])) { - $input_errors[] = gettext("A valid IP address or hostname must be specified for the TFTP server."); + f ($_POST['tftp'] && !is_ipaddrv4($_POST['tftp']) && !is_domain($_POST['tftp']) && !filter_var($_POST['tftp'], FILTER_VALIDATE_URL)) { + $input_errors[] = gettext("A valid IP address, hostname or URL must be specified for the TFTP server."); } if (($_POST['nextserver'] && !is_ipaddrv4($_POST['nextserver']))) { $input_errors[] = gettext("A valid IP address must be specified for the network boot server."); -- cgit v1.1 From 4b79a9d443c4e16d6ffa304775aec79938d2988c Mon Sep 17 00:00:00 2001 From: doktornotor Date: Sun, 31 Jul 2016 10:25:07 +0200 Subject: Typo fix --- src/usr/local/www/services_dhcp.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/usr/local/www/services_dhcp.php') diff --git a/src/usr/local/www/services_dhcp.php b/src/usr/local/www/services_dhcp.php index 74d9746..bda57b7 100644 --- a/src/usr/local/www/services_dhcp.php +++ b/src/usr/local/www/services_dhcp.php @@ -329,7 +329,7 @@ if (isset($_POST['save'])) { if (($_POST['domain'] && !is_domain($_POST['domain']))) { $input_errors[] = gettext("A valid domain name must be specified for the DNS domain."); } - f ($_POST['tftp'] && !is_ipaddrv4($_POST['tftp']) && !is_domain($_POST['tftp']) && !filter_var($_POST['tftp'], FILTER_VALIDATE_URL)) { + if ($_POST['tftp'] && !is_ipaddrv4($_POST['tftp']) && !is_domain($_POST['tftp']) && !filter_var($_POST['tftp'], FILTER_VALIDATE_URL)) { $input_errors[] = gettext("A valid IP address, hostname or URL must be specified for the TFTP server."); } if (($_POST['nextserver'] && !is_ipaddrv4($_POST['nextserver']))) { -- cgit v1.1 From c411661a8e8f9f9eb014a24954b9be2fcaaece18 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Sun, 31 Jul 2016 11:27:20 +0200 Subject: Allow URLs for TFTP Server (Bug #6634) The setPattern() thing ain't usable for this and just causes regressions. --- src/usr/local/www/services_dhcp.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/usr/local/www/services_dhcp.php') diff --git a/src/usr/local/www/services_dhcp.php b/src/usr/local/www/services_dhcp.php index bda57b7..d892cab 100644 --- a/src/usr/local/www/services_dhcp.php +++ b/src/usr/local/www/services_dhcp.php @@ -1084,11 +1084,11 @@ $section->addInput(new Form_StaticText( $btnadv )); -$section->addInput(new Form_IpAddress( +$section->addInput(new Form_Input( 'tftp', 'TFTP Server', $pconfig['tftp'] -))->setHelp('Leave blank to disable. Enter a full hostname or IP for the TFTP server.')->setPattern('[.a-zA-Z0-9_-]+'); +))->setHelp('Leave blank to disable. Enter a valid IP address, hostname or URL for the TFTP server.'); // Advanced LDAP $btnadv = new Form_Button( -- cgit v1.1