From 39894ed4b4710d2d26412b4206b36f4cb424a765 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Fri, 13 Mar 2015 14:18:15 +0545 Subject: Status DHCP Leases handle expire never Note: We can let the code pass "never" (or any other unexpected stuff) to adjust_gmt() adjust_gmt() should anyway handle the case when strtotime() cannot understand the input string and thus returns false. In that case we return the input string as-is so it will be displayed as the time. That way the user will see it and can report easily whatever other unexpected char data was in the leases file. It also prevents "false" (zero) being converted to the date-time string and thus becoming the Unix epoch 1 Jan 1970 on the display. Latest forum report of this kind of thing: https://forum.pfsense.org/index.php?topic=90083.0 --- usr/local/www/status_dhcp_leases.php | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'usr/local') diff --git a/usr/local/www/status_dhcp_leases.php b/usr/local/www/status_dhcp_leases.php index 191d9f5..24c41b8 100644 --- a/usr/local/www/status_dhcp_leases.php +++ b/usr/local/www/status_dhcp_leases.php @@ -107,9 +107,12 @@ function adjust_gmt($dt) { } if ($dhcpleaseinlocaltime == "yes") { $ts = strtotime($dt . " GMT"); - return strftime("%Y/%m/%d %I:%M:%S%p", $ts); - } else - return $dt; + if ($ts !== false) { + return strftime("%Y/%m/%d %I:%M:%S%p", $ts); + } + } + /* If we did not need to convert to local time or the conversion failed, just return the input. */ + return $dt; } function remove_duplicate($array, $field) @@ -186,9 +189,16 @@ foreach($leases_content as $lease) { $f = $f+3; break; case "ends": - $leases[$l]['end'] = $data[$f+2]; - $leases[$l]['end'] .= " " . $data[$f+3]; - $f = $f+3; + if ($data[$f+1] == "never") { + // Quote from dhcpd.leases(5) man page: + // If a lease will never expire, date is never instead of an actual date. + $leases[$l]['end'] = gettext("Never"); + $f = $f+1; + } else { + $leases[$l]['end'] = $data[$f+2]; + $leases[$l]['end'] .= " " . $data[$f+3]; + $f = $f+3; + } break; case "tstp": $f = $f+3; -- cgit v1.1 From 8fa074af536c318338cde7a3e1992818f38382cc Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Sat, 21 Mar 2015 18:08:23 +0545 Subject: Handle release number in installer This code just looked wrong. It was considering 10.1-RELEASE-p6 to be release number "1" and comparing it to "9". These changes to do what it seems to intend. This will make that UFS+J stuff appear, if that is of any consequence. --- usr/local/www/installer/installer.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'usr/local') diff --git a/usr/local/www/installer/installer.php b/usr/local/www/installer/installer.php index 90c138b..8f5dd91 100644 --- a/usr/local/www/installer/installer.php +++ b/usr/local/www/installer/installer.php @@ -1138,7 +1138,8 @@ EOF; function return_rowhelper_row($rownum, $mountpoint, $fstype, $disk, $size, $encpass) { global $g, $select_txt, $custom_disks, $savemsg; $release = php_uname("r"); - $release = trim($release[0]); + // Get release number like 8.3 or 10.1 + $relnum = strtok($release, "-"); // Mount point $disks = installer_find_all_disks(); @@ -1155,7 +1156,7 @@ function return_rowhelper_row($rownum, $mountpoint, $fstype, $disk, $size, $encp ); // UFS + Journaling was introduced in 9.0 - if($release == "9") { + if($relnum >= 9) { $types['UFS+J'] = "UFS + Journaling"; $types['UFS+J.eli'] = "Encrypted UFS + Journaling"; } -- cgit v1.1 From ddb4b472866e890379122c65f50c47b3ebafc5e9 Mon Sep 17 00:00:00 2001 From: k-paulius Date: Sun, 22 Mar 2015 14:00:14 -0500 Subject: Make sure 'DHCPv6 Prefix Delegation size' is provided if 'Send IPv6 prefix hint' flag is checked to avoid generating invalid dhcp6c configuration file. --- usr/local/www/interfaces.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'usr/local') diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php index 8ca3247..425bbfe 100644 --- a/usr/local/www/interfaces.php +++ b/usr/local/www/interfaces.php @@ -576,6 +576,9 @@ if ($_POST['apply']) { case "dhcp6": if (in_array($wancfg['ipaddrv6'], array())) $input_errors[] = sprintf(gettext("You have to reassign the interface to be able to configure as %s."),$_POST['type6']); + if ($_POST['dhcp6-ia-pd-send-hint'] && strtolower($_POST['dhcp6-ia-pd-len']) == 'none') { + $input_errors[] = gettext('DHCPv6 Prefix Delegation size must be provided when Send IPv6 prefix hint flag is checked'); + } break; case "6rd": foreach ($ifdescrs as $ifent => $ifdescr) { -- cgit v1.1 From 4c6d81ea930f9748ff31f9c6e120988bf521ca53 Mon Sep 17 00:00:00 2001 From: k-paulius Date: Sun, 22 Mar 2015 14:31:58 -0500 Subject: Use is_numericint() instead of empty() to check if value has been entered because empty() does not allow 0, which is a valid value. --- usr/local/www/interfaces.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'usr/local') diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php index 425bbfe..62cf658 100644 --- a/usr/local/www/interfaces.php +++ b/usr/local/www/interfaces.php @@ -1157,7 +1157,7 @@ if ($_POST['apply']) { $wancfg['adv_dhcp6_id_assoc_statement_address_enable'] = $_POST['adv_dhcp6_id_assoc_statement_address_enable']; if (!empty($_POST['adv_dhcp6_id_assoc_statement_address'])) $wancfg['adv_dhcp6_id_assoc_statement_address'] = $_POST['adv_dhcp6_id_assoc_statement_address']; - if (!empty($_POST['adv_dhcp6_id_assoc_statement_address_id'])) + if (is_numericint($_POST['adv_dhcp6_id_assoc_statement_address_id'])) $wancfg['adv_dhcp6_id_assoc_statement_address_id'] = $_POST['adv_dhcp6_id_assoc_statement_address_id']; if (!empty($_POST['adv_dhcp6_id_assoc_statement_address_pltime'])) $wancfg['adv_dhcp6_id_assoc_statement_address_pltime'] = $_POST['adv_dhcp6_id_assoc_statement_address_pltime']; @@ -1168,16 +1168,16 @@ if ($_POST['apply']) { $wancfg['adv_dhcp6_id_assoc_statement_prefix_enable'] = $_POST['adv_dhcp6_id_assoc_statement_prefix_enable']; if (!empty($_POST['adv_dhcp6_id_assoc_statement_prefix'])) $wancfg['adv_dhcp6_id_assoc_statement_prefix'] = $_POST['adv_dhcp6_id_assoc_statement_prefix']; - if (!empty($_POST['adv_dhcp6_id_assoc_statement_prefix_id'])) + if (is_numericint($_POST['adv_dhcp6_id_assoc_statement_prefix_id'])) $wancfg['adv_dhcp6_id_assoc_statement_prefix_id'] = $_POST['adv_dhcp6_id_assoc_statement_prefix_id']; if (!empty($_POST['adv_dhcp6_id_assoc_statement_prefix_pltime'])) $wancfg['adv_dhcp6_id_assoc_statement_prefix_pltime'] = $_POST['adv_dhcp6_id_assoc_statement_prefix_pltime']; if (!empty($_POST['adv_dhcp6_id_assoc_statement_prefix_vltime'])) $wancfg['adv_dhcp6_id_assoc_statement_prefix_vltime'] = $_POST['adv_dhcp6_id_assoc_statement_prefix_vltime']; - if (!empty($_POST['adv_dhcp6_prefix_interface_statement_sla_id'])) + if (is_numericint($_POST['adv_dhcp6_prefix_interface_statement_sla_id'])) $wancfg['adv_dhcp6_prefix_interface_statement_sla_id'] = $_POST['adv_dhcp6_prefix_interface_statement_sla_id']; - if (!empty($_POST['adv_dhcp6_prefix_interface_statement_sla_len'])) + if (is_numericint($_POST['adv_dhcp6_prefix_interface_statement_sla_len'])) $wancfg['adv_dhcp6_prefix_interface_statement_sla_len'] = $_POST['adv_dhcp6_prefix_interface_statement_sla_len']; if (!empty($_POST['adv_dhcp6_authentication_statement_authname'])) -- cgit v1.1 From cd94a9a8d9ea4ba99576da957e18c23472d59f85 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Mon, 23 Mar 2015 10:18:55 -0300 Subject: Add missing encoding, as suggested by yakar --- usr/local/www/getserviceproviders.php | 2 +- usr/local/www/graph.php | 2 +- usr/local/www/graph_cpu.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'usr/local') diff --git a/usr/local/www/getserviceproviders.php b/usr/local/www/getserviceproviders.php index d720d14..b34e046 100644 --- a/usr/local/www/getserviceproviders.php +++ b/usr/local/www/getserviceproviders.php @@ -76,7 +76,7 @@ function providers_list($country) { function provider_plan_data($country,$provider,$connection) { header("Content-type: application/xml;"); - echo "\n"; + echo "\n"; echo "\n"; $serviceproviders = get_country_providers($country); foreach($serviceproviders as $sp) { diff --git a/usr/local/www/graph.php b/usr/local/www/graph.php index ce65a55..478bae4 100755 --- a/usr/local/www/graph.php +++ b/usr/local/www/graph.php @@ -102,7 +102,7 @@ if(file_exists("/usr/local/www/themes/{$g['theme']}/graph.php")) { } /********* Graph DATA **************/ -print('' . "\n");?> +print('' . "\n");?> diff --git a/usr/local/www/graph_cpu.php b/usr/local/www/graph_cpu.php index 200b9ea..ef3f22d 100644 --- a/usr/local/www/graph_cpu.php +++ b/usr/local/www/graph_cpu.php @@ -68,7 +68,7 @@ $height=100; // SVG internal height : do not modify $width=200; // SVG internal width : do not modify /********* Graph DATA **************/ -print('' . "\n");?> +print('' . "\n");?> -- cgit v1.1 From ca12c20400a7e6c78c79e0e3908e25dffe7f3cdd Mon Sep 17 00:00:00 2001 From: k-paulius Date: Mon, 23 Mar 2015 23:11:08 -0500 Subject: Commit 89f171b changed result returned by get_possible_traffic_source_addresses() from indexed to associative array. Updating affected code. --- usr/local/www/diag_logs_settings.php | 8 ++++---- usr/local/www/diag_ping.php | 8 ++++---- usr/local/www/diag_testport.php | 8 ++++---- usr/local/www/diag_traceroute.php | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) (limited to 'usr/local') diff --git a/usr/local/www/diag_logs_settings.php b/usr/local/www/diag_logs_settings.php index e2eca1a..5f48985 100644 --- a/usr/local/www/diag_logs_settings.php +++ b/usr/local/www/diag_logs_settings.php @@ -380,13 +380,13 @@ function check_everything() { diff --git a/usr/local/www/diag_ping.php b/usr/local/www/diag_ping.php index bc60f71..0c289cf 100644 --- a/usr/local/www/diag_ping.php +++ b/usr/local/www/diag_ping.php @@ -116,13 +116,13 @@ include("head.inc"); ?> diff --git a/usr/local/www/diag_testport.php b/usr/local/www/diag_testport.php index b64075e..393c757 100644 --- a/usr/local/www/diag_testport.php +++ b/usr/local/www/diag_testport.php @@ -140,13 +140,13 @@ include("head.inc"); ?> diff --git a/usr/local/www/diag_traceroute.php b/usr/local/www/diag_traceroute.php index 8cdbf93..7878ebe 100644 --- a/usr/local/www/diag_traceroute.php +++ b/usr/local/www/diag_traceroute.php @@ -116,13 +116,13 @@ if (!isset($do_traceroute)) { -- cgit v1.1 From d5b28fcf94d5db726f8e5d9e1e80662df215b733 Mon Sep 17 00:00:00 2001 From: Stephen Beaver Date: Wed, 25 Mar 2015 13:24:25 -0400 Subject: Fixes an issue wherein an alias could be added only if some other alias already exists in the system. --- usr/local/www/diag_dns.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'usr/local') diff --git a/usr/local/www/diag_dns.php b/usr/local/www/diag_dns.php index d99c5ba..cbce9aa 100644 --- a/usr/local/www/diag_dns.php +++ b/usr/local/www/diag_dns.php @@ -38,11 +38,13 @@ require("guiconfig.inc"); $host = trim($_REQUEST['host'], " \t\n\r\0\x0B[];\"'"); $host_esc = escapeshellarg($host); -if (is_array($config['aliases']['alias'])) { - $a_aliases = &$config['aliases']['alias']; -} else { - $a_aliases = array(); +/* If this section of config.xml has not been populated yet we need to set it up +*/ +if (!is_array($config['aliases']['alias'])) { + $config['aliases']['alias'] = array(); } +$a_aliases = &$config['aliases']['alias']; + $aliasname = str_replace(array(".","-"), "_", $host); $alias_exists = false; $counter=0; -- cgit v1.1