diff options
Diffstat (limited to 'src/usr/local/www')
26 files changed, 443 insertions, 119 deletions
diff --git a/src/usr/local/www/diag_backup.php b/src/usr/local/www/diag_backup.php index 30da41b..242551c 100644 --- a/src/usr/local/www/diag_backup.php +++ b/src/usr/local/www/diag_backup.php @@ -57,7 +57,7 @@ */ ##|+PRIV -##|*IDENT=page-diagnostics-backup/restore +##|*IDENT=page-diagnostics-backup-restore ##|*NAME=Diagnostics: Backup/restore ##|*DESCR=Allow access to the 'Diagnostics: Backup/restore' page. ##|*MATCH=diag_backup.php* diff --git a/src/usr/local/www/firewall_aliases.php b/src/usr/local/www/firewall_aliases.php index 1911548..4f422dd 100644 --- a/src/usr/local/www/firewall_aliases.php +++ b/src/usr/local/www/firewall_aliases.php @@ -216,7 +216,7 @@ display_top_tabs($tab_array); <div class="panel-body"> <div class="table-responsive"> -<table class="table table-striped table-hover"> +<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable> <thead> <tr> <th><?=gettext("Name")?></th> diff --git a/src/usr/local/www/foot.inc b/src/usr/local/www/foot.inc index be2ed15..081cfca 100755 --- a/src/usr/local/www/foot.inc +++ b/src/usr/local/www/foot.inc @@ -24,7 +24,6 @@ <script src="/jquery/pfSense.js"></script> <script src="/jquery/pfSenseHelpers.js"></script> <script src="/sortable/sortable.js"></script> - <script type="text/javascript"> //<![CDATA[ // Un-hide the "Top of page" icons if the page is larger than the window diff --git a/src/usr/local/www/index.php b/src/usr/local/www/index.php index 25a6a57..55de55e 100644 --- a/src/usr/local/www/index.php +++ b/src/usr/local/www/index.php @@ -57,7 +57,7 @@ */ ##|+PRIV -##|*IDENT=page-system-login/logout +##|*IDENT=page-system-login-logout ##|*NAME=System: Login / Logout / Dashboard ##|*DESCR=Allow access to the 'System: Login / Logout' page and Dashboard. ##|*MATCH=index.php* diff --git a/src/usr/local/www/load_balancer_monitor_edit.php b/src/usr/local/www/load_balancer_monitor_edit.php index 615064f..6ba0907 100644 --- a/src/usr/local/www/load_balancer_monitor_edit.php +++ b/src/usr/local/www/load_balancer_monitor_edit.php @@ -89,6 +89,10 @@ if (isset($id) && $a_monitor[$id]) { $pconfig['options']['code'] = 200; } +if ($_GET['act'] = "dup") { + unset($id); +} + $changedesc = gettext("Load Balancer: Monitor:") . " "; $changecount = 0; diff --git a/src/usr/local/www/services_rfc2136.php b/src/usr/local/www/services_rfc2136.php index afb6e86..44bb1c5 100644 --- a/src/usr/local/www/services_rfc2136.php +++ b/src/usr/local/www/services_rfc2136.php @@ -123,6 +123,7 @@ if ($input_errors) { $iflist = get_configured_interface_with_descr(); +$groupslist = return_gateway_groups_array(); $i = 0; foreach ($a_rfc2136 as $rfc2136): @@ -136,6 +137,12 @@ foreach ($a_rfc2136 as $rfc2136): break; } } + foreach ($groupslist as $if => $group) { + if ($rfc2136['interface'] == $if) { + print($if); + break; + } + } ?> </td> <td> @@ -147,13 +154,14 @@ foreach ($a_rfc2136 as $rfc2136): <td> <?php $filename = "{$g['conf_path']}/dyndns_{$rfc2136['interface']}_rfc2136_" . escapeshellarg($rfc2136['host']) . "_{$rfc2136['server']}.cache"; + $if = get_failover_interface($rfc2136['interface']); if (file_exists($filename)) { print('IPv4: '); if (isset($rfc2136['usepublicip'])) { - $ipaddr = dyndnsCheckIP($rfc2136['interface']); + $ipaddr = dyndnsCheckIP($if); } else { - $ipaddr = get_interface_ip($rfc2136['interface']); + $ipaddr = get_interface_ip($if); } $cached_ip_s = explode("|", file_get_contents($filename)); @@ -175,7 +183,7 @@ foreach ($a_rfc2136 as $rfc2136): if (file_exists("{$filename}.ipv6")) { print('IPv6: '); - $ipaddr = get_interface_ipv6($rfc2136['interface']); + $ipaddr = get_interface_ipv6($if); $cached_ip_s = explode("|", file_get_contents("{$filename}.ipv6")); $cached_ip = $cached_ip_s[0]; diff --git a/src/usr/local/www/services_rfc2136_edit.php b/src/usr/local/www/services_rfc2136_edit.php index 5b74e36..891e8b1 100644 --- a/src/usr/local/www/services_rfc2136_edit.php +++ b/src/usr/local/www/services_rfc2136_edit.php @@ -157,6 +157,28 @@ if ($_POST) { } } +function build_if_list() { + $list = array(); + + $iflist = get_configured_interface_with_descr(); + + foreach ($iflist as $if => $ifdesc) { + $list[$if] = $ifdesc; + } + + unset($iflist); + + $grouplist = return_gateway_groups_array(); + + foreach ($grouplist as $name => $group) { + $list[$name] = 'GW Group ' . $name; + } + + unset($grouplist); + + return($list); +} + $pgtitle = array(gettext("Services"), gettext("Dynamic DNS"), gettext("RFC 2136 Client"), gettext("Edit")); include("head.inc"); @@ -180,17 +202,14 @@ $section->addInput(new Form_Checkbox( )); $optionlist = array(); -$iflist = get_configured_interface_with_descr(); -foreach ($iflist as $ifnam => $ifdescr) { - $optionlist[$ifnam] = $ifdescr; -} +$iflist = build_if_list(); $section->addInput(new Form_Select( 'interface', 'Interface', $pconfig['interface'], - $optionlist + $iflist )); $section->addInput(new Form_Input( @@ -306,12 +325,17 @@ $section->addInput(new Form_Input( ))->setHelp('You may enter a description here for your reference (not parsed).'); if (isset($id) && $a_rfc2136[$id]) { - $section->addInput(new Form_Input( - 'id', - null, - 'hidden', - $id + $section->addInput(new Form_Input( + 'id', + null, + 'hidden', + $id )); + + $form->addGlobal(new Form_Button( + 'force', + 'Save & Force Update' + ))->removeClass('btn-primary')->addClass('btn-info'); } $form->add($section); diff --git a/src/usr/local/www/status_dhcp_leases.php b/src/usr/local/www/status_dhcp_leases.php index 8f8be60..41bce34 100644 --- a/src/usr/local/www/status_dhcp_leases.php +++ b/src/usr/local/www/status_dhcp_leases.php @@ -379,11 +379,12 @@ if (count($pools) > 0) { <th><?=gettext("IP address")?></th> <th><?=gettext("MAC address")?></th> <th><?=gettext("Hostname")?></th> + <th><?=gettext("Description")?></th> <th><?=gettext("Start")?></th> <th><?=gettext("End")?></th> <th><?=gettext("Online")?></th> <th><?=gettext("Lease Type")?></th> - <th><?=gettext("Actions")?></th> + <th data-sortable="false"><?=gettext("Actions")?></th> </tr> </thead> <tbody> @@ -437,12 +438,9 @@ foreach ($leases as $data): <?php endif; ?> </td> <td><?=htmlentities($data['hostname'])?></td> -<?php if ($data['type'] != $static_string):?> + <td><?=htmlentities($data['descr'])?></td> <td><?=adjust_gmt($data['start'])?></td> <td><?=adjust_gmt($data['end'])?></td> -<?php else: ?> - <td colspan="2"><?=htmlentities($data['descr'])?></td> -<?php endif; ?> <td><?=$data['online']?></td> <td><?=$data['act']?></td> <td> diff --git a/src/usr/local/www/status_logs_common.inc b/src/usr/local/www/status_logs_common.inc index 0636064..b608817 100644 --- a/src/usr/local/www/status_logs_common.inc +++ b/src/usr/local/www/status_logs_common.inc @@ -334,7 +334,7 @@ function filter_form_system() { ); } - $btnsubmit->removeClass('btn-primary')->addClass('btn-success')->addClass('btn-sm'); + $btnsubmit->removeClass('btn-primary')->addClass('btn-sm btn-success'); $group->add(new Form_StaticText( '', @@ -553,7 +553,7 @@ function filter_form_firewall() { ); } - $btnsubmit->removeClass('btn-primary')->addClass('btn-success')->addClass('btn-sm'); + $btnsubmit->removeClass('btn-primary')->addClass('btn-sm btn-success'); $group->add(new Form_StaticText( '', @@ -958,11 +958,12 @@ function manage_log_section() { $btnsavesettings = new Form_Button( 'save_settings', - gettext('Save'), - null + ' ' . gettext('Save'), + null, + 'fa-save' ); - $btnsavesettings->addClass('btn-sm'); + $btnsavesettings->addClass('btn-sm btn-primary'); $group->add(new Form_StaticText( '', @@ -977,7 +978,7 @@ function manage_log_section() { 'fa-trash' ); - $btnclear->removeClass('btn-primary')->addClass('btn-danger')->addClass('btn-sm'); + $btnclear->removeClass('btn-primary')->addClass('btn-sm btn-danger'); $group->add(new Form_StaticText( '', diff --git a/src/usr/local/www/system.php b/src/usr/local/www/system.php index c791489..69d3069 100644 --- a/src/usr/local/www/system.php +++ b/src/usr/local/www/system.php @@ -181,16 +181,16 @@ if ($_POST) { $dnsname="dns{$dnscounter}"; $dnsgwname="dns{$dnscounter}gw"; if (($_POST[$dnsname] && !is_ipaddr($_POST[$dnsname]))) { - $input_errors[] = gettext("A valid IP address must be specified for DNS server $dnscounter."); + $input_errors[] = sprintf(gettext("A valid IP address must be specified for DNS server %s."), $dnscounter); } else { if (($_POST[$dnsgwname] <> "") && ($_POST[$dnsgwname] <> "none")) { // A real gateway has been selected. if (is_ipaddr($_POST[$dnsname])) { if ((is_ipaddrv4($_POST[$dnsname])) && (validate_address_family($_POST[$dnsname], $_POST[$dnsgwname]) === false)) { - $input_errors[] = gettext("You can not specify IPv6 gateway '{$_POST[$dnsgwname]}' for IPv4 DNS server '{$_POST[$dnsname]}'"); + $input_errors[] = sprintf(gettext('You can not specify IPv6 gateway "%1$s" for IPv4 DNS server "%2$s".'), $_POST[$dnsgwname], $_POST[$dnsname]); } if ((is_ipaddrv6($_POST[$dnsname])) && (validate_address_family($_POST[$dnsname], $_POST[$dnsgwname]) === false)) { - $input_errors[] = gettext("You can not specify IPv4 gateway '{$_POST[$dnsgwname]}' for IPv6 DNS server '{$_POST[$dnsname]}'"); + $input_errors[] = sprintf(gettext('You can not specify IPv4 gateway "%1$s" for IPv6 DNS server "%2$s".'), $_POST[$dnsgwname], $_POST[$dnsname]); } } else { // The user selected a gateway but did not provide a DNS address. Be nice and set the gateway back to "none". diff --git a/src/usr/local/www/system_advanced_firewall.php b/src/usr/local/www/system_advanced_firewall.php index 29b92af..f831959 100644 --- a/src/usr/local/www/system_advanced_firewall.php +++ b/src/usr/local/www/system_advanced_firewall.php @@ -470,7 +470,7 @@ $section->addInput(new Form_Checkbox( $section->addInput(new Form_Checkbox( 'disablescrub', 'Disable Firewall Scrub', - 'Disables the PF scrubbing option which can sometimes interfere with NFS and PPTP traffic.', + 'Disables the PF scrubbing option which can sometimes interfere with NFS traffic.', isset($config['system']['disablescrub']) )); @@ -545,8 +545,7 @@ $section->addInput(new Form_Checkbox( 'Disable Auto-added VPN rules', 'Disable all auto-added VPN rules.', isset($config['system']['disablevpnrules']) -))->setHelp('<span>Note: This disables automatically added rules for IPsec, '. - 'PPTP.</span>'); +))->setHelp('Note: This disables automatically added rules for IPsec.'); $section->addInput(new Form_Checkbox( 'disablereplyto', @@ -743,13 +742,13 @@ events.push(function() { var htext = '<span class="text-success">'; if (val == 'normal') { - htext += 'The default optimization algorithm'; + htext += '<?=gettext("The default optimization algorithm");?>'; } else if (val == 'high-latency') { - htext += 'Used for eg. satellite links. Expires idle connections later than default'; + htext += '<?=gettext("Used for eg. satellite links. Expires idle connections later than default");?>'; } else if (val == 'aggressive') { - htext += 'Expires idle connections quicker. More efficient use of CPU and memory but can drop legitimate idle connections'; + htext += '<?=gettext("Expires idle connections quicker. More efficient use of CPU and memory but can drop legitimate idle connections");?>'; } else if (val == 'conservative') { - htext += 'Tries to avoid dropping any legitimate idle connections at the expense of increased memory usage and CPU utilization'; + htext += '<?=gettext("Tries to avoid dropping any legitimate idle connections at the expense of increased memory usage and CPU utilization");?>'; } htext += '</span>'; diff --git a/src/usr/local/www/system_authservers.php b/src/usr/local/www/system_authservers.php index 75e71a6..1171c7e 100644 --- a/src/usr/local/www/system_authservers.php +++ b/src/usr/local/www/system_authservers.php @@ -111,7 +111,7 @@ if ($act == "del") { /* Remove server from temp list used later on this page. */ unset($a_server[$_GET['id']]); - $savemsg = gettext("Authentication Server") . " " . htmlspecialchars($serverdeleted) . " " . gettext("deleted") . "<br />"; + $savemsg = sprintf(gettext("Authentication Server %s deleted"), htmlspecialchars($serverdeleted)); write_config($savemsg); } @@ -379,11 +379,13 @@ if($_POST && $input_errors) { include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} -if ($savemsg) +if ($savemsg) { print_info_box($savemsg, 'success'); +} $tab_array = array(); $tab_array[] = array(gettext("Users"), false, "system_usermanager.php"); @@ -392,8 +394,7 @@ $tab_array[] = array(gettext("Settings"), false, "system_usermanager_settings.ph $tab_array[] = array(gettext("Servers"), true, "system_authservers.php"); display_top_tabs($tab_array); -if (!($act == "new" || $act == "edit" || $input_errors)) -{ +if (!($act == "new" || $act == "edit" || $input_errors)) { ?> <div class="panel panel-default"> <div class="panel-heading"><h2 class="panel-title"><?=gettext('Authentication Servers')?></h2></div> diff --git a/src/usr/local/www/system_camanager.php b/src/usr/local/www/system_camanager.php index 6dbd32f..d81ce00 100644 --- a/src/usr/local/www/system_camanager.php +++ b/src/usr/local/www/system_camanager.php @@ -128,7 +128,7 @@ if ($act == "del") { $name = $a_ca[$id]['descr']; unset($a_ca[$id]); write_config(); - $savemsg = sprintf(gettext("Certificate Authority %s and its CRLs (if any) successfully deleted"), htmlspecialchars($name)) . "<br />"; + $savemsg = sprintf(gettext("Certificate Authority %s and its CRLs (if any) successfully deleted"), htmlspecialchars($name)); pfSenseHeader("system_camanager.php"); exit; } @@ -246,20 +246,20 @@ if ($_POST) { if ($pconfig['method'] != "existing") { /* Make sure we do not have invalid characters in the fields for the certificate */ if (preg_match("/[\?\>\<\&\/\\\"\']/", $_POST['descr'])) { - array_push($input_errors, "The field 'Descriptive Name' contains invalid characters."); + array_push($input_errors, gettext("The field 'Descriptive Name' contains invalid characters.")); } for ($i = 0; $i < count($reqdfields); $i++) { if ($reqdfields[$i] == 'dn_email') { if (preg_match("/[\!\#\$\%\^\(\)\~\?\>\<\&\/\\\,\"\']/", $_POST["dn_email"])) { - array_push($input_errors, "The field 'Distinguished name Email Address' contains invalid characters."); + array_push($input_errors, gettext("The field 'Distinguished name Email Address' contains invalid characters.")); } } else if ($reqdfields[$i] == 'dn_commonname') { if (preg_match("/[\!\@\#\$\%\^\(\)\~\?\>\<\&\/\\\,\"\']/", $_POST["dn_commonname"])) { - array_push($input_errors, "The field 'Distinguished name Common Name' contains invalid characters."); + array_push($input_errors, gettext("The field 'Distinguished name Common Name' contains invalid characters.")); } } else if (($reqdfields[$i] != "descr") && preg_match("/[\!\@\#\$\%\^\(\)\~\?\>\<\&\/\\\,\.\"\']/", $_POST["$reqdfields[$i]"])) { - array_push($input_errors, "The field '" . $reqdfieldsn[$i] . "' contains invalid characters."); + array_push($input_errors, sprintf(gettext("The field '%s' contains invalid characters."), $reqdfieldsn[$i])); } } if (!in_array($_POST["keylen"], $ca_keylens)) { diff --git a/src/usr/local/www/system_certmanager.php b/src/usr/local/www/system_certmanager.php index f186f5a..d9cd26b 100644 --- a/src/usr/local/www/system_certmanager.php +++ b/src/usr/local/www/system_certmanager.php @@ -137,7 +137,7 @@ if ($act == "del") { unset($a_cert[$id]); write_config(); - $savemsg = sprintf(gettext("Certificate %s successfully deleted"), htmlspecialchars($a_cert[$id]['descr'])) . "<br />"; + $savemsg = sprintf(gettext("Certificate %s successfully deleted"), htmlspecialchars($a_cert[$id]['descr'])); pfSenseHeader("system_certmanager.php"); exit; } @@ -247,7 +247,7 @@ if ($act == "csr") { } if ($_POST) { - // This is just the blank altername name that is added for display purposes. We don't want to validate/save it + // This is just the blank alternate name that is added for display purposes. We don't want to validate/save it if ($_POST['altname_value0'] == "") { unset($_POST['altname_type0']); unset($_POST['altname_value0']); @@ -371,14 +371,14 @@ if ($_POST) { for ($i = 0; $i < count($reqdfields); $i++) { if (preg_match('/email/', $reqdfields[$i])) { /* dn_email or csr_dn_name */ if (preg_match("/[\!\#\$\%\^\(\)\~\?\>\<\&\/\\\,\"\']/", $_POST[$reqdfields[$i]])) { - array_push($input_errors, "The field 'Distinguished name Email Address' contains invalid characters."); + array_push($input_errors, gettext("The field 'Distinguished name Email Address' contains invalid characters.")); } } else if (preg_match('/commonname/', $reqdfields[$i])) { /* dn_commonname or csr_dn_commonname */ if (preg_match("/[\!\@\#\$\%\^\(\)\~\?\>\<\&\/\\\,\"\']/", $_POST[$reqdfields[$i]])) { - array_push($input_errors, "The field 'Distinguished name Common Name' contains invalid characters."); + array_push($input_errors, gettext("The field 'Distinguished name Common Name' contains invalid characters.")); } } else if (($reqdfields[$i] != "descr") && preg_match("/[\!\@\#\$\%\^\(\)\~\?\>\<\&\/\\\,\.\"\']/", $_POST[$reqdfields[$i]])) { - array_push($input_errors, "The field '" . $reqdfieldsn[$i] . "' contains invalid characters."); + array_push($input_errors, sprintf(gettext("The field '%s' contains invalid characters."), $reqdfieldsn[$i])); } } @@ -1052,7 +1052,7 @@ foreach ($a_cert as $i => $cert): <i><?=$cert_types[$cert['type']]?></i><br /> <?php endif?> <?php if (is_array($purpose)): ?> - CA: <b><?=$purpose['ca']?></b>, Server: <b><?=$purpose['server']?></b> + CA: <b><?=$purpose['ca']?></b>, <?=gettext("Server")?>: <b><?=$purpose['server']?></b> <?php endif?> </td> <td><?=$caname?></td> @@ -1067,25 +1067,25 @@ foreach ($a_cert as $i => $cert): </td> <td> <?php if (is_cert_revoked($cert)): ?> - <i>Revoked </i> + <i><?=gettext("Revoked")?></i> <?php endif?> <?php if (is_webgui_cert($cert['refid'])): ?> - webConfigurator + <?=gettext("webConfigurator")?> <?php endif?> <?php if (is_user_cert($cert['refid'])): ?> - User Cert + <?=gettext("User Cert")?> <?php endif?> <?php if (is_openvpn_server_cert($cert['refid'])): ?> - OpenVPN Server + <?=gettext("OpenVPN Server")?> <?php endif?> <?php if (is_openvpn_client_cert($cert['refid'])): ?> - OpenVPN Client + <?=gettext("OpenVPN Client")?> <?php endif?> <?php if (is_ipsec_cert($cert['refid'])): ?> - IPsec Tunnel + <?=gettext("IPsec Tunnel")?> <?php endif?> <?php if (is_captiveportal_cert($cert['refid'])): ?> - Captive Portal + <?=gettext("Captive Portal")?> <?php endif?> <?php $refid = $cert['refid']; diff --git a/src/usr/local/www/system_crlmanager.php b/src/usr/local/www/system_crlmanager.php index 5d3a3f5..650ea20 100644 --- a/src/usr/local/www/system_crlmanager.php +++ b/src/usr/local/www/system_crlmanager.php @@ -123,7 +123,7 @@ if (!$thiscrl && (($act != "") && ($act != "new"))) { if ($act == "del") { $name = htmlspecialchars($thiscrl['descr']); if (crl_in_use($id)) { - $savemsg = sprintf(gettext("Certificate Revocation List %s is in use and cannot be deleted"), $name) . "<br />"; + $savemsg = sprintf(gettext("Certificate Revocation List %s is in use and cannot be deleted"), $name); } else { foreach ($a_crl as $cid => $acrl) { if ($acrl['refid'] == $thiscrl['refid']) { @@ -131,7 +131,7 @@ if ($act == "del") { } } write_config("Deleted CRL {$name}."); - $savemsg = sprintf(gettext("Certificate Revocation List %s successfully deleted"), $name) . "<br />"; + $savemsg = sprintf(gettext("Certificate Revocation List %s successfully deleted"), $name); } } @@ -212,13 +212,13 @@ if ($act == "delcert") { $certname = htmlspecialchars($thiscert['descr']); $crlname = htmlspecialchars($thiscrl['descr']); if (cert_unrevoke($thiscert, $thiscrl)) { - $savemsg = sprintf(gettext("Deleted Certificate %s from CRL %s"), $certname, $crlname) . "<br />"; + $savemsg = sprintf(gettext("Deleted Certificate %s from CRL %s"), $certname, $crlname); // refresh IPsec and OpenVPN CRLs openvpn_refresh_crls(); vpn_ipsec_configure(); - write_config(sprintf(gettext("Deleted Certificate %s from CRL %s"), $certname, $crlname)); + write_config($savemsg); } else { - $savemsg = sprintf(gettext("Failed to delete Certificate %s from CRL %s"), $certname, $crlname) . "<br />"; + $savemsg = sprintf(gettext("Failed to delete Certificate %s from CRL %s"), $certname, $crlname); } $act="edit"; } diff --git a/src/usr/local/www/system_gateway_groups.php b/src/usr/local/www/system_gateway_groups.php index eaebcfe..cd21fd4 100644 --- a/src/usr/local/www/system_gateway_groups.php +++ b/src/usr/local/www/system_gateway_groups.php @@ -106,7 +106,7 @@ if ($_POST) { if ($_GET['act'] == "del") { if ($a_gateway_groups[$_GET['id']]) { - $changedesc .= gettext("removed gateway group") . " {$_GET['id']}"; + $changedesc .= sprintf(gettext("removed gateway group %s"), $_GET['id']); foreach ($config['filter']['rule'] as $idx => $rule) { if ($rule['gateway'] == $a_gateway_groups[$_GET['id']]['name']) { unset($config['filter']['rule'][$idx]['gateway']); diff --git a/src/usr/local/www/system_gateway_groups_edit.php b/src/usr/local/www/system_gateway_groups_edit.php index c026615..c28fa8d 100644 --- a/src/usr/local/www/system_gateway_groups_edit.php +++ b/src/usr/local/www/system_gateway_groups_edit.php @@ -146,7 +146,7 @@ if ($_POST) { } /* check for overlaps */ if ($_POST['name'] == $gwname) { - $input_errors[] = sprintf(gettext('A gateway group cannot have the same name with a gateway "%s" please choose another name.'), $_POST['name']); + $input_errors[] = sprintf(gettext('A gateway group cannot have the same name as a gateway "%s" please choose another name.'), $_POST['name']); } } diff --git a/src/usr/local/www/system_gateways.php b/src/usr/local/www/system_gateways.php index 332a383..b28c727 100644 --- a/src/usr/local/www/system_gateways.php +++ b/src/usr/local/www/system_gateways.php @@ -115,9 +115,9 @@ function can_delete_disable_gateway_item($id, $disable = false) { $items = explode("|", $item); if ($items[0] == $a_gateways[$id]['name']) { if (!$disable) { - $input_errors[] = sprintf(gettext("Gateway '%s' cannot be deleted because it is in use on Gateway Group '%s'"), $a_gateways[$id]['name'], $group['name']); + $input_errors[] = sprintf(gettext('Gateway "%1$s" cannot be deleted because it is in use on Gateway Group "%2$s"'), $a_gateways[$id]['name'], $group['name']); } else { - $input_errors[] = sprintf(gettext("Gateway '%s' cannot be disabled because it is in use on Gateway Group '%s'"), $a_gateways[$id]['name'], $group['name']); + $input_errors[] = sprintf(gettext('Gateway "%1$s" cannot be disabled because it is in use on Gateway Group "%2$s"'), $a_gateways[$id]['name'], $group['name']); } } } @@ -129,11 +129,11 @@ function can_delete_disable_gateway_item($id, $disable = false) { if ($route['gateway'] == $a_gateways[$id]['name']) { if (!$disable) { // The user wants to delete this gateway, but there is a static route (enabled or disabled) that refers to the gateway. - $input_errors[] = sprintf(gettext("Gateway '%s' cannot be deleted because it is in use on Static Route '%s'"), $a_gateways[$id]['name'], $route['network']); + $input_errors[] = sprintf(gettext('Gateway "%1$s" cannot be deleted because it is in use on Static Route "%2$s"'), $a_gateways[$id]['name'], $route['network']); } else if (!isset($route['disabled'])) { // The user wants to disable this gateway. // But there is a static route that uses this gateway and is enabled (not disabled). - $input_errors[] = sprintf(gettext("Gateway '%s' cannot be disabled because it is in use on Static Route '%s'"), $a_gateways[$id]['name'], $route['network']); + $input_errors[] = sprintf(gettext('Gateway "%1$s" cannot be disabled because it is in use on Static Route "%2$s"'), $a_gateways[$id]['name'], $route['network']); } } } @@ -208,7 +208,7 @@ if (isset($_POST['del_x'])) { $items_deleted .= "{$rulei} "; } if (!empty($items_deleted)) { - write_config("Gateways: removed gateways {$items_deleted}"); + write_config(sprintf(gettext("Gateways: removed gateways %s", $items_deleted))); mark_subsystem_dirty('staticroutes'); } header("Location: system_gateways.php"); diff --git a/src/usr/local/www/system_gateways_edit.php b/src/usr/local/www/system_gateways_edit.php index 7c71408..a926190 100644 --- a/src/usr/local/www/system_gateways_edit.php +++ b/src/usr/local/www/system_gateways_edit.php @@ -117,6 +117,7 @@ if (isset($id) && $a_gateways[$id]) { $pconfig['losshigh'] = $a_gateways[$id]['losshigh']; $pconfig['monitor'] = $a_gateways[$id]['monitor']; $pconfig['monitor_disable'] = isset($a_gateways[$id]['monitor_disable']); + $pconfig['data_payload'] = $a_gateways[$id]['data_payload']; $pconfig['nonlocalgateway'] = isset($a_gateways[$id]['nonlocalgateway']); $pconfig['descr'] = $a_gateways[$id]['descr']; $pconfig['attribute'] = $a_gateways[$id]['attribute']; @@ -155,7 +156,7 @@ if ($_POST) { foreach ($group['item'] as $item) { $items = explode("|", $item); if ($items[0] == $_POST['name']) { - $input_errors[] = sprintf(gettext("Gateway '%s' cannot be disabled because it is in use on Gateway Group '%s'"), $_POST['name'], $group['name']); + $input_errors[] = sprintf(gettext('Gateway "%1$s" cannot be disabled because it is in use on Gateway Group "%2$s"'), $_POST['name'], $group['name']); } } } @@ -167,7 +168,7 @@ if ($_POST) { if ($route['gateway'] == $_POST['name']) { if (!isset($route['disabled'])) { // There is a static route that uses this gateway and is enabled (not disabled). - $input_errors[] = sprintf(gettext("Gateway '%s' cannot be disabled because it is in use on Static Route '%s'"), $_POST['name'], $route['network']); + $input_errors[] = sprintf(gettext('Gateway "%1$s" cannot be disabled because it is in use on Static Route "%2$s"'), $_POST['name'], $route['network']); } } } @@ -256,22 +257,25 @@ if ($_POST) { if (($_POST['monitor'] != "") && !is_ipaddr($_POST['monitor']) && $_POST['monitor'] != "dynamic") { $input_errors[] = gettext("A valid monitor IP address must be specified."); } + if (isset($_POST['data_payload']) && is_numeric($_POST['data_payload']) && $_POST['data_payload'] < 0) { + $input_errors[] = gettext("A valid data payload must be specified."); + } /* only allow correct IPv4 and IPv6 gateway addresses */ if (($_POST['gateway'] <> "") && is_ipaddr($_POST['gateway']) && $_POST['gateway'] != "dynamic") { if (is_ipaddrv6($_POST['gateway']) && ($_POST['ipprotocol'] == "inet")) { - $input_errors[] = gettext("The IPv6 gateway address '{$_POST['gateway']}' can not be used as a IPv4 gateway'."); + $input_errors[] = sprintf(gettext("The IPv6 gateway address '%s' can not be used as a IPv4 gateway."), $_POST['gateway']); } if (is_ipaddrv4($_POST['gateway']) && ($_POST['ipprotocol'] == "inet6")) { - $input_errors[] = gettext("The IPv4 gateway address '{$_POST['gateway']}' can not be used as a IPv6 gateway'."); + $input_errors[] = sprintf(gettext("The IPv4 gateway address '%s' can not be used as a IPv6 gateway."), $_POST['gateway']); } } /* only allow correct IPv4 and IPv6 monitor addresses */ if (($_POST['monitor'] <> "") && is_ipaddr($_POST['monitor']) && $_POST['monitor'] != "dynamic") { if (is_ipaddrv6($_POST['monitor']) && ($_POST['ipprotocol'] == "inet")) { - $input_errors[] = gettext("The IPv6 monitor address '{$_POST['monitor']}' can not be used on a IPv4 gateway'."); + $input_errors[] = sprintf(gettext("The IPv6 monitor address '%s' can not be used on a IPv4 gateway."), $_POST['monitor']); } if (is_ipaddrv4($_POST['monitor']) && ($_POST['ipprotocol'] == "inet6")) { - $input_errors[] = gettext("The IPv4 monitor address '{$_POST['monitor']}' can not be used on a IPv6 gateway'."); + $input_errors[] = sprintf(gettext("The IPv4 monitor address '%s' can not be used on a IPv6 gateway."), $_POST['monitor']); } } @@ -415,16 +419,16 @@ if ($_POST) { } else if ($_POST['latencyhigh']) { if (is_numeric($_POST['latencyhigh']) && ($_POST['latencyhigh'] > $dpinger_default['loss_interval'])) { - $input_errors[] = gettext(sprintf( - "The high latency threshold needs to be less than or equal to the default loss interval (%d)", - $dpinger_default['loss_interval'])); + $input_errors[] = sprintf( + gettext("The high latency threshold needs to be less than or equal to the default loss interval (%d)"), + $dpinger_default['loss_interval']); } } else if ($_POST['loss_interval']) { if (is_numeric($_POST['loss_interval']) && ($_POST['loss_interval'] < $dpinger_default['latencyhigh'])) { - $input_errors[] = gettext(sprintf( - "The loss interval needs to be greater than or equal to the default high latency threshold (%d)", - $dpinger_default['latencyhigh'])); + $input_errors[] = sprintf( + gettext("The loss interval needs to be greater than or equal to the default high latency threshold (%d)"), + $dpinger_default['latencyhigh']); } } @@ -447,16 +451,16 @@ if ($_POST) { } else if ($_POST['interval']) { if (is_numeric($_POST['interval']) && (($_POST['interval'] * 2) > $dpinger_default['time_period'])) { - $input_errors[] = gettext(sprintf( - "The probe interval needs to be half or less than the default time period over which results are averaged (%d)", - $dpinger_default['time_period'])); + $input_errors[] = sprintf( + gettext("The probe interval needs to be half or less than the default time period over which results are averaged (%d)"), + $dpinger_default['time_period']); } } else if ($_POST['time_period']) { if (is_numeric($_POST['time_period']) && ($_POST['time_period'] < ($dpinger_default['interval'] * 2))) { - $input_errors[] = gettext(sprintf( - "The time period over which results are averaged needs to be at least twice the default probe interval (%d)", - $dpinger_default['interval'])); + $input_errors[] = sprintf( + gettext("The time period over which results are averaged needs to be at least twice the default probe interval (%d)"), + $dpinger_default['interval']); } } @@ -479,16 +483,16 @@ if ($_POST) { } else if ($_POST['interval']) { if (is_numeric($_POST['interval']) && ($_POST['interval'] > $dpinger_default['alert_interval'])) { - $input_errors[] = gettext(sprintf( - "The probe interval needs to be less than or equal to the default alert interval (%d)", - $dpinger_default['alert_interval'])); + $input_errors[] = sprintf( + gettext("The probe interval needs to be less than or equal to the default alert interval (%d)"), + $dpinger_default['alert_interval']); } } else if ($_POST['alert_interval']) { if (is_numeric($_POST['alert_interval']) && ($_POST['alert_interval'] < $dpinger_default['interval'])) { - $input_errors[] = gettext(sprintf( - "The alert interval needs to be greater than or equal to the default probe interval (%d)", - $dpinger_default['interval'])); + $input_errors[] = sprintf( + gettext("The alert interval needs to be greater than or equal to the default probe interval (%d)"), + $dpinger_default['interval']); } } @@ -533,6 +537,9 @@ if ($_POST) { if (is_ipaddr($_POST['monitor'])) { $gateway['monitor'] = $_POST['monitor']; } + if (isset($_POST['data_payload']) && $_POST['data_payload'] > 0) { + $gateway['data_payload'] = $_POST['data_payload']; + } /* NOTE: If gateway ip is changed need to cleanup the old static interface route */ if ($_POST['monitor'] != "dynamic" && !empty($a_gateway_item[$realid]) && is_ipaddr($a_gateway_item[$realid]['gateway']) && @@ -762,7 +769,7 @@ $section->addInput(new Form_Input( // If any of the advanced options are non-default, we will not show the "Advanced" button // and will display the advanced section if (!(!empty($pconfig['latencylow']) || !empty($pconfig['latencyhigh']) || - !empty($pconfig['losslow']) || !empty($pconfig['losshigh']) || + !empty($pconfig['losslow']) || !empty($pconfig['losshigh']) || !empty($pconfig['data_payload']) || (isset($pconfig['weight']) && $pconfig['weight'] > 1) || (isset($pconfig['interval']) && !($pconfig['interval'] == $dpinger_default['interval'])) || (isset($pconfig['loss_interval']) && !($pconfig['loss_interval'] == $dpinger_default['loss_interval'])) || @@ -802,6 +809,14 @@ $section->addInput(new Form_Select( array_combine(range(1, 5), range(1, 5)) ))->setHelp('Weight for this gateway when used in a Gateway Group.'); +$section->addInput(new Form_Input( + 'data_payload', + 'Data Payload', + 'number', + $pconfig['data_payload'], + ['placeholder' => $dpinger_default['data_payload']] +))->setHelp('Define data payload to send on ICMP packets to gateway monitor IP.'); + $group = new Form_Group('Latency thresholds'); $group->add(new Form_Input( 'latencylow', @@ -893,7 +908,7 @@ $group->setHelp('Time interval in milliseconds between checking for an alert con $section->add($group); $section->addInput(new Form_StaticText( - 'Additional information', + gettext('Additional information'), '<span class="help-block">'. gettext('The time period over which results are averaged must be at least twice ' . 'the probe interval, otherwise the averaging would only "average" over a single probe.') . diff --git a/src/usr/local/www/system_groupmanager_addprivs.php b/src/usr/local/www/system_groupmanager_addprivs.php index 6819e39..e1ae561 100644 --- a/src/usr/local/www/system_groupmanager_addprivs.php +++ b/src/usr/local/www/system_groupmanager_addprivs.php @@ -207,8 +207,46 @@ $section->addInput(new Form_Select( $a_group['priv'], build_priv_list(), true -))->addClass('multiselect')->setHelp('Hold down CTRL (PC)/COMMAND (Mac) key to select multiple items.')->setAttribute('style', 'height:400px;'); +))->addClass('multiselect') + ->setHelp('Hold down CTRL (PC)/COMMAND (Mac) key to select multiple items.'); +$section->addInput(new Form_Select( + 'shadow', + 'Shadow', + null, + build_priv_list(), + true +))->addClass('shadowselect') + ->setHelp('Hold down CTRL (PC)/COMMAND (Mac) key to select multiple items'); + +$section->addInput(new Form_Input( + 'filtertxt', + 'Filter', + 'text', + null +))->setHelp('Show only the choices containing this term'); + +$btnfilter = new Form_Button( + 'btnfilter', + 'Filter', + null, + 'fa-filter' +); + +$btnfilter->addClass('btn btn-info'); + +$form->addGlobal($btnfilter); + +$btnclear = new Form_Button( + 'btnclear', + 'Clear', + null, + 'fa-times' +); + +$btnclear->addClass('btn btn-warning'); + +$form->addGlobal($btnclear); $form->add($section); print $form; @@ -240,12 +278,87 @@ events.push(function() { echo $jdescs; } ?> + $('.shadowselect').parent().parent('div').addClass('hidden'); + // Set the number of options to display $('.multiselect').attr("size","20"); + $('.shadowselect').attr("size","20"); // When the 'sysprivs" selector is clicked, we display a description $('.multiselect').click(function() { - $('#pdesc').html('<span style="color: green;">' + descs[$(this).children('option:selected').index()] + '</span>'); + $('#pdesc').html('<span class="text-info">' + descs[$(this).children('option:selected').index()] + '</span>'); + + // and update the shadow list from the real list + $(".multiselect option").each(function() { + shadowoption = $('.shadowselect option').filter('[value=' + $(this).val() + ']'); + + if ($(this).is(':selected')) { + shadowoption.prop("selected", true); + } else { + shadowoption.prop("selected", false); + } + }); + }); + + $('#btnfilter').prop('type', 'button'); + + $('#btnfilter').click(function() { + searchterm = $('#filtertxt').val().toLowerCase(); + copyselect(true); + + // Then filter + $(".multiselect > option").each(function() { + if (this.text.toLowerCase().indexOf(searchterm) == -1 ) { + $(this).remove(); + } + }); + }); + + $('#btnclear').prop('type', 'button'); + + $('#btnclear').click(function() { + // Copy all options from shadow to sysprivs + copyselect(true) + + $('#filtertxt').val(''); + }); + + $('#filtertxt').keypress(function(e) { + if(e.which == 13) { + e.preventDefault(); + $('#btnfilter').trigger('click'); + } + }); + + // On submit unhide all options (or else they will not submit) + $('form').submit(function() { + + $(".multiselect > option").each(function() { + $(this).show(); + }); + + $('.shadowselect').remove(); + }); + + function copyselect(selected) { + // Copy all optionsfrom shadow to sysprivs + $('.multiselect').html($('.shadowselect').html()); + + if (selected) { + // Update the shadow list from the real list + $(".shadowselect option").each(function() { + multioption = $('.multiselect option').filter('[value=' + $(this).val() + ']'); + if ($(this).is(':selected')) { + multioption.prop("selected", true); + } else { + multioption.prop("selected", false); + } + }); + } + } + + $('.multiselect').mouseup(function () { + $('.multiselect').trigger('click'); }); }); //]]> diff --git a/src/usr/local/www/system_hasync.php b/src/usr/local/www/system_hasync.php index 6104d5c..f078910 100755 --- a/src/usr/local/www/system_hasync.php +++ b/src/usr/local/www/system_hasync.php @@ -108,6 +108,12 @@ if ($_POST) { $input_errors[] = gettext("Password and confirmation must match."); } + if ($pconfig['pfsyncpeerip'] != "") { + if (!is_ipaddrv4($pconfig['pfsyncpeerip'])) { + $input_errors[] = gettext("pfsync Synchronize Peer IP must be an IPv4 IP."); + } + } + if (!$input_errors) { write_config("Updated High Availability Sync configuration"); interfaces_sync_setup(); diff --git a/src/usr/local/www/system_routes.php b/src/usr/local/www/system_routes.php index 0c4fcbd..496e9d4 100644 --- a/src/usr/local/www/system_routes.php +++ b/src/usr/local/www/system_routes.php @@ -140,7 +140,7 @@ function delete_static_route($id) { if ($_GET['act'] == "del") { if ($a_routes[$_GET['id']]) { - $changedesc = $changedesc_prefix . gettext("removed route to") . " " . $a_routes[$_GET['id']]['network']; + $changedesc = $changedesc_prefix . sprintf(gettext("removed route to %s"), $a_routes[$_GET['id']]['network']); delete_static_route($_GET['id']); unset($a_routes[$_GET['id']]); write_config($changedesc); @@ -152,12 +152,13 @@ if ($_GET['act'] == "del") { if (isset($_POST['del_x'])) { /* delete selected routes */ if (is_array($_POST['route']) && count($_POST['route'])) { - $changedesc = $changedesc_prefix . gettext("removed route to"); + $deleted_routes = ""; foreach ($_POST['route'] as $routei) { - $changedesc .= " " . $a_routes[$routei]['network']; + $deleted_routes .= " " . $a_routes[$routei]['network']; delete_static_route($routei); unset($a_routes[$routei]); } + $changedesc = $changedesc_prefix . sprintf(gettext("removed route to%s"), $deleted_routes); write_config($changedesc); header("Location: system_routes.php"); exit; @@ -170,15 +171,15 @@ if (isset($_POST['del_x'])) { // Do not enable a route whose gateway is disabled if (isset($a_gateways[$a_routes[$_GET['id']]['gateway']]['disabled'])) { $do_update_config = false; - $input_errors[] = $changedesc_prefix . gettext("gateway is disabled, cannot enable route to") . " " . $a_routes[$_GET['id']]['network']; + $input_errors[] = $changedesc_prefix . sprintf(gettext("gateway is disabled, cannot enable route to %s"), $a_routes[$_GET['id']]['network']); } else { unset($a_routes[$_GET['id']]['disabled']); - $changedesc = $changedesc_prefix . gettext("enabled route to") . " " . $a_routes[$_GET['id']]['network']; + $changedesc = $changedesc_prefix . sprintf(gettext("enabled route to %s"), $a_routes[$_GET['id']]['network']); } } else { delete_static_route($_GET['id']); $a_routes[$_GET['id']]['disabled'] = true; - $changedesc = $changedesc_prefix . gettext("disabled route to") . " " . $a_routes[$_GET['id']]['network']; + $changedesc = $changedesc_prefix . sprintf(gettext("disabled route to %s"), $a_routes[$_GET['id']]['network']); } if ($do_update_config) { diff --git a/src/usr/local/www/system_routes_edit.php b/src/usr/local/www/system_routes_edit.php index 0e81be8..d9ac2c6 100644 --- a/src/usr/local/www/system_routes_edit.php +++ b/src/usr/local/www/system_routes_edit.php @@ -130,7 +130,7 @@ if ($_POST) { } else { // Note that the 3rd parameter "disabled" must be passed as explicitly true or false. if (!validate_address_family($_POST['network'], $_POST['gateway'], $_POST['disabled'] ? true : false)) { - $input_errors[] = gettext("The gateway '{$a_gateways[$_POST['gateway']]['gateway']}' is a different Address Family than network '{$_POST['network']}'."); + $input_errors[] = sprintf(gettext('The gateway "%1$s" is a different Address Family than network "%2$s".'), $a_gateways[$_POST['gateway']]['gateway'], $_POST['network']); } } } diff --git a/src/usr/local/www/system_update_settings.php b/src/usr/local/www/system_update_settings.php index 4133234..96b7c6d 100644 --- a/src/usr/local/www/system_update_settings.php +++ b/src/usr/local/www/system_update_settings.php @@ -126,7 +126,7 @@ $section->addInput(new Form_Select( fwbranch, 'Branch', (is_pkg_installed($g['product_name'] . "-repo")) ? "stable":"development", - ["stable" => "Stable", "development" => "Development"] + ["stable" => gettext("Stable"), "development" => gettext("Development")] ))->setHelp('Please select the stable, or the development branch from which to update the system firmware. ' . ' <br />' . 'Use of the development version is at your own risk!'); diff --git a/src/usr/local/www/system_usermanager_addprivs.php b/src/usr/local/www/system_usermanager_addprivs.php index 69860ba..3b7703b 100644 --- a/src/usr/local/www/system_usermanager_addprivs.php +++ b/src/usr/local/www/system_usermanager_addprivs.php @@ -93,6 +93,7 @@ $spriv_list = $priv_list; uasort($spriv_list, admusercmp); if ($_POST) { + conf_mount_rw(); unset($input_errors); @@ -184,7 +185,46 @@ $section->addInput(new Form_Select( null, build_priv_list(), true -))->addClass('multiselect')->setHelp('Hold down CTRL (PC)/COMMAND (Mac) key to select multiple items')->setAttribute('style', 'height:400px;'); +))->addClass('multiselect') + ->setHelp('Hold down CTRL (PC)/COMMAND (Mac) key to select multiple items'); + +$section->addInput(new Form_Select( + 'shadow', + 'Shadow', + null, + build_priv_list(), + true +))->addClass('shadowselect') + ->setHelp('Hold down CTRL (PC)/COMMAND (Mac) key to select multiple items'); + +$section->addInput(new Form_Input( + 'filtertxt', + 'Filter', + 'text', + null +))->setHelp('Show only the choices containing this term'); + +$btnfilter = new Form_Button( + 'btnfilter', + 'Filter', + null, + 'fa-filter' +); + +$btnfilter->addClass('btn btn-info'); + +$form->addGlobal($btnfilter); + +$btnclear = new Form_Button( + 'btnclear', + 'Clear', + null, + 'fa-times' +); + +$btnclear->addClass('btn btn-warning'); + +$form->addGlobal($btnclear); if (isset($userid)) { $section->addInput(new Form_Input( @@ -208,6 +248,7 @@ events.push(function() { <?php + // Build a list of privilege descriptions if (is_array($spriv_list)) { $id = 0; @@ -225,12 +266,88 @@ events.push(function() { echo $jdescs; } ?> + + $('.shadowselect').parent().parent('div').addClass('hidden'); + // Set the number of options to display $('.multiselect').attr("size","20"); + $('.shadowselect').attr("size","20"); // When the 'sysprivs" selector is clicked, we display a description $('.multiselect').click(function() { - $('#pdesc').html('<span style="color: green;">' + descs[$(this).children('option:selected').index()] + '</span>'); + $('#pdesc').html('<span class="text-info">' + descs[$(this).children('option:selected').index()] + '</span>'); + + // and update the shadow list from the real list + $(".multiselect option").each(function() { + shadowoption = $('.shadowselect option').filter('[value=' + $(this).val() + ']'); + + if ($(this).is(':selected')) { + shadowoption.prop("selected", true); + } else { + shadowoption.prop("selected", false); + } + }); + }); + + $('#btnfilter').prop('type', 'button'); + + $('#btnfilter').click(function() { + searchterm = $('#filtertxt').val().toLowerCase(); + copyselect(true); + + // Then filter + $(".multiselect > option").each(function() { + if (this.text.toLowerCase().indexOf(searchterm) == -1 ) { + $(this).remove(); + } + }); + }); + + $('#btnclear').prop('type', 'button'); + + $('#btnclear').click(function() { + // Copy all options from shadow to sysprivs + copyselect(true) + + $('#filtertxt').val(''); + }); + + $('#filtertxt').keypress(function(e) { + if(e.which == 13) { + e.preventDefault(); + $('#btnfilter').trigger('click'); + } + }); + + // On submit unhide all options (or else they will not submit) + $('form').submit(function() { + + $(".multiselect > option").each(function() { + $(this).show(); + }); + + $('.shadowselect').remove(); + }); + + function copyselect(selected) { + // Copy all optionsfrom shadow to sysprivs + $('.multiselect').html($('.shadowselect').html()); + + if (selected) { + // Update the shadow list from the real list + $(".shadowselect option").each(function() { + multioption = $('.multiselect option').filter('[value=' + $(this).val() + ']'); + if ($(this).is(':selected')) { + multioption.prop("selected", true); + } else { + multioption.prop("selected", false); + } + }); + } + } + + $('.multiselect').mouseup(function () { + $('.multiselect').trigger('click'); }); }); //]]> diff --git a/src/usr/local/www/widgets/widgets/dyn_dns_status.widget.php b/src/usr/local/www/widgets/widgets/dyn_dns_status.widget.php index a875526..c8de7df 100644 --- a/src/usr/local/www/widgets/widgets/dyn_dns_status.widget.php +++ b/src/usr/local/www/widgets/widgets/dyn_dns_status.widget.php @@ -65,24 +65,48 @@ if (!is_array($config['dyndnses']['dyndns'])) { $config['dyndnses']['dyndns'] = array(); } -$a_dyndns = &$config['dyndnses']['dyndns']; +$a_dyndns = $config['dyndnses']['dyndns']; + +if (!is_array($config['dnsupdates']['dnsupdate'])) { + $config['dnsupdates']['dnsupdate'] = array(); +} + +$a_rfc2136 = $config['dnsupdates']['dnsupdate']; + +$all_dyndns = array_merge($a_dyndns, $a_rfc2136); if ($_REQUEST['getdyndnsstatus']) { $first_entry = true; - foreach ($a_dyndns as $dyndns) { + foreach ($all_dyndns as $dyndns) { if ($first_entry) { $first_entry = false; } else { // Put a vertical bar delimiter between the echoed HTML for each entry processed. echo "|"; } + $cache_sep = ":"; + if ($dyndns['type'] == "namecheap") { + $hostname = $dyndns['host'] . "." . $dyndns['domainname']; + } elseif (empty($dyndns['type'])) { + /* RFC2136, add some dummy values */ + $dyndns['type'] = '_rfc2136_'; + $dyndns['id'] = '_' . $dyndns['server']; + $hostname = $dyndns['host']; + $cache_sep = "|"; + } else { + $hostname = $dyndns['host']; + } - $filename = "{$g['conf_path']}/dyndns_{$dyndns['interface']}{$dyndns['type']}" . escapeshellarg($dyndns['host']) . "{$dyndns['id']}.cache"; + $filename = "{$g['conf_path']}/dyndns_{$dyndns['interface']}{$dyndns['type']}" . escapeshellarg($hostname) . "{$dyndns['id']}.cache"; if (file_exists($filename)) { - $ipaddr = dyndnsCheckIP($dyndns['interface']); - $cached_ip_s = explode(':', file_get_contents($filename)); + if (($dyndns['type'] == '_rfc2136_') && (!isset($dyndns['usepublicip']))) { + $ipaddr = get_interface_ip(get_failover_interface($dyndns['interface'])); + } else { + $ipaddr = dyndnsCheckIP($dyndns['interface']); + } + $cached_ip_s = explode($cache_sep, file_get_contents($filename)); $cached_ip = $cached_ip_s[0]; - if ($ipaddr <> $cached_ip) { + if (trim($ipaddr) != trim($cached_ip)) { print('<span class="text-danger">'); } else { print('<span class="text-success">'); @@ -108,7 +132,18 @@ if ($_REQUEST['getdyndnsstatus']) { </tr> </thead> <tbody> - <?php $dyndnsid = 0; foreach ($a_dyndns as $dyndns): ?> + <?php $dyndnsid = 0; foreach ($all_dyndns as $dyndns): + + if ($dyndns['type'] == "namecheap") { + $hostname = $dyndns['host'] . "." . $dyndns['domainname']; + } elseif (empty($dyndns['type'])) { + /* RFC2136, add some dummy values */ + $dyndns['type'] = '_rfc2136_'; + $dyndns['id'] = '_' . $dyndns['server']; + $hostname = $dyndns['host']; + } else { + $hostname = $dyndns['host']; + } ?> <tr ondblclick="document.location='services_dyndns_edit.php?id=<?=$dyndnsid;?>'"<?=!isset($dyndns['enable'])?' class="disabled"':''?>> <td> <?php $iflist = get_configured_interface_with_descr(); @@ -137,11 +172,14 @@ if ($_REQUEST['getdyndnsstatus']) { break; } } + if ($dyndns['type'] == '_rfc2136_') : ?> + RFC 2136 + <? endif; ?> </td> <td> <?php - print(htmlspecialchars($dyndns['host'])); + print(htmlspecialchars($hostname)); ?> </td> <td> |