summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/conf.default/config.xml2
-rw-r--r--src/etc/inc/auth.inc8
-rw-r--r--src/etc/inc/authgui.inc6
-rw-r--r--src/etc/inc/captiveportal.inc3
-rw-r--r--src/etc/inc/config.console.inc98
-rw-r--r--src/etc/inc/config.inc12
-rw-r--r--src/etc/inc/config.lib.inc8
-rw-r--r--src/etc/inc/dyndns.class65
-rw-r--r--src/etc/inc/easyrule.inc3
-rw-r--r--src/etc/inc/filter.inc51
-rw-r--r--src/etc/inc/filter_log.inc62
-rw-r--r--src/etc/inc/globals.inc4
-rw-r--r--src/etc/inc/gwlb.inc449
-rw-r--r--src/etc/inc/interfaces.inc14
-rw-r--r--src/etc/inc/ipsec.inc9
-rw-r--r--src/etc/inc/openvpn.auth-user.php2
-rw-r--r--src/etc/inc/openvpn.inc86
-rw-r--r--src/etc/inc/pfsense-utils.inc68
-rw-r--r--src/etc/inc/pkg-utils.inc11
-rw-r--r--src/etc/inc/priv.defs.inc34
-rw-r--r--src/etc/inc/priv/user.priv.inc24
-rw-r--r--src/etc/inc/rrd.inc93
-rw-r--r--src/etc/inc/service-utils.inc11
-rw-r--r--src/etc/inc/services.inc4
-rw-r--r--src/etc/inc/shaper.inc48
-rw-r--r--src/etc/inc/system.inc22
-rw-r--r--src/etc/inc/upgrade_config.inc55
-rw-r--r--src/etc/inc/util.inc22
-rw-r--r--src/etc/inc/voucher.inc3
-rw-r--r--src/etc/inc/vpn.inc10
-rw-r--r--src/etc/login.conf4
-rw-r--r--src/etc/pfSense.obsoletedfiles17
-rw-r--r--src/etc/phpshellsessions/gitsync2
-rwxr-xr-xsrc/etc/rc.bootup10
-rwxr-xr-xsrc/etc/rc.carpbackup2
-rwxr-xr-xsrc/etc/rc.gateway_alarm63
-rwxr-xr-xsrc/etc/rc.initial.defaults19
-rwxr-xr-xsrc/etc/rc.initial.halt16
-rwxr-xr-xsrc/etc/rc.initial.password8
-rwxr-xr-xsrc/etc/rc.initial.reboot16
-rwxr-xr-xsrc/etc/rc.newwanip4
-rwxr-xr-xsrc/etc/rc.openvpn2
-rwxr-xr-xsrc/etc/rc.packages17
-rw-r--r--src/etc/services2
-rwxr-xr-xsrc/etc/sshd2
-rw-r--r--src/etc/ssl/openssl.cnf2
-rwxr-xr-xsrc/sbin/dhclient-script2
-rwxr-xr-xsrc/usr/local/sbin/pfSense-upgrade29
-rwxr-xr-xsrc/usr/local/share/pfSense/post_upgrade_command2
-rw-r--r--src/usr/local/www/bootstrap/css/pfSense-dark.css52
-rw-r--r--src/usr/local/www/bootstrap/css/pfSense.css67
-rw-r--r--src/usr/local/www/classes/Form.class.php5
-rw-r--r--src/usr/local/www/classes/Form/Checkbox.class.php8
-rw-r--r--src/usr/local/www/classes/Form/Section.class.php4
-rw-r--r--src/usr/local/www/diag_arp.php4
-rw-r--r--src/usr/local/www/diag_authentication.php12
-rw-r--r--src/usr/local/www/diag_backup.php22
-rwxr-xr-xsrc/usr/local/www/diag_dns.php11
-rwxr-xr-xsrc/usr/local/www/diag_dump_states.php19
-rw-r--r--src/usr/local/www/diag_dump_states_sources.php6
-rwxr-xr-xsrc/usr/local/www/diag_halt.php (renamed from src/usr/local/www/halt.php)9
-rw-r--r--src/usr/local/www/diag_limiter_info.php5
-rw-r--r--src/usr/local/www/diag_logs_filter.php634
-rw-r--r--src/usr/local/www/diag_nanobsd.php22
-rw-r--r--src/usr/local/www/diag_ndp.php5
-rw-r--r--src/usr/local/www/diag_packet_capture.php27
-rw-r--r--src/usr/local/www/diag_pf_info.php8
-rw-r--r--src/usr/local/www/diag_pftop.php (renamed from src/usr/local/www/diag_system_pftop.php)20
-rw-r--r--src/usr/local/www/diag_ping.php16
-rwxr-xr-xsrc/usr/local/www/diag_reboot.php (renamed from src/usr/local/www/reboot.php)19
-rw-r--r--src/usr/local/www/diag_resetstate.php9
-rw-r--r--src/usr/local/www/diag_routes.php24
-rw-r--r--src/usr/local/www/diag_smart.php13
-rw-r--r--src/usr/local/www/diag_sockets.php11
-rw-r--r--src/usr/local/www/diag_states_summary.php9
-rw-r--r--src/usr/local/www/diag_system_activity.php5
-rw-r--r--src/usr/local/www/diag_tables.php18
-rw-r--r--src/usr/local/www/diag_testport.php35
-rw-r--r--src/usr/local/www/diag_traceroute.php11
-rw-r--r--src/usr/local/www/easyrule.php9
-rw-r--r--src/usr/local/www/edit.php19
-rw-r--r--src/usr/local/www/exec.php14
-rw-r--r--src/usr/local/www/firewall_aliases.php19
-rwxr-xr-xsrc/usr/local/www/firewall_aliases_edit.php44
-rwxr-xr-xsrc/usr/local/www/firewall_aliases_import.php3
-rw-r--r--src/usr/local/www/firewall_nat.php24
-rw-r--r--src/usr/local/www/firewall_nat_1to1.php14
-rw-r--r--src/usr/local/www/firewall_nat_1to1_edit.php55
-rw-r--r--src/usr/local/www/firewall_nat_edit.php160
-rw-r--r--src/usr/local/www/firewall_nat_npt.php14
-rw-r--r--src/usr/local/www/firewall_nat_npt_edit.php27
-rw-r--r--src/usr/local/www/firewall_nat_out.php85
-rw-r--r--src/usr/local/www/firewall_nat_out_edit.php41
-rw-r--r--src/usr/local/www/firewall_rules.php95
-rw-r--r--src/usr/local/www/firewall_rules_edit.php158
-rw-r--r--src/usr/local/www/firewall_schedule.php25
-rw-r--r--src/usr/local/www/firewall_schedule_edit.php249
-rw-r--r--src/usr/local/www/firewall_shaper.php29
-rw-r--r--src/usr/local/www/firewall_shaper_queues.php24
-rw-r--r--src/usr/local/www/firewall_shaper_vinterface.php14
-rw-r--r--src/usr/local/www/firewall_shaper_wizards.php9
-rw-r--r--src/usr/local/www/firewall_virtual_ip.php28
-rw-r--r--src/usr/local/www/firewall_virtual_ip_edit.php50
-rw-r--r--src/usr/local/www/guiconfig.inc19
-rwxr-xr-xsrc/usr/local/www/head.inc22
-rw-r--r--src/usr/local/www/help.php34
-rw-r--r--src/usr/local/www/index.php104
-rw-r--r--src/usr/local/www/jquery/pfSenseHelpers.js48
-rw-r--r--src/usr/local/www/pkg_edit.php6
-rw-r--r--src/usr/local/www/pkg_mgr_install.php11
-rw-r--r--src/usr/local/www/services_captiveportal.php4
-rw-r--r--src/usr/local/www/services_captiveportal_filemanager.php4
-rw-r--r--src/usr/local/www/services_captiveportal_hostname.php4
-rw-r--r--src/usr/local/www/services_captiveportal_ip.php4
-rw-r--r--src/usr/local/www/services_captiveportal_mac.php4
-rw-r--r--src/usr/local/www/services_captiveportal_vouchers.php4
-rw-r--r--src/usr/local/www/services_captiveportal_zones.php2
-rw-r--r--src/usr/local/www/services_captiveportal_zones_edit.php4
-rw-r--r--src/usr/local/www/services_dhcp.php2
-rw-r--r--src/usr/local/www/services_dhcpv6.php8
-rw-r--r--src/usr/local/www/services_dnsmasq.php1
-rw-r--r--src/usr/local/www/services_dnsmasq_edit.php103
-rw-r--r--src/usr/local/www/services_dyndns.php4
-rw-r--r--src/usr/local/www/services_dyndns_edit.php2
-rw-r--r--src/usr/local/www/services_igmpproxy_edit.php2
-rw-r--r--src/usr/local/www/services_ntpd.php6
-rw-r--r--src/usr/local/www/services_ntpd_gps.php2
-rw-r--r--src/usr/local/www/services_ntpd_pps.php2
-rw-r--r--src/usr/local/www/services_pppoe.php (renamed from src/usr/local/www/vpn_pppoe.php)12
-rw-r--r--src/usr/local/www/services_pppoe_edit.php (renamed from src/usr/local/www/vpn_pppoe_edit.php)6
-rw-r--r--src/usr/local/www/services_rfc2136.php4
-rw-r--r--src/usr/local/www/services_rfc2136_edit.php2
-rw-r--r--src/usr/local/www/services_unbound.php3
-rw-r--r--src/usr/local/www/services_unbound_host_edit.php97
-rw-r--r--src/usr/local/www/services_wol.php4
-rw-r--r--src/usr/local/www/shortcuts.inc44
-rwxr-xr-xsrc/usr/local/www/status.php6
-rw-r--r--src/usr/local/www/status_carp.php (renamed from src/usr/local/www/carp_status.php)8
-rw-r--r--src/usr/local/www/status_filter_reload.php2
-rw-r--r--src/usr/local/www/status_ipsec.php (renamed from src/usr/local/www/diag_ipsec.php)25
-rw-r--r--src/usr/local/www/status_ipsec_leases.php (renamed from src/usr/local/www/diag_ipsec_leases.php)12
-rw-r--r--src/usr/local/www/status_ipsec_sad.php (renamed from src/usr/local/www/diag_ipsec_sad.php)14
-rw-r--r--src/usr/local/www/status_ipsec_spd.php (renamed from src/usr/local/www/diag_ipsec_spd.php)12
-rw-r--r--src/usr/local/www/status_lb_pool.php2
-rw-r--r--src/usr/local/www/status_lb_vs.php2
-rwxr-xr-xsrc/usr/local/www/status_logs.php (renamed from src/usr/local/www/diag_logs.php)394
-rw-r--r--src/usr/local/www/status_logs_filter.php1036
-rwxr-xr-xsrc/usr/local/www/status_logs_filter_dynamic.php (renamed from src/usr/local/www/diag_logs_filter_dynamic.php)42
-rw-r--r--src/usr/local/www/status_logs_filter_summary.php (renamed from src/usr/local/www/diag_logs_filter_summary.php)37
-rw-r--r--src/usr/local/www/status_logs_settings.php (renamed from src/usr/local/www/diag_logs_settings.php)40
-rw-r--r--[-rwxr-xr-x]src/usr/local/www/status_logs_vpn.php (renamed from src/usr/local/www/diag_logs_vpn.php)36
-rw-r--r--src/usr/local/www/status_openvpn.php1
-rwxr-xr-xsrc/usr/local/www/status_pkglogs.php (renamed from src/usr/local/www/diag_pkglogs.php)8
-rw-r--r--src/usr/local/www/status_queues.php49
-rw-r--r--src/usr/local/www/status_upnp.php2
-rw-r--r--src/usr/local/www/system.php6
-rw-r--r--src/usr/local/www/system_advanced_admin.php4
-rw-r--r--src/usr/local/www/system_advanced_firewall.php2
-rw-r--r--src/usr/local/www/system_advanced_misc.php27
-rw-r--r--src/usr/local/www/system_advanced_network.php2
-rw-r--r--src/usr/local/www/system_advanced_notifications.php4
-rw-r--r--src/usr/local/www/system_advanced_sysctl.php2
-rw-r--r--src/usr/local/www/system_authservers.php2
-rw-r--r--src/usr/local/www/system_camanager.php2
-rw-r--r--src/usr/local/www/system_certmanager.php2
-rw-r--r--src/usr/local/www/system_crlmanager.php2
-rw-r--r--src/usr/local/www/system_gateways_edit.php465
-rw-r--r--src/usr/local/www/system_groupmanager.php2
-rw-r--r--src/usr/local/www/system_groupmanager_addprivs.php2
-rw-r--r--src/usr/local/www/system_usermanager.php2
-rw-r--r--src/usr/local/www/system_usermanager_addprivs.php2
-rw-r--r--src/usr/local/www/system_usermanager_settings.php2
-rwxr-xr-xsrc/usr/local/www/tree/tree.css2
-rw-r--r--src/usr/local/www/vpn_ipsec.php6
-rw-r--r--src/usr/local/www/vpn_ipsec_keys.php4
-rw-r--r--src/usr/local/www/vpn_ipsec_keys_edit.php2
-rw-r--r--src/usr/local/www/vpn_ipsec_mobile.php6
-rw-r--r--src/usr/local/www/vpn_ipsec_phase1.php10
-rw-r--r--src/usr/local/www/vpn_ipsec_phase2.php10
-rw-r--r--src/usr/local/www/vpn_ipsec_settings.php6
-rw-r--r--src/usr/local/www/vpn_openvpn_client.php6
-rw-r--r--src/usr/local/www/vpn_openvpn_csc.php2
-rw-r--r--src/usr/local/www/vpn_openvpn_server.php38
-rw-r--r--src/usr/local/www/widgets/include/carp_status.inc4
-rw-r--r--src/usr/local/www/widgets/include/dyn_dns_status.inc2
-rw-r--r--src/usr/local/www/widgets/include/ipsec.inc2
-rw-r--r--src/usr/local/www/widgets/include/log.inc2
-rw-r--r--src/usr/local/www/widgets/widgets/carp_status.widget.php28
-rw-r--r--src/usr/local/www/widgets/widgets/dyn_dns_status.widget.php4
-rw-r--r--src/usr/local/www/widgets/widgets/gateways.widget.php24
-rw-r--r--src/usr/local/www/widgets/widgets/installed_packages.widget.php6
-rw-r--r--src/usr/local/www/widgets/widgets/interface_statistics.widget.php2
-rw-r--r--src/usr/local/www/widgets/widgets/ipsec.widget.php7
-rw-r--r--src/usr/local/www/widgets/widgets/log.widget.php8
-rw-r--r--src/usr/local/www/widgets/widgets/ntp_status.widget.php10
-rw-r--r--src/usr/local/www/widgets/widgets/openvpn.widget.php2
-rw-r--r--src/usr/local/www/widgets/widgets/services_status.widget.php6
-rw-r--r--src/usr/local/www/widgets/widgets/system_information.widget.php127
-rw-r--r--src/usr/local/www/widgets/widgets/traffic_graphs.widget.php3
-rw-r--r--src/usr/local/www/widgets/widgets/wake_on_lan.widget.php4
200 files changed, 4039 insertions, 2955 deletions
diff --git a/src/conf.default/config.xml b/src/conf.default/config.xml
index fcd26e8..54003a3 100644
--- a/src/conf.default/config.xml
+++ b/src/conf.default/config.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<pfsense>
- <version>12.9</version>
+ <version>13.1</version>
<lastchange/>
<system>
<optimization>normal</optimization>
diff --git a/src/etc/inc/auth.inc b/src/etc/inc/auth.inc
index 92b9705..fffe84f 100644
--- a/src/etc/inc/auth.inc
+++ b/src/etc/inc/auth.inc
@@ -165,7 +165,7 @@ if (function_exists("display_error_form") && !isset($config['system']['webgui'][
$referrer_host = str_replace(array("[", "]"), "", $referrer_host);
if ($referrer_host) {
if (strcasecmp($referrer_host, $config['system']['hostname'] . "." . $config['system']['domain']) == 0 ||
- strcasecmp($referrer_host, $config['system']['hostname']) == 0) {
+ strcasecmp($referrer_host, $config['system']['hostname']) == 0) {
$found_host = true;
}
@@ -1126,11 +1126,11 @@ function ldap_get_groups($username, $authcfg) {
$gresults = isset($authcfg['ldap_rfc2307']) ? $info : $info[0][$ldapgroupattribute];
- if(is_array($gresults)) {
+ if (is_array($gresults)) {
/* Iterate through the groups and throw them into an array */
foreach ($gresults as $grp) {
- if (((isset($authcfg['ldap_rfc2307'])) && (stristr($grp["dn"], "CN=") !== false))
- || ((!isset($authcfg['ldap_rfc2307'])) && (stristr($grp, "CN=") !== false))) {
+ if (((isset($authcfg['ldap_rfc2307'])) && (stristr($grp["dn"], "CN=") !== false)) ||
+ ((!isset($authcfg['ldap_rfc2307'])) && (stristr($grp, "CN=") !== false))) {
$grpsplit = isset($authcfg['ldap_rfc2307']) ? explode(",", $grp["dn"]) : explode(",", $grp);
$memberof[] = preg_replace("/CN=/i", "", $grpsplit[0]);
}
diff --git a/src/etc/inc/authgui.inc b/src/etc/inc/authgui.inc
index a60712d..58bbd6c 100644
--- a/src/etc/inc/authgui.inc
+++ b/src/etc/inc/authgui.inc
@@ -130,7 +130,7 @@ function display_error_form($http_code, $desc) {
$cssfile = "/bootstrap/css/pfSense.css";
if (isset($config['system']['webgui']['webguicss'])) {
- if(file_exists("bootstrap/css/" . $config['system']['webgui']['webguicss'])) {
+ if (file_exists("bootstrap/css/" . $config['system']['webgui']['webguicss'])) {
$cssfile = "/bootstrap/css/" . $config['system']['webgui']['webguicss'];
}
}
@@ -139,6 +139,7 @@ function display_error_form($http_code, $desc) {
<!DOCTYPE html>
<html lang="en">
<head>
+ <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="<?=$cssfile?>" />
<title><?=gettext("Error: not allowed"); ?></title>
</head>
@@ -233,7 +234,7 @@ if ($local_ip == false) {
$cssfile = "/bootstrap/css/pfSense.css";
if (isset($config['system']['webgui']['webguicss'])) {
- if(file_exists("bootstrap/css/" . $config['system']['webgui']['webguicss'])) {
+ if (file_exists("bootstrap/css/" . $config['system']['webgui']['webguicss'])) {
$cssfile = "/bootstrap/css/" . $config['system']['webgui']['webguicss'];
}
}
@@ -242,6 +243,7 @@ if (isset($config['system']['webgui']['webguicss'])) {
<!DOCTYPE html>
<html lang="en">
<head>
+ <meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="<?=$cssfile?>" />
<title><?=gettext("Login"); ?></title>
<script type="text/javascript">
diff --git a/src/etc/inc/captiveportal.inc b/src/etc/inc/captiveportal.inc
index 7bfaf44..0f1d166 100644
--- a/src/etc/inc/captiveportal.inc
+++ b/src/etc/inc/captiveportal.inc
@@ -545,8 +545,9 @@ EOD;
$rulenum++;
$cprules .= "add {$rulenum} pass ip from table(100) to any out\n";
$rulenum++;
- foreach ($cpips as $cpip)
+ foreach ($cpips as $cpip) {
$cprules .= "table 100 add {$cpip}\n";
+ }
$cprules .= "add {$rulenum} pass ip from any to 255.255.255.255 in\n";
$rulenum++;
$cprules .= "add {$rulenum} pass ip from 255.255.255.255 to any out\n";
diff --git a/src/etc/inc/config.console.inc b/src/etc/inc/config.console.inc
index 33194bf..f719591 100644
--- a/src/etc/inc/config.console.inc
+++ b/src/etc/inc/config.console.inc
@@ -101,15 +101,13 @@ BEGIN MANUAL CONFIGURATION OR WE WILL PROCEED WITH AUTO CONFIGURATION.
EOD;
}
- echo <<<EOD
-
-Do you want to set up VLANs first?
-
-If you are not going to use VLANs, or only for optional interfaces, you should
-say no here and use the webConfigurator to configure VLANs later, if required.
-
-Do you want to set up VLANs now [y|n]?
-EOD;
+ echo "\n" . gettext("Do you want to set up VLANs first?");
+ echo "\n" .
+ gettext(
+ "If you are not going to use VLANs, or only for optional interfaces, you should\n" .
+ "say no here and use the webConfigurator to configure VLANs later, if required.") .
+ "\n";
+ echo "\n" . gettext("Do you want to set up VLANs now [y|n]?") . " ";
if ($auto_assign) {
$key = timeout();
@@ -314,10 +312,7 @@ EOD;
echo "OPT" . ($i+1) . " -> " . $optif[$i] . "\n";
}
- echo <<<EOD
-
-Do you want to proceed [y|n]?
-EOD;
+ echo "\n" . gettext("Do you want to proceed [y|n]?") . " ";
$key = chop(fgets($fp));
}
@@ -330,13 +325,8 @@ EOD;
$config['interfaces']['lan']['enable'] = true;
} elseif (!platform_booting() && !$auto_assign) {
-echo <<<EODD
-
-You have chosen to remove the LAN interface.
-
-Would you like to remove the LAN IP address and
-unload the interface now? [y|n]?
-EODD;
+ echo "\n" . gettext("You have chosen to remove the LAN interface.") . "\n";
+ echo "\n" . gettext("Would you like to remove the LAN IP address and \nunload the interface now [y|n]?") . " ";
if (strcasecmp(chop(fgets($fp)), "y") == 0) {
if (isset($config['interfaces']['lan']) && $config['interfaces']['lan']['if']) {
@@ -497,13 +487,8 @@ function vlan_setup() {
$iflist = get_interface_list();
if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) {
-
- echo <<<EOD
-
-WARNING: all existing VLANs will be cleared if you proceed!
-
-Do you want to proceed [y|n]?
-EOD;
+ echo "\n" . gettext("WARNING: all existing VLANs will be cleared if you proceed!") . "\n";
+ echo "\n" . gettext("Do you want to proceed [y|n]?") . " ";
if (strcasecmp(chop(fgets($fp)), "y") != 0) {
return;
@@ -563,4 +548,63 @@ EOD;
}
}
+function check_for_alternate_interfaces() {
+ global $config;
+
+ // If the WAN and/or LAN devices in the factory default config do not exist,
+ // then look for alternate devices.
+ // This lets many systems boot a factory default config without being
+ // forced to do interface assignment on the console.
+
+ $specplatform = system_identify_specific_platform();
+ $default_device = array();
+
+ // If we recognise the platform, then specify the devices directly.
+ switch ($specplatform['name']) {
+ case 'alix':
+ $default_device['wan'] = "vr1";
+ $default_device['lan'] = "vr0";
+ break;
+ case 'APU':
+ $default_device['wan'] = "re1";
+ $default_device['lan'] = "re2";
+ break;
+ case 'RCC-VE':
+ $default_device['wan'] = "igb0";
+ $default_device['lan'] = "igb1";
+ break;
+ default:
+ $default_device['wan'] = "";
+ $default_device['lan'] = "";
+ break;
+ }
+
+ // Other common device names can be put here and will be looked for
+ // if the system was not one of the known platforms.
+ $other_devices_arr['wan'] = array("vr1", "re1", "igb0", "em0");
+ $other_devices_arr['lan'] = array("vr0", "re2", "igb1", "em1");
+ $interface_assignment_changed = false;
+
+ foreach ($other_devices_arr as $ifname => $other_devices) {
+ if (!does_interface_exist($config['interfaces'][$ifname]['if'])) {
+ if (does_interface_exist($default_device[$ifname])) {
+ $config['interfaces'][$ifname]['if'] = $default_device[$ifname];
+ $interface_assignment_changed = true;
+ } else {
+ foreach ($other_devices as $other_device) {
+ if (does_interface_exist($other_device)) {
+ $config['interfaces'][$ifname]['if'] = $other_device;
+ $interface_assignment_changed = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ if ($interface_assignment_changed) {
+ write_config("Factory default boot detected WAN " . $config['interfaces']['wan']['if'] . " and LAN " . $config['interfaces']['lan']['if']);
+ }
+}
+
?>
diff --git a/src/etc/inc/config.inc b/src/etc/inc/config.inc
index b3395c8..4c07213 100644
--- a/src/etc/inc/config.inc
+++ b/src/etc/inc/config.inc
@@ -217,6 +217,18 @@ if (isset($config['system']['timezone']) &&
}
date_default_timezone_set("$timezone");
+/* Set the default interface language */
+if ($config['system']['language'] <> "") {
+ $g['language'] = $config['system']['language'];
+} elseif ($g['language'] == "") {
+ $g['language'] = 'en_US';
+}
+
+if (!function_exists('set_language')) {
+ require_once("pfsense-utils.inc");
+}
+set_language($g['language']);
+
if ($config_parsed == true) {
/* process packager manager custom rules */
if (is_dir("/usr/local/pkg/parse_config")) {
diff --git a/src/etc/inc/config.lib.inc b/src/etc/inc/config.lib.inc
index 0ea97b3..9eef685 100644
--- a/src/etc/inc/config.lib.inc
+++ b/src/etc/inc/config.lib.inc
@@ -515,7 +515,7 @@ function safe_write_file($file, $content, $force_binary) {
* null
******/
/* save the system configuration */
-function write_config($desc="Unknown", $backup = true) {
+function write_config($desc="Unknown", $backup = true, $write_config_only = false) {
global $config, $g;
if (!empty($_SERVER['REMOTE_ADDR'])) {
@@ -580,6 +580,12 @@ function write_config($desc="Unknown", $backup = true) {
unlock($lockkey);
+ if ($write_config_only) {
+ /* tell kernel to sync fs data */
+ conf_mount_ro();
+ return $config;
+ }
+
unlink_if_exists("/usr/local/pkg/pf/carp_sync_client.php");
/* tell kernel to sync fs data */
diff --git a/src/etc/inc/dyndns.class b/src/etc/inc/dyndns.class
index 610afad..1d1641b 100644
--- a/src/etc/inc/dyndns.class
+++ b/src/etc/inc/dyndns.class
@@ -33,6 +33,8 @@
* - DNSimple (dnsimple.com)
* - Google Domains (domains.google.com)
* - DNS Made Easy (www.dnsmadeeasy.com)
+ * - SPDNS (spdns.de)
+ * - SPDNS IPv6 (spdns.de)
* +----------------------------------------------------+
* Requirements:
* - PHP version 4.0.2 or higher with the CURL Library and the PCRE Library
@@ -79,6 +81,8 @@
* DNSimple - Last Tested: 09 February 2015
* Google Domains - Last Tested: 27 April 2015
* DNS Made Easy - Last Tested: 27 April 2015
+ * SPDNS - Last Tested: 04 December 2015
+ * SPDNS IPv6 - Last Tested: 04 December 2015
* +====================================================+
*
* @author E.Kristensen
@@ -179,6 +183,7 @@
switch ($dnsService) {
case 'he-net-v6':
case 'custom-v6':
+ case 'spdns-v6':
$this->_useIPv6 = true;
break;
default:
@@ -254,6 +259,8 @@
case 'dnsimple':
case 'googledomains':
case 'dnsmadeeasy':
+ case 'spdns':
+ case 'spdns-v6':
$this->_update();
if ($this->_dnsDummyUpdateDone == true) {
// If a dummy update was needed, then sleep a while and do the update again to put the proper address back.
@@ -293,7 +300,7 @@
$ch = curl_init();
if ($this->_useIPv6 == false) {
- curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );
+ curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
}
if ($this->_dnsService != 'ods' and $this->_dnsService != 'route53 ') {
@@ -684,7 +691,7 @@
case 'cloudflare':
$needsIP = TRUE;
$dnsServer ='api.cloudflare.com';
- $dnsHost = str_replace(' ','', $this->_dnsHost);
+ $dnsHost = str_replace(' ', '', $this->_dnsHost);
$host_names = explode(".", $dnsHost);
$bottom_host_name = $host_names[count($host_names)-2] . "." . $host_names[count($host_names)-1];
@@ -700,12 +707,12 @@
curl_setopt($ch, CURLOPT_URL, $getZoneId);
$output = json_decode(curl_exec($ch));
$zone = $output->result[0]->id;
- if ($zone){ // If zone ID was found get host ID
+ if ($zone) { // If zone ID was found get host ID
$getHostId = "https://{$dnsServer}/client/v4/zones/{$zone}/dns_records?name={$this->_dnsHost}";
curl_setopt($ch, CURLOPT_URL, $getHostId);
$output = json_decode(curl_exec($ch));
$host = $output->result[0]->id;
- if ($host){ // If host ID was found update host
+ if ($host) { // If host ID was found update host
$hostData = array(
"content" => "{$this->_dnsIP}",
"type" => "A",
@@ -717,7 +724,7 @@
$updateHostId = "https://{$dnsServer}/client/v4/zones/{$zone}/dns_records/{$host}";
curl_setopt($ch, CURLOPT_URL, $updateHostId);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
- curl_setopt($ch, CURLOPT_POSTFIELDS,$data_json);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data_json);
}
}
break;
@@ -821,6 +828,23 @@
$server = "https://cp.dnsmadeeasy.com/servlet/updateip";
curl_setopt($ch, CURLOPT_URL, $server . '?username=' . $this->_dnsUser . '&password=' . $this->_dnsPass . '&id=' . $this->_dnsHost . '&ip=' . $this->_dnsIP);
break;
+ case 'spdns':
+ case 'spdns-v6':
+ $needsIP = FALSE;
+ if ($this->_dnsVerboseLog) {
+ log_error("SPDNS: ({$this->_dnsHost}) DNS update() starting.");
+ }
+ curl_setopt($ch, CURLOPT_USERPWD, $this->_dnsUser.':'.$this->_dnsPass);
+ $server = "https://update.spdns.de/nic/update";
+ $port = "";
+ if ($this->_dnsServer) {
+ $server = $this->_dnsServer;
+ }
+ if ($this->_dnsPort) {
+ $port = ":" . $this->_dnsPort;
+ }
+ curl_setopt($ch, CURLOPT_URL, $server .$port . '?hostname=' . $this->_dnsHost . '&myip=' . $this->_dnsIP);
+ break;
default:
break;
}
@@ -1279,17 +1303,14 @@
break;
case 'cloudflare':
$output = json_decode($data);
- if ($output->result->content === $this->_dnsIP){
+ if ($output->result->content === $this->_dnsIP) {
$status = "DynDNS: (Success) {$this->_dnsHost} updated to {$this->_dnsIP}";
$successful_update = true;
- }
- elseif ($output->errors[0]->code === 9103){
+ } elseif ($output->errors[0]->code === 9103) {
$status = "DynDNS ({$this->_dnsHost}): ERROR - Invalid Credentials! Don't forget to use API Key for password field with CloudFlare.";
- }
- elseif (($output->success) && (!$output->result[0]->id)) {
+ } elseif (($output->success) && (!$output->result[0]->id)) {
$status = "DynDNS ({$this->_dnsHost}): ERROR - Zone or Host ID was not found, check your hostname.";
- }
- else {
+ } else {
$status = "DynDNS ({$this->_dnsHost}): UNKNOWN ERROR - {$output->errors[0]->message}";
log_error("DynDNS ({$this->_dnsHost}): PAYLOAD: {$data}");
}
@@ -1417,6 +1438,26 @@
break;
}
break;
+ case 'spdns':
+ case 'spdns-v6':
+ if (preg_match('/notfqdn/i', $data)) {
+ $status = "phpDynDNS ({$this->_dnsHost}): (Error) Not A FQDN!";
+ } else if (preg_match('/nohost/i', $data)) {
+ $status = "phpDynDNS ({$this->_dnsHost}): (Error) No such host";
+ } else if (preg_match('/nochg/i', $data)) {
+ $status = "phpDynDNS ({$this->_dnsHost}): (Success) No Change In IP Address";
+ $successful_update = true;
+ } else if (preg_match('/good/i', $data)) {
+ $status = "phpDynDNS ({$this->_dnsHost}): (Success) IP Address Changed Successfully! (".$this->_dnsIP.")";
+ $successful_update = true;
+ } else if (preg_match('/badauth/i', $data)) {
+ $status = "phpDynDNS ({$this->_dnsHost}): (Error) User Authorization Failed";
+ } else {
+ $status = "phpDynDNS ({$this->_dnsHost}): (Unknown Response)";
+ log_error("phpDynDNS ({$this->_dnsHost}): PAYLOAD: {$data}");
+ $this->_debug($data);
+ }
+ break;
}
if ($successful_update == true) {
diff --git a/src/etc/inc/easyrule.inc b/src/etc/inc/easyrule.inc
index 199e7d0..727fd4b 100644
--- a/src/etc/inc/easyrule.inc
+++ b/src/etc/inc/easyrule.inc
@@ -53,8 +53,9 @@ function easyrule_find_rule_interface($int) {
}
/* add ipsec interfaces */
- if (ipsec_enabled())
+ if (ipsec_enabled()) {
$iflist["enc0"] = "IPSEC";
+ }
if (isset($iflist[$int])) {
return $int;
diff --git a/src/etc/inc/filter.inc b/src/etc/inc/filter.inc
index f236289..2d4c6a5 100644
--- a/src/etc/inc/filter.inc
+++ b/src/etc/inc/filter.inc
@@ -430,31 +430,32 @@ function filter_configure_sync($delete_states_if_needed = true) {
* then output the contents of the error to the caller
*/
if ($rules_loading <> 0) {
- $saved_line_error = $rules_error[0];
- $line_error = explode(":", $rules_error[0]);
- $line_number = $line_error[1];
- $line_split = file("{$g['tmp_path']}/rules.debug");
- if (is_array($line_split)) {
- $line_error = sprintf(gettext('The line in question reads [%1$d]: %2$s'), $line_number, $line_split[$line_number-1]);
- }
- unset($line_split);
-
- /* Brutal ugly hack but required -- PF is stuck, unwedge */
- if (strstr("$rules_error[0]", "busy")) {
- exec("/sbin/pfctl -d; /sbin/pfctl -e; /sbin/pfctl -f {$g['tmp_path']}/rules.debug");
- $error_msg = gettext("PF was wedged/busy and has been reset.");
- file_notice("pf_busy", $error_msg, "pf_busy", "");
- } else {
- $_grbg = exec("/sbin/pfctl -o basic -f {$g['tmp_path']}/rules.debug.old 2>&1");
+ foreach ($rules_error as $errorline) {
+ $saved_line_error = $errorline;
+ $line_error = explode(":", $errorline);
+ $line_number = $line_error[1];
+ $line_split = file("{$g['tmp_path']}/rules.debug");
+ if (is_array($line_split)) {
+ $line_error = sprintf(gettext('The line in question reads [%1$d]: %2$s'), $line_number, $line_split[$line_number-1]);
+ }
+ unset($line_split);
+
+ /* Brutal ugly hack but required -- PF is stuck, unwedge */
+ if (strstr("$rules_error[0]", "busy")) {
+ exec("/sbin/pfctl -d; /sbin/pfctl -e; /sbin/pfctl -f {$g['tmp_path']}/rules.debug");
+ $error_msg = gettext("PF was wedged/busy and has been reset.");
+ file_notice("pf_busy", $error_msg, "pf_busy", "");
+ } else {
+ $_grbg = exec("/sbin/pfctl -o basic -f {$g['tmp_path']}/rules.debug.old 2>&1");
+ }
+ if ($line_error and $line_number) {
+ file_notice("filter_load", sprintf(gettext('There were error(s) loading the rules: %1$s - %2$s'), $saved_line_error, $line_error), "Filter Reload", "");
+ update_filter_reload_status(sprintf(gettext('There were error(s) loading the rules: %1$s - %2$s'), $saved_line_error, $line_error));
+ unlock($filterlck);
+ return;
+ }
}
unset($rules_loading, $rules_error);
-
- if ($line_error and $line_number) {
- file_notice("filter_load", sprintf(gettext('There were error(s) loading the rules: %1$s - %2$s'), $saved_line_error, $line_error), "Filter Reload", "");
- update_filter_reload_status(sprintf(gettext('There were error(s) loading the rules: %1$s - %2$s'), $saved_line_error, $line_error));
- unlock($filterlck);
- return;
- }
}
# If we are not using bogonsv6 then we can remove any bogonsv6 table from the running pf (if the table is not there, the kill is still fine).
@@ -2871,7 +2872,7 @@ function filter_generate_user_rule($rule) {
(isset($rule['max-src-conn-rate']) and $rule['max-src-conn-rate'] <> "") or
(isset($rule['max-src-conn-rates']) and $rule['max-src-conn-rates'] <> ""))) or
(isset($rule['sloppy'])) or
- (isset($rule['nopfsync'])) ) {
+ (isset($rule['nopfsync']))) {
$aline['flags'] .= "( ";
if (isset($rule['sloppy'])) {
$aline['flags'] .= "sloppy ";
@@ -3323,7 +3324,7 @@ EOD;
}
/* allow access to DHCP relay on interfaces */
- if(isset($config['dhcrelay']['enable'])) {
+ if (isset($config['dhcrelay']['enable'])) {
$dhcifaces = explode(",", $dhcrelaycfg['interface']);
foreach ($dhcifaces as $dhcrelayif) {
if ($dhcrelayif == $on) {
diff --git a/src/etc/inc/filter_log.inc b/src/etc/inc/filter_log.inc
index a010471..e3ca6fe 100644
--- a/src/etc/inc/filter_log.inc
+++ b/src/etc/inc/filter_log.inc
@@ -113,11 +113,16 @@ function conv_log_filter($logfile, $nentries, $tail = 50, $filtertext = "", $fil
$date_pattern = "\(" . $month_pattern . "\ +" . $day_pattern . "\ +" . $time_pattern . "\)";
- $process_pattern = "\(.*?\)";
- $pid_pattern = "\(.*?\)\(?::\ +\)?\(?:\[[0-9:]*\]\)?:?";
+ $host_pattern = "\(.*?\)";
+# $host_pattern = "\([a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9]\)";
+
+ $process_pattern = "\(.*?\)\(?::\ +\)?";
+ $pid_pattern = "\(?:\[[0-9:]*\]\)?:?";
+ $process_pid_pattern = $process_pattern . $pid_pattern;
+
$log_message_pattern = "\(.*\)";
- $pattern = "^" . $date_pattern . "\ +" . $process_pattern . "\ +" . $pid_pattern . "\ +" . $log_message_pattern . "$";
+ $pattern = "^" . $date_pattern . "\ +" . $host_pattern . "\ +" . $process_pid_pattern . "\ +" . $log_message_pattern . "$";
}
else if ($logfile_type == 'tbd') {
$pattern = "^\(.*\)$";
@@ -159,7 +164,13 @@ function conv_log_filter($logfile, $nentries, $tail = 50, $filtertext = "", $fil
}
}
/* Since the lines are in reverse order, flip them around if needed based on the user's preference */
- return isset($config['syslog']['reverse']) ? $filterlog : array_reverse($filterlog);
+ # First get the "General Logging Options" (global) chronological order setting. Then apply specific log override if set.
+ $reverse = isset($config['syslog']['reverse']);
+ $specific_log = basename($logfile, '.log') . '_settings';
+ if ($config['syslog'][$specific_log]['cronorder'] == 'forward') $reverse = false;
+ if ($config['syslog'][$specific_log]['cronorder'] == 'reverse') $reverse = true;
+
+ return ($reverse) ? $filterlog : array_reverse($filterlog);
}
function escape_filter_regex($filtertext) {
@@ -230,21 +241,17 @@ function parse_unknown_log_line($line) {
$pattern = "/^" . $date_pattern . "\ +" . $log_message_pattern . "$/";
- if (!preg_match($pattern, $line, $log_split))
+ if (!preg_match($pattern, $line, $log_split)) {
return "";
+ }
list($all, $flent['time'], $flent['message']) = $log_split;
- if($g['debug']) {
- log_error(sprintf(gettext("There was a error parsing: %s. Please report to mailing list or forum."), $flent['process']));
- return "";
- }
-
/* If there is time, and message, fields, then the line should be usable/good */
- if (!( (trim($flent['time']) == "") && (trim($flent['message']) == "") )) {
+ if (!((trim($flent['time']) == "") && (trim($flent['message']) == ""))) {
return $flent;
} else {
- if($g['debug']) {
+ if ($g['debug']) {
log_error(sprintf(gettext("There was a error parsing log entry: %s. Please report to mailing list or forum."), $errline));
}
return "";
@@ -263,27 +270,28 @@ function parse_system_log_line($line) {
$date_pattern = "(" . $month_pattern . "\ +" . $day_pattern . "\ +" . $time_pattern . ")";
- $process_pattern = "(.*?)";
- $pid_pattern = "(.*?)(?::\ +)?(?:\[([0-9:]*)\])?:?";
+ $host_pattern = "(.*?)";
+# $host_pattern = "([a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])";
+
+ $process_pattern = "(.*?)(?::\ +)?";
+ $pid_pattern = "(?:\[([0-9:]*)\])?:?";
+ $process_pid_pattern = $process_pattern . $pid_pattern;
+
$log_message_pattern = "(.*)";
- $pattern = "/^" . $date_pattern . "\ +" . $process_pattern . "\ +" . $pid_pattern . "\ +" . $log_message_pattern . "$/";
+ $pattern = "/^" . $date_pattern . "\ +" . $host_pattern . "\ +" . $process_pid_pattern . "\ +" . $log_message_pattern . "$/";
- if (!preg_match($pattern, $line, $log_split))
+ if (!preg_match($pattern, $line, $log_split)) {
return "";
+ }
list($all, $flent['time'], $flent['host'], $flent['process'], $flent['pid'], $flent['message']) = $log_split;
- if($g['debug']) {
- log_error(sprintf(gettext("There was a error parsing: %s. Please report to mailing list or forum."), $flent['process']));
- return "";
- }
-
/* If there is time, process, and message, fields, then the line should be usable/good */
- if (!( (trim($flent['time']) == "") && (trim($flent['process']) == "") && (trim($flent['message']) == "") )) {
+ if (!((trim($flent['time']) == "") && (trim($flent['process']) == "") && (trim($flent['message']) == ""))) {
return $flent;
} else {
- if($g['debug']) {
+ if ($g['debug']) {
log_error(sprintf(gettext("There was a error parsing log entry: %s. Please report to mailing list or forum."), $errline));
}
return "";
@@ -552,7 +560,7 @@ function find_action_image($action) {
function handle_ajax($nentries, $tail = 50) {
global $config;
if ($_GET['lastsawtime'] or $_POST['lastsawtime']) {
- global $filter_logfile,$filterent;
+ global $filter_logfile, $filterent;
if ($_GET['lastsawtime']) {
$lastsawtime = $_GET['lastsawtime'];
}
@@ -575,12 +583,12 @@ function handle_ajax($nentries, $tail = 50) {
}
if ($log_row['act'] == "block") {
- $icon_act = "fa-times icon-danger";
+ $icon_act = "fa-times text-danger";
} else {
- $icon_act = "fa-check icon-success";
+ $icon_act = "fa-check text-success";
}
- $btn = '<i class="fa ' . $icon_act . ' icon-pointer" title="' . $log_row['act'] . '/' . $log_row['tracker'] . '" onclick="javascript:getURL(\'diag_logs_filter.php?getrulenum=' . $log_row['rulenum'] . ',' . $log_row['tracker'] . ',' . $log_row['act'] . '\', outputrule);"></i>';
+ $btn = '<i class="fa ' . $icon_act . ' icon-pointer" title="' . $log_row['act'] . '/' . $log_row['tracker'] . '" onclick="javascript:getURL(\'status_logs_filter.php?getrulenum=' . $log_row['rulenum'] . ',' . $log_row['tracker'] . ',' . $log_row['act'] . '\', outputrule);"></i>';
$new_rules .= "{$btn}||{$log_row['time']}||{$log_row['interface']}||{$log_row['srcip']}||{$log_row['srcport']}||{$log_row['dstip']}||{$log_row['dstport']}||{$log_row['proto']}||{$log_row['version']}||" . time() . "||\n";
}
}
diff --git a/src/etc/inc/globals.inc b/src/etc/inc/globals.inc
index 893590d..44a3b02 100644
--- a/src/etc/inc/globals.inc
+++ b/src/etc/inc/globals.inc
@@ -59,7 +59,7 @@ $g = array(
"product_name" => "pfSense",
"product_version" => trim(file_get_contents("/etc/version"), " \n"),
"product_copyright" => "Electric Sheep Fencing LLC",
- "product_copyright_url" => "http://www.electricsheepfencing.com",
+ "product_copyright_url" => "https://pfsense.org/license",
"product_copyright_years" => "2004 - ".date("Y"),
"product_website" => "www.pfsense.org",
"product_website_footer" => "https://www.pfsense.org/?gui=bootstrap",
@@ -71,7 +71,7 @@ $g = array(
"disablecrashreporter" => false,
"crashreporterurl" => "https://crashreporter.pfsense.org/crash_reporter.php",
"debug" => false,
- "latest_config" => "13.0",
+ "latest_config" => "13.1",
"nopkg_platforms" => array("cdrom"),
"minimum_ram_warning" => "101",
"minimum_ram_warning_text" => "128 MB",
diff --git a/src/etc/inc/gwlb.inc b/src/etc/inc/gwlb.inc
index 9880cdc..ab2d5a6 100644
--- a/src/etc/inc/gwlb.inc
+++ b/src/etc/inc/gwlb.inc
@@ -26,135 +26,136 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
- pfSense_BUILDER_BINARIES: /sbin/route /usr/local/sbin/apinger
pfSense_MODULE: routing
*/
require_once("config.inc");
require_once("rrd.inc");
-/* Returns an array of default values used for apinger.conf */
-function return_apinger_defaults() {
+/* Returns an array of default values used for dpinger */
+function return_dpinger_defaults() {
return array(
"latencylow" => "200",
"latencyhigh" => "500",
"losslow" => "10",
"losshigh" => "20",
- "interval" => "1",
- "down" => "10",
- "avg_delay_samples" => "10",
- "avg_loss_samples" => "50",
- "avg_loss_delay_samples" => "20");
+ "interval" => "250",
+ "loss_interval" => "500",
+ "time_period" => "25000",
+ "alert_interval" => "1000");
}
-/*
- * Creates monitoring configuration file and
- * adds appropriate static routes.
- */
-function setup_gateways_monitor() {
- global $config, $g;
+function running_dpinger_processes() {
+ global $g;
- $gateways_arr = return_gateways_array();
- if (!is_array($gateways_arr)) {
- log_error("No gateways to monitor. Apinger will not be run.");
- killbypid("{$g['varrun_path']}/apinger.pid");
- @unlink("{$g['varrun_path']}/apinger.status");
- return;
- }
+ $pidfiles = glob("{$g['varrun_path']}/dpinger_*.pid");
- $apinger_debug = "";
- if (isset($config['system']['apinger_debug'])) {
- $apinger_debug = "debug on";
+ $result = array();
+ if ($pidfiles === FALSE) {
+ return $result;
}
- $apinger_default = return_apinger_defaults();
- $apingerconfig = <<<EOD
-
-# pfSense apinger configuration file. Automatically Generated!
-
-{$apinger_debug}
-
-## User and group the pinger should run as
-user "root"
-group "wheel"
-
-## Mailer to use (default: "/usr/lib/sendmail -t")
-#mailer "/var/qmail/bin/qmail-inject"
-
-## Location of the pid-file (default: "/var/run/apinger.pid")
-pid_file "{$g['varrun_path']}/apinger.pid"
-
-## Format of timestamp (%s macro) (default: "%b %d %H:%M:%S")
-#timestamp_format "%Y%m%d%H%M%S"
+ foreach ($pidfiles as $pidfile) {
+ $result[] = preg_replace('/^dpinger_(\w+)\.pid$/', "$1",
+ basename($pidfile));
+ }
-status {
- ## File where the status information should be written to
- file "{$g['varrun_path']}/apinger.status"
- ## Interval between file updates
- ## when 0 or not set, file is written only when SIGUSR1 is received
- interval 5s
+ return $result;
}
-########################################
-# RRDTool status gathering configuration
-# Interval between RRD updates
-rrd interval 60s;
+/*
+ * Stop one or more dpinger process
+ * default parameter $gwname is '*' that will kill all running sessions
+ * If a gateway name is passed, only this one will be killed
+ */
+function stop_dpinger($gwname = '*') {
+ global $g;
-## These parameters can be overridden in a specific alarm configuration
-alarm default {
- command on "/usr/local/sbin/pfSctl -c 'service reload dyndns %T' -c 'service reload ipsecdns' -c 'service reload openvpn %T' -c 'filter reload' "
- command off "/usr/local/sbin/pfSctl -c 'service reload dyndns %T' -c 'service reload ipsecdns' -c 'service reload openvpn %T' -c 'filter reload' "
- combine 10s
-}
+ $pidfiles = glob("{$g['varrun_path']}/dpinger_{$gwname}.pid");
-## "Down" alarm definition.
-## This alarm will be fired when target doesn't respond for 30 seconds.
-alarm down "down" {
- time {$apinger_default['down']}s
-}
+ if ($pidfiles === FALSE) {
+ return;
+ }
-## "Delay" alarm definition.
-## This alarm will be fired when responses are delayed more than 200ms
-## it will be canceled, when the delay drops below 100ms
-alarm delay "delay" {
- delay_low {$apinger_default['latencylow']}ms
- delay_high {$apinger_default['latencyhigh']}ms
+ foreach ($pidfiles as $pidfile) {
+ if (isvalidpid($pidfile)) {
+ killbypid($pidfile);
+ } else {
+ @unlink($pidfile);
+ }
+ }
}
-## "Loss" alarm definition.
-## This alarm will be fired when packet loss goes over 20%
-## it will be canceled, when the loss drops below 10%
-alarm loss "loss" {
- percent_low {$apinger_default['losslow']}
- percent_high {$apinger_default['losshigh']}
+function start_dpinger($gateway) {
+ global $g;
+
+ $dpinger_defaults = return_dpinger_defaults();
+
+ $pidfile = "{$g['varrun_path']}/dpinger_{$gateway['name']}.pid";
+ $socket = "{$g['varrun_path']}/dpinger_{$gateway['name']}.sock";
+ $alarm_cmd = "{$g['etc_path']}/rc.gateway_alarm {$gateway['name']}";
+
+ $params = "-S "; /* Log warnings via syslog */
+ $params .= "-B {$gateway['gwifip']} "; /* Bind src address */
+ $params .= "-p {$pidfile} "; /* PID filename */
+ $params .= "-U {$socket} "; /* Status Socket */
+ $params .= "-C \"{$alarm_cmd}\" "; /* Command to run on alarm */
+
+ $params .= "-s " .
+ (isset($gateway['interval']) && is_numeric($gateway['interval'])
+ ? $gateway['interval']
+ : $dpinger_defaults['interval']
+ ) . " ";
+
+ $params .= "-l " .
+ (isset($gateway['loss_interval']) && is_numeric($gateway['loss_interval'])
+ ? $gateway['loss_interval']
+ : $dpinger_defaults['loss_interval']
+ ) . " ";
+
+ $params .= "-t " .
+ (isset($gateway['time_period']) && is_numeric($gateway['time_period'])
+ ? $gateway['time_period']
+ : $dpinger_defaults['time_period']
+ ) . " ";
+
+ $params .= "-A " .
+ (isset($gateway['alert_interval']) && is_numeric($gateway['alert_interval'])
+ ? $gateway['alert_interval']
+ : $dpinger_defaults['alert_interval']
+ ) . " ";
+
+ $params .= "-D " .
+ (isset($gateway['latencyhigh']) && is_numeric($gateway['latencyhigh'])
+ ? $gateway['latencyhigh']
+ : $dpinger_defaults['latencyhigh']
+ ) . " ";
+
+ $params .= "-L " .
+ (isset($gateway['losshigh']) && is_numeric($gateway['losshigh'])
+ ? $gateway['losshigh']
+ : $dpinger_defaults['losshigh']
+ ) . " ";
+
+ mwexec_bg("/usr/local/bin/dpinger {$params} {$gateway['monitor']}");
}
-target default {
- ## How often the probe should be sent
- interval {$apinger_default['interval']}s
-
- ## How many replies should be used to compute average delay
- ## for controlling "delay" alarms
- avg_delay_samples {$apinger_default['avg_delay_samples']}
-
- ## How many probes should be used to compute average loss
- avg_loss_samples {$apinger_default['avg_loss_samples']}
-
- ## The delay (in samples) after which loss is computed
- ## without this delays larger than interval would be treated as loss
- avg_loss_delay_samples {$apinger_default['avg_loss_delay_samples']}
-
- ## Names of the alarms that may be generated for the target
- alarms "down","delay","loss"
-
- ## Location of the RRD
- #rrd file "{$g['vardb_path']}/rrd/apinger-%t.rrd"
-}
+/*
+ * Creates monitoring configuration file and
+ * adds appropriate static routes.
+ */
+function setup_gateways_monitor() {
+ global $config, $g;
-EOD;
+ $gateways_arr = return_gateways_array();
+ if (!is_array($gateways_arr)) {
+ log_error("No gateways to monitor. dpinger will not run.");
+ stop_dpinger();
+ return;
+ }
$monitor_ips = array();
- foreach ($gateways_arr as $name => $gateway) {
+ foreach ($gateways_arr as $gwname => $gateway) {
/* Do not monitor if such was requested */
if (isset($gateway['monitor_disable'])) {
continue;
@@ -172,7 +173,7 @@ EOD;
continue;
}
- /* Interface ip is needed since apinger will bind a socket to it.
+ /* Interface ip is needed since dpinger will bind a socket to it.
* However the config GUI should already have checked this and when
* PPoE is used the IP address is set to "dynamic". So using is_ipaddrv4
* or is_ipaddrv6 to identify packet type would be wrong, especially as
@@ -262,176 +263,124 @@ EOD;
}
$monitor_ips[] = $gateway['monitor'];
- $apingercfg = "target \"{$gateway['monitor']}\" {\n";
- $apingercfg .= " description \"{$name}\"\n";
- $apingercfg .= " srcip \"{$gwifip}\"\n";
-
- ## How often the probe should be sent
- if (!empty($gateway['interval']) && is_numeric($gateway['interval'])) {
- $interval = intval($gateway['interval']); # Restrict to Integer
- if ($interval < 1) {
- $interval = 1; # Minimum
- }
- if ($interval != $apinger_default['interval']) { # If not default value
- $apingercfg .= " interval " . $interval . "s\n";
- }
- }
+ $gateways_arr[$gwname]['enable_dpinger'] = true;
+ $gateways_arr[$gwname]['gwifip'] = $gwifip;
+ }
- ## How many replies should be used to compute average delay
- ## for controlling "delay" alarms
- if (!empty($gateway['avg_delay_samples']) && is_numeric($gateway['avg_delay_samples'])) {
- $avg_delay_samples = intval($gateway['avg_delay_samples']); # Restrict to Integer
- if ($avg_delay_samples < 1) {
- $avg_delay_samples = 1; # Minimum
- }
- if ($avg_delay_samples != $apinger_default['avg_delay_samples']) { # If not default value
- $apingercfg .= " avg_delay_samples " . $avg_delay_samples . "\n";
- }
- }
+ stop_dpinger();
- ## How many probes should be used to compute average loss
- if (!empty($gateway['avg_loss_samples']) && is_numeric($gateway['avg_loss_samples'])) {
- $avg_loss_samples = intval($gateway['avg_loss_samples']); # Restrict to Integer
- if ($avg_loss_samples < 1) {
- $avg_loss_samples = 1; # Minimum
- }
- if ($avg_loss_samples != $apinger_default['avg_loss_samples']) { # If not default value
- $apingercfg .= " avg_loss_samples " . $avg_loss_samples . "\n";
- }
+ /* Start new processes */
+ foreach ($gateways_arr as $gateway) {
+ if (isset($gateway['enable_dpinger'])) {
+ start_dpinger($gateway);
}
+ }
- ## The delay (in samples) after which loss is computed
- ## without this delays larger than interval would be treated as loss
- if (!empty($gateway['avg_loss_delay_samples']) && is_numeric($gateway['avg_loss_delay_samples'])) {
- $avg_loss_delay_samples = intval($gateway['avg_loss_delay_samples']); # Restrict to Integer
- if ($avg_loss_delay_samples < 1) {
- $avg_loss_delay_samples = 1; # Minimum
- }
- if ($avg_loss_delay_samples != $apinger_default['avg_loss_delay_samples']) { # If not default value
- $apingercfg .= " avg_loss_delay_samples " . $avg_loss_delay_samples . "\n";
- }
- }
+ return 0;
+}
- $alarms = "";
- $alarmscfg = "";
- $override = false;
- if (!empty($gateway['losslow'])) {
- $alarmscfg .= "alarm loss \"{$name}loss\" {\n";
- $alarmscfg .= "\tpercent_low {$gateway['losslow']}\n";
- $alarmscfg .= "\tpercent_high {$gateway['losshigh']}\n";
- $alarmscfg .= "}\n";
- $alarms .= "\"{$name}loss\"";
- $override = true;
- } else {
- if ($override == true) {
- $alarms .= ",";
- }
- $alarms .= "\"loss\"";
- $override = true;
- }
- if (!empty($gateway['latencylow'])) {
- $alarmscfg .= "alarm delay \"{$name}delay\" {\n";
- $alarmscfg .= "\tdelay_low {$gateway['latencylow']}ms\n";
- $alarmscfg .= "\tdelay_high {$gateway['latencyhigh']}ms\n";
- $alarmscfg .= "}\n";
- if ($override == true) {
- $alarms .= ",";
- }
- $alarms .= "\"{$name}delay\"";
- $override = true;
- } else {
- if ($override == true) {
- $alarms .= ",";
- }
- $alarms .= "\"delay\"";
- $override = true;
- }
- if (!empty($gateway['down'])) {
- $alarmscfg .= "alarm down \"{$name}down\" {\n";
- $alarmscfg .= "\ttime {$gateway['down']}s\n";
- $alarmscfg .= "}\n";
- if ($override == true) {
- $alarms .= ",";
- }
- $alarms .= "\"{$name}down\"";
- $override = true;
- } else {
- if ($override == true) {
- $alarms .= ",";
- }
- $alarms .= "\"down\"";
- $override = true;
- }
- if ($override == true) {
- $apingercfg .= "\talarms override {$alarms};\n";
- }
+function get_dpinger_status($gwname) {
+ global $g;
- if (isset($gateway['force_down'])) {
- $apingercfg .= "\tforce_down on\n";
- }
+ $socket = "{$g['varrun_path']}/dpinger_{$gwname}.sock";
- $apingercfg .= " rrd file \"{$g['vardb_path']}/rrd/{$gateway['name']}-quality.rrd\"\n";
- $apingercfg .= "}\n";
- $apingercfg .= "\n";
+ if (!file_exists($socket)) {
+ log_error("dpinger: status socket {$socket} not found");
+ return false;
+ }
- $apingerconfig .= $alarmscfg;
- $apingerconfig .= $apingercfg;
+ $fp = stream_socket_client("unix://{$socket}", $errno, $errstr, 10);
+ if (!$fp) {
+ log_error("dpinger: cannot connect to status socket {$socket} - $errstr ($errno)");
+ return false;
+ }
- # Create gateway quality RRD with settings more suitable for pfSense graph set,
- # since apinger uses default step (300; 5 minutes) and other settings that don't
- # match the pfSense gateway quality graph set.
- create_gateway_quality_rrd("{$g['vardb_path']}/rrd/{$gateway['name']}-quality.rrd");
+ $status = '';
+ while (!feof($fp)) {
+ $status .= fgets($fp, 1024);
}
- @file_put_contents("{$g['varetc_path']}/apinger.conf", $apingerconfig);
- unset($apingerconfig);
+ fclose($fp);
+
+ $r = array();
+ list(
+ $r['latency_avg'],
+ $r['latency_stddev'],
+ $r['loss'],
+ $r['alarm_on'],
+ $r['srcip'],
+ $r['targetip']
+ ) = explode(' ', preg_replace('/\n/', '', $status));
- /* Restart apinger process */
- if (isvalidpid("{$g['varrun_path']}/apinger.pid")) {
- sigkillbypid("{$g['varrun_path']}/apinger.pid", "HUP");
- } else {
- /* start a new apinger process */
- @unlink("{$g['varrun_path']}/apinger.status");
- sleep(1);
- mwexec_bg("/usr/local/sbin/apinger -c {$g['varetc_path']}/apinger.conf");
- sleep(1);
- sigkillbypid("{$g['varrun_path']}/apinger.pid", "USR1");
+ $gateways_arr = return_gateways_array();
+ unset($gw);
+ if (isset($gateways_arr[$gwname])) {
+ $gw = $gateways_arr[$gwname];
}
- return 0;
+ $r['latency_avg'] = round($r['latency_avg']/1000, 3);
+ $r['latency_stddev'] = round($r['latency_stddev']/1000, 3);
+
+ $r['status'] = "none";
+ if (isset($gw) && isset($gw['force_down'])) {
+ $r['status'] = "force_down";
+ } else if ($r['alarm_on'] == 1) {
+ $r['status'] = "down";
+ } else if (isset($gw)) {
+ $dpinger_defaults = return_dpinger_defaults();
+ if (isset($gw['latencylow']) &&
+ is_numeric($gw['latencylow'])) {
+ $latencylow = $gw['latencylow'];
+ } else {
+ $latencylow = $dpinger_defaults['latencylow'];
+ }
+
+ if ($r['latency_avg'] > $latencylow) {
+ $r['status'] = "delay";
+ } else {
+ if (isset($gw['losslow']) &&
+ is_numeric($gw['losslow'])) {
+ $losslow = $gw['losslow'];
+ } else {
+ $losslow = $dpinger_defaults['losslow'];
+ }
+
+ if ($r['loss'] > $losslow) {
+ $r['status'] = "loss";
+ }
+ }
+ }
+
+ return $r;
}
-/* return the status of the apinger targets as a array */
+/* return the status of the dpinger targets as an array */
function return_gateways_status($byname = false) {
global $config, $g;
- $apingerstatus = array();
- /* Always get the latest status from apinger */
- if (file_exists("{$g['varrun_path']}/apinger.pid")) {
- sigkillbypid("{$g['varrun_path']}/apinger.pid", "USR1");
- }
- if (file_exists("{$g['varrun_path']}/apinger.status")) {
- $apingerstatus = file("{$g['varrun_path']}/apinger.status");
- } else {
- $apingerstatus = array();
- }
-
+ $dpinger_gws = running_dpinger_processes();
$status = array();
- foreach ($apingerstatus as $line) {
- $info = explode("|", $line);
+
+ $gateways_arr = return_gateways_array();
+
+ foreach ($dpinger_gws as $gwname) {
+ $dpinger_status = get_dpinger_status($gwname);
+ if ($dpinger_status === false) {
+ continue;
+ }
+
if ($byname == false) {
- $target = $info[0];
+ $target = $dpinger_status['targetip'];
} else {
- $target = $info[2];
+ $target = $gwname;
}
$status[$target] = array();
- $status[$target]['monitorip'] = $info[0];
- $status[$target]['srcip'] = $info[1];
- $status[$target]['name'] = $info[2];
- $status[$target]['lastcheck'] = $info[5] ? date('r', $info[5]) : date('r');
- $status[$target]['delay'] = empty($info[6]) ? "0ms" : round($info[6], 1) ."ms" ;
- $status[$target]['loss'] = empty($info[7]) ? "0.0%" : round($info[7], 1) . "%";
- $status[$target]['status'] = trim($info[8]);
+ $status[$target]['monitorip'] = $dpinger_status['targetip'];
+ $status[$target]['srcip'] = $dpinger_status['srcip'];
+ $status[$target]['name'] = $gwname;
+ $status[$target]['delay'] = empty($dpinger_status['latency_avg']) ? "0ms" : $dpinger_status['latency_avg'] . "ms";
+ $status[$target]['loss'] = empty($dpinger_status['loss']) ? "0.0%" : round($dpinger_status['loss'], 1) . "%";
+ $status[$target]['status'] = $dpinger_status['status'];
}
/* tack on any gateways that have monitoring disabled
@@ -441,7 +390,7 @@ function return_gateways_status($byname = false) {
if (!isset($gwitem['monitor_disable'])) {
continue;
}
- if (!is_ipaddr($gwitem['monitorip'])) {
+ if (!is_ipaddr($gwitem['monitor'])) {
$realif = $gwitem['interface'];
$tgtip = get_interface_gateway($realif);
if (!is_ipaddr($tgtip)) {
@@ -449,7 +398,7 @@ function return_gateways_status($byname = false) {
}
$srcip = find_interface_ip($realif);
} else {
- $tgtip = $gwitem['monitorip'];
+ $tgtip = $gwitem['monitor'];
$srcip = find_interface_ip($realif);
}
if ($byname == true) {
@@ -462,7 +411,6 @@ function return_gateways_status($byname = false) {
if ($target == "none") {
$target = $gwitem['name'];
$status[$target]['name'] = $gwitem['name'];
- $status[$target]['lastcheck'] = date('r');
$status[$target]['delay'] = "0.0ms";
$status[$target]['loss'] = "100.0%";
$status[$target]['status'] = "down";
@@ -470,7 +418,6 @@ function return_gateways_status($byname = false) {
$status[$target]['monitorip'] = $tgtip;
$status[$target]['srcip'] = $srcip;
$status[$target]['name'] = $gwitem['name'];
- $status[$target]['lastcheck'] = date('r');
$status[$target]['delay'] = "0.0ms";
$status[$target]['loss'] = "0.0%";
$status[$target]['status'] = "none";
@@ -1249,4 +1196,4 @@ function gateway_is_gwgroup_member($name) {
return $members;
}
-?> \ No newline at end of file
+?>
diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc
index 8767615..984913b 100644
--- a/src/etc/inc/interfaces.inc
+++ b/src/etc/inc/interfaces.inc
@@ -824,7 +824,7 @@ function interface_gre_configure(&$gre, $grekey = "") {
/* Do not change the order here for more see gre(4) NOTES section. */
if (is_ipaddrv6($gre['remote-addr'])) {
mwexec("/sbin/ifconfig {$greif} inet6 tunnel {$realifip6} " . escapeshellarg($gre['remote-addr']));
- }else{
+ } else {
mwexec("/sbin/ifconfig {$greif} tunnel {$realifip} " . escapeshellarg($gre['remote-addr']));
}
if ((is_ipaddrv6($gre['tunnel-local-addr'])) || (is_ipaddrv6($gre['tunnel-remote-addr']))) {
@@ -945,7 +945,7 @@ function interface_gif_configure(&$gif, $gifkey = "") {
if (is_ipaddrv6($gif['remote-addr'])) {
mwexec("/sbin/ifconfig {$gifif} inet6 tunnel {$realifip} " . escapeshellarg($gif['remote-addr']));
} else {
- mwexec("/sbin/ifconfig {$gifif} tunnel {$realifip} " . escapeshellarg($gif['remote-addr']));
+ mwexec("/sbin/ifconfig {$gifif} tunnel {$realifip} " . escapeshellarg($gif['remote-addr']));
}
if ((is_ipaddrv6($gif['tunnel-local-addr'])) || (is_ipaddrv6($gif['tunnel-remote-addr']))) {
/* XXX: The prefixlen argument for tunnels of ipv6 is useless since it needs to be 128 as enforced by kernel */
@@ -5241,17 +5241,19 @@ function get_possible_listen_ips($include_ipv6_link_local=false) {
/* XXX: Maybe use array_merge below? */
$carplist = get_configured_carp_interface_list();
foreach ($carplist as $cif => $carpip) {
- if (get_vip_descr($carpip))
+ if (get_vip_descr($carpip)) {
$interfaces[$cif] = $carpip . ' (' . get_vip_descr($carpip) . ')';
- else
+ } else {
$interfaces[$cif] = $carpip;
+ }
}
$aliaslist = get_configured_ip_aliases_list();
foreach ($aliaslist as $aliasip => $aliasif) {
- if (get_vip_descr($aliasip))
+ if (get_vip_descr($aliasip)) {
$interfaces[$aliasip] = $aliasip . ' (' . get_vip_descr($aliasip) . ')';
- else
+ } else {
$interfaces[$aliasip] = $aliasip;
+ }
}
$interfaces['lo0'] = 'Localhost';
diff --git a/src/etc/inc/ipsec.inc b/src/etc/inc/ipsec.inc
index de9ee00..e766ae1 100644
--- a/src/etc/inc/ipsec.inc
+++ b/src/etc/inc/ipsec.inc
@@ -205,8 +205,9 @@ $p2_pfskeygroups = array(
function ipsec_enabled() {
global $config;
- if (!isset($config['ipsec']) || !is_array($config['ipsec']))
+ if (!isset($config['ipsec']) || !is_array($config['ipsec'])) {
return false;
+ }
/* Check if we have at least one phase 1 entry. */
if (!isset($config['ipsec']['phase1']) ||
@@ -216,8 +217,9 @@ function ipsec_enabled() {
}
/* Check if at least one phase 1 entry is enabled. */
foreach ($config['ipsec']['phase1'] as $phase1) {
- if (!isset($phase1['disabled']))
+ if (!isset($phase1['disabled'])) {
return true;
+ }
}
return false;
@@ -477,8 +479,9 @@ function ipsec_phase2_status(&$ipsec_status, &$phase2) {
*/
function ipsec_list_sa() {
- if (ipsec_enabled())
+ if (ipsec_enabled()) {
return pfSense_ipsec_list_sa();
+ }
return array();
}
diff --git a/src/etc/inc/openvpn.auth-user.php b/src/etc/inc/openvpn.auth-user.php
index f994eb7..d258135 100644
--- a/src/etc/inc/openvpn.auth-user.php
+++ b/src/etc/inc/openvpn.auth-user.php
@@ -117,7 +117,7 @@ if (file_exists("{$g['varetc_path']}/openvpn/{$modeid}.ca")) {
$authenticated = false;
-if (($strictusercn === true) && ($common_name != $username)) {
+if (($strictusercn === true) && (mb_strtolower($common_name) !== mb_strtolower($username))) {
syslog(LOG_WARNING, "Username does not match certificate common name ({$username} != {$common_name}), access denied.\n");
if (isset($_GET['username'])) {
echo "FAILED";
diff --git a/src/etc/inc/openvpn.inc b/src/etc/inc/openvpn.inc
index d69bfbf..9dc5579 100644
--- a/src/etc/inc/openvpn.inc
+++ b/src/etc/inc/openvpn.inc
@@ -131,8 +131,9 @@ function openvpn_build_mode_list() {
$list = array();
- foreach ($openvpn_server_modes as $name => $desc)
+ foreach ($openvpn_server_modes as $name => $desc) {
$list[$name] = $desc;
+ }
return($list);
}
@@ -143,24 +144,28 @@ function openvpn_build_if_list() {
$interfaces = get_configured_interface_with_descr();
$carplist = get_configured_carp_interface_list();
- foreach ($carplist as $cif => $carpip)
+ foreach ($carplist as $cif => $carpip) {
$interfaces[$cif.'|'.$carpip] = $carpip." (".get_vip_descr($carpip).")";
+ }
$aliaslist = get_configured_ip_aliases_list();
- foreach ($aliaslist as $aliasip => $aliasif)
+ foreach ($aliaslist as $aliasip => $aliasif) {
$interfaces[$aliasif.'|'.$aliasip] = $aliasip." (".get_vip_descr($aliasip).")";
+ }
$grouplist = return_gateway_groups_array();
foreach ($grouplist as $name => $group) {
- if($group['ipprotocol'] != inet)
+ if ($group['ipprotocol'] != inet) {
continue;
+ }
- if($group[0]['vip'] != "")
+ if ($group[0]['vip'] != "") {
$vipif = $group[0]['vip'];
- else
+ } else {
$vipif = $group[0]['int'];
+ }
$interfaces[$name] = "GW Group {$name}";
}
@@ -168,8 +173,9 @@ function openvpn_build_if_list() {
$interfaces['lo0'] = "Localhost";
$interfaces['any'] = "any";
- foreach ($interfaces as $iface => $ifacename)
+ foreach ($interfaces as $iface => $ifacename) {
$list[$iface] = $ifacename;
+ }
return($list);
}
@@ -183,8 +189,9 @@ function openvpn_build_crl_list() {
$caname = "";
$ca = lookup_ca($crl['caref']);
- if ($ca)
+ if ($ca) {
$caname = " (CA: {$ca['descr']})";
+ }
$list[$crl['refid']] = $crl['descr'] . $caname;
}
@@ -192,7 +199,7 @@ function openvpn_build_crl_list() {
return($list);
}
-function openvpn_build_cert_list($include_none = false) {
+function openvpn_build_cert_list($include_none = false, $prioritize_server_certs = false) {
global $a_cert;
if ($include_none) {
@@ -201,28 +208,50 @@ function openvpn_build_cert_list($include_none = false) {
$list = array();
}
- foreach ($a_cert as $cert) {
- $caname = "";
- $inuse = "";
- $revoked = "";
- $ca = lookup_ca($cert['caref']);
+ $non_server_list = array();
- if ($ca)
- $caname = " (CA: {$ca['descr']})";
+ if ($prioritize_server_certs) {
+ $list[' '] = "===== Server Certificates =====";
+ $non_server_list[' '] = "===== Non-Server Certificates =====";
+ }
- if ($pconfig['certref'] == $cert['refid'])
- $selected = "selected";
+ foreach ($a_cert as $cert) {
+ $properties = array();
+ $propstr = "";
+ $ca = lookup_ca($cert['caref']);
+ $purpose = cert_get_purpose($cert['crt'], true);
- if (cert_in_use($cert['refid']))
- $inuse = " *In Use";
+ if ($purpose['server'] == "Yes") {
+ $properties[] = "Server: Yes";
+ } elseif ($prioritize_server_certs) {
+ $properties[] = "Server: NO";
+ }
+ if ($ca) {
+ $properties[] = "CA: {$ca['descr']}";
+ }
+ if (cert_in_use($cert['refid'])) {
+ $properties[] = "In Use";
+ }
+ if (is_cert_revoked($cert)) {
+ $properties[] = "Revoked";
+ }
- if (is_cert_revoked($cert))
- $revoked = " *Revoked";
+ if (!empty($properties)) {
+ $propstr = " (" . implode(", ", $properties) . ")";
+ }
- $list[$cert['refid']] = $cert['descr'] . $caname . $inuse . $revoked;
+ if ($prioritize_server_certs) {
+ if ($purpose['server'] == "Yes") {
+ $list[$cert['refid']] = $cert['descr'] . $propstr;
+ } else {
+ $non_server_list[$cert['refid']] = $cert['descr'] . $propstr;
+ }
+ } else {
+ $list[$cert['refid']] = $cert['descr'] . $propstr;
+ }
}
- return($list);
+ return(array('server' => $list, 'non-server' => $non_server_list));
}
function openvpn_build_bridge_list() {
@@ -232,16 +261,19 @@ function openvpn_build_bridge_list() {
$serverbridge_interface = array_merge($serverbridge_interface, get_configured_interface_with_descr());
$carplist = get_configured_carp_interface_list();
- foreach ($carplist as $cif => $carpip)
+ foreach ($carplist as $cif => $carpip) {
$serverbridge_interface[$cif.'|'.$carpip] = $carpip." (".get_vip_descr($carpip).")";
+ }
$aliaslist = get_configured_ip_aliases_list();
- foreach ($aliaslist as $aliasip => $aliasif)
+ foreach ($aliaslist as $aliasip => $aliasif) {
$serverbridge_interface[$aliasif.'|'.$aliasip] = $aliasip." (".get_vip_descr($aliasip).")";
+ }
- foreach ($serverbridge_interface as $iface => $ifacename)
+ foreach ($serverbridge_interface as $iface => $ifacename) {
$list[$iface] = htmlspecialchars($ifacename);
+ }
return($list);
}
diff --git a/src/etc/inc/pfsense-utils.inc b/src/etc/inc/pfsense-utils.inc
index f9049fa..c5c5de5 100644
--- a/src/etc/inc/pfsense-utils.inc
+++ b/src/etc/inc/pfsense-utils.inc
@@ -408,11 +408,13 @@ function get_carp_interface_status($carpinterface) {
global $config;
foreach ($config['virtualip']['vip'] as $carp) {
- if ($carp['mode'] != "carp")
+ if ($carp['mode'] != "carp") {
continue;
+ }
$carpif = "_vip{$carp['uniqid']}";
- if ($carpinterface !== $carpif)
+ if ($carpinterface !== $carpif) {
continue;
+ }
$interface = get_real_interface($carp['interface']);
$vhid = $carp['vhid'];
@@ -1810,7 +1812,7 @@ function update_status($status) {
global $pkg_interface;
if ($pkg_interface == "console") {
- echo "\r{$status}";
+ print ("{$status}");
}
/* ensure that contents are written out */
@@ -2759,66 +2761,6 @@ function get_locale_list() {
return $locales;
}
-function system_get_language_code() {
- global $config, $g_languages;
-
- // a language code, as per [RFC3066]
- $language = $config['system']['language'];
- //$code = $g_languages[$language]['code'];
- $code = str_replace("_", "-", $language);
-
- if (empty($code)) {
- $code = "en-US"; // Set default code.
- }
-
- return $code;
-}
-
-function system_get_language_codeset() {
- global $config, $g_languages;
-
- $language = $config['system']['language'];
- $codeset = $g_languages[$language]['codeset'];
-
- if (empty($codeset)) {
- $codeset = "UTF-8"; // Set default codeset.
- }
-
- return $codeset;
-}
-
-/* Available languages/locales */
-$g_languages = array (
- "sq" => array("codeset" => "UTF-8", "desc" => gettext("Albanian")),
- "bg" => array("codeset" => "UTF-8", "desc" => gettext("Bulgarian")),
- "zh_CN" => array("codeset" => "UTF-8", "desc" => gettext("Chinese (Simplified)")),
- "zh_TW" => array("codeset" => "UTF-8", "desc" => gettext("Chinese (Traditional)")),
- "nl" => array("codeset" => "UTF-8", "desc" => gettext("Dutch")),
- "da" => array("codeset" => "UTF-8", "desc" => gettext("Danish")),
- "en_US" => array("codeset" => "UTF-8", "desc" => gettext("English")),
- "fi" => array("codeset" => "UTF-8", "desc" => gettext("Finnish")),
- "fr" => array("codeset" => "UTF-8", "desc" => gettext("French")),
- "de" => array("codeset" => "UTF-8", "desc" => gettext("German")),
- "el" => array("codeset" => "UTF-8", "desc" => gettext("Greek")),
- "hu" => array("codeset" => "UTF-8", "desc" => gettext("Hungarian")),
- "it" => array("codeset" => "UTF-8", "desc" => gettext("Italian")),
- "ja" => array("codeset" => "UTF-8", "desc" => gettext("Japanese")),
- "ko" => array("codeset" => "UTF-8", "desc" => gettext("Korean")),
- "lv" => array("codeset" => "UTF-8", "desc" => gettext("Latvian")),
- "nb" => array("codeset" => "UTF-8", "desc" => gettext("Norwegian (Bokmal)")),
- "pl" => array("codeset" => "UTF-8", "desc" => gettext("Polish")),
- "pt_BR" => array("codeset" => "UTF-8", "desc" => gettext("Portuguese (Brazil)")),
- "pt" => array("codeset" => "UTF-8", "desc" => gettext("Portuguese (Portugal)")),
- "ro" => array("codeset" => "UTF-8", "desc" => gettext("Romanian")),
- "ru" => array("codeset" => "UTF-8", "desc" => gettext("Russian")),
- "sl" => array("codeset" => "UTF-8", "desc" => gettext("Slovenian")),
- "tr" => array("codeset" => "UTF-8", "desc" => gettext("Turkish")),
- "es" => array("codeset" => "UTF-8", "desc" => gettext("Spanish")),
- "sv" => array("codeset" => "UTF-8", "desc" => gettext("Swedish")),
- "sk" => array("codeset" => "UTF-8", "desc" => gettext("Slovak")),
- "cs" => array("codeset" => "UTF-8", "desc" => gettext("Czech"))
-);
-
function return_hex_ipv4($ipv4) {
if (!is_ipaddrv4($ipv4)) {
return(false);
diff --git a/src/etc/inc/pkg-utils.inc b/src/etc/inc/pkg-utils.inc
index d76afbc..0303092 100644
--- a/src/etc/inc/pkg-utils.inc
+++ b/src/etc/inc/pkg-utils.inc
@@ -192,7 +192,7 @@ function pkg_call($params, $mute = false) {
$now = time();
- if(($now - $started) >= $maxwaittime) {
+ if (($now - $started) >= $maxwaittime) {
$rc = -1;
proc_terminate($process);
break;
@@ -204,7 +204,7 @@ function pkg_call($params, $mute = false) {
fclose($pipes[2]);
proc_close($process);
- if(!isset($rc)) {
+ if (!isset($rc)) {
$rc = $status['exitcode'];
}
@@ -353,7 +353,7 @@ function get_package_id($package_name) {
foreach ($config['installedpackages']['package'] as $idx => $pkg) {
if ($pkg['name'] == $package_name ||
- get_package_internal_name($pkg) == $package_name) {
+ get_package_internal_name($pkg) == $package_name) {
return $idx;
}
}
@@ -702,10 +702,9 @@ function install_package_xml($package_name) {
return false;
}
- $configfile = substr(strrchr($pkg_info['config_file'], '/'), 1);
- if (file_exists("/usr/local/pkg/" . $configfile)) {
+ if (file_exists("/usr/local/pkg/" . $pkg_info['configurationfile'])) {
update_status(gettext("Loading package configuration... "));
- $pkg_config = parse_xml_config_pkg("/usr/local/pkg/" . $configfile, "packagegui");
+ $pkg_config = parse_xml_config_pkg("/usr/local/pkg/" . $pkg_info['configurationfile'], "packagegui");
update_status(gettext("done.") . "\n");
update_status(gettext("Configuring package components...") . "\n");
if (!empty($pkg_config['filter_rules_needed'])) {
diff --git a/src/etc/inc/priv.defs.inc b/src/etc/inc/priv.defs.inc
index fa9f19b..06d0418 100644
--- a/src/etc/inc/priv.defs.inc
+++ b/src/etc/inc/priv.defs.inc
@@ -23,7 +23,7 @@ $priv_list['page-status-carp'] = array();
$priv_list['page-status-carp']['name'] = gettext("WebCfg - Status: CARP");
$priv_list['page-status-carp']['descr'] = gettext("Allow access to the 'Status: CARP' page.");
$priv_list['page-status-carp']['match'] = array();
-$priv_list['page-status-carp']['match'][] = "carp_status.php*";
+$priv_list['page-status-carp']['match'][] = "status_carp.php*";
$priv_list['page-diagnostics-crash-reporter'] = array();
$priv_list['page-diagnostics-crash-reporter']['name'] = gettext("WebCfg - Crash reporter");
@@ -89,25 +89,25 @@ $priv_list['page-status-ipsec'] = array();
$priv_list['page-status-ipsec']['name'] = gettext("WebCfg - Status: IPsec");
$priv_list['page-status-ipsec']['descr'] = gettext("Allow access to the 'Status: IPsec' page.");
$priv_list['page-status-ipsec']['match'] = array();
-$priv_list['page-status-ipsec']['match'][] = "diag_ipsec.php*";
+$priv_list['page-status-ipsec']['match'][] = "status_ipsec.php*";
$priv_list['page-status-ipsec-leases'] = array();
$priv_list['page-status-ipsec-leases']['name'] = gettext("WebCfg - Status: IPsec: Leases");
$priv_list['page-status-ipsec-leases']['descr'] = gettext("Allow access to the 'Status: IPsec: Leases' page.");
$priv_list['page-status-ipsec-leases']['match'] = array();
-$priv_list['page-status-ipsec-leases']['match'][] = "diag_ipsec_leases.php*";
+$priv_list['page-status-ipsec-leases']['match'][] = "status_ipsec_leases.php*";
$priv_list['page-status-ipsec-sad'] = array();
$priv_list['page-status-ipsec-sad']['name'] = gettext("WebCfg - Status: IPsec: SAD");
$priv_list['page-status-ipsec-sad']['descr'] = gettext("Allow access to the 'Status: IPsec: SAD' page.");
$priv_list['page-status-ipsec-sad']['match'] = array();
-$priv_list['page-status-ipsec-sad']['match'][] = "diag_ipsec_sad.php*";
+$priv_list['page-status-ipsec-sad']['match'][] = "status_ipsec_sad.php*";
$priv_list['page-status-ipsec-spd'] = array();
$priv_list['page-status-ipsec-spd']['name'] = gettext("WebCfg - Status: IPsec: SPD");
$priv_list['page-status-ipsec-spd']['descr'] = gettext("Allow access to the 'Status: IPsec: SPD' page.");
$priv_list['page-status-ipsec-spd']['match'] = array();
-$priv_list['page-status-ipsec-spd']['match'][] = "diag_ipsec_spd.php*";
+$priv_list['page-status-ipsec-spd']['match'][] = "status_ipsec_spd.php*";
$priv_list['page-diagnostics-limiter-info'] = array();
$priv_list['page-diagnostics-limiter-info']['name'] = gettext("WebCfg - Diagnostics: Limiter Info");
@@ -119,37 +119,37 @@ $priv_list['page-diagnostics-logs-system'] = array();
$priv_list['page-diagnostics-logs-system']['name'] = gettext("WebCfg - Status: Logs: System");
$priv_list['page-diagnostics-logs-system']['descr'] = gettext("Allow access to the 'Status: System Logs: General' page.");
$priv_list['page-diagnostics-logs-system']['match'] = array();
-$priv_list['page-diagnostics-logs-system']['match'][] = "diag_logs.php";
+$priv_list['page-diagnostics-logs-system']['match'][] = "status_logs.php";
$priv_list['page-diagnostics-logs-firewall'] = array();
$priv_list['page-diagnostics-logs-firewall']['name'] = gettext("WebCfg - Status: Logs: Firewall");
$priv_list['page-diagnostics-logs-firewall']['descr'] = gettext("Allow access to the 'Status: Logs: Firewall' page.");
$priv_list['page-diagnostics-logs-firewall']['match'] = array();
-$priv_list['page-diagnostics-logs-firewall']['match'][] = "diag_logs_filter.php*";
+$priv_list['page-diagnostics-logs-firewall']['match'][] = "status_logs_filter.php*";
$priv_list['page-diagnostics-logs-firewall-dynamic'] = array();
$priv_list['page-diagnostics-logs-firewall-dynamic']['name'] = gettext("WebCfg - Status: System Logs: Firewall (Dynamic View)");
$priv_list['page-diagnostics-logs-firewall-dynamic']['descr'] = gettext("Allow access to the 'Status: System Logs: Firewall (Dynamic View)' page");
$priv_list['page-diagnostics-logs-firewall-dynamic']['match'] = array();
-$priv_list['page-diagnostics-logs-firewall-dynamic']['match'][] = "diag_logs_filter_dynamic.php*";
+$priv_list['page-diagnostics-logs-firewall-dynamic']['match'][] = "status_logs_filter_dynamic.php*";
$priv_list['page-diagnostics-logs-firewall-summary'] = array();
$priv_list['page-diagnostics-logs-firewall-summary']['name'] = gettext("WebCfg - Status: System Logs: Firewall Log Summary");
$priv_list['page-diagnostics-logs-firewall-summary']['descr'] = gettext("Allow access to the 'Status: System Logs: Firewall Log Summary' page");
$priv_list['page-diagnostics-logs-firewall-summary']['match'] = array();
-$priv_list['page-diagnostics-logs-firewall-summary']['match'][] = "diag_logs_filter_summary.php*";
+$priv_list['page-diagnostics-logs-firewall-summary']['match'][] = "status_logs_filter_summary.php*";
$priv_list['page-diagnostics-logs-settings'] = array();
$priv_list['page-diagnostics-logs-settings']['name'] = gettext("WebCfg - Status: Logs: Settings");
$priv_list['page-diagnostics-logs-settings']['descr'] = gettext("Allow access to the 'Status: Logs: Settings' page.");
$priv_list['page-diagnostics-logs-settings']['match'] = array();
-$priv_list['page-diagnostics-logs-settings']['match'][] = "diag_logs_settings.php*";
+$priv_list['page-diagnostics-logs-settings']['match'][] = "status_logs_settings.php*";
$priv_list['page-diagnostics-logs-pptpvpn'] = array();
$priv_list['page-diagnostics-logs-pptpvpn']['name'] = gettext("WebCfg - Status: Logs: VPN");
$priv_list['page-diagnostics-logs-pptpvpn']['descr'] = gettext("Allow access to the 'Status: Logs: VPN' page.");
$priv_list['page-diagnostics-logs-pptpvpn']['match'] = array();
-$priv_list['page-diagnostics-logs-pptpvpn']['match'][] = "diag_logs_vpn.php*";
+$priv_list['page-diagnostics-logs-pptpvpn']['match'][] = "status_logs_vpn.php*";
$priv_list['page-diagnostics-nanobsd'] = array();
$priv_list['page-diagnostics-nanobsd']['name'] = gettext("WebCfg - Diagnostics: NanoBSD");
@@ -185,7 +185,7 @@ $priv_list['page-status-packagelogs'] = array();
$priv_list['page-status-packagelogs']['name'] = gettext("WebCfg - Status: Package logs");
$priv_list['page-status-packagelogs']['descr'] = gettext("Allow access to the 'Status: Package logs' page.");
$priv_list['page-status-packagelogs']['match'] = array();
-$priv_list['page-status-packagelogs']['match'][] = "diag_pkglogs.php*";
+$priv_list['page-status-packagelogs']['match'][] = "status_pkglogs.php*";
$priv_list['page-diagnostics-resetstate'] = array();
$priv_list['page-diagnostics-resetstate']['name'] = gettext("WebCfg - Diagnostics: Reset states");
@@ -227,7 +227,7 @@ $priv_list['page-diagnostics-system-pftop'] = array();
$priv_list['page-diagnostics-system-pftop']['name'] = gettext("WebCfg - Diagnostics: pfTop");
$priv_list['page-diagnostics-system-pftop']['descr'] = gettext("Allows access to the 'Diagnostics: pfTop' page");
$priv_list['page-diagnostics-system-pftop']['match'] = array();
-$priv_list['page-diagnostics-system-pftop']['match'][] = "diag_system_pftop.php*";
+$priv_list['page-diagnostics-system-pftop']['match'][] = "diag_pftop.php*";
$priv_list['page-diagnostics-tables'] = array();
$priv_list['page-diagnostics-tables']['name'] = gettext("WebCfg - Diagnostics: pf Table IP addresses");
@@ -422,7 +422,7 @@ $priv_list['page-diagnostics-haltsystem'] = array();
$priv_list['page-diagnostics-haltsystem']['name'] = gettext("WebCfg - Diagnostics: Halt system");
$priv_list['page-diagnostics-haltsystem']['descr'] = gettext("Allow access to the 'Diagnostics: Halt system' page.");
$priv_list['page-diagnostics-haltsystem']['match'] = array();
-$priv_list['page-diagnostics-haltsystem']['match'][] = "halt.php*";
+$priv_list['page-diagnostics-haltsystem']['match'][] = "diag_halt.php*";
$priv_list['page-xmlrpcinterfacestats'] = array();
$priv_list['page-xmlrpcinterfacestats']['name'] = gettext("WebCfg - XMLRPC Interface Stats");
@@ -638,7 +638,7 @@ $priv_list['page-diagnostics-rebootsystem'] = array();
$priv_list['page-diagnostics-rebootsystem']['name'] = gettext("WebCfg - Diagnostics: Reboot System");
$priv_list['page-diagnostics-rebootsystem']['descr'] = gettext("Allow access to the 'Diagnostics: Reboot System' page.");
$priv_list['page-diagnostics-rebootsystem']['match'] = array();
-$priv_list['page-diagnostics-rebootsystem']['match'][] = "reboot.php*";
+$priv_list['page-diagnostics-rebootsystem']['match'][] = "diag_reboot.php*";
$priv_list['page-diagnostics-restart-httpd'] = array();
$priv_list['page-diagnostics-restart-httpd']['name'] = gettext("WebCfg - Diagnostics: Restart Web Server Daemon");
@@ -1278,13 +1278,13 @@ $priv_list['page-services-pppoeserver'] = array();
$priv_list['page-services-pppoeserver']['name'] = gettext("WebCfg - Services: PPPoE Server");
$priv_list['page-services-pppoeserver']['descr'] = gettext("Allow access to the 'Services: PPPoE Server' page.");
$priv_list['page-services-pppoeserver']['match'] = array();
-$priv_list['page-services-pppoeserver']['match'][] = "vpn_pppoe.php*";
+$priv_list['page-services-pppoeserver']['match'][] = "services_pppoe.php*";
$priv_list['page-services-pppoeserver-edit'] = array();
$priv_list['page-services-pppoeserver-edit']['name'] = gettext("WebCfg - Services: PPPoE Server: Edit");
$priv_list['page-services-pppoeserver-edit']['descr'] = gettext("Allow access to the 'Services: PPPoE Server: Edit' page.");
$priv_list['page-services-pppoeserver-edit']['match'] = array();
-$priv_list['page-services-pppoeserver-edit']['match'][] = "vpn_pppoe_edit.php*";
+$priv_list['page-services-pppoeserver-edit']['match'][] = "services_pppoe_edit.php*";
$priv_list['page-pfsensewizardsubsystem'] = array();
$priv_list['page-pfsensewizardsubsystem']['name'] = gettext("WebCfg - pfSense wizard subsystem");
diff --git a/src/etc/inc/priv/user.priv.inc b/src/etc/inc/priv/user.priv.inc
index d3290fe..fca9be2 100644
--- a/src/etc/inc/priv/user.priv.inc
+++ b/src/etc/inc/priv/user.priv.inc
@@ -22,7 +22,7 @@ $priv_list['page-dashboard-all']['match'][] = "graph.php*";
$priv_list['page-dashboard-all']['match'][] = "graph_cpu.php*";
$priv_list['page-dashboard-all']['match'][] = "getstats.php*";
$priv_list['page-dashboard-all']['match'][] = "ifstats.php*";
-$priv_list['page-dashboard-all']['match'][] = "diag_logs_filter_dynamic.php*";
+$priv_list['page-dashboard-all']['match'][] = "status_logs_filter_dynamic.php*";
$priv_list['page-dashboard-widgets'] = array();
$priv_list['page-dashboard-widgets']['name'] = gettext("WebCfg - Dashboard widgets (direct access).");
@@ -70,66 +70,66 @@ $priv_list['page-status-systemlogs-portalauth'] = array();
$priv_list['page-status-systemlogs-portalauth']['name'] = gettext("WebCfg - Status: System logs: Portal Auth");
$priv_list['page-status-systemlogs-portalauth']['descr'] = gettext("Allow access to the 'Status: System logs: Portal Auth' page.");
$priv_list['page-status-systemlogs-portalauth']['match'] = array();
-$priv_list['page-status-systemlogs-portalauth']['match'][] = "diag_logs.php?logfile=portalauth";
+$priv_list['page-status-systemlogs-portalauth']['match'][] = "status_logs.php?logfile=portalauth";
$priv_list['page-diagnostics-logs-dhcp'] = array();
$priv_list['page-diagnostics-logs-dhcp']['name'] = gettext("WebCfg - Status: Logs: DHCP");
$priv_list['page-diagnostics-logs-dhcp']['descr'] = gettext("Allow access to the 'Status: Logs: DHCP' page.");
$priv_list['page-diagnostics-logs-dhcp']['match'] = array();
-$priv_list['page-diagnostics-logs-dhcp']['match'][] = "diag_logs.php?logfile=dhcpd";
+$priv_list['page-diagnostics-logs-dhcp']['match'][] = "status_logs.php?logfile=dhcpd";
$priv_list['page-diagnostics-logs-gateways'] = array();
$priv_list['page-diagnostics-logs-gateways']['name'] = gettext("WebCfg - Status: Logs: Gateways");
$priv_list['page-diagnostics-logs-gateways']['descr'] = gettext("Allow access to the 'Status: Logs: System: Gateways' page.");
$priv_list['page-diagnostics-logs-gateways']['match'] = array();
-$priv_list['page-diagnostics-logs-gateways']['match'][] = "diag_logs.php?logfile=gateways";
+$priv_list['page-diagnostics-logs-gateways']['match'][] = "status_logs.php?logfile=gateways";
$priv_list['page-diagnostics-logs-resolver'] = array();
$priv_list['page-diagnostics-logs-resolver']['name'] = gettext("WebCfg - Status: Logs: Resolver");
$priv_list['page-diagnostics-logs-resolver']['descr'] = gettext("Allow access to the 'Status: Logs: System: Resolver' page.");
$priv_list['page-diagnostics-logs-resolver']['match'] = array();
-$priv_list['page-diagnostics-logs-resolver']['match'][] = "diag_logs.php?logfile=resolver";
+$priv_list['page-diagnostics-logs-resolver']['match'][] = "status_logs.php?logfile=resolver";
$priv_list['page-status-systemlogs-ipsecvpn'] = array();
$priv_list['page-status-systemlogs-ipsecvpn']['name'] = gettext("WebCfg - Status: System logs: IPsec VPN");
$priv_list['page-status-systemlogs-ipsecvpn']['descr'] = gettext("Allow access to the 'Status: System logs: IPsec VPN' page.");
$priv_list['page-status-systemlogs-ipsecvpn']['match'] = array();
-$priv_list['page-status-systemlogs-ipsecvpn']['match'][] = "diag_logs.php?logfile=ipsec";
+$priv_list['page-status-systemlogs-ipsecvpn']['match'][] = "status_logs.php?logfile=ipsec";
$priv_list['page-status-systemlogs-ntpd'] = array();
$priv_list['page-status-systemlogs-ntpd']['name'] = gettext("WebCfg - Status: System logs: NTP");
$priv_list['page-status-systemlogs-ntpd']['descr'] = gettext("Allow access to the 'Status: System logs: NTP' page.");
$priv_list['page-status-systemlogs-ntpd']['match'] = array();
-$priv_list['page-status-systemlogs-ntpd']['match'][] = "diag_logs.php?logfile=ntpd";
+$priv_list['page-status-systemlogs-ntpd']['match'][] = "status_logs.php?logfile=ntpd";
$priv_list['page-status-systemlogs-openvpn'] = array();
$priv_list['page-status-systemlogs-openvpn']['name'] = gettext("WebCfg - Status: System logs: OpenVPN");
$priv_list['page-status-systemlogs-openvpn']['descr'] = gettext("Allow access to the 'Status: System logs: OpenVPN' page.");
$priv_list['page-status-systemlogs-openvpn']['match'] = array();
-$priv_list['page-status-systemlogs-openvpn']['match'][] = "diag_logs.php?logfile=openvpn";
+$priv_list['page-status-systemlogs-openvpn']['match'][] = "status_logs.php?logfile=openvpn";
$priv_list['page-status-systemlogs-ppp'] = array();
$priv_list['page-status-systemlogs-ppp']['name'] = gettext("WebCfg - Status: System logs: IPsec VPN");
$priv_list['page-status-systemlogs-ppp']['descr'] = gettext("Allow access to the 'Status: System logs: IPsec VPN' page.");
$priv_list['page-status-systemlogs-ppp']['match'] = array();
-$priv_list['page-status-systemlogs-ppp']['match'][] = "diag_logs.php?logfile=ppp";
+$priv_list['page-status-systemlogs-ppp']['match'][] = "status_logs.php?logfile=ppp";
$priv_list['page-status-systemlogs-loadbalancer'] = array();
$priv_list['page-status-systemlogs-loadbalancer']['name'] = gettext("WebCfg - Status: System logs: Load Balancer");
$priv_list['page-status-systemlogs-loadbalancer']['descr'] = gettext("Allow access to the 'Status: System logs: Load Balancer' page.");
$priv_list['page-status-systemlogs-loadbalancer']['match'] = array();
-$priv_list['page-status-systemlogs-loadbalancer']['match'][] = "diag_logs.php?logfile=relayd";
+$priv_list['page-status-systemlogs-loadbalancer']['match'][] = "status_logs.php?logfile=relayd";
$priv_list['page-status-systemlogs-routing'] = array();
$priv_list['page-status-systemlogs-routing']['name'] = gettext("WebCfg - Status: System logs: Routing");
$priv_list['page-status-systemlogs-routing']['descr'] = gettext("Allow access to the 'Status: System logs: System: Routing' page.");
$priv_list['page-status-systemlogs-routing']['match'] = array();
-$priv_list['page-status-systemlogs-routing']['match'][] = "diag_logs.php?logfile=routing";
+$priv_list['page-status-systemlogs-routing']['match'][] = "status_logs.php?logfile=routing";
$priv_list['page-status-systemlogs-wireless'] = array();
$priv_list['page-status-systemlogs-wireless']['name'] = gettext("WebCfg - Status: System logs: Wireless");
$priv_list['page-status-systemlogs-wireless']['descr'] = gettext("Allow access to the 'Status: System logs: System: Wireless' page.");
$priv_list['page-status-systemlogs-wireless']['match'] = array();
-$priv_list['page-status-systemlogs-wireless']['match'][] = "diag_logs.php?logfile=wireless";
+$priv_list['page-status-systemlogs-wireless']['match'][] = "status_logs.php?logfile=wireless";
?>
diff --git a/src/etc/inc/rrd.inc b/src/etc/inc/rrd.inc
index 1459c93..d80c6d4 100644
--- a/src/etc/inc/rrd.inc
+++ b/src/etc/inc/rrd.inc
@@ -50,7 +50,7 @@ function dump_rrd_to_xml($rrddatabase, $xmldumpfile) {
function restore_rrd() {
global $g, $config;
- $rrddbpath = "/var/db/rrd/";
+ $rrddbpath = "{$g['vardb_path']}/rrd/";
$rrdtool = "/usr/bin/nice -n20 /usr/local/bin/rrdtool";
$rrdrestore = "";
@@ -211,7 +211,7 @@ function enable_rrd_graphing() {
echo gettext("Generating RRD graphs...");
}
- $rrddbpath = "/var/db/rrd/";
+ $rrddbpath = "{$g['vardb_path']}/rrd/";
$rrdgraphpath = "/usr/local/www/rrd";
$traffic = "-traffic.rrd";
@@ -278,7 +278,7 @@ function enable_rrd_graphing() {
$captiveportalvalid = $rrdcaptiveportalinterval * 2;
$ntpdvalid = $rrdntpdinterval * 2;
$dhcpdvalid = $rrddhcpdinterval * 2;
-
+
/* Assume 2*10GigE for now */
$downstream = 2500000000;
$upstream = 2500000000;
@@ -323,11 +323,11 @@ function enable_rrd_graphing() {
}
if (platform_booting()) {
- if (!is_dir("{$g['vardb_path']}/rrd")) {
- mkdir("{$g['vardb_path']}/rrd", 0775);
+ if (!is_dir($rrddbpath)) {
+ mkdir($rrddbpath, 0775);
}
- @chown("{$g['vardb_path']}/rrd", "nobody");
+ @chown($rrddbpath, "nobody");
}
/* process all real and pseudo interfaces */
@@ -915,11 +915,11 @@ function enable_rrd_graphing() {
}
/* End NTP statistics */
-
+
/* Start dhcpd statistics */
if (is_array($config['dhcpd'])) {
foreach ($config['dhcpd'] as $dhcpif => $dhcpifconf) {
- if (isset($config['dhcpd'][$dhcpif]['statsgraph'])) {
+ if (isset($config['dhcpd'][$dhcpif]['statsgraph'])) {
if (!file_exists("$rrddbpath$dhcpif$dhcpd")) {
$rrdcreate = "$rrdtool create $rrddbpath$dhcpif$dhcpd --step $rrddhcpdinterval ";
$rrdcreate .= "DS:leases:GAUGE:$dhcpdvalid:0:100000 ";
@@ -950,12 +950,52 @@ function enable_rrd_graphing() {
$rrdupdatesh .= "# polling leases for dhcp \n";
$rrdupdatesh .= "DHCP=`${php} -q ${dhcpd_gather} '${dhcpif}'`\n";
$rrdupdatesh .= "$rrdtool update $rrddbpath$dhcpif$dhcpd \${DHCP}\n";
-
+
}
}
}
/* END dhcpd statistics */
+ /* Start gateway quality */
+ $rrdupdatesh .= <<<EOD
+
+# Gateway quality graphs
+for sock in {$g['varrun_path']}/dpinger_*.sock; do
+ if [ ! -S "\$sock" ]; then
+ continue
+ fi
+ loss=\$(/usr/bin/nc -U \$sock | awk '{ print \$3 }')
+ delay=\$(/usr/bin/nc -U \$sock | awk '{ print \$1 }')
+
+ if echo "\$loss" | grep -Eqv '^[0-9]+\$'; then
+ loss="U"
+ fi
+ if echo "\$delay" | grep -Eqv '^[0-9]+\$'; then
+ delay="U"
+ else
+ # Convert delay to millisecond
+ delay=\$(echo "scale=7; \$delay / 1000 / 1000" | /usr/bin/bc)
+ fi
+
+ gw=\$(echo \$sock | sed 's,^.*dpinger_,,; s,\.sock,,')
+ if [ ! -f {$rrddbpath}\$gw-quality.rrd ]; then
+ {$rrdtool} create {$rrddbpath}\$gw-quality.rrd --step 60 \\
+ DS:loss:GAUGE:120:0:100 \\
+ DS:delay:GAUGE:120:0:100000 \\
+ RRA:AVERAGE:0.5:1:1200 \\
+ RRA:AVERAGE:0.5:5:720 \\
+ RRA:AVERAGE:0.5:60:1860 \\
+ RRA:AVERAGE:0.5:1440:2284
+
+ {$rrdtool} update {$rrddbpath}\$gw-quality.rrd -t loss:delay N:U:U
+ fi
+
+ {$rrdtool} update {$rrddbpath}\$gw-quality.rrd -t loss:delay N:\$loss:\$delay
+done
+
+EOD;
+ /* End gateway quality */
+
$rrdupdatesh .= "sleep 60\n";
$rrdupdatesh .= "done\n";
log_error(gettext("Creating rrd update script"));
@@ -989,41 +1029,6 @@ function enable_rrd_graphing() {
}
-# Create gateway quality RRD with settings suitable for pfSense graph set.
-function create_gateway_quality_rrd($rrd_file) {
- global $g;
-
- $rrdinterval = 60;
- $valid = $rrdinterval * 2;
- $rrdtool = "/usr/bin/nice -n20 /usr/local/bin/rrdtool";
-
- /* GATEWAY QUALITY, set up the rrd file */
- if (!file_exists("$rrd_file")) {
- $rrdcreate = "$rrdtool create $rrd_file --step $rrdinterval ";
- $rrdcreate .= "DS:loss:GAUGE:$valid:0:100 ";
- $rrdcreate .= "DS:delay:GAUGE:$valid:0:100000 ";
- $rrdcreate .= "RRA:AVERAGE:0.5:1:1200 ";
- $rrdcreate .= "RRA:AVERAGE:0.5:5:720 ";
- $rrdcreate .= "RRA:AVERAGE:0.5:60:1860 ";
- $rrdcreate .= "RRA:AVERAGE:0.5:1440:2284 ";
-
- create_new_rrd($rrdcreate);
- unset($rrdcreate);
- }
-
- /* enter UNKNOWN values in the RRD so it knows we rebooted. */
- if (platform_booting()) {
- if (!is_dir("{$g['vardb_path']}/rrd")) {
- mkdir("{$g['vardb_path']}/rrd", 0775);
- }
-
- @chown("{$g['vardb_path']}/rrd", "nobody");
-
- mwexec("$rrdtool update $rrd_file N:U:U");
- }
- unset($rrdtool, $rrdinterval, $valid, $rrd_file);
-}
-
function kill_traffic_collector() {
global $g;
diff --git a/src/etc/inc/service-utils.inc b/src/etc/inc/service-utils.inc
index c97c7c9..f4d355d 100644
--- a/src/etc/inc/service-utils.inc
+++ b/src/etc/inc/service-utils.inc
@@ -322,7 +322,7 @@ function get_services() {
$gateways_arr = return_gateways_array();
if (is_array($gateways_arr)) {
$pconfig = array();
- $pconfig['name'] = "apinger";
+ $pconfig['name'] = "dpinger";
$pconfig['description'] = gettext("Gateway Monitoring Daemon");
$services[] = $pconfig;
}
@@ -609,7 +609,7 @@ function service_control_start($name, $extras) {
case 'openntpd':
system_ntp_configure();
break;
- case 'apinger':
+ case 'dpinger':
setup_gateways_monitor();
break;
case 'bsnmpd':
@@ -678,8 +678,8 @@ function service_control_stop($name, $extras) {
case 'openntpd':
killbyname("openntpd");
break;
- case 'apinger':
- killbypid("{$g['varrun_path']}/apinger.pid");
+ case 'dpinger':
+ stop_dpinger();
break;
case 'bsnmpd':
killbypid("{$g['varrun_path']}/snmpd.pid");
@@ -748,8 +748,7 @@ function service_control_restart($name, $extras) {
case 'openntpd':
system_ntp_configure();
break;
- case 'apinger':
- killbypid("{$g['varrun_path']}/apinger.pid");
+ case 'dpinger':
setup_gateways_monitor();
break;
case 'bsnmpd':
diff --git a/src/etc/inc/services.inc b/src/etc/inc/services.inc
index 2b4cd4a..da9a28e 100644
--- a/src/etc/inc/services.inc
+++ b/src/etc/inc/services.inc
@@ -38,8 +38,8 @@
pfSense_MODULE: utils
*/
-define('DYNDNS_PROVIDER_VALUES', 'citynetwork cloudflare custom custom-v6 dnsexit dnsimple dnsmadeeasy dnsomatic dyndns dyndns-custom dyndns-static dyns easydns eurodns freedns glesys googledomains gratisdns he-net he-net-v6 he-net-tunnelbroker loopia namecheap noip noip-free ods opendns ovh-dynhost route53 selfhost zoneedit');
-define('DYNDNS_PROVIDER_DESCRIPTIONS', 'City Network,CloudFlare,Custom,Custom (v6),DNSexit,DNSimple,DNS Made Easy,DNS-O-Matic,DynDNS (dynamic),DynDNS (custom),DynDNS (static),DyNS,easyDNS,Euro Dns,freeDNS,GleSYS,Google Domains,GratisDNS,HE.net,HE.net (v6),HE.net Tunnelbroker,Loopia,Namecheap,No-IP,No-IP (free),ODS.org,OpenDNS,OVH DynHOST,Route 53,SelfHost,ZoneEdit');
+define('DYNDNS_PROVIDER_VALUES', 'citynetwork cloudflare custom custom-v6 dnsexit dnsimple dnsmadeeasy dnsomatic dyndns dyndns-custom dyndns-static dyns easydns eurodns freedns glesys googledomains gratisdns he-net he-net-v6 he-net-tunnelbroker loopia namecheap noip noip-free ods opendns ovh-dynhost route53 selfhost spdns spdns-v6 zoneedit');
+define('DYNDNS_PROVIDER_DESCRIPTIONS', 'City Network,CloudFlare,Custom,Custom (v6),DNSexit,DNSimple,DNS Made Easy,DNS-O-Matic,DynDNS (dynamic),DynDNS (custom),DynDNS (static),DyNS,easyDNS,Euro Dns,freeDNS,GleSYS,Google Domains,GratisDNS,HE.net,HE.net (v6),HE.net Tunnelbroker,Loopia,Namecheap,No-IP,No-IP (free),ODS.org,OpenDNS,OVH DynHOST,Route 53,SelfHost,SPDNS,SPDNS (v6),ZoneEdit');
/* implement ipv6 route advertising daemon */
function services_radvd_configure($blacklist = array()) {
diff --git a/src/etc/inc/shaper.inc b/src/etc/inc/shaper.inc
index 8d391a1..160e49c 100644
--- a/src/etc/inc/shaper.inc
+++ b/src/etc/inc/shaper.inc
@@ -1310,7 +1310,12 @@ class priq_queue {
function build_form() {
- $sform = new Form();
+ $sform = new Form(new Form_Button(
+ 'Submit',
+ 'Save'
+ ));
+
+ $sform->setAction("firewall_shaper.php");
$section = new Form_Section("");
@@ -1323,13 +1328,20 @@ class priq_queue {
));
$section->addInput(new Form_Input(
- 'name',
+ 'newname',
'Name',
'text',
$this->GetQname()
))->setHelp('Enter the name of the queue here. Do not use spaces and limit the size to 15 characters.');
$section->addInput(new Form_Input(
+ 'name',
+ null,
+ 'hidden',
+ $this->GetQname()
+ ));
+
+ $section->addInput(new Form_Input(
'priority',
'Priority',
'number',
@@ -1351,7 +1363,8 @@ class priq_queue {
'default',
null,
null,
- $this->GetDefault()
+ $this->GetDefault(),
+ 'default'
))->setHelp('Default Queue');
}
@@ -1381,7 +1394,7 @@ class priq_queue {
null,
null,
!empty($this->GetCodel())
- ))->setHelp('<a target="_new" href="http://www.openbsd.org/faq/pf/queueing.html#ecn">' . gettext('Explicit Congestion Notification') . '</a>');
+ ))->setHelp('<a target="_new" href="http://www.openbsd.org/faq/pf/queueing.html#ecn">' . gettext('Codel Active Queue') . '</a>');
$group->setHelp('Select options for this queue');
@@ -1394,14 +1407,21 @@ class priq_queue {
$this->GetDescription()
));
- $section->addInput(new Form_Input(
+ $sform->add($section);
+
+ $sform->addGlobal(new Form_Input(
'interface',
null,
'hidden',
$this->GetInterface()
));
- $sform->add($section);
+ $sform->addGlobal(new Form_Input(
+ 'name',
+ null,
+ 'hidden',
+ $this->GetQname()
+ ));
return($sform);
}
@@ -3741,8 +3761,9 @@ EOD;
$form .= "<tbody>";
// If there are no bandwidths defined, make a blank one for convenience
- if(empty($bandwidth))
+ if (empty($bandwidth)) {
$bandwidth = array(0 => array('bw' => '', 'bwscale' => 'Kb', 'bwsched' => 'none'));
+ }
if (is_array($bandwidth)) {
foreach ($bandwidth as $bwidx => $bw) {
@@ -3810,6 +3831,7 @@ EOD;
$sform = new Form();
+ $sform->setAction("firewall_shaper.php");
$section = new Form_Section('Limiters');
@@ -4132,7 +4154,7 @@ class dnqueue_class extends dummynet_class {
$sform = new Form();
-
+ $sform->setAction("firewall_shaper.php");
$section = new Form_Section('Limiters');
$section->addInput(new Form_Checkbox(
@@ -4169,11 +4191,12 @@ class dnqueue_class extends dummynet_class {
$bandwidth = $this->GetBandwidth();
// Delete a row
- if(isset($_GET['delbwrow']) && (count($bandwidth) > 0))
+ if (isset($_GET['delbwrow']) && (count($bandwidth) > 0)) {
unset($bandwidth[$_GET['delbwrow']]);
+ }
// Add a row
- if($_GET['newbwrow']) {
+ if ($_GET['newbwrow']) {
array_push($bandwidth, array(count($bandwidth) => array('bw' => '', 'burst' => '', 'bwscale' => 'Kb', 'bwsched' => 'none') ));
}
@@ -4182,7 +4205,7 @@ class dnqueue_class extends dummynet_class {
$row = 0;
$numrows = count($bandwidth) - 1;
- if($numrows >= 0) {
+ if ($numrows >= 0) {
foreach ($bandwidth as $bwidx => $bw) {
$group = new Form_Group($row == 0 ? 'Bandwidth':null);
@@ -4213,8 +4236,9 @@ class dnqueue_class extends dummynet_class {
'firewall_shaper_vinterface.php?pipe=' . $pipe . '&queue=' . $qname . '&action=' . $action . '&delbwrow=' . $bwidx
))->removeClass('btn-primary')->addClass('btn-danger btn-sm');
- if($row == $numrows)
+ if ($row == $numrows) {
$group->setHelp('Bandwidth is the rate (e.g. Mbit/s) to which traffic in this limiter will be restricted.');
+ }
$section->add($group);
$row++;
diff --git a/src/etc/inc/system.inc b/src/etc/inc/system.inc
index ce58b10..9cbc534 100644
--- a/src/etc/inc/system.inc
+++ b/src/etc/inc/system.inc
@@ -587,7 +587,7 @@ function system_routing_configure($interface = "") {
}
$gateways_arr = return_gateways_array(false, true);
- foreach($gateways_arr as $gateway) {
+ foreach ($gateways_arr as $gateway) {
// setup static interface routes for nonlocal gateways
if (isset($gateway["nonlocalgateway"])) {
$srgatewayip = $gateway['gateway'];
@@ -788,7 +788,7 @@ function system_syslogd_get_remote_servers($syslogcfg, $facility = "*.*") {
// Rather than repeatedly use the same code, use this function to build a list of remote servers.
$facility .= " ".
$remote_servers = "";
- $pad_to = 56;
+ $pad_to = max(strlen($facility), 56);
$padding = ceil(($pad_to - strlen($facility))/8)+1;
if ($syslogcfg['remoteserver']) {
$remote_servers .= "{$facility}" . str_repeat("\t", $padding) . "@" . system_syslogd_fixup_server($syslogcfg['remoteserver']) . "\n";
@@ -838,7 +838,7 @@ function system_syslogd_start() {
$syslogd_extra = "";
if (isset($syslogcfg)) {
- $separatelogfacilities = array('ntp', 'ntpd', 'ntpdate', 'charon', 'ipsec_starter', 'openvpn', 'pptps', 'poes', 'l2tps', 'relayd', 'hostapd', 'dnsmasq', 'filterdns', 'unbound', 'dhcpd', 'dhcrelay', 'dhclient', 'dhcp6c', 'apinger', 'radvd', 'routed', 'olsrd', 'zebra', 'ospfd', 'bgpd', 'miniupnpd', 'filterlog');
+ $separatelogfacilities = array('ntp', 'ntpd', 'ntpdate', 'charon', 'ipsec_starter', 'openvpn', 'pptps', 'poes', 'l2tps', 'relayd', 'hostapd', 'dnsmasq', 'filterdns', 'unbound', 'dhcpd', 'dhcrelay', 'dhclient', 'dhcp6c', 'dpinger', 'radvd', 'routed', 'olsrd', 'zebra', 'ospfd', 'bgpd', 'miniupnpd', 'filterlog');
$syslogconf = "";
if ($config['installedpackages']['package']) {
foreach ($config['installedpackages']['package'] as $package) {
@@ -898,11 +898,11 @@ function system_syslogd_start() {
$syslogconf .= system_syslogd_get_remote_servers($syslogcfg, "*.*");
}
- $syslogconf .= "!apinger\n";
+ $syslogconf .= "!dpinger\n";
if (!isset($syslogcfg['disablelocallogging'])) {
$syslogconf .= "*.* {$log_directive}{$g['varlog_path']}/gateways.log\n";
}
- if (isset($syslogcfg['apinger'])) {
+ if (isset($syslogcfg['dpinger'])) {
$syslogconf .= system_syslogd_get_remote_servers($syslogcfg, "*.*");
}
@@ -947,11 +947,7 @@ function system_syslogd_start() {
local3.* {$log_directive}{$g['varlog_path']}/vpn.log
local4.* {$log_directive}{$g['varlog_path']}/portalauth.log
local7.* {$log_directive}{$g['varlog_path']}/dhcpd.log
-*.notice;kern.debug;lpr.info;mail.crit;daemon.none; {$log_directive}{$g['varlog_path']}/system.log
-news.err;local0.none;local3.none;local4.none; {$log_directive}{$g['varlog_path']}/system.log
-local7.none {$log_directive}{$g['varlog_path']}/system.log
-security.* {$log_directive}{$g['varlog_path']}/system.log
-auth.info;authpriv.info;daemon.info {$log_directive}{$g['varlog_path']}/system.log
+*.notice;kern.debug;lpr.info;mail.crit;daemon.none;news.err;local0.none;local3.none;local4.none;local7.none;security.*;auth.info;authpriv.info;daemon.info {$log_directive}{$g['varlog_path']}/system.log
auth.info;authpriv.info |exec /usr/local/sbin/sshlockout_pf 15
*.emerg *
@@ -967,11 +963,7 @@ EOD;
$syslogconf .= system_syslogd_get_remote_servers($syslogcfg, "local7.*");
}
if (isset($syslogcfg['system'])) {
- $syslogconf .= system_syslogd_get_remote_servers($syslogcfg, "*.notice;kern.debug;lpr.info;mail.crit;");
- $syslogconf .= system_syslogd_get_remote_servers($syslogcfg, "news.err;local0.none;local3.none;local7.none");
- $syslogconf .= system_syslogd_get_remote_servers($syslogcfg, "security.*");
- $syslogconf .= system_syslogd_get_remote_servers($syslogcfg, "auth.info;authpriv.info;daemon.info");
- $syslogconf .= system_syslogd_get_remote_servers($syslogcfg, "*.emerg");
+ $syslogconf .= system_syslogd_get_remote_servers($syslogcfg, "*.emerg;*.notice;kern.debug;lpr.info;mail.crit;news.err;local0.none;local3.none;local7.none;security.*;auth.info;authpriv.info;daemon.info");
}
if (isset($syslogcfg['logall'])) {
// Make everything mean everything, including facilities excluded above.
diff --git a/src/etc/inc/upgrade_config.inc b/src/etc/inc/upgrade_config.inc
index a5ed9d1..a7bb6ce 100644
--- a/src/etc/inc/upgrade_config.inc
+++ b/src/etc/inc/upgrade_config.inc
@@ -4033,7 +4033,7 @@ function upgrade_125_to_126() {
/* subtract 2 from ipsec log levels. the value stored in the config.xml
* will now match the strongswan level exactly.
*/
- foreach(array_keys($ipsec_log_cats) as $cat) {
+ foreach (array_keys($ipsec_log_cats) as $cat) {
if (!isset($config['ipsec']["ipsec_{$cat}"])) {
$new_level = $def_loglevel;
} else {
@@ -4121,8 +4121,9 @@ function upgrade_128_to_129() {
}
/* IPSEC is always on in 2.3. */
- if (isset($config['ipsec']['enable']))
+ if (isset($config['ipsec']['enable'])) {
unset($config['ipsec']['enable']);
+ }
}
function upgrade_129_to_130() {
@@ -4141,4 +4142,54 @@ function upgrade_129_to_130() {
}
}
+function upgrade_130_to_131() {
+ global $config;
+
+ if (isset($config['syslog']['apinger'])) {
+ $config['syslog']['dpinger'] = true;
+ unset($config['syslog']['apinger']);
+ }
+
+ if (isset($config['system']['apinger_debug'])) {
+ unset($config['system']['apinger_debug']);
+ }
+
+ if (!isset($config['gateways']['gateway_item']) ||
+ !is_array($config['gateways']['gateway_item'])) {
+ return;
+ }
+
+ foreach ($config['gateways']['gateway_item'] as &$gw) {
+ // dpinger uses milliseconds
+ if (isset($gw['interval']) &&
+ is_numeric($gw['interval'])) {
+ $gw['interval'] = $gw['interval'] * 1000;
+ }
+ if (isset($gw['down']) &&
+ is_numeric($gw['down'])) {
+ $gw['loss_interval'] = $gw['down'] * 1000;
+ unset($gw['down']);
+ }
+
+ if (isset($gw['avg_delay_samples'])) {
+ unset($gw['avg_delay_samples']);
+ }
+ if (isset($gw['avg_delay_samples_calculated'])) {
+ unset($gw['avg_delay_samples_calculated']);
+ }
+ if (isset($gw['avg_loss_samples'])) {
+ unset($gw['avg_loss_samples']);
+ }
+ if (isset($gw['avg_loss_samples_calculated'])) {
+ unset($gw['avg_loss_samples_calculated']);
+ }
+ if (isset($gw['avg_loss_delay_samples'])) {
+ unset($gw['avg_loss_delay_samples']);
+ }
+ if (isset($gw['avg_loss_delay_samples_calculated'])) {
+ unset($gw['avg_loss_delay_samples_calculated']);
+ }
+ }
+}
+
?>
diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc
index 88d48fa..d372be7 100644
--- a/src/etc/inc/util.inc
+++ b/src/etc/inc/util.inc
@@ -1041,21 +1041,24 @@ function get_configured_carp_interface_list($carpinterface = '', $family = 'inet
$iflist = array();
- if (!is_array($config['virtualip']['vip']) || empty($config['virtualip']['vip']))
+ if (!is_array($config['virtualip']['vip']) || empty($config['virtualip']['vip'])) {
return $iflist;
+ }
$viparr = &$config['virtualip']['vip'];
foreach ($viparr as $vip) {
- if ($vip['mode'] != "carp")
+ if ($vip['mode'] != "carp") {
continue;
+ }
if (empty($carpinterface)) {
$iflist["_vip{$vip['uniqid']}"] = $vip['subnet'];
continue;
}
- if ($carpinterface != "_vip{$vip['uniqid']}")
+ if ($carpinterface != "_vip{$vip['uniqid']}") {
continue;
+ }
switch ($what) {
case 'subnet':
@@ -1478,8 +1481,9 @@ function mwexec($command, $nologentry = false, $clearsigmask = false, $backgroun
// run in foreground, and (optionally) log if nonzero return
$outputarray = array();
exec("$command 2>&1", $outputarray, $retval);
- if (($retval <> 0) && (!$nologentry || isset($config['system']['developerspew'])))
+ if (($retval <> 0) && (!$nologentry || isset($config['system']['developerspew']))) {
log_error(sprintf(gettext("The command '%1\$s' returned exit code '%2\$d', the output was '%3\$s' "), $command, $retval, implode(" ", $outputarray)));
+ }
}
if ($clearsigmask) {
@@ -1494,13 +1498,13 @@ function mwexec_bg($command, $clearsigmask = false) {
return mwexec($command, false, $clearsigmask, true);
}
-/* unlink a file, if it exists */
+/* unlink a file, or pattern-match of a file, if it exists
+ if the file/path contains glob() compatible wildcards, all matching files will be unlinked
+ if no matches, no error occurs */
function unlink_if_exists($fn) {
$to_do = glob($fn);
- if (is_array($to_do)) {
- foreach ($to_do as $filename) {
- @unlink($filename);
- }
+ if (is_array($to_do) && count($to_do) > 0) {
+ array_map("unlink", $to_do);
} else {
@unlink($fn);
}
diff --git a/src/etc/inc/voucher.inc b/src/etc/inc/voucher.inc
index 2e0f5f5..97b2403 100644
--- a/src/etc/inc/voucher.inc
+++ b/src/etc/inc/voucher.inc
@@ -588,8 +588,9 @@ function voucher_configure_zone($sync = false) {
$roll = $rollent['number'];
$len = ($rollent['count'] >> 3) + 1;
- if (strlen(base64_decode($rollent['used'])) != $len)
+ if (strlen(base64_decode($rollent['used'])) != $len) {
$rollent['used'] = base64_encode(str_repeat("\000", $len));
+ }
voucher_write_used_db($roll, $rollent['used']);
$minutes = $rollent['minutes'];
$active_vouchers = array();
diff --git a/src/etc/inc/vpn.inc b/src/etc/inc/vpn.inc
index 09f514b..8769ca1 100644
--- a/src/etc/inc/vpn.inc
+++ b/src/etc/inc/vpn.inc
@@ -138,6 +138,7 @@ function vpn_ipsec_configure($restart = false) {
/* get the automatic ping_hosts.sh ready */
unlink_if_exists("{$g['vardb_path']}/ipsecpinghosts");
touch("{$g['vardb_path']}/ipsecpinghosts");
+ $ipsecpinghostsactive = false;
/* service may have been enabled, disabled, or otherwise changed in a way requiring rule updates */
filter_configure();
@@ -386,6 +387,7 @@ function vpn_ipsec_configure($restart = false) {
}
if (is_ipaddr($srcip)) {
$ipsecpinghosts[] = "{$srcip}|{$dstip}|3|||||{$family}|\n";
+ $ipsecpinghostsactive = true;
}
}
}
@@ -1221,7 +1223,8 @@ EOD;
$tunneltype = "type = transport";
if ((($ph1ent['authentication_method'] == "xauth_psk_server") ||
- ($ph1ent['authentication_method'] == "pre_shared_key")) && isset($ph1ent['mobile'])) {
+ ($ph1ent['authentication_method'] == "pre_shared_key")) &&
+ isset($ph1ent['mobile'])) {
$left_spec = "%any";
} else {
$tmpsubnet = ipsec_get_phase1_src($ph1ent);
@@ -1437,6 +1440,11 @@ EOD;
}
}
+ // run ping_hosts.sh once if it's enabled to avoid wait for minicron
+ if ($ipsecpinghostsactive == true) {
+ mwexec_bg("/usr/local/bin/ping_hosts.sh");
+ }
+
if ($natfilterrules == true) {
filter_configure();
}
diff --git a/src/etc/login.conf b/src/etc/login.conf
index 1e61a9f..98324e2 100644
--- a/src/etc/login.conf
+++ b/src/etc/login.conf
@@ -35,7 +35,7 @@ default:\
:maxproc=unlimited:\
:sbsize=unlimited:\
:vmemoryuse=unlimited:\
- :idletime=unlimited:\
+ :idletime=unlimited:\
:priority=0:\
:ignoretime@:\
:umask=022:
@@ -81,7 +81,7 @@ russian|Russian Users Accounts:\
######################################################################
##
## Example entries
-##
+##
######################################################################
######################################################################
diff --git a/src/etc/pfSense.obsoletedfiles b/src/etc/pfSense.obsoletedfiles
index a680c75..8754ad5 100644
--- a/src/etc/pfSense.obsoletedfiles
+++ b/src/etc/pfSense.obsoletedfiles
@@ -739,6 +739,7 @@
/usr/local/share/strongswan/templates/config/plugins/smp.conf
/usr/local/share/xml
/usr/local/www/auto_complete_helper.js
+/usr/local/www/carp_status.php
/usr/local/www/classes/maintable.inc
/usr/local/www/code-syntax-highlighter
/usr/local/www/csrf/csrf-secret.php
@@ -749,8 +750,16 @@
/usr/local/www/dfuife.css
/usr/local/www/dfuife.js
/usr/local/www/diag_dhcp_leases.php
+/usr/local/www/diag_ipsec.php
+/usr/local/www/diag_ipsec_leases.php
+/usr/local/www/diag_ipsec_sad.php
+/usr/local/www/diag_ipsec_spd.php
+/usr/local/www/diag_logs.php
/usr/local/www/diag_logs_auth.php
/usr/local/www/diag_logs_dhcp.php
+/usr/local/www/diag_logs_filter.php
+/usr/local/www/diag_logs_filter_dynamic.php
+/usr/local/www/diag_logs_filter_summary.php
/usr/local/www/diag_logs_gateways.php
/usr/local/www/diag_logs_ipsec.php
/usr/local/www/diag_logs_ntpd.php
@@ -759,10 +768,14 @@
/usr/local/www/diag_logs_relayd.php
/usr/local/www/diag_logs_resolver.php
/usr/local/www/diag_logs_routing.php
+/usr/local/www/diag_logs_settings.php
/usr/local/www/diag_logs_slbd.php
+/usr/local/www/diag_logs_vpn.php
/usr/local/www/diag_logs_wireless.php
/usr/local/www/diag_patterns.php
+/usr/local/www/diag_pkglogs.php
/usr/local/www/diag_showbogons.php
+/usr/local/diag_system_pftop.php
/usr/local/www/dom-drag.js
/usr/local/www/draglist.js
/usr/local/www/dtree.js
@@ -780,6 +793,7 @@
/usr/local/www/fred.png
/usr/local/www/green_dot.jpg
/usr/local/www/gui.css
+/usr/local/www/halt.php
/usr/local/www/headjs.php
/usr/local/www/ifstats.cgi
/usr/local/www/includes/javascript.inc.php
@@ -815,6 +829,7 @@
/usr/local/www/protochart/ProtoChart.js
/usr/local/www/protochart/excanvas-compressed.js
/usr/local/www/protochart/excanvas.js
+/usr/local/www/reboot.php
/usr/local/www/row_helper.js
/usr/local/www/row_helper_dynamic.js
/usr/local/www/row_toggle.js
@@ -857,6 +872,8 @@
/usr/local/www/vpn_openvpn_crl_edit.php
/usr/local/www/vpn_openvpn_srv.php
/usr/local/www/vpn_openvpn_srv_edit.php
+/usr/local/www/vpn_pppoe.php
+/usr/local/www/vpn_pppoe_edit.php
/usr/local/www/vpn_pppoe_users.php
/usr/local/www/vpn_pppoe_users_edit.php
/usr/local/www/wizards/traffic_shaper_wizard.inc
diff --git a/src/etc/phpshellsessions/gitsync b/src/etc/phpshellsessions/gitsync
index dceeaa9..3aa072f 100644
--- a/src/etc/phpshellsessions/gitsync
+++ b/src/etc/phpshellsessions/gitsync
@@ -48,7 +48,7 @@ while (!empty($temp_args)) {
switch ($arg) {
case "--help":
echo "Usage: playback gitsync [options] [[repository] <branch>]\nOptions:\n";
- foreach($valid_args as $arg_name => $arg_desc) {
+ foreach ($valid_args as $arg_name => $arg_desc) {
echo $arg_name . "\n" . $arg_desc;
}
exit;
diff --git a/src/etc/rc.bootup b/src/etc/rc.bootup
index 478e3f5..df434f2 100755
--- a/src/etc/rc.bootup
+++ b/src/etc/rc.bootup
@@ -132,6 +132,12 @@ if (file_exists("/root/firmware.tgz")) {
unlink("/root/firmware.tgz");
}
+/* Reinstall of packages after reboot has been requested */
+if (file_exists('/conf/needs_package_sync_after_reboot')) {
+ touch('/conf/needs_package_sync');
+ @unlink('/conf/needs_package_sync_after_reboot');
+}
+
/* start devd (dhclient now uses it) */
echo "Starting device manager (devd)...";
mute_kernel_msgs();
@@ -152,6 +158,10 @@ echo "done.\n";
/* run any early shell commands specified in config.xml */
system_do_shell_commands(1);
+if (file_exists("/conf/trigger_initial_wizard")) {
+ check_for_alternate_interfaces();
+}
+
/*
* Determine if we need to throw a interface exception
* and ask the user to reassign interfaces. This will
diff --git a/src/etc/rc.carpbackup b/src/etc/rc.carpbackup
index 32cb319..e74ea3c 100755
--- a/src/etc/rc.carpbackup
+++ b/src/etc/rc.carpbackup
@@ -50,7 +50,7 @@ $friendly_descr = convert_friendly_interface_to_friendly_descr($friendly);
$vips = link_interface_to_vips($friendly, '', $vhid);
$carp_iface = "{$friendly}_vip{$vhid}";
-if(is_array($vips)) {
+if (is_array($vips)) {
foreach ($vips as $vip) {
$notificationmsg = sprintf('Carp cluster member "(%1$s): (%2$s)" has resumed the state "BACKUP" for vhid %3$s', $argument, $friendly_descr, $vhid);
diff --git a/src/etc/rc.gateway_alarm b/src/etc/rc.gateway_alarm
new file mode 100755
index 0000000..a1afb65
--- /dev/null
+++ b/src/etc/rc.gateway_alarm
@@ -0,0 +1,63 @@
+#!/bin/sh
+#
+# rc.gateway_alarm
+#
+# Copyright (c) 2015 Electric Sheep Fencing, LLC. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+#
+# 3. All advertising materials mentioning features or use of this software
+# must display the following acknowledgment:
+# "This product includes software developed by the pfSense Project
+# for use in the pfSense® software distribution. (http://www.pfsense.org/).
+#
+# 4. The names "pfSense" and "pfSense Project" must not be used to
+# endorse or promote products derived from this software without
+# prior written permission. For written permission, please contact
+# coreteam@pfsense.org.
+#
+# 5. Products derived from this software may not be called "pfSense"
+# nor may "pfSense" appear in their names without prior written
+# permission of the Electric Sheep Fencing, LLC.
+#
+# 6. Redistributions of any form whatsoever must retain the following
+# acknowledgment:
+#
+# "This product includes software developed by the pfSense Project
+# for use in the pfSense software distribution (http://www.pfsense.org/).
+#
+# THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
+# EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
+# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+# OF THE POSSIBILITY OF SUCH DAMAGE.
+
+GW="$1"
+
+if [ -z "$GW" ]; then
+ exit 1
+fi
+
+/usr/local/sbin/pfSctl \
+ -c "service reload dyndns ${GW}" \
+ -c "service reload ipsecdns" \
+ -c "service reload openvpn ${GW}" \
+ -c "filter reload" >/dev/null 2>&1
+
+exit $?
diff --git a/src/etc/rc.initial.defaults b/src/etc/rc.initial.defaults
index 40ceaf9..c80a18d 100755
--- a/src/etc/rc.initial.defaults
+++ b/src/etc/rc.initial.defaults
@@ -36,24 +36,13 @@
$fp = fopen('php://stdin', 'r');
- echo <<<EOD
-
-You are about to reset the firewall to factory defaults.
-The firewall will reboot after resetting the configuration.
-
-Do you want to proceed [y|n]?
-EOD;
+ echo "\n" . gettext("You are about to reset the firewall to factory defaults.");
+ echo "\n" . gettext("The firewall will reboot after resetting the configuration.");
+ echo "\n" . gettext("Do you want to proceed [y|n]?") . " ";
if (strcasecmp(chop(fgets($fp)), "y") == 0) {
-
reset_factory_defaults();
-
- echo <<<EOD
-
-{$g['product_name']} is rebooting now.
-
-EOD;
-
+ echo "\n" . sprintf(gettext("%s is rebooting now."), $g['product_name']) . "\n";
system_reboot_sync();
}
diff --git a/src/etc/rc.initial.halt b/src/etc/rc.initial.halt
index df91ded..27377b5 100755
--- a/src/etc/rc.initial.halt
+++ b/src/etc/rc.initial.halt
@@ -37,21 +37,11 @@
$fp = fopen('php://stdin', 'r');
- echo <<<EOD
-
-{$g['product_name']} will shutdown and halt system. This may take a few minutes, depending on your hardware.
-
-Do you want to proceed [y|n]?
-EOD;
+ echo "\n" . sprintf(gettext("%s will shutdown and halt system. This may take a few minutes, depending on your hardware."), $g['product_name']) . "\n";
+ echo gettext("Do you want to proceed [y|n]?") . " ";
if (strcasecmp(chop(fgets($fp)), "y") == 0) {
-
- echo <<<EOD
-
-{$g['product_name']} will shutdown and halt system now.
-
-EOD;
-
+ echo "\n" . sprintf(gettext("%s will shutdown and halt system now."), $g['product_name']) . "\n";
system_halt();
}
diff --git a/src/etc/rc.initial.password b/src/etc/rc.initial.password
index 0e13f7c..969745b 100755
--- a/src/etc/rc.initial.password
+++ b/src/etc/rc.initial.password
@@ -40,14 +40,14 @@
echo "\n" . gettext('
The webConfigurator admin password and privileges will be reset to the default (which is "' . strtolower($g['product_name']) . '").') . "\n" .
- gettext('Do you want to proceed [y|n]?');
+ gettext('Do you want to proceed [y|n]?') . " ";
if (strcasecmp(chop(fgets($fp)), "y") == 0) {
if (isset($config['system']['webgui']['authmode']) &&
- $config['system']['webgui']['authmode'] != "Local Database") {
+ $config['system']['webgui']['authmode'] != "Local Database") {
echo "\n" . gettext('
The User manager authentication server is set to "' . $config['system']['webgui']['authmode'] . '".') . "\n" .
- gettext('Do you want to set it back to Local Database [y|n]?');
+ gettext('Do you want to set it back to Local Database [y|n]?') . " ";
if (strcasecmp(chop(fgets($fp)), "y") == 0) {
$config['system']['webgui']['authmode'] = "Local Database";
}
@@ -76,7 +76,7 @@ The User manager authentication server is set to "' . $config['system']['webgui'
write_config(gettext("password changed from console menu"));
echo "\n" . gettext('
-The password for the webConfigurator has been reset and
+The password for the webConfigurator has been reset and
the default username has been set to "admin".') . "\n" .
gettext('
Remember to set the password to something else than
diff --git a/src/etc/rc.initial.reboot b/src/etc/rc.initial.reboot
index 6f70407..fdcc480 100755
--- a/src/etc/rc.initial.reboot
+++ b/src/etc/rc.initial.reboot
@@ -37,21 +37,11 @@
$fp = fopen('php://stdin', 'r');
- echo <<<EOD
-
-{$g['product_name']} will reboot. This may take a few minutes, depending on your hardware.
-
-Do you want to proceed [y|n]?
-EOD;
+ echo "\n" . sprintf(gettext("%s will reboot. This may take a few minutes, depending on your hardware."), $g['product_name']) . "\n";
+ echo gettext("Do you want to proceed [y|n]?") . " ";
if (strcasecmp(chop(fgets($fp)), "y") == 0) {
-
- echo <<<EOD
-
-{$g['product_name']} is rebooting now.
-
-EOD;
-
+ echo "\n" . sprintf(gettext("%s is rebooting now."), $g['product_name']) . "\n";
system_reboot_sync();
}
diff --git a/src/etc/rc.newwanip b/src/etc/rc.newwanip
index ea44b81..45cef96 100755
--- a/src/etc/rc.newwanip
+++ b/src/etc/rc.newwanip
@@ -216,8 +216,8 @@ if (!is_ipaddr($oldip) || $curwanip != $oldip || !is_ipaddrv4($config['interface
/*
* Some services (e.g. dyndns, see ticket #4066) depend on
* filter_configure() to be called before, otherwise pass out
- * route-to rules have the old ip set in 'from' and connection
- * do not go through correct link
+ * route-to rules have the old ip set in 'from' and connections
+ * do not go through the correct link
*/
filter_configure_sync();
diff --git a/src/etc/rc.openvpn b/src/etc/rc.openvpn
index cda8067..790f9c8 100755
--- a/src/etc/rc.openvpn
+++ b/src/etc/rc.openvpn
@@ -76,7 +76,7 @@ if (isset($_GET['interface'])) {
}
if ((is_array($config['openvpn']['openvpn-server']) && count($config['openvpn']['openvpn-server'])) ||
- (is_array($config['openvpn']['openvpn-client']) && count($config['openvpn']['openvpn-client']))) {
+ (is_array($config['openvpn']['openvpn-client']) && count($config['openvpn']['openvpn-client']))) {
if (empty($argument) || $argument == "all") {
$argument = "all";
$log_text = "all";
diff --git a/src/etc/rc.packages b/src/etc/rc.packages
index 643ee85..3fe08b9 100755
--- a/src/etc/rc.packages
+++ b/src/etc/rc.packages
@@ -73,15 +73,14 @@ if ($pkg == '' || $when == '') {
pkg_remove_prefix($pkg);
switch ($when) {
-case "post-install":
- install_package_xml($pkg);
- break;
-case "deinstall":
-case "post-deinstall":
- delete_package_xml($pkg, $when);
- break;
-default:
- usage();
+ case "post-install":
+ install_package_xml($pkg);
+ break;
+ case "post-deinstall":
+ delete_package_xml($pkg, $when);
+ break;
+ default:
+ usage();
}
?>
diff --git a/src/etc/services b/src/etc/services
index 1f85da0..6687559 100644
--- a/src/etc/services
+++ b/src/etc/services
@@ -134,7 +134,7 @@ bootpc 68/tcp dhcpc #Bootstrap Protocol Client
bootpc 68/udp dhcpc #Bootstrap Protocol Client
tftp 69/tcp #Trivial File Transfer
tftp 69/udp #Trivial File Transfer
-tftp-proxy 6969/udp
+tftp-proxy 6969/udp
gopher 70/tcp
gopher 70/udp
netrjs-1 71/tcp #Remote Job Service
diff --git a/src/etc/sshd b/src/etc/sshd
index 05ddb63..2e59824 100755
--- a/src/etc/sshd
+++ b/src/etc/sshd
@@ -163,7 +163,7 @@
$generate_keys = array();
foreach ($keys as $key) {
if (!file_exists("{$sshConfigDir}/ssh_host_{$key['suffix']}key") ||
- !file_exists("{$sshConfigDir}/ssh_host_{$key['suffix']}key.pub")) {
+ !file_exists("{$sshConfigDir}/ssh_host_{$key['suffix']}key.pub")) {
$generate_keys[] = $key;
}
}
diff --git a/src/etc/ssl/openssl.cnf b/src/etc/ssl/openssl.cnf
index 41664e6..3ea2df5 100644
--- a/src/etc/ssl/openssl.cnf
+++ b/src/etc/ssl/openssl.cnf
@@ -275,7 +275,7 @@ authorityKeyIdentifier=keyid:always,issuer:always
# So we do this instead.
basicConstraints = CA:true
-# Key usage: this is typical for a CA certificate.
+# Key usage: this is typical for a CA certificate.
keyUsage = cRLSign, keyCertSign
# Some might want this also
diff --git a/src/sbin/dhclient-script b/src/sbin/dhclient-script
index d8199cb..0695eff 100755
--- a/src/sbin/dhclient-script
+++ b/src/sbin/dhclient-script
@@ -110,7 +110,7 @@ add_new_address() {
$LOGGER "New Routers ($interface): $new_routers"
- # This is necessary otherwise apinger will try to ping all 1s address
+ # This is necessary otherwise dpinger will try to ping all 1s address
if [ -n "$new_routers" ] && [ "$new_routers" != "255.255.255.255" ]; then
echo $new_routers > /tmp/${interface}_router
fi
diff --git a/src/usr/local/sbin/pfSense-upgrade b/src/usr/local/sbin/pfSense-upgrade
index 4ee40cb..297476d 100755
--- a/src/usr/local/sbin/pfSense-upgrade
+++ b/src/usr/local/sbin/pfSense-upgrade
@@ -140,6 +140,10 @@ _exit() {
/etc/rc.conf_mount_ro
fi
+ if [ -n "${nc_pid}" ] && ps -p ${nc_pid} >/dev/null 2>&1; then
+ kill ${nc_pid}
+ fi
+
local _rc=${1:-"0"}
# If EVENT_PIPE is defined, GUI is calling
@@ -153,20 +157,22 @@ pkg_with_pb() {
local _event_pipe=""
if [ -n "${progress_socket}" ]; then
- if [ -e "${progress_socket}" ]; then
- rm -f ${progress_socket}
+ if [ -e "${chroot_dir}${progress_socket}" ]; then
+ rm -f ${chroot_dir}${progress_socket}
fi
_event_pipe="-o EVENT_PIPE=${progress_socket}"
- nc -lU ${progress_socket} >> ${progress_file} &
+ nc -lU ${chroot_dir}${progress_socket} >> ${progress_file} &
+ nc_pid=$!
- while [ ! -e "${progress_socket}" ]; do
+ while [ ! -e "${chroot_dir}${progress_socket}" ]; do
sleep 0.1
done
fi
pkg ${_event_pipe} $@
+ nc_pid=""
return $?
}
@@ -243,7 +249,7 @@ pkg_update() {
if [ -z "${_force}" -a -f ${last_update_file} ]; then
local _last_update=$(head -n 1 ${last_update_file})
- # Verify if content contain only numbers
+ # Verify if content contains only numbers
if echo "${_last_update}" | grep -E -q '^[0-9]+$'; then
local _now=$(date +%s)
# Only run update hourly, and if last update is in the future
@@ -310,8 +316,10 @@ pkg_upgrade() {
_echo "**** WARNING ****"
_echo "Duplicate slice required!!"
_echo ""
- _echo "Before start upgrade process, current mounted nanobsd partition"
- _echo "needs to be cloned to secondary partition, where update will happen"
+ _echo "Before starting the upgrade process, the currently mounted nanobsd partition"
+ _echo "needs to be cloned to the secondary partition, where the update will happen"
+ _echo ""
+ _echo "After installation a reboot will be required to switch partition."
_echo ""
if [ -z "${yes}" ]; then
_echo -n "Proceed with upgrade? (y/N) "
@@ -320,9 +328,11 @@ pkg_upgrade() {
_echo "Aborting..."
_exit 0
fi
+ # Do not make the user have to answer again.
+ yes=1
fi
+ setup_nanobsd_env
fi
- setup_nanobsd_env
need_reboot=1
fi
@@ -695,6 +705,9 @@ fi
export pkg_chroot=""
export chroot_dir=""
+# Save nc_pid to be able to kill it
+export nc_pid=""
+
unset dry_run
unset dont_reboot
unset booting
diff --git a/src/usr/local/share/pfSense/post_upgrade_command b/src/usr/local/share/pfSense/post_upgrade_command
index 4a63a31..1a3e968 100755
--- a/src/usr/local/share/pfSense/post_upgrade_command
+++ b/src/usr/local/share/pfSense/post_upgrade_command
@@ -5,7 +5,7 @@
PFSENSETYPE=`cat /etc/platform`
if [ "${PFSENSETYPE}" = "pfSense" -o "${PFSENSETYPE}" = "nanobsd" ]; then
- touch /conf/needs_package_sync
+ touch /conf/needs_package_sync_after_reboot
fi
if [ "${PFSENSETYPE}" = "nanobsd" ]; then
diff --git a/src/usr/local/www/bootstrap/css/pfSense-dark.css b/src/usr/local/www/bootstrap/css/pfSense-dark.css
index ab8d465..63380de 100644
--- a/src/usr/local/www/bootstrap/css/pfSense-dark.css
+++ b/src/usr/local/www/bootstrap/css/pfSense-dark.css
@@ -79,6 +79,11 @@ ul.context-links li a {
color: #009688;
}
+/* navigation */
+.navbar-inverse {
+ background-color: #000000;
+}
+
.nav>li>a {
border-bottom: 5px solid #212121;
color: #009688;
@@ -97,7 +102,7 @@ ul.context-links li a {
color: #009688;
}
-.navbar-nav >li>a {
+.navbar-inverse .navbar-nav >li>a {
border-bottom: 5px solid #000000;
}
@@ -117,6 +122,7 @@ ul.context-links li a {
.nav-tabs {
border-bottom: 1px solid #009688;
}
+/* end navigation */
/* common button colors */
.btn-default {
@@ -158,6 +164,18 @@ ul.context-links li a {
border-color: #37474F;
}
+.alert-warning {
+ border-top: 1px solid #FFECB3;
+}
+
+.alert-success {
+ border-top: 1px solid #DCEDC8;
+}
+
+.alert-info {
+ border-top: 1px solid #B2EBF2;
+}
+
caption {
color: #E0E0E0;
background-color: #303030;
@@ -187,12 +205,6 @@ caption {
background-color: #424242;
}
-.alert-warning {
- color: #6D4C41;
- background-color: #FFF9C4;
- border-color: #FFEB3B;
-}
-
.help-block {
color: #eeeeee;
}
@@ -290,30 +302,6 @@ a.list-group-item .list-group-item-heading, .list-group-item .list-group-item-he
}
/** create icon colors */
-.icon-black
-{
- color: #000000;
-}
-
-.icon-danger
-{
- color: #F44336;
-}
-
-.icon-success
-{
- color: #5CB85C;
-}
-
-.icon-warning {
- color: #FDD835;
-}
-
-.icon-primary
-{
- color: #009688;
-}
-
.bg-primary {
color: #000;
background-color: #009688;
@@ -363,6 +351,6 @@ button.close {
color: #fff;
}
-textarea {
+input, select, textarea {
color: #212121;
} \ No newline at end of file
diff --git a/src/usr/local/www/bootstrap/css/pfSense.css b/src/usr/local/www/bootstrap/css/pfSense.css
index 4e48f56..59ba403 100644
--- a/src/usr/local/www/bootstrap/css/pfSense.css
+++ b/src/usr/local/www/bootstrap/css/pfSense.css
@@ -107,7 +107,7 @@ ul.context-links li a {
}
.navbar-inverse {
- background-color: #000000;
+ background-color: #212121;
}
.navbar-brand {
@@ -132,8 +132,9 @@ ul.context-links li a {
background-color: #F5F5F5;
}
-.navbar-nav >li>a {
- border-bottom: 5px solid #000000;
+.navbar-inverse .navbar-nav >li>a {
+ border-bottom: 5px solid #212121;
+ color: #BDBDBD;
}
.nav-tabs>li>a {
@@ -171,6 +172,27 @@ ul.context-links li a {
box-shadow: 0px 1px 10px rgba(0,0,0,0.1);
}
+.alert-warning {
+ color: #FF6F00;
+ background-color: #FFFDE7;
+ border-color: #FFECB3;
+ border-top: 5px solid #FFD600;
+}
+
+.alert-success {
+ color: #1B5E20;
+ background-color: #E8F5E9;
+ border-color: #DCEDC8;
+ border-top: 5px solid #1B5E20;
+}
+
+.alert-info {
+ color: #01579B;
+ background-color: #E1F5FE;
+ border-color: #B2EBF2;
+ border-top: 5px solid #01579B;
+}
+
.panel {
margin-bottom: 10px;
border-radius: 0;
@@ -188,6 +210,10 @@ ul.context-links li a {
border-radius: 0;
}
+.panel-heading a:link, .panel-heading a:visited {
+ color: white;
+}
+
.panel-title {
font-size: 20px;
}
@@ -285,6 +311,7 @@ ul.context-links li a {
/** Page header with title and breadcrumb */
.header {
position: relative;
+ margin: 10px 0 20px 0;
}
.header .page-header {
@@ -429,11 +456,11 @@ footer a {
}
.progress-bar.progress-bar-success {
- background-color: #5cb85c;
+ background-color: #4CAF50;
}
.progress-bar.progress-bar-warning {
- background-color: #f0ad4e;
+ background-color: #FBC02D;
}
.progress-bar.progress-bar-danger {
@@ -444,33 +471,17 @@ footer a {
overflow-x: auto;
}
-/** create icon colors */
-.icon-black
-{
- color: #000000;
-}
-
-.icon-danger
-{
- color: #D9534F;
-}
-
-.icon-success
-{
- color: #5CB85C;
-}
-
-.icon-primary
-{
- color: #337AB7;
+/** create text colors */
+.text-warning {
+ color: #F57F17;
}
-.icon-warning {
- color: #FDD835;
+.text-success {
+ color: #4CAF50;
}
-.text-warning {
- color: #F57F17;
+.text-danger {
+ color: #B71C1C;
}
.btn-success {
diff --git a/src/usr/local/www/classes/Form.class.php b/src/usr/local/www/classes/Form.class.php
index 7964d12..6f30f69 100644
--- a/src/usr/local/www/classes/Form.class.php
+++ b/src/usr/local/www/classes/Form.class.php
@@ -35,8 +35,6 @@ class Form extends Form_Element
protected $_attributes = array(
'class' => array('form-horizontal' => true),
'method' => 'post',
- // Empty is interpreted by all browsers to submit to the current URI
- 'action' => '',
);
protected $_sections = array();
protected $_global = array();
@@ -54,6 +52,9 @@ class Form extends Form_Element
if (false !== $submit)
$this->addGlobal($submit);
+
+ if (!isset($this->_attributes['action']))
+ $this->_attributes['action'] = htmlspecialchars($_SERVER['REQUEST_URI']);
}
public function add(Form_Section $section)
diff --git a/src/usr/local/www/classes/Form/Checkbox.class.php b/src/usr/local/www/classes/Form/Checkbox.class.php
index e0734de..d94c210 100644
--- a/src/usr/local/www/classes/Form/Checkbox.class.php
+++ b/src/usr/local/www/classes/Form/Checkbox.class.php
@@ -46,10 +46,16 @@ class Form_Checkbox extends Form_Input
$this->column->addClass('checkbox');
}
- public function displayAsRadio()
+ public function displayAsRadio($id = null)
{
$this->_attributes['type'] = 'radio';
+ if ($id != null) {
+ $this->_attributes['id'] = $id;
+ } else {
+ $this->_attributes['id'] = $this->_attributes['name'] . '_' . $this->_attributes['value'] . ':' .substr(uniqid(), 9);
+ }
+
return $this;
}
diff --git a/src/usr/local/www/classes/Form/Section.class.php b/src/usr/local/www/classes/Form/Section.class.php
index ac1587d..eff386a 100644
--- a/src/usr/local/www/classes/Form/Section.class.php
+++ b/src/usr/local/www/classes/Form/Section.class.php
@@ -81,11 +81,11 @@ class Form_Section extends Form_Element
if ($this->_collapsible & COLLAPSIBLE) {
$hdricon = '<span class="widget-heading-icon">' .
- '<a data-toggle="collapse" href="#' . $this->_attributes['id'] . ' .panel-body">' .
+ '<a data-toggle="collapse" href="#' . $this->_attributes['id'] . '_panel-body">' .
'<i class="fa fa-plus-circle"></i>' .
'</a>' .
'</span>';
- $bodyclass = '<div class="panel-body collapse ';
+ $bodyclass = '<div id="' . $this->_attributes['id'] . '_panel-body" class="panel-body collapse ';
if (($this->_collapsible & SEC_CLOSED)) {
$bodyclass .= 'out">';
} else {
diff --git a/src/usr/local/www/diag_arp.php b/src/usr/local/www/diag_arp.php
index 9f36fd0..ad58a70 100644
--- a/src/usr/local/www/diag_arp.php
+++ b/src/usr/local/www/diag_arp.php
@@ -349,7 +349,7 @@ $mac_man = load_mac_manufacturer_table();
</tr>
</thead>
<tbody>
-
+
<?php
foreach ($data as $entry): ?>
<tr>
@@ -376,7 +376,7 @@ $mac_man = load_mac_manufacturer_table();
<script type="text/javascript">
//<![CDATA[
// Clear the "loading" div once the page has loaded"
-events.push(function(){
+events.push(function() {
$('#loading').empty();
});
//]]>
diff --git a/src/usr/local/www/diag_authentication.php b/src/usr/local/www/diag_authentication.php
index 5dea23d..d665fc6 100644
--- a/src/usr/local/www/diag_authentication.php
+++ b/src/usr/local/www/diag_authentication.php
@@ -87,8 +87,9 @@ if ($_POST) {
$groups = getUserGroups($_POST['username'], $authcfg, $attributes);
$savemsg .= "&nbsp;" . gettext("This user is a member of groups") . ": <br />";
$savemsg .= "<ul>";
- foreach ($groups as $group)
+ foreach ($groups as $group) {
$savemsg .= "<li>" . "{$group} " . "</li>";
+ }
$savemsg .= "</ul>";
} else {
@@ -109,18 +110,21 @@ include("head.inc");
?>
<?php
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
-if ($savemsg)
+if ($savemsg) {
print('<div class="alert alert-success" role="alert">'. $savemsg.'</div>');
+}
$form = new Form('Test');
$section = new Form_Section('Authentication Test');
-foreach (auth_get_authserver_list() as $auth_server)
+foreach (auth_get_authserver_list() as $auth_server) {
$serverlist[$auth_server['name']] = $auth_server['name'];
+}
$section->addInput(new Form_Select(
'authmode',
diff --git a/src/usr/local/www/diag_backup.php b/src/usr/local/www/diag_backup.php
index 7e75e7e..4b5f453 100644
--- a/src/usr/local/www/diag_backup.php
+++ b/src/usr/local/www/diag_backup.php
@@ -372,7 +372,7 @@ if ($_POST) {
/* this will be picked up by /index.php */
conf_mount_rw();
mark_subsystem_dirty("restore");
- touch("/conf/needs_package_sync");
+ touch("/conf/needs_package_sync_after_reboot");
/* remove cache, we will force a config reboot */
if (file_exists("{$g['tmp_path']}/config.cache")) {
unlink("{$g['tmp_path']}/config.cache");
@@ -608,16 +608,18 @@ function build_area_list($showall) {
$pgtitle = array(gettext("Diagnostics"), gettext("Backup/Restore"));
include("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg, 'success');
+}
if (is_subsystem_dirty('restore')):
?>
<br/>
- <form action="reboot.php" method="post">
+ <form action="diag_reboot.php" method="post">
<input name="Submit" type="hidden" value="Yes" />
<?=print_info_box(gettext("The firewall configuration has been changed.") . "<br />" . gettext("The firewall is now rebooting."))?>
<br />
@@ -736,7 +738,7 @@ $group = new Form_Group('');
$group->add(new Form_Button(
'Submit',
'Restore Configuration'
-))->setHelp('The firewall will reboot after restoring the configuration.')->removeClass('btn-primary')->addClass('btn-danger');
+))->setHelp('The firewall will reboot after restoring the configuration.')->removeClass('btn-primary')->addClass('btn-danger restore');
$section->add($group);
@@ -750,7 +752,7 @@ if (($config['installedpackages']['package'] != "") || (is_subsystem_dirty("pack
$group->add(new Form_Button(
'Submit',
'Reinstall Packages'
- ))->setHelp('Click this button to reinstall all system packages. This may take a while.')->removeClass('btn-primary')->addClass('btn-danger');
+ ))->setHelp('Click this button to reinstall all system packages. This may take a while.')->removeClass('btn-primary')->addClass('btn-success');
$section->add($group);
}
@@ -772,7 +774,7 @@ print($form);
?>
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
+events.push(function() {
// ------- Show/hide sections based on checkbox settings --------------------------------------
@@ -791,7 +793,7 @@ events.push(function(){
hideInput('decrypt_passconf', decryptHide);
}
- // ---------- Click checkbox handlers ---------------------------------------------------------
+ // ---------- Click handlers ------------------------------------------------------------------
$('input[name="encrypt"]').on('change', function() {
hidePasswords();
@@ -801,9 +803,13 @@ events.push(function(){
hidePasswords();
});
+ $('#conffile').change(function () {
+ $('.restore').prop('disabled', false);
+ });
// ---------- On initial page load ------------------------------------------------------------
hideSections();
+ $('.restore').prop('disabled', true);
});
//]]>
</script>
diff --git a/src/usr/local/www/diag_dns.php b/src/usr/local/www/diag_dns.php
index 679370d..1ac0d17 100755
--- a/src/usr/local/www/diag_dns.php
+++ b/src/usr/local/www/diag_dns.php
@@ -99,8 +99,9 @@ if (isset($_POST['create_alias']) && (is_hostname($host) || is_ipaddr($host))) {
$isfirst = true;
foreach ($resolved as $re) {
if ($re != "") {
- if (!$isfirst)
+ if (!$isfirst) {
$addresses .= " ";
+ }
$addresses .= rtrim($re) . "/32";
$isfirst = false;
}
@@ -211,13 +212,15 @@ function display_host_results ($address, $hostname, $dns_speeds) {
include("head.inc");
/* Display any error messages resulting from user input */
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
-else if (!$resolved && $type)
+} else if (!$resolved && $type) {
print('<div class="alert alert-warning" role="alert">' . gettext("Host") .' "'. $host .'" '. gettext("could not be resolved") . '</div>');
+}
-if ($createdalias)
+if ($createdalias) {
print('<div class="alert alert-success" role="alert">'.gettext("Alias was created/updated successfully").'</div>');
+}
$form = new Form('Lookup');
$section = new Form_Section('DNS Lookup');
diff --git a/src/usr/local/www/diag_dump_states.php b/src/usr/local/www/diag_dump_states.php
index c4c93d6..f5cd437 100755
--- a/src/usr/local/www/diag_dump_states.php
+++ b/src/usr/local/www/diag_dump_states.php
@@ -100,8 +100,8 @@ include("head.inc");
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
- $('a[data-entry]').on('click', function(){
+events.push(function() {
+ $('a[data-entry]').on('click', function() {
var el = $(this);
var data = $(this).data('entry').split('|');
@@ -114,7 +114,7 @@ events.push(function(){
srcip: data[0],
dstip: data[1]
},
- success: function(){
+ success: function() {
el.parents('tr').remove();
},
});
@@ -126,8 +126,9 @@ events.push(function(){
<?php
$tab_array = array();
$tab_array[] = array(gettext("States"), true, "diag_dump_states.php");
-if (isset($config['system']['lb_use_sticky']))
+if (isset($config['system']['lb_use_sticky'])) {
$tab_array[] = array(gettext("Source Tracking"), false, "diag_dump_states_sources.php");
+}
$tab_array[] = array(gettext("Reset States"), false, "diag_resetstate.php");
display_top_tabs($tab_array);
@@ -182,8 +183,9 @@ print $form;
$grepline = (isset($_POST['filter'])) ? "| /usr/bin/egrep " . escapeshellarg(htmlspecialchars($_POST['filter'])) : "";
$fd = popen("/sbin/pfctl -s state {$grepline}", "r");
while ($line = chop(fgets($fd))) {
- if ($row >= 10000)
+ if ($row >= 10000) {
break;
+ }
$line_split = preg_split("/\s+/", $line);
@@ -213,17 +215,18 @@ print $form;
title="<?=sprintf(gettext('Remove all state entries from %s to %s'), $srcip, $dstip);?>"></a>
</td>
</tr>
-<?php $row++; }
+<?php $row++; }
?>
</tbody>
</table>
<?php
if ($row == 0) {
- if (isset($_POST['filter']) && !empty($_POST['filter']))
+ if (isset($_POST['filter']) && !empty($_POST['filter'])) {
$errmsg = gettext('No states were found that match the current filter');
- else
+ } else {
$errmsg = gettext('No states were found');
+ }
print('<p class="alert alert-warning">' . $errmsg . '</p>');
}
diff --git a/src/usr/local/www/diag_dump_states_sources.php b/src/usr/local/www/diag_dump_states_sources.php
index b0c216f..da8cb35 100644
--- a/src/usr/local/www/diag_dump_states_sources.php
+++ b/src/usr/local/www/diag_dump_states_sources.php
@@ -102,8 +102,8 @@ display_top_tabs($tab_array);
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
- $('a[data-entry]').on('click', function(){
+events.push(function() {
+ $('a[data-entry]').on('click', function() {
var el = $(this);
var data = $(this).data('entry').split('|');
@@ -116,7 +116,7 @@ events.push(function(){
srcip: data[0],
dstip: data[1]
},
- success: function(){
+ success: function() {
el.parents('tr').remove();
},
});
diff --git a/src/usr/local/www/halt.php b/src/usr/local/www/diag_halt.php
index 846aeb9..20658e1 100755
--- a/src/usr/local/www/halt.php
+++ b/src/usr/local/www/diag_halt.php
@@ -1,6 +1,6 @@
<?php
/*
- halt.php
+ diag_halt.php
*/
/* ====================================================================
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
@@ -63,7 +63,7 @@
##|*IDENT=page-diagnostics-haltsystem
##|*NAME=Diagnostics: Halt system
##|*DESCR=Allow access to the 'Diagnostics: Halt system' page.
-##|*MATCH=halt.php*
+##|*MATCH=diag_halt.php*
##|-PRIV
// Set DEBUG to true to prevent the system_halt() function from being called
@@ -91,8 +91,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
<?php
if (DEBUG) {
print("Not actually halting (DEBUG is set true)<br>");
- }
- else {
+ } else {
print('<pre>');
system_halt();
print('</pre>');
@@ -107,7 +106,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
<div class="panel-body">
<div class="content">
<p>Click "Halt" to halt the system immediately, or "No" to go to the system dashboard. (There will be a brief delay before the dashboard appears.)</p>
- <form action="halt.php" method="post">
+ <form action="diag_halt.php" method="post">
<input type="submit" class="btn btn-danger pull-center" name="save" value="Halt">
<a href="/" class="btn btn-default">No</a>
</form>
diff --git a/src/usr/local/www/diag_limiter_info.php b/src/usr/local/www/diag_limiter_info.php
index 5425e6c..0c703b6 100644
--- a/src/usr/local/www/diag_limiter_info.php
+++ b/src/usr/local/www/diag_limiter_info.php
@@ -87,8 +87,9 @@ if ($_REQUEST['getactivity']) {
include("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
?>
<script type="text/javascript">
@@ -107,7 +108,7 @@ if ($input_errors)
});
}
- events.push(function(){
+ events.push(function() {
setInterval('getlimiteractivity()', 2500);
getlimiteractivity();
});
diff --git a/src/usr/local/www/diag_logs_filter.php b/src/usr/local/www/diag_logs_filter.php
deleted file mode 100644
index 64a0dad..0000000
--- a/src/usr/local/www/diag_logs_filter.php
+++ /dev/null
@@ -1,634 +0,0 @@
-<?php
-/*
- diag_logs_filter.php
-*/
-
-/* ====================================================================
- * Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
- *
- * Some or all of this file is based on the m0n0wall project which is
- * Copyright (c) 2004 Manuel Kasper (BSD 2 clause)
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- * this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgment:
- * "This product includes software developed by the pfSense Project
- * for use in the pfSense software distribution. (http://www.pfsense.org/).
- *
- * 4. The names "pfSense" and "pfSense Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * coreteam@pfsense.org.
- *
- * 5. Products derived from this software may not be called "pfSense"
- * nor may "pfSense" appear in their names without prior written
- * permission of the Electric Sheep Fencing, LLC.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- *
- * "This product includes software developed by the pfSense Project
- * for use in the pfSense software distribution (http://www.pfsense.org/).
- *
- * THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * ====================================================================
- *
- */
-
-/*
- pfSense_MODULE: filter
-*/
-
-##|+PRIV
-##|*IDENT=page-diagnostics-logs-firewall
-##|*NAME=Status: Logs: Firewall
-##|*DESCR=Allow access to the 'Status: Logs: Firewall' page.
-##|*MATCH=diag_logs_filter.php*
-##|-PRIV
-
-require("guiconfig.inc");
-require_once("ipsec.inc");
-require_once("filter_log.inc");
-
-# --- AJAX RESOLVE ---
-if (isset($_POST['resolve'])) {
- $ip = strtolower($_POST['resolve']);
- $res = (is_ipaddr($ip) ? gethostbyaddr($ip) : '');
-
- if ($res && $res != $ip) {
- $response = array('resolve_ip' => $ip, 'resolve_text' => $res);
- } else {
- $response = array('resolve_ip' => $ip, 'resolve_text' => gettext("Cannot resolve"));
- }
-
- echo json_encode(str_replace("\\", "\\\\", $response)); // single escape chars can break JSON decode
- exit;
-}
-
-function getGETPOSTsettingvalue($settingname, $default) {
- $settingvalue = $default;
- if ($_GET[$settingname]) {
- $settingvalue = $_GET[$settingname];
- }
- if ($_POST[$settingname]) {
- $settingvalue = $_POST[$settingname];
- }
- return $settingvalue;
-}
-
-$rulenum = getGETPOSTsettingvalue('getrulenum', null);
-if ($rulenum) {
- list($rulenum, $tracker, $type) = explode(',', $rulenum);
- $rule = find_rule_by_number($rulenum, $tracker, $type);
- echo gettext("The rule that triggered this action is") . ":\n\n{$rule}";
- exit;
-}
-
-$filtersubmit = getGETPOSTsettingvalue('filtersubmit', null);
-
-if ($filtersubmit) {
- $interfacefilter = getGETPOSTsettingvalue('interface', null);
- $filtertext = getGETPOSTsettingvalue('filtertext', "");
- $filterlogentries_qty = getGETPOSTsettingvalue('filterlogentries_qty', null);
-}
-
-$filterlogentries_submit = getGETPOSTsettingvalue('filterlogentries_submit', null);
-
-if ($filterlogentries_submit) {
- $filterfieldsarray = array();
-
- $actpass = getGETPOSTsettingvalue('actpass', null);
- $actblock = getGETPOSTsettingvalue('actblock', null);
- $filterfieldsarray['act'] = str_replace(" ", " ", trim($actpass . " " . $actblock));
- $filterfieldsarray['act'] = $filterfieldsarray['act'] != "" ? $filterfieldsarray['act'] : 'All';
- $filterfieldsarray['time'] = getGETPOSTsettingvalue('filterlogentries_time', null);
- $filterfieldsarray['interface'] = getGETPOSTsettingvalue('filterlogentries_interfaces', null);
- $filterfieldsarray['srcip'] = getGETPOSTsettingvalue('filterlogentries_sourceipaddress', null);
- $filterfieldsarray['srcport'] = getGETPOSTsettingvalue('filterlogentries_sourceport', null);
- $filterfieldsarray['dstip'] = getGETPOSTsettingvalue('filterlogentries_destinationipaddress', null);
- $filterfieldsarray['dstport'] = getGETPOSTsettingvalue('filterlogentries_destinationport', null);
- $filterfieldsarray['proto'] = getGETPOSTsettingvalue('filterlogentries_protocol', null);
- $filterfieldsarray['tcpflags'] = getGETPOSTsettingvalue('filterlogentries_protocolflags', null);
- $filterlogentries_qty = getGETPOSTsettingvalue('filterlogentries_qty', null);
-}
-
-$filter_logfile = "{$g['varlog_path']}/filter.log";
-
-$nentries = $config['syslog']['nentries'];
-
-# Override Display Quantity
-if ($filterlogentries_qty) {
- $nentries = $filterlogentries_qty;
-}
-
-if (!$nentries || !is_numeric($nentries)) {
- $nentries = 50;
-}
-
-if ($_POST['clear']) {
- clear_log_file($filter_logfile);
-}
-
-$pgtitle = array(gettext("Status"), gettext("System logs"), gettext("Firewall"));
-$shortcut_section = "firewall";
-include("head.inc");
-
-function build_if_list() {
- $iflist = get_configured_interface_with_descr(false, true);
- //$iflist = get_interface_list();
- // Allow extending of the firewall edit interfaces
- pfSense_handle_custom_code("/usr/local/pkg/firewall_nat/pre_interfaces_edit");
- foreach ($iflist as $if => $ifdesc)
- $interfaces[$if] = $ifdesc;
-
- if ($config['l2tp']['mode'] == "server")
- $interfaces['l2tp'] = "L2TP VPN";
-
- if (is_pppoe_server_enabled() && have_ruleint_access("pppoe"))
- $interfaces['pppoe'] = "PPPoE Server";
-
- /* add ipsec interfaces */
- if (ipsec_enabled())
- $interfaces["enc0"] = "IPsec";
-
- /* add openvpn/tun interfaces */
- if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"])
- $interfaces["openvpn"] = "OpenVPN";
-
- return($interfaces);
-}
-
-$tab_array = array();
-$tab_array[] = array(gettext("System"), false, "diag_logs.php");
-$tab_array[] = array(gettext("Firewall"), true, "diag_logs_filter.php");
-$tab_array[] = array(gettext("DHCP"), false, "diag_logs.php?logfile=dhcpd");
-$tab_array[] = array(gettext("Portal Auth"), false, "diag_logs.php?logfile=portalauth");
-$tab_array[] = array(gettext("IPsec"), false, "diag_logs.php?logfile=ipsec");
-$tab_array[] = array(gettext("PPP"), false, "diag_logs.php?logfile=ppp");
-$tab_array[] = array(gettext("VPN"), false, "diag_logs_vpn.php");
-$tab_array[] = array(gettext("Load Balancer"), false, "diag_logs.php?logfile=relayd");
-$tab_array[] = array(gettext("OpenVPN"), false, "diag_logs.php?logfile=openvpn");
-$tab_array[] = array(gettext("NTP"), false, "diag_logs.php?logfile=ntpd");
-$tab_array[] = array(gettext("Settings"), false, "diag_logs_settings.php");
-display_top_tabs($tab_array);
-
-$tab_array = array();
-$tab_array[] = array(gettext("Normal View"), true, "/diag_logs_filter.php");
-$tab_array[] = array(gettext("Dynamic View"), false, "/diag_logs_filter_dynamic.php");
-$tab_array[] = array(gettext("Summary View"), false, "/diag_logs_filter_summary.php");
-display_top_tabs($tab_array, false, 'nav nav-tabs');
-
-$Include_Act = explode(",", str_replace(" ", ",", $filterfieldsarray['act']));
-if ($filterfieldsarray['interface'] == "All")
- $interface = "";
-
-if (!isset($config['syslog']['rawfilter'])) { // Advanced log filter form
- $form = new Form(false);
-
- $section = new Form_Section('Advanced Log Filter', 'adv-filter-panel', COLLAPSIBLE|SEC_CLOSED);
-
- $group = new Form_Group('');
-
- $group->add(new Form_Input(
- 'filterlogentries_sourceipaddress',
- null,
- 'text',
- $filterfieldsarray['srcip']
- ))->setHelp('Source IP Address');
-
- $group->add(new Form_Input(
- 'filterlogentries_destinationipaddress',
- null,
- 'text',
- $filterfieldsarray['dstip']
- ))->setHelp('Destination IP Address');
-
- $section->add($group);
- $group = new Form_Group('');
-
- $group->add(new Form_Checkbox(
- 'actpass',
- 'Pass',
- 'Pass',
- in_arrayi('Pass', $Include_Act),
- 'Pass'
- ));
-
- $group->add(new Form_Input(
- 'filterlogentries_time',
- null,
- 'text',
- $filterfieldsarray['time']
- ))->setHelp('Time');
-
- $group->add(new Form_Input(
- 'filterlogentries_sourceport',
- null,
- 'text',
- $filterfieldsarray['srcport']
- ))->setHelp('Source Port');
-
- $group->add(new Form_Input(
- 'filterlogentries_protocol',
- null,
- 'text',
- $filterfieldsarray['proto']
- ))->setHelp('Protocol');
-
- $group->add(new Form_Input(
- 'filterlogentries_qty',
- null,
- 'number',
- $filterlogentries_qty,
- ['placeholder' => $nentries]
- ))->setHelp('Quantity');
-
- $section->add($group);
-
- $group = new Form_Group('');
-
- $group->add(new Form_Checkbox(
- 'actblock',
- 'Block',
- 'Block',
- in_arrayi('Block', $Include_Act),
- 'Block'
- ));
-
- $group->add(new Form_Input(
- 'filterlogentries_interfaces',
- null,
- 'text',
- $filterfieldsarray['interface']
- ))->setHelp('Interface');
-
- $group->add(new Form_Input(
- 'filterlogentries_destinationport',
- null,
- 'text',
- $filterfieldsarray['dstport']
- ))->setHelp('Destination Port');
-
- $group->add(new Form_Input(
- 'filterlogentries_protocolflags',
- null,
- 'text',
- $filterfieldsarray['tcpflags']
- ))->setHelp('Protocol Flags');
-
- $btnsubmit = new Form_Button(
- 'filterlogentries_submit',
- ' ' . 'Apply Filter',
- null,
- 'fa-filter'
- );
-}
-else { // Simple log filter form
- $form = new Form(false);
-
- $section = new Form_Section('Log Filter', 'basic-filter-panel', true);
-
- $group = new Form_Group('');
-
- $group->add(new Form_Select(
- 'interface',
- 'Interface',
- $interfacefilter,
- build_if_list()
- ))->setHelp('Interface');
-
- $group->add(new Form_Input(
- 'filterlogentries_qty',
- null,
- 'number',
- $filterlogentries_qty,
- ['placeholder' => $nentries]
- ))->setHelp('Quantity');
-
- $section->add($group);
-
- $group = new Form_Group('');
-
- $group->add(new Form_Input(
- 'filtertext',
- null,
- 'text',
- $filtertext
- ))->setHelp('Filter Expression');
-
- $btnsubmit = new Form_Button(
- 'filtersubmit',
- ' ' . 'Apply Filter',
- null,
- 'fa-filter'
- );
-}
-
-$btnsubmit->removeClass('btn-primary')->addClass('btn-success')->addClass('btn-sm');
-
-$group->add(new Form_StaticText(
- '',
- $btnsubmit
-));
-
-$group->setHelp('<a target="_blank" href="http://www.php.net/manual/en/book.pcre.php">' . 'Regular expression reference</a> Precede with exclamation (!) to exclude match.');
-$section->add($group);
-$form->add($section);
-print($form);
-
-// Now the forms are complete we can draw the log table and its controls
-if (!isset($config['syslog']['rawfilter'])) {
- $iflist = get_configured_interface_with_descr(false, true);
-
- if ($iflist[$interfacefilter])
- $interfacefilter = $iflist[$interfacefilter];
-
- if ($filterlogentries_submit)
- $filterlog = conv_log_filter($filter_logfile, $nentries, $nentries + 100, $filterfieldsarray);
- else
- $filterlog = conv_log_filter($filter_logfile, $nentries, $nentries + 100, $filtertext, $interfacefilter);
-?>
-
-<form id="clearform" name="clearform" action="diag_logs_filter.php" method="post" style="margin-top: 14px;">
- <input id="submit" name="clear" type="submit" class="btn btn-danger" value="<?=gettext("Clear log")?>" />
-</form>
-
-<br />
-<div class="panel panel-default">
- <div class="panel-heading">
- <h2 class="panel-title">
-<?php
- if ((!$filtertext) && (!$filterfieldsarray))
- printf(gettext("Last %d %s log entries."), count($filterlog), gettext('firewall'));
- else
- printf(gettext('%d matched %s log entries.'), count($filterlog), gettext('firewall'));
-
- printf(gettext(" (Maximum %d)"), $nentries);
-?>
- </h2>
- </div>
- <div class="panel-body">
- <div class="table-responsive">
- <table class="table table-striped table-hover table-compact">
- <tr>
- <th><?=gettext("Act")?></th>
- <th><?=gettext("Time")?></th>
- <th><?=gettext("IF")?></th>
-<?php
- if ($config['syslog']['filterdescriptions'] === "1") {
-?>
- <th>
- <?=gettext("Rule")?>
- </th>
-<?php
- }
-?>
- <th><?=gettext("Source")?></th>
- <th><?=gettext("Destination")?></th>
- <th><?=gettext("Proto")?></th>
- </tr>
-<?php
- if ($config['syslog']['filterdescriptions'])
- buffer_rules_load();
-
- foreach ($filterlog as $filterent) {
-?>
- <tr>
- <td>
-<?php
- if ($filterent['act'] == "block") {
- $icon_act = "fa-times icon-danger";
- } else {
- $icon_act = "fa-check icon-success";
- }
-?>
- <i class="fa <?php echo $icon_act;?> icon-pointer" title="<?php echo $filterent['act'] .'/'. $filterent['tracker'];?>" onclick="javascript:getURL('diag_logs_filter.php?getrulenum=<?="{$filterent['rulenum']},{$filterent['tracker']},{$filterent['act']}"; ?>', outputrule);"></i>
-<?php
- if ($filterent['count'])
- echo $filterent['count'];
-?>
- </td>
- <td>
- <?=htmlspecialchars($filterent['time'])?>
- </td>
- <td>
-<?php
- if ($filterent['direction'] == "out")
- print('&#x25ba;' . ' ');
-?>
- <?=htmlspecialchars($filterent['interface'])?>
- </td>
-<?php
- if ($config['syslog']['filterdescriptions'] === "1") {
-?>
- <td>
- <?=find_rule_by_number_buffer($filterent['rulenum'], $filterent['tracker'], $filterent['act'])?>
- </td>
-<?php
- }
-
- $int = strtolower($filterent['interface']);
- $proto = strtolower($filterent['proto']);
-
- if ($filterent['version'] == '6') {
- $ipproto = "inet6";
- $filterent['srcip'] = "[{$filterent['srcip']}]";
- $filterent['dstip'] = "[{$filterent['dstip']}]";
- } else {
- $ipproto = "inet";
- }
-
- $srcstr = $filterent['srcip'] . get_port_with_service($filterent['srcport'], $proto);
- $src_htmlclass = str_replace(array('.', ':'), '-', $filterent['srcip']);
- $dststr = $filterent['dstip'] . get_port_with_service($filterent['dstport'], $proto);
- $dst_htmlclass = str_replace(array('.', ':'), '-', $filterent['dstip']);
-?>
- <td>
- <i class="fa fa-info icon-pointer icon-primary" onclick="javascript:resolve_with_ajax('<?="{$filterent['srcip']}"; ?>');" title="<?=gettext("Click to resolve")?>" alt="Reverse Resolve with DNS"/>
- </i>
-
- <i class="fa fa-minus-square-o icon-pointer icon-primary" href="easyrule.php?<?="action=block&amp;int={$int}&amp;src={$filterent['srcip']}&amp;ipproto={$ipproto}"; ?>" alt="Easy Rule: Add to Block List" title="<?=gettext("Easy Rule: Add to Block List")?>" onclick="return confirm('<?=gettext("Do you really want to add this BLOCK rule?")?>')">
- </i>
-
- <?=$srcstr . '<span class="RESOLVE-' . $src_htmlclass . '"></span>'?>
- </td>
- <td>
- <i class="fa fa-info icon-pointer icon-primary" onclick="javascript:resolve_with_ajax('<?="{$filterent['dstip']}"; ?>');" title="<?=gettext("Click to resolve")?>" class="ICON-<?= $dst_htmlclass; ?>" alt="Reverse Resolve with DNS"/>
- </i>
-
- <i class="fa fa-plus-square-o icon-pointer icon-primary" href="easyrule.php?<?="action=pass&amp;int={$int}&amp;proto={$proto}&amp;src={$filterent['srcip']}&amp;dst={$filterent['dstip']}&amp;dstport={$filterent['dstport']}&amp;ipproto={$ipproto}"; ?>" title="<?=gettext("Easy Rule: Pass this traffic")?>" onclick="return confirm('<?=gettext("Do you really want to add this PASS rule?")?>')">
- </i>
- <?=$dststr . '<span class="RESOLVE-' . $dst_htmlclass . '"></span>'?>
- </td>
-<?php
- if ($filterent['proto'] == "TCP")
- $filterent['proto'] .= ":{$filterent['tcpflags']}";
-?>
- <td>
- <?=htmlspecialchars($filterent['proto'])?>
- </td>
- </tr>
-<?php
- if (isset($config['syslog']['filterdescriptions']) && $config['syslog']['filterdescriptions'] === "2") {
-?>
- <tr>
- <td colspan="2" />
- <td colspan="4"><?=find_rule_by_number_buffer($filterent['rulenum'],$filterent['tracker'],$filterent['act'])?></td>
- </tr>
-<?php
- }
- } // e-o-foreach
- buffer_rules_clear();
-?>
- </table>
- </div>
- </div>
-</div>
-
-<?php
- if (count($filterlog) == 0)
- print_info_box('No logs to display');
-}
-else
-{
-?>
-<div class="panel panel-default">
- <div class="panel-heading"><h2 class="panel-title"><?=gettext("Last ")?><?=$nentries?> <?='firewall'?><?=gettext(" log entries")?></h2></div>
- <div class="table table-responsive">
- <table class="table table-striped table-hover">
- <thead>
- <tr>
- <th class="col-sm-2"></th>
- <th></th>
- </tr>
- </thead>
- <tbody>
-<?php
- if ($filtertext)
- $rows = dump_clog($filter_logfile, $nentries, true, array("$filtertext"));
- else
- $rows = dump_clog($filter_logfile, $nentries);
-?>
- </tbody>
- </table>
- </div>
-</div>
-<?php
- if ($rows == 0)
- print_info_box('No logs to display');
-}
-?>
-
-<div id="infoblock"
-
-<?php
-
-print_info_box('<a href="https://doc.pfsense.org/index.php/What_are_TCP_Flags%3F">' .
- gettext("TCP Flags") . '</a>: F - FIN, S - SYN, A or . - ACK, R - RST, P - PSH, U - URG, E - ECE, C - CWR' . '<br />' .
- '<i class="fa fa-minus-square-o icon-primary"></i> = Add to block list., <i class="fa fa-plus-square-o icon-primary"></i> = Pass traffic, <i class="fa fa-info icon-primary"></i> = Resolve');
-
-?>
-</div>
-<!-- AJAXY STUFF -->
-<script type="text/javascript">
-//<![CDATA[
-function outputrule(req) {
- alert(req.content);
-}
-
-function resolve_with_ajax(ip_to_resolve) {
- var url = "/diag_logs_filter.php";
-
- $.ajax(
- url,
- {
- method: 'post',
- dataType: 'json',
- data: {
- resolve: ip_to_resolve,
- },
- complete: resolve_ip_callback
- });
-
-}
-
-function resolve_ip_callback(transport) {
- var response = $.parseJSON(transport.responseText);
- var resolve_class = htmlspecialchars(response.resolve_ip.replace(/[.:]/g, '-'));
- var resolve_text = '<small><br />' + htmlspecialchars(response.resolve_text) + '<\/small>';
-
- jQuery('span.RESOLVE-' + resolve_class).html(resolve_text);
-}
-
-// From http://stackoverflow.com/questions/5499078/fastest-method-to-escape-html-tags-as-html-entities
-function htmlspecialchars(str) {
- return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&apos;');
-}
-
-if (typeof getURL == 'undefined') {
- getURL = function(url, callback) {
- if (!url)
- throw 'No URL for getURL';
- try {
- if (typeof callback.operationComplete == 'function')
- callback = callback.operationComplete;
- } catch (e) {}
- if (typeof callback != 'function')
- throw 'No callback function for getURL';
- var http_request = null;
- if (typeof XMLHttpRequest != 'undefined') {
- http_request = new XMLHttpRequest();
- }
- else if (typeof ActiveXObject != 'undefined') {
- try {
- http_request = new ActiveXObject('Msxml2.XMLHTTP');
- } catch (e) {
- try {
- http_request = new ActiveXObject('Microsoft.XMLHTTP');
- } catch (e) {}
- }
- }
- if (!http_request)
- throw 'Both getURL and XMLHttpRequest are undefined';
- http_request.onreadystatechange = function() {
- if (http_request.readyState == 4) {
- callback( { success : true,
- content : http_request.responseText,
- contentType : http_request.getResponseHeader("Content-Type") } );
- }
- };
- http_request.open('GET', url, true);
- http_request.send(null);
- };
-}
-
-events.push(function(){
- $('.fa').tooltip();
-});
-//]]>
-</script>
-
-<?php include("foot.inc");
-?>
diff --git a/src/usr/local/www/diag_nanobsd.php b/src/usr/local/www/diag_nanobsd.php
index b09258c..7a06ebd 100644
--- a/src/usr/local/www/diag_nanobsd.php
+++ b/src/usr/local/www/diag_nanobsd.php
@@ -90,10 +90,11 @@ $NANOBSD_SIZE = nanobsd_get_size();
$class='alert-warning';
if ($_POST['bootslice']) {
- if (!DEBUG)
+ if (!DEBUG) {
nanobsd_switch_boot_slice();
- else
+ } else {
sleep(4);
+ }
$savemsg = gettext("The boot slice has been set to") . " " . nanobsd_get_active_slice();
$class='alert-success';
@@ -126,15 +127,15 @@ if ($_POST['changero']) {
if ($_POST['setrw']) {
if (!DEBUG) {
conf_mount_rw();
- if (isset($_POST['nanobsd_force_rw']))
+ if (isset($_POST['nanobsd_force_rw'])) {
$config['system']['nanobsd_force_rw'] = true;
- else
+ } else {
unset($config['system']['nanobsd_force_rw']);
+ }
write_config("Changed Permanent Read/Write Setting");
conf_mount_ro();
- }
- else {
+ } else {
$savemsg = 'Saved r/w permanently';
$class = 'alert-success';
}
@@ -142,8 +143,9 @@ if ($_POST['setrw']) {
print_info_box("The options on this page are intended for use by advanced users only.");
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg, $class);
+}
$form = new Form(false);
@@ -173,12 +175,14 @@ if (is_writable("/")) {
$refdisplay = " (Reference count " . $refcount . ")";
}
$lbl = gettext("Read/Write") . $refdisplay;
- if (!isset($config['system']['nanobsd_force_rw']))
+ if (!isset($config['system']['nanobsd_force_rw'])) {
$btnlbl = gettext("Switch to Read-Only");
+ }
} else {
$lbl = gettext("Read-Only");
- if (!isset($config['system']['nanobsd_force_rw']))
+ if (!isset($config['system']['nanobsd_force_rw'])) {
$btnlbl = gettext("Switch to Read/Write");
+ }
}
$robtn = new Form_Button('changero', $btnlbl);
diff --git a/src/usr/local/www/diag_ndp.php b/src/usr/local/www/diag_ndp.php
index 461d397..f87b43f 100644
--- a/src/usr/local/www/diag_ndp.php
+++ b/src/usr/local/www/diag_ndp.php
@@ -165,10 +165,11 @@ include("head.inc");
</td>
<td>
<?php
- if (isset($hwif[$entry['interface']]))
+ if (isset($hwif[$entry['interface']])) {
echo $hwif[$entry['interface']];
- else
+ } else {
echo $entry['interface'];
+ }
?>
</td>
</tr>
diff --git a/src/usr/local/www/diag_packet_capture.php b/src/usr/local/www/diag_packet_capture.php
index 3bb8094..6016e90 100644
--- a/src/usr/local/www/diag_packet_capture.php
+++ b/src/usr/local/www/diag_packet_capture.php
@@ -137,8 +137,10 @@ $protos = array('icmp', 'icmp6', 'tcp', 'udp', 'arp', 'carp', 'esp',
$input_errors = array();
$interfaces = get_configured_interface_with_descr();
-if (ipsec_enabled())
+if (ipsec_enabled()) {
$interfaces['enc0'] = "IPsec";
+}
+
foreach (array('server', 'client') as $mode) {
if (is_array($config['openvpn']["openvpn-{$mode}"])) {
foreach ($config['openvpn']["openvpn-{$mode}"] as $id => $setting) {
@@ -285,8 +287,9 @@ $protocollist = array(
include("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
$form = new Form(false); // No button yet. We add those later depending on the required action
@@ -391,8 +394,7 @@ if (($action == gettext("Stop") or $action == "") and $processisrunning != true)
'startbtn',
'Start'
))->removeClass('btn-primary')->addClass('btn-success');
-}
-else {
+} else {
$form->addGlobal(new Form_Button(
'stopbtn',
'Stop'
@@ -421,14 +423,17 @@ print($form);
if ($do_tcpdump) :
$matches = array();
- if (in_array($fam, $fams))
+ if (in_array($fam, $fams)) {
$matches[] = $fam;
+ }
- if (in_array($proto, $protos))
+ if (in_array($proto, $protos)) {
$matches[] = fixup_not($proto);
+ }
- if ($port != "")
+ if ($port != "") {
$matches[] = "port ".fixup_not($port);
+ }
if ($host != "") {
$hostmatch = "";
@@ -437,15 +442,17 @@ if ($do_tcpdump) :
foreach ($hosts as $h) {
$h = fixup_host($h, $hostcount++);
- if (!empty($h))
+ if (!empty($h)) {
$hostmatch .= " " . $h;
+ }
}
- if (!empty($hostmatch))
+ if (!empty($hostmatch)) {
$matches[] = "({$hostmatch})";
+ }
}
- if ($count != "0" ) {
+ if ($count != "0") {
$searchcount = "-c " . $count;
} else {
$searchcount = "";
diff --git a/src/usr/local/www/diag_pf_info.php b/src/usr/local/www/diag_pf_info.php
index c553b34..bd0d3f0 100644
--- a/src/usr/local/www/diag_pf_info.php
+++ b/src/usr/local/www/diag_pf_info.php
@@ -88,8 +88,9 @@ if ($_REQUEST['getactivity']) {
include("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
$form = new Form(false);
$form->addGlobal(new Form_Input(
@@ -114,8 +115,9 @@ print $form;
<script type="text/javascript">
//<![CDATA[
function getpfinfo() {
- if (!$('#refresh').is(':checked'))
+ if (!$('#refresh').is(':checked')) {
return;
+ }
$.ajax(
'/diag_pf_info.php',
@@ -128,7 +130,7 @@ print $form;
});
}
- events.push(function(){
+ events.push(function() {
setInterval('getpfinfo()', 2500);
getpfinfo();
});
diff --git a/src/usr/local/www/diag_system_pftop.php b/src/usr/local/www/diag_pftop.php
index 4191720..dd57e9c 100644
--- a/src/usr/local/www/diag_system_pftop.php
+++ b/src/usr/local/www/diag_pftop.php
@@ -1,6 +1,6 @@
<?php
/*
- diag_system_pftop.php
+ diag_pftop.php
*/
/* ====================================================================
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
@@ -61,7 +61,7 @@
##|*IDENT=page-diagnostics-system-pftop
##|*NAME=Diagnostics: pfTop
##|*DESCR=Allows access to the 'Diagnostics: pfTop' page
-##|*MATCH=diag_system_pftop.php*
+##|*MATCH=diag_pftop.php*
##|-PRIV
require("guiconfig.inc");
@@ -115,8 +115,9 @@ if ($_REQUEST['sorttype'] && in_array($_REQUEST['sorttype'], $sorttypes) &&
$numstate = "100";
}
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
$form = new Form(false);
$form->addGlobal(new Form_Input(
@@ -175,7 +176,7 @@ print $form;
//<![CDATA[
function getpftopactivity() {
$.ajax(
- '/diag_system_pftop.php',
+ '/diag_pftop.php',
{
method: 'post',
data: $(document.forms[0]).serialize(),
@@ -187,7 +188,7 @@ print $form;
);
}
- events.push(function(){
+ events.push(function() {
setInterval('getpftopactivity()', 2500);
getpftopactivity();
});
@@ -204,12 +205,13 @@ print $form;
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
- $('#viewtype').on('change', function(){
- if (['queue', 'label', 'rules'].indexOf($(this).val()) > -1)
+events.push(function() {
+ $('#viewtype').on('change', function() {
+ if (['queue', 'label', 'rules'].indexOf($(this).val()) > -1) {
$("#sorttype, #sorttypediv, #statesdiv, #states").parents('.form-group').hide();
- else
+ } else {
$("#sorttype, #sorttypediv, #statesdiv, #states").parents('.form-group').show();
+ }
});
});
//]]>
diff --git a/src/usr/local/www/diag_ping.php b/src/usr/local/www/diag_ping.php
index 140513e..cc5c442 100644
--- a/src/usr/local/www/diag_ping.php
+++ b/src/usr/local/www/diag_ping.php
@@ -117,7 +117,7 @@ if ($_POST || $_REQUEST['host']) {
if ($_POST) {
$do_ping = true;
}
- if(isset($_REQUEST['sourceip'])) {
+ if (isset($_REQUEST['sourceip'])) {
$sourceip = $_REQUEST['sourceip'];
}
$count = $_REQUEST['count'];
@@ -131,7 +131,7 @@ if ($do_ping) {
?>
<script type="text/javascript">
//<![CDATA[
- window.onload=function(){
+ window.onload=function() {
document.getElementById("pingCaptured").wrap='off';
}
//]]>
@@ -142,31 +142,35 @@ if ($do_ping) {
if ($ipproto == "ipv6") {
$command .= "6";
$ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ipv6($sourceip);
- if (is_linklocal($ifaddr))
+ if (is_linklocal($ifaddr)) {
$ifscope = get_ll_scope($ifaddr);
+ }
} else {
$ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ip($sourceip);
}
if ($ifaddr && (is_ipaddr($host) || is_hostname($host))) {
$srcip = "-S" . escapeshellarg($ifaddr);
- if (is_linklocal($host) && !strstr($host, "%") && !empty($ifscope))
+ if (is_linklocal($host) && !strstr($host, "%") && !empty($ifscope)) {
$host .= "%{$ifscope}";
+ }
}
$cmd = "{$command} {$srcip} -c" . escapeshellarg($count) . " " . escapeshellarg($host);
//echo "Ping command: {$cmd}\n";
$result = shell_exec($cmd);
- if (empty($result))
+ if (empty($result)) {
$input_errors[] = "Host \"" . $host . "\" did not respond or could not be resolved.";
+ }
}
include('head.inc');
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
$form = new Form('Ping');
diff --git a/src/usr/local/www/reboot.php b/src/usr/local/www/diag_reboot.php
index 77642fb..f8f3a4e 100755
--- a/src/usr/local/www/reboot.php
+++ b/src/usr/local/www/diag_reboot.php
@@ -1,6 +1,6 @@
<?php
/*
- reboot.php
+ diag_reboot.php
*/
/* ====================================================================
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
@@ -60,7 +60,7 @@
##|*IDENT=page-diagnostics-rebootsystem
##|*NAME=Diagnostics: Reboot System
##|*DESCR=Allow access to the 'Diagnostics: Reboot System' page.
-##|*MATCH=reboot.php*
+##|*MATCH=diag_reboot.php*
##|-PRIV
// Set DEBUG to true to prevent the system_reboot() function from being called
@@ -73,15 +73,14 @@ require("captiveportal.inc");
$guitimeout = 90; // Seconds to wait before reloading the page after reboot
$guiretry = 20; // Seconds to try again if $guitimeout was not long enough
-$pgtitle = array(gettext("Diagnostics"),gettext("Reboot System"));
+$pgtitle = array(gettext("Diagnostics"), gettext("Reboot System"));
include("head.inc");
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
- if(DEBUG) {
+ if (DEBUG) {
print_info_box("Not actually rebooting (DEBUG is set true)", success);
- }
- else {
+ } else {
print('<div><pre>');
system_reboot();
print('</pre></div>');
@@ -93,7 +92,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
+events.push(function() {
var timeoutmsg = '<h4>Rebooting<br />Page will automatically reload in ';
var time = 0;
@@ -109,8 +108,8 @@ events.push(function(){
}
function startCountdown() {
- setInterval(function(){
- if(time > 0) {
+ setInterval(function() {
+ if (time > 0) {
$('#countdown').html(timeoutmsg + time + ' seconds.</h4>');
time--;
} else {
@@ -137,7 +136,7 @@ events.push(function(){
<div class="panel-body">
<div class="content">
<p>Click "Reboot" to reboot the system immediately, or "No" to go to the system dashboard without rebooting. (There will be a brief delay before the dashboard appears.)</p>
- <form action="reboot.php" method="post">
+ <form action="diag_reboot.php" method="post">
<input type="submit" class="btn btn-danger pull-center" name="Submit" value="Reboot">
<a href="/" class="btn btn-default">No</a>
</form>
diff --git a/src/usr/local/www/diag_resetstate.php b/src/usr/local/www/diag_resetstate.php
index 494e842..a5edd4d 100644
--- a/src/usr/local/www/diag_resetstate.php
+++ b/src/usr/local/www/diag_resetstate.php
@@ -93,11 +93,13 @@ if ($_POST) {
$pgtitle = array(gettext("Diagnostics"), gettext("Reset state"));
include("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg, 'alert-success');
+}
$statetablehelp = 'Resetting the state tables will remove all entries from the corresponding tables. This means that all open connections ' .
'will be broken and will have to be re-established. This may be necessary after making substantial changes to the ' .
@@ -117,8 +119,9 @@ $sourcetablehelp = 'Resetting the source tracking table will remove all source/d
$tab_array = array();
$tab_array[] = array(gettext("States"), false, "diag_dump_states.php");
-if (isset($config['system']['lb_use_sticky']))
+if (isset($config['system']['lb_use_sticky'])) {
$tab_array[] = array(gettext("Source Tracking"), false, "diag_dump_states_sources.php");
+}
$tab_array[] = array(gettext("Reset States"), true, "diag_resetstate.php");
display_top_tabs($tab_array);
diff --git a/src/usr/local/www/diag_routes.php b/src/usr/local/www/diag_routes.php
index 58c4924..e02bafa 100644
--- a/src/usr/local/www/diag_routes.php
+++ b/src/usr/local/www/diag_routes.php
@@ -161,29 +161,33 @@ function update_routes_callback(html) {
for (var i = 0; i < responseTextArr.length; i++) {
- if (responseTextArr[i] == "")
+ if (responseTextArr[i] == "") {
continue;
+ }
- if (i == 0)
+ if (i == 0) {
var tmp = '';
- else
+ } else {
var tmp = '<tr>';
+ }
var j = 0;
var entry = responseTextArr[i].split(" ");
for (var k = 0; k < entry.length; k++) {
- if (entry[k] == "")
+ if (entry[k] == "") {
continue;
- if (i == 0)
+ }
+ if (i == 0) {
tmp += '<th>' + entry[k] + '<\/th>';
- else
+ } else {
tmp += '<td>' + entry[k] + '<\/td>';
+ }
j++;
}
- if (i == 0)
+ if (i == 0) {
thead += tmp;
- else {
+ } else {
tmp += '<td><\/td>'
tbody += tmp;
}
@@ -198,11 +202,11 @@ function update_all_routes() {
update_routes("IPv6");
}
-events.push(function(){
+events.push(function() {
setInterval('update_all_routes()', 5000);
update_all_routes();
- $(document.forms[0]).on('submit', function(e){
+ $(document.forms[0]).on('submit', function(e) {
update_all_routes();
e.preventDefault();
diff --git a/src/usr/local/www/diag_smart.php b/src/usr/local/www/diag_smart.php
index f4ca880..7793c35 100644
--- a/src/usr/local/www/diag_smart.php
+++ b/src/usr/local/www/diag_smart.php
@@ -76,8 +76,7 @@ $closehead = false;
include("head.inc");
// Highlights the words "PASSED", "FAILED", and "WARNING".
-function add_colors($string)
-{
+function add_colors($string) {
// To add words keep arrays matched by numbers
$patterns[0] = '/PASSED/';
$patterns[1] = '/FAILED/';
@@ -230,9 +229,7 @@ switch ($action) {
smartmonctl("stop");
smartmonctl("start");
$style = 'warning';
- }
- else if (isset($_POST['save']))
- {
+ } else if (isset($_POST['save'])) {
$config['system']['smartmonemail'] = $_POST['smartmonemail'];
write_config();
@@ -242,8 +239,7 @@ switch ($action) {
if (stristr($retval, "error") != true) {
$savemsg = get_std_save_message($retval);
$style = 'success';
- }
- else {
+ } else {
$savemsg = $retval;
$style='danger';
}
@@ -258,8 +254,9 @@ switch ($action) {
}
// Was the config changed? if so, print the message
- if ($savemsg)
+ if ($savemsg) {
print_info_box($savemsg, $style);
+ }
// Get users email from the xml file
$pconfig['smartmonemail'] = $config['system']['smartmonemail'];
diff --git a/src/usr/local/www/diag_sockets.php b/src/usr/local/www/diag_sockets.php
index 3a7d6e1..5cad1ac 100644
--- a/src/usr/local/www/diag_sockets.php
+++ b/src/usr/local/www/diag_sockets.php
@@ -100,26 +100,27 @@ $showAllOption = $showAll ? "" : "?showAll";
<thead>
<?php
foreach (explode("\n", $table) as $i => $line) {
- if (trim($line) == "")
+ if (trim($line) == "") {
continue;
+ }
$j = 0;
print("<tr>\n");
foreach (explode(' ', $line) as $entry) {
- if ($entry == '' || $entry == "ADDRESS")
+ if ($entry == '' || $entry == "ADDRESS") {
continue;
+ }
if ($i == 0) {
print("<th class=\"$class\">$entry</th>\n");
- }
- else {
+ } else {
print("<td class=\"$class\">$entry</td>\n");
}
$j++;
}
print("</tr>\n");
- if($i == 0) {
+ if ($i == 0) {
print("</thead>\n");
print("<tbody>\n");
}
diff --git a/src/usr/local/www/diag_states_summary.php b/src/usr/local/www/diag_states_summary.php
index 47142b5..ef6b612 100644
--- a/src/usr/local/www/diag_states_summary.php
+++ b/src/usr/local/www/diag_states_summary.php
@@ -167,10 +167,10 @@ function build_port_info($portarr, $proto) {
return implode($ports, ', ');
}
-function print_summary_table($label, $iparr, $sort = TRUE)
-{
- if ($sort)
+function print_summary_table($label, $iparr, $sort = TRUE) {
+ if ($sort) {
uksort($iparr, "sort_by_ip");
+ }
?>
<div class="panel panel-default">
@@ -196,8 +196,9 @@ function print_summary_table($label, $iparr, $sort = TRUE)
$rowSpan = '';
$i = 0;
- if ($protocolCount > 1)
+ if ($protocolCount > 1) {
$rowSpan = ' rowspan="' . $protocolCount . '"';
+ }
?>
<tr>
<td<?= $rowSpan ?>><?php echo $ip; ?></td>
diff --git a/src/usr/local/www/diag_system_activity.php b/src/usr/local/www/diag_system_activity.php
index 810c39a..76c5c17 100644
--- a/src/usr/local/www/diag_system_activity.php
+++ b/src/usr/local/www/diag_system_activity.php
@@ -77,8 +77,9 @@ if ($_REQUEST['getactivity']) {
include("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
?>
<script type="text/javascript">
@@ -99,7 +100,7 @@ function getcpuactivity() {
);
}
-events.push(function(){
+events.push(function() {
setInterval('getcpuactivity()', 2500);
getcpuactivity();
});
diff --git a/src/usr/local/www/diag_tables.php b/src/usr/local/www/diag_tables.php
index 5fb0eba..c351701 100644
--- a/src/usr/local/www/diag_tables.php
+++ b/src/usr/local/www/diag_tables.php
@@ -105,15 +105,18 @@ if (($tablename == "bogons") || ($tablename == "bogonsv6")) {
$loading = true;
while ($loading == true) {
$isrunning = `/bin/ps awwwux | /usr/bin/grep -v grep | /usr/bin/grep bogons`;
- if ($isrunning == "")
+ if ($isrunning == "") {
$loading = false;
+ }
$maxtimetowait++;
- if ($maxtimetowait > 89)
+ if ($maxtimetowait > 89) {
$loading = false;
+ }
sleep(1);
}
- if ($maxtimetowait < 90)
+ if ($maxtimetowait < 90) {
$savemsg = gettext("The bogons database has been updated.");
+ }
}
}
@@ -122,8 +125,9 @@ exec("/sbin/pfctl -sT", $tables);
include("head.inc");
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg);
+}
$form = new Form('Show');
@@ -142,8 +146,8 @@ print $form;
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
- $('a[data-entry]').on('click', function(){
+events.push(function() {
+ $('a[data-entry]').on('click', function() {
var el = $(this);
$.ajax(
@@ -154,7 +158,7 @@ events.push(function(){
type: '<?=htmlspecialchars($tablename)?>',
delete: $(this).data('entry')
},
- success: function(){
+ success: function() {
el.parents('tr').remove();
},
});
diff --git a/src/usr/local/www/diag_testport.php b/src/usr/local/www/diag_testport.php
index c009929..3b495e3 100644
--- a/src/usr/local/www/diag_testport.php
+++ b/src/usr/local/www/diag_testport.php
@@ -124,7 +124,7 @@ if ($_POST || $_REQUEST['host']) {
?>
<script type="text/javascript">
//<![CDATA[
- window.onload=function(){
+ window.onload=function() {
document.getElementById("testportCaptured").wrap='off';
}
//]]>
@@ -134,10 +134,12 @@ if ($_POST || $_REQUEST['host']) {
$ncoutput = "";
$nc_base_cmd = '/usr/bin/nc';
$nc_args = "-w " . escapeshellarg($timeout);
- if (!$showtext)
+ if (!$showtext) {
$nc_args .= ' -z ';
- if (!empty($srcport))
+ }
+ if (!empty($srcport)) {
$nc_args .= ' -p ' . escapeshellarg($srcport) . ' ';
+ }
/* Attempt to determine the interface address, if possible. Else try both. */
if (is_ipaddrv4($host)) {
@@ -152,12 +154,13 @@ if ($_POST || $_REQUEST['host']) {
}
$nc_args .= ' -4';
} elseif (is_ipaddrv6($host)) {
- if ($sourceip == "any")
+ if ($sourceip == "any") {
$ifaddr = '';
- else if (is_linklocal($sourceip))
+ } else if (is_linklocal($sourceip)) {
$ifaddr = $sourceip;
- else
+ } else {
$ifaddr = get_interface_ipv6($sourceip);
+ }
$nc_args .= ' -6';
} else {
switch ($ipprotocol) {
@@ -197,8 +200,9 @@ if ($_POST || $_REQUEST['host']) {
if (!empty($ifaddr)) {
$nc_args .= ' -s ' . escapeshellarg($ifaddr) . ' ';
$scope = get_ll_scope($ifaddr);
- if (!empty($scope) && !strstr($host, "%"))
+ if (!empty($scope) && !strstr($host, "%")) {
$host .= "%{$scope}";
+ }
}
$nc_cmd = "{$nc_base_cmd} {$nc_args} " . escapeshellarg($host) . ' ' . escapeshellarg($port) . ' 2>&1';
@@ -220,9 +224,9 @@ if ($_POST || $_REQUEST['host']) {
include("head.inc");
// Handle the display of all messages here where the user can readily see them
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
-else {
+} else {
// New page
if (empty($result) && $retval != 0 && !$showtext) {
print('<div class="alert alert-warning" role="alert">This page allows you to perform a simple TCP connection test to determine if a host is up and accepting connections on a given port.' .
@@ -231,18 +235,21 @@ else {
// Good host & port
if ($retval == 0 && $do_testport == 1) {
- if (!$showtext)
+ if (!$showtext) {
print('<div class="alert alert-success" role="alert">'.gettext("Port test to host: " . $host . " Port: " . $port . " successful").'</div>');
- else
+ } else {
print('<div class="alert alert-success" role="alert">'.gettext("Port test to host: " . $host . " Port: " . $port . " successful") . '. Any text received from the host will be shown below the form.</div>');
+ }
}
// netcat exit value != 0
- if ($retval != 0 && !empty($result))
- if ($showtext)
+ if ($retval != 0 && !empty($result)) {
+ if ($showtext) {
print('<div class="alert alert-danger" role="alert">'.gettext('No output received, or connection failed. Try with "Show Remote Text" unchecked first.').'</div>');
- else
+ } else {
print('<div class="alert alert-danger" role="alert">'.gettext('Connection failed.').'</div>');
+ }
+ }
}
$form = new Form('Test');
diff --git a/src/usr/local/www/diag_traceroute.php b/src/usr/local/www/diag_traceroute.php
index ad614a9..10a6a4b 100644
--- a/src/usr/local/www/diag_traceroute.php
+++ b/src/usr/local/www/diag_traceroute.php
@@ -90,8 +90,9 @@ function create_sourceaddresslist() {
$sourceips = get_possible_traffic_source_addresses(true);
- foreach ($sourceips as $sipvalue => $sipname)
+ foreach ($sourceips as $sipvalue => $sipname) {
$list[$sipvalue] = $sipname;
+ }
return($list);
}
@@ -135,8 +136,9 @@ if ($_POST || $_REQUEST['host']) {
$useicmp = false;
}
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
$form = new Form('Traceroute');
@@ -212,10 +214,11 @@ if (!$input_errors && $do_traceroute) {
<div class="panel-heading"><h2 class="panel-title">Results</h2></div>
<div class="panel-body">
<?php
- if ($result = shell_exec($cmd))
+ if ($result = shell_exec($cmd)) {
print(nl2br($result));
- else
+ } else {
print('Error: ' . $host . ' ' . gettext("could not be traced/resolved"));
+ }
?>
</div>
</div>
diff --git a/src/usr/local/www/easyrule.php b/src/usr/local/www/easyrule.php
index bb62f38..575ddf8 100644
--- a/src/usr/local/www/easyrule.php
+++ b/src/usr/local/www/easyrule.php
@@ -92,14 +92,15 @@ if (stristr($retval, "error") == true) {
include("head.inc"); ?>
-include("fbegin.inc");
+include("fbegin.inc");
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
-<?php
-if ($input_errors)
+<?php
+if ($input_errors) {
print_input_errors($input_errors);
+}
if ($message) { ?>
<br />
@@ -109,7 +110,7 @@ if ($message) { ?>
<?=gettext("This is the Easy Rule status page, mainly used to display errors when adding rules. " .
"If you are seeing this, there apparently was not an error, and you navigated to the " .
"page directly without telling it what to do"); ?>.<br /><br />
-<?=gettext("This page is meant to be called from the block/pass buttons on the Firewall Logs page"); ?>, <a href="diag_logs_filter.php"><?=gettext("Status"); ?> &gt; <?=gettext("System Logs, " .
+<?=gettext("This page is meant to be called from the block/pass buttons on the Firewall Logs page"); ?>, <a href="status_logs_filter.php"><?=gettext("Status"); ?> &gt; <?=gettext("System Logs, " .
"Firewall Tab"); ?></a>.
<br />
<?php } ?>
diff --git a/src/usr/local/www/edit.php b/src/usr/local/www/edit.php
index f4ecde7..29e073b 100644
--- a/src/usr/local/www/edit.php
+++ b/src/usr/local/www/edit.php
@@ -138,7 +138,7 @@ require("head.inc");
<div style="background:#eeeeee;" id="fileOutput">
<script type="text/javascript">
//<![CDATA[
- window.onload=function(){
+ window.onload=function() {
document.getElementById("fileContent").wrap='off';
}
//]]>
@@ -173,8 +173,7 @@ require("head.inc");
var fileContent = window.atob(values.join("|"));
jQuery("#fileContent").val(fileContent);
- }
- else {
+ } else {
jQuery("#fileStatus").html(values[0]);
jQuery("#fileContent").val("");
}
@@ -296,12 +295,10 @@ var Base64 = {
if (c < 128) {
utftext += String.fromCharCode(c);
- }
- else if((c > 127) && (c < 2048)) {
+ } else if ((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
- }
- else {
+ } else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
@@ -318,20 +315,18 @@ var Base64 = {
var i = 0;
var c = c1 = c2 = 0;
- while ( i < utftext.length ) {
+ while (i < utftext.length) {
c = utftext.charCodeAt(i);
if (c < 128) {
string += String.fromCharCode(c);
i++;
- }
- else if((c > 191) && (c < 224)) {
+ } else if ((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i+1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
- }
- else {
+ } else {
c2 = utftext.charCodeAt(i+1);
c3 = utftext.charCodeAt(i+2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
diff --git a/src/usr/local/www/exec.php b/src/usr/local/www/exec.php
index 3205da3..a36053c 100644
--- a/src/usr/local/www/exec.php
+++ b/src/usr/local/www/exec.php
@@ -221,8 +221,9 @@ if (isBlank($_POST['txtRecallBuffer'])) {
</script>
<?php
-if (isBlank($_POST['txtCommand']) && isBlank($_POST['txtPHPCommand']) && isBlank($ulmsg))
+if (isBlank($_POST['txtCommand']) && isBlank($_POST['txtPHPCommand']) && isBlank($ulmsg)) {
print('<div class="alert alert-warning" role="alert">'.gettext("The capabilities offered here can be dangerous. No support is available. Use them at your own risk!").'</div>');
+}
if (!isBlank($_POST['txtCommand'])):?>
<div class="panel panel-success responsive">
@@ -235,8 +236,9 @@ if (!isBlank($_POST['txtCommand'])):?>
putenv("SCRIPT_FILENAME=" . strtok($_POST['txtCommand'], " "));
$output = array();
exec($_POST['txtCommand'] . ' 2>&1', $output);
- foreach($output as $line)
+ foreach ($output as $line) {
print(htmlspecialchars($line) . "\r\n");
+ }
?>
</pre>
</div>
@@ -272,8 +274,9 @@ if (!isBlank($_POST['txtCommand'])):?>
</div>
<?php
- if ($ulmsg)
+ if ($ulmsg) {
print('<div class="alert alert-success" role="alert">' . $ulmsg .'</div>');
+ }
?>
<div class="panel panel-default">
<div class="panel-heading"><h2 class="panel-title"><?=gettext('Upload file')?></h2></div>
@@ -314,7 +317,7 @@ if (!isBlank($_POST['txtCommand'])):?>
?>
<script type="text/javascript">
//<![CDATA[
- events.push(function(){
+ events.push(function() {
// Scroll to the bottom of the page to more easily see the results of a PHP exec command
$("html, body").animate({ scrollTop: $(document).height() }, 1000);
});
@@ -339,5 +342,6 @@ if (!isBlank($_POST['txtCommand'])):?>
<?php
include("foot.inc");
-if($_POST)
+if ($_POST) {
conf_mount_ro();
+}
diff --git a/src/usr/local/www/firewall_aliases.php b/src/usr/local/www/firewall_aliases.php
index c5f6acc..6df3ad2 100644
--- a/src/usr/local/www/firewall_aliases.php
+++ b/src/usr/local/www/firewall_aliases.php
@@ -191,7 +191,7 @@ $tab_array[] = array(gettext("URLs"), ($tab == "url"? true : false), "/firewall
$tab_array[] = array(gettext("All"), ($tab == "all"? true : false), "/firewall_aliases.php?tab=all");
foreach ($tab_array as $dtab) {
- if($dtab[1] == true) {
+ if ($dtab[1] == true) {
$bctab = $dtab[0];
break;
}
@@ -202,11 +202,13 @@ $shortcut_section = "aliases";
include("head.inc");
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg, 'success');
+}
-if (is_subsystem_dirty('aliases'))
+if (is_subsystem_dirty('aliases')) {
print_info_box_np(gettext("The alias list has been changed.") . "<br />" . gettext("You must apply the changes in order for them to take effect."));
+}
display_top_tabs($tab_array);
@@ -234,16 +236,19 @@ display_top_tabs($tab_array);
case "ip":
case "host":
case "network":
- if (preg_match("/(host|network)/", $alias["type"]))
+ if (preg_match("/(host|network)/", $alias["type"])) {
$show_alias= true;
+ }
break;
case "url":
- if (preg_match("/(url)/i", $alias["type"]))
+ if (preg_match("/(url)/i", $alias["type"])) {
$show_alias= true;
+ }
break;
case "port":
- if ($alias["type"] == "port")
+ if ($alias["type"] == "port") {
$show_alias= true;
+ }
break;
}
if ($show_alias):
@@ -303,7 +308,7 @@ display_top_tabs($tab_array);
That way jQuery (in pfenseHelpers.js) will automatically take care of the display. -->
<div>
<div id="infoblock">
- <?=print_info_box(gettext( 'Aliases act as placeholders for real hosts, networks or ports. They can be used to minimize the number ' .
+ <?=print_info_box(gettext('Aliases act as placeholders for real hosts, networks or ports. They can be used to minimize the number ' .
'of changes that have to be made if a host, network or port changes. <br />' .
'You can enter the name of an alias instead of the host, network or port where indicated. The alias will be resolved according to the list above.' . '<br />' .
'If an alias cannot be resolved (e.g. because you deleted it), the corresponding element (e.g. filter/NAT/shaper rule) will be considered invalid and skipped.'), info)?>
diff --git a/src/usr/local/www/firewall_aliases_edit.php b/src/usr/local/www/firewall_aliases_edit.php
index 3f2563b..0adc184 100755
--- a/src/usr/local/www/firewall_aliases_edit.php
+++ b/src/usr/local/www/firewall_aliases_edit.php
@@ -116,7 +116,7 @@ function alias_same_type($name, $type) {
foreach ($config['aliases']['alias'] as $alias) {
if ($name == $alias['name']) {
if (in_array($type, array("host", "network")) &&
- in_array($alias['type'], array("host", "network"))) {
+ in_array($alias['type'], array("host", "network"))) {
return true;
}
@@ -426,7 +426,7 @@ if ($_POST) {
if (!alias_same_type($input_address, $_POST['type'])) {
// But alias type network can include alias type urltable. Feature#1603.
if (!($_POST['type'] == 'network' &&
- preg_match("/urltable/i", alias_get_type($input_address)))) {
+ preg_match("/urltable/i", alias_get_type($input_address)))) {
$wrongaliases .= " " . $input_address;
}
}
@@ -436,7 +436,7 @@ if ($_POST) {
}
} else if ($_POST['type'] == "host" || $_POST['type'] == "network") {
if (is_subnet($input_address) ||
- (!is_ipaddr($input_address) && !is_hostname($input_address))) {
+ (!is_ipaddr($input_address) && !is_hostname($input_address))) {
$input_errors[] = sprintf(gettext('%1$s is not a valid %2$s address, FQDN or alias.'), $input_address, $_POST['type']);
}
}
@@ -606,16 +606,18 @@ $types = array(
);
if (empty($tab)) {
- if (preg_match("/url/i", $pconfig['type']))
+ if (preg_match("/url/i", $pconfig['type'])) {
$tab = 'url';
- else if ($pconfig['type'] == 'host')
+ } else if ($pconfig['type'] == 'host') {
$tab = 'ip';
- else
+ } else {
$tab = $pconfig['type'];
+ }
}
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
$form = new Form;
@@ -627,21 +629,13 @@ $form->addGlobal(new Form_Input(
));
$form->addGlobal(new Form_Input(
- 'tab',
- null,
- 'hidden',
- $tab
-));
-
-$form->addGlobal(new Form_Input(
'origname',
null,
'hidden',
$pconfig['name']
));
-if (isset($id) && $a_aliases[$id])
-{
+if (isset($id) && $a_aliases[$id]) {
$form->addGlobal(new Form_Input(
'id',
null,
@@ -739,7 +733,9 @@ print $form;
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
+addressarray = <?= json_encode(array_exclude($pconfig['name'], get_alias_list($pconfig['type']))) ?>;
+
+events.push(function() {
var disable_subnets;
@@ -769,7 +765,7 @@ events.push(function(){
hideRowsAfter(1, (tab == 'urltable') || (tab == 'urltable_ports'));
// The add button and delete buttons must not show on URL Table IP or URL table ports
- if((tab == 'urltable') || (tab == 'urltable_ports')) {
+ if ((tab == 'urltable') || (tab == 'urltable_ports')) {
hideClass('addbtn', true);
$('[id^=deleterow]').hide();
} else {
@@ -783,7 +779,7 @@ events.push(function(){
var idx = 0;
$('.repeatable').each(function(el) {
- if ( idx >= row ) {
+ if (idx >= row) {
hideRow(idx, hide);
}
@@ -812,10 +808,12 @@ events.push(function(){
checkLastRow();
// Autocomplete
- var addressarray = <?= json_encode(array_exclude($pconfig['name'], get_alias_list($pconfig['type']))) ?>;
-
- $('[id^=address]').autocomplete({
- source: addressarray
+ $('[id^=address]').each(function() {
+ if (this.id.substring(0, 8) != "address_") {
+ $(this).autocomplete({
+ source: addressarray
+ });
+ }
});
// on click . .
diff --git a/src/usr/local/www/firewall_aliases_import.php b/src/usr/local/www/firewall_aliases_import.php
index f44c92f..a263208 100755
--- a/src/usr/local/www/firewall_aliases_import.php
+++ b/src/usr/local/www/firewall_aliases_import.php
@@ -191,8 +191,9 @@ if ($_POST['aliasimport'] != "") {
include("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
$form = new Form;
$section = new Form_Section('Alias details');
diff --git a/src/usr/local/www/firewall_nat.php b/src/usr/local/www/firewall_nat.php
index c67c3cc..6c856a5 100644
--- a/src/usr/local/www/firewall_nat.php
+++ b/src/usr/local/www/firewall_nat.php
@@ -79,18 +79,20 @@ if (!is_array($config['nat']['rule'])) {
$a_nat = &$config['nat']['rule'];
/* update rule order, POST[rule] is an array of ordered IDs */
-if(array_key_exists('order-store', $_POST)) {
+if (array_key_exists('order-store', $_POST)) {
if (is_array($_POST['rule']) && !empty($_POST['rule'])) {
$a_nat_new = array();
// if a rule is not in POST[rule], it has been deleted by the user
- foreach ($_POST['rule'] as $id)
+ foreach ($_POST['rule'] as $id) {
$a_nat_new[] = $a_nat[$id];
+ }
$a_nat = $a_nat_new;
- if (write_config())
+ if (write_config()) {
mark_subsystem_dirty('filter');
+ }
header("Location: firewall_nat.php");
exit;
@@ -171,12 +173,14 @@ $closehead = false;
$pgtitle = array(gettext("Firewall"), gettext("NAT"), gettext("Port Forward"));
include("head.inc");
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg, 'success');
+}
-if (is_subsystem_dirty('natconf'))
+if (is_subsystem_dirty('natconf')) {
print_info_box_np(gettext('The NAT configuration has been changed.') . '<br />' .
gettext('You must apply the changes in order for them to take effect.') . '<br />');
+}
$tab_array = array();
$tab_array[] = array(gettext("Port Forward"), true, "firewall_nat.php");
@@ -222,8 +226,9 @@ foreach ($a_nat as $natent):
);
/* if user does not have access to edit an interface skip on to the next record */
- if (!have_natpfruleint_access($natent['interface']))
+ if (!have_natpfruleint_access($natent['interface'])) {
continue;
+ }
?>
<tr id="fr<?=$nnats;?>" onClick="fr_toggle(<?=$nnats;?>)" ondblclick="document.location='firewall_nat_edit.php?id=<?=$i;?>';">
@@ -246,10 +251,11 @@ foreach ($a_nat as $natent):
<td>
<?=$textss?>
<?php
- if (!$natent['interface'])
+ if (!$natent['interface']) {
echo htmlspecialchars(convert_friendly_interface_to_friendly_descr("wan"));
- else
+ } else {
echo htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface']));
+ }
?>
<?=$textse?>
</td>
@@ -353,7 +359,7 @@ foreach ($a_nat as $natent):
<td>
<a class="fa fa-pencil" title="<?=gettext("Edit rule"); ?>" href="firewall_nat_edit.php?id=<?=$i?>"></a>
<a class="fa fa-clone" title="<?=gettext("Add a new NAT based on this one")?>" href="firewall_nat_edit.php?dup=<?=$i?>"></a>
- <a class="fa fa-trash" title="<?=gettext("Delete rule")?>" href="firewall_nat.php?act=del&amp;id=<?=$i?>" onclick="return confirm('<?=gettext("Are you sure you want to delete this rule?")?>')"></a>
+ <a class="fa fa-trash" title="<?=gettext("Delete rule")?>" href="firewall_nat.php?act=del&amp;id=<?=$i?>"></a>
</td>
</tr>
<?php
diff --git a/src/usr/local/www/firewall_nat_1to1.php b/src/usr/local/www/firewall_nat_1to1.php
index a2213b8..0995cb8 100644
--- a/src/usr/local/www/firewall_nat_1to1.php
+++ b/src/usr/local/www/firewall_nat_1to1.php
@@ -78,18 +78,20 @@ if (!is_array($config['nat']['onetoone'])) {
$a_1to1 = &$config['nat']['onetoone'];
/* update rule order, POST[rule] is an array of ordered IDs */
-if($_POST['order-store']) {
+if ($_POST['order-store']) {
if (is_array($_POST['rule']) && !empty($_POST['rule'])) {
$a_1to1_new = array();
// if a rule is not in POST[rule], it has been deleted by the user
- foreach ($_POST['rule'] as $id)
+ foreach ($_POST['rule'] as $id) {
$a_1to1_new[] = $a_1to1[$id];
+ }
$a_1to1 = $a_1to1_new;
- if (write_config())
+ if (write_config()) {
mark_subsystem_dirty('natconf');
+ }
header("Location: firewall_nat_1to1.php");
exit;
@@ -156,12 +158,14 @@ if (isset($_POST['del_x'])) {
$pgtitle = array(gettext("Firewall"), gettext("NAT"), gettext("1:1"));
include("head.inc");
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg, 'success');
+}
-if (is_subsystem_dirty('natconf'))
+if (is_subsystem_dirty('natconf')) {
print_info_box_np(gettext('The NAT configuration has been changed.') . '<br />' .
gettext('You must apply the changes in order for them to take effect.') . '<br />');
+}
$tab_array = array();
$tab_array[] = array(gettext("Port Forward"), false, "firewall_nat.php");
diff --git a/src/usr/local/www/firewall_nat_1to1_edit.php b/src/usr/local/www/firewall_nat_1to1_edit.php
index 8788280..4b4d960 100644
--- a/src/usr/local/www/firewall_nat_1to1_edit.php
+++ b/src/usr/local/www/firewall_nat_1to1_edit.php
@@ -143,8 +143,9 @@ if ($_POST) {
$temp = str_replace(">", "", $value);
$newpost = htmlentities($temp);
- if ($newpost != $temp)
+ if ($newpost != $temp) {
$input_errors[] = sprintf(gettext("Invalid characters detected (%s). Please remove invalid characters and save again."), $temp);
+ }
}
/* input validation */
@@ -283,11 +284,13 @@ function build_srctype_list() {
$sel = is_specialnet($pconfig['src']);
- if (have_ruleint_access("pppoe"))
+ if (have_ruleint_access("pppoe")) {
$list['pppoe'] = 'PPPoE clients';
+ }
- if (have_ruleint_access("l2tp"))
+ if (have_ruleint_access("l2tp")) {
$list['l2tp'] = 'L2TP clients';
+ }
foreach ($ifdisp as $ifent => $ifdesc) {
if (have_ruleint_access($ifent)) {
@@ -305,8 +308,9 @@ function srctype_selected() {
$sel = is_specialnet($pconfig['src']);
if (!$sel) {
- if (($pconfig['srcmask'] == 32) || (!isset($pconfig['srcmask'])))
+ if (($pconfig['srcmask'] == 32) || (!isset($pconfig['srcmask']))) {
return('single');
+ }
return('network');
}
@@ -320,11 +324,13 @@ function build_dsttype_list() {
$sel = is_specialnet($pconfig['dst']);
$list = array('any' => 'Any', 'single' => 'Single host or alias', 'network' => 'Network', '(self)' => 'This Firewall (self)');
- if (have_ruleint_access("pppoe"))
+ if (have_ruleint_access("pppoe")) {
$list['pppoe'] = 'PPPoE clients';
+ }
- if (have_ruleint_access("l2tp"))
+ if (have_ruleint_access("l2tp")) {
$list['l2tp'] = 'L2TP clients';
+ }
foreach ($ifdisp as $if => $ifdesc) {
if (have_ruleint_access($if)) {
@@ -335,8 +341,9 @@ function build_dsttype_list() {
if (is_array($config['virtualip']['vip'])) {
foreach ($config['virtualip']['vip'] as $sn) {
- if (isset($sn['noexpand']))
+ if (isset($sn['noexpand'])) {
continue;
+ }
if ($sn['mode'] == "proxyarp" && $sn['type'] == "network") {
$start = ip2long32(gen_subnet($sn['subnet'], $sn['subnet_bits']));
@@ -362,12 +369,14 @@ function dsttype_selected() {
$sel = is_specialnet($pconfig['dst']);
- if (empty($pconfig['dst'] || $pconfig['dst'] == "any"))
+ if (empty($pconfig['dst'] || $pconfig['dst'] == "any")) {
return('any');
+ }
if (!$sel) {
- if ($pconfig['dstmask'] == 32)
+ if ($pconfig['dstmask'] == 32) {
return('single');
+ }
return('network');
}
@@ -375,8 +384,9 @@ function dsttype_selected() {
return($pconfig['dst']);
}
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
$form = new Form(new Form_Button(
'Submit',
@@ -394,24 +404,31 @@ $section->addInput(new Form_Checkbox(
$iflist = get_configured_interface_with_descr(false, true);
-foreach ($iflist as $if => $ifdesc)
- if (have_ruleint_access($if))
+foreach ($iflist as $if => $ifdesc) {
+ if (have_ruleint_access($if)) {
$interfaces[$if] = $ifdesc;
+ }
+}
-if ($config['l2tp']['mode'] == "server")
- if (have_ruleint_access("l2tp"))
+if ($config['l2tp']['mode'] == "server") {
+ if (have_ruleint_access("l2tp")) {
$interfaces['l2tp'] = "L2TP VPN";
+ }
+}
-if (is_pppoe_server_enabled() && have_ruleint_access("pppoe"))
+if (is_pppoe_server_enabled() && have_ruleint_access("pppoe")) {
$interfaces['pppoe'] = "PPPoE Server";
+}
/* add ipsec interfaces */
-if (ipsec_enabled() && have_ruleint_access("enc0"))
+if (ipsec_enabled() && have_ruleint_access("enc0")) {
$interfaces["enc0"] = "IPsec";
+}
/* add openvpn/tun interfaces */
-if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"])
+if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) {
$interfaces["openvpn"] = "OpenVPN";
+}
$section->addInput(new Form_Select(
'interface',
@@ -460,7 +477,7 @@ $group->add(new Form_Checkbox(
'dstnot',
null,
'Not',
- $pconfig['srcnot']
+ $pconfig['dstnot']
))->setHelp('Invert the sense of the match.');
$group->add(new Form_Select(
@@ -505,7 +522,7 @@ print($form);
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
+events.push(function() {
// Disables the specified input element
function disableInput(id, disable) {
diff --git a/src/usr/local/www/firewall_nat_edit.php b/src/usr/local/www/firewall_nat_edit.php
index 6cbf9ea..fa2842e 100644
--- a/src/usr/local/www/firewall_nat_edit.php
+++ b/src/usr/local/www/firewall_nat_edit.php
@@ -158,8 +158,9 @@ unset($input_errors);
foreach ($_POST as $key => $value) {
$temp = $value;
$newpost = htmlentities($temp);
- if ($newpost != $temp)
+ if ($newpost != $temp) {
$input_errors[] = sprintf(gettext("Invalid characters detected %s. Please remove invalid characters and save again."), $temp);
+ }
}
if ($_POST) {
@@ -310,7 +311,7 @@ if ($_POST) {
/* if user enters an alias and selects "network" then disallow. */
if (($_POST['srctype'] == "network" && is_alias($_POST['src'])) ||
- ($_POST['dsttype'] == "network" && is_alias($_POST['dst']))) {
+ ($_POST['dsttype'] == "network" && is_alias($_POST['dst']))) {
$input_errors[] = gettext("You must specify single host or alias for alias entries.");
}
@@ -373,7 +374,7 @@ if ($_POST) {
}
if (!((($_POST['dstbeginport'] < $begp) && ($_POST['dstendport'] < $begp)) ||
- (($_POST['dstbeginport'] > $endp) && ($_POST['dstendport'] > $endp)))) {
+ (($_POST['dstbeginport'] > $endp) && ($_POST['dstendport'] > $endp)))) {
$input_errors[] = gettext("The destination port range overlaps with an existing entry.");
break;
}
@@ -446,8 +447,8 @@ if ($_POST) {
}
// If creating a new rule, where we want to add the filter rule, associated or not
else if (isset($_POST['filter-rule-association']) &&
- ($_POST['filter-rule-association'] == 'add-associated' ||
- $_POST['filter-rule-association'] == 'add-unassociated')) {
+ ($_POST['filter-rule-association'] == 'add-associated' ||
+ $_POST['filter-rule-association'] == 'add-unassociated')) {
$need_filter_rule = true;
}
@@ -531,17 +532,19 @@ if ($_POST) {
}
function build_srctype_list() {
- global $pconfig, $ifdisp;
+ global $pconfig, $ifdisp, $config;
$list = array('any' => 'Any', 'single' => 'Single host or alias', 'network' => 'Network');
$sel = is_specialnet($pconfig['src']);
- if (have_ruleint_access("pppoe"))
+ if (have_ruleint_access("pppoe")) {
$list['pppoe'] = 'PPPoE clients';
+ }
- if (have_ruleint_access("l2tp"))
+ if (have_ruleint_access("l2tp")) {
$list['l2tp'] = 'L2TP clients';
+ }
foreach ($ifdisp as $ifent => $ifdesc) {
if (have_ruleint_access($ifent)) {
@@ -553,17 +556,39 @@ function build_srctype_list() {
return($list);
}
+function srctype_selected() {
+ global $pconfig, $config;
+
+ $selected = "";
+
+ $sel = is_specialnet($pconfig['src']);
+ if (!$sel) {
+ if ($pconfig['srcmask'] == 32) {
+ $selected = 'single';
+ } else {
+ $selected = 'network';
+ }
+ } else {
+ $selected = $pconfig['src'];
+ }
+
+
+ return($selected);
+}
+
function build_dsttype_list() {
global $pconfig, $config, $ifdisp;
$sel = is_specialnet($pconfig['dst']);
$list = array('any' => 'Any', 'single' => 'Single host or alias', 'network' => 'Network', '(self)' => 'This Firewall (self)');
- if (have_ruleint_access("pppoe"))
+ if (have_ruleint_access("pppoe")) {
$list['pppoe'] = 'PPPoE clients';
+ }
- if (have_ruleint_access("l2tp"))
+ if (have_ruleint_access("l2tp")) {
$list['l2tp'] = 'L2TP clients';
+ }
foreach ($ifdisp as $if => $ifdesc) {
if (have_ruleint_access($if)) {
@@ -574,10 +599,10 @@ function build_dsttype_list() {
if (is_array($config['virtualip']['vip'])) {
foreach ($config['virtualip']['vip'] as $sn) {
- if (isset($sn['noexpand']))
- continue;
-
if ($sn['mode'] == "proxyarp" && $sn['type'] == "network") {
+ if (isset($sn['noexpand'])) {
+ continue;
+ }
$start = ip2long32(gen_subnet($sn['subnet'], $sn['subnet_bits']));
$end = ip2long32(gen_subnet_max($sn['subnet'], $sn['subnet_bits']));
$len = $end - $start;
@@ -589,6 +614,8 @@ function build_dsttype_list() {
}
$list[$sn['subnet']] = $sn['subnet'] . ' (' . $sn['descr'] . ')';
+ } else {
+ $list[$sn['subnet']] = $sn['subnet'] . ' (' . $sn['descr'] . ')';
}
}
}
@@ -597,41 +624,35 @@ function build_dsttype_list() {
}
function dsttype_selected() {
- global $pconfig;
+ global $pconfig, $config;
- $sel = is_specialnet($pconfig['dst']);
-
- if (!$sel) {
- if ($pconfig['dstmask'] == 32)
- return('single');
-
- return('network');
- }
-
- return($pconfig['dst']);
-}
+ $selected = "";
-function srctype_selected() {
- global $pconfig;
-
- $sel = is_specialnet($pconfig['src']);
-
- if (!$sel) {
- if ($pconfig['srcmask'] == 32)
- return('single');
-
- return('network');
+ if (is_array($config['virtualip']['vip'])) {
+ $selected = $pconfig['dst'];
+ } else {
+ $sel = is_specialnet($pconfig['dst']);
+ if (!$sel) {
+ if ($pconfig['dstmask'] == 32) {
+ $selected = 'single';
+ } else {
+ $selected = 'network';
+ }
+ } else {
+ $selected = $pconfig['dst'];
+ }
}
- return($pconfig['src']);
+ return($selected);
}
$closehead = false;
$pgtitle = array(gettext("Firewall"), gettext("NAT"), gettext("Port Forward"), gettext("Edit"));
include("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
$form = new Form(new Form_Button(
'Submit',
@@ -656,24 +677,31 @@ $section->addInput(new Form_Checkbox(
$iflist = get_configured_interface_with_descr(false, true);
-foreach ($iflist as $if => $ifdesc)
- if (have_ruleint_access($if))
+foreach ($iflist as $if => $ifdesc) {
+ if (have_ruleint_access($if)) {
$interfaces[$if] = $ifdesc;
+ }
+}
-if ($config['l2tp']['mode'] == "server")
- if (have_ruleint_access("l2tp"))
+if ($config['l2tp']['mode'] == "server") {
+ if (have_ruleint_access("l2tp")) {
$interfaces['l2tp'] = "L2TP VPN";
+ }
+}
-if (is_pppoe_server_enabled() && have_ruleint_access("pppoe"))
+if (is_pppoe_server_enabled() && have_ruleint_access("pppoe")) {
$interfaces['pppoe'] = "PPPoE Server";
+}
/* add ipsec interfaces */
-if (ipsec_enabled() && have_ruleint_access("enc0"))
+if (ipsec_enabled() && have_ruleint_access("enc0")) {
$interfaces["enc0"] = "IPsec";
+}
/* add openvpn/tun interfaces */
-if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"])
+if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) {
$interfaces["openvpn"] = "OpenVPN";
+}
$section->addInput(new Form_Select(
'interface',
@@ -691,7 +719,20 @@ $section->addInput(new Form_Select(
array_combine(explode(" ", strtolower($protocols)), explode(" ", $protocols))
))->setHelp('Choose which protocol this rule should match. In most cases "TCP" is specified.');
+$btnsrcadv = new Form_Button(
+ 'srcadv',
+ 'Advanced'
+);
+
+$btnsrcadv->removeClass('btn-primary')->addClass('btn-default');
+
+$section->addInput(new Form_StaticText(
+ 'Source',
+ $btnsrcadv
+));
+
$group = new Form_Group('Source');
+$group->addClass('srcadv');
$group->add(new Form_Checkbox(
'srcnot',
@@ -717,8 +758,9 @@ $section->add($group);
$portlist = array("" => 'Other', 'any' => 'Any');
-foreach ($wkports as $wkport => $wkportdesc)
+foreach ($wkports as $wkport => $wkportdesc) {
$portlist[$wkport] = $wkportdesc;
+}
$group = new Form_Group('Source port range');
$group->addClass('srcportrange');
@@ -899,8 +941,9 @@ if (isset($id) && $a_nat[$id] && (!isset($_GET['dup']) || !is_numericint($_GET['
}
}
- if (isset($pconfig['associated-rule-id']))
+ if (isset($pconfig['associated-rule-id'])) {
$rulelist['new'] = 'Create new associated filter rule';
+ }
$section->addInput(new Form_Select(
'associated-rule-id',
@@ -933,14 +976,14 @@ if ($has_created_time || $has_updated_time) {
if ($has_created_time) {
$section->addInput(new Form_StaticText(
'Created',
- date(gettext("n/j/y H:i:s"), $a_nat[$id]['created']['time']) . gettext("by") . $a_nat[$id]['created']['username']
+ date(gettext("n/j/y H:i:s"), $a_nat[$id]['created']['time']) . gettext(" by ") . $a_nat[$id]['created']['username']
));
}
if ($has_updated_time) {
$section->addInput(new Form_StaticText(
'Updated',
- date(gettext("n/j/y H:i:s"), $a_nat[$id]['updated']['time']) . gettext("by") . $a_nat[$id]['updated']['username']
+ date(gettext("n/j/y H:i:s"), $a_nat[$id]['updated']['time']) . gettext(" by ") . $a_nat[$id]['updated']['username']
));
}
@@ -968,7 +1011,7 @@ print($form);
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
+events.push(function() {
var portsenabled = 1;
var dstenabled = 1;
var showsource = 0;
@@ -1022,7 +1065,7 @@ events.push(function(){
disableInput('srcbeginport', false);
disableInput('srcendport', false);
disableInput('localbeginport_cust', false);
- if ( dstenabled ) {
+ if (dstenabled) {
disableInput('dstbeginport', false);
disableInput('dstendport', false);
}
@@ -1030,7 +1073,7 @@ events.push(function(){
}
function nordr_change() {
- if ( $('#nordr').prop('checked') ) {
+ if ($('#nordr').prop('checked')) {
hideInput('localip', true);
hideClass('lclportrange', true);
hideInput('associated-rule-id', true);
@@ -1164,12 +1207,18 @@ events.push(function(){
$('#dstendport').prop("selectedIndex", $('#dstbeginport').find(":selected").index());
}
- function dst_change( iface, old_iface, old_dst ) {
- if ( ( old_dst == "" ) || ( old_iface.concat("ip") == old_dst ) ) {
+ function dst_change(iface, old_iface, old_dst) {
+ if ((old_dst == "") || (old_iface.concat("ip") == old_dst)) {
$('#dsttype').val(iface + "ip");
}
}
+ function hideSource(hide) {
+ hideClass('srcadv', hide);
+ hideClass('srcportrange', hide || !portsenabled);
+ hideInput('srcadv', !hide);
+ }
+
// ---------- "onclick" functions ---------------------------------------------------------------------------------
$('#srcbeginport').on('change', function() {
src_rep_change();
@@ -1217,14 +1266,19 @@ events.push(function(){
typesel_change();
});
+ $("#srcadv").click(function() {
+ hideSource(false);
+ });
// ---------- On initial page load --------------------------------------------------------------------------------
+ $("#srcadv").prop('type', 'button');
ext_change();
dst_change($('#interface').val(),'<?=htmlspecialchars($pconfig['interface'])?>','<?=htmlspecialchars($pconfig['dst'])?>');
iface_old = $('#interface').val();
typesel_change();
proto_change();
nordr_change();
+ hideSource(true);
// --------- Autocomplete -----------------------------------------------------------------------------------------
var addressarray = <?= json_encode(get_alias_list(array("host", "network", "openvpn", "urltable"))) ?>;
diff --git a/src/usr/local/www/firewall_nat_npt.php b/src/usr/local/www/firewall_nat_npt.php
index 6f6c426..54e64ff 100644
--- a/src/usr/local/www/firewall_nat_npt.php
+++ b/src/usr/local/www/firewall_nat_npt.php
@@ -72,8 +72,9 @@ require_once("functions.inc");
require_once("filter.inc");
require_once("shaper.inc");
-if (!is_array($config['nat']['npt']))
+if (!is_array($config['nat']['npt'])) {
$config['nat']['npt'] = array();
+}
$a_npt = &$config['nat']['npt'];
@@ -106,11 +107,13 @@ if ($_GET['act'] == "del") {
$pgtitle = array(gettext("Firewall"), gettext("NAT"), gettext("NPt"));
include("head.inc");
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg, 'success');
+}
-if (is_subsystem_dirty('natconf'))
+if (is_subsystem_dirty('natconf')) {
print_info_box_np(gettext("The NAT configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));
+}
$tab_array = array();
$tab_array[] = array(gettext("Port Forward"), false, "firewall_nat.php");
@@ -142,10 +145,11 @@ foreach ($a_npt as $natent):
<td>
<input type="hidden" name="rule[]" value="<?=$i?>" />
<?php
- if (!$natent['interface'])
+ if (!$natent['interface']) {
print(htmlspecialchars(convert_friendly_interface_to_friendly_descr("wan")));
- else
+ } else {
print(htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface'])));
+ }
?>
</td>
<?php
diff --git a/src/usr/local/www/firewall_nat_npt_edit.php b/src/usr/local/www/firewall_nat_npt_edit.php
index a83f13d..9a783bb 100644
--- a/src/usr/local/www/firewall_nat_npt_edit.php
+++ b/src/usr/local/www/firewall_nat_npt_edit.php
@@ -92,8 +92,9 @@ foreach ($ifdisp as $kif => $kdescr) {
$specialsrcdst[] = "{$kif}ip";
}
-if (!is_array($config['nat']['npt']))
+if (!is_array($config['nat']['npt'])) {
$config['nat']['npt'] = array();
+}
$a_npt = &$config['nat']['npt'];
@@ -180,25 +181,32 @@ function build_if_list() {
global $ifdisp;
foreach ($ifdisp as $if => $ifdesc) {
- if (have_ruleint_access($if))
+ if (have_ruleint_access($if)) {
$interfaces[$if] = $ifdesc;
+ }
}
- if ($config['l2tp']['mode'] == "server")
- if (have_ruleint_access("l2tp"))
+ if ($config['l2tp']['mode'] == "server") {
+ if (have_ruleint_access("l2tp")) {
$interfaces['l2tp'] = "L2TP VPN";
+ }
+ }
- if ($config['pppoe']['mode'] == "server")
- if (have_ruleint_access("pppoe"))
+ if ($config['pppoe']['mode'] == "server") {
+ if (have_ruleint_access("pppoe")) {
$interfaces['pppoe'] = "PPPoE Server";
+ }
+ }
/* add ipsec interfaces */
- if (ipsec_enabled() && have_ruleint_access("enc0"))
+ if (ipsec_enabled() && have_ruleint_access("enc0")) {
$interfaces["enc0"] = "IPsec";
+ }
/* add openvpn/tun interfaces */
- if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"])
+ if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) {
$interfaces["openvpn"] = "OpenVPN";
+ }
return($interfaces);
}
@@ -206,8 +214,9 @@ function build_if_list() {
$pgtitle = array(gettext("Firewall"), gettext("NAT"), gettext("NPt"), gettext("Edit"));
include("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
$form = new Form();
diff --git a/src/usr/local/www/firewall_nat_out.php b/src/usr/local/www/firewall_nat_out.php
index 0fa4f09..1679be2 100644
--- a/src/usr/local/www/firewall_nat_out.php
+++ b/src/usr/local/www/firewall_nat_out.php
@@ -87,7 +87,7 @@ $a_out = &$config['nat']['outbound']['rule'];
// update rule order, POST[rule] is an array of ordered IDs
// All rule are 'checked' before posting
if (isset($_POST['order-store'])) {
- if(is_array($_POST['rule']) && !empty($_POST['rule'])) {
+ if (is_array($_POST['rule']) && !empty($_POST['rule'])) {
$a_out_new = array();
@@ -98,8 +98,9 @@ if (isset($_POST['order-store'])) {
$a_out = $a_out_new;
- if (write_config())
+ if (write_config()) {
mark_subsystem_dirty('natconf');
+ }
header("Location: firewall_nat_out.php");
exit;
@@ -107,8 +108,9 @@ if (isset($_POST['order-store'])) {
}
}
-if (!isset($config['nat']['outbound']['mode']))
+if (!isset($config['nat']['outbound']['mode'])) {
$config['nat']['outbound']['mode'] = "automatic";
+}
$mode = $config['nat']['outbound']['mode'];
@@ -159,10 +161,10 @@ if ($_POST['save']) {
$found = false;
foreach ($a_out as $rule) {
if ($rule['interface'] == $natent['interface'] &&
- $rule['source']['network'] == $natent['source']['network'] &&
- $rule['dstport'] == $natent['dstport'] &&
- $rule['target'] == $natent['target'] &&
- $rule['descr'] == $natent['descr']) {
+ $rule['source']['network'] == $natent['source']['network'] &&
+ $rule['dstport'] == $natent['dstport'] &&
+ $rule['target'] == $natent['target'] &&
+ $rule['descr'] == $natent['descr']) {
$found = true;
break;
}
@@ -240,11 +242,13 @@ if (isset($_POST['del_x'])) {
$pgtitle = array(gettext("Firewall"), gettext("NAT"), gettext("Outbound"));
include("head.inc");
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg, 'success');
+}
-if (is_subsystem_dirty('natconf'))
+if (is_subsystem_dirty('natconf')) {
print_info_box_np(gettext("The NAT configuration has been changed.")."<br />".gettext("You must apply the changes in order for them to take effect."));
+}
$tab_array = array();
$tab_array[] = array(gettext("Port Forward"), false, "firewall_nat.php");
@@ -325,8 +329,9 @@ print($form);
foreach ($a_out as $natent):
$iconfn = "pass";
$textss = $textse = "";
- if ($mode == "disabled" || $mode == "automatic" || isset($natent['disabled']))
+ if ($mode == "disabled" || $mode == "automatic" || isset($natent['disabled'])) {
$iconfn .= "_d";
+ }
$alias = rule_columns_with_alias(
@@ -413,8 +418,9 @@ print($form);
if (isset($natent['destination']['any'])) {
echo "*";
} else {
- if (isset($natent['destination']['not']))
+ if (isset($natent['destination']['not'])) {
echo "!&nbsp;";
+ }
if (isset($alias['dst'])):
@@ -461,32 +467,35 @@ print($form);
<td>
<?php
- if (isset($natent['nonat']))
+ if (isset($natent['nonat'])) {
echo '<I>NO NAT</I>';
- elseif (!$natent['target'])
+ } elseif (!$natent['target']) {
echo htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface'])) . " address";
- elseif ($natent['target'] == "other-subnet")
+ } elseif ($natent['target'] == "other-subnet") {
echo $natent['targetip'] . '/' . $natent['targetip_subnet'];
- else
+ } else {
echo $natent['target'];
+ }
?>
</td>
<td>
<?php
- if (!$natent['natport'])
+ if (!$natent['natport']) {
echo "*";
- else
+ } else {
echo $natent['natport'];
+ }
?>
</td>
<td>
<?php
- if (isset($natent['staticnatport']))
+ if (isset($natent['staticnatport'])) {
echo gettext("YES");
- else
+ } else {
echo gettext("NO");
+ }
?>
</td>
@@ -531,11 +540,13 @@ print($form);
<?php
if ($mode == "automatic" || $mode == "hybrid"):
- if (empty($FilterIflist))
+ if (empty($FilterIflist)) {
filter_generate_optcfg_array();
+ }
- if (empty($GatewaysList))
+ if (empty($GatewaysList)) {
filter_generate_gateways();
+ }
$automatic_rules = filter_nat_rules_outbound_automatic(implode(" ", filter_nat_rules_automatic_tonathosts()));
unset($FilterIflist, $GatewaysList);
@@ -577,10 +588,11 @@ if ($mode == "automatic" || $mode == "hybrid"):
<?php
echo ($natent['protocol']) ? $natent['protocol'] . '/' : "" ;
- if (!$natent['sourceport'])
+ if (!$natent['sourceport']) {
echo "*";
- else
+ } else {
echo $natent['sourceport'];
+ }
?>
</td>
<td>
@@ -588,8 +600,9 @@ if ($mode == "automatic" || $mode == "hybrid"):
if (isset($natent['destination']['any'])) {
echo "*";
} else {
- if (isset($natent['destination']['not']))
+ if (isset($natent['destination']['not'])) {
echo "!&nbsp;";
+ }
echo $natent['destination']['address'];
}
@@ -598,38 +611,42 @@ if ($mode == "automatic" || $mode == "hybrid"):
<td>
<?php
echo ($natent['protocol']) ? $natent['protocol'] . '/' : "" ;
- if (!$natent['dstport'])
+ if (!$natent['dstport']) {
echo "*";
- else
+ } else {
echo $natent['dstport'];
+ }
?>
</td>
<td>
<?php
- if (isset($natent['nonat']))
+ if (isset($natent['nonat'])) {
echo 'NO NAT';
- elseif (!$natent['target'])
+ } elseif (!$natent['target']) {
echo htmlspecialchars(convert_friendly_interface_to_friendly_descr($natent['interface'])) . " address";
- elseif ($natent['target'] == "other-subnet")
+ } elseif ($natent['target'] == "other-subnet") {
echo $natent['targetip'] . '/' . $natent['targetip_subnet'];
- else
+ } else {
echo $natent['target'];
+ }
?>
</td>
<td>
<?php
- if (!$natent['natport'])
+ if (!$natent['natport']) {
echo "*";
- else
+ } else {
echo $natent['natport'];
+ }
?>
</td>
<td>
<?php
- if (isset($natent['staticnatport']))
+ if (isset($natent['staticnatport'])) {
echo gettext("YES");
- else
+ } else {
echo gettext("NO");
+ }
?>
</td>
<td>
diff --git a/src/usr/local/www/firewall_nat_out_edit.php b/src/usr/local/www/firewall_nat_out_edit.php
index bf00c99..0f10140 100644
--- a/src/usr/local/www/firewall_nat_out_edit.php
+++ b/src/usr/local/www/firewall_nat_out_edit.php
@@ -71,8 +71,9 @@ require_once("ipsec.inc");
require_once("filter.inc");
require("shaper.inc");
-if (!is_array($config['nat']['outbound']))
+if (!is_array($config['nat']['outbound'])) {
$config['nat']['outbound'] = array();
+}
if (!is_array($config['nat']['outbound']['rule'])) {
$config['nat']['outbound']['rule'] = array();
@@ -404,8 +405,9 @@ function build_target_list() {
if (is_array($config['virtualip']['vip'])) {
foreach ($config['virtualip']['vip'] as $sn) {
- if (isset($sn['noexpand']))
+ if (isset($sn['noexpand'])) {
continue;
+ }
if ($sn['mode'] == "proxyarp" && $sn['type'] == "network") {
$start = ip2long32(gen_subnet($sn['subnet'], $sn['subnet_bits']));
@@ -425,8 +427,9 @@ function build_target_list() {
}
foreach ($a_aliases as $alias) {
- if ($alias['type'] != "host")
+ if ($alias['type'] != "host") {
continue;
+ }
$list[$alias['name']] = 'Host Alias: ' . $alias['name'] . ' (' . $alias['descr'] . ')';
}
@@ -436,8 +439,9 @@ function build_target_list() {
return($list);
}
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
$form = new Form(new Form_Button(
'Submit',
@@ -462,24 +466,31 @@ $section->addInput(new Form_Checkbox(
$iflist = get_configured_interface_with_descr(false, true);
-foreach ($iflist as $if => $ifdesc)
- if (have_ruleint_access($if))
+foreach ($iflist as $if => $ifdesc) {
+ if (have_ruleint_access($if)) {
$interfaces[$if] = $ifdesc;
+ }
+}
-if ($config['l2tp']['mode'] == "server")
- if (have_ruleint_access("l2tp"))
+if ($config['l2tp']['mode'] == "server") {
+ if (have_ruleint_access("l2tp")) {
$interfaces['l2tp'] = "L2TP VPN";
+ }
+}
-if (is_pppoe_server_enabled() && have_ruleint_access("pppoe"))
+if (is_pppoe_server_enabled() && have_ruleint_access("pppoe")) {
$interfaces['pppoe'] = "PPPoE Server";
+}
/* add ipsec interfaces */
-if (ipsec_enabled() && have_ruleint_access("enc0"))
+if (ipsec_enabled() && have_ruleint_access("enc0")) {
$interfaces["enc0"] = "IPsec";
+}
/* add openvpn/tun interfaces */
-if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"])
+if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) {
$interfaces["openvpn"] = "OpenVPN";
+}
$section->addInput(new Form_Select(
'interface',
@@ -683,7 +694,7 @@ print($form);
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
+events.push(function() {
var portsenabled = 1;
function staticportchange() {
@@ -699,8 +710,7 @@ events.push(function(){
if ($('#source_type').find(":selected").val() == "network") {
disableInput('source', false);
disableInput('source_subnet', false);
- }
- else {
+ } else {
$('#source').val("");
disableInput('source', true);
$('#source_subnet').val("24");
@@ -712,8 +722,7 @@ events.push(function(){
if ($('#destination_type').find(":selected").val() == "network") {
disableInput('destination', false);
disableInput('destination_subnet', false);
- }
- else {
+ } else {
$('#destination').val("");
disableInput('destination', true);
$('#destination_subnet').val("24");
diff --git a/src/usr/local/www/firewall_rules.php b/src/usr/local/www/firewall_rules.php
index 70371de..4f7469b 100644
--- a/src/usr/local/www/firewall_rules.php
+++ b/src/usr/local/www/firewall_rules.php
@@ -136,8 +136,9 @@ if (is_array($config['pppoes']['pppoe'])) {
}
/* add ipsec interfaces */
-if (ipsec_enabled() && have_ruleint_access("enc0"))
+if (ipsec_enabled() && have_ruleint_access("enc0")) {
$iflist["enc0"] = "IPsec";
+}
/* add openvpn/tun interfaces */
if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"]) {
@@ -201,7 +202,7 @@ if (isset($_POST['del_x'])) {
$deleted = true;
}
- if($deleted) {
+ if ($deleted) {
if (write_config()) {
mark_subsystem_dirty('filter');
}
@@ -224,14 +225,15 @@ if (isset($_POST['del_x'])) {
header("Location: firewall_rules.php?if=" . htmlspecialchars($if));
exit;
}
-} else if($_POST['order-store']) {
+} else if ($_POST['order-store']) {
/* update rule order, POST[rule] is an array of ordered IDs */
if (is_array($_POST['rule']) && !empty($_POST['rule'])) {
$a_filter_new = array();
// if a rule is not in POST[rule], it has been deleted by the user
- foreach ($_POST['rule'] as $id)
+ foreach ($_POST['rule'] as $id) {
$a_filter_new[] = $a_filter[$id];
+ }
$a_filter = $a_filter_new;
if (write_config()) {
@@ -245,11 +247,12 @@ if (isset($_POST['del_x'])) {
$tab_array = array(array(gettext("Floating"), ("FloatingRules" == $if), "firewall_rules.php?if=FloatingRules"));
-foreach ($iflist as $ifent => $ifname)
+foreach ($iflist as $ifent => $ifname) {
$tab_array[] = array($ifname, ($ifent == $if), "firewall_rules.php?if={$ifent}");
+}
foreach ($tab_array as $dtab) {
- if($dtab[1]) {
+ if ($dtab[1]) {
$bctab = $dtab[0];
break;
}
@@ -261,13 +264,13 @@ $shortcut_section = "firewall";
include("head.inc");
$nrules = 0;
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg, 'success');
+}
-if (is_subsystem_dirty('filter'))
+if (is_subsystem_dirty('filter')) {
print_info_box_np(gettext("The firewall rule configuration has been changed.") . "<br />" . gettext("You must apply the changes in order for them to take effect."), "apply", "", true);
-
-
+}
display_top_tabs($tab_array);
@@ -297,13 +300,13 @@ display_top_tabs($tab_array);
<?php
// Show the anti-lockout rule if it's enabled, and we are on LAN with an if count > 1, or WAN with an if count of 1.
if (!isset($config['system']['webgui']['noantilockout']) &&
- (((count($config['interfaces']) > 1) && ($if == 'lan')) ||
- ((count($config['interfaces']) == 1) && ($if == 'wan')))):
+ (((count($config['interfaces']) > 1) && ($if == 'lan')) ||
+ ((count($config['interfaces']) == 1) && ($if == 'wan')))):
$alports = implode('<br />', filter_get_antilockout_ports(true));
?>
<tr id="antilockout">
<td></td>
- <td title="<?=gettext("traffic is passed")?>"><i class="fa fa-check icon-success"></i></td>
+ <td title="<?=gettext("traffic is passed")?>"><i class="fa fa-check text-success"></i></td>
<td>*</td>
<td>*</td>
<td>*</td>
@@ -321,7 +324,7 @@ display_top_tabs($tab_array);
<?php if (isset($config['interfaces'][$if]['blockpriv'])): ?>
<tr id="frrfc1918">
<td></td>
- <td title="<?=gettext("traffic is blocked")?>"><i class="fa fa-times icon-danger"></i></td>
+ <td title="<?=gettext("traffic is blocked")?>"><i class="fa fa-times text-danger"></i></td>
<td>*</td>
<td><?=gettext("RFC 1918 networks");?></td>
<td>*</td>
@@ -339,7 +342,7 @@ display_top_tabs($tab_array);
<?php if (isset($config['interfaces'][$if]['blockbogons'])): ?>
<tr id="frrfc1918">
<td></td>
- <td title="<?=gettext("traffic is blocked")?>"><i class="fa fa-times icon-danger"></i></td>
+ <td title="<?=gettext("traffic is blocked")?>"><i class="fa fa-times text-danger"></i></td>
<td>*</td>
<td><?=gettext("Reserved/not assigned by IANA");?></td>
<td>*</td>
@@ -362,7 +365,7 @@ $nrules = 0;
for ($i = 0; isset($a_filter[$i]); $i++):
$filterent = $a_filter[$i];
- if ( ($filterent['interface'] != $if && !isset($filterent['floating'])) || (isset($filterent['floating']) && "FloatingRules" != $if) ) {
+ if (($filterent['interface'] != $if && !isset($filterent['floating'])) || (isset($filterent['floating']) && "FloatingRules" != $if)) {
$display = 'style="display: none;"';
} else {
$display = "";
@@ -375,16 +378,16 @@ for ($i = 0; isset($a_filter[$i]); $i++):
<?php
if ($filterent['type'] == "block") {
- $iconfn = "times icon-danger";
+ $iconfn = "times text-danger";
$title_text = gettext("traffic is blocked");
} else if ($filterent['type'] == "reject") {
- $iconfn = "hand-stop-o icon-warning";
+ $iconfn = "hand-stop-o text-warning";
$title_text = gettext("traffic is rejected");
} else if ($filterent['type'] == "match") {
$iconfn = "filter";
$title_text = gettext("traffic is matched");
} else {
- $iconfn = "check icon-success";
+ $iconfn = "check text-success";
$title_text = gettext("traffic is passed");
}
?>
@@ -393,11 +396,13 @@ for ($i = 0; isset($a_filter[$i]); $i++):
<i class="fa fa-<?=$iconfn?>"></i>
<?php
$isadvset = firewall_check_for_advanced_options($filterent);
- if ($isadvset)
+ if ($isadvset) {
print '<i class="fa fa-cog" title="'. gettext("advanced setting") .': '. $isadvset .'"></i>';
+ }
- if (isset($filterent['log']))
+ if (isset($filterent['log'])) {
print '<i class="fa fa-tasks" title="'. gettext("traffic is logged") .'"></i>';
+ }
?>
</td>
<?php
@@ -418,8 +423,7 @@ for ($i = 0; isset($a_filter[$i]); $i++):
$dayArray = array (gettext('Mon'), gettext('Tues'), gettext('Wed'), gettext('Thur'), gettext('Fri'), gettext('Sat'), gettext('Sun'));
$monthArray = array (gettext('January'), gettext('February'), gettext('March'), gettext('April'), gettext('May'), gettext('June'), gettext('July'), gettext('August'), gettext('September'), gettext('October'), gettext('November'), gettext('December'));
if ($config['schedules']['schedule'] != "" && is_array($config['schedules']['schedule'])) {
- foreach ($a_schedules as $schedule)
- {
+ foreach ($a_schedules as $schedule) {
if ($schedule['name'] == $filterent['sched']) {
$schedstatus = filter_get_time_based_rule_status($schedule);
@@ -448,8 +452,7 @@ for ($i = 0; isset($a_filter[$i]); $i++):
$month = $tempmontharray[$arraycounter];
$day = $tempdayarray[$arraycounter];
- if (!$firstDayFound)
- {
+ if (!$firstDayFound) {
$firstDay = $day;
$firstmonth = $month;
$firstDayFound = true;
@@ -459,21 +462,21 @@ for ($i = 0; isset($a_filter[$i]); $i++):
$nextDay = $tempdayarray[$arraycounter+1];
$currentDay++;
if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])) {
- if ($firstPrint)
+ if ($firstPrint) {
$dayFriendly .= ", ";
+ }
$currentDay--;
- if ($currentDay != $firstDay)
+ if ($currentDay != $firstDay) {
$dayFriendly .= $monthArray[$firstmonth-1] . " " . $firstDay . " - " . $currentDay ;
- else
+ } else {
$dayFriendly .= $monthArray[$month-1] . " " . $day;
+ }
$firstDayFound = false;
$firstPrint = true;
}
$arraycounter++;
}
- }
- else
- {
+ } else {
$tempdayFriendly = $timerange['position'];
$firstDayFound = false;
$tempFriendlyDayArray = explode(",", $tempdayFriendly);
@@ -483,8 +486,7 @@ for ($i = 0; isset($a_filter[$i]); $i++):
$counter = 0;
foreach ($tempFriendlyDayArray as $day) {
if ($day != "") {
- if (!$firstDayFound)
- {
+ if (!$firstDayFound) {
$firstDay = $tempFriendlyDayArray[$counter];
$firstDayFound = true;
}
@@ -493,13 +495,15 @@ for ($i = 0; isset($a_filter[$i]); $i++):
$nextDay = $tempFriendlyDayArray[$counter+1];
$currentDay++;
if ($currentDay != $nextDay) {
- if ($firstprint)
+ if ($firstprint) {
$dayFriendly .= ", ";
+ }
$currentDay--;
- if ($currentDay != $firstDay)
+ if ($currentDay != $firstDay) {
$dayFriendly .= $dayArray[$firstDay-1] . " - " . $dayArray[$currentDay-1];
- else
+ } else {
$dayFriendly .= $dayArray[$firstDay-1];
+ }
$firstDayFound = false;
$firstprint = true;
}
@@ -533,10 +537,11 @@ for ($i = 0; isset($a_filter[$i]); $i++):
}
$printicon = true;
} else if ($filterent['sched']) {
- if ($iconfn == "block" || $iconfn == "reject")
+ if ($iconfn == "block" || $iconfn == "reject") {
$image = "times-circle";
- else
+ } else {
$image = "times-circle";
+ }
$alttext = gettext("This rule is not currently active because its period has expired");
$printicon = true;
}
@@ -615,8 +620,9 @@ for ($i = 0; isset($a_filter[$i]); $i++):
} else if (isset($filterent['defaultqueue'])) {
$desc = $filterent['defaultqueue'];
echo "<a href=\"firewall_shaper_queues.php?queue={$filterent['defaultqueue']}&amp;action=show\">{$desc}</a>";
- } else
+ } else {
echo gettext("none");
+ }
?>
</td>
<td>
@@ -691,27 +697,28 @@ for ($i = 0; isset($a_filter[$i]); $i++):
<dl class="dl-horizontal responsive">
<!-- Legend -->
<dt><?=gettext('Legend')?></dt> <dd></dd>
- <dt><i class="fa fa-check icon-success"></i></dt> <dd><?=gettext("Pass");?></dd>
+ <dt><i class="fa fa-check text-success"></i></dt> <dd><?=gettext("Pass");?></dd>
<dt><i class="fa fa-filter"></i></dt> <dd><?=gettext("Match");?></dd>
- <dt><i class="fa fa-times icon-danger"></i></dt> <dd><?=gettext("Block");?></dd>
- <dt><i class="fa fa-hand-stop-o icon-warning"></i></dt> <dd><?=gettext("Reject");?></dd>
+ <dt><i class="fa fa-times text-danger"></i></dt> <dd><?=gettext("Block");?></dd>
+ <dt><i class="fa fa-hand-stop-o text-warning"></i></dt> <dd><?=gettext("Reject");?></dd>
<dt><i class="fa fa-tasks"></i></dt> <dd> <?=gettext("Log");?></dd>
<dt><i class="fa fa-cog"></i></dt> <dd> <?=gettext("Advanced filter");?></dd>
</dl>
<?php
- if ("FloatingRules" != $if)
+ if ("FloatingRules" != $if) {
print(gettext("Rules are evaluated on a first-match basis (i.e. " .
"the action of the first rule to match a packet will be executed). ") . '<br />' .
gettext("This means that if you use block rules, you'll have to pay attention " .
"to the rule order. Everything that isn't explicitly passed is blocked " .
"by default. "));
- else
+ } else {
print(gettext("Floating rules are evaluated on a first-match basis (i.e. " .
"the action of the first rule to match a packet will be executed) only " .
"if the 'quick' option is checked on a rule. Otherwise they will only match if no " .
"other rules match. Pay close attention to the rule order and options " .
"chosen. If no rule here matches, the per-interface or default rules are used. "));
+ }
?>
</div>
</div>
diff --git a/src/usr/local/www/firewall_rules_edit.php b/src/usr/local/www/firewall_rules_edit.php
index 5190081..32d6342 100644
--- a/src/usr/local/www/firewall_rules_edit.php
+++ b/src/usr/local/www/firewall_rules_edit.php
@@ -86,16 +86,16 @@ function is_aoadv_used($rule_config) {
// Note that the user could set "tag" or "tagged" to the string "0", which is valid but empty().
// And if the user enters "0" in other fields, we want to present an error message, and keep the Advanced Options section open.
if ((isset($rule_config['allowopts'])) ||
- (isset($rule_config['disablereplyto'])) ||
- ($rule_config['tag'] != "") ||
- ($rule_config['tagged'] != "") ||
- ($rule_config['max'] != "") ||
- ($rule_config['max-src-nodes'] != "") ||
- ($rule_config['max-src-conn'] != "") ||
- ($rule_config['max-src-states'] != "") ||
- ($rule_config['max-src-conn-rate'] != "") ||
- ($rule_config['max-src-conn-rates'] != "") ||
- ($rule_config['statetimeout'] != "")) {
+ (isset($rule_config['disablereplyto'])) ||
+ ($rule_config['tag'] != "") ||
+ ($rule_config['tagged'] != "") ||
+ ($rule_config['max'] != "") ||
+ ($rule_config['max-src-nodes'] != "") ||
+ ($rule_config['max-src-conn'] != "") ||
+ ($rule_config['max-src-states'] != "") ||
+ ($rule_config['max-src-conn-rate'] != "") ||
+ ($rule_config['max-src-conn-rates'] != "") ||
+ ($rule_config['statetimeout'] != "")) {
return true;
}
@@ -448,12 +448,12 @@ if ($_POST) {
}
if (isset($a_filter[$id]['associated-rule-id']) === false &&
- (!(is_specialnet($_POST['srctype']) || ($_POST['srctype'] == "single")))) {
+ (!(is_specialnet($_POST['srctype']) || ($_POST['srctype'] == "single")))) {
$reqdfields[] = "srcmask";
$reqdfieldsn[] = "Source bit count";
}
if (isset($a_filter[$id]['associated-rule-id']) === false &&
- (!(is_specialnet($_POST['dsttype']) || ($_POST['dsttype'] == "single")))) {
+ (!(is_specialnet($_POST['dsttype']) || ($_POST['dsttype'] == "single")))) {
$reqdfields[] = "dstmask";
$reqdfieldsn[] = gettext("Destination bit count");
}
@@ -491,7 +491,7 @@ if ($_POST) {
$input_errors[] = 'The same port alias must be used in Source port range from: and to: fields';
}
if ((is_alias($_POST['srcbeginport_cust']) && (!is_alias($_POST['srcendport_cust']) && $_POST['srcendport_cust'] != '')) ||
- ((!is_alias($_POST['srcbeginport_cust']) && $_POST['srcbeginport_cust'] != '') && is_alias($_POST['srcendport_cust']))) {
+ ((!is_alias($_POST['srcbeginport_cust']) && $_POST['srcbeginport_cust'] != '') && is_alias($_POST['srcendport_cust']))) {
$input_errors[] = 'You cannot specify numbers and port aliases at the same time in Source port range from: and to: field';
}
}
@@ -505,7 +505,7 @@ if ($_POST) {
$input_errors[] = 'The same port alias must be used in Destination port range from: and to: fields';
}
if ((is_alias($_POST['dstbeginport_cust']) && (!is_alias($_POST['dstendport_cust']) && $_POST['dstendport_cust'] != '')) ||
- ((!is_alias($_POST['dstbeginport_cust']) && $_POST['dstbeginport_cust'] != '') && is_alias($_POST['dstendport_cust']))) {
+ ((!is_alias($_POST['dstbeginport_cust']) && $_POST['dstbeginport_cust'] != '') && is_alias($_POST['dstendport_cust']))) {
$input_errors[] = 'You cannot specify numbers and port aliases at the same time in Destination port range from: and to: field';
}
}
@@ -692,7 +692,7 @@ if ($_POST) {
}
if ((($_POST['max-src-conn-rate'] <> "" and $_POST['max-src-conn-rates'] == "")) ||
- (($_POST['max-src-conn-rate'] == "" and $_POST['max-src-conn-rates'] <> ""))) {
+ (($_POST['max-src-conn-rate'] == "" and $_POST['max-src-conn-rates'] <> ""))) {
$input_errors[] = gettext("Both maximum new connections per host and the interval (per second(s)) must be specified");
}
@@ -1024,14 +1024,14 @@ $closehead = false;
$page_filename = "firewall_rules_edit.php";
include("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
$form = new Form;
$section = new Form_Section('Edit Firewall rule');
-if (isset($id))
-{
+if (isset($id)) {
$form->addGlobal(new Form_Input(
'id',
'ID',
@@ -1040,8 +1040,7 @@ if (isset($id))
));
}
-if (isset($a_filter[$id]))
-{
+if (isset($a_filter[$id])) {
$form->addGlobal(new Form_Input(
'tracker',
'Tracker',
@@ -1073,8 +1072,9 @@ $values = array(
'reject' => 'Reject',
);
-if ($if == "FloatingRules" || isset($pconfig['floating']))
+if ($if == "FloatingRules" || isset($pconfig['floating'])) {
$values['match'] = 'Match';
+}
$section->addInput(new Form_Select(
'type',
@@ -1095,8 +1095,7 @@ $section->addInput(new Form_Checkbox(
))->setHelp('Set this option to disable this rule without removing it from the '.
'list.');
-if ($if == "FloatingRules" || isset($pconfig['floating']))
-{
+if ($if == "FloatingRules" || isset($pconfig['floating'])) {
$section->addInput(new Form_Checkbox(
'quick',
'Quick',
@@ -1108,13 +1107,12 @@ if ($if == "FloatingRules" || isset($pconfig['floating']))
$edit_disabled = isset($pconfig['associated-rule-id']);
-if ($edit_disabled)
-{
+if ($edit_disabled) {
$extra = '';
- foreach ($config['nat']['rule'] as $index => $nat_rule)
- {
- if ($nat_rule['associated-rule-id'] === $pconfig['associated-rule-id'])
+ foreach ($config['nat']['rule'] as $index => $nat_rule) {
+ if ($nat_rule['associated-rule-id'] === $pconfig['associated-rule-id']) {
$extra = '<br/><a href="firewall_nat_edit.php?id='. $index .'">'. gettext('View the NAT rule') .'</a>';
+ }
}
$section->addInput(new Form_StaticText(
@@ -1133,8 +1131,7 @@ if ($edit_disabled)
$pconfig['associated-rule-id']
));
- if (!empty($pconfig['interface']))
- {
+ if (!empty($pconfig['interface'])) {
$form->addGlobal(new Form_Input(
'interface',
null,
@@ -1269,17 +1266,20 @@ foreach (['src' => 'Source', 'dst' => 'Destination'] as $type => $name) {
$ruleValues['(self)'] = "This firewall (self)";
}
- if (isset($a_filter[$id]['floating']) || $if == "FloatingRules")
+ if (isset($a_filter[$id]['floating']) || $if == "FloatingRules") {
$ruleValues['(self)'] = 'This Firewall (self)';
- if (have_ruleint_access("pppoe"))
+ }
+ if (have_ruleint_access("pppoe")) {
$ruleValues['pppoe'] = 'PPPoE clients';
- if (have_ruleint_access("l2tp"))
+ }
+ if (have_ruleint_access("l2tp")) {
$ruleValues['l2tp'] = 'L2TP clients';
+ }
- foreach ($ifdisp as $ifent => $ifdesc)
- {
- if (!have_ruleint_access($ifent))
+ foreach ($ifdisp as $ifent => $ifdesc) {
+ if (!have_ruleint_access($ifent)) {
continue;
+ }
$ruleValues[$ifent] = $ifdesc.' net';
$ruleValues[$ifent.'ip'] = $ifdesc.' address';
@@ -1309,8 +1309,9 @@ foreach (['src' => 'Source', 'dst' => 'Destination'] as $type => $name) {
$portValues = ['' => '(other)', 'any' => 'any'];
- foreach ($wkports as $port => $portName)
+ foreach ($wkports as $port => $portName) {
$portValues[$port] = $portName.' ('. $port .')';
+ }
$group = new Form_Group($name .' port range');
@@ -1368,7 +1369,7 @@ $section->addInput(new Form_Checkbox(
$pconfig['log']
))->setHelp('Hint: the firewall has limited local log space. Don\'t turn on logging '.
'for everything. If you want to do a lot of logging, consider using a remote '.
- 'syslog server (see the <a href="diag_logs_settings.php">Status: System logs: '.
+ 'syslog server (see the <a href="status_logs_settings.php">Status: System logs: '.
'Settings</a> page).');
$section->addInput(new Form_Input(
@@ -1387,7 +1388,7 @@ $btnadvanced = new Form_Button(
$btnadvanced->removeClass('btn-primary')->addClass('btn-default');
-if(!$adv_open) {
+if (!$adv_open) {
$section->addInput(new Form_StaticText(
null,
$btnadvanced
@@ -1476,7 +1477,7 @@ $section->addInput(new Form_Input(
'Max. src. conn. Rate',
'number',
$pconfig['max-src-conn-rate']
-))->setHelp('Maximum state entries per host');
+))->setHelp('Maximum new connections per host (TCP only)');
$section->addInput(new Form_Input(
'max-src-conn-rates',
@@ -1484,7 +1485,7 @@ $section->addInput(new Form_Input(
'number',
$pconfig['max-src-conn-rates'],
['min' => 1, 'max' => 255]
-))->setHelp('Maximum new connections per host / per second(s) (TCP only)');
+))->setHelp('/ per how many second(s) (TCP only)');
$section->addInput(new Form_Input(
'statetimeout',
@@ -1543,10 +1544,10 @@ $section->addInput(new Form_Select(
))->setHelp('Choose 802.1p priority to apply');
$schedules = array();
-foreach ((array)$config['schedules']['schedule'] as $schedule)
-{
- if ($schedule['name'] != "")
+foreach ((array)$config['schedules']['schedule'] as $schedule) {
+ if ($schedule['name'] != "") {
$schedules[] = $schedule['name'];
+ }
}
$section->addInput(new Form_Select(
@@ -1557,24 +1558,27 @@ $section->addInput(new Form_Select(
))->setHelp('Leave as \'none\' to leave the rule enabled all the time');
$gateways = array("" => 'default');
-foreach (return_gateways_array() as $gwname => $gw)
-{
- if (($pconfig['ipprotocol'] == "inet46"))
+foreach (return_gateways_array() as $gwname => $gw) {
+ if (($pconfig['ipprotocol'] == "inet46")) {
continue;
- if (($pconfig['ipprotocol'] == "inet6") && !(($gw['ipprotocol'] == "inet6") || (is_ipaddrv6($gw['gateway']))))
+ }
+ if (($pconfig['ipprotocol'] == "inet6") && !(($gw['ipprotocol'] == "inet6") || (is_ipaddrv6($gw['gateway'])))) {
continue;
- if (($pconfig['ipprotocol'] == "inet") && !(($gw['ipprotocol'] == "inet") || (is_ipaddrv4($gw['gateway']))))
+ }
+ if (($pconfig['ipprotocol'] == "inet") && !(($gw['ipprotocol'] == "inet") || (is_ipaddrv4($gw['gateway'])))) {
continue;
- if ($gw == "")
+ }
+ if ($gw == "") {
continue;
+ }
$gateways[ $gwname ] = $gw['name'] . (empty($gw['gateway'])? '' : ' - '. $gateway_addr_str);
}
-foreach ((array)$a_gatewaygroups as $gwg_name => $gwg_data)
-{
- if ((empty($pconfig['ipprotocol'])) || ($pconfig['ipprotocol'] == $gwg_data['ipprotocol']))
+foreach ((array)$a_gatewaygroups as $gwg_name => $gwg_data) {
+ if ((empty($pconfig['ipprotocol'])) || ($pconfig['ipprotocol'] == $gwg_data['ipprotocol'])) {
$gateways[ $gwg_name ] = $gwg_name;
+ }
}
$section->addInput(new Form_Select(
@@ -1612,14 +1616,16 @@ $section->add($group)->setHelp('Choose the Out queue/Virtual interface only if '
$group = new Form_Group('Ackqueue / Queue');
$list = array('' => 'none');
-if(!is_array($qlist))
+if (!is_array($qlist)) {
$qlist = array();
+}
foreach ($qlist as $q => $qkey) {
- if (isset($ifdisp[$q]))
+ if (isset($ifdisp[$q])) {
$list[$q] = $ifdisp[$q];
- else
+ } else {
$list[$q] = $q;
+ }
}
$group->add(new Form_Select(
@@ -1644,21 +1650,18 @@ $has_created_time = (isset($a_filter[$id]['created']) && is_array($a_filter[$id]
$has_updated_time = (isset($a_filter[$id]['updated']) && is_array($a_filter[$id]['updated']));
-if ($has_created_time || $has_updated_time)
-{
+if ($has_created_time || $has_updated_time) {
$form->add($section);
$section = new Form_Section('Rule Information');
- if ($has_created_time)
- {
+ if ($has_created_time) {
$section->addInput(new Form_StaticText(
'Created',
date('n/j/y H:i:s', $a_filter[$id]['created']['time']) . gettext(' by ') .'<b>'. $a_filter[$id]['created']['username'] .'</b>'
));
}
- if ($has_updated_time)
- {
+ if ($has_updated_time) {
$section->addInput(new Form_StaticText(
'Updated',
date('n/j/y H:i:s', $a_filter[$id]['updated']['time']) . gettext(' by ') .'<b>'. $a_filter[$id]['updated']['username'] .'</b>'
@@ -1672,7 +1675,7 @@ echo $form;
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
+events.push(function() {
var portsenabled = 1;
var editenabled = 1;
@@ -1683,8 +1686,9 @@ events.push(function(){
if (($('#srcbeginport').find(":selected").index() == 0) && portsenabled && editenabled) {
disableInput('srcbeginport_cust', false);
} else {
- if (editenabled)
+ if (editenabled) {
$('#srcbeginport_cust').val("");
+ }
disableInput('srcbeginport_cust', true);
}
@@ -1692,8 +1696,9 @@ events.push(function(){
if (($('#srcendport').find(":selected").index() == 0) && portsenabled && editenabled) {
disableInput('srcendport_cust', false);
} else {
- if (editenabled)
+ if (editenabled) {
$('#srcendport_cust').val("");
+ }
disableInput('srcendport_cust', true);
}
@@ -1701,8 +1706,9 @@ events.push(function(){
if (($('#dstbeginport').find(":selected").index() == 0) && portsenabled && editenabled) {
disableInput('dstbeginport_cust', false);
} else {
- if (editenabled)
+ if (editenabled) {
$('#dstbeginport_cust').val("");
+ }
disableInput('dstbeginport_cust', true);
}
@@ -1710,8 +1716,9 @@ events.push(function(){
if (($('#dstendport').find(":selected").index() == 0) && portsenabled && editenabled) {
disableInput('dstendport_cust', false);
} else {
- if (editenabled)
+ if (editenabled) {
$('#dstendport_cust').val("");
+ }
disableInput('dstendport_cust', true);
}
@@ -1900,15 +1907,17 @@ events.push(function(){
$('#toggle-advanced').click(function() {
optionsvisible = 1;
hideClass('advanced-options', false);
- if ($('#tcpflags_any').prop('checked'))
+ if ($('#tcpflags_any').prop('checked')) {
$('.table-flags').addClass('hidden');
+ }
});
$('#tcpflags_any').click(function () {
- if (this.checked)
+ if (this.checked) {
$('.table-flags').addClass('hidden');
- else
+ } else {
$('.table-flags').removeClass('hidden');
+ }
});
// Change help text based on the selector value
@@ -1919,14 +1928,15 @@ events.push(function(){
function setOptText(target, val) {
var dispstr = '<span class="text-success">';
- if (val == 'keep state')
+ if (val == 'keep state') {
dispstr += 'Keep: works with all IP protocols';
- else if (val == 'sloppy state')
+ } else if (val == 'sloppy state') {
dispstr += 'Sloppy: works with all IP protocols';
- else if (val == 'synproxy state')
+ } else if (val == 'synproxy state') {
dispstr += 'Synproxy: proxies incoming TCP connections to help protect servers from spoofed TCP SYN floods. This option includes the functionality of keep state and modulate state combined';
- else if (val == 'none')
+ } else if (val == 'none') {
dispstr += 'None: Do not use state mechanisms to keep track. This is only useful if you\'re doing advanced queueing in certain situations';
+ }
dispstr += '</span>';
setHelpText(target, dispstr);
diff --git a/src/usr/local/www/firewall_schedule.php b/src/usr/local/www/firewall_schedule.php
index 39880ce..11bf2bb 100644
--- a/src/usr/local/www/firewall_schedule.php
+++ b/src/usr/local/www/firewall_schedule.php
@@ -113,8 +113,9 @@ if ($_GET['act'] == "del") {
include("head.inc");
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg, 'success');
+}
?>
<div class="panel panel-default">
@@ -183,23 +184,24 @@ foreach ($a_schedules as $schedule):
$currentDay++;
if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])) {
- if ($firstPrint)
+ if ($firstPrint) {
$dayFriendly .= "<br />";
+ }
$currentDay--;
- if ($currentDay != $firstDay)
+ if ($currentDay != $firstDay) {
$dayFriendly .= $monthArray[$firstmonth-1] . " " . $firstDay . " - " . $currentDay ;
- else
+ } else {
$dayFriendly .= $monthArray[$month-1] . " " . $day;
+ }
$firstDayFound = false;
$firstPrint = true;
}
$arraycounter++;
}
- }
- else {
+ } else {
$tempdayFriendly = $timerange['position'];
$firstDayFound = false;
$tempFriendlyDayArray = explode(",", $tempdayFriendly);
@@ -210,8 +212,7 @@ foreach ($a_schedules as $schedule):
foreach ($tempFriendlyDayArray as $day) {
if ($day != "") {
- if (!$firstDayFound)
- {
+ if (!$firstDayFound) {
$firstDay = $tempFriendlyDayArray[$counter];
$firstDayFound = true;
}
@@ -222,15 +223,17 @@ foreach ($a_schedules as $schedule):
$currentDay++;
if ($currentDay != $nextDay) {
- if ($firstprint)
+ if ($firstprint) {
$dayFriendly .= "<br />";
+ }
$currentDay--;
- if ($currentDay != $firstDay)
+ if ($currentDay != $firstDay) {
$dayFriendly .= $dayArray[$firstDay-1] . " - " . $dayArray[$currentDay-1];
- else
+ } else {
$dayFriendly .= $dayArray[$firstDay-1];
+ }
$firstDayFound = false;
$firstprint = true;
diff --git a/src/usr/local/www/firewall_schedule_edit.php b/src/usr/local/www/firewall_schedule_edit.php
index 0621591..14cab5a 100644
--- a/src/usr/local/www/firewall_schedule_edit.php
+++ b/src/usr/local/www/firewall_schedule_edit.php
@@ -73,8 +73,9 @@ function schedulecmp($a, $b) {
function schedule_sort() {
global $g, $config;
- if (!is_array($config['schedules']['schedule']))
+ if (!is_array($config['schedules']['schedule'])) {
return;
+ }
usort($config['schedules']['schedule'], "schedulecmp");
}
@@ -91,16 +92,19 @@ $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firew
$dayArray = array (gettext('Mon'), gettext('Tues'), gettext('Wed'), gettext('Thur'), gettext('Fri'), gettext('Sat'), gettext('Sun'));
$monthArray = array (gettext('January'), gettext('February'), gettext('March'), gettext('April'), gettext('May'), gettext('June'), gettext('July'), gettext('August'), gettext('September'), gettext('October'), gettext('November'), gettext('December'));
-if (!is_array($config['schedules']['schedule']))
+if (!is_array($config['schedules']['schedule'])) {
$config['schedules']['schedule'] = array();
+}
$a_schedules = &$config['schedules']['schedule'];
-if (is_numericint($_GET['id']))
+if (is_numericint($_GET['id'])) {
$id = $_GET['id'];
+}
-if (isset($_POST['id']) && is_numericint($_POST['id']))
+if (isset($_POST['id']) && is_numericint($_POST['id'])) {
$id = $_POST['id'];
+}
if (isset($id) && $a_schedules[$id]) {
$pconfig['name'] = $a_schedules[$id]['name'];
@@ -112,27 +116,32 @@ if (isset($id) && $a_schedules[$id]) {
if ($_POST) {
- if (strtolower($_POST['name']) == "lan")
+ if (strtolower($_POST['name']) == "lan") {
$input_errors[] = gettext("Schedule may not be named LAN.");
+ }
- if (strtolower($_POST['name']) == "wan")
+ if (strtolower($_POST['name']) == "wan") {
$input_errors[] = gettext("Schedule may not be named WAN.");
+ }
- if (strtolower($_POST['name']) == "")
+ if (strtolower($_POST['name']) == "") {
$input_errors[] = gettext("Schedule name cannot be blank.");
+ }
$x = is_validaliasname($_POST['name']);
if (!isset($x)) {
$input_errors[] = gettext("Reserved word used for schedule name.");
} else {
- if (is_validaliasname($_POST['name']) == false)
+ if (is_validaliasname($_POST['name']) == false) {
$input_errors[] = gettext("The schedule name may only consist of the characters a-z, A-Z, 0-9");
+ }
}
/* check for name conflicts */
foreach ($a_schedules as $schedule) {
- if (isset($id) && ($a_schedules[$id]) && ($a_schedules[$id] === $schedule))
+ if (isset($id) && ($a_schedules[$id]) && ($a_schedules[$id] === $schedule)) {
continue;
+ }
if ($schedule['name'] == $_POST['name']) {
$input_errors[] = gettext("A Schedule with this name already exists.");
@@ -169,21 +178,16 @@ if ($_POST) {
$timedescrstr = htmlentities($_POST['timedescr' . $x], ENT_QUOTES, 'UTF-8');
$dashpos = strpos($timestr, '-');
- if ($dashpos === false)
- {
+ if ($dashpos === false) {
$timeparts['position'] = $timestr;
- }
- else
- {
+ } else {
$tempindarray = array();
$monthstr = "";
$daystr = "";
$tempindarray = explode(",", $timestr);
- foreach ($tempindarray as $currentselection)
- {
+ foreach ($tempindarray as $currentselection) {
if ($currentselection) {
- if ($firstprint)
- {
+ if ($firstprint) {
$monthstr .= ",";
$daystr .= ",";
}
@@ -206,39 +210,41 @@ if ($_POST) {
}
}
- if (!$timerangeFound)
+ if (!$timerangeFound) {
$input_errors[] = gettext("The schedule must have at least one time range configured.");
+ }
if (!$input_errors) {
- if (!empty($pconfig['schedlabel']))
+ if (!empty($pconfig['schedlabel'])) {
$schedule['schedlabel'] = $pconfig['schedlabel'];
- else
+ } else {
$schedule['schedlabel'] = uniqid();
+ }
if (isset($id) && $a_schedules[$id]) {
$a_schedules[$id] = $schedule;
- }
- else {
+ } else {
$a_schedules[] = $schedule;
}
schedule_sort();
- if (write_config())
+ if (write_config()) {
filter_configure();
+ }
header("Location: firewall_schedule.php");
exit;
}
//we received input errors, copy data to prevent retype
- else
- {
- if (!$_POST['schedule0'])
+ else {
+ if (!$_POST['schedule0']) {
$getSchedule = false;
- else
+ } else {
$getSchedule = true;
+ }
$pconfig['name'] = $schedule['name'];
$pconfig['descr'] = $schedule['descr'];
@@ -260,8 +266,9 @@ function build_date_table() {
for ($k = 0; $k < 12; $k++) {
$firstdayofmonth = date("w", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter)));
- if ($firstdayofmonth == 0)
+ if ($firstdayofmonth == 0) {
$firstdayofmonth = 7;
+ }
$daycounter = 1;
//number of day in month
@@ -273,10 +280,11 @@ function build_date_table() {
$mostr = '<div id="' . date("F_y", mktime(0, 0, 0, date($monthcounter), 1, date($yearcounter))) ;
$mostr .= '" style="position:relative; display:';
- if ($firstmonth)
+ if ($firstmonth) {
$mostr .= "block";
- else
+ } else {
$mostr .= "none";
+ }
$mostr .= '" class="col-md-6">';
@@ -301,8 +309,7 @@ function build_date_table() {
while ($daycounter<=$numberofdays) {
$weekcounter = date("W", mktime(0, 0, 0, date($monthcounter), date($daycounter), date($yearcounter)));
$weekcounter = ltrim($weekcounter, "0");
- if ($positioncounter == 1)
- {
+ if ($positioncounter == 1) {
$mostr .= "<tr>";
}
@@ -313,22 +320,18 @@ function build_date_table() {
$daycounter++;
$firstdayprinted = TRUE;
$mostr .= "</td>";
- }
- elseif ($firstdayprinted == TRUE && $daycounter <= $numberofdays) {
+ } elseif ($firstdayprinted == TRUE && $daycounter <= $numberofdays) {
$mostr .= '<td class="text-center" style="cursor: pointer;" id="w' . $weekcounter . 'p' . $positioncounter . '" onclick="daytoggle(\'w' . $weekcounter . 'p' . $positioncounter . '-m' . $monthcounter . 'd' . $daycounter . '\');">' . $daycounter . "\r\n";
$daycounter++;
$mostr .= "</td>";
- }
- else
- {
+ } else {
$mostr .= '<td class="text-center"></td>';
}
if ($positioncounter == 7 || $daycounter > $numberofdays) {
$positioncounter = 1;
$mostr .= "</tr>";
- }
- else {
+ } else {
$positioncounter++;
}
@@ -338,13 +341,10 @@ function build_date_table() {
$mostr .= gettext('Click individual date to select that date only. Click the appropriate weekday Header to select all occurrences of that weekday. ');
$mostr .= '</div>';
- if ($monthcounter == 12)
- {
+ if ($monthcounter == 12) {
$monthcounter = 1;
$yearcounter++;
- }
- else
- {
+ } else {
$monthcounter++;
}
@@ -368,9 +368,7 @@ function build_month_list() {
if ($monthcounter == 12) {
$monthcounter = 1;
$yearcounter++;
- }
- else
- {
+ } else {
$monthcounter++;
}
}
@@ -378,8 +376,9 @@ function build_month_list() {
return($list);
}
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
$form = new Form();
@@ -395,8 +394,9 @@ $input = new Form_Input(
$input->setHelp((is_schedule_inuse($pconfig['name']) != true) ? 'The name of the alias may only consist of the characters a-z, A-Z and 0-9':
'This schedule is in use so the name may not be modified!');
-if (is_schedule_inuse($pconfig['name']) == true)
+if (is_schedule_inuse($pconfig['name']) == true) {
$input->setReadonly();
+}
$section->addInput($input);
@@ -529,16 +529,14 @@ if ($getSchedule) {
$weeknumber = date("W", mktime(0, 0, 0, date($month), date($day), date("Y")));
$weeknumber = ltrim($weeknumber, "0");
- if ($firstPrint)
- {
+ if ($firstPrint) {
$tempID .= ",";
}
$tempID .= "w" . $weeknumber . "p" . $daypos . "-m" . $month . "d" . $day;
$firstPrint = true;
- if (!$firstDayFound)
- {
+ if (!$firstDayFound) {
$firstDay = $day;
$firstmonth = $month;
$firstDayFound = true;
@@ -548,15 +546,17 @@ if ($getSchedule) {
$nextDay = $tempdayarray[$arraycounter+1];
$currentDay++;
if (($currentDay != $nextDay) || ($tempmontharray[$arraycounter] != $tempmontharray[$arraycounter+1])) {
- if ($firstprint2)
+ if ($firstprint2) {
$tempFriendlyTime .= ", ";
+ }
$currentDay--;
- if ($currentDay != $firstDay)
+ if ($currentDay != $firstDay) {
$tempFriendlyTime .= $monthArray[$firstmonth-1] . " " . $firstDay . " - " . $currentDay ;
- else
+ } else {
$tempFriendlyTime .= $monthArray[$month-1] . " " . $day;
+ }
$firstDayFound = false;
$firstprint2 = true;
@@ -564,9 +564,7 @@ if ($getSchedule) {
$arraycounter++;
}
- }
- else
- {
+ } else {
$dayFriendly = $timerange['position'];
$tempID = $dayFriendly;
}
@@ -586,8 +584,7 @@ if ($getSchedule) {
if (!$timerange['month']) {
foreach ($tempFriendlyDayArray as $day) {
if ($day != "") {
- if (!$firstDayFound)
- {
+ if (!$firstDayFound) {
$firstDay = $tempFriendlyDayArray[$i];
$firstDayFound = true;
}
@@ -598,15 +595,17 @@ if ($getSchedule) {
$currentDay++;
if ($currentDay != $nextDay) {
- if ($firstprint)
+ if ($firstprint) {
$tempFriendlyTime .= ", ";
+ }
$currentDay--;
- if ($currentDay != $firstDay)
+ if ($currentDay != $firstDay) {
$tempFriendlyTime .= $dayArray[$firstDay-1] . " - " . $dayArray[$currentDay-1];
- else
+ } else {
$tempFriendlyTime .= $dayArray[$firstDay-1];
+ }
$firstDayFound = false;
$firstprint = true;
@@ -679,7 +678,7 @@ print($form);
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
+events.push(function() {
//Update the calendar when a new month is selected
$('#monthsel').on('change', function() {
@@ -721,8 +720,9 @@ var schCounter = 0;
function rgb2hex(rgb) {
var parts = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
- if (parts == null)
+ if (parts == null) {
return;
+ }
function hex(x) {
return ("0" + parseInt(x).toString(16)).slice(-2);
@@ -731,7 +731,7 @@ function rgb2hex(rgb) {
return ("#" + hex(parts[1]) + hex(parts[2]) + hex(parts[3])).toUpperCase();
}
-function repeatExistingDays(){
+function repeatExistingDays() {
var tempstr, tempstrdaypos, week, daypos, dayposdone = "";
var dayarray = daysSelected.split(",");
@@ -749,17 +749,18 @@ function repeatExistingDays(){
tempstr = 'w' + week + 'p' + daypos;
daycell = eval('document.getElementById(tempstr)');
if (daydone == "-1") {
- if (rgb2hex(daycell.style.backgroundColor) == "#F08080") // lightcoral
+ if (rgb2hex(daycell.style.backgroundColor) == "#F08080") { // lightcoral
daytogglerepeating(week,daypos,true);
- else
+ } else {
daytogglerepeating(week,daypos,false);
+ }
dayposdone += daypos + ",";
}
}
}
-function daytogglerepeating(week,daypos,bExists){
+function daytogglerepeating(week, daypos, bExists) {
var tempstr, daycell, dayoriginal = "";
for (j=1; j<=53; j++) {
@@ -773,9 +774,7 @@ function daytogglerepeating(week,daypos,bExists){
if (daycell != null) {
if (bExists) {
daycell.style.backgroundColor = "#FFFFFF"; // white
- }
- else
- {
+ } else {
daycell.style.backgroundColor = "#F08080"; // lightcoral
}
@@ -803,9 +802,7 @@ function daytoggle(id) {
idmod = id;
runrepeat = true;
var daypos = id.substr(tempstrdaypos+1);
- }
- else
- {
+ } else {
idmod = id.substring(0, iddashpos);
var daypos = id.substring(tempstrdaypos+1, iddashpos);
}
@@ -820,28 +817,19 @@ function daytoggle(id) {
daycell.style.backgroundColor = "#FFFFFF"; // white
str = id + ",";
daysSelected = daysSelected.replace(str, "");
- }
- else if (rgb2hex(daycell.style.backgroundColor) == "#F08080") // lightcoral
- {
+ } else if (rgb2hex(daycell.style.backgroundColor) == "#F08080") { // lightcoral
daytogglerepeating(week,daypos,true);
- }
- else //color is white cell
- {
- if (!runrepeat)
- {
+ } else { //color is white cell
+ if (!runrepeat) {
daycell.style.backgroundColor = "#FF0000"; // red
- }
- else
- {
+ } else {
daycell.style.backgroundColor = "#F08080"; // lightcoral
daytogglerepeating(week,daypos,false);
}
daysSelected += id + ",";
}
bFoundValid = true;
- }
- else
- {
+ } else {
//we found an invalid cell when column was clicked, move up to the next week
week++;
tempstr = "w" + week + "p" + daypos;
@@ -858,21 +846,19 @@ function update_month() {
option = document.forms[0].monthsel.options[i].text;
document.popupMonthLayer = eval('document.getElementById (option)');
- if (selected == option)
+ if (selected == option) {
document.popupMonthLayer.style.display="block";
- else
+ } else {
document.popupMonthLayer.style.display="none";
+ }
}
}
function checkForRanges() {
- if (daysSelected != "")
- {
+ if (daysSelected != "") {
alert("You have not saved the specified time range. Please click 'Add Time' button to save the time range.");
return false;
- }
- else
- {
+ } else {
return true;
}
}
@@ -888,14 +874,11 @@ function processEntries() {
stoptimemin = parseInt(document.getElementById("stoptimemin").value);
//do time checks
- if (starttimehour > stoptimehour)
- {
+ if (starttimehour > stoptimehour) {
errors = "Error: Start Hour cannot be greater than Stop Hour.";
passedValidiation = false;
- }
- else if (starttimehour == stoptimehour)
- {
+ } else if (starttimehour == stoptimehour) {
if (starttimemin > stoptimemin) {
errors = "Error: Start Minute cannot be greater than Stop Minute.";
passedValidiation = false;
@@ -904,10 +887,10 @@ function processEntries() {
if (passedValidiation) {
addTimeRange();
- }
- else {
- if (errors != "")
+ } else {
+ if (errors != "") {
alert(errors);
+ }
}
}
@@ -931,8 +914,7 @@ function addTimeRange() {
for (u = 0; u < 99; u++) {
findCurrentCounter = document.getElementById("schedule" + u);
- if (!findCurrentCounter)
- {
+ if (!findCurrentCounter) {
schCounter = u;
break;
}
@@ -941,18 +923,15 @@ function addTimeRange() {
if (daysSelected != "") {
//get days selected
- for (i = 0; i < tempdayarray.length; i++)
- {
+ for (i = 0; i < tempdayarray.length; i++) {
tempstr = tempdayarray[i];
- if (tempstr != "")
- {
+ if (tempstr != "") {
tempstrdaypos = tempstr.search("p");
week = tempstr.substring(1, tempstrdaypos);
week = parseInt(week);
dashpos = tempstr.search("-");
- if (dashpos != "-1")
- {
+ if (dashpos != "-1") {
var nonrepeatingfound = true;
daypos = tempstr.substring(tempstrdaypos+1, dashpos);
daypos = parseInt(daypos);
@@ -965,9 +944,7 @@ function addTimeRange() {
monthstr += month + ",";
daystr += day + ",";
nrtempID += tempstr + ",";
- }
- else
- {
+ } else {
var repeatingfound = true;
daypos = tempstr.substr(tempstrdaypos+1);
daypos = parseInt(daypos);
@@ -988,8 +965,7 @@ function addTimeRange() {
for (k = 0; k < tempFriendlyMonthArray.length; k++) {
tempstr = tempFriendlyMonthArray[k];
if (tempstr != "") {
- if (!firstDayFound)
- {
+ if (!firstDayFound) {
firstDay = tempFriendlyDayArray[k];
firstDay = parseInt(firstDay);
firstMonth = tempFriendlyMonthArray[k];
@@ -1006,15 +982,17 @@ function addTimeRange() {
currentDay++;
if ((currentDay != nextDay) || (tempFriendlyMonthArray[k] != tempFriendlyMonthArray[k+1])) {
- if (firstprint)
+ if (firstprint) {
nrtempFriendlyTime += ", ";
+ }
currentDay--;
- if (currentDay != firstDay)
+ if (currentDay != firstDay) {
nrtempFriendlyTime += month_array[firstMonth-1] + " " + firstDay + "-" + currentDay;
- else
+ } else {
nrtempFriendlyTime += month_array[firstMonth-1] + " " + currentDay;
+ }
firstDayFound = false;
firstprint = true;
@@ -1033,8 +1011,7 @@ function addTimeRange() {
for (k = 0; k < tempFriendlyDayArray.length; k++) {
tempstr = tempFriendlyDayArray[k];
if (tempstr != "") {
- if (!firstDayFound)
- {
+ if (!firstDayFound) {
firstDay = tempFriendlyDayArray[k];
firstDay = parseInt(firstDay);
firstDayFound = true;
@@ -1048,15 +1025,17 @@ function addTimeRange() {
currentDay++;
if (currentDay != nextDay) {
- if (firstprint)
+ if (firstprint) {
rtempFriendlyTime += ", ";
+ }
currentDay--;
- if (currentDay != firstDay)
+ if (currentDay != firstDay) {
rtempFriendlyTime += day_array[firstDay-1] + " - " + day_array[currentDay-1];
- else
+ } else {
rtempFriendlyTime += day_array[firstDay-1];
+ }
firstDayFound = false;
firstprint = true;
@@ -1072,15 +1051,14 @@ function addTimeRange() {
//clear tempID
rtempID = "";
- for (t = 0; t < tempsortArray.length; t++)
- {
+ for (t = 0; t < tempsortArray.length; t++) {
if (tempsortArray[t] != "") {
if (!isFirstdone) {
rtempID += tempsortArray[t];
isFirstdone = true;
- }
- else
+ } else {
rtempID += "," + tempsortArray[t];
+ }
}
}
@@ -1116,9 +1094,7 @@ function addTimeRange() {
insertElements(rtempFriendlyTime, starttimehour, starttimemin, stoptimehour, stoptimemin, tempdescr, rtempTime, rtempID);
}
- }
- else
- {
+ } else {
//no days were selected, alert user
alert ("You must select at least 1 day before adding time");
}
@@ -1129,8 +1105,7 @@ function clearCalendar() {
//clear days selected
daysSelected = "";
//loop through all 52 weeks
- for (j = 1; j <= 53; j++)
- {
+ for (j = 1; j <= 53; j++) {
//loop through all 7 days
for (k = 1; k < 8; k++) {
tempstr = 'w' + j + 'p' + k;
@@ -1164,7 +1139,7 @@ function insertElements(tempFriendlyTime, starttimehour, starttimemin, stoptimeh
rows_displayed = counter;
}
- // Template for the schedule deifinition. '@' will be replaced with the row number using .replace()
+ // Template for the schedule definition. '@' will be replaced with the row number using .replace()
rowhtml =
'<div class="form-group schedulegrp' + counter + '">' +
'<label for="tempFriendlyTime" class="col-sm-2 control-label"></label>' +
diff --git a/src/usr/local/www/firewall_shaper.php b/src/usr/local/www/firewall_shaper.php
index e439aed..1a9b9a9 100644
--- a/src/usr/local/www/firewall_shaper.php
+++ b/src/usr/local/www/firewall_shaper.php
@@ -76,7 +76,7 @@ if ($_GET['reset'] != "") {
exit;
}
-$pgtitle = array(gettext("Firewall"), gettext("Traffic Shaper"));
+$pgtitle = array(gettext("Firewall"), gettext("Traffic Shaper"), gettext("Interfaces"));
$shortcut_section = "trafficshaper";
$shaperIFlist = get_configured_interface_with_descr();
@@ -120,7 +120,6 @@ if ($interface) {
}
}
-
$dontshow = false;
$newqueue = false;
$dfltmsg = false;
@@ -204,16 +203,23 @@ if ($_GET) {
$q = new altq_root_queue();
} else {
$input_errors[] = gettext("Could not create new queue/discipline!");
- }
+ }
- if ($q) {
- $q->SetInterface($interface);
- $sform = $q->build_form();
- $newjavascript = $q->build_javascript();
- unset($q);
- $newqueue = true;
- }
- break;
+ if ($q) {
+ $q->SetInterface($interface);
+ $sform = $q->build_form();
+ $sform->addGlobal(new Form_Input(
+ 'parentqueue',
+ null,
+ 'hidden',
+ $qname
+ ));
+
+ $newjavascript = $q->build_javascript();
+ unset($q);
+ $newqueue = true;
+ }
+ break;
case "show":
if ($queue) {
$sform = $queue->build_form();
@@ -493,7 +499,6 @@ if (!$dfltmsg) {
}
- // Print the form
print($sform);
}
?>
diff --git a/src/usr/local/www/firewall_shaper_queues.php b/src/usr/local/www/firewall_shaper_queues.php
index 2794a07..0e67215 100644
--- a/src/usr/local/www/firewall_shaper_queues.php
+++ b/src/usr/local/www/firewall_shaper_queues.php
@@ -160,8 +160,9 @@ if ($_GET) {
$config['shaper']['queue'][] = $newroot;
}
- if (write_config())
+ if (write_config()) {
mark_subsystem_dirty('shaper');
+ }
break;
}
@@ -177,17 +178,19 @@ if ($_GET) {
if ($altq) {
$qtmp =& $altq->find_queue("", $qname);
- if ($qtmp)
+ if ($qtmp) {
$output .= $qtmp->build_shortform();
- else
+ } else {
$output .= build_iface_without_this_queue($if, $qname);
-
+ }
} else {
- if (!is_altq_capable($ifdesc['if']))
+ if (!is_altq_capable($ifdesc['if'])) {
continue;
+ }
- if (!isset($ifdesc['enable']) && $if != "lan" && $if != "wan")
+ if (!isset($ifdesc['enable']) && $if != "lan" && $if != "wan") {
continue;
+ }
$output .= build_iface_without_this_queue($if, $qname);
}
@@ -228,14 +231,17 @@ include("head.inc");
<script type="text/javascript" src="./tree/tree.js"></script>
<?php
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg);
+}
-if (is_subsystem_dirty('shaper'))
+if (is_subsystem_dirty('shaper')) {
print_info_box_np(gettext("The traffic shaper configuration has been changed. You must apply the changes in order for them to take effect."));
+}
$tab_array = array();
$tab_array[] = array(gettext("By Interface"), false, "firewall_shaper.php");
diff --git a/src/usr/local/www/firewall_shaper_vinterface.php b/src/usr/local/www/firewall_shaper_vinterface.php
index 18ad00a..753f0e5 100644
--- a/src/usr/local/www/firewall_shaper_vinterface.php
+++ b/src/usr/local/www/firewall_shaper_vinterface.php
@@ -198,8 +198,9 @@ if ($_GET) {
} else if ($addnewpipe) {
$q = new dnpipe_class();
$q->SetQname($pipe);
- } else
+ } else {
$input_errors[] = gettext("Could not create new queue/discipline!");
+ }
if ($q) {
$sform = $q->build_form();
@@ -220,8 +221,9 @@ if ($_GET) {
$queue->SetEnabled("on");
$sform = $queue->build_form();
$queue->wconfig();
- if (write_config())
+ if (write_config()) {
mark_subsystem_dirty('shaper');
+ }
} else {
$input_errors[] = gettext("Queue not found!");
}
@@ -231,8 +233,9 @@ if ($_GET) {
$queue->SetEnabled("");
$sform = $queue->build_form();
$queue->wconfig();
- if (write_config())
+ if (write_config()) {
mark_subsystem_dirty('shaper');
+ }
} else {
$input_errors[] = gettext("Queue not found!");
}
@@ -351,8 +354,9 @@ if ($queue) {
}
if ($queue->CanHaveChildren()) {
$can_add = true;
- } else
+ } else {
$can_add = false;
+ }
}
$tree = "<ul class=\"tree\" >";
@@ -469,7 +473,7 @@ if ($dfltmsg) {
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
+events.push(function() {
// Disables the specified input element
function disableInput(id, disable) {
diff --git a/src/usr/local/www/firewall_shaper_wizards.php b/src/usr/local/www/firewall_shaper_wizards.php
index 4bfb9a8..4246201 100644
--- a/src/usr/local/www/firewall_shaper_wizards.php
+++ b/src/usr/local/www/firewall_shaper_wizards.php
@@ -107,8 +107,9 @@ $wizards = array(
$closehead = false;
include("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
$tab_array = array();
$tab_array[] = array(gettext("By Interface"), false, "firewall_shaper.php");
@@ -117,11 +118,13 @@ $tab_array[] = array(gettext("Limiter"), false, "firewall_shaper_vinterface.php"
$tab_array[] = array(gettext("Wizards"), true, "firewall_shaper_wizards.php");
display_top_tabs($tab_array);
-if ($savemsg)
+if ($savemsg) {
print_info_box($savemsg, 'success');
+}
-if (is_subsystem_dirty('shaper'))
+if (is_subsystem_dirty('shaper')) {
print_info_box_np(gettext("The traffic shaper configuration has been changed.") . "<br />" . gettext("You must apply the changes in order for them to take effect."));
+}
?>
<div class="panel panel-default">
diff --git a/src/usr/local/www/firewall_virtual_ip.php b/src/usr/local/www/firewall_virtual_ip.php
index 7637278..45fb083 100644
--- a/src/usr/local/www/firewall_virtual_ip.php
+++ b/src/usr/local/www/firewall_virtual_ip.php
@@ -275,12 +275,13 @@ $types = array('proxyarp' => 'Proxy ARP',
$pgtitle = array(gettext("Firewall"), gettext("Virtual IP Addresses"));
include("head.inc");
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
-else if ($savemsg)
+} else if ($savemsg) {
print_info_box($savemsg, 'success');
-else if (is_subsystem_dirty('vip'))
+} else if (is_subsystem_dirty('vip')) {
print_info_box_np(gettext("The VIP configuration has been changed.")."<br />".gettext("You must apply the changes in order for them to take effect."));
+}
/* active tabs
$tab_array = array();
@@ -307,8 +308,9 @@ display_top_tabs($tab_array);
$interfaces = get_configured_interface_with_descr(false, true);
$carplist = get_configured_carp_interface_list();
-foreach ($carplist as $cif => $carpip)
+foreach ($carplist as $cif => $carpip) {
$interfaces[$cif] = $carpip." (".get_vip_descr($carpip).")";
+}
$interfaces['lo0'] = "Localhost";
@@ -320,15 +322,19 @@ foreach ($a_vip as $vipent):
<tr>
<td>
<?php
- if (($vipent['type'] == "single") || ($vipent['type'] == "network"))
- if ($vipent['subnet_bits'])
+ if (($vipent['type'] == "single") || ($vipent['type'] == "network")) {
+ if ($vipent['subnet_bits']) {
print("{$vipent['subnet']}/{$vipent['subnet_bits']}");
+ }
+ }
- if ($vipent['type'] == "range")
- print("{$vipent['range']['from']}-{$vipent['range']['to']}");
+ if ($vipent['type'] == "range") {
+ print("{$vipent['range']['from']}-{$vipent['range']['to']}");
+ }
- if ($vipent['mode'] == "carp")
- print(" (vhid: {$vipent['vhid']})");
+ if ($vipent['mode'] == "carp") {
+ print(" (vhid: {$vipent['vhid']})");
+ }
?>
</td>
<td>
@@ -364,7 +370,7 @@ endforeach;
<div id="infoblock">
<?=print_info_box(gettext('The virtual IP addresses defined on this page may be used in ') . '<a href="firewall_nat.php">' . gettext('NAT') . '</a>' . gettext(' mappings.') . '<br />' .
- gettext('You can check the status of your CARP Virtual IPs and interfaces ') . '<a href="carp_status.php">' . gettext('here') . '</a>', info)?>
+ gettext('You can check the status of your CARP Virtual IPs and interfaces ') . '<a href="status_carp.php">' . gettext('here') . '</a>', info)?>
</div>
<?php
diff --git a/src/usr/local/www/firewall_virtual_ip_edit.php b/src/usr/local/www/firewall_virtual_ip_edit.php
index ebdccc4..9d30ce7 100644
--- a/src/usr/local/www/firewall_virtual_ip_edit.php
+++ b/src/usr/local/www/firewall_virtual_ip_edit.php
@@ -202,19 +202,22 @@ if ($_POST) {
case 'carp':
/* verify against reusage of vhids */
$idtracker = 0;
- foreach($config['virtualip']['vip'] as $vip) {
- if($vip['vhid'] == $_POST['vhid'] && $vip['interface'] == $_POST['interface'] && $idtracker != $id)
- $input_errors[] = sprintf(gettext("VHID %s is already in use on interface %s. Pick a unique number on this interface."),$_POST['vhid'], convert_friendly_interface_to_friendly_descr($_POST['interface']));
+ foreach ($config['virtualip']['vip'] as $vip) {
+ if ($vip['vhid'] == $_POST['vhid'] && $vip['interface'] == $_POST['interface'] && $idtracker != $id) {
+ $input_errors[] = sprintf(gettext("VHID %s is already in use on interface %s. Pick a unique number on this interface."), $_POST['vhid'], convert_friendly_interface_to_friendly_descr($_POST['interface']));
+ }
$idtracker++;
}
- if (empty($_POST['password']))
+ if (empty($_POST['password'])) {
$input_errors[] = gettext("You must specify a CARP password that is shared between the two VHID members.");
+ }
- if ($_POST['interface'] == 'lo0')
+ if ($_POST['interface'] == 'lo0') {
$input_errors[] = gettext("For this type of vip localhost is not allowed.");
- else if (strpos($_POST['interface'], '_vip'))
+ } else if (strpos($_POST['interface'], '_vip')) {
$input_errors[] = gettext("A CARP parent interface can only be used with IP Alias type Virtual IPs.");
+ }
break;
case 'ipalias':
@@ -230,9 +233,9 @@ if ($_POST) {
}
if (isset($parent_ip) && !ip_in_subnet($_POST['subnet'], "{$subnet}/{$parent_sn}") &&
- !ip_in_interface_alias_subnet(link_carp_interface_to_parent($_POST['interface']), $_POST['subnet'])) {
+ !ip_in_interface_alias_subnet(link_carp_interface_to_parent($_POST['interface']), $_POST['subnet'])) {
$cannot_find = $_POST['subnet'] . "/" . $_POST['subnet_bits'] ;
- $input_errors[] = sprintf(gettext("Sorry, we could not locate an interface with a matching subnet for %s. Please add an IP alias in this subnet on this interface."),$cannot_find);
+ $input_errors[] = sprintf(gettext("Sorry, we could not locate an interface with a matching subnet for %s. Please add an IP alias in this subnet on this interface."), $cannot_find);
}
unset($parent_ip, $parent_sn, $subnet);
@@ -240,10 +243,11 @@ if ($_POST) {
break;
default:
- if ($_POST['interface'] == 'lo0')
+ if ($_POST['interface'] == 'lo0') {
$input_errors[] = gettext("For this type of vip localhost is not allowed.");
- else if (strpos($_POST['interface'], '_vip'))
+ } else if (strpos($_POST['interface'], '_vip')) {
$input_errors[] = gettext("A CARP parent interface can only be used with IP Alias type Virtual IPs.");
+ }
break;
}
@@ -327,7 +331,7 @@ if ($_POST) {
$ipaliashelp = gettext('The mask must be the network\'s subnet mask. It does not specify a CIDR range.');
$proxyarphelp = gettext('Enter a CIDR block of proxy ARP addresses.');
-$pgtitle = array(gettext("Firewall"),gettext("Virtual IP Address"),gettext("Edit"));
+$pgtitle = array(gettext("Firewall"), gettext("Virtual IP Address"), gettext("Edit"));
include("head.inc");
function build_if_list() {
@@ -336,16 +340,18 @@ function build_if_list() {
$interfaces = get_configured_interface_with_descr(false, true);
$carplist = get_configured_carp_interface_list();
- foreach ($carplist as $cif => $carpip)
+ foreach ($carplist as $cif => $carpip) {
$interfaces[$cif] = $carpip . ' (' . get_vip_descr($carpip) . ')';
+ }
$interfaces['lo0'] = 'Localhost';
return($interfaces);
}
-if ($input_errors)
+if ($input_errors) {
print_input_errors($input_errors);
+}
$form = new Form();
@@ -485,14 +491,15 @@ print($form);
<script type="text/javascript">
//<![CDATA[
-events.push(function(){
+events.push(function() {
// Hides the <div> in which the specified checkbox lives so that the checkbox, its label and help text are hidden
function hideCheckbox(id, hide) {
- if(hide)
+ if (hide) {
$('#' + id).parent().parent().parent('div').addClass('hidden');
- else
+ } else {
$('#' + id).parent().parent().parent('div').removeClass('hidden');
+ }
}
// Disables the specified input element
@@ -512,13 +519,12 @@ events.push(function(){
disableInput('password', true);
hideCheckbox('noexpand', true);
- if(mode == 'ipalias') {
+ if (mode == 'ipalias') {
$('#address_note').html("<?=$ipaliashelp?>");
$('#type').val('single');
disableInput('subnet_bits', false);
- }
- else if(mode == 'carp') {
+ } else if (mode == 'carp') {
$('#address_note').html("<?=$ipaliashelp?>");
disableInput('vhid', false);
disableInput('advbase', false);
@@ -526,13 +532,11 @@ events.push(function(){
disableInput('password', false);
disableInput('subnet_bits', false);
$('#type').val('single');
- }
- else if(mode == 'proxyarp') {
+ } else if (mode == 'proxyarp') {
$('#address_note').html("<?=$proxyarphelp?>");
disableInput('type', false);
disableInput('subnet_bits', ($('#type').val() == 'single'));
- }
- else {
+ } else {
$('#address_note').html('');
disableInput('type', false);
disableInput('subnet_bits', ($('#type').val() == 'single'));
diff --git a/src/usr/local/www/guiconfig.inc b/src/usr/local/www/guiconfig.inc
index 735c460..7c9c7d8 100644
--- a/src/usr/local/www/guiconfig.inc
+++ b/src/usr/local/www/guiconfig.inc
@@ -87,15 +87,6 @@ require_once("functions.inc");
/* Include the autoloader for all the GUI display classes */
require_once("classes/autoload.inc.php");
-/* Set the default interface language */
-if ($config['system']['language'] <> "") {
- $g['language'] = $config['system']['language'];
-} elseif ($g['language'] == "") {
- $g['language'] = 'en_US';
-}
-
-set_language($g['language']);
-
/* used by progress bar */
$lastseen = "-1";
@@ -572,6 +563,7 @@ function clear_log_file($logfile = "/var/log/system.log", $restart_syslogd = tru
touch($logfile);
} else {
$log_size = isset($config['syslog']['logfilesize']) ? $config['syslog']['logfilesize'] : "511488";
+ $log_size = isset($config['syslog'][basename($logfile, '.log') . '_settings']['logfilesize']) ? $config['syslog'][basename($logfile, '.log') . '_settings']['logfilesize'] : $log_size;
if (isset($config['system']['usefifolog'])) {
exec("/usr/sbin/fifolog_create -s {$log_size} " . escapeshellarg($logfile));
} else {
@@ -602,6 +594,9 @@ function clear_all_log_files() {
function dump_clog_no_table($logfile, $tail, $withorig = true, $grepfor = "", $grepinvert = "") {
global $g, $config;
$sor = isset($config['syslog']['reverse']) ? "-r" : "";
+ $specific_log = basename($logfile, '.log') . '_settings';
+ if ($config['syslog'][$specific_log]['cronorder'] == 'forward') $sor = "";
+ if ($config['syslog'][$specific_log]['cronorder'] == 'reverse') $sor = "-r";
$logarr = "";
$grepline = " ";
if (is_array($grepfor))
@@ -651,6 +646,9 @@ function dump_clog_no_table($logfile, $tail, $withorig = true, $grepfor = "", $g
function dump_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinvert = "") {
global $g, $config;
$sor = isset($config['syslog']['reverse']) ? "-r" : "";
+ $specific_log = basename($logfile, '.log') . '_settings';
+ if ($config['syslog'][$specific_log]['cronorder'] == 'forward') $sor = "";
+ if ($config['syslog'][$specific_log]['cronorder'] == 'reverse') $sor = "-r";
$logarr = "";
$grepline = " ";
if (is_array($grepfor)) {
@@ -702,6 +700,9 @@ function dump_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinvert
function return_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinvert = "", $grepreverse = false) {
global $g, $config;
$sor = (isset($config['syslog']['reverse']) || $grepreverse) ? "-r" : "";
+ $specific_log = basename($logfile, '.log') . '_settings';
+ if (($config['syslog'][$specific_log]['cronorder'] == 'forward') && !$grepreverse) $sor = "";
+ if (($config['syslog'][$specific_log]['cronorder'] == 'reverse') || $grepreverse) $sor = "-r";
$logarr = "";
$grepline = " ";
if (is_array($grepfor)) {
diff --git a/src/usr/local/www/head.inc b/src/usr/local/www/head.inc
index c951d6e..0fb30e6 100755
--- a/src/usr/local/www/head.inc
+++ b/src/usr/local/www/head.inc
@@ -72,7 +72,7 @@ if (isset($config['system']['webgui']['pagenamefirst'])) {
$cssfile = "/bootstrap/css/pfSense.css";
if (isset($config['system']['webgui']['webguicss'])) {
- if(file_exists("bootstrap/css/" . $config['system']['webgui']['webguicss'])) {
+ if (file_exists("/usr/local/www/bootstrap/css/" . $config['system']['webgui']['webguicss'])) {
$cssfile = "/bootstrap/css/" . $config['system']['webgui']['webguicss'];
}
}
@@ -252,10 +252,10 @@ if ($g['services_dhcp_server_enable']) {
}
$services_menu[] = array(gettext("Dynamic DNS"), "/services_dyndns.php");
-$services_menu[] = array(gettext("IGMP proxy"), "/services_igmpproxy.php");
+$services_menu[] = array(gettext("IGMP Proxy"), "/services_igmpproxy.php");
$services_menu[] = array(gettext("Load Balancer"), "/load_balancer_pool.php");
$services_menu[] = array(gettext("NTP"), "/services_ntpd.php");
-$services_menu[] = array(gettext("PPPoE Server"), "/vpn_pppoe.php");
+$services_menu[] = array(gettext("PPPoE Server"), "/services_pppoe.php");
$services_menu[] = array(gettext("SNMP"), "/services_snmp.php");
if (count($config['interfaces']) > 1) {
@@ -279,26 +279,26 @@ $vpn_menu = msort(array_merge($vpn_menu, return_ext_menu("VPN")), 0);
// Status
$status_menu = array();
$status_menu[] = array(gettext("Captive Portal"), "/status_captiveportal.php");
-$status_menu[] = array(gettext("CARP (failover)"), "/carp_status.php");
+$status_menu[] = array(gettext("CARP (failover)"), "/status_carp.php");
$status_menu[] = array(gettext("Dashboard"), "/index.php");
$status_menu[] = array(gettext("Gateways"), "/status_gateways.php");
$status_menu[] = array(gettext("DHCP Leases"), "/status_dhcp_leases.php");
$status_menu[] = array(gettext("DHCPv6 Leases"), "/status_dhcpv6_leases.php");
$status_menu[] = array(gettext("Filter Reload"), "/status_filter_reload.php");
$status_menu[] = array(gettext("Interfaces"), "/status_interfaces.php");
-$status_menu[] = array(gettext("IPsec"), "/diag_ipsec.php");
+$status_menu[] = array(gettext("IPsec"), "/status_ipsec.php");
$status_menu[] = array(gettext("Load Balancer"), "/status_lb_pool.php");
$status_menu[] = array(gettext("NTP"), "/status_ntpd.php");
$status_menu[] = array(gettext("OpenVPN"), "/status_openvpn.php");
if ($g['platform'] == $g['product_name']) {
- $status_menu[] = array(gettext("Package Logs"), "/diag_pkglogs.php");
+ $status_menu[] = array(gettext("Package Logs"), "/status_pkglogs.php");
}
$status_menu[] = array(gettext("Queues"), "/status_queues.php");
$status_menu[] = array(gettext("RRD Graphs"), "/status_rrd_graph.php");
$status_menu[] = array(gettext("Services"), "/status_services.php");
-$status_menu[] = array(gettext("System Logs"), "/diag_logs.php");
+$status_menu[] = array(gettext("System Logs"), "/status_logs.php");
$status_menu[] = array(gettext("Traffic Graph"), "/status_graph.php?if=wan");
if (count($config['interfaces']) > 1) {
@@ -333,15 +333,15 @@ if (file_exists("/var/run/gmirror_active")) {
$diagnostics_menu[] = array(gettext("GEOM Mirrors"), "/diag_gmirror.php");
}
-$diagnostics_menu[] = array(gettext("Halt System"), "/halt.php");
+$diagnostics_menu[] = array(gettext("Halt System"), "/diag_halt.php");
$diagnostics_menu[] = array(gettext("Limiter Info"), "/diag_limiter_info.php");
$diagnostics_menu[] = array(gettext("NDP Table"), "/diag_ndp.php");
$diagnostics_menu[] = array(gettext("Tables"), "/diag_tables.php");
$diagnostics_menu[] = array(gettext("Ping"), "/diag_ping.php");
$diagnostics_menu[] = array(gettext("Test Port"), "/diag_testport.php");
$diagnostics_menu[] = array(gettext("pfInfo"), "/diag_pf_info.php");
-$diagnostics_menu[] = array(gettext("pfTop"), "/diag_system_pftop.php");
-$diagnostics_menu[] = array(gettext("Reboot"), "/reboot.php");
+$diagnostics_menu[] = array(gettext("pfTop"), "/diag_pftop.php");
+$diagnostics_menu[] = array(gettext("Reboot"), "/diag_reboot.php");
$diagnostics_menu[] = array(gettext("Routes"), "/diag_routes.php");
$diagnostics_menu[] = array(gettext("SMART Status"), "/diag_smart.php");
$diagnostics_menu[] = array(gettext("Sockets"), "/diag_sockets.php");
@@ -377,7 +377,7 @@ if (!$g['disablehelpmenu']) {
$help_menu[] = array(gettext("Developers Wiki"), "https://www.pfsense.org/j.php?jumpto=devwiki");
$help_menu[] = array(gettext("Paid Support"), "https://www.pfsense.org/j.php?jumpto=portal");
$help_menu[] = array(gettext("pfSense Book"), "https://www.pfsense.org/j.php?jumpto=book");
- $help_menu[] = array(gettext("Search portal"), "https://www.pfsense.org/j.php?jumpto=searchportal");
+ $help_menu[] = array(gettext("Search Portal"), "https://www.pfsense.org/j.php?jumpto=searchportal");
$help_menu[] = array(gettext("FreeBSD Handbook"), "https://www.pfsense.org/j.php?jumpto=fbsdhandbook");
$help_menu = msort(array_merge($help_menu, return_ext_menu("Help")), 0);
}
diff --git a/src/usr/local/www/help.php b/src/usr/local/www/help.php
index 70e0c6c..485e33f 100644
--- a/src/usr/local/www/help.php
+++ b/src/usr/local/www/help.php
@@ -79,7 +79,7 @@ $helppages = array(
'interfaces_vlan_edit.php' => 'https://doc.pfsense.org/index.php/VLAN_Trunking',
'diag_routes.php' => 'https://doc.pfsense.org/index.php/Viewing_Routes',
'diag_packet_capture.php' => 'https://doc.pfsense.org/index.php/Sniffers,_Packet_Capture',
- 'diag_system_pftop.php' => 'https://doc.pfsense.org/index.php/How_can_I_monitor_bandwidth_usage#pftop',
+ 'diag_pftop.php' => 'https://doc.pfsense.org/index.php/How_can_I_monitor_bandwidth_usage#pftop',
'status_rrd_graph.php' => 'https://doc.pfsense.org/index.php/RRD_Graphs',
'status_rrd_graph_img.php' => 'https://doc.pfsense.org/index.php/RRD_Graphs',
'status_rrd_graph_settings.php' => 'https://doc.pfsense.org/index.php/RRD_Graphs',
@@ -98,22 +98,22 @@ $helppages = array(
'diag_dns.php' => 'https://doc.pfsense.org/index.php/DNS_Lookup',
'diag_dump_states.php' => 'https://doc.pfsense.org/index.php/Show_States',
'diag_resetstate.php' => 'https://doc.pfsense.org/index.php/Reset_States',
- 'diag_logs.php' => 'https://doc.pfsense.org/index.php/System_Logs',
+ 'status_logs.php' => 'https://doc.pfsense.org/index.php/System_Logs',
'diag_logs_auth.php' => 'https://doc.pfsense.org/index.php/Captive_Portal_Authentication_Logs',
'diag_logs_dhcp.php' => 'https://doc.pfsense.org/index.php/DHCP_Logs',
- 'diag_logs_filter.php' => 'https://doc.pfsense.org/index.php/Firewall_Logs',
- 'diag_logs_filter_dynamic.php' => 'https://doc.pfsense.org/index.php/Firewall_Logs',
- 'diag_logs_filter_summary.php' => 'https://doc.pfsense.org/index.php/Firewall_Logs',
+ 'status_logs_filter.php' => 'https://doc.pfsense.org/index.php/Firewall_Logs',
+ 'status_logs_filter_dynamic.php' => 'https://doc.pfsense.org/index.php/Firewall_Logs',
+ 'status_logs_filter_summary.php' => 'https://doc.pfsense.org/index.php/Firewall_Logs',
'diag_logs_ntpd.php' => 'https://doc.pfsense.org/index.php/NTP_Logs',
'diag_logs_ppp.php' => 'https://doc.pfsense.org/index.php/PPP_Logs',
'diag_logs_relayd.php' => 'https://doc.pfsense.org/index.php/Load_Balancer_Logs',
- 'diag_logs_settings.php' => 'https://doc.pfsense.org/index.php/Log_Settings',
- 'diag_logs_vpn.php' => 'https://doc.pfsense.org/index.php/PPTP_VPN_Logs',
+ 'status_logs_settings.php' => 'https://doc.pfsense.org/index.php/Log_Settings',
+ 'status_logs_vpn.php' => 'https://doc.pfsense.org/index.php/PPTP_VPN_Logs',
'diag_logs_ipsec.php' => 'https://doc.pfsense.org/index.php/IPsec_Logs',
'diag_logs_openvpn.php' => 'https://doc.pfsense.org/index.php/OpenVPN_Logs',
'diag_nanobsd.php' => 'https://doc.pfsense.org/index.php/NanoBSD_Diagnostics',
'diag_ping.php' => 'https://doc.pfsense.org/index.php/Ping_Host',
- 'diag_pkglogs.php' => 'https://doc.pfsense.org/index.php/Package_Logs',
+ 'status_pkglogs.php' => 'https://doc.pfsense.org/index.php/Package_Logs',
'diag_tables.php' => 'https://doc.pfsense.org/index.php/Tables',
'diag_system_activity.php' => 'https://doc.pfsense.org/index.php/System_Activity',
'diag_traceroute.php' => 'https://doc.pfsense.org/index.php/Traceroute',
@@ -122,8 +122,8 @@ $helppages = array(
'exec.php' => 'https://doc.pfsense.org/index.php/Execute_Command',
'firewall_nat_1to1.php' => 'https://doc.pfsense.org/index.php/1:1_NAT',
'firewall_nat_1to1_edit.php' => 'https://doc.pfsense.org/index.php/1:1_NAT',
- 'halt.php' => 'https://doc.pfsense.org/index.php/Halt_System',
- 'reboot.php' => 'https://doc.pfsense.org/index.php/Reboot_System',
+ 'diag_halt.php' => 'https://doc.pfsense.org/index.php/Halt_System',
+ 'diag_reboot.php' => 'https://doc.pfsense.org/index.php/Reboot_System',
'status_filter_reload.php' => 'https://doc.pfsense.org/index.php/Filter_Reload_Status',
'status_gateway_groups.php' => 'https://doc.pfsense.org/index.php/Gateway_Status',
'status_gateways.php' => 'https://doc.pfsense.org/index.php/Gateway_Status',
@@ -194,17 +194,17 @@ $helppages = array(
'vpn_l2tp.php' => 'https://doc.pfsense.org/index.php/L2TP_VPN_Settings',
'vpn_l2tp_users.php' => 'https://doc.pfsense.org/index.php/L2TP_VPN_Settings',
'vpn_l2tp_users_edit.php' => 'https://doc.pfsense.org/index.php/L2TP_VPN_Settings',
- 'vpn_pppoe.php' => 'https://doc.pfsense.org/index.php/PPPoE_Server_Settings',
- 'vpn_pppoe_edit.php' => 'https://doc.pfsense.org/index.php/PPPoE_Server_Settings',
+ 'services_pppoe.php' => 'https://doc.pfsense.org/index.php/PPPoE_Server_Settings',
+ 'services_pppoe_edit.php' => 'https://doc.pfsense.org/index.php/PPPoE_Server_Settings',
'vpn_pptp.php' => 'https://doc.pfsense.org/index.php/PPTP_VPN_Settings',
'vpn_pptp_users.php' => 'https://doc.pfsense.org/index.php/PPTP_VPN_Settings',
'vpn_pptp_users_edit.php' => 'https://doc.pfsense.org/index.php/PPTP_VPN_Settings',
- 'diag_ipsec.php' => 'https://doc.pfsense.org/index.php/IPsec_Status',
- 'diag_ipsec_sad.php' => 'https://doc.pfsense.org/index.php/IPsec_Status',
- 'diag_ipsec_spd.php' => 'https://doc.pfsense.org/index.php/IPsec_Status',
+ 'status_ipsec.php' => 'https://doc.pfsense.org/index.php/IPsec_Status',
+ 'status_ipsec_sad.php' => 'https://doc.pfsense.org/index.php/IPsec_Status',
+ 'status_ipsec_spd.php' => 'https://doc.pfsense.org/index.php/IPsec_Status',
'vpn_ipsec.php' => 'https://doc.pfsense.org/index.php/IPsec_Tunnels',
'vpn_ipsec_mobile.php' => 'https://doc.pfsense.org/index.php/IPsec_Mobile_Clients',
- 'diag_ipsec_leases.php' => 'https://doc.pfsense.org/index.php/IPsec_Mobile_Clients',
+ 'status_ipsec_leases.php' => 'https://doc.pfsense.org/index.php/IPsec_Mobile_Clients',
'vpn_ipsec_phase1.php' => 'https://doc.pfsense.org/index.php/IPsec_Tunnels',
'vpn_ipsec_phase2.php' => 'https://doc.pfsense.org/index.php/IPsec_Tunnels',
'vpn_ipsec_keys.php' => 'https://doc.pfsense.org/index.php/IPsec_Tunnels',
@@ -270,7 +270,7 @@ $helppages = array(
'services_dhcpv6.php' => 'https://doc.pfsense.org/index.php/DHCPv6_Server',
'services_dhcpv6_edit.php' => 'https://doc.pfsense.org/index.php/DHCPv6_Server',
'services_router_advertisements.php' => 'https://doc.pfsense.org/index.php/Router_Advertisements',
- 'carp_status.php' => 'https://doc.pfsense.org/index.php/CARP_Status',
+ 'status_carp.php' => 'https://doc.pfsense.org/index.php/CARP_Status',
'system_hasync.php' => 'https://doc.pfsense.org/index.php/High_Availability',
'services_unbound.php' => 'https://doc.pfsense.org/index.php/Unbound_DNS_Resolver',
'services_unbound_advanced.php' => 'https://doc.pfsense.org/index.php/Unbound_DNS_Resolver#Advanced_Settings_Tab',
diff --git a/src/usr/local/www/index.php b/src/usr/local/www/index.php
index 52b0a2f..350ddb7 100644
--- a/src/usr/local/www/index.php
+++ b/src/usr/local/www/index.php
@@ -116,11 +116,40 @@ if ($g['disablecrashreporter'] != true) {
}
}
+##build list of php include files
+$phpincludefiles = array();
+$directory = "/usr/local/www/widgets/include/";
+$dirhandle = opendir($directory);
+$filename = "";
+
+while (false !== ($filename = readdir($dirhandle))) {
+ $phpincludefiles[] = $filename;
+}
+
+## Include each widget include file.
+## These define vars that specify the widget title and title link.
+foreach ($phpincludefiles as $includename) {
+ if (!stristr($includename, ".inc")) {
+ continue;
+ }
+ if (file_exists($directory . $includename)) {
+ include($directory . $includename);
+ }
+}
+
##build list of widgets
foreach (glob("/usr/local/www/widgets/widgets/*.widget.php") as $file)
{
$name = basename($file, '.widget.php');
- $widgets[ $name ] = array('name' => ucwords(str_replace('_', ' ', $name)), 'display' => 'none');
+ // Get the widget title that should be in a var defined in the widget's inc file.
+ $widgettitle = ${$name . '_title'};
+
+ if ((strlen($widgettitle) == 0)) {
+ // Fall back to constructing a title from the file name of the widget.
+ $widgettitle = ucwords(str_replace('_', ' ', $name));
+ }
+
+ $widgets[ $name ] = array('name' => $widgettitle, 'display' => 'none');
}
##insert the system information widget as first, so as to be displayed first
@@ -242,8 +271,16 @@ if ($config['widgets'] && $config['widgets']['sequence'] != "") {
if (false !== $offset)
$file = substr($file, 0, $offset);
+ // Get the widget title that should be in a var defined in the widget's inc file.
+ $widgettitle = ${$file . '_title'};
+
+ if ((strlen($widgettitle) == 0)) {
+ // Fall back to constructing a title from the file name of the widget.
+ $widgettitle = ucwords(str_replace('_', ' ', $file));
+ }
+
$widgetsfromconfig[ $file ] = array(
- 'name' => ucwords(str_replace('_', ' ', $file)),
+ 'name' => $widgettitle,
'col' => $col,
'display' => $display,
);
@@ -260,32 +297,6 @@ if ($config['widgets'] && $config['widgets']['sequence'] != "") {
}
}
-## Replace any known acronyms in widget names with suitable mixed-case forms
-$input_acronyms = array("carp", "dns", "dyn dns", "gmirror", "ipsec", "ntp", "openvpn", "rss", "smart");
-$output_acronyms = array("CARP", "DNS", "Dynamic DNS", "gmirror", "IPsec", "NTP", "OpenVPN", "RSS", "SMART");
-foreach ($widgets as $widgetname => $widgetconfig) {
- $widgets[$widgetname]['name'] = str_ireplace($input_acronyms, $output_acronyms, $widgetconfig['name']);
-}
-
-##build list of php include files
-$phpincludefiles = array();
-$directory = "/usr/local/www/widgets/include/";
-$dirhandle = opendir($directory);
-$filename = "";
-
-while (false !== ($filename = readdir($dirhandle))) {
- $phpincludefiles[] = $filename;
-}
-
-foreach ($phpincludefiles as $includename) {
- if (!stristr($includename, ".inc")) {
- continue;
- }
- if (file_exists($directory . $includename)) {
- include($directory . $includename);
- }
-}
-
## Set Page Title and Include Header
$pgtitle = array(gettext("Status"), gettext("Dashboard"));
include("head.inc");
@@ -301,19 +312,19 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard");
<div class="panel panel-default" id="widget-available">
<div class="panel-heading"><?=gettext("Available Widgets"); ?>
<span class="widget-heading-icon">
- <a data-toggle="collapse" href="#widget-available .panel-body" name="widgets-available">
+ <a data-toggle="collapse" href="#widget-available_panel-body" id="widgets-available">
<i class="fa fa-plus-circle"></i>
</a>
</span>
</div>
- <div class="panel-body collapse out">
+ <div id="widget-available_panel-body" class="panel-body collapse out">
<div class="content">
<div class="row">
<?php
foreach ($widgets as $widgetname => $widgetconfig):
if ($widgetconfig['display'] == 'none'):
?>
- <div class="col-sm-3"><a href="#" name="btnadd-<?=$widgetname?>"><i class="fa fa-plus"></i> <?=$widgetconfig['name']?></a></div>
+ <div class="col-sm-3"><a href="#" id="btnadd-<?=$widgetname?>"><i class="fa fa-plus"></i> <?=$widgetconfig['name']?></a></div>
<?php endif; ?>
<?php endforeach; ?>
</div>
@@ -344,7 +355,7 @@ foreach ($widgets as $widgetname => $widgetconfig):
</div>
<div class="hidden" id="widgetSequence">
- <form action="/" method="post" id="widgetSequence" name="widgetForm">
+ <form action="/" method="post" id="widgetSequence_Form" name="widgetForm">
<input type="hidden" name="sequence" value="" />
<button type="submit" id="btnstore" class="btn btn-primary">Store widget configuration</button>
@@ -376,15 +387,26 @@ foreach ($widgets as $widgetname => $widgetconfig)
?>
<?php foreach ($widgetColumns as $column => $columnWidgets):?>
<div class="col-md-<?=$columnWidth?>" id="widgets-<?=$column?>">
-<?php foreach ($columnWidgets as $widgetname => $widgetconfig):?>
+<?php foreach ($columnWidgets as $widgetname => $widgetconfig):
+
+ // Compose the widget title and include the title link if available
+ $widgetlink = ${$widgetname . '_title_link'};
+
+ if ((strlen($widgetlink) > 0)) {
+ $wtitle = '<a href="' . $widgetlink . '"> ' . $widgetconfig['name'] . '</a>';
+ } else {
+ $wtitle = $widgetconfig['name'];
+ }
+
+?>
<div class="panel panel-default" id="widget-<?=$widgetname?>">
<div class="panel-heading">
- <?=$widgetconfig['name']?>
+ <?=$wtitle?>
<span class="widget-heading-icon">
- <a data-toggle="collapse" href="#widget-<?=$widgetname?> .panel-footer" class="config hidden">
+ <a data-toggle="collapse" href="#widget-<?=$widgetname?>_panel-footer" class="config hidden">
<i class="fa fa-wrench"></i>
</a>
- <a data-toggle="collapse" href="#widget-<?=$widgetname?> .panel-body">
+ <a data-toggle="collapse" href="#widget-<?=$widgetname?>_panel-body">
<!-- actual icon is determined in css based on state of body -->
<i class="fa fa-plus-circle"></i>
</a>
@@ -393,11 +415,11 @@ foreach ($widgets as $widgetname => $widgetconfig)
</a>
</span>
</div>
- <div class="panel-body collapse<?=($widgetconfig['display']=='close' ? '' : ' in')?>">
+ <div id="widget-<?=$widgetname?>_panel-body" class="panel-body collapse<?=($widgetconfig['display']=='close' ? '' : ' in')?>">
<?php include('/usr/local/www/widgets/widgets/'. $widgetname.'.widget.php'); ?>
</div>
</div>
-<?php endforeach;
+<?php endforeach;
$columnCounter++;
?>
</div>
@@ -427,7 +449,7 @@ function updateWidgets(newWidget)
sequence += newWidget + ':' + 'col2:open';
$('#widgetSequence').removeClass('hidden');
- $('input[name=sequence]', $('#widgetSequence')).val(sequence);
+ $('input[name=sequence]', $('#widgetSequence_Form')).val(sequence);
}
events.push(function() {
@@ -449,9 +471,9 @@ events.push(function() {
});
// On clicking a widget to install . .
- $('[name^=btnadd-]').click(function(event) {
+ $('[id^=btnadd-]').click(function(event) {
// Add the widget name to the list of displayed widgets
- updateWidgets(this.name.replace('btnadd-', ''));
+ updateWidgets(this.id.replace('btnadd-', ''));
// We don't want to see the "Store" button because we are doing that automatically
$('#btnstore').hide();
diff --git a/src/usr/local/www/jquery/pfSenseHelpers.js b/src/usr/local/www/jquery/pfSenseHelpers.js
index aac6def..4fbe9f8 100644
--- a/src/usr/local/www/jquery/pfSenseHelpers.js
+++ b/src/usr/local/www/jquery/pfSenseHelpers.js
@@ -138,7 +138,7 @@ function hideLabel(text, hide) {
element.parent('div').removeClass('hidden');
}
-// Toggle table row chackboxes and background colors on the pages that use sortable tables:
+// Toggle table row checkboxes and background colors on the pages that use sortable tables:
// /usr/local/www/firewall_nat.php
// /usr/local/www/firewall_nat_1to1.php
// /usr/local/www/firewall_nat_out.php
@@ -214,13 +214,18 @@ function moveHelpText(id) {
var helpSpan;
if(!$(this).hasClass('pfIpMask') && !$(this).hasClass('btn')) {
-
- helpSpan = $('#' + fromId).parent('div').parent('div').find('span:last').clone();
+ if($('#' + decrStringInt(fromId)).parent('div').hasClass('input-group')) {
+ helpSpan = $('#' + fromId).parent('div').parent('div').find('span:last').clone();
+ } else {
+ helpSpan = $('#' + fromId).parent('div').find('span:last').clone();
+ }
if($(helpSpan).hasClass('help-block')) {
- if($('#' + decrStringInt(fromId)).parent('div').hasClass('input-group'))
+ if($('#' + decrStringInt(fromId)).parent('div').hasClass('input-group')) {
$('#' + decrStringInt(fromId)).parent('div').after(helpSpan);
- else
+ }
+ else {
$('#' + decrStringInt(fromId)).after(helpSpan);
+ }
}
}
});
@@ -288,8 +293,7 @@ function add_row() {
var lastRepeatableGroup = $('.repeatable:last');
// Clone it
- var newGroup = lastRepeatableGroup.clone(true);
-
+ var newGroup = lastRepeatableGroup.clone();
// Increment the suffix number for each input element in the new group
$(newGroup).find('input').each(function() {
$(this).prop("id", bumpStringInt(this.id));
@@ -332,9 +336,31 @@ function add_row() {
checkLastRow();
- $('[id^=address]').autocomplete({
- source: addressarray
+ // Autocomplete
+ if ( typeof addressarray !== 'undefined') {
+ $('[id^=address]').each(function() {
+ if(this.id.substring(0, 8) != "address_") {
+ $(this).autocomplete({
+ source: addressarray
+ });
+ }
+ });
+ }
+
+ // Now that we are no longer cloning the event handlers, we need to remove and re-add after a new row
+ // has been added to the table
+ $('[id^=delete]').unbind();
+ $('[id^=delete]').click(function(event) {
+ if($('.repeatable').length > 1) {
+ if((typeof retainhelp) == "undefined")
+ moveHelpText(event.target.id);
+
+ delete_row(event.target.id);
+ }
+ else
+ alert('You may not delete the last row!');
});
+
}
// These are action buttons, not submit buttons
@@ -401,7 +427,7 @@ $('tbody:empty').html("<tr><td></td></tr>");
$(el).children('i').toggleClass('fa-minus-circle', true);
$(el).children('i').toggleClass('fa-plus-circle', false);
- if($(el).closest('a').attr('name') != 'widgets-available') {
+ if($(el).closest('a').attr('id') != 'widgets-available') {
updateWidgets();
}
});
@@ -410,7 +436,7 @@ $('tbody:empty').html("<tr><td></td></tr>");
$(el).children('i').toggleClass('fa-minus-circle', false);
$(el).children('i').toggleClass('fa-plus-circle', true);
- if($(el).closest('a').attr('name') != 'widgets-available') {
+ if($(el).closest('a').attr('id') != 'widgets-available') {
updateWidgets();
}
});
diff --git a/src/usr/local/www/pkg_edit.php b/src/usr/local/www/pkg_edit.php
index 88b6148..7a736ff 100644
--- a/src/usr/local/www/pkg_edit.php
+++ b/src/usr/local/www/pkg_edit.php
@@ -878,7 +878,7 @@ foreach ($pkg['fields']['field'] as $pkga) {
if($grouping) {
$group->add(new Form_Select(
$pkga['fieldname'],
- $pkga['name'],
+ strip_tags($pkga['fielddescr']),
isset($pkga['multiple']) ? $srcselected:$srcselected[0],
$srcoptions,
isset($pkga['multiple'])
@@ -887,7 +887,7 @@ foreach ($pkg['fields']['field'] as $pkga) {
if (isset($pkga['advancedfield']) && isset($advfield_count)) {
$advanced->addInput(new Form_Select(
$pkga['fieldname'],
- $pkga['name'],
+ strip_tags($pkga['fielddescr']),
isset($pkga['multiple']) ? $srcselected:$srcselected[0],
$srcoptions,
isset($pkga['multiple'])
@@ -895,7 +895,7 @@ foreach ($pkg['fields']['field'] as $pkga) {
} else {
$section->addInput(new Form_Select(
$pkga['fieldname'],
- $pkga['name'],
+ strip_tags($pkga['fielddescr']),
isset($pkga['multiple']) ? $srcselected:$srcselected[0],
$srcoptions,
isset($pkga['multiple'])
diff --git a/src/usr/local/www/pkg_mgr_install.php b/src/usr/local/www/pkg_mgr_install.php
index e400c24..4ba5eda 100644
--- a/src/usr/local/www/pkg_mgr_install.php
+++ b/src/usr/local/www/pkg_mgr_install.php
@@ -344,8 +344,15 @@ if ($input_errors)
<?php
if ($firmwareversion['version'] != $firmwareversion['installed_version'] ) {
?>
- <input type="hidden" name="id" value="firmware" />
- <input type="submit" class="btn btn-success" name="pkgconfirm" id="pkgconfirm" value="Confirm"/>
+ <div class="form-group">
+ <label class="col-sm-2 control-label">
+ <?=gettext("Confirm Upgrade")?>
+ </label>
+ <div class="col-sm-10">
+ <input type="hidden" name="id" value="firmware" />
+ <input type="submit" class="btn btn-success" name="pkgconfirm" id="pkgconfirm" value="Confirm"/>
+ </div>
+ </div>
<?php
} else {
?>
diff --git a/src/usr/local/www/services_captiveportal.php b/src/usr/local/www/services_captiveportal.php
index 4832d01..5ed2551 100644
--- a/src/usr/local/www/services_captiveportal.php
+++ b/src/usr/local/www/services_captiveportal.php
@@ -96,7 +96,7 @@ if (!is_array($config['captiveportal'])) {
}
$a_cp =& $config['captiveportal'];
-$pgtitle = array(gettext("Services"), gettext("Captive Portal"), $a_cp[$cpzone]['zone']);
+$pgtitle = array(gettext("Services"), gettext("Captive Portal"), "Zone " . $a_cp[$cpzone]['zone'], gettext("Configuration"));
$shortcut_section = "captiveportal";
if ($_GET['act'] == "viewhtml") {
@@ -558,7 +558,7 @@ if ($savemsg)
print_info_box($savemsg, 'success');
$tab_array = array();
-$tab_array[] = array(gettext("Captive Portal(s)"), true, "services_captiveportal.php?zone={$cpzone}");
+$tab_array[] = array(gettext("Configuration"), true, "services_captiveportal.php?zone={$cpzone}");
$tab_array[] = array(gettext("MAC"), false, "services_captiveportal_mac.php?zone={$cpzone}");
$tab_array[] = array(gettext("Allowed IP Addresses"), false, "services_captiveportal_ip.php?zone={$cpzone}");
$tab_array[] = array(gettext("Allowed Hostnames"), false, "services_captiveportal_hostname.php?zone={$cpzone}");
diff --git a/src/usr/local/www/services_captiveportal_filemanager.php b/src/usr/local/www/services_captiveportal_filemanager.php
index 11ecb99..6d2da57 100644
--- a/src/usr/local/www/services_captiveportal_filemanager.php
+++ b/src/usr/local/www/services_captiveportal_filemanager.php
@@ -99,7 +99,7 @@ if (!is_array($config['captiveportal'])) {
}
$a_cp =& $config['captiveportal'];
-$pgtitle = array(gettext("Services"), gettext("Captive Portal"), $a_cp[$cpzone]['zone']);
+$pgtitle = array(gettext("Services"), gettext("Captive Portal"), "Zone " . $a_cp[$cpzone]['zone'], gettext("File Manager"));
$shortcut_section = "captiveportal";
if (!is_array($a_cp[$cpzone]['element'])) {
@@ -171,7 +171,7 @@ if ($input_errors)
print_input_errors($input_errors);
$tab_array = array();
-$tab_array[] = array(gettext("Captive Portal(s)"), false, "services_captiveportal.php?zone={$cpzone}");
+$tab_array[] = array(gettext("Configuration"), false, "services_captiveportal.php?zone={$cpzone}");
$tab_array[] = array(gettext("MAC"), false, "services_captiveportal_mac.php?zone={$cpzone}");
$tab_array[] = array(gettext("Allowed IP Addresses"), false, "services_captiveportal_ip.php?zone={$cpzone}");
$tab_array[] = array(gettext("Allowed Hostnames"), false, "services_captiveportal_hostname.php?zone={$cpzone}");
diff --git a/src/usr/local/www/services_captiveportal_hostname.php b/src/usr/local/www/services_captiveportal_hostname.php
index 9d0da78..3cee2fb 100644
--- a/src/usr/local/www/services_captiveportal_hostname.php
+++ b/src/usr/local/www/services_captiveportal_hostname.php
@@ -96,7 +96,7 @@ if (isset($cpzone) && !empty($cpzone) && isset($a_cp[$cpzone]['zoneid'])) {
$cpzoneid = $a_cp[$cpzone]['zoneid'];
}
-$pgtitle = array(gettext("Services"), gettext("Captive Portal"), $a_cp[$cpzone]['zone']);
+$pgtitle = array(gettext("Services"), gettext("Captive Portal"), "Zone " . $a_cp[$cpzone]['zone'], gettext("Allowed Hostnames"));
$shortcut_section = "captiveportal";
if ($_GET['act'] == "del" && !empty($cpzone) && isset($cpzoneid)) {
@@ -138,7 +138,7 @@ if ($savemsg)
print_info_box($savemsg);
$tab_array = array();
-$tab_array[] = array(gettext("Captive Portal(s)"), false, "services_captiveportal.php?zone={$cpzone}");
+$tab_array[] = array(gettext("Configuration"), false, "services_captiveportal.php?zone={$cpzone}");
$tab_array[] = array(gettext("MAC"), false, "services_captiveportal_mac.php?zone={$cpzone}");
$tab_array[] = array(gettext("Allowed IP Addresses"), false, "services_captiveportal_ip.php?zone={$cpzone}");
$tab_array[] = array(gettext("Allowed Hostnames"), true, "services_captiveportal_hostname.php?zone={$cpzone}");
diff --git a/src/usr/local/www/services_captiveportal_ip.php b/src/usr/local/www/services_captiveportal_ip.php
index a5c8c5d..ae12914 100644
--- a/src/usr/local/www/services_captiveportal_ip.php
+++ b/src/usr/local/www/services_captiveportal_ip.php
@@ -95,7 +95,7 @@ if (isset($cpzone) && !empty($cpzone) && isset($a_cp[$cpzone]['zoneid'])) {
$cpzoneid = $a_cp[$cpzone]['zoneid'];
}
-$pgtitle = array(gettext("Services"), gettext("Captive Portal"), $a_cp[$cpzone]['zone']);
+$pgtitle = array(gettext("Services"), gettext("Captive Portal"), "Zone " . $a_cp[$cpzone]['zone'], gettext("Allowed IP Addresses"));
$shortcut_section = "captiveportal";
if ($_GET['act'] == "del" && !empty($cpzone) && isset($cpzoneid)) {
@@ -131,7 +131,7 @@ if ($savemsg)
print_info_box($savemsg);
$tab_array = array();
-$tab_array[] = array(gettext("Captive Portal(s)"), false, "services_captiveportal.php?zone={$cpzone}");
+$tab_array[] = array(gettext("Configuration"), false, "services_captiveportal.php?zone={$cpzone}");
$tab_array[] = array(gettext("MAC"), false, "services_captiveportal_mac.php?zone={$cpzone}");
$tab_array[] = array(gettext("Allowed IP Addresses"), true, "services_captiveportal_ip.php?zone={$cpzone}");
$tab_array[] = array(gettext("Allowed Hostnames"), false, "services_captiveportal_hostname.php?zone={$cpzone}");
diff --git a/src/usr/local/www/services_captiveportal_mac.php b/src/usr/local/www/services_captiveportal_mac.php
index ba31962..0b321a8 100644
--- a/src/usr/local/www/services_captiveportal_mac.php
+++ b/src/usr/local/www/services_captiveportal_mac.php
@@ -91,7 +91,7 @@ if (!is_array($config['captiveportal'])) {
}
$a_cp =& $config['captiveportal'];
-$pgtitle = array(gettext("Services"), gettext("Captive Portal"), $a_cp[$cpzone]['zone']);
+$pgtitle = array(gettext("Services"), gettext("Captive Portal"), "Zone " . $a_cp[$cpzone]['zone'], gettext("MAC"));
$shortcut_section = "captiveportal";
$actsmbl = array('pass' => '<font color="green" size="4">&#x2714;</font>&nbsp;Pass',
@@ -194,7 +194,7 @@ if (is_subsystem_dirty('passthrumac'))
print_info_box_np(gettext("The captive portal MAC address configuration has been changed.<br />You must apply the changes in order for them to take effect."));
$tab_array = array();
-$tab_array[] = array(gettext("Captive Portal(s)"), false, "services_captiveportal.php?zone={$cpzone}");
+$tab_array[] = array(gettext("Configuration"), false, "services_captiveportal.php?zone={$cpzone}");
$tab_array[] = array(gettext("MAC"), true, "services_captiveportal_mac.php?zone={$cpzone}");
$tab_array[] = array(gettext("Allowed IP Addresses"), false, "services_captiveportal_ip.php?zone={$cpzone}");
$tab_array[] = array(gettext("Allowed Hostnames"), false, "services_captiveportal_hostname.php?zone={$cpzone}");
diff --git a/src/usr/local/www/services_captiveportal_vouchers.php b/src/usr/local/www/services_captiveportal_vouchers.php
index 51e0c80..d3c8cad 100644
--- a/src/usr/local/www/services_captiveportal_vouchers.php
+++ b/src/usr/local/www/services_captiveportal_vouchers.php
@@ -111,7 +111,7 @@ if (empty($a_cp[$cpzone])) {
exit;
}
-$pgtitle = array(gettext("Services"), gettext("Captive Portal"), gettext("Vouchers"), $a_cp[$cpzone]['zone']);
+$pgtitle = array(gettext("Services"), gettext("Captive Portal"), "Zone " . $a_cp[$cpzone]['zone'], gettext("Vouchers"));
$shortcut_section = "captiveportal-vouchers";
if (!is_array($config['voucher'][$cpzone]['roll'])) {
@@ -430,7 +430,7 @@ if ($savemsg)
print_info_box($savemsg. 'success');
$tab_array = array();
-$tab_array[] = array(gettext("Captive Portal(s)"), false, "services_captiveportal.php?zone={$cpzone}");
+$tab_array[] = array(gettext("Configuration"), false, "services_captiveportal.php?zone={$cpzone}");
$tab_array[] = array(gettext("MAC"), false, "services_captiveportal_mac.php?zone={$cpzone}");
$tab_array[] = array(gettext("Allowed IP Addresses"), false, "services_captiveportal_ip.php?zone={$cpzone}");
$tab_array[] = array(gettext("Allowed Hostnames"), false, "services_captiveportal_hostname.php?zone={$cpzone}");
diff --git a/src/usr/local/www/services_captiveportal_zones.php b/src/usr/local/www/services_captiveportal_zones.php
index b96ce1b..f5b1202 100644
--- a/src/usr/local/www/services_captiveportal_zones.php
+++ b/src/usr/local/www/services_captiveportal_zones.php
@@ -90,7 +90,7 @@ if ($_GET['act'] == "del" && !empty($_GET['zone'])) {
exit;
}
-$pgtitle = array(gettext("Captive Portal"), gettext("Zones"));
+$pgtitle = array(gettext("Services"), gettext("Captive Portal"), gettext("Zones"));
$shortcut_section = "captiveportal";
include("head.inc");
diff --git a/src/usr/local/www/services_captiveportal_zones_edit.php b/src/usr/local/www/services_captiveportal_zones_edit.php
index 933e5e4..3b73ac4 100644
--- a/src/usr/local/www/services_captiveportal_zones_edit.php
+++ b/src/usr/local/www/services_captiveportal_zones_edit.php
@@ -69,7 +69,7 @@ require_once("filter.inc");
require("shaper.inc");
require("captiveportal.inc");
-$pgtitle = array(gettext("Services"), gettext("Captive Portal"), gettext("Edit Zones"));
+$pgtitle = array(gettext("Services"), gettext("Captive Portal"), gettext("Add Zone"));
$shortcut_section = "captiveportal";
if (!is_array($config['captiveportal'])) {
@@ -121,7 +121,7 @@ $form = new Form(new Form_Button(
'Continue'
));
-$section = new Form_Section('Edit Captive Portal Zones');
+$section = new Form_Section('Add Captive Portal Zone');
$section->addInput(new Form_Input(
'zone',
diff --git a/src/usr/local/www/services_dhcp.php b/src/usr/local/www/services_dhcp.php
index 3a16993..a48e36b 100644
--- a/src/usr/local/www/services_dhcp.php
+++ b/src/usr/local/www/services_dhcp.php
@@ -1282,7 +1282,7 @@ if (!is_numeric($pool) && !($act == "newpool")) {
?>
<div class="panel panel-default">
- <div class="panel-heading"><h2 class="panel-title"><?=gettext("DHCP Static Mappings for this interface.")?></h2></div>
+ <div class="panel-heading"><h2 class="panel-title"><?=gettext("DHCP Static Mappings for this interface")?></h2></div>
<div class="table-responsive">
<table class="table table-striped table-hover table-condensed">
<thead>
diff --git a/src/usr/local/www/services_dhcpv6.php b/src/usr/local/www/services_dhcpv6.php
index 0ebf441..70cddb5 100644
--- a/src/usr/local/www/services_dhcpv6.php
+++ b/src/usr/local/www/services_dhcpv6.php
@@ -599,19 +599,19 @@ $group->add($f2);
$section->add($group);
$f1 = new Form_Input(
- 'prefix_from',
+ 'prefixrange_from',
null,
'text',
- $pconfig['prefix_from']
+ $pconfig['prefixrange_from']
);
$f1->setHelp('To');
$f2 = new Form_Input(
- 'prefix_to',
+ 'prefixrange_to',
null,
'text',
- $pconfig['prefix_to']
+ $pconfig['prefixrange_to']
);
$f2->setHelp('From');
diff --git a/src/usr/local/www/services_dnsmasq.php b/src/usr/local/www/services_dnsmasq.php
index dabeb7d..d6b7710 100644
--- a/src/usr/local/www/services_dnsmasq.php
+++ b/src/usr/local/www/services_dnsmasq.php
@@ -404,6 +404,7 @@ foreach ($a_hosts as $i => $hostent):
Alias for <?=$hostent['host'] ? $hostent['host'] . '.' . $hostent['domain'] : $hostent['domain']?>
</td>
<td>
+ <i class="fa fa-angle-double-right text-info"></i>
<?=htmlspecialchars($alias['description'])?>
</td>
<td>
diff --git a/src/usr/local/www/services_dnsmasq_edit.php b/src/usr/local/www/services_dnsmasq_edit.php
index 9c3c811..3eedebb 100644
--- a/src/usr/local/www/services_dnsmasq_edit.php
+++ b/src/usr/local/www/services_dnsmasq_edit.php
@@ -133,47 +133,49 @@ 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;
-
- /* validate aliases */
- foreach ($aliases as $idx => $alias) {
- $aliasreqdfields = array('aliasdomain' . $idx);
- $aliasreqdfieldsn = array(gettext("Alias Domain"));
-
- 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");
+ $pconfig['aliases']['item'] = $aliases;
+
+ /* validate aliases */
+ foreach ($aliases as $idx => $alias) {
+ $aliasreqdfields = array('aliasdomain' . $idx);
+ $aliasreqdfieldsn = array(gettext("Alias Domain"));
+
+ 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['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.");
+ }
}
}
-
/* check for overlaps */
foreach ($a_hosts as $hostent) {
if (isset($id) && ($a_hosts[$id]) && ($a_hosts[$id] === $hostent)) {
@@ -284,12 +286,17 @@ $form->add($section);
$section = new Form_Section('Additional names for this host');
+if(!$pconfig['aliases']['item']) {
+ $pconfig['aliases']['item'] = array('host' => "");
+}
+
if( $pconfig['aliases']['item']) {
$counter = 0;
$last = count($pconfig['aliases']['item']) - 1;
foreach($pconfig['aliases']['item'] as $item) {
$group = new Form_Group(null);
+ $group->addClass('repeatable');
$group->add(new Form_Input(
'aliashost' . $counter,
@@ -312,28 +319,22 @@ if( $pconfig['aliases']['item']) {
$item['description']
))->setHelp($counter == $last ? 'Description':null);
- $btn = new Form_Button(
- 'btn' . $counter,
- 'Delete',
- 'services_dnsmasq_edit.php?act=delopt' . '&id=' . $counter
- );
+ $group->add(new Form_Button(
+ 'deleterow' . $counter,
+ 'Delete'
+ ))->removeClass('btn-primary')->addClass('btn-warning');
- $btn->removeClass('btn-primary')->addClass('btn-danger btn-sm');
- $group->add($btn);
$section->add($group);
$counter++;
}
}
-$btnaddopt = new Form_Button(
- 'btnaddopt',
- 'Add Host name',
- 'services_dnsmasq_edit.php?act=addopt'
-);
-
-$btnaddopt->removeClass('btn-primary')->addClass('btn-success btn-sm');
-
-$section->addInput($btnaddopt);
+$form->addGlobal(new Form_Button(
+ 'addrow',
+ 'Add host name',
+ null,
+ 'fa-plus'
+))->removeClass('btn-primary')->addClass('btn-success addbtn');
$form->add($section);
print($form);
diff --git a/src/usr/local/www/services_dyndns.php b/src/usr/local/www/services_dyndns.php
index 610f7ec..2cdd53a 100644
--- a/src/usr/local/www/services_dyndns.php
+++ b/src/usr/local/www/services_dyndns.php
@@ -97,14 +97,14 @@ else if ($_GET['act'] == "toggle") {
exit;
}
}
-$pgtitle = array(gettext("Services"), gettext("Dynamic DNS clients"));
+$pgtitle = array(gettext("Services"), gettext("Dynamic DNS"), gettext("Dynamic DNS Clients"));
include("head.inc");
if ($input_errors)
print_input_errors($input_errors);
$tab_array = array();
-$tab_array[] = array(gettext("DynDns"), true, "services_dyndns.php");
+$tab_array[] = array(gettext("Dynamic DNS"), true, "services_dyndns.php");
$tab_array[] = array(gettext("RFC 2136"), false, "services_rfc2136.php");
display_top_tabs($tab_array);
?>
diff --git a/src/usr/local/www/services_dyndns_edit.php b/src/usr/local/www/services_dyndns_edit.php
index ff4dbb4..285ba76 100644
--- a/src/usr/local/www/services_dyndns_edit.php
+++ b/src/usr/local/www/services_dyndns_edit.php
@@ -247,7 +247,7 @@ function build_if_list() {
return($list);
}
-$pgtitle = array(gettext("Services"),gettext("Dynamic DNS client"));
+$pgtitle = array(gettext("Services"), gettext("Dynamic DNS"), gettext("Dynamic DNS Client"), gettext("Edit"));
include("head.inc");
if ($input_errors)
diff --git a/src/usr/local/www/services_igmpproxy_edit.php b/src/usr/local/www/services_igmpproxy_edit.php
index 5ef7994..6c66dbd 100644
--- a/src/usr/local/www/services_igmpproxy_edit.php
+++ b/src/usr/local/www/services_igmpproxy_edit.php
@@ -66,7 +66,7 @@
##|*MATCH=services_igmpproxy_edit.php*
##|-PRIV
-$pgtitle = array(gettext("Firewall"), gettext("IGMP Proxy"), gettext("Edit"));
+$pgtitle = array(gettext("Services"), gettext("IGMP Proxy"), gettext("Edit"));
require("guiconfig.inc");
diff --git a/src/usr/local/www/services_ntpd.php b/src/usr/local/www/services_ntpd.php
index 3340bdf..8803d79 100644
--- a/src/usr/local/www/services_ntpd.php
+++ b/src/usr/local/www/services_ntpd.php
@@ -107,7 +107,7 @@ if ($_POST) {
unset($config['ntpd']['noselect']);
$timeservers = '';
- for ($i = 0; $i < 10; $i++) {
+ for ($i = 0; $i < NUMTIMESERVERS; $i++) {
$tserver = trim($_POST["server{$i}"]);
if (!empty($tserver)) {
$timeservers .= "{$tserver} ";
@@ -268,7 +268,7 @@ if (empty($pconfig['interface'])) {
} else {
$pconfig['interface'] = explode(",", $pconfig['interface']);
}
-$pgtitle = array(gettext("Services"), gettext("NTP"));
+$pgtitle = array(gettext("Services"), gettext("NTP"), gettext("NTP"));
$shortcut_section = "ntp";
include("head.inc");
@@ -299,8 +299,8 @@ $section->addInput(new Form_Select(
'Selecting no interfaces will listen on all interfaces with a wildcard.' . '<br />' .
'Selecting all interfaces will explicitly listen on only the interfaces/IPs specified.');
-$maxrows = 3;
$timeservers = explode( ' ', $config['system']['timeservers']);
+$maxrows = max(count($timeservers), 1);
for ($counter=0; $counter < $maxrows; $counter++) {
$group = new Form_Group($counter == 0 ? 'Time servers':'');
$group->addClass('repeatable');
diff --git a/src/usr/local/www/services_ntpd_gps.php b/src/usr/local/www/services_ntpd_gps.php
index e457fd9..154d91b 100644
--- a/src/usr/local/www/services_ntpd_gps.php
+++ b/src/usr/local/www/services_ntpd_gps.php
@@ -224,7 +224,7 @@ function build_nmea_list() {
$closehead = false;
$pconfig = &$config['ntpd']['gps'];
-$pgtitle = array(gettext("Services"), gettext("NTP GPS"));
+$pgtitle = array(gettext("Services"), gettext("NTP"), gettext("Serial GPS"));
$shortcut_section = "ntp";
include("head.inc");
diff --git a/src/usr/local/www/services_ntpd_pps.php b/src/usr/local/www/services_ntpd_pps.php
index 1f836cf..c2f6423 100644
--- a/src/usr/local/www/services_ntpd_pps.php
+++ b/src/usr/local/www/services_ntpd_pps.php
@@ -136,7 +136,7 @@ if ($_POST) {
$pconfig = &$config['ntpd']['pps'];
-$pgtitle = array(gettext("Services"), gettext("NTP PPS"));
+$pgtitle = array(gettext("Services"), gettext("NTP"), gettext("PPS"));
$shortcut_section = "ntp";
include("head.inc");
diff --git a/src/usr/local/www/vpn_pppoe.php b/src/usr/local/www/services_pppoe.php
index 14aea1f..d6082ef 100644
--- a/src/usr/local/www/vpn_pppoe.php
+++ b/src/usr/local/www/services_pppoe.php
@@ -1,6 +1,6 @@
<?php
/*
- vpn_pppoe.php
+ services_pppoe.php
*/
/* ====================================================================
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
@@ -60,7 +60,7 @@
##|*IDENT=page-services-pppoeserver
##|*NAME=Services: PPPoE Server
##|*DESCR=Allow access to the 'Services: PPPoE Server' page.
-##|*MATCH=vpn_pppoe.php*
+##|*MATCH=services_pppoe.php*
##|-PRIV
require_once("guiconfig.inc");
@@ -111,7 +111,7 @@ if ($_GET['act'] == "del") {
}
unset($a_pppoes[$_GET['id']]);
write_config();
- header("Location: vpn_pppoe.php");
+ header("Location: services_pppoe.php");
exit;
}
}
@@ -157,8 +157,8 @@ foreach ($a_pppoes as $pppoe):
<?=htmlspecialchars($pppoe['descr'])?>
</td>
<td>
- <a class="fa fa-pencil" title="<?=gettext('Edit PPPoE instance')?>" href="vpn_pppoe_edit.php?id=<?=$i?>"></a>
- <a class="fa fa-trash" title="<?=gettext('Delete PPPoE instance')?>" href="vpn_pppoe.php?act=del&amp;id=<?=$i?>"></a>
+ <a class="fa fa-pencil" title="<?=gettext('Edit PPPoE instance')?>" href="services_pppoe_edit.php?id=<?=$i?>"></a>
+ <a class="fa fa-trash" title="<?=gettext('Delete PPPoE instance')?>" href="services_pppoe.php?act=del&amp;id=<?=$i?>"></a>
</td>
</tr>
<?php
@@ -170,7 +170,7 @@ endforeach;
</div>
<nav class="action-buttons">
- <a href="vpn_pppoe_edit.php" class="btn btn-success">
+ <a href="services_pppoe_edit.php" class="btn btn-success">
<i class="fa fa-plus icon-embed-btn"></i>
<?=gettext("Add")?>
</a>
diff --git a/src/usr/local/www/vpn_pppoe_edit.php b/src/usr/local/www/services_pppoe_edit.php
index e03757c..f358749 100644
--- a/src/usr/local/www/vpn_pppoe_edit.php
+++ b/src/usr/local/www/services_pppoe_edit.php
@@ -1,6 +1,6 @@
<?php
/*
- vpn_pppoe_edit.php
+ services_pppoe_edit.php
*/
/* ====================================================================
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
@@ -57,7 +57,7 @@
##|*IDENT=page-services-pppoeserver-edit
##|*NAME=Services: PPPoE Server: Edit
##|*DESCR=Allow access to the 'Services: PPPoE Server: Edit' page.
-##|*MATCH=vpn_pppoe_edit.php*
+##|*MATCH=services_pppoe_edit.php*
##|-PRIV
require("guiconfig.inc");
@@ -282,7 +282,7 @@ if ($_POST) {
write_config();
mark_subsystem_dirty('vpnpppoe');
file_put_contents("{$g['tmp_path']}/.vpn_pppoe.apply", serialize($toapplylist));
- header("Location: vpn_pppoe.php");
+ header("Location: services_pppoe.php");
exit;
}
}
diff --git a/src/usr/local/www/services_rfc2136.php b/src/usr/local/www/services_rfc2136.php
index ded27ea..b854d2c 100644
--- a/src/usr/local/www/services_rfc2136.php
+++ b/src/usr/local/www/services_rfc2136.php
@@ -93,11 +93,11 @@ else if ($_GET['act'] == "toggle") {
}
}
-$pgtitle = array(gettext("Services"), gettext("RFC 2136 Clients"));
+$pgtitle = array(gettext("Services"), gettext("Dynamic DNS"), gettext("RFC 2136 Clients"));
include("head.inc");
$tab_array = array();
-$tab_array[] = array(gettext("DynDns"), false, "services_dyndns.php");
+$tab_array[] = array(gettext("Dynamic DNS"), false, "services_dyndns.php");
$tab_array[] = array(gettext("RFC 2136"), true, "services_rfc2136.php");
display_top_tabs($tab_array);
diff --git a/src/usr/local/www/services_rfc2136_edit.php b/src/usr/local/www/services_rfc2136_edit.php
index e3d8483..4b01add 100644
--- a/src/usr/local/www/services_rfc2136_edit.php
+++ b/src/usr/local/www/services_rfc2136_edit.php
@@ -160,7 +160,7 @@ if ($_POST) {
}
}
-$pgtitle = array(gettext("Services"), gettext("RFC 2136 Client"), gettext("Edit"));
+$pgtitle = array(gettext("Services"), gettext("Dynamic DNS"), gettext("RFC 2136 Client"), gettext("Edit"));
include("head.inc");
if ($input_errors)
diff --git a/src/usr/local/www/services_unbound.php b/src/usr/local/www/services_unbound.php
index 8e8a0cc..0eead55 100644
--- a/src/usr/local/www/services_unbound.php
+++ b/src/usr/local/www/services_unbound.php
@@ -251,7 +251,7 @@ function build_if_list($selectedifs) {
}
$closehead = false;
-$pgtitle = array(gettext("Services"), gettext("DNS Resolver"));
+$pgtitle = array(gettext("Services"), gettext("DNS Resolver"), gettext("General"));
$shortcut_section = "resolver";
include_once("head.inc");
@@ -472,6 +472,7 @@ foreach ($a_hosts as $hostent):
Alias for <?=$hostent['host'] ? $hostent['host'] . '.' . $hostent['domain'] : $hostent['domain']?>
</td>
<td>
+ <i class="fa fa-angle-double-right text-info"></i>
<?=htmlspecialchars($alias['description'])?>
</td>
<td>
diff --git a/src/usr/local/www/services_unbound_host_edit.php b/src/usr/local/www/services_unbound_host_edit.php
index 29ebc3c..cab96ed 100644
--- a/src/usr/local/www/services_unbound_host_edit.php
+++ b/src/usr/local/www/services_unbound_host_edit.php
@@ -106,7 +106,6 @@ if (isset($id) && $a_hosts[$id]) {
}
if ($_POST) {
-
unset($input_errors);
$pconfig = $_POST;
@@ -136,43 +135,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 +236,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');
@@ -282,12 +286,17 @@ $form->add($section);
$section = new Form_Section('Additional names for this host');
+if(!$pconfig['aliases']['item']) {
+ $pconfig['aliases']['item'] = array('host' => "");
+}
+
if( $pconfig['aliases']['item']) {
$counter = 0;
$last = count($pconfig['aliases']['item']) - 1;
foreach($pconfig['aliases']['item'] as $item) {
$group = new Form_Group(null);
+ $group->addClass('repeatable');
$group->add(new Form_Input(
'aliashost' . $counter,
@@ -310,28 +319,22 @@ if( $pconfig['aliases']['item']) {
$item['description']
))->setHelp($counter == $last ? 'Description':null);
- $btn = new Form_Button(
- 'btn' . $counter,
- 'Delete',
- 'services_unbound_host_edit.php?act=delopt' . '&id=' . $counter
- );
+ $group->add(new Form_Button(
+ 'deleterow' . $counter,
+ 'Delete'
+ ))->removeClass('btn-primary')->addClass('btn-warning');
- $btn->removeClass('btn-primary')->addClass('btn-danger btn-sm');
- $group->add($btn);
$section->add($group);
$counter++;
}
}
-$btnaddopt = new Form_Button(
- 'btnaddopt',
- 'Add Host name',
- 'services_unbound_host_edit.php?act=addopt'
-);
-
-$btnaddopt->removeClass('btn-primary')->addClass('btn-success btn-sm');
-
-$section->addInput($btnaddopt);
+$form->addGlobal(new Form_Button(
+ 'addrow',
+ 'Add host name',
+ null,
+ 'fa-plus'
+))->removeClass('btn-primary')->addClass('btn-success addbtn');
$form->add($section);
print($form);
diff --git a/src/usr/local/www/services_wol.php b/src/usr/local/www/services_wol.php
index e6e3b5c..c624c98 100644
--- a/src/usr/local/www/services_wol.php
+++ b/src/usr/local/www/services_wol.php
@@ -89,7 +89,7 @@ if($_GET['wakeall'] != "") {
if (!mwexec("/usr/local/bin/wol -i {$bcip} {$mac}")) {
$savemsg .= sprintf(gettext('Sent magic packet to %1$s (%2$s)%3$s'), $mac, $description, ".<br />");
} else {
- $savemsg .= sprintf(gettext('Please check the %1$ssystem log%2$s, the wol command for %3$s (%4$s) did not complete successfully%5$s'), '<a href="/diag_logs.php">', '</a>', $description, $mac, ".<br />");
+ $savemsg .= sprintf(gettext('Please check the %1$ssystem log%2$s, the wol command for %3$s (%4$s) did not complete successfully%5$s'), '<a href="/status_logs.php">', '</a>', $description, $mac, ".<br />");
}
}
}
@@ -128,7 +128,7 @@ if ($_POST || $_GET['mac']) {
if (!mwexec("/usr/local/bin/wol -i {$bcip} " . escapeshellarg($mac))) {
$savemsg .= sprintf(gettext("Sent magic packet to %s."), $mac);
} else {
- $savemsg .= sprintf(gettext('Please check the %1$ssystem log%2$s, the wol command for %3$s did not complete successfully%4$s'), '<a href="/diag_logs.php">', '</a>', $mac, ".<br />");
+ $savemsg .= sprintf(gettext('Please check the %1$ssystem log%2$s, the wol command for %3$s did not complete successfully%4$s'), '<a href="/status_logs.php">', '</a>', $mac, ".<br />");
}
}
}
diff --git a/src/usr/local/www/shortcuts.inc b/src/usr/local/www/shortcuts.inc
index 350733d..e0a95bc 100644
--- a/src/usr/local/www/shortcuts.inc
+++ b/src/usr/local/www/shortcuts.inc
@@ -182,70 +182,70 @@ if (is_dir("/usr/local/pkg/shortcuts")) {
$shortcuts['relayd'] = array();
$shortcuts['relayd']['main'] = "load_balancer_pool.php";
-$shortcuts['relayd']['log'] = "diag_logs.php?logfile=relayd";
+$shortcuts['relayd']['log'] = "status_logs.php?logfile=relayd";
$shortcuts['relayd']['status'] = "status_lb_pool.php";
$shortcuts['relayd']['service'] = "relayd";
$shortcuts['relayd-virtualservers'] = array();
$shortcuts['relayd-virtualservers']['main'] = "load_balancer_virtual_server.php";
-$shortcuts['relayd-virtualservers']['log'] = "diag_logs.php?logfile=relayd";
+$shortcuts['relayd-virtualservers']['log'] = "status_logs.php?logfile=relayd";
$shortcuts['relayd-virtualservers']['status'] = "status_lb_vs.php";
$shortcuts['relayd-virtualservers']['service'] = "relayd";
$shortcuts['captiveportal'] = array();
$shortcuts['captiveportal']['main'] = "services_captiveportal_zones.php";
-$shortcuts['captiveportal']['log'] = "diag_logs.php?logfile=portalauth";
+$shortcuts['captiveportal']['log'] = "status_logs.php?logfile=portalauth";
$shortcuts['captiveportal']['status'] = "status_captiveportal.php";
$shortcuts['captiveportal']['service'] = "captiveportal";
$shortcuts['captiveportal-vouchers'] = array();
-$shortcuts['captiveportal-vouchers']['log'] = "diag_logs.php?logfile=auth";
+$shortcuts['captiveportal-vouchers']['log'] = "status_logs.php?logfile=auth";
$shortcuts['captiveportal-vouchers']['status'] = "status_captiveportal_vouchers.php";
$shortcuts['captiveportal-vouchers']['service'] = "captiveportal";
$shortcuts['dhcp'] = array();
$shortcuts['dhcp']['main'] = "services_dhcp.php";
-$shortcuts['dhcp']['log'] = "diag_logs.php?logfile=dhcpd";
+$shortcuts['dhcp']['log'] = "status_logs.php?logfile=dhcpd";
$shortcuts['dhcp']['status'] = "status_dhcp_leases.php";
$shortcuts['dhcp']['service'] = "dhcpd";
$shortcuts['dhcp6'] = array();
$shortcuts['dhcp6']['main'] = "services_dhcpv6.php";
-$shortcuts['dhcp6']['log'] = "diag_logs.php?logfile=dhcp";
+$shortcuts['dhcp6']['log'] = "status_logs.php?logfile=dhcp";
$shortcuts['dhcp6']['status'] = "status_dhcpv6_leases.php";
$shortcuts['ipsec'] = array();
$shortcuts['ipsec']['main'] = "vpn_ipsec.php";
-$shortcuts['ipsec']['log'] = "diag_logs.php?logfile=ipsec";
-$shortcuts['ipsec']['status'] = "diag_ipsec.php";
+$shortcuts['ipsec']['log'] = "status_logs.php?logfile=ipsec";
+$shortcuts['ipsec']['status'] = "status_ipsec.php";
$shortcuts['ipsec']['service'] = "ipsec";
$shortcuts['openvpn'] = array();
$shortcuts['openvpn']['main'] = "vpn_openvpn_server.php";
-$shortcuts['openvpn']['log'] = "diag_logs.php?logfile=openvpn";
+$shortcuts['openvpn']['log'] = "status_logs.php?logfile=openvpn";
$shortcuts['openvpn']['status'] = "status_openvpn.php";
$shortcuts['openvpn']['service'] = "openvpn";
$shortcuts['firewall'] = array();
$shortcuts['firewall']['main'] = "firewall_rules.php";
-$shortcuts['firewall']['log'] = "diag_logs_filter.php";
+$shortcuts['firewall']['log'] = "status_logs_filter.php";
$shortcuts['firewall']['status'] = "status_filter_reload.php";
$shortcuts['routing'] = array();
$shortcuts['routing']['main'] = "system_routes.php";
-$shortcuts['routing']['log'] = "diag_logs.php?logfile=routing";
+$shortcuts['routing']['log'] = "status_logs.php?logfile=routing";
$shortcuts['routing']['status'] = "diag_routes.php";
$shortcuts['gateways'] = array();
$shortcuts['gateways']['main'] = "system_gateways.php";
-$shortcuts['gateways']['log'] = "diag_logs.php?logfile=gateways";
+$shortcuts['gateways']['log'] = "status_logs.php?logfile=gateways";
$shortcuts['gateways']['status'] = "status_gateways.php";
-$shortcuts['gateways']['service'] = "apinger";
+$shortcuts['gateways']['service'] = "dpinger";
$shortcuts['gateway-groups'] = array();
$shortcuts['gateway-groups']['main'] = "system_gateway_groups.php";
-$shortcuts['gateway-groups']['log'] = "diag_logs.php?logfile=gateways";
+$shortcuts['gateway-groups']['log'] = "status_logs.php?logfile=gateways";
$shortcuts['gateway-groups']['status'] = "status_gateway_groups.php";
$shortcuts['interfaces'] = array();
@@ -262,36 +262,36 @@ $shortcuts['trafficshaper-limiters']['status'] = "diag_limiter_info.php";
$shortcuts['forwarder'] = array();
$shortcuts['forwarder']['main'] = "services_dnsmasq.php";
-$shortcuts['forwarder']['log'] = "diag_logs.php?logfile=resolver";
+$shortcuts['forwarder']['log'] = "status_logs.php?logfile=resolver";
$shortcuts['forwarder']['service'] = "dnsmasq";
$shortcuts['resolver'] = array();
$shortcuts['resolver']['main'] = "services_unbound.php";
-$shortcuts['resolver']['log'] = "diag_logs.php?logfile=resolver";
+$shortcuts['resolver']['log'] = "status_logs.php?logfile=resolver";
$shortcuts['resolver']['service'] = "unbound";
$shortcuts['wireless'] = array();
$shortcuts['wireless']['main'] = "interfaces_wireless.php";
-$shortcuts['wireless']['log'] = "diag_logs.php?logfile=wireless";
+$shortcuts['wireless']['log'] = "status_logs.php?logfile=wireless";
$shortcuts['wireless']['status'] = "status_wireless.php";
$shortcuts['ntp'] = array();
$shortcuts['ntp']['main'] = "services_ntpd.php";
-$shortcuts['ntp']['log'] = "diag_logs.php?logfile=ntpd";
+$shortcuts['ntp']['log'] = "status_logs.php?logfile=ntpd";
$shortcuts['ntp']['status'] = "status_ntpd.php";
$shortcuts['ntp']['service'] = "ntpd";
$shortcuts['pptps'] = array();
$shortcuts['pptps']['main'] = "vpn_pptp.php";
-$shortcuts['pptps']['log'] = "diag_logs_vpn.php";
+$shortcuts['pptps']['log'] = "status_logs_vpn.php";
$shortcuts['pppoes'] = array();
-$shortcuts['pppoes']['main'] = "vpn_pppoe.php";
-$shortcuts['pppoes']['log'] = "diag_logs_vpn.php?vpntype=poes";
+$shortcuts['pppoes']['main'] = "services_pppoe.php";
+$shortcuts['pppoes']['log'] = "status_logs_vpn.php?vpntype=poes";
$shortcuts['l2tps'] = array();
$shortcuts['l2tps']['main'] = "vpn_l2tp.php";
-$shortcuts['l2tps']['log'] = "diag_logs_vpn.php?vpntype=l2tp";
+$shortcuts['l2tps']['log'] = "status_logs_vpn.php?vpntype=l2tp";
$shortcuts['carp'] = array();
$shortcuts['carp']['main'] = "system_hasync.php";
diff --git a/src/usr/local/www/status.php b/src/usr/local/www/status.php
index 1722099..b4bbd44 100755
--- a/src/usr/local/www/status.php
+++ b/src/usr/local/www/status.php
@@ -255,12 +255,6 @@ if (file_exists("/boot/loader.conf")) {
if (file_exists("/boot/loader.conf.local")) {
defCmdT("Loader Configuration (Local)", "/bin/cat /boot/loader.conf.local");
}
-if (file_exists("/var/run/apinger.status")) {
- defCmdT("Gateway Status", "/bin/cat /var/run/apinger.status");
-}
-if (file_exists("/var/etc/apinger.conf")) {
- defCmdT("Gateway Monitoring Config", "/bin/cat /var/etc/apinger.conf");
-}
if (file_exists("/var/etc/filterdns.conf")) {
defCmdT("Filter DNS Daemon Config", "/bin/cat /var/etc/filterdns.conf");
}
diff --git a/src/usr/local/www/carp_status.php b/src/usr/local/www/status_carp.php
index 5d9fdbf..b6a3d93 100644
--- a/src/usr/local/www/carp_status.php
+++ b/src/usr/local/www/status_carp.php
@@ -1,6 +1,6 @@
<?php
/*
- carp_status.php
+ status_carp.php
*/
/* ====================================================================
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
@@ -57,7 +57,7 @@
##|*IDENT=page-status-carp
##|*NAME=Status: CARP
##|*DESCR=Allow access to the 'Status: CARP' page.
-##|*MATCH=carp_status.php*
+##|*MATCH=status_carp.php*
##|-PRIV
/*
@@ -180,7 +180,7 @@ if ($carpcount == 0) {
} else
{
?>
-<form action="carp_status.php" method="post">
+<form action="status_carp.php" method="post">
<?php
if($status > 0)
$carp_enabled = true;
@@ -193,7 +193,7 @@ if ($carpcount == 0) {
gettext("CARP has detected a problem and this unit has been demoted to BACKUP status.") . "<br/>" .
gettext("Check the link status on all interfaces with configured CARP VIPs.") . "<br/>" .
gettext("Search the") .
- " <a href=\"/diag_logs.php?filtertext=carp%3A+demoted+by\">" .
+ " <a href=\"/status_logs.php?filtertext=carp%3A+demoted+by\">" .
gettext("system log") .
"</a> " .
gettext("for CARP demotion-related events.") . "<br/><br/>" .
diff --git a/src/usr/local/www/status_filter_reload.php b/src/usr/local/www/status_filter_reload.php
index f29d32a..1156184 100644
--- a/src/usr/local/www/status_filter_reload.php
+++ b/src/usr/local/www/status_filter_reload.php
@@ -67,7 +67,7 @@ require_once("globals.inc");
require_once("guiconfig.inc");
require_once("functions.inc");
-$pgtitle = array(gettext("Status"), gettext("Filter Reload Status"));
+$pgtitle = array(gettext("Status"), gettext("Filter Reload"));
$shortcut_section = "firewall";
if (file_exists("{$g['varrun_path']}/filter_reload_status")) {
diff --git a/src/usr/local/www/diag_ipsec.php b/src/usr/local/www/status_ipsec.php
index 1146986..c78d3fb 100644
--- a/src/usr/local/www/diag_ipsec.php
+++ b/src/usr/local/www/status_ipsec.php
@@ -1,6 +1,6 @@
<?php
/*
- diag_ipsec.php
+ status_ipsec.php
*/
/* ====================================================================
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
@@ -65,13 +65,13 @@
##|*IDENT=page-status-ipsec
##|*NAME=Status: IPsec
##|*DESCR=Allow access to the 'Status: IPsec' page.
-##|*MATCH=diag_ipsec.php*
+##|*MATCH=status_ipsec.php*
##|-PRIV
global $g;
-$pgtitle = array(gettext("Status"), gettext("IPsec"));
+$pgtitle = array(gettext("Status"), gettext("IPsec"), gettext("Overview"));
$shortcut_section = "ipsec";
require("guiconfig.inc");
@@ -120,10 +120,10 @@ $a_phase1 = &$config['ipsec']['phase1'];
$status = ipsec_list_sa();
$tab_array = array();
-$tab_array[] = array(gettext("Overview"), true, "diag_ipsec.php");
-$tab_array[] = array(gettext("Leases"), false, "diag_ipsec_leases.php");
-$tab_array[] = array(gettext("SAD"), false, "diag_ipsec_sad.php");
-$tab_array[] = array(gettext("SPD"), false, "diag_ipsec_spd.php");
+$tab_array[] = array(gettext("Overview"), true, "status_ipsec.php");
+$tab_array[] = array(gettext("Leases"), false, "status_ipsec_leases.php");
+$tab_array[] = array(gettext("SAD"), false, "status_ipsec_sad.php");
+$tab_array[] = array(gettext("SPD"), false, "status_ipsec_spd.php");
display_top_tabs($tab_array);
?>
@@ -278,18 +278,15 @@ if (is_array($status)) {
<?php
if ($ikesa['state'] != 'ESTABLISHED') {
?>
- <a href="diag_ipsec.php?act=connect&amp;ikeid=<?=$con_id; ?>" class="btn btn-xs btn-success" data-toggle="tooltip" title="Connect VPN" >
+ <a href="status_ipsec.php?act=connect&amp;ikeid=<?=$con_id; ?>" class="btn btn-xs btn-success" data-toggle="tooltip" title="Connect VPN" >
<?=gettext("Connect VPN")?>
</a>
<?php
} else {
?>
- <a href="diag_ipsec.php?act=ikedisconnect&amp;ikeid=<?=$con_id; ?>" class="btn btn-xs btn-danger" data-toggle="tooltip" title="Disconnect VPN">
+ <a href="status_ipsec.php?act=ikedisconnect&amp;ikeid=<?=$con_id; ?>" class="btn btn-xs btn-danger" data-toggle="tooltip" title="Disconnect VPN">
<?=gettext("Disconnect")?>
</a><br />
- <a href="diag_ipsec.php?act=ikedisconnect&amp;ikeid=<?=$con_id; ?>&amp;ikesaid=<?=$ikesa['uniqueid']; ?>" class="btn btn-xs btn-warning" data-toggle="tooltip" title="Disconnect VPN connection">
- <?=gettext("Disconnect")?>
- </a>
<?php
}
?>
@@ -396,7 +393,7 @@ if (is_array($status)) {
?>
</td>
<td>
- <a href="diag_ipsec.php?act=childdisconnect&amp;ikeid=<?=$con_id; ?>&amp;ikesaid=<?=$childsa['uniqueid']; ?>" class="btn btn-xs btn-warning" data-toggle="tooltip" title="<?=gettext('Disconnect Child SA')?>">
+ <a href="status_ipsec.php?act=childdisconnect&amp;ikeid=<?=$con_id; ?>&amp;ikesaid=<?=$childsa['uniqueid']; ?>" class="btn btn-xs btn-warning" data-toggle="tooltip" title="<?=gettext('Disconnect Child SA')?>">
<?=gettext("Disconnect")?>
</a>
</td>
@@ -493,7 +490,7 @@ foreach ($a_phase1 as $ph1ent) {
<?=gettext("Disconnected")?>
</td>
<td >
- <a href="diag_ipsec.php?act=connect&amp;ikeid=<?=$ph1ent['ikeid']; ?>" class="btn btn-xs btn-success">
+ <a href="status_ipsec.php?act=connect&amp;ikeid=<?=$ph1ent['ikeid']; ?>" class="btn btn-xs btn-success">
<?=gettext("Connect VPN")?>
</a>
</td>
diff --git a/src/usr/local/www/diag_ipsec_leases.php b/src/usr/local/www/status_ipsec_leases.php
index 51fcab2..7fee324 100644
--- a/src/usr/local/www/diag_ipsec_leases.php
+++ b/src/usr/local/www/status_ipsec_leases.php
@@ -1,6 +1,6 @@
<?php
/*
- diag_ipsec_leases.php
+ status_ipsec_leases.php
*/
/* ====================================================================
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
@@ -62,7 +62,7 @@
##|*IDENT=page-status-ipsec-leases
##|*NAME=Status: IPsec: Leases
##|*DESCR=Allow access to the 'Status: IPsec: Leases' page.
-##|*MATCH=diag_ipsec_leases.php*
+##|*MATCH=status_ipsec_leases.php*
##|-PRIV
define(DEBUG, true); // Force dummy data for testing. Setting up a pFSense box to get real data is far too hard!
@@ -77,10 +77,10 @@ include("head.inc");
$mobile = ipsec_dump_mobile();
$tab_array = array();
-$tab_array[] = array(gettext("Overview"), false, "diag_ipsec.php");
-$tab_array[] = array(gettext("Leases"), true, "diag_ipsec_leases.php");
-$tab_array[] = array(gettext("SAD"), false, "diag_ipsec_sad.php");
-$tab_array[] = array(gettext("SPD"), false, "diag_ipsec_spd.php");
+$tab_array[] = array(gettext("Overview"), false, "status_ipsec.php");
+$tab_array[] = array(gettext("Leases"), true, "status_ipsec_leases.php");
+$tab_array[] = array(gettext("SAD"), false, "status_ipsec_sad.php");
+$tab_array[] = array(gettext("SPD"), false, "status_ipsec_spd.php");
display_top_tabs($tab_array);
if (isset($mobile['pool']) && is_array($mobile['pool'])) {
diff --git a/src/usr/local/www/diag_ipsec_sad.php b/src/usr/local/www/status_ipsec_sad.php
index 2e785a2..fa2b8d6 100644
--- a/src/usr/local/www/diag_ipsec_sad.php
+++ b/src/usr/local/www/status_ipsec_sad.php
@@ -1,6 +1,6 @@
<?php
/*
- diag_ipsec_sad.php
+ status_ipsec_sad.php
*/
/* ====================================================================
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
@@ -65,7 +65,7 @@
##|*IDENT=page-status-ipsec-sad
##|*NAME=Status: IPsec: SAD
##|*DESCR=Allow access to the 'Status: IPsec: SAD' page.
-##|*MATCH=diag_ipsec_sad.php*
+##|*MATCH=status_ipsec_sad.php*
##|-PRIV
require("guiconfig.inc");
@@ -88,10 +88,10 @@ if ($_GET['act'] == "del") {
}
$tab_array = array();
-$tab_array[] = array(gettext("Overview"), false, "diag_ipsec.php");
-$tab_array[] = array(gettext("Leases"), false, "diag_ipsec_leases.php");
-$tab_array[] = array(gettext("SAD"), true, "diag_ipsec_sad.php");
-$tab_array[] = array(gettext("SPD"), false, "diag_ipsec_spd.php");
+$tab_array[] = array(gettext("Overview"), false, "status_ipsec.php");
+$tab_array[] = array(gettext("Leases"), false, "status_ipsec_leases.php");
+$tab_array[] = array(gettext("SAD"), true, "status_ipsec_sad.php");
+$tab_array[] = array(gettext("SPD"), false, "status_ipsec_spd.php");
display_top_tabs($tab_array);
if (count($sad)) {
@@ -140,7 +140,7 @@ if (count($sad)) {
$args .= "&amp;proto=" . rawurlencode($sa['proto']);
$args .= "&amp;spi=" . rawurlencode("0x" . $sa['spi']);
?>
- <a class="btn btn-xs btn-danger" href="diag_ipsec_sad.php?act=del&amp;<?=$args?>">Delete</a>
+ <a class="btn btn-xs btn-danger" href="status_ipsec_sad.php?act=del&amp;<?=$args?>">Delete</a>
</td>
</tr>
diff --git a/src/usr/local/www/diag_ipsec_spd.php b/src/usr/local/www/status_ipsec_spd.php
index 2e807a6..464408b 100644
--- a/src/usr/local/www/diag_ipsec_spd.php
+++ b/src/usr/local/www/status_ipsec_spd.php
@@ -1,6 +1,6 @@
<?php
/*
- diag_ipsec_spd.php
+ status_ipsec_spd.php
*/
/* ====================================================================
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
@@ -65,7 +65,7 @@
##|*IDENT=page-status-ipsec-spd
##|*NAME=Status: IPsec: SPD
##|*DESCR=Allow access to the 'Status: IPsec: SPD' page.
-##|*MATCH=diag_ipsec_spd.php*
+##|*MATCH=status_ipsec_spd.php*
##|-PRIV
define(RIGHTARROW, '&#x25ba;');
@@ -81,10 +81,10 @@ include("head.inc");
$spd = ipsec_dump_spd();
$tab_array = array();
-$tab_array[0] = array(gettext("Overview"), false, "diag_ipsec.php");
-$tab_array[1] = array(gettext("Leases"), false, "diag_ipsec_leases.php");
-$tab_array[2] = array(gettext("SAD"), false, "diag_ipsec_sad.php");
-$tab_array[3] = array(gettext("SPD"), true, "diag_ipsec_spd.php");
+$tab_array[0] = array(gettext("Overview"), false, "status_ipsec.php");
+$tab_array[1] = array(gettext("Leases"), false, "status_ipsec_leases.php");
+$tab_array[2] = array(gettext("SAD"), false, "status_ipsec_sad.php");
+$tab_array[3] = array(gettext("SPD"), true, "status_ipsec_spd.php");
display_top_tabs($tab_array);
if (count($spd)) {
diff --git a/src/usr/local/www/status_lb_pool.php b/src/usr/local/www/status_lb_pool.php
index 47fbfce..c14d6eb 100644
--- a/src/usr/local/www/status_lb_pool.php
+++ b/src/usr/local/www/status_lb_pool.php
@@ -96,7 +96,7 @@ if (!$nentries)
$now = time();
$year = date("Y");
-$pgtitle = array(gettext("Status"), gettext("Load Balancer"), gettext("Pool"));
+$pgtitle = array(gettext("Status"), gettext("Load Balancer"), gettext("Pools"));
$shortcut_section = "relayd";
include("head.inc");
diff --git a/src/usr/local/www/status_lb_vs.php b/src/usr/local/www/status_lb_vs.php
index be608bb..4f1ab0d 100644
--- a/src/usr/local/www/status_lb_vs.php
+++ b/src/usr/local/www/status_lb_vs.php
@@ -85,7 +85,7 @@ $a_vs = &$config['load_balancer']['virtual_server'];
$a_pool = &$config['load_balancer']['lbpool'];
$rdr_a = get_lb_redirects();
-$pgtitle = array(gettext("Status"), gettext("Load Balancer"), gettext("Virtual Server"));
+$pgtitle = array(gettext("Status"), gettext("Load Balancer"), gettext("Virtual Servers"));
include("head.inc");
/* active tabs */
diff --git a/src/usr/local/www/diag_logs.php b/src/usr/local/www/status_logs.php
index d3fc1f8..d033a00 100755
--- a/src/usr/local/www/diag_logs.php
+++ b/src/usr/local/www/status_logs.php
@@ -1,6 +1,6 @@
<?php
/*
- diag_logs.php
+ status_logs.php
*/
/* ====================================================================
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
@@ -64,7 +64,7 @@
##|*IDENT=page-diagnostics-logs-system
##|*NAME=Status: Logs: System
##|*DESCR=Allow access to the 'Status: System Logs: General' page.
-##|*MATCH=diag_logs.php
+##|*MATCH=status_logs.php
##|-PRIV
require("guiconfig.inc");
@@ -112,6 +112,9 @@ if (!$_GET['logfile']) {
}
}
+$system_logfile = "{$g['varlog_path']}/" . basename($logfile) . ".log";
+
+
function getGETPOSTsettingvalue($settingname, $default) {
$settingvalue = $default;
if ($_GET[$settingname]) {
@@ -123,9 +126,11 @@ function getGETPOSTsettingvalue($settingname, $default) {
return $settingvalue;
}
+
$filtersubmit = getGETPOSTsettingvalue('filtersubmit', null);
if ($filtersubmit) {
+ $filter_active = true;
$filtertext = getGETPOSTsettingvalue('filtertext', "");
$filterlogentries_qty = getGETPOSTsettingvalue('filterlogentries_qty', null);
}
@@ -133,6 +138,7 @@ if ($filtersubmit) {
$filterlogentries_submit = getGETPOSTsettingvalue('filterlogentries_submit', null);
if ($filterlogentries_submit) {
+ $filter_active = true;
$filterfieldsarray = array();
$filterfieldsarray['time'] = getGETPOSTsettingvalue('filterlogentries_time', null);
@@ -142,9 +148,111 @@ if ($filterlogentries_submit) {
$filterlogentries_qty = getGETPOSTsettingvalue('filterlogentries_qty', null);
}
-$system_logfile = "{$g['varlog_path']}/" . basename($logfile) . ".log";
-$nentries = $config['syslog']['nentries'];
+# Manage Log - Code
+
+$specific_log = basename($logfile) . '_settings';
+
+# All
+$pconfig['cronorder'] = $config['syslog'][$specific_log]['cronorder'];
+$pconfig['nentries'] = $config['syslog'][$specific_log]['nentries'];
+$pconfig['logfilesize'] = $config['syslog'][$specific_log]['logfilesize'];
+$pconfig['format'] = $config['syslog'][$specific_log]['format'];
+
+# System General (main) Specific
+$pconfig['loglighttpd'] = !isset($config['syslog']['nologlighttpd']);
+
+$save_settings = getGETPOSTsettingvalue('save_settings', null);
+
+if ($save_settings) {
+
+ # All
+ $cronorder = getGETPOSTsettingvalue('cronorder', null);
+ $nentries = getGETPOSTsettingvalue('nentries', null);
+ $logfilesize = getGETPOSTsettingvalue('logfilesize', null);
+ $format = getGETPOSTsettingvalue('format', null);
+
+ # System General (main) Specific
+ $loglighttpd = getGETPOSTsettingvalue('loglighttpd', null);
+
+ unset($input_errors);
+ $pconfig = $_POST;
+
+ /* input validation */
+ # All
+ if (isset($nentries) && (strlen($nentries) > 0)) {
+ if (!is_numeric($nentries) || ($nentries < 5) || ($nentries > 2000)) {
+ $input_errors[] = gettext("Number of log entries to show must be between 5 and 2000.");
+ }
+ }
+
+ if (isset($logfilesize) && (strlen($logfilesize) > 0)) {
+ if (!is_numeric($logfilesize) || ($logfilesize < 100000)) {
+ $input_errors[] = gettext("Log file size must be numeric and greater than or equal to 100000.");
+ }
+ }
+
+ if (!$input_errors) {
+
+ # Clear out the specific log settings and leave only the applied settings to override the general logging options (global) settings.
+ unset($config['syslog'][$specific_log]);
+
+ # All
+ if ($cronorder != '') { # if not using the general logging options setting (global)
+ $config['syslog'][$specific_log]['cronorder'] = $cronorder;
+ }
+
+ if (isset($nentries) && (strlen($nentries) > 0)) {
+ $config['syslog'][$specific_log]['nentries'] = (int)$nentries;
+ }
+
+ if (isset($logfilesize) && (strlen($logfilesize) > 0)) {
+ $config['syslog'][$specific_log]['logfilesize'] = (int)$logfilesize;
+ }
+
+ if ($format != '') { # if not using the general logging options setting (global)
+ $config['syslog'][$specific_log]['format'] = $format;
+ }
+
+ # System General (main) Specific
+ if ($logfile == 'system') {
+ $oldnologlighttpd = isset($config['syslog']['nologlighttpd']);
+ $config['syslog']['nologlighttpd'] = $loglighttpd ? false : true;
+ }
+
+
+ write_config($desc = "Log Display Settings Saved: " . gettext($allowed_logs[$logfile]["name"]));
+
+ $retval = 0;
+ $savemsg = get_std_save_message($retval);
+
+ # System General (main) Specific
+ if ($logfile == 'system') {
+ if ($oldnologlighttpd !== isset($config['syslog']['nologlighttpd'])) {
+ ob_flush();
+ flush();
+ log_error(gettext("webConfigurator configuration has changed. Restarting webConfigurator."));
+ send_event("service restart webgui");
+ $savemsg .= "<br />" . gettext("WebGUI process is restarting.");
+ }
+ }
+ }
+}
+
+
+# Formatted/Raw Display
+if ($config['syslog'][$specific_log]['format'] == 'formatted') {
+ $rawfilter = false;
+}
+else if ($config['syslog'][$specific_log]['format'] == 'raw') {
+ $rawfilter = true;
+}
+else { # Use the general logging options setting (global).
+ $rawfilter = isset($config['syslog']['rawfilter']);
+}
+
+
+isset($config['syslog'][$specific_log]['nentries']) ? $nentries = $config['syslog'][$specific_log]['nentries'] : $nentries = $config['syslog']['nentries'];
# Override Display Quantity
if ($filterlogentries_qty) {
@@ -172,34 +280,47 @@ if (!empty($allowed_logs[$logfile]["shortcut"])) {
$pgtitle = array(gettext("Status"), gettext("System logs"), gettext($allowed_logs[$logfile]["name"]));
include("head.inc");
+if (!$input_errors && $savemsg) {
+ print_info_box($savemsg);
+ $manage_log_active = false;
+}
+
$tab_array = array();
-$tab_array[] = array(gettext("System"), ($logfile == 'system'), "diag_logs.php");
-$tab_array[] = array(gettext("Firewall"), false, "diag_logs_filter.php");
-$tab_array[] = array(gettext("DHCP"), ($logfile == 'dhcpd'), "diag_logs.php?logfile=dhcpd");
-$tab_array[] = array(gettext("Portal Auth"), ($logfile == 'portalauth'), "diag_logs.php?logfile=portalauth");
-$tab_array[] = array(gettext("IPsec"), ($logfile == 'ipsec'), "diag_logs.php?logfile=ipsec");
-$tab_array[] = array(gettext("PPP"), ($logfile == 'ppp'), "diag_logs.php?logfile=ppp");
-$tab_array[] = array(gettext("VPN"), false, "diag_logs_vpn.php");
-$tab_array[] = array(gettext("Load Balancer"), ($logfile == 'relayd'), "diag_logs.php?logfile=relayd");
-$tab_array[] = array(gettext("OpenVPN"), ($logfile == 'openvpn'), "diag_logs.php?logfile=openvpn");
-$tab_array[] = array(gettext("NTP"), ($logfile == 'ntpd'), "diag_logs.php?logfile=ntpd");
-$tab_array[] = array(gettext("Settings"), false, "diag_logs_settings.php");
+$tab_array[] = array(gettext("System"), ($logfile == 'system'), "status_logs.php");
+$tab_array[] = array(gettext("Firewall"), false, "status_logs_filter.php");
+$tab_array[] = array(gettext("DHCP"), ($logfile == 'dhcpd'), "status_logs.php?logfile=dhcpd");
+$tab_array[] = array(gettext("Portal Auth"), ($logfile == 'portalauth'), "status_logs.php?logfile=portalauth");
+$tab_array[] = array(gettext("IPsec"), ($logfile == 'ipsec'), "status_logs.php?logfile=ipsec");
+$tab_array[] = array(gettext("PPP"), ($logfile == 'ppp'), "status_logs.php?logfile=ppp");
+$tab_array[] = array(gettext("VPN"), false, "status_logs_vpn.php");
+$tab_array[] = array(gettext("Load Balancer"), ($logfile == 'relayd'), "status_logs.php?logfile=relayd");
+$tab_array[] = array(gettext("OpenVPN"), ($logfile == 'openvpn'), "status_logs.php?logfile=openvpn");
+$tab_array[] = array(gettext("NTP"), ($logfile == 'ntpd'), "status_logs.php?logfile=ntpd");
+$tab_array[] = array(gettext("Settings"), false, "status_logs_settings.php");
display_top_tabs($tab_array);
$tab_array = array();
if (in_array($logfile, array('system', 'gateways', 'routing', 'resolver', 'wireless'))) {
- $tab_array[] = array(gettext("General"), ($logfile == 'system'), "/diag_logs.php");
- $tab_array[] = array(gettext("Gateways"), ($logfile == 'gateways'), "/diag_logs.php?logfile=gateways");
- $tab_array[] = array(gettext("Routing"), ($logfile == 'routing'), "/diag_logs.php?logfile=routing");
- $tab_array[] = array(gettext("Resolver"), ($logfile == 'resolver'), "/diag_logs.php?logfile=resolver");
- $tab_array[] = array(gettext("Wireless"), ($logfile == 'wireless'), "/diag_logs.php?logfile=wireless");
+ $tab_array[] = array(gettext("General"), ($logfile == 'system'), "/status_logs.php");
+ $tab_array[] = array(gettext("Gateways"), ($logfile == 'gateways'), "/status_logs.php?logfile=gateways");
+ $tab_array[] = array(gettext("Routing"), ($logfile == 'routing'), "/status_logs.php?logfile=routing");
+ $tab_array[] = array(gettext("Resolver"), ($logfile == 'resolver'), "/status_logs.php?logfile=resolver");
+ $tab_array[] = array(gettext("Wireless"), ($logfile == 'wireless'), "/status_logs.php?logfile=wireless");
display_top_tabs($tab_array, false, 'nav nav-tabs');
}
-if (!isset($config['syslog']['rawfilter'])) { // Advanced log filter form
+define(SEC_OPEN, 0x00);
+define(SEC_CLOSED, 0x04);
+
+if ($filter_active)
+ $filter_state = SEC_OPEN;
+else
+ $filter_state = SEC_CLOSED;
+
+if (!$rawfilter) { // Advanced log filter form
$form = new Form(false);
- $section = new Form_Section(gettext('Advanced Log Filter'), 'adv-filter-panel', true);
+ $section = new Form_Section('Advanced Log Filter', 'adv-filter-panel', COLLAPSIBLE|$filter_state);
$group = new Form_Group('');
@@ -208,21 +329,21 @@ if (!isset($config['syslog']['rawfilter'])) { // Advanced log filter form
null,
'text',
$filterfieldsarray['time']
- ))->setHelp(gettext('Time'));
+ ))->setWidth(3)->setHelp('Time');
$group->add(new Form_Input(
'filterlogentries_process',
null,
'text',
$filterfieldsarray['process']
- ))->setHelp(gettext('Process'));
+ ))->setWidth(2)->setHelp('Process');
$group->add(new Form_Input(
'filterlogentries_pid',
null,
'text',
$filterfieldsarray['pid']
- ))->setHelp(gettext('PID'));
+ ))->setWidth(2)->setHelp('PID');
$group->add(new Form_Input(
'filterlogentries_qty',
@@ -230,7 +351,7 @@ if (!isset($config['syslog']['rawfilter'])) { // Advanced log filter form
'number',
$filterlogentries_qty,
['placeholder' => $nentries]
- ))->setHelp(gettext('Quantity'));
+ ))->setWidth(2)->setHelp('Quantity');
$section->add($group);
@@ -241,7 +362,7 @@ if (!isset($config['syslog']['rawfilter'])) { // Advanced log filter form
null,
'text',
$filterfieldsarray['message']
- ))->setHelp(gettext('Log Message'));
+ ))->setWidth(7)->setHelp('Message');
$btnsubmit = new Form_Button(
'filterlogentries_submit',
@@ -253,7 +374,7 @@ if (!isset($config['syslog']['rawfilter'])) { // Advanced log filter form
else { // Simple log filter form
$form = new Form(false);
- $section = new Form_Section(gettext('Log Filter'), 'basic-filter-panel', true);
+ $section = new Form_Section('Log Filter', 'basic-filter-panel', COLLAPSIBLE|$filter_state);
$group = new Form_Group('');
@@ -262,7 +383,7 @@ else { // Simple log filter form
null,
'text',
$filtertext
- ))->setHelp(gettext('Filter Expression'));
+ ))->setWidth(6)->setHelp('Filter Expression');
$group->add(new Form_Input(
'filterlogentries_qty',
@@ -270,7 +391,7 @@ else { // Simple log filter form
'number',
$filterlogentries_qty,
['placeholder' => $nentries]
- ))->setHelp(gettext('Quantity'));
+ ))->setWidth(2)->setHelp('Quantity');
$btnsubmit = new Form_Button(
'filtersubmit',
@@ -293,7 +414,7 @@ $form->add($section);
print $form;
// Now the forms are complete we can draw the log table and its controls
-if (!isset($config['syslog']['rawfilter'])) {
+if (!$rawfilter) {
if ($filterlogentries_submit)
$filterlog = conv_log_filter($system_logfile, $nentries, $nentries + 100, $filterfieldsarray);
else
@@ -305,62 +426,68 @@ if (!isset($config['syslog']['rawfilter'])) {
<h2 class="panel-title">
<?php
if ((!$filtertext) && (!$filterfieldsarray))
- printf(gettext("Last %d %s log entries."), count($filterlog), $logfile);
+ printf(gettext("Last %d %s log entries."), count($filterlog), gettext($allowed_logs[$logfile]["name"]));
else
- printf(gettext("%d matched %s log entries."), count($filterlog), $logfile);
+ printf(gettext("%d matched %s log entries."), count($filterlog), gettext($allowed_logs[$logfile]["name"]));
- printf(gettext(" (Maximum %d)"), $nentries);
+ printf(" (" . gettext("Maximum %d") . ")", $nentries);
?>
</h2>
</div>
<div class="panel-body">
<div class="table-responsive">
- <table class="table table-striped table-hover table-compact">
- <tr>
- <th><?=gettext("Time")?></th>
- <th><?=gettext("Process")?></th>
- <th><?=gettext("PID")?></th>
- <th style="width:100%"><?=gettext("Log Message")?></th>
- </tr>
+ <table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
+ <thead>
+ <tr>
+ <th><?=gettext("Time")?></th>
+ <th><?=gettext("Process")?></th>
+ <th><?=gettext("PID")?></th>
+ <th style="width:100%"><?=gettext("Message")?></th>
+ </tr>
+ </thead>
+ <tbody>
<?php
foreach ($filterlog as $filterent) {
?>
- <tr>
- <td style="white-space:nowrap;">
- <?=htmlspecialchars($filterent['time'])?>
- </td>
- <td style="white-space:nowrap;">
- <?=htmlspecialchars($filterent['process'])?>
- </td>
- <td style="white-space:nowrap;">
- <?=htmlspecialchars($filterent['pid'])?>
- </td>
- <td style="word-wrap:break-word; word-break:break-all; white-space:normal">
- <?=htmlspecialchars($filterent['message'])?>
- </td>
- </tr>
+ <tr>
+ <td style="white-space:nowrap;">
+ <?=htmlspecialchars($filterent['time'])?>
+ </td>
+ <td style="white-space:nowrap;">
+ <?=htmlspecialchars($filterent['process'])?>
+ </td>
+ <td style="white-space:nowrap;">
+ <?=htmlspecialchars($filterent['pid'])?>
+ </td>
+ <td style="word-wrap:break-word; word-break:break-all; white-space:normal">
+ <?=htmlspecialchars($filterent['message'])?>
+ </td>
+ </tr>
<?php
} // e-o-foreach
?>
+ </tbody>
</table>
+<?php
+ if (count($filterlog) == 0)
+ print_info_box(gettext('No logs to display'));
+?>
</div>
</div>
</div>
<?php
- if (count($filterlog) == 0)
- print_info_box(gettext('No logs to display'));
}
else
{
?>
<div class="panel panel-default">
- <div class="panel-heading"><h2 class="panel-title"><?=gettext("Last ")?><?=$nentries?> <?=$logfile?><?=gettext(" log entries")?></h2></div>
+ <div class="panel-heading"><h2 class="panel-title"><?=gettext("Last ")?><?=$nentries?> <?=gettext($allowed_logs[$logfile]["name"])?><?=gettext(" log entries")?></h2></div>
<div class="table table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
- <th class="col-sm-2"></th>
- <th></th>
+ <th><?=gettext("Time")?></th>
+ <th style="width:100%"><?=gettext("Message")?></th>
</tr>
</thead>
<tbody>
@@ -377,20 +504,154 @@ else
?>
</tbody>
</table>
- </div>
-</div>
<?php
if ($rows == 0)
print_info_box(gettext('No logs to display'));
+?>
+ </div>
+</div>
+<?php
}
?>
<?php
+# Manage Log - Section/Form
+
+if ($input_errors) {
+ print_input_errors($input_errors);
+ $manage_log_active = true;
+}
+
+if ($manage_log_active)
+ $manage_log_state = SEC_OPEN;
+else
+ $manage_log_state = SEC_CLOSED;
+
$form = new Form(false);
-$section = new Form_Section(gettext('Manage Log'), 'log-manager-panel', true);
+$section = new Form_Section(gettext('Manage') . ' ' . gettext($allowed_logs[$logfile]["name"]) . ' ' . gettext('Log'), 'log-manager-panel', COLLAPSIBLE|$manage_log_state);
+
+$section->addInput(new Form_StaticText(
+ '',
+ 'These settings override the "General Logging Options" settings.'
+));
+
+
+# All
+$group = new Form_Group('Forward/Reverse Display');
+
+$group->add(new Form_Checkbox(
+ 'cronorder',
+ null,
+ 'Forward',
+ ($pconfig['cronorder'] == 'forward') ? true : false,
+ 'forward'
+))->displayAsRadio()->setHelp('(newest at bottom)');
+
+$group->add(new Form_Checkbox(
+ 'cronorder',
+ null,
+ 'Reverse',
+ ($pconfig['cronorder'] == 'reverse') ? true : false,
+ 'reverse'
+))->displayAsRadio()->setHelp('(newest at top)');
+
+$group->add(new Form_Checkbox(
+ 'cronorder',
+ null,
+ 'General Logging Options Setting',
+ ($pconfig['cronorder'] == '') ? true : false,
+ ''
+))->displayAsRadio();
+
+$group->setHelp('Show log entries in forward or reverse order.');
+$section->add($group);
+
+$group = new Form_Group('GUI Log Entries');
+
+# Use the general logging options setting (global) as placeholder.
+$group->add(new Form_Input(
+ 'nentries',
+ 'GUI Log Entries',
+ 'number',
+ $pconfig['nentries'],
+ ['placeholder' => $config['syslog']['nentries']]
+))->setWidth(2);
+
+$group->setHelp('This is the number of log entries displayed in the GUI. It does not affect how many entries are contained in the log.');
+$section->add($group);
+
+$group = new Form_Group('Log file size (Bytes)');
+
+# Use the general logging options setting (global) as placeholder.
+$group->add(new Form_Input(
+ 'logfilesize',
+ 'Log file size (Bytes)',
+ 'number',
+ $pconfig['logfilesize'],
+ ['placeholder' => $config['syslog']['logfilesize'] ? $config['syslog']['logfilesize'] : "511488"]
+))->setWidth(2);
+$group->setHelp("The log is held in a constant-size circular log file. This field controls how large the log file is, and thus how many entries may exist inside the log. The default is approximately 500KB." .
+ '<br /><br />' .
+ "NOTE: The log size is changed the next time it is cleared. To immediately change the log size, first save the options to set the size, then clear the log using the \"Clear Log\" action below. ");
+$section->add($group);
+
+$group = new Form_Group('Formatted/Raw Display');
+
+$group->add(new Form_Checkbox(
+ 'format',
+ null,
+ 'Formatted',
+ ($pconfig['format'] == 'formatted') ? true : false,
+ 'formatted'
+))->displayAsRadio();
+
+$group->add(new Form_Checkbox(
+ 'format',
+ null,
+ 'Raw',
+ ($pconfig['format'] == 'raw') ? true : false,
+ 'raw'
+))->displayAsRadio();
+
+$group->add(new Form_Checkbox(
+ 'format',
+ null,
+ 'General Logging Options Setting',
+ ($pconfig['format'] == '') ? true : false,
+ ''
+))->displayAsRadio();
+
+$group->setHelp('Show the log entries as formatted or raw output as generated by the service. The raw output will reveal more detailed information, but it is more difficult to read.');
+$section->add($group);
+
+
+# System General (main) Specific
+if ($logfile == 'system') {
+ $section->addInput(new Form_Checkbox(
+ 'loglighttpd',
+ 'Web Server Log',
+ 'Log errors from the web server process',
+ $pconfig['loglighttpd']
+ ))->setHelp('If this is checked, errors from the lighttpd web server process for the GUI or Captive Portal will appear in the system log.');
+}
+
+
+$group = new Form_Group('Action');
+
+$btnsavesettings = new Form_Button(
+ 'save_settings',
+ gettext('Save'),
+ null
+);
+
+$btnsavesettings->addClass('btn-sm');
+
+$group->add(new Form_StaticText(
+ '',
+ $btnsavesettings
+))->setHelp('Saves changed settings.');
-$group = new Form_Group('');
$btnclear = new Form_Button(
'clear',
@@ -401,13 +662,10 @@ $btnclear = new Form_Button(
$btnclear->removeClass('btn-primary')->addClass('btn-danger')->addClass('btn-sm');
-if ($logfile == 'dhcpd')
- print_info_box(gettext('Warning: Clearing the log file will restart the DHCP daemon.'));
-
$group->add(new Form_StaticText(
'',
$btnclear
-));
+))->setHelp('Clears local log file and reinitializes it as an empty log. Save any settings changes first.');
$section->add($group);
$form->add($section);
diff --git a/src/usr/local/www/status_logs_filter.php b/src/usr/local/www/status_logs_filter.php
new file mode 100644
index 0000000..d009f3e
--- /dev/null
+++ b/src/usr/local/www/status_logs_filter.php
@@ -0,0 +1,1036 @@
+<?php
+/*
+ status_logs_filter.php
+*/
+/* ====================================================================
+ * Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
+ *
+ * Some or all of this file is based on the m0n0wall project which is
+ * Copyright (c) 2004 Manuel Kasper (BSD 2 clause)
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgment:
+ * "This product includes software developed by the pfSense Project
+ * for use in the pfSense software distribution. (http://www.pfsense.org/).
+ *
+ * 4. The names "pfSense" and "pfSense Project" must not be used to
+ * endorse or promote products derived from this software without
+ * prior written permission. For written permission, please contact
+ * coreteam@pfsense.org.
+ *
+ * 5. Products derived from this software may not be called "pfSense"
+ * nor may "pfSense" appear in their names without prior written
+ * permission of the Electric Sheep Fencing, LLC.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ * acknowledgment:
+ *
+ * "This product includes software developed by the pfSense Project
+ * for use in the pfSense software distribution (http://www.pfsense.org/).
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ====================================================================
+ *
+ */
+
+/*
+ pfSense_MODULE: filter
+*/
+
+##|+PRIV
+##|*IDENT=page-diagnostics-logs-firewall
+##|*NAME=Status: Logs: Firewall
+##|*DESCR=Allow access to the 'Status: Logs: Firewall' page.
+##|*MATCH=status_logs_filter.php*
+##|-PRIV
+
+require("guiconfig.inc");
+require_once("ipsec.inc");
+require_once("filter_log.inc");
+
+
+# --- AJAX RESOLVE ---
+if (isset($_POST['resolve'])) {
+ $ip = strtolower($_POST['resolve']);
+ $res = (is_ipaddr($ip) ? gethostbyaddr($ip) : '');
+
+ if ($res && $res != $ip) {
+ $response = array('resolve_ip' => $ip, 'resolve_text' => $res);
+ } else {
+ $response = array('resolve_ip' => $ip, 'resolve_text' => gettext("Cannot resolve"));
+ }
+
+ echo json_encode(str_replace("\\", "\\\\", $response)); // single escape chars can break JSON decode
+ exit;
+}
+
+
+/*
+Build a list of allowed log files so we can reject others to prevent the page
+from acting on unauthorized files.
+*/
+$allowed_logs = array(
+ "filter" => array("name" => "Firewall",
+ "shortcut" => "filter"),
+);
+
+// The logs to display are specified in a GET argument. Default to 'system' logs
+if (!$_GET['logfile']) {
+ $logfile = 'filter';
+} else {
+ $logfile = $_GET['logfile'];
+ if (!array_key_exists($logfile, $allowed_logs)) {
+ /* Do not let someone attempt to load an unauthorized log. */
+ $logfile = 'filter';
+ }
+}
+
+$filter_logfile = "{$g['varlog_path']}/" . basename($logfile) . ".log";
+
+
+function getGETPOSTsettingvalue($settingname, $default) {
+ $settingvalue = $default;
+ if ($_GET[$settingname]) {
+ $settingvalue = $_GET[$settingname];
+ }
+ if ($_POST[$settingname]) {
+ $settingvalue = $_POST[$settingname];
+ }
+ return $settingvalue;
+}
+
+
+$rulenum = getGETPOSTsettingvalue('getrulenum', null);
+
+if ($rulenum) {
+ list($rulenum, $tracker, $type) = explode(',', $rulenum);
+ $rule = find_rule_by_number($rulenum, $tracker, $type);
+ echo gettext("The rule that triggered this action is") . ":\n\n{$rule}";
+ exit;
+}
+
+$filtersubmit = getGETPOSTsettingvalue('filtersubmit', null);
+
+if ($filtersubmit) {
+ $filter_active = true;
+ $interfacefilter = getGETPOSTsettingvalue('interface', null);
+ $filtertext = getGETPOSTsettingvalue('filtertext', "");
+ $filterlogentries_qty = getGETPOSTsettingvalue('filterlogentries_qty', null);
+}
+
+$filterlogentries_submit = getGETPOSTsettingvalue('filterlogentries_submit', null);
+
+if ($filterlogentries_submit) {
+ $filter_active = true;
+ $filterfieldsarray = array();
+
+ $actpass = getGETPOSTsettingvalue('actpass', null);
+ $actblock = getGETPOSTsettingvalue('actblock', null);
+ $filterfieldsarray['act'] = str_replace(" ", " ", trim($actpass . " " . $actblock));
+ $filterfieldsarray['act'] = $filterfieldsarray['act'] != "" ? $filterfieldsarray['act'] : 'All';
+ $filterfieldsarray['time'] = getGETPOSTsettingvalue('filterlogentries_time', null);
+ $filterfieldsarray['interface'] = getGETPOSTsettingvalue('filterlogentries_interfaces', null);
+ $filterfieldsarray['srcip'] = getGETPOSTsettingvalue('filterlogentries_sourceipaddress', null);
+ $filterfieldsarray['srcport'] = getGETPOSTsettingvalue('filterlogentries_sourceport', null);
+ $filterfieldsarray['dstip'] = getGETPOSTsettingvalue('filterlogentries_destinationipaddress', null);
+ $filterfieldsarray['dstport'] = getGETPOSTsettingvalue('filterlogentries_destinationport', null);
+ $filterfieldsarray['proto'] = getGETPOSTsettingvalue('filterlogentries_protocol', null);
+ $filterfieldsarray['tcpflags'] = getGETPOSTsettingvalue('filterlogentries_protocolflags', null);
+ $filterlogentries_qty = getGETPOSTsettingvalue('filterlogentries_qty', null);
+}
+
+
+# Manage Log - Code
+
+$specific_log = basename($logfile) . '_settings';
+
+# All
+$pconfig['cronorder'] = $config['syslog'][$specific_log]['cronorder'];
+$pconfig['nentries'] = $config['syslog'][$specific_log]['nentries'];
+$pconfig['logfilesize'] = $config['syslog'][$specific_log]['logfilesize'];
+$pconfig['format'] = $config['syslog'][$specific_log]['format'];
+
+# System General (main) Specific
+$pconfig['loglighttpd'] = !isset($config['syslog']['nologlighttpd']);
+
+# Firewall Specific
+$pconfig['logdefaultblock'] = !isset($config['syslog']['nologdefaultblock']);
+$pconfig['logdefaultpass'] = isset($config['syslog']['nologdefaultpass']);
+$pconfig['logbogons'] = !isset($config['syslog']['nologbogons']);
+$pconfig['logprivatenets'] = !isset($config['syslog']['nologprivatenets']);
+$pconfig['filterdescriptions'] = $config['syslog']['filterdescriptions'];
+
+$save_settings = getGETPOSTsettingvalue('save_settings', null);
+
+if ($save_settings) {
+
+ # All
+ $cronorder = getGETPOSTsettingvalue('cronorder', null);
+ $nentries = getGETPOSTsettingvalue('nentries', null);
+ $logfilesize = getGETPOSTsettingvalue('logfilesize', null);
+ $format = getGETPOSTsettingvalue('format', null);
+
+ # System General (main) Specific
+ $loglighttpd = getGETPOSTsettingvalue('loglighttpd', null);
+
+ # Firewall Specific
+ $logdefaultblock = getGETPOSTsettingvalue('logdefaultblock', null);
+ $logdefaultpass = getGETPOSTsettingvalue('logdefaultpass', null);
+ $logbogons = getGETPOSTsettingvalue('logbogons', null);
+ $logprivatenets = getGETPOSTsettingvalue('logprivatenets', null);
+ $filterdescriptions = getGETPOSTsettingvalue('filterdescriptions', null);
+
+ unset($input_errors);
+ $pconfig = $_POST;
+
+ /* input validation */
+ if (isset($nentries) && (strlen($nentries) > 0)) {
+ if (!is_numeric($nentries) || ($nentries < 5) || ($nentries > 2000)) {
+ $input_errors[] = gettext("Number of log entries to show must be between 5 and 2000.");
+ }
+ }
+
+ if (isset($logfilesize) && (strlen($logfilesize) > 0)) {
+ if (!is_numeric($logfilesize) || ($logfilesize < 100000)) {
+ $input_errors[] = gettext("Log file size must be numeric and greater than or equal to 100000.");
+ }
+ }
+
+ if (!$input_errors) {
+
+ # Clear out the specific log settings and leave only the applied settings to override the general logging options (global) settings.
+ unset($config['syslog'][$specific_log]);
+
+ # All
+ if ($cronorder != '') { # if not using the general logging options setting (global)
+ $config['syslog'][$specific_log]['cronorder'] = $cronorder;
+ }
+
+ if (isset($nentries) && (strlen($nentries) > 0)) {
+ $config['syslog'][$specific_log]['nentries'] = (int)$nentries;
+ }
+
+ if (isset($logfilesize) && (strlen($logfilesize) > 0)) {
+ $config['syslog'][$specific_log]['logfilesize'] = (int)$logfilesize;
+ }
+
+ if ($format != '') { # if not using the general logging options setting (global)
+ $config['syslog'][$specific_log]['format'] = $format;
+ }
+
+ # System General (main) Specific
+ if ($logfile == 'system') {
+ $oldnologlighttpd = isset($config['syslog']['nologlighttpd']);
+ $config['syslog']['nologlighttpd'] = $loglighttpd ? false : true;
+ }
+
+ # Firewall Specific
+ if ($logfile == 'filter') {
+ $oldnologdefaultblock = isset($config['syslog']['nologdefaultblock']);
+ $oldnologdefaultpass = isset($config['syslog']['nologdefaultpass']);
+ $oldnologbogons = isset($config['syslog']['nologbogons']);
+ $oldnologprivatenets = isset($config['syslog']['nologprivatenets']);
+
+ $config['syslog']['nologdefaultblock'] = $logdefaultblock ? false : true;
+ $config['syslog']['nologdefaultpass'] = $logdefaultpass ? true : false;
+ $config['syslog']['nologbogons'] = $logbogons ? false : true;
+ $config['syslog']['nologprivatenets'] = $logprivatenets ? false : true;
+
+ if (is_numeric($filterdescriptions) && $filterdescriptions > 0) {
+ $config['syslog']['filterdescriptions'] = $filterdescriptions;
+ } else {
+ unset($config['syslog']['filterdescriptions']);
+ }
+ }
+
+
+ write_config($desc = "Log Display Settings Saved: " . gettext($allowed_logs[$logfile]["name"]));
+
+ $retval = 0;
+ $savemsg = get_std_save_message($retval);
+
+ # System General (main) Specific
+ if ($logfile == 'system') {
+ if ($oldnologlighttpd !== isset($config['syslog']['nologlighttpd'])) {
+ ob_flush();
+ flush();
+ log_error(gettext("webConfigurator configuration has changed. Restarting webConfigurator."));
+ send_event("service restart webgui");
+ $savemsg .= "<br />" . gettext("WebGUI process is restarting.");
+ }
+ }
+
+ # Firewall Specific
+ if ($logfile == 'filter') {
+ if (($oldnologdefaultblock !== isset($config['syslog']['nologdefaultblock'])) ||
+ ($oldnologdefaultpass !== isset($config['syslog']['nologdefaultpass'])) ||
+ ($oldnologbogons !== isset($config['syslog']['nologbogons'])) ||
+ ($oldnologprivatenets !== isset($config['syslog']['nologprivatenets']))) {
+
+ require_once("filter.inc");
+ $retval |= filter_configure();
+ filter_pflog_start(true);
+ }
+ }
+ }
+}
+
+
+# Formatted/Raw Display
+if ($config['syslog'][$specific_log]['format'] == 'formatted') {
+ $rawfilter = false;
+}
+else if ($config['syslog'][$specific_log]['format'] == 'raw') {
+ $rawfilter = true;
+}
+else { # Use the general logging options setting (global).
+ $rawfilter = isset($config['syslog']['rawfilter']);
+}
+
+
+isset($config['syslog'][$specific_log]['nentries']) ? $nentries = $config['syslog'][$specific_log]['nentries'] : $nentries = $config['syslog']['nentries'];
+
+# Override Display Quantity
+if ($filterlogentries_qty) {
+ $nentries = $filterlogentries_qty;
+}
+
+if (!$nentries || !is_numeric($nentries)) {
+ $nentries = 50;
+}
+
+if ($_POST['clear']) {
+ clear_log_file($filter_logfile);
+}
+
+/* Setup shortcuts if they exist */
+
+if (!empty($allowed_logs[$logfile]["shortcut"])) {
+ $shortcut_section = $allowed_logs[$logfile]["shortcut"];
+}
+
+$pgtitle = array(gettext("Status"), gettext("System logs"), gettext($allowed_logs[$logfile]["name"]));
+include("head.inc");
+
+if (!$input_errors && $savemsg) {
+ print_info_box($savemsg);
+ $manage_log_active = false;
+}
+
+
+function build_if_list() {
+ $iflist = get_configured_interface_with_descr(false, true);
+ //$iflist = get_interface_list();
+ // Allow extending of the firewall edit interfaces
+ pfSense_handle_custom_code("/usr/local/pkg/firewall_nat/pre_interfaces_edit");
+ foreach ($iflist as $if => $ifdesc)
+ $interfaces[$if] = $ifdesc;
+
+ if ($config['l2tp']['mode'] == "server")
+ $interfaces['l2tp'] = "L2TP VPN";
+
+ if (is_pppoe_server_enabled() && have_ruleint_access("pppoe"))
+ $interfaces['pppoe'] = "PPPoE Server";
+
+ /* add ipsec interfaces */
+ if (ipsec_enabled())
+ $interfaces["enc0"] = "IPsec";
+
+ /* add openvpn/tun interfaces */
+ if ($config['openvpn']["openvpn-server"] || $config['openvpn']["openvpn-client"])
+ $interfaces["openvpn"] = "OpenVPN";
+
+ return($interfaces);
+}
+
+$Include_Act = explode(",", str_replace(" ", ",", $filterfieldsarray['act']));
+if ($filterfieldsarray['interface'] == "All")
+ $interface = "";
+
+
+$tab_array = array();
+$tab_array[] = array(gettext("System"), ($logfile == 'system'), "status_logs.php");
+$tab_array[] = array(gettext("Firewall"), ($logfile == 'filter'), "status_logs_filter.php");
+$tab_array[] = array(gettext("DHCP"), ($logfile == 'dhcpd'), "status_logs.php?logfile=dhcpd");
+$tab_array[] = array(gettext("Portal Auth"), ($logfile == 'portalauth'), "status_logs.php?logfile=portalauth");
+$tab_array[] = array(gettext("IPsec"), ($logfile == 'ipsec'), "status_logs.php?logfile=ipsec");
+$tab_array[] = array(gettext("PPP"), ($logfile == 'ppp'), "status_logs.php?logfile=ppp");
+$tab_array[] = array(gettext("VPN"), false, "status_logs_vpn.php");
+$tab_array[] = array(gettext("Load Balancer"), ($logfile == 'relayd'), "status_logs.php?logfile=relayd");
+$tab_array[] = array(gettext("OpenVPN"), ($logfile == 'openvpn'), "status_logs.php?logfile=openvpn");
+$tab_array[] = array(gettext("NTP"), ($logfile == 'ntpd'), "status_logs.php?logfile=ntpd");
+$tab_array[] = array(gettext("Settings"), false, "status_logs_settings.php");
+display_top_tabs($tab_array);
+
+$tab_array = array();
+$tab_array[] = array(gettext("Normal View"), true, "/status_logs_filter.php");
+$tab_array[] = array(gettext("Dynamic View"), false, "/status_logs_filter_dynamic.php");
+$tab_array[] = array(gettext("Summary View"), false, "/status_logs_filter_summary.php");
+display_top_tabs($tab_array, false, 'nav nav-tabs');
+
+define(SEC_OPEN, 0x00);
+define(SEC_CLOSED, 0x04);
+
+if ($filter_active)
+ $filter_state = SEC_OPEN;
+else
+ $filter_state = SEC_CLOSED;
+
+if (!$rawfilter) { // Advanced log filter form
+ $form = new Form(false);
+
+ $section = new Form_Section('Advanced Log Filter', 'adv-filter-panel', COLLAPSIBLE|$filter_state);
+
+ $group = new Form_Group('');
+
+ $group->add(new Form_Input(
+ 'filterlogentries_sourceipaddress',
+ null,
+ 'text',
+ $filterfieldsarray['srcip']
+ ))->setHelp('Source IP Address');
+
+ $group->add(new Form_Input(
+ 'filterlogentries_destinationipaddress',
+ null,
+ 'text',
+ $filterfieldsarray['dstip']
+ ))->setHelp('Destination IP Address');
+
+ $section->add($group);
+ $group = new Form_Group('');
+
+ $group->add(new Form_Checkbox(
+ 'actpass',
+ 'Pass',
+ 'Pass',
+ in_arrayi('Pass', $Include_Act),
+ 'Pass'
+ ))->setWidth(1);
+
+ $group->add(new Form_Input(
+ 'filterlogentries_time',
+ null,
+ 'text',
+ $filterfieldsarray['time']
+ ))->setWidth(3)->setHelp('Time');
+
+ $group->add(new Form_Input(
+ 'filterlogentries_sourceport',
+ null,
+ 'text',
+ $filterfieldsarray['srcport']
+ ))->setWidth(2)->setHelp('Source Port');
+
+ $group->add(new Form_Input(
+ 'filterlogentries_protocol',
+ null,
+ 'text',
+ $filterfieldsarray['proto']
+ ))->setWidth(2)->setHelp('Protocol');
+
+ $group->add(new Form_Input(
+ 'filterlogentries_qty',
+ null,
+ 'number',
+ $filterlogentries_qty,
+ ['placeholder' => $nentries]
+ ))->setWidth(2)->setHelp('Quantity');
+
+ $section->add($group);
+
+ $group = new Form_Group('');
+
+ $group->add(new Form_Checkbox(
+ 'actblock',
+ 'Block',
+ 'Block',
+ in_arrayi('Block', $Include_Act),
+ 'Block'
+ ))->setWidth(1);
+
+ $group->add(new Form_Input(
+ 'filterlogentries_interfaces',
+ null,
+ 'text',
+ $filterfieldsarray['interface']
+ ))->setWidth(2)->setHelp('Interface');
+
+ $group->add(new Form_Input(
+ 'filterlogentries_destinationport',
+ null,
+ 'text',
+ $filterfieldsarray['dstport']
+ ))->setWidth(2)->setHelp('Destination Port');
+
+ $group->add(new Form_Input(
+ 'filterlogentries_protocolflags',
+ null,
+ 'text',
+ $filterfieldsarray['tcpflags']
+ ))->setWidth(2)->setHelp('Protocol Flags');
+
+ $btnsubmit = new Form_Button(
+ 'filterlogentries_submit',
+ ' ' . gettext('Apply Filter'),
+ null,
+ 'fa-filter'
+ );
+}
+else { // Simple log filter form
+ $form = new Form(false);
+
+ $section = new Form_Section('Log Filter', 'basic-filter-panel', COLLAPSIBLE|$filter_state);
+
+ $group = new Form_Group('');
+
+ $group->add(new Form_Select(
+ 'interface',
+ 'Interface',
+ $interfacefilter,
+ build_if_list()
+ ))->setWidth(2)->setHelp('Interface');
+
+ $group->add(new Form_Input(
+ 'filterlogentries_qty',
+ null,
+ 'number',
+ $filterlogentries_qty,
+ ['placeholder' => $nentries]
+ ))->setWidth(2)->setHelp('Quantity');
+
+ $section->add($group);
+
+ $group = new Form_Group('');
+
+ $group->add(new Form_Input(
+ 'filtertext',
+ null,
+ 'text',
+ $filtertext
+ ))->setWidth(6)->setHelp('Filter Expression');
+
+ $btnsubmit = new Form_Button(
+ 'filtersubmit',
+ ' ' . gettext('Apply Filter'),
+ null,
+ 'fa-filter'
+ );
+}
+
+$btnsubmit->removeClass('btn-primary')->addClass('btn-success')->addClass('btn-sm');
+
+$group->add(new Form_StaticText(
+ '',
+ $btnsubmit
+));
+
+$group->setHelp('<a target="_blank" href="http://www.php.net/manual/en/book.pcre.php">' . gettext('Regular expression reference') . '</a> ' . gettext('Precede with exclamation (!) to exclude match.'));
+$section->add($group);
+$form->add($section);
+print($form);
+
+// Now the forms are complete we can draw the log table and its controls
+if (!$rawfilter) {
+ $iflist = get_configured_interface_with_descr(false, true);
+
+ if ($iflist[$interfacefilter])
+ $interfacefilter = $iflist[$interfacefilter];
+
+ if ($filterlogentries_submit)
+ $filterlog = conv_log_filter($filter_logfile, $nentries, $nentries + 100, $filterfieldsarray);
+ else
+ $filterlog = conv_log_filter($filter_logfile, $nentries, $nentries + 100, $filtertext, $interfacefilter);
+?>
+
+<div class="panel panel-default">
+ <div class="panel-heading">
+ <h2 class="panel-title">
+<?php
+ if ((!$filtertext) && (!$filterfieldsarray))
+ printf(gettext("Last %d %s log entries."), count($filterlog), gettext($allowed_logs[$logfile]["name"]));
+ else
+ printf(gettext("%d matched %s log entries."), count($filterlog), gettext($allowed_logs[$logfile]["name"]));
+
+ printf(" (" . gettext("Maximum %d") . ")", $nentries);
+?>
+ </h2>
+ </div>
+ <div class="panel-body">
+ <div class="table-responsive">
+ <table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
+ <thead>
+ <tr>
+ <th><?=gettext("Act")?></th>
+ <th><?=gettext("Time")?></th>
+ <th><?=gettext("IF")?></th>
+<?php
+ if ($config['syslog']['filterdescriptions'] === "1") {
+?>
+ <th style="width:100%">
+ <?=gettext("Rule")?>
+ </th>
+<?php
+ }
+?>
+ <th><?=gettext("Source")?></th>
+ <th><?=gettext("Destination")?></th>
+ <th><?=gettext("Proto")?></th>
+ </tr>
+ </thead>
+ <tbody>
+<?php
+ if ($config['syslog']['filterdescriptions'])
+ buffer_rules_load();
+
+ foreach ($filterlog as $filterent) {
+?>
+ <tr>
+ <td style="white-space:nowrap;">
+<?php
+ if ($filterent['act'] == "block") {
+ $icon_act = "fa-times text-danger";
+ } else {
+ $icon_act = "fa-check text-success";
+ }
+?>
+ <i class="fa <?php echo $icon_act;?> icon-pointer" title="<?php echo $filterent['act'] .'/'. $filterent['tracker'];?>" onclick="javascript:getURL('status_logs_filter.php?getrulenum=<?="{$filterent['rulenum']},{$filterent['tracker']},{$filterent['act']}"; ?>', outputrule);"></i>
+<?php
+ if ($filterent['count'])
+ echo $filterent['count'];
+?>
+ </td>
+ <td style="white-space:nowrap;">
+ <?=htmlspecialchars($filterent['time'])?>
+ </td>
+ <td style="white-space:nowrap;">
+<?php
+ if ($filterent['direction'] == "out")
+ print('&#x25ba;' . ' ');
+?>
+ <?=htmlspecialchars($filterent['interface'])?>
+ </td>
+<?php
+ if ($config['syslog']['filterdescriptions'] === "1") {
+?>
+ <td>
+ <?=find_rule_by_number_buffer($filterent['rulenum'], $filterent['tracker'], $filterent['act'])?>
+ </td>
+<?php
+ }
+
+ $int = strtolower($filterent['interface']);
+ $proto = strtolower($filterent['proto']);
+
+ if ($filterent['version'] == '6') {
+ $ipproto = "inet6";
+ $filterent['srcip'] = "[{$filterent['srcip']}]";
+ $filterent['dstip'] = "[{$filterent['dstip']}]";
+ } else {
+ $ipproto = "inet";
+ }
+
+ $srcstr = $filterent['srcip'] . get_port_with_service($filterent['srcport'], $proto);
+ $src_htmlclass = str_replace(array('.', ':'), '-', $filterent['srcip']);
+ $dststr = $filterent['dstip'] . get_port_with_service($filterent['dstport'], $proto);
+ $dst_htmlclass = str_replace(array('.', ':'), '-', $filterent['dstip']);
+?>
+ <td style="white-space:nowrap;">
+ <i class="fa fa-info icon-pointer icon-primary" onclick="javascript:resolve_with_ajax('<?="{$filterent['srcip']}"; ?>');" title="<?=gettext("Click to resolve")?>" alt="Reverse Resolve with DNS"/>
+ </i>
+
+ <i class="fa fa-minus-square-o icon-pointer icon-primary" href="easyrule.php?<?="action=block&amp;int={$int}&amp;src={$filterent['srcip']}&amp;ipproto={$ipproto}"; ?>" alt="Easy Rule: Add to Block List" title="<?=gettext("Easy Rule: Add to Block List")?>" onclick="return confirm('<?=gettext("Do you really want to add this BLOCK rule?")?>')">
+ </i>
+
+ <?=$srcstr . '<span class="RESOLVE-' . $src_htmlclass . '"></span>'?>
+ </td>
+ <td style="white-space:nowrap;">
+ <i class="fa fa-info icon-pointer icon-primary" onclick="javascript:resolve_with_ajax('<?="{$filterent['dstip']}"; ?>');" title="<?=gettext("Click to resolve")?>" class="ICON-<?= $dst_htmlclass; ?>" alt="Reverse Resolve with DNS"/>
+ </i>
+
+ <i class="fa fa-plus-square-o icon-pointer icon-primary" href="easyrule.php?<?="action=pass&amp;int={$int}&amp;proto={$proto}&amp;src={$filterent['srcip']}&amp;dst={$filterent['dstip']}&amp;dstport={$filterent['dstport']}&amp;ipproto={$ipproto}"; ?>" title="<?=gettext("Easy Rule: Pass this traffic")?>" onclick="return confirm('<?=gettext("Do you really want to add this PASS rule?")?>')">
+ </i>
+ <?=$dststr . '<span class="RESOLVE-' . $dst_htmlclass . '"></span>'?>
+ </td>
+<?php
+ if ($filterent['proto'] == "TCP")
+ $filterent['proto'] .= ":{$filterent['tcpflags']}";
+?>
+ <td style="white-space:nowrap;">
+ <?=htmlspecialchars($filterent['proto'])?>
+ </td>
+ </tr>
+<?php
+ if (isset($config['syslog']['filterdescriptions']) && $config['syslog']['filterdescriptions'] === "2") {
+?>
+ <tr>
+ <td colspan="2" />
+ <td colspan="4"><?=find_rule_by_number_buffer($filterent['rulenum'],$filterent['tracker'],$filterent['act'])?></td>
+ </tr>
+<?php
+ }
+ } // e-o-foreach
+ buffer_rules_clear();
+?>
+ </tbody>
+ </table>
+<?php
+ if (count($filterlog) == 0)
+ print_info_box(gettext('No logs to display'));
+?>
+ </div>
+ </div>
+</div>
+
+<?php
+}
+else
+{
+?>
+<div class="panel panel-default">
+ <div class="panel-heading"><h2 class="panel-title"><?=gettext("Last ")?><?=$nentries?> <?=gettext($allowed_logs[$logfile]["name"])?><?=gettext(" log entries")?></h2></div>
+ <div class="table table-responsive">
+ <table class="table table-striped table-hover">
+ <thead>
+ <tr>
+ <th><?=gettext("Time")?></th>
+ <th style="width:100%"><?=gettext("Message")?></th>
+ </tr>
+ </thead>
+ <tbody>
+<?php
+ if ($filtertext)
+ $rows = dump_clog($filter_logfile, $nentries, true, array("$filtertext"));
+ else
+ $rows = dump_clog($filter_logfile, $nentries, true, array());
+?>
+ </tbody>
+ </table>
+<?php
+ if ($rows == 0)
+ print_info_box(gettext('No logs to display'));
+?>
+ </div>
+</div>
+<?php
+}
+?>
+
+<div id="infoblock">
+
+<?php
+
+print_info_box('<a href="https://doc.pfsense.org/index.php/What_are_TCP_Flags%3F">' .
+ gettext("TCP Flags") . '</a>: F - FIN, S - SYN, A or . - ACK, R - RST, P - PSH, U - URG, E - ECE, C - CWR' . '<br />' .
+ '<i class="fa fa-minus-square-o icon-primary"></i> = Add to block list., <i class="fa fa-plus-square-o icon-primary"></i> = Pass traffic, <i class="fa fa-info icon-primary"></i> = Resolve');
+
+?>
+</div>
+
+<?php
+# Manage Log - Section/Form
+
+if ($input_errors) {
+ print_input_errors($input_errors);
+ $manage_log_active = true;
+}
+
+if ($manage_log_active)
+ $manage_log_state = SEC_OPEN;
+else
+ $manage_log_state = SEC_CLOSED;
+
+$form = new Form(false);
+
+$section = new Form_Section(gettext('Manage') . ' ' . gettext($allowed_logs[$logfile]["name"]) . ' ' . gettext('Log'), 'log-manager-panel', COLLAPSIBLE|$manage_log_state);
+
+$section->addInput(new Form_StaticText(
+ '',
+ 'These settings override the "General Logging Options" settings.'
+));
+
+
+# All
+$group = new Form_Group('Forward/Reverse Display');
+
+$group->add(new Form_Checkbox(
+ 'cronorder',
+ null,
+ 'Forward',
+ ($pconfig['cronorder'] == 'forward') ? true : false,
+ 'forward'
+))->displayAsRadio()->setHelp('(newest at bottom)');
+
+$group->add(new Form_Checkbox(
+ 'cronorder',
+ null,
+ 'Reverse',
+ ($pconfig['cronorder'] == 'reverse') ? true : false,
+ 'reverse'
+))->displayAsRadio()->setHelp('(newest at top)');
+
+$group->add(new Form_Checkbox(
+ 'cronorder',
+ null,
+ 'General Logging Options Setting',
+ ($pconfig['cronorder'] == '') ? true : false,
+ ''
+))->displayAsRadio();
+
+$group->setHelp('Show log entries in forward or reverse order.');
+$section->add($group);
+
+$group = new Form_Group('GUI Log Entries');
+
+# Use the general logging options setting (global) as placeholder.
+$group->add(new Form_Input(
+ 'nentries',
+ 'GUI Log Entries',
+ 'number',
+ $pconfig['nentries'],
+ ['placeholder' => $config['syslog']['nentries']]
+))->setWidth(2);
+
+$group->setHelp('This is the number of log entries displayed in the GUI. It does not affect how many entries are contained in the log.');
+$section->add($group);
+
+$group = new Form_Group('Log file size (Bytes)');
+
+# Use the general logging options setting (global) as placeholder.
+$group->add(new Form_Input(
+ 'logfilesize',
+ 'Log file size (Bytes)',
+ 'number',
+ $pconfig['logfilesize'],
+ ['placeholder' => $config['syslog']['logfilesize'] ? $config['syslog']['logfilesize'] : "511488"]
+))->setWidth(2);
+$group->setHelp("The log is held in a constant-size circular log file. This field controls how large the log file is, and thus how many entries may exist inside the log. The default is approximately 500KB." .
+ '<br /><br />' .
+ "NOTE: The log size is changed the next time it is cleared. To immediately change the log size, first save the options to set the size, then clear the log using the \"Clear Log\" action below. ");
+$section->add($group);
+
+$group = new Form_Group('Formatted/Raw Display');
+
+$group->add(new Form_Checkbox(
+ 'format',
+ null,
+ 'Formatted',
+ ($pconfig['format'] == 'formatted') ? true : false,
+ 'formatted'
+))->displayAsRadio();
+
+$group->add(new Form_Checkbox(
+ 'format',
+ null,
+ 'Raw',
+ ($pconfig['format'] == 'raw') ? true : false,
+ 'raw'
+))->displayAsRadio();
+
+$group->add(new Form_Checkbox(
+ 'format',
+ null,
+ 'General Logging Options Setting',
+ ($pconfig['format'] == '') ? true : false,
+ ''
+))->displayAsRadio();
+
+$group->setHelp('Show the log entries as formatted or raw output as generated by the service. The raw output will reveal more detailed information, but it is more difficult to read.');
+$section->add($group);
+
+
+# System General (main) Specific
+if ($logfile == 'system') {
+ $section->addInput(new Form_Checkbox(
+ 'loglighttpd',
+ 'Web Server Log',
+ 'Log errors from the web server process',
+ $pconfig['loglighttpd']
+ ))->setHelp('If this is checked, errors from the lighttpd web server process for the GUI or Captive Portal will appear in the system log.');
+}
+
+
+# Firewall Specific
+if ($logfile == 'filter') {
+$section->addInput(new Form_Checkbox(
+ 'logdefaultblock',
+ 'Log firewall default blocks',
+ 'Log packets matched from the default block rules in the ruleset',
+ $pconfig['logdefaultblock']
+))->setHelp('Packets that are blocked by the implicit default block rule will not be logged if this option is unchecked. Per-rule logging options are still respected.');
+
+$section->addInput(new Form_Checkbox(
+ 'logdefaultpass',
+ null,
+ 'Log packets matched from the default pass rules put in the ruleset',
+ $pconfig['logdefaultpass']
+))->setHelp('Packets that are allowed by the implicit default pass rule will be logged if this option is checked. Per-rule logging options are still respected. ');
+
+$section->addInput(new Form_Checkbox(
+ 'logbogons',
+ null,
+ 'Log packets blocked by \'Block Bogon Networks\' rules',
+ $pconfig['logbogons']
+));
+
+$section->addInput(new Form_Checkbox(
+ 'logprivatenets',
+ null,
+ 'Log packets blocked by \'Block Private Networks\' rules',
+ $pconfig['logprivatenets']
+));
+
+$section->addInput(new Form_Select(
+ 'filterdescriptions',
+ 'Where to show rule descriptions',
+ !isset($pconfig['filterdescriptions']) ? '0':$pconfig['filterdescriptions'],
+ array(
+ '0' => 'Dont load descriptions',
+ '1' => 'Display as column',
+ '2' => 'Display as second row'
+ )
+))->setHelp('Show the applied rule description below or in the firewall log rows' . '<br />' .
+ 'Displaying rule descriptions for all lines in the log might affect performance with large rule sets');
+}
+
+
+$group = new Form_Group('Action');
+
+$btnsavesettings = new Form_Button(
+ 'save_settings',
+ gettext('Save'),
+ null
+);
+
+$btnsavesettings->addClass('btn-sm');
+
+$group->add(new Form_StaticText(
+ '',
+ $btnsavesettings
+))->setHelp('Saves changed settings.');
+
+
+$btnclear = new Form_Button(
+ 'clear',
+ ' ' . gettext('Clear log'),
+ null,
+ 'fa-trash'
+);
+
+$btnclear->removeClass('btn-primary')->addClass('btn-danger')->addClass('btn-sm');
+
+$group->add(new Form_StaticText(
+ '',
+ $btnclear
+))->setHelp('Clears local log file and reinitializes it as an empty log. Save any settings changes first.');
+
+$section->add($group);
+$form->add($section);
+print $form;
+?>
+
+
+<!-- AJAXY STUFF -->
+<script type="text/javascript">
+//<![CDATA[
+function outputrule(req) {
+ alert(req.content);
+}
+
+function resolve_with_ajax(ip_to_resolve) {
+ var url = "/status_logs_filter.php";
+
+ $.ajax(
+ url,
+ {
+ method: 'post',
+ dataType: 'json',
+ data: {
+ resolve: ip_to_resolve,
+ },
+ complete: resolve_ip_callback
+ });
+
+}
+
+function resolve_ip_callback(transport) {
+ var response = $.parseJSON(transport.responseText);
+ var resolve_class = htmlspecialchars(response.resolve_ip.replace(/[.:]/g, '-'));
+ var resolve_text = '<small><br />' + htmlspecialchars(response.resolve_text) + '<\/small>';
+
+ jQuery('span.RESOLVE-' + resolve_class).html(resolve_text);
+}
+
+// From http://stackoverflow.com/questions/5499078/fastest-method-to-escape-html-tags-as-html-entities
+function htmlspecialchars(str) {
+ return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&apos;');
+}
+
+if (typeof getURL == 'undefined') {
+ getURL = function(url, callback) {
+ if (!url)
+ throw 'No URL for getURL';
+ try {
+ if (typeof callback.operationComplete == 'function')
+ callback = callback.operationComplete;
+ } catch (e) {}
+ if (typeof callback != 'function')
+ throw 'No callback function for getURL';
+ var http_request = null;
+ if (typeof XMLHttpRequest != 'undefined') {
+ http_request = new XMLHttpRequest();
+ }
+ else if (typeof ActiveXObject != 'undefined') {
+ try {
+ http_request = new ActiveXObject('Msxml2.XMLHTTP');
+ } catch (e) {
+ try {
+ http_request = new ActiveXObject('Microsoft.XMLHTTP');
+ } catch (e) {}
+ }
+ }
+ if (!http_request)
+ throw 'Both getURL and XMLHttpRequest are undefined';
+ http_request.onreadystatechange = function() {
+ if (http_request.readyState == 4) {
+ callback( { success : true,
+ content : http_request.responseText,
+ contentType : http_request.getResponseHeader("Content-Type") } );
+ }
+ };
+ http_request.open('GET', url, true);
+ http_request.send(null);
+ };
+}
+
+events.push(function(){
+ $('.fa').tooltip();
+});
+//]]>
+</script>
+
+<?php include("foot.inc");
+?>
diff --git a/src/usr/local/www/diag_logs_filter_dynamic.php b/src/usr/local/www/status_logs_filter_dynamic.php
index 8dd74db..63771f5 100755
--- a/src/usr/local/www/diag_logs_filter_dynamic.php
+++ b/src/usr/local/www/status_logs_filter_dynamic.php
@@ -1,6 +1,6 @@
<?php
/*
- diag_logs_filter_dynamic.php
+ status_logs_filter_dynamic.php
*/
/* ====================================================================
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
@@ -64,7 +64,7 @@
##|*IDENT=page-diagnostics-logs-firewall-dynamic
##|*NAME=Status: System Logs: Firewall (Dynamic View)
##|*DESCR=Allow access to the 'Status: System Logs: Firewall (Dynamic View)' page
-##|*MATCH=diag_logs_filter_dynamic.php*
+##|*MATCH=status_logs_filter_dynamic.php*
##|-PRIV
require("guiconfig.inc");
@@ -84,7 +84,7 @@ if ($_POST['clear']) {
$filterlog = conv_log_filter($filter_logfile, $nentries, $nentries + 100);
-$pgtitle = array(gettext("Status"), gettext("System logs"), gettext("Firewall (Dynamic View)"));
+$pgtitle = array(gettext("Status"), gettext("System logs"), gettext("Firewall"), gettext("Dynamic View"));
$shortcut_section = "firewall";
include("head.inc");
@@ -185,7 +185,7 @@ function fetch_new_rules() {
if(isBusy)
return;
isBusy = true;
- getURL('diag_logs_filter_dynamic.php?lastsawtime=' + lastsawtime, fetch_new_rules_callback);
+ getURL('status_logs_filter_dynamic.php?lastsawtime=' + lastsawtime, fetch_new_rules_callback);
}
function fetch_new_rules_callback(callback_data) {
@@ -325,23 +325,23 @@ function toggleListDescriptions(){
<?php
$tab_array = array();
-$tab_array[] = array(gettext("System"), false, "diag_logs.php");
-$tab_array[] = array(gettext("Firewall"), true, "diag_logs_filter.php");
-$tab_array[] = array(gettext("DHCP"), false, "diag_logs.php?logfile=dhcpd");
-$tab_array[] = array(gettext("Portal Auth"), false, "diag_logs.php?logfile=portalauth");
-$tab_array[] = array(gettext("IPsec"), false, "diag_logs.php?logfile=ipsec");
-$tab_array[] = array(gettext("PPP"), false, "diag_logs.php?logfile=ppp");
-$tab_array[] = array(gettext("VPN"), false, "diag_logs_vpn.php");
-$tab_array[] = array(gettext("Load Balancer"), false, "diag_logs.php?logfile=relayd");
-$tab_array[] = array(gettext("OpenVPN"), false, "diag_logs.php?logfile=openvpn");
-$tab_array[] = array(gettext("NTP"), false, "diag_logs.php?logfile=ntpd");
-$tab_array[] = array(gettext("Settings"), false, "diag_logs_settings.php");
+$tab_array[] = array(gettext("System"), false, "status_logs.php");
+$tab_array[] = array(gettext("Firewall"), true, "status_logs_filter.php");
+$tab_array[] = array(gettext("DHCP"), false, "status_logs.php?logfile=dhcpd");
+$tab_array[] = array(gettext("Portal Auth"), false, "status_logs.php?logfile=portalauth");
+$tab_array[] = array(gettext("IPsec"), false, "status_logs.php?logfile=ipsec");
+$tab_array[] = array(gettext("PPP"), false, "status_logs.php?logfile=ppp");
+$tab_array[] = array(gettext("VPN"), false, "status_logs_vpn.php");
+$tab_array[] = array(gettext("Load Balancer"), false, "status_logs.php?logfile=relayd");
+$tab_array[] = array(gettext("OpenVPN"), false, "status_logs.php?logfile=openvpn");
+$tab_array[] = array(gettext("NTP"), false, "status_logs.php?logfile=ntpd");
+$tab_array[] = array(gettext("Settings"), false, "status_logs_settings.php");
display_top_tabs($tab_array);
$tab_array = array();
-$tab_array[] = array(gettext("Normal View"), false, "/diag_logs_filter.php");
-$tab_array[] = array(gettext("Dynamic View"), true, "/diag_logs_filter_dynamic.php");
-$tab_array[] = array(gettext("Summary View"), false, "/diag_logs_filter_summary.php");
+$tab_array[] = array(gettext("Normal View"), false, "/status_logs_filter.php");
+$tab_array[] = array(gettext("Dynamic View"), true, "/status_logs_filter_dynamic.php");
+$tab_array[] = array(gettext("Summary View"), false, "/status_logs_filter_summary.php");
display_top_tabs($tab_array, false, 'nav nav-tabs');
?>
@@ -394,12 +394,12 @@ display_top_tabs($tab_array, false, 'nav nav-tabs');
<td>
<?php
if ($filterent['act'] == "block") {
- $icon_act = "fa-times icon-danger";
+ $icon_act = "fa-times text-danger";
} else {
- $icon_act = "fa-check icon-success";
+ $icon_act = "fa-check text-success";
}
?>
- <i class="fa <?php echo $icon_act;?> icon-pointer" title="<?php echo $filterent['act'] .'/'. $filterent['tracker'];?>" onclick="javascript:getURL('diag_logs_filter.php?getrulenum=<?="{$filterent['rulenum']},{$filterent['tracker']},{$filterent['act']}"; ?>', outputrule);"></i>
+ <i class="fa <?php echo $icon_act;?> icon-pointer" title="<?php echo $filterent['act'] .'/'. $filterent['tracker'];?>" onclick="javascript:getURL('status_logs_filter.php?getrulenum=<?="{$filterent['rulenum']},{$filterent['tracker']},{$filterent['act']}"; ?>', outputrule);"></i>
</td>
<td><?=htmlspecialchars($filterent['time'])?></td>
<td><?=htmlspecialchars($filterent['interface'])?></td>
diff --git a/src/usr/local/www/diag_logs_filter_summary.php b/src/usr/local/www/status_logs_filter_summary.php
index abc446d..a460577 100644
--- a/src/usr/local/www/diag_logs_filter_summary.php
+++ b/src/usr/local/www/status_logs_filter_summary.php
@@ -1,6 +1,6 @@
<?php
/*
- diag_logs_filter_summary.php
+ status_logs_filter_summary.php
*/
/* ====================================================================
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
@@ -62,11 +62,9 @@
##|*IDENT=page-diagnostics-logs-firewall-summary
##|*NAME=Status: System Logs: Firewall Log Summary
##|*DESCR=Allow access to the 'Status: System Logs: Firewall Log Summary' page
-##|*MATCH=diag_logs_filter_summary.php*
+##|*MATCH=status_logs_filter_summary.php*
##|-PRIV
-$pgtitle = gettext("Status").": ".gettext("System logs").": ".gettext("Firewall Log Summary");
-$shortcut_section = "firewall";
require_once("guiconfig.inc");
include_once("filter_log.inc");
@@ -274,27 +272,28 @@ foreach ($filterlog as $fe) {
}
}
-$pgtitle = array(gettext("Status"), gettext("System logs"), gettext("Firewall"), gettext("Summary"));
+$pgtitle = array(gettext("Status"), gettext("System logs"), gettext("Firewall"), gettext("Summary View"));
+$shortcut_section = "firewall";
include("head.inc");
$tab_array = array();
-$tab_array[] = array(gettext("System"), false, "diag_logs.php");
-$tab_array[] = array(gettext("Firewall"), true, "diag_logs_filter.php");
-$tab_array[] = array(gettext("DHCP"), false, "diag_logs.php?logfile=dhcpd");
-$tab_array[] = array(gettext("Portal Auth"), false, "diag_logs.php?logfile=portalauth");
-$tab_array[] = array(gettext("IPsec"), false, "diag_logs.php?logfile=ipsec");
-$tab_array[] = array(gettext("PPP"), false, "diag_logs.php?logfile=ppp");
-$tab_array[] = array(gettext("VPN"), false, "diag_logs_vpn.php");
-$tab_array[] = array(gettext("Load Balancer"), false, "diag_logs.php?logfile=relayd");
-$tab_array[] = array(gettext("OpenVPN"), false, "diag_logs.php?logfile=openvpn");
-$tab_array[] = array(gettext("NTP"), false, "diag_logs.php?logfile=ntpd");
-$tab_array[] = array(gettext("Settings"), false, "diag_logs_settings.php");
+$tab_array[] = array(gettext("System"), false, "status_logs.php");
+$tab_array[] = array(gettext("Firewall"), true, "status_logs_filter.php");
+$tab_array[] = array(gettext("DHCP"), false, "status_logs.php?logfile=dhcpd");
+$tab_array[] = array(gettext("Portal Auth"), false, "status_logs.php?logfile=portalauth");
+$tab_array[] = array(gettext("IPsec"), false, "status_logs.php?logfile=ipsec");
+$tab_array[] = array(gettext("PPP"), false, "status_logs.php?logfile=ppp");
+$tab_array[] = array(gettext("VPN"), false, "status_logs_vpn.php");
+$tab_array[] = array(gettext("Load Balancer"), false, "status_logs.php?logfile=relayd");
+$tab_array[] = array(gettext("OpenVPN"), false, "status_logs.php?logfile=openvpn");
+$tab_array[] = array(gettext("NTP"), false, "status_logs.php?logfile=ntpd");
+$tab_array[] = array(gettext("Settings"), false, "status_logs_settings.php");
display_top_tabs($tab_array);
$tab_array = array();
-$tab_array[] = array(gettext("Normal View"), false, "/diag_logs_filter.php");
-$tab_array[] = array(gettext("Dynamic View"), false, "/diag_logs_filter_dynamic.php");
-$tab_array[] = array(gettext("Summary View"), true, "/diag_logs_filter_summary.php");
+$tab_array[] = array(gettext("Normal View"), false, "/status_logs_filter.php");
+$tab_array[] = array(gettext("Dynamic View"), false, "/status_logs_filter_dynamic.php");
+$tab_array[] = array(gettext("Summary View"), true, "/status_logs_filter_summary.php");
display_top_tabs($tab_array, false, 'nav nav-tabs');
print("<br />");
diff --git a/src/usr/local/www/diag_logs_settings.php b/src/usr/local/www/status_logs_settings.php
index d8de257..0152471 100644
--- a/src/usr/local/www/diag_logs_settings.php
+++ b/src/usr/local/www/status_logs_settings.php
@@ -1,6 +1,6 @@
<?php
/*
- diag_logs_settings.php
+ status_logs_settings.php
*/
/* ====================================================================
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
@@ -64,7 +64,7 @@
##|*IDENT=page-diagnostics-logs-settings
##|*NAME=Status: Logs: Settings
##|*DESCR=Allow access to the 'Status: Logs: Settings' page.
-##|*MATCH=diag_logs_settings.php*
+##|*MATCH=status_logs_settings.php*
##|-PRIV
require("guiconfig.inc");
@@ -83,7 +83,7 @@ $pconfig['filter'] = isset($config['syslog']['filter']);
$pconfig['dhcp'] = isset($config['syslog']['dhcp']);
$pconfig['portalauth'] = isset($config['syslog']['portalauth']);
$pconfig['vpn'] = isset($config['syslog']['vpn']);
-$pconfig['apinger'] = isset($config['syslog']['apinger']);
+$pconfig['dpinger'] = isset($config['syslog']['dpinger']);
$pconfig['relayd'] = isset($config['syslog']['relayd']);
$pconfig['hostapd'] = isset($config['syslog']['hostapd']);
$pconfig['logall'] = isset($config['syslog']['logall']);
@@ -156,7 +156,7 @@ if ($_POST['resetlogs'] == gettext("Reset Log Files")) {
$config['syslog']['dhcp'] = $_POST['dhcp'] ? true : false;
$config['syslog']['portalauth'] = $_POST['portalauth'] ? true : false;
$config['syslog']['vpn'] = $_POST['vpn'] ? true : false;
- $config['syslog']['apinger'] = $_POST['apinger'] ? true : false;
+ $config['syslog']['dpinger'] = $_POST['dpinger'] ? true : false;
$config['syslog']['relayd'] = $_POST['relayd'] ? true : false;
$config['syslog']['hostapd'] = $_POST['hostapd'] ? true : false;
$config['syslog']['logall'] = $_POST['logall'] ? true : false;
@@ -230,17 +230,17 @@ else if ($savemsg)
print_info_box($savemsg);
$tab_array = array();
-$tab_array[] = array(gettext("System"), false, "diag_logs.php");
-$tab_array[] = array(gettext("Firewall"), false, "diag_logs_filter.php");
-$tab_array[] = array(gettext("DHCP"), false, "diag_logs.php?logfile=dhcpd");
-$tab_array[] = array(gettext("Portal Auth"), false, "diag_logs.php?logfile=portalauth");
-$tab_array[] = array(gettext("IPsec"), false, "diag_logs.php?logfile=ipsec");
-$tab_array[] = array(gettext("PPP"), false, "diag_logs.php?logfile=ppp");
-$tab_array[] = array(gettext("VPN"), false, "diag_logs_vpn.php");
-$tab_array[] = array(gettext("Load Balancer"), false, "diag_logs.php?logfile=relayd");
-$tab_array[] = array(gettext("OpenVPN"), false, "diag_logs.php?logfile=openvpn");
-$tab_array[] = array(gettext("NTP"), false, "diag_logs.php?logfile=ntpd");
-$tab_array[] = array(gettext("Settings"), true, "diag_logs_settings.php");
+$tab_array[] = array(gettext("System"), false, "status_logs.php");
+$tab_array[] = array(gettext("Firewall"), false, "status_logs_filter.php");
+$tab_array[] = array(gettext("DHCP"), false, "status_logs.php?logfile=dhcpd");
+$tab_array[] = array(gettext("Portal Auth"), false, "status_logs.php?logfile=portalauth");
+$tab_array[] = array(gettext("IPsec"), false, "status_logs.php?logfile=ipsec");
+$tab_array[] = array(gettext("PPP"), false, "status_logs.php?logfile=ppp");
+$tab_array[] = array(gettext("VPN"), false, "status_logs_vpn.php");
+$tab_array[] = array(gettext("Load Balancer"), false, "status_logs.php?logfile=relayd");
+$tab_array[] = array(gettext("OpenVPN"), false, "status_logs.php?logfile=openvpn");
+$tab_array[] = array(gettext("NTP"), false, "status_logs.php?logfile=ntpd");
+$tab_array[] = array(gettext("Settings"), true, "status_logs_settings.php");
display_top_tabs($tab_array);
$form = new Form(new Form_Button(
@@ -278,14 +278,14 @@ $section->addInput(new Form_Checkbox(
'Log firewall default blocks',
'Log packets matched from the default block rules in the ruleset',
$pconfig['logdefaultblock']
-))->setHelp('Packets that are blocked by the implicit default block rule will not be logged if you uncheck this option. Per-rule logging options are still respected.');
+))->setHelp('Log packets that are <strong>blocked</strong> by the implicit default block rule. - Per-rule logging options are still respected.');
$section->addInput(new Form_Checkbox(
'logdefaultpass',
null,
'Log packets matched from the default pass rules put in the ruleset',
$pconfig['logdefaultpass']
-))->setHelp('Packets that are allowed by the implicit default pass rule will be logged if you check this option. Per-rule logging options are still respected. ');
+))->setHelp('Log packets that are <strong>allowed</strong> by the implicit default pass rule. - Per-rule logging options are still respected. ');
$section->addInput(new Form_Checkbox(
'logbogons',
@@ -441,10 +441,10 @@ $group->add(new Form_MultiCheckbox(
));
$group->add(new Form_MultiCheckbox(
- 'apinger',
+ 'dpinger',
null,
'Gateway Monitor events',
- $pconfig['apinger']
+ $pconfig['dpinger']
));
$group->add(new Form_MultiCheckbox(
@@ -506,7 +506,7 @@ events.push(function(){
disableInput('dhcp', hide);
disableInput('portalauth', hide);
disableInput('vpn', hide);
- disableInput('apinger', hide);
+ disableInput('dpinger', hide);
disableInput('relayd', hide);
disableInput('hostapd', hide);
}
diff --git a/src/usr/local/www/diag_logs_vpn.php b/src/usr/local/www/status_logs_vpn.php
index d14a8a5..403daee 100755..100644
--- a/src/usr/local/www/diag_logs_vpn.php
+++ b/src/usr/local/www/status_logs_vpn.php
@@ -1,7 +1,7 @@
#!/usr/local/bin/php
<?php
/*
- diag_logs_vpn.php
+ status_logs_vpn.php
*/
/* ====================================================================
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
@@ -66,7 +66,7 @@
##|*IDENT=page-diagnostics-logs-pptpvpn
##|*NAME=Status: Logs: VPN
##|*DESCR=Allow access to the 'Status: Logs: VPN' page.
-##|*MATCH=diag_logs_vpn.php*
+##|*MATCH=status_logs_vpn.php*
##|-PRIV
@@ -152,32 +152,32 @@ function dump_clog_vpn($logfile, $tail) {
include("head.inc");
$tab_array = array();
-$tab_array[] = array(gettext("System"), false, "diag_logs.php");
-$tab_array[] = array(gettext("Firewall"), false, "diag_logs_filter.php");
-$tab_array[] = array(gettext("DHCP"), false, "diag_logs.php?logfile=dhcpd");
-$tab_array[] = array(gettext("Portal Auth"), false, "diag_logs.php?logfile=portalauth");
-$tab_array[] = array(gettext("IPsec"), false, "diag_logs.php?logfile=ipsec");
-$tab_array[] = array(gettext("PPP"), false, "diag_logs.php?logfile=ppp");
-$tab_array[] = array(gettext("VPN"), true, "diag_logs_vpn.php");
-$tab_array[] = array(gettext("Load Balancer"), false, "diag_logs.php?logfile=relayd");
-$tab_array[] = array(gettext("OpenVPN"), false, "diag_logs.php?logfile=openvpn");
-$tab_array[] = array(gettext("NTP"), false, "diag_logs.php?logfile=ntpd");
-$tab_array[] = array(gettext("Settings"), false, "diag_logs_settings.php");
+$tab_array[] = array(gettext("System"), false, "status_logs.php");
+$tab_array[] = array(gettext("Firewall"), false, "status_logs_filter.php");
+$tab_array[] = array(gettext("DHCP"), false, "status_logs.php?logfile=dhcpd");
+$tab_array[] = array(gettext("Portal Auth"), false, "status_logs.php?logfile=portalauth");
+$tab_array[] = array(gettext("IPsec"), false, "status_logs.php?logfile=ipsec");
+$tab_array[] = array(gettext("PPP"), false, "status_logs.php?logfile=ppp");
+$tab_array[] = array(gettext("VPN"), true, "status_logs_vpn.php");
+$tab_array[] = array(gettext("Load Balancer"), false, "status_logs.php?logfile=relayd");
+$tab_array[] = array(gettext("OpenVPN"), false, "status_logs.php?logfile=openvpn");
+$tab_array[] = array(gettext("NTP"), false, "status_logs.php?logfile=ntpd");
+$tab_array[] = array(gettext("Settings"), false, "status_logs_settings.php");
display_top_tabs($tab_array);
$tab_array = array();
$tab_array[] = array(gettext("PPPoE Logins"),
(($vpntype == "poes") && ($mode != "raw")),
- "/diag_logs_vpn.php?vpntype=poes");
+ "/status_logs_vpn.php?vpntype=poes");
$tab_array[] = array(gettext("PPPoE Raw"),
(($vpntype == "poes") && ($mode == "raw")),
- "/diag_logs_vpn.php?vpntype=poes&amp;mode=raw");
+ "/status_logs_vpn.php?vpntype=poes&amp;mode=raw");
$tab_array[] = array(gettext("L2TP Logins"),
(($vpntype == "l2tp") && ($mode != "raw")),
- "/diag_logs_vpn.php?vpntype=l2tp");
+ "/status_logs_vpn.php?vpntype=l2tp");
$tab_array[] = array(gettext("L2TP Raw"),
(($vpntype == "l2tp") && ($mode == "raw")),
- "/diag_logs_vpn.php?vpntype=l2tp&amp;mode=raw");
+ "/status_logs_vpn.php?vpntype=l2tp&amp;mode=raw");
display_top_tabs($tab_array, false, 'nav nav-tabs');
?>
@@ -223,7 +223,7 @@ display_top_tabs($tab_array, false, 'nav nav-tabs');
}
?>
<p>
- <form action="diag_logs_vpn.php" method="post">
+ <form action="status_logs_vpn.php" method="post">
<input type="hidden" name="vpntype" id="vpntype" value="<?=$vpntype?>" />
<input type="hidden" name="mode" id="mode" value="<?=$mode?>" />
<input name="clear" type="submit" class="btn btn-danger" value="<?=gettext("Clear log")?>" />
diff --git a/src/usr/local/www/status_openvpn.php b/src/usr/local/www/status_openvpn.php
index 82a4a05..6cd30b7 100644
--- a/src/usr/local/www/status_openvpn.php
+++ b/src/usr/local/www/status_openvpn.php
@@ -181,6 +181,7 @@ include("head.inc"); ?>
<th><?=gettext("Connected Since"); ?></th>
<th><?=gettext("Bytes Sent")?></th>
<th><?=gettext("Bytes Received")?></th>
+ <th><!-- Icons --></th>
</tr>
</thead>
<tbody>
diff --git a/src/usr/local/www/diag_pkglogs.php b/src/usr/local/www/status_pkglogs.php
index f4781f0..23385d2 100755
--- a/src/usr/local/www/diag_pkglogs.php
+++ b/src/usr/local/www/status_pkglogs.php
@@ -1,6 +1,6 @@
<?php
/*
- diag_pkglogs.php
+ status_pkglogs.php
*/
/* ====================================================================
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
@@ -72,7 +72,7 @@
##|*IDENT=page-status-packagelogs
##|*NAME=Status: Package logs
##|*DESCR=Allow access to the 'Status: Package logs' page.
-##|*MATCH=diag_pkglogs.php*
+##|*MATCH=status_pkglogs.php*
##|-PRIV
require("guiconfig.inc");
@@ -119,9 +119,9 @@ if ($pkgwithlogging == false) {
if ($apkg == $package['name']) {
$curtab = $logtab;
- $tab_array[] = array(sprintf(gettext("%s"), $logtab), true, "diag_pkglogs.php?pkg=".$package['name']);
+ $tab_array[] = array(sprintf(gettext("%s"), $logtab), true, "status_pkglogs.php?pkg=".$package['name']);
} else {
- $tab_array[] = array(sprintf(gettext("%s"), $logtab), false, "diag_pkglogs.php?pkg=".$package['name']);
+ $tab_array[] = array(sprintf(gettext("%s"), $logtab), false, "status_pkglogs.php?pkg=".$package['name']);
}
}
}
diff --git a/src/usr/local/www/status_queues.php b/src/usr/local/www/status_queues.php
index 57ddccd..d4e5477 100644
--- a/src/usr/local/www/status_queues.php
+++ b/src/usr/local/www/status_queues.php
@@ -150,7 +150,6 @@ $pgtitle = array(gettext("Status"), gettext("Traffic shaper"), gettext("Queues")
$shortcut_section = "trafficshaper";
include("head.inc");
?>
-<body>
<script src="/jquery/jquery-1.11.2.min.js"></script>
<?php
if (!is_array($config['shaper']['queue']) || count($config['shaper']['queue']) < 1) {
@@ -222,7 +221,7 @@ else: ?>
?>
</div>
</div>
-</br>
+<br/>
<?php
@@ -266,38 +265,36 @@ function processQueues($altqstats, $level, $parent_name) {
}
}
if ($prev_if != $q['interface']) {
- echo "<tr><td><b>Interface ". htmlspecialchars(convert_real_interface_to_friendly_descr($q['interface'])) . "</b></td></tr>";
+ echo "<tr><td colspan=\"8\"><b>Interface " . htmlspecialchars(convert_real_interface_to_friendly_descr($q['interface'])) . "</b></td></tr>\n";
$prev_if = $q['interface'];
}
?>
<tr class="<?php echo $parent_name?>">
- <td bgcolor="#<?php echo $row_background?>" style="padding-left: <?php echo $level * 20?>px;">
- <font color="#000000">
- <?
- if (is_array($q['queue'])) {
- echo "<a href=\"#\" onclick=\"StatsShowHide('queuerow{$q['name']}{$q['interface']}');return false\">+/-</a> ";
- }
- if (strstr($q['name'], "root_")) {
- echo "<a href=\"firewall_shaper.php?interface={$if_name}&amp;queue={$if_name}&amp;action=show\">Root queue</a>";
- } else {
- echo "<a href=\"firewall_shaper.php?interface={$if_name}&amp;queue={$q['name']}&amp;action=show\">" . htmlspecialchars($q['name']) . "</a>";
- }
- ?>
- </font>
+ <td style="background-color:#<?php echo $row_background?>;padding-left:<?php echo $level * 20?>px;">
+ <?php
+ if (is_array($q['queue'])) {
+ echo "<a href=\"#\" onclick=\"StatsShowHide('queuerow{$q['name']}{$q['interface']}');return false\">+/-</a>";
+ }
+ if (strstr($q['name'], "root_")) {
+ echo "<a href=\"firewall_shaper.php?interface={$if_name}&amp;queue={$if_name}&amp;action=show\">Root queue</a>";
+ } else {
+ echo "<a href=\"firewall_shaper.php?interface={$if_name}&amp;queue={$q['name']}&amp;action=show\">" . htmlspecialchars($q['name']) . "</a>";
+ }
+ ?>
</td>
<?php
$cpuUsage = 0;
- echo "<td bgcolor=\"#{$row_background}\">";
- echo "<div class='progress' style='height: 7px;width: 170px;'>
- <div class='progress-bar' role='progressbar' name='queue{$q['name']}{$q['interface']}width' id='queue{$q['name']}{$q['interface']}width' aria-valuenow='70' aria-valuemin='0' aria-valuemax='100' style='width: ". ($cpuUsage*100) ."%;'></div>
+ echo "<td style=\"background-color:#{$row_background}\" >";
+ echo "<div class=\"progress\" style=\"height: 7px;width: 170px;\">
+ <div class=\"progress-bar\" role=\"progressbar\" id=\"queue{$q['name']}{$q['interface']}width\" aria-valuenow=\"70\" aria-valuemin=\"0\" aria-valuemax=\"100\" style=\"width: " . ($cpuUsage*100) . "%;\"></div>
</div>";
- echo " </td>";
- echo "<td bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}pps' id='queue{$q['name']}{$q['interface']}pps' value='(" . gettext("Loading") . ")' align='left' /></td>";
- echo "<td bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:80px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}bps' id='queue{$q['name']}{$q['interface']}bps' value='' align='right' /></td>";
- echo "<td bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}borrows' id='queue{$q['name']}{$q['interface']}borrows' value='' align='right' /></td>";
- echo "<td bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}suspends' id='queue{$q['name']}{$q['interface']}suspends' value='' align='right' /></td>";
- echo "<td bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}drops' id='queue{$q['name']}{$q['interface']}drops' value='' align='right' /></td>";
- echo "<td bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}length' id='queue{$q['name']}{$q['interface']}length' value='' align='right' /></td>";
+ echo "</td>";
+ echo "<td style=\"background-color:#{$row_background}\"><input style=\"border:0;width:70px;text-align:right;\" size=\"10\" name=\"queue{$q['name']}{$q['interface']}pps\" id=\"queue{$q['name']}{$q['interface']}pps\" value=\"(" . gettext("Loading") . ")\" /></td>";
+ echo "<td style=\"background-color:#{$row_background}\"><input style=\"border:0;width:80px;text-align:right;\" size=\"10\" name=\"queue{$q['name']}{$q['interface']}bps\" id=\"queue{$q['name']}{$q['interface']}bps\" value=\"\" /></td>";
+ echo "<td style=\"background-color:#{$row_background}\"><input style=\"border:0;width:70px;text-align:right;\" size=\"10\" name=\"queue{$q['name']}{$q['interface']}borrows\" id=\"queue{$q['name']}{$q['interface']}borrows\" value=\"\" /></td>";
+ echo "<td style=\"background-color:#{$row_background}\"><input style=\"border:0;width:70px;text-align:right;\" size=\"10\" name=\"queue{$q['name']}{$q['interface']}suspends\" id=\"queue{$q['name']}{$q['interface']}suspends\" value=\"\" /></td>";
+ echo "<td style=\"background-color:#{$row_background}\"><input style=\"border:0;width:70px;text-align:right;\" size=\"10\" name=\"queue{$q['name']}{$q['interface']}drops\" id=\"queue{$q['name']}{$q['interface']}drops\" value=\"\" /></td>";
+ echo "<td style=\"background-color:#{$row_background}\"><input style=\"border:0;width:70px;text-align:right;\" size=\"10\" name=\"queue{$q['name']}{$q['interface']}length\" id=\"queue{$q['name']}{$q['interface']}length\" value=\"\" /></td>";
?>
</tr>
<?php
diff --git a/src/usr/local/www/status_upnp.php b/src/usr/local/www/status_upnp.php
index 0a66273..f5af632 100644
--- a/src/usr/local/www/status_upnp.php
+++ b/src/usr/local/www/status_upnp.php
@@ -77,7 +77,7 @@ if ($_POST) {
$rdr_entries = array();
exec("/sbin/pfctl -aminiupnpd -sn", $rdr_entries, $pf_ret);
-$pgtitle = array(gettext("Status"),gettext("UPnP &amp; NAT-PMP Status"));
+$pgtitle = array(gettext("Status"),gettext("UPnP &amp; NAT-PMP"));
$shortcut_section = "upnp";
include("head.inc");
diff --git a/src/usr/local/www/system.php b/src/usr/local/www/system.php
index e2fcd72..051dcae 100644
--- a/src/usr/local/www/system.php
+++ b/src/usr/local/www/system.php
@@ -466,7 +466,7 @@ $section->addInput(new Form_Select(
$form->add($section);
$csslist = array();
-$css = glob("bootstrap/css/*.css");
+$css = glob("/usr/local/www/bootstrap/css/*.css");
foreach ($css as $file) {
$file = basename($file);
if(substr($file, 0, 9) !== 'bootstrap') {
@@ -487,14 +487,14 @@ $section->addInput(new Form_Select(
'Theme',
$pconfig['webguicss'],
$csslist
-))->setHelp('<span class="badge" title="This feature is in BETA">BETA</span> Choose an alternative css file (if installed) to change the appearance of the Web configurator. css files are located in /usr/local/www/bootstrap/css');
+))->setHelp('Choose an alternative css file (if installed) to change the appearance of the Web configurator. css files are located in /usr/local/www/bootstrap/css');
$section->addInput(new Form_Select(
'webguifixedmenu',
'Top Navigation',
$pconfig['webguifixedmenu'],
["" => "Scrolls with page", "fixed" => "Fixed (Remains visible at top of page)"]
-))->setHelp("<span class=\"badge bg-danger\" title=\"This feature is in BETA\">BETA</span>");
+))->setHelp("The fixed option is intended for large screens only.");
$section->addInput(new Form_Input(
'dashboardcolumns',
diff --git a/src/usr/local/www/system_advanced_admin.php b/src/usr/local/www/system_advanced_admin.php
index a4c4c62..28edf97 100644
--- a/src/usr/local/www/system_advanced_admin.php
+++ b/src/usr/local/www/system_advanced_admin.php
@@ -317,7 +317,7 @@ if ($_POST) {
}
}
-$pgtitle = array(gettext("System"), gettext("Advanced: Admin Access"));
+$pgtitle = array(gettext("System"), gettext("Advanced"), gettext("Admin Access"));
include("head.inc");
if ($input_errors)
@@ -520,7 +520,7 @@ if (!$g['enableserial_force'] && ($g['platform'] == $g['product_name'] || $g['pl
isset($pconfig['enableserial'])
))->setHelp('Note: This will redirect the console output and messages to '.
'the serial port. You can still access the console menu from the internal video '.
- 'card/keyboard. A<b>null modem</b>serial cable or adapter is required to use the '.
+ 'card/keyboard. A <b>null modem</b> serial cable or adapter is required to use the '.
'serial console.');
$section->addInput(new Form_Select(
diff --git a/src/usr/local/www/system_advanced_firewall.php b/src/usr/local/www/system_advanced_firewall.php
index edce9f6..ab3d7d8 100644
--- a/src/usr/local/www/system_advanced_firewall.php
+++ b/src/usr/local/www/system_advanced_firewall.php
@@ -402,7 +402,7 @@ if ($_POST) {
}
}
-$pgtitle = array(gettext("System"), gettext("Advanced: Firewall and NAT"));
+$pgtitle = array(gettext("System"), gettext("Advanced"), gettext("Firewall and NAT"));
include("head.inc");
if ($input_errors)
diff --git a/src/usr/local/www/system_advanced_misc.php b/src/usr/local/www/system_advanced_misc.php
index 24ed18c..422ca6f 100644
--- a/src/usr/local/www/system_advanced_misc.php
+++ b/src/usr/local/www/system_advanced_misc.php
@@ -88,7 +88,6 @@ $pconfig['thermal_hardware'] = $config['system']['thermal_hardware'];
$pconfig['schedule_states'] = isset($config['system']['schedule_states']);
$pconfig['kill_states'] = isset($config['system']['kill_states']);
$pconfig['skip_rules_gw_down'] = isset($config['system']['skip_rules_gw_down']);
-$pconfig['apinger_debug'] = isset($config['system']['apinger_debug']);
$pconfig['use_mfs_tmpvar'] = isset($config['system']['use_mfs_tmpvar']);
$pconfig['use_mfs_tmp_size'] = $config['system']['use_mfs_tmp_size'];
$pconfig['use_mfs_var_size'] = $config['system']['use_mfs_var_size'];
@@ -261,19 +260,6 @@ if ($_POST) {
unset($config['system']['skip_rules_gw_down']);
}
- $need_apinger_restart = false;
- if ($_POST['apinger_debug'] == "yes") {
- if (!isset($config['system']['apinger_debug'])) {
- $need_apinger_restart = true;
- }
- $config['system']['apinger_debug'] = true;
- } else {
- if (isset($config['system']['apinger_debug'])) {
- $need_apinger_restart = true;
- }
- unset($config['system']['apinger_debug']);
- }
-
if ($_POST['use_mfs_tmpvar'] == "yes") {
$config['system']['use_mfs_tmpvar'] = true;
} else {
@@ -309,13 +295,10 @@ if ($_POST) {
if ($need_relayd_restart) {
relayd_configure();
}
- if ($need_apinger_restart) {
- setup_gateways_monitor();
- }
}
}
-$pgtitle = array(gettext("System"), gettext("Advanced: Miscellaneous"));
+$pgtitle = array(gettext("System"), gettext("Advanced"), gettext("Miscellaneous"));
include("head.inc");
if ($input_errors)
@@ -519,14 +502,6 @@ $section->addInput(new Form_Checkbox(
'down, the rule is created omitting the gateway. This option overrides that '.
'behavior by omitting the entire rule instead.');
-$section->addInput(new Form_Checkbox(
- 'apinger_debug',
- 'Gateway monitoring logging',
- 'Enable debug logging',
- $pconfig['apinger_debug']
-))->setHelp('Enable this setting to log debug information from the gateway '.
- 'monitoring process to the system logs.');
-
$form->add($section);
$section = new Form_Section('RAM Disk Settings (Reboot to Apply Changes)');
diff --git a/src/usr/local/www/system_advanced_network.php b/src/usr/local/www/system_advanced_network.php
index 80ea22f..6a3f3f5 100644
--- a/src/usr/local/www/system_advanced_network.php
+++ b/src/usr/local/www/system_advanced_network.php
@@ -171,7 +171,7 @@ if ($_POST) {
}
}
-$pgtitle = array(gettext("System"), gettext("Advanced: Networking"));
+$pgtitle = array(gettext("System"), gettext("Advanced"), gettext("Networking"));
include("head.inc");
if ($input_errors)
diff --git a/src/usr/local/www/system_advanced_notifications.php b/src/usr/local/www/system_advanced_notifications.php
index dadfb8a..bdc6034 100644
--- a/src/usr/local/www/system_advanced_notifications.php
+++ b/src/usr/local/www/system_advanced_notifications.php
@@ -199,7 +199,7 @@ if ($_POST) {
}
}
-$pgtitle = array(gettext("System"), gettext("Advanced: Notifications"));
+$pgtitle = array(gettext("System"), gettext("Advanced"), gettext("Notifications"));
include("head.inc");
if ($input_errors)
@@ -358,7 +358,7 @@ $section->addInput(new Form_Input(
'submit',
'Test SMTP settings'
))->addClass('btn-info')->setHelp('A test notification will be sent even if the service is '.
- 'marked as disabled.');
+ 'marked as disabled. The last SAVED values will be used, not necessarily the values entered here.');
$form->add($section);
diff --git a/src/usr/local/www/system_advanced_sysctl.php b/src/usr/local/www/system_advanced_sysctl.php
index 423ed74..8d1e0b0 100644
--- a/src/usr/local/www/system_advanced_sysctl.php
+++ b/src/usr/local/www/system_advanced_sysctl.php
@@ -166,7 +166,7 @@ if ($_POST) {
}
}
-$pgtitle = array(gettext("System"), gettext("Advanced: System Tunables"));
+$pgtitle = array(gettext("System"), gettext("Advanced"), gettext("System Tunables"));
include("head.inc");
if ($input_errors)
diff --git a/src/usr/local/www/system_authservers.php b/src/usr/local/www/system_authservers.php
index 7f10912..821fc68 100644
--- a/src/usr/local/www/system_authservers.php
+++ b/src/usr/local/www/system_authservers.php
@@ -67,7 +67,7 @@
require("guiconfig.inc");
require_once("auth.inc");
-$pgtitle = array(gettext("System"), gettext("Authentication Servers"));
+$pgtitle = array(gettext("System"), gettext("User Manager"), gettext("Authentication Servers"));
$shortcut_section = "authentication";
if (is_numericint($_GET['id'])) {
diff --git a/src/usr/local/www/system_camanager.php b/src/usr/local/www/system_camanager.php
index 6e5459a..59c1f8e 100644
--- a/src/usr/local/www/system_camanager.php
+++ b/src/usr/local/www/system_camanager.php
@@ -75,7 +75,7 @@ $ca_methods = array(
$ca_keylens = array("512", "1024", "2048", "4096");
$openssl_digest_algs = array("sha1", "sha224", "sha256", "sha384", "sha512");
-$pgtitle = array(gettext("System"), gettext("Certificate Authority Manager"));
+$pgtitle = array(gettext("System"), gettext("Certificate Manager"), gettext("CAs"));
if (is_numericint($_GET['id'])) {
$id = $_GET['id'];
diff --git a/src/usr/local/www/system_certmanager.php b/src/usr/local/www/system_certmanager.php
index d179667..32d5fad 100644
--- a/src/usr/local/www/system_certmanager.php
+++ b/src/usr/local/www/system_certmanager.php
@@ -82,7 +82,7 @@ $cert_types = array(
$altname_types = array("DNS", "IP", "email", "URI");
$openssl_digest_algs = array("sha1", "sha224", "sha256", "sha384", "sha512");
-$pgtitle = array(gettext("System"), gettext("Certificate Manager"));
+$pgtitle = array(gettext("System"), gettext("Certificate Manager"), gettext("Certificates"));
if (is_numericint($_GET['userid'])) {
$userid = $_GET['userid'];
diff --git a/src/usr/local/www/system_crlmanager.php b/src/usr/local/www/system_crlmanager.php
index b84de92..98a9b68 100644
--- a/src/usr/local/www/system_crlmanager.php
+++ b/src/usr/local/www/system_crlmanager.php
@@ -70,7 +70,7 @@ require_once("vpn.inc");
global $openssl_crl_status;
-$pgtitle = array(gettext("System"), gettext("Certificate Revocation List Manager"));
+$pgtitle = array(gettext("System"), gettext("Certificate Manager"), gettext("Certificate Revocation Lists"));
$crl_methods = array(
"internal" => gettext("Create an internal Certificate Revocation List"),
diff --git a/src/usr/local/www/system_gateways_edit.php b/src/usr/local/www/system_gateways_edit.php
index b5068d6..35cfffb 100644
--- a/src/usr/local/www/system_gateways_edit.php
+++ b/src/usr/local/www/system_gateways_edit.php
@@ -84,7 +84,7 @@ if (!is_array($config['gateways']['gateway_item'])) {
}
$a_gateway_item = &$config['gateways']['gateway_item'];
-$apinger_default = return_apinger_defaults();
+$dpinger_default = return_dpinger_defaults();
if (is_numericint($_GET['id'])) {
$id = $_GET['id'];
@@ -102,12 +102,9 @@ if (isset($id) && $a_gateways[$id]) {
$pconfig['name'] = $a_gateways[$id]['name'];
$pconfig['weight'] = $a_gateways[$id]['weight'];
$pconfig['interval'] = $a_gateways[$id]['interval'];
- $pconfig['avg_delay_samples'] = $a_gateways[$id]['avg_delay_samples'];
- $pconfig['avg_delay_samples_calculated'] = isset($a_gateways[$id]['avg_delay_samples_calculated']);
- $pconfig['avg_loss_samples'] = $a_gateways[$id]['avg_loss_samples'];
- $pconfig['avg_loss_samples_calculated'] = isset($a_gateways[$id]['avg_loss_samples_calculated']);
- $pconfig['avg_loss_delay_samples'] = $a_gateways[$id]['avg_loss_delay_samples'];
- $pconfig['avg_loss_delay_samples_calculated'] = isset($a_gateways[$id]['avg_loss_delay_samples_calculated']);
+ $pconfig['loss_interval'] = $a_gateways[$id]['loss_interval'];
+ $pconfig['alert_interval'] = $a_gateways[$id]['alert_interval'];
+ $pconfig['time_period'] = $a_gateways[$id]['time_period'];
$pconfig['interface'] = $a_gateways[$id]['interface'];
$pconfig['friendlyiface'] = $a_gateways[$id]['friendlyiface'];
$pconfig['ipprotocol'] = $a_gateways[$id]['ipprotocol'];
@@ -121,7 +118,6 @@ if (isset($id) && $a_gateways[$id]) {
$pconfig['latencyhigh'] = $a_gateways[$id]['latencyhigh'];
$pconfig['losslow'] = $a_gateways[$id]['losslow'];
$pconfig['losshigh'] = $a_gateways[$id]['losshigh'];
- $pconfig['down'] = $a_gateways[$id]['down'];
$pconfig['monitor'] = $a_gateways[$id]['monitor'];
$pconfig['monitor_disable'] = isset($a_gateways[$id]['monitor_disable']);
$pconfig['nonlocalgateway'] = isset($a_gateways[$id]['nonlocalgateway']);
@@ -312,169 +308,190 @@ if ($_POST) {
}
}
- /* input validation of apinger advanced parameters */
+ /* input validation of dpinger advanced parameters */
if ($_POST['latencylow']) {
if (!is_numeric($_POST['latencylow'])) {
$input_errors[] = gettext("The low latency threshold needs to be a numeric value.");
- } else {
- if ($_POST['latencylow'] < 1) {
- $input_errors[] = gettext("The low latency threshold needs to be positive.");
- }
+ } else if ($_POST['latencylow'] < 1) {
+ $input_errors[] = gettext("The low latency threshold needs to be positive.");
}
}
if ($_POST['latencyhigh']) {
if (!is_numeric($_POST['latencyhigh'])) {
$input_errors[] = gettext("The high latency threshold needs to be a numeric value.");
- } else {
- if ($_POST['latencyhigh'] < 1) {
- $input_errors[] = gettext("The high latency threshold needs to be positive.");
- }
+ } else if ($_POST['latencyhigh'] < 1) {
+ $input_errors[] = gettext("The high latency threshold needs to be positive.");
}
}
if ($_POST['losslow']) {
if (!is_numeric($_POST['losslow'])) {
$input_errors[] = gettext("The low Packet Loss threshold needs to be a numeric value.");
- } else {
- if ($_POST['losslow'] < 1) {
- $input_errors[] = gettext("The low Packet Loss threshold needs to be positive.");
- }
- if ($_POST['losslow'] >= 100) {
- $input_errors[] = gettext("The low Packet Loss threshold needs to be less than 100.");
- }
+ } else if ($_POST['losslow'] < 1) {
+ $input_errors[] = gettext("The low Packet Loss threshold needs to be positive.");
+ } else if ($_POST['losslow'] >= 100) {
+ $input_errors[] = gettext("The low Packet Loss threshold needs to be less than 100.");
}
}
if ($_POST['losshigh']) {
if (!is_numeric($_POST['losshigh'])) {
$input_errors[] = gettext("The high Packet Loss threshold needs to be a numeric value.");
- } else {
- if ($_POST['losshigh'] < 1) {
- $input_errors[] = gettext("The high Packet Loss threshold needs to be positive.");
- }
- if ($_POST['losshigh'] > 100) {
- $input_errors[] = gettext("The high Packet Loss threshold needs to be 100 or less.");
- }
+ } else if ($_POST['losshigh'] < 1) {
+ $input_errors[] = gettext("The high Packet Loss threshold needs to be positive.");
+ } else if ($_POST['losshigh'] > 100) {
+ $input_errors[] = gettext("The high Packet Loss threshold needs to be 100 or less.");
}
}
if (($_POST['latencylow']) && ($_POST['latencyhigh'])) {
- if ((is_numeric($_POST['latencylow'])) && (is_numeric($_POST['latencyhigh']))) {
- if (($_POST['latencylow'] > $_POST['latencyhigh'])) {
- $input_errors[] = gettext("The high latency threshold needs to be higher than the low latency threshold");
- }
- }
- } else {
- if ($_POST['latencylow']) {
- if (is_numeric($_POST['latencylow'])) {
- if ($_POST['latencylow'] > $apinger_default['latencyhigh']) {
- $input_errors[] = gettext(sprintf("The low latency threshold needs to be less than the default high latency threshold (%d)", $apinger_default['latencyhigh']));
- }
- }
- }
- if ($_POST['latencyhigh']) {
- if (is_numeric($_POST['latencyhigh'])) {
- if ($_POST['latencyhigh'] < $apinger_default['latencylow']) {
- $input_errors[] = gettext(sprintf("The high latency threshold needs to be higher than the default low latency threshold (%d)", $apinger_default['latencylow']));
- }
- }
+ if ((is_numeric($_POST['latencylow'])) &&
+ (is_numeric($_POST['latencyhigh'])) &&
+ ($_POST['latencylow'] >= $_POST['latencyhigh'])) {
+ $input_errors[] = gettext(
+ "The high latency threshold needs to be higher than the low latency threshold");
+ }
+ } else if ($_POST['latencylow']) {
+ if (is_numeric($_POST['latencylow']) &&
+ ($_POST['latencylow'] >= $dpinger_default['latencyhigh'])) {
+ $input_errors[] = gettext(sprintf(
+ "The low latency threshold needs to be less than the default high latency threshold (%d)",
+ $dpinger_default['latencyhigh']));
+ }
+ } else if ($_POST['latencyhigh']) {
+ if (is_numeric($_POST['latencyhigh']) &&
+ ($_POST['latencyhigh'] <= $dpinger_default['latencylow'])) {
+ $input_errors[] = gettext(sprintf(
+ "The high latency threshold needs to be higher than the default low latency threshold (%d)",
+ $dpinger_default['latencylow']));
}
}
if (($_POST['losslow']) && ($_POST['losshigh'])) {
- if ((is_numeric($_POST['losslow'])) && (is_numeric($_POST['losshigh']))) {
- if ($_POST['losslow'] > $_POST['losshigh']) {
- $input_errors[] = gettext("The high Packet Loss threshold needs to be higher than the low Packet Loss threshold");
- }
- }
- } else {
- if ($_POST['losslow']) {
- if (is_numeric($_POST['losslow'])) {
- if ($_POST['losslow'] > $apinger_default['losshigh']) {
- $input_errors[] = gettext(sprintf("The low Packet Loss threshold needs to be less than the default high Packet Loss threshold (%d)", $apinger_default['losshigh']));
- }
- }
- }
- if ($_POST['losshigh']) {
- if (is_numeric($_POST['losshigh'])) {
- if ($_POST['losshigh'] < $apinger_default['losslow']) {
- $input_errors[] = gettext(sprintf("The high Packet Loss threshold needs to be higher than the default low Packet Loss threshold (%d)", $apinger_default['losslow']));
- }
- }
+ if ((is_numeric($_POST['losslow'])) &&
+ (is_numeric($_POST['losshigh'])) &&
+ ($_POST['losslow'] >= $_POST['losshigh'])) {
+ $input_errors[] = gettext(
+ "The high Packet Loss threshold needs to be higher than the low Packet Loss threshold");
+ }
+ } else if ($_POST['losslow']) {
+ if (is_numeric($_POST['losslow']) &&
+ ($_POST['losslow'] >= $dpinger_default['losshigh'])) {
+ $input_errors[] = gettext(sprintf(
+ "The low Packet Loss threshold needs to be less than the default high Packet Loss threshold (%d)",
+ $dpinger_default['losshigh']));
+ }
+ } else if ($_POST['losshigh']) {
+ if (is_numeric($_POST['losshigh']) &&
+ ($_POST['losshigh'] <= $dpinger_default['losslow'])) {
+ $input_errors[] = gettext(sprintf(
+ "The high Packet Loss threshold needs to be higher than the default low Packet Loss threshold (%d)",
+ $dpinger_default['losslow']));
}
}
if ($_POST['interval']) {
if (!is_numeric($_POST['interval'])) {
$input_errors[] = gettext("The probe interval needs to be a numeric value.");
- } else {
- if ($_POST['interval'] < 1) {
- $input_errors[] = gettext("The probe interval needs to be positive.");
- }
+ } else if ($_POST['interval'] < 1) {
+ $input_errors[] = gettext("The probe interval needs to be positive.");
}
}
- if ($_POST['down']) {
- if (!is_numeric($_POST['down'])) {
- $input_errors[] = gettext("The down time setting needs to be a numeric value.");
- } else {
- if ($_POST['down'] < 1) {
- $input_errors[] = gettext("The down time setting needs to be positive.");
- }
+ if ($_POST['loss_interval']) {
+ if (!is_numeric($_POST['loss_interval'])) {
+ $input_errors[] = gettext("The loss interval needs to be a numeric value.");
+ } else if ($_POST['loss_interval'] < 1) {
+ $input_errors[] = gettext("The loss interval setting needs to be positive.");
}
}
- if (($_POST['interval']) && ($_POST['down'])) {
- if ((is_numeric($_POST['interval'])) && (is_numeric($_POST['down']))) {
- if ($_POST['interval'] > $_POST['down']) {
- $input_errors[] = gettext("The probe interval needs to be less than the down time setting.");
- }
+ // If the loss interval is less than latencyhigh, then high latency could never be recorded
+ // because those high latency packets would be considered as lost. So do not allow that.
+ if (($_POST['latencyhigh']) && ($_POST['loss_interval'])) {
+ if ((is_numeric($_POST['latencyhigh'])) &&
+ (is_numeric($_POST['loss_interval'])) &&
+ ($_POST['latencyhigh'] > $_POST['loss_interval'])) {
+ $input_errors[] = gettext("The loss interval needs to be greater than or equal to the high latency threshold.");
+ }
+ } 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']));
+ }
+ } 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']));
}
- } else {
- if ($_POST['interval']) {
- if (is_numeric($_POST['interval'])) {
- if ($_POST['interval'] > $apinger_default['down']) {
- $input_errors[] = gettext(sprintf("The probe interval needs to be less than the default down time setting (%d)", $apinger_default['down']));
- }
- }
- }
- if ($_POST['down']) {
- if (is_numeric($_POST['down'])) {
- if ($_POST['down'] < $apinger_default['interval']) {
- $input_errors[] = gettext(sprintf("The down time setting needs to be higher than the default probe interval (%d)", $apinger_default['interval']));
- }
- }
+ }
+
+ if ($_POST['time_period']) {
+ if (!is_numeric($_POST['time_period'])) {
+ $input_errors[] = gettext("The time period over which results are averaged needs to be a numeric value.");
+ } else if ($_POST['time_period'] < 1) {
+ $input_errors[] = gettext("The time period over which results are averaged needs to be positive.");
}
}
- if ($_POST['avg_delay_samples']) {
- if (!is_numeric($_POST['avg_delay_samples'])) {
- $input_errors[] = gettext("The average delay replies qty needs to be a numeric value.");
- } else {
- if ($_POST['avg_delay_samples'] < 1) {
- $input_errors[] = gettext("The average delay replies qty needs to be positive.");
- }
+ // It would be a weird averaging algorithm if we allowed averaging over a time that covered less than 2 pings.
+ // So make sure that the averaging time period is at least 2 times the probe interval.
+ if (($_POST['interval']) && ($_POST['time_period'])) {
+ if ((is_numeric($_POST['interval'])) &&
+ (is_numeric($_POST['time_period'])) &&
+ (($_POST['interval'] * 2) > $_POST['time_period'])) {
+ $input_errors[] = gettext("The time period over which results are averaged needs to be at least twice the probe interval.");
+ }
+ } 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']));
+ }
+ } 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']));
}
}
- if ($_POST['avg_loss_samples']) {
- if (!is_numeric($_POST['avg_loss_samples'])) {
- $input_errors[] = gettext("The average packet loss probes qty needs to be a numeric value.");
- } else {
- if ($_POST['avg_loss_samples'] < 1) {
- $input_errors[] = gettext("The average packet loss probes qty needs to be positive.");
- }
+ if ($_POST['alert_interval']) {
+ if (!is_numeric($_POST['alert_interval'])) {
+ $input_errors[] = gettext("The alert interval needs to be a numeric value.");
+ } else if ($_POST['alert_interval'] < 1) {
+ $input_errors[] = gettext("The alert interval needs to be positive.");
}
}
- if ($_POST['avg_loss_delay_samples']) {
- if (!is_numeric($_POST['avg_loss_delay_samples'])) {
- $input_errors[] = gettext("The lost probe delay needs to be a numeric value.");
- } else {
- if ($_POST['avg_loss_delay_samples'] < 1) {
- $input_errors[] = gettext("The lost probe delay needs to be positive.");
- }
+ // There is no point recalculating the average latency and loss more often than the probe interval.
+ // So the alert interval needs to be >= probe interval.
+ if (($_POST['interval']) && ($_POST['alert_interval'])) {
+ if ((is_numeric($_POST['interval'])) &&
+ (is_numeric($_POST['alert_interval'])) &&
+ ($_POST['interval'] > $_POST['alert_interval'])) {
+ $input_errors[] = gettext("The alert interval needs to be greater than or equal to the probe interval.");
+ }
+ } 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']));
+ }
+ } 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']));
}
}
@@ -495,21 +512,15 @@ if ($_POST) {
$gateway['name'] = $_POST['name'];
$gateway['weight'] = $_POST['weight'];
$gateway['ipprotocol'] = $_POST['ipprotocol'];
- $gateway['interval'] = $_POST['interval'];
-
- $gateway['avg_delay_samples'] = $_POST['avg_delay_samples'];
- if ($_POST['avg_delay_samples_calculated'] == "yes" || $_POST['avg_delay_samples_calculated'] == "on") {
- $gateway['avg_delay_samples_calculated'] = true;
+ if ($_POST['interval']) {
+ $gateway['interval'] = $_POST['interval'];
}
- $gateway['avg_loss_samples'] = $_POST['avg_loss_samples'];
- if ($_POST['avg_loss_samples_calculated'] == "yes" || $_POST['avg_loss_samples_calculated'] == "on") {
- $gateway['avg_loss_samples_calculated'] = true;
+ if ($_POST['time_period']) {
+ $gateway['time_period'] = $_POST['time_period'];
}
-
- $gateway['avg_loss_delay_samples'] = $_POST['avg_loss_delay_samples'];
- if ($_POST['avg_loss_delay_samples_calculated'] == "yes" || $_POST['avg_loss_delay_samples_calculated'] == "on") {
- $gateway['avg_loss_delay_samples_calculated'] = true;
+ if ($_POST['alert_interval']) {
+ $gateway['alert_interval'] = $_POST['alert_interval'];
}
$gateway['descr'] = $_POST['descr'];
@@ -573,8 +584,8 @@ if ($_POST) {
if ($_POST['losshigh']) {
$gateway['losshigh'] = $_POST['losshigh'];
}
- if ($_POST['down']) {
- $gateway['down'] = $_POST['down'];
+ if ($_POST['loss_interval']) {
+ $gateway['loss_interval'] = $_POST['loss_interval'];
}
if (isset($_POST['disabled'])) {
@@ -629,61 +640,6 @@ include("head.inc");
if ($input_errors)
print_input_errors($input_errors);
-?>
-<script type="text/javascript">
-//<![CDATA[
-var systemGatewaysEditRecalculate = function(){
- var interval = $('#interval')[0].value;
-
- $('input[name$=_calculated]').each(function (idx, c){
- c = $(c);
- i = $(c.parents('.form-group').find('input[type=number]')[0]);
-
- c.prop('disabled', interval==0);
-
- if (interval==0)
- c.prop('checked', false);
-
- if (!c.prop('checked'))
- return i.prop('readonly', false);
-
- switch (i.attr('name'))
- {
- case 'avg_delay_samples':
- // How many replies should be used to compute average delay
- // for controlling "delay" alarms.
- // Calculate a reasonable value based on gateway probe interval and RRD 1 minute average graph step size (60).
- i.attr('value', Math.round(60 * (1/6) / Math.pow(interval, 0.333)));
- break;
-
- case 'avg_loss_samples':
- // How many probes should be used to compute average loss.
- // Calculate a reasonable value based on gateway probe interval and RRD 1 minute average graph step size (60).
- i.attr('value', Math.round(60 / interval));
- break;
-
- case 'avg_loss_delay_samples':
- // The delay (in samples) after which loss is computed
- // without this delays larger than interval would be treated as loss.
- // Calculate a reasonable value based on gateway probe interval and RRD 1 minute average graph step size (60).
- i.attr('value', Math.round(60 * (1/3) / interval));
- break;
- }
-
- i.prop('readonly', true);
- });
-};
-
-events.push(function(){
- $('#interval').on('change', systemGatewaysEditRecalculate);
- $('input[name$=_calculated]').on('change', systemGatewaysEditRecalculate);
-
- systemGatewaysEditRecalculate();
-});
-//]]>
-</script>
-<?php
-
$form = new Form;
/* If this is a system gateway we need this var */
@@ -800,10 +756,14 @@ $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']) || (isset($pconfig['weight']) && $pconfig['weight'] > 1) ||
- (isset($pconfig['interval']) && ($pconfig['interval'] > $apinger_default['interval'])) ||
- (isset($pconfig['down']) && !($pconfig['down'] == $apinger_default['down'])))) {
+if (!(!empty($pconfig['latencylow']) || !empty($pconfig['latencyhigh']) ||
+ !empty($pconfig['losslow']) || !empty($pconfig['losshigh']) ||
+ (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'])) ||
+ (isset($pconfig['time_period']) && !($pconfig['time_period'] == $dpinger_default['time_period'])) ||
+ (isset($pconfig['alert_interval']) && !($pconfig['alert_interval'] == $dpinger_default['alert_interval'])) ||
+ (isset($pconfig['nonlocalgateway']) && $pconfig['nonlocalgateway']))) {
$btnadvanced = new Form_Button(
'toggle-advanced',
@@ -843,17 +803,17 @@ $group->add(new Form_Input(
'From',
'number',
$pconfig['latencylow'],
- ['placeholder' => $apinger_default['latencylow']]
+ ['placeholder' => $dpinger_default['latencylow']]
));
$group->add(new Form_Input(
'latencyhigh',
'To',
'number',
$pconfig['latencyhigh'],
- ['placeholder' => $apinger_default['latencyhigh']]
+ ['placeholder' => $dpinger_default['latencyhigh']]
));
$group->setHelp('Low and high thresholds for latency in milliseconds.
- Default is %d/%d.', [$apinger_default['latencylow'], $apinger_default['latencyhigh']]);
+ Default is %d/%d.', [$dpinger_default['latencylow'], $dpinger_default['latencyhigh']]);
$section->add($group);
@@ -863,17 +823,17 @@ $group->add(new Form_Input(
'From',
'number',
$pconfig['losslow'],
- ['placeholder' => $apinger_default['losslow']]
+ ['placeholder' => $dpinger_default['losslow']]
));
$group->add(new Form_Input(
'losshigh',
'To',
'number',
$pconfig['losshigh'],
- ['placeholder' => $apinger_default['losshigh']]
+ ['placeholder' => $dpinger_default['losshigh']]
));
-$group->setHelp('Low and high thresholds for packet loss in milliseconds.
- Default is %d/%d.', [$apinger_default['losslow'], $apinger_default['losshigh']]);
+$group->setHelp('Low and high thresholds for packet loss in %%.
+ Default is %d/%d.', [$dpinger_default['losslow'], $dpinger_default['losshigh']]);
$section->add($group);
$section->addInput(new Form_Input(
@@ -882,103 +842,68 @@ $section->addInput(new Form_Input(
'number',
$pconfig['interval'],
[
- 'placeholder' => $apinger_default['interval'],
+ 'placeholder' => $dpinger_default['interval'],
'max' => 86400
]
-))->setHelp('How often an ICMP probe will be sent in seconds. Default is %d.'.
+))->setHelp('How often an ICMP probe will be sent in milliseconds. Default is %d. '.
'NOTE: The quality graph is averaged over seconds, not intervals, so as '.
'the probe interval is increased the accuracy of the quality graph is '.
- 'decreased.', [$apinger_default['interval']]);
+ 'decreased.', [$dpinger_default['interval']]);
$section->addInput(new Form_Input(
- 'down',
- 'Down',
+ 'loss_interval',
+ 'Loss Interval',
'number',
- $pconfig['down'],
- ['placeholder' => $apinger_default['down']]
-))->setHelp('The number of seconds of failed probes before the alarm '.
- 'will fire. Default is %d.', [$apinger_default['down']]);
+ $pconfig['loss_interval'],
+ ['placeholder' => $dpinger_default['loss_interval']]
+))->setHelp('Time interval in milliseconds before packets are treated as lost. '.
+ 'Default is %d.', [$dpinger_default['loss_interval']]);
-$group = new Form_Group('Avg. Delay Replies Qty');
+$group = new Form_Group('Time Period');
$group->add(new Form_Input(
- 'avg_delay_samples',
+ 'time_period',
null,
'number',
- $pconfig['avg_delay_samples'],
+ $pconfig['time_period'],
[
- 'placeholder' => $apinger_default['avg_delay_samples'],
- 'max' => 100
+ 'placeholder' => $dpinger_default['time_period']
]
));
-$group->add(new Form_Checkbox(
- 'avg_delay_samples_calculated',
- null,
- 'Use calculated value.',
- $pconfig['avg_delay_samples_calculated']
-));
-$group->setHelp('How many replies should be used to compute average delay for '.
- 'controlling "delay" alarms? Default is %d.',
- [$apinger_default['avg_delay_samples']]);
+$group->setHelp('Time period in milliseconds over which results are averaged. Default is %d.',
+ [$dpinger_default['time_period']]);
$section->add($group);
-$group = new Form_Group('Avg. Packet Loss Probes');
+$group = new Form_Group('Alert interval');
$group->add(new Form_Input(
- 'avg_loss_samples',
+ 'alert_interval',
null,
'number',
- $pconfig['avg_loss_samples'],
+ $pconfig['alert_interval'],
[
- 'placeholder' => $apinger_default['avg_loss_samples'],
- 'max' => 1000
+ 'placeholder' => $dpinger_default['alert_interval']
]
));
-$group->add(new Form_Checkbox(
- 'avg_loss_samples_calculated',
- null,
- 'Use calculated value.',
- $pconfig['avg_loss_samples_calculated']
-));
-$group->setHelp('How many probes should be useds to compute average packet loss? '.
- 'Default is %d.',
- [$apinger_default['avg_loss_samples']]);
-$section->add($group);
-
-$group = new Form_Group('Lost Probe Delay');
-$group->add(new Form_Input(
- 'avg_loss_delay_samples',
- null,
- 'number',
- $pconfig['avg_loss_delay_samples'],
- [
- 'placeholder' => $apinger_default['avg_loss_delay_samples'],
- 'max' => 200
- ]
-));
-$group->add(new Form_Checkbox(
- 'avg_loss_delay_samples_calculated',
- null,
- 'Use calculated value.',
- $pconfig['avg_loss_samples_calculated']
-));
-$group->setHelp('The delay (in qty of probe samples) after which loss is '.
- 'computed. Without this, delays longer than the probe interval would be '.
- 'treated as packet loss. Default is %d.',
- [$apinger_default['avg_loss_delay_samples']]);
+$group->setHelp('Time interval in milliseconds between checking for an alert condition. Default is %d.',
+ [$dpinger_default['alert_interval']]);
$section->add($group);
$section->addInput(new Form_StaticText(
'Additional information',
'<span class="help-block">'.
- gettext('The probe interval must be less than the down time, otherwise the '.
- 'gateway will seem to go down then come up again at the next probe.').
- '<br/><br/>'.
- gettext('The down time defines the length of time before the gateway is marked '.
- 'as down, but the accuracy is controlled by the probe interval. For example, '.
- 'if your down time is 40 seconds but on a 30 second probe interval, only one '.
- 'probe would have to fail before the gateway is marked down at the 40 second '.
- 'mark. By default, the gateway is considered down after 10 seconds, and the '.
- 'probe interval is 1 second, so 10 probes would have to fail before the gateway '.
- 'is marked down.').
+ 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.') .
+ '<br/><br/>' .
+ gettext('The alert interval must be greater than or equal to the probe interval. ' .
+ 'There is no point checking for alerts more often than probes are done.') .
+ '<br/><br/>' .
+ gettext('The loss interval must be greater than or equal to the high latency threshold. ' .
+ 'Otherwise high latency packets would always be considered as lost.') .
+ '<br/><br/>' .
+ gettext('Choose a combination of parameters to suit your needs. ' .
+ 'For example, a short probe interval will give more probes and (hopefully) ' .
+ 'a statistically more stable average. A higher loss interval will allow the ' .
+ 'system to wait longer for probes on high-latency links, and thus allow a ' .
+ 'better estimate of high-latency versus loss.').
'</span>'
));
diff --git a/src/usr/local/www/system_groupmanager.php b/src/usr/local/www/system_groupmanager.php
index dfeb12f..bd2eb5c 100644
--- a/src/usr/local/www/system_groupmanager.php
+++ b/src/usr/local/www/system_groupmanager.php
@@ -70,7 +70,7 @@
require("guiconfig.inc");
-$pgtitle = array(gettext("System"), gettext("Group Manager"));
+$pgtitle = array(gettext("System"), gettext("User Manager"), gettext("Groups"));
if (!is_array($config['system']['group'])) {
$config['system']['group'] = array();
diff --git a/src/usr/local/www/system_groupmanager_addprivs.php b/src/usr/local/www/system_groupmanager_addprivs.php
index e238228..1e97e59 100644
--- a/src/usr/local/www/system_groupmanager_addprivs.php
+++ b/src/usr/local/www/system_groupmanager_addprivs.php
@@ -83,7 +83,7 @@ function admin_groups_sort() {
require("guiconfig.inc");
-$pgtitle = array(gettext("System"), gettext("Group manager"), gettext("Add privileges"));
+$pgtitle = array(gettext("System"), gettext("User Manager"), gettext("Groups"), gettext("Add Privileges"));
if (is_numericint($_GET['groupid'])) {
$groupid = $_GET['groupid'];
diff --git a/src/usr/local/www/system_usermanager.php b/src/usr/local/www/system_usermanager.php
index 8b3175f..67fbbe1 100644
--- a/src/usr/local/www/system_usermanager.php
+++ b/src/usr/local/www/system_usermanager.php
@@ -73,7 +73,7 @@ require("certs.inc");
require("guiconfig.inc");
// start admin user code
-$pgtitle = array(gettext("System"), gettext("User Manager"));
+$pgtitle = array(gettext("System"), gettext("User Manager"), gettext("Users"));
if (isset($_POST['userid']) && is_numericint($_POST['userid'])) {
$id = $_POST['userid'];
diff --git a/src/usr/local/www/system_usermanager_addprivs.php b/src/usr/local/www/system_usermanager_addprivs.php
index 98a209c..1086a65 100644
--- a/src/usr/local/www/system_usermanager_addprivs.php
+++ b/src/usr/local/www/system_usermanager_addprivs.php
@@ -70,7 +70,7 @@ function admusercmp($a, $b) {
require("guiconfig.inc");
-$pgtitle = array("System", "User manager", "Add privileges");
+$pgtitle = array(gettext("System"), gettext("User Manager"), gettext("Users"), gettext("Add Privileges"));
if (is_numericint($_GET['userid'])) {
$userid = $_GET['userid'];
diff --git a/src/usr/local/www/system_usermanager_settings.php b/src/usr/local/www/system_usermanager_settings.php
index 6585112..09029ed 100644
--- a/src/usr/local/www/system_usermanager_settings.php
+++ b/src/usr/local/www/system_usermanager_settings.php
@@ -76,7 +76,7 @@ else {
$pconfig['backend'] = &$config['system']['webgui']['backend'];
// Page title for main admin
-$pgtitle = array(gettext("System"), gettext("User manager settings"));
+$pgtitle = array(gettext("System"), gettext("User Manager"), gettext("Settings"));
$save_and_test = false;
diff --git a/src/usr/local/www/tree/tree.css b/src/usr/local/www/tree/tree.css
index 31b7979..f3ed323 100755
--- a/src/usr/local/www/tree/tree.css
+++ b/src/usr/local/www/tree/tree.css
@@ -127,7 +127,7 @@ ul.tree div a {
}
ul.tree li A:link, ul.tree li A:hover, ul.tree li A:visited {
- color : #111111;
+ color : #ffffff;
}
diff --git a/src/usr/local/www/vpn_ipsec.php b/src/usr/local/www/vpn_ipsec.php
index b437e41..9a81ab6 100644
--- a/src/usr/local/www/vpn_ipsec.php
+++ b/src/usr/local/www/vpn_ipsec.php
@@ -250,14 +250,14 @@ if ($_POST) {
}
}
-$pgtitle = array(gettext("VPN"), gettext("IPsec"));
+$pgtitle = array(gettext("VPN"), gettext("IPsec"), gettext("Tunnels"));
$shortcut_section = "ipsec";
include("head.inc");
$tab_array = array();
$tab_array[] = array(gettext("Tunnels"), true, "vpn_ipsec.php");
-$tab_array[] = array(gettext("Mobile clients"), false, "vpn_ipsec_mobile.php");
+$tab_array[] = array(gettext("Mobile Clients"), false, "vpn_ipsec_mobile.php");
$tab_array[] = array(gettext("Pre-Shared Keys"), false, "vpn_ipsec_keys.php");
$tab_array[] = array(gettext("Advanced Settings"), false, "vpn_ipsec_settings.php");
display_top_tabs($tab_array);
@@ -550,7 +550,7 @@ display_top_tabs($tab_array);
<div id="infoblock">
<?=print_info_box('<strong>' . gettext("Note:") . '</strong><br />' .
- gettext("You can check your IPsec status at ") . '<a href="diag_ipsec.php">' . gettext("Status:IPsec") . '</a>.<br />' .
+ gettext("You can check your IPsec status at ") . '<a href="status_ipsec.php">' . gettext("Status:IPsec") . '</a>.<br />' .
gettext("IPsec Debug Mode can be enabled at ") . '<a href="vpn_ipsec_settings.php">' .gettext("VPN:IPsec:Advanced Settings") . '</a>.<br />' .
gettext("IPsec can be set to prefer older SAs at ") . '<a href="vpn_ipsec_settings.php">' . gettext("VPN:IPsec:Advanced Settings") . '</a>', info)?>
</div>
diff --git a/src/usr/local/www/vpn_ipsec_keys.php b/src/usr/local/www/vpn_ipsec_keys.php
index 0e8f894..7dbd8e7 100644
--- a/src/usr/local/www/vpn_ipsec_keys.php
+++ b/src/usr/local/www/vpn_ipsec_keys.php
@@ -102,7 +102,7 @@ if ($_GET['act'] == "del") {
}
}
-$pgtitle = array(gettext("VPN"), gettext("IPsec"), gettext("Keys"));
+$pgtitle = array(gettext("VPN"), gettext("IPsec"), gettext("Pre-Shared Keys"));
$shortcut_section = "ipsec";
include("head.inc");
@@ -121,7 +121,7 @@ if (is_subsystem_dirty('ipsec'))
<?php
$tab_array = array();
$tab_array[0] = array(gettext("Tunnels"), false, "vpn_ipsec.php");
- $tab_array[1] = array(gettext("Mobile clients"), false, "vpn_ipsec_mobile.php");
+ $tab_array[1] = array(gettext("Mobile Clients"), false, "vpn_ipsec_mobile.php");
$tab_array[2] = array(gettext("Pre-Shared Keys"), true, "vpn_ipsec_keys.php");
$tab_array[3] = array(gettext("Advanced Settings"), false, "vpn_ipsec_settings.php");
display_top_tabs($tab_array);
diff --git a/src/usr/local/www/vpn_ipsec_keys_edit.php b/src/usr/local/www/vpn_ipsec_keys_edit.php
index a55a728..981e3a7 100644
--- a/src/usr/local/www/vpn_ipsec_keys_edit.php
+++ b/src/usr/local/www/vpn_ipsec_keys_edit.php
@@ -152,7 +152,7 @@ if ($_POST) {
}
}
-$pgtitle = gettext("VPN: IPsec: Edit Pre-Shared Key");
+$pgtitle = array(gettext("VPN"), gettext("IPsec"), gettext("Pre-Shared Key"), gettext("Edit"));
$shortcut_section = "ipsec";
include("head.inc");
diff --git a/src/usr/local/www/vpn_ipsec_mobile.php b/src/usr/local/www/vpn_ipsec_mobile.php
index 9d7f524..974e452 100644
--- a/src/usr/local/www/vpn_ipsec_mobile.php
+++ b/src/usr/local/www/vpn_ipsec_mobile.php
@@ -336,7 +336,7 @@ if ($_POST['save']) {
}
}
-$pgtitle = array(gettext("VPN"), gettext("IPsec"), gettext("Mobile"));
+$pgtitle = array(gettext("VPN"), gettext("IPsec"), gettext("Mobile Clients"));
$shortcut_section = "ipsec";
include("head.inc");
@@ -443,8 +443,8 @@ if ($input_errors)
$tab_array = array();
$tab_array[0] = array(gettext("Tunnels"), false, "vpn_ipsec.php");
-$tab_array[1] = array(gettext("Mobile clients"), true, "vpn_ipsec_mobile.php");
-$tab_array[2] = array(gettext("Pre-Shared Key"), false, "vpn_ipsec_keys.php");
+$tab_array[1] = array(gettext("Mobile Clients"), true, "vpn_ipsec_mobile.php");
+$tab_array[2] = array(gettext("Pre-Shared Keys"), false, "vpn_ipsec_keys.php");
$tab_array[3] = array(gettext("Advanced Settings"), false, "vpn_ipsec_settings.php");
display_top_tabs($tab_array);
diff --git a/src/usr/local/www/vpn_ipsec_phase1.php b/src/usr/local/www/vpn_ipsec_phase1.php
index 70bd951..703a993 100644
--- a/src/usr/local/www/vpn_ipsec_phase1.php
+++ b/src/usr/local/www/vpn_ipsec_phase1.php
@@ -626,9 +626,11 @@ function build_eal_list() {
}
if ($pconfig['mobile']) {
- $pgtitle = array(gettext("VPN"), gettext("IPsec"), gettext("Edit Phase 1"), gettext("Mobile Client"));
+ $pgtitle = array(gettext("VPN"), gettext("IPsec"), gettext("Mobile Client"), gettext("Edit Phase 1"));
+ $editing_mobile = true;
} else {
- $pgtitle = array(gettext("VPN"), gettext("IPsec"), gettext("Edit Phase 1"));
+ $pgtitle = array(gettext("VPN"), gettext("IPsec"), gettext("Tunnel"), gettext("Edit Phase 1"));
+ $editing_mobile = false;
}
$shortcut_section = "ipsec";
@@ -640,8 +642,8 @@ if ($input_errors) {
}
$tab_array = array();
-$tab_array[] = array(gettext("Tunnels"), true, "vpn_ipsec.php");
-$tab_array[] = array(gettext("Mobile clients"), false, "vpn_ipsec_mobile.php");
+$tab_array[] = array(gettext("Tunnels"), !$editing_mobile, "vpn_ipsec.php");
+$tab_array[] = array(gettext("Mobile Clients"), $editing_mobile, "vpn_ipsec_mobile.php");
$tab_array[] = array(gettext("Pre-Shared Keys"), false, "vpn_ipsec_keys.php");
$tab_array[] = array(gettext("Advanced Settings"), false, "vpn_ipsec_settings.php");
display_top_tabs($tab_array);
diff --git a/src/usr/local/www/vpn_ipsec_phase2.php b/src/usr/local/www/vpn_ipsec_phase2.php
index f402917..85d5f1c 100644
--- a/src/usr/local/www/vpn_ipsec_phase2.php
+++ b/src/usr/local/www/vpn_ipsec_phase2.php
@@ -436,9 +436,11 @@ if ($_POST) {
}
if ($pconfig['mobile']) {
- $pgtitle = array(gettext("VPN"), gettext("IPsec"), gettext("Edit Phase 2"), gettext("Mobile Client"));
+ $pgtitle = array(gettext("VPN"), gettext("IPsec"), gettext("Mobile Client"), gettext("Edit Phase 2"));
+ $editing_mobile = true;
} else {
- $pgtitle = array(gettext("VPN"), gettext("IPsec"), gettext("Edit Phase 2"));
+ $pgtitle = array(gettext("VPN"), gettext("IPsec"), gettext("Tunnel"), gettext("Edit Phase 2"));
+ $editing_mobile = false;
}
$shortcut_section = "ipsec";
@@ -515,8 +517,8 @@ if ($input_errors)
print_input_errors($input_errors);
$tab_array = array();
-$tab_array[0] = array(gettext("Tunnels"), true, "vpn_ipsec.php");
-$tab_array[1] = array(gettext("Mobile clients"), false, "vpn_ipsec_mobile.php");
+$tab_array[0] = array(gettext("Tunnels"), !$editing_mobile, "vpn_ipsec.php");
+$tab_array[1] = array(gettext("Mobile Clients"), $editing_mobile, "vpn_ipsec_mobile.php");
$tab_array[2] = array(gettext("Pre-Shared Keys"), false, "vpn_ipsec_keys.php");
$tab_array[3] = array(gettext("Advanced Settings"), false, "vpn_ipsec_settings.php");
display_top_tabs($tab_array);
diff --git a/src/usr/local/www/vpn_ipsec_settings.php b/src/usr/local/www/vpn_ipsec_settings.php
index 06677f2..62a6869 100644
--- a/src/usr/local/www/vpn_ipsec_settings.php
+++ b/src/usr/local/www/vpn_ipsec_settings.php
@@ -231,7 +231,7 @@ if ($_POST) {
}
}
-$pgtitle = array(gettext("VPN"), gettext("IPsec"), gettext("Settings"));
+$pgtitle = array(gettext("VPN"), gettext("IPsec"), gettext("Advanced Settings"));
$shortcut_section = "ipsec";
include("head.inc");
@@ -260,8 +260,8 @@ if ($input_errors)
$tab_array = array();
$tab_array[0] = array(gettext("Tunnels"), false, "vpn_ipsec.php");
-$tab_array[1] = array(gettext("Mobile clients"), false, "vpn_ipsec_mobile.php");
-$tab_array[2] = array(gettext("Pre-Shared Key"), false, "vpn_ipsec_keys.php");
+$tab_array[1] = array(gettext("Mobile Clients"), false, "vpn_ipsec_mobile.php");
+$tab_array[2] = array(gettext("Pre-Shared Keys"), false, "vpn_ipsec_keys.php");
$tab_array[3] = array(gettext("Advanced Settings"), true, "vpn_ipsec_settings.php");
display_top_tabs($tab_array);
diff --git a/src/usr/local/www/vpn_openvpn_client.php b/src/usr/local/www/vpn_openvpn_client.php
index 806eb9d..19a9609 100644
--- a/src/usr/local/www/vpn_openvpn_client.php
+++ b/src/usr/local/www/vpn_openvpn_client.php
@@ -65,7 +65,7 @@ require("guiconfig.inc");
require_once("openvpn.inc");
require_once("pkg-utils.inc");
-$pgtitle = array(gettext("OpenVPN"), gettext("Client"));
+$pgtitle = array(gettext("VPN"), gettext("OpenVPN"), gettext("Client"));
$shortcut_section = "openvpn";
if (!is_array($config['openvpn']['openvpn-client'])) {
@@ -616,11 +616,13 @@ if($act=="new" || $act=="edit") :
$pconfig['shared_key']
))->setHelp('Paste your shared key here');
+ $cl = openvpn_build_cert_list(true);
+
$section->addInput(new Form_Select(
'certref',
'Client Certificate',
$pconfig['certref'],
- openvpn_build_cert_list(true)
+ $cl['server']
));
$section->addInput(new Form_Select(
diff --git a/src/usr/local/www/vpn_openvpn_csc.php b/src/usr/local/www/vpn_openvpn_csc.php
index ddb67b5..94d9455 100644
--- a/src/usr/local/www/vpn_openvpn_csc.php
+++ b/src/usr/local/www/vpn_openvpn_csc.php
@@ -67,7 +67,7 @@ require_once("pkg-utils.inc");
global $openvpn_tls_server_modes;
-$pgtitle = array(gettext("OpenVPN"), gettext("Client Specific Override"));
+$pgtitle = array(gettext("VPN"), gettext("OpenVPN"), gettext("Client Specific Overrides"));
$shortcut_section = "openvpn";
if (!is_array($config['openvpn']['openvpn-csc'])) {
diff --git a/src/usr/local/www/vpn_openvpn_server.php b/src/usr/local/www/vpn_openvpn_server.php
index 7a94bec..4a475b4 100644
--- a/src/usr/local/www/vpn_openvpn_server.php
+++ b/src/usr/local/www/vpn_openvpn_server.php
@@ -419,6 +419,9 @@ if ($_POST) {
/* If we are not in shared key mode, then we need the CA/Cert. */
if ($pconfig['mode'] != "p2p_shared_key") {
+ if (empty(trim($pconfig['certref']))) {
+ $input_errors[] = gettext("The selected certificate is not valid");
+ }
$reqdfields = explode(" ", "caref certref");
$reqdfieldsn = array(gettext("Certificate Authority"), gettext("Certificate"));
} elseif (!$pconfig['autokey_enable']) {
@@ -586,7 +589,7 @@ if ($_POST) {
}
}
-$pgtitle = array(gettext("OpenVPN"), gettext("Server"));
+$pgtitle = array(gettext("VPN"), gettext("OpenVPN"), gettext("Server"));
$shortcut_section = "openvpn";
include("head.inc");
@@ -744,12 +747,30 @@ if($act=="new" || $act=="edit") :
));
}
+ $certhelp = '<span id="certtype"></span>';
+ if (count($a_cert)) {
+ if (!empty(trim($pconfig['certref']))) {
+ $thiscert = lookup_cert($pconfig['certref']);
+ $purpose = cert_get_purpose($thiscert['crt'], true);
+ if ($purpose['server'] != "Yes") {
+ $certhelp = '<span id="certtype" class="text-danger">' . gettext("Warning: The selected server certificate was not created as an SSL Server certificate and may not work as expected") . ' </span>';
+ }
+ }
+ } else {
+ $certhelp = sprintf('%s%s%s$s', '<span id="certtype">', gettext('No Certificates defined. You may create one here: '), '<a href="system_camanager.php">System &gt; Cert Manager</a>', '</span>');
+ }
+
+ $cl = openvpn_build_cert_list(false, true);
+
+ //Save the number of server certs for use at run-time
+ $servercerts = count($cl['server']);
+
$section->addInput(new Form_Select(
'certref',
'Server certificate',
$pconfig['certref'],
- openvpn_build_cert_list()
- ))->setHelp(count($a_cert) ? '':sprintf('No Certificates defined. You may create one here: %s', '<a href="system_camanager.php">System &gt; Cert Manager</a>'));
+ $cl['server'] + $cl['non-server']
+ ))->setHelp($certhelp);
$section->addInput(new Form_Select(
'dh_length',
@@ -1553,6 +1574,17 @@ events.push(function(){
tuntap_change();
});
+ // Certref
+ $('#certref').on('change', function() {
+ var errmsg = "";
+
+ if ($(this).find(":selected").index() >= "<?=$servercerts?>") {
+ var errmsg = '<span class="text-danger">' + "<?=gettext('Warning: The selected server certificate was not created as an SSL Server certificate and may not work as expected')?>" + '</span>';
+ }
+
+ $('#certtype').html(errmsg);
+ });
+
// ---------- Set initial page display state ----------------------------------------------------------------------
mode_change();
autokey_change();
diff --git a/src/usr/local/www/widgets/include/carp_status.inc b/src/usr/local/www/widgets/include/carp_status.inc
index 79d3c03..63a49fe 100644
--- a/src/usr/local/www/widgets/include/carp_status.inc
+++ b/src/usr/local/www/widgets/include/carp_status.inc
@@ -1,7 +1,7 @@
<?php
//set variable for custom title
-$carp_status_title = "Carp Status";
-$carp_status_title_link = "carp_status.php";
+$carp_status_title = "CARP Status";
+$carp_status_title_link = "status_carp.php";
?>
diff --git a/src/usr/local/www/widgets/include/dyn_dns_status.inc b/src/usr/local/www/widgets/include/dyn_dns_status.inc
index 8116fe7..b2588db 100644
--- a/src/usr/local/www/widgets/include/dyn_dns_status.inc
+++ b/src/usr/local/www/widgets/include/dyn_dns_status.inc
@@ -1,7 +1,7 @@
<?php
//set variable for custom title
-$dyn_dns_status_title = "Dyn DNS Status";
+$dyn_dns_status_title = "Dynamic DNS Status";
$dyn_dns_status_title_link = "services_dyndns.php";
?>
diff --git a/src/usr/local/www/widgets/include/ipsec.inc b/src/usr/local/www/widgets/include/ipsec.inc
index 6df0a7c..59fe454 100644
--- a/src/usr/local/www/widgets/include/ipsec.inc
+++ b/src/usr/local/www/widgets/include/ipsec.inc
@@ -1,4 +1,4 @@
<?php
$ipsec_title = "IPsec";
-$ipsec_title_link = "diag_ipsec.php";
+$ipsec_title_link = "status_ipsec.php";
?>
diff --git a/src/usr/local/www/widgets/include/log.inc b/src/usr/local/www/widgets/include/log.inc
index 7ad453a..d2bafb0 100644
--- a/src/usr/local/www/widgets/include/log.inc
+++ b/src/usr/local/www/widgets/include/log.inc
@@ -1,6 +1,6 @@
<?php
//set variable for custom title
$log_title = "Firewall Logs";
-$log_title_link = "diag_logs_filter.php";
+$log_title_link = "status_logs_filter.php";
?> \ No newline at end of file
diff --git a/src/usr/local/www/widgets/widgets/carp_status.widget.php b/src/usr/local/www/widgets/widgets/carp_status.widget.php
index 642b0f4..8884e2b 100644
--- a/src/usr/local/www/widgets/widgets/carp_status.widget.php
+++ b/src/usr/local/www/widgets/widgets/carp_status.widget.php
@@ -93,20 +93,30 @@ $carp_enabled = get_carp_status();
$status = "DISABLED";
echo '<i class="fa fa-ban"></i>';
} else {
- if($status == "MASTER") {
+ if ($status == "MASTER") {
echo '<i class="fa fa-arrow-right"></i>';
- } else if($status == "BACKUP") {
+ } else if ($status == "BACKUP") {
echo '<i class="fa fa-arrow-right"></i>';
- } else if($status == "INIT") {
+ } else if ($status == "INIT") {
echo '<i class="fa fa-list-alt"></i>';
}
}
- if ($ipaddress){ ?> &nbsp;
+ if ($ipaddress) {
+?>
+ &nbsp;
<?=htmlspecialchars($status);?> &nbsp;
- <?=htmlspecialchars($ipaddress);}?>
-</td></tr><?php }
- } else { ?>
- <tr><td>No CARP Interfaces Defined. Click <a href="carp_status.php">here</a> to configure CARP.</td></tr>
-<?php } ?>
+ <?=htmlspecialchars($ipaddress);?>
+<?php
+ }
+?>
+</td></tr>
+<?php
+ }
+ } else {
+?>
+ <tr><td>No CARP Interfaces Defined. Click <a href="status_carp.php">here</a> to configure CARP.</td></tr>
+<?php
+ }
+?>
</table>
</div>
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 cb4612e..24b8c0e 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
@@ -1,6 +1,6 @@
<?php
/*
- Original status page code from: services_dyndns.php
+ dyn_dns_status.widget.php
*/
/* ====================================================================
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
@@ -71,7 +71,7 @@ if (!is_array($config['dyndnses']['dyndns'])) {
$a_dyndns = &$config['dyndnses']['dyndns'];
-if($_REQUEST['getdyndnsstatus']) {
+if ($_REQUEST['getdyndnsstatus']) {
$first_entry = true;
foreach ($a_dyndns as $dyndns) {
if ($first_entry) {
diff --git a/src/usr/local/www/widgets/widgets/gateways.widget.php b/src/usr/local/www/widgets/widgets/gateways.widget.php
index 59fa21d..cd86719 100644
--- a/src/usr/local/www/widgets/widgets/gateways.widget.php
+++ b/src/usr/local/www/widgets/widgets/gateways.widget.php
@@ -75,7 +75,7 @@ if (isset($config["widgets"]["gateways_widget"]["display_type"])) {
}
// Compose the table contents and pass it back to the ajax caller
-if($_REQUEST && $_REQUEST['ajax']) {
+if ($_REQUEST && $_REQUEST['ajax']) {
global $a_gateways, $gateways_status;
print("<thead>\n");
@@ -167,7 +167,7 @@ if($_REQUEST && $_REQUEST['ajax']) {
print( "<td>" . ($gateways_status[$gname] ? htmlspecialchars($gateways_status[$gname]['loss']) : gettext("Pending")) . "</td>\n");
print('<td class="bg-' . $bgcolor . '">' . $online . "</td>\n");
print("</tr>\n");
- }
+ }
print("</tbody>\n");
@@ -188,7 +188,7 @@ if ($_POST) {
?>
<table id="gwtbl" class="table table-striped table-hover">
- <tr><td><?=gettext("Retrieving gateway data")?></td></tr>
+ <tr><td><?=gettext("Retrieving gateways data")?>&nbsp;<i class="fa fa-cog fa-spin"></i></td></tr>
</table>
<!-- close the body we're wrapped in and add a configuration-panel -->
@@ -227,23 +227,23 @@ if ($_POST) {
<form action="/widgets/widgets/gateways.widget.php" method="post" name="gateways_widget_iform" id="gateways_widget_iform">
Display:
<?php
- $display_type_gw_ip="checked";
- $display_type_monitor_ip="";
- $display_type_both_ip="";
+ $display_type_gw_ip = "checked";
+ $display_type_monitor_ip = "";
+ $display_type_both_ip = "";
if (isset($config["widgets"]["gateways_widget"]["display_type"])) {
$selected_radio = $config["widgets"]["gateways_widget"]["display_type"];
if ($selected_radio == "gw_ip") {
$display_type_gw_ip = "checked";
- $display_type_monitor_ip="";
- $display_type_both_ip="";
+ $display_type_monitor_ip = "";
+ $display_type_both_ip = "";
} else if ($selected_radio == "monitor_ip") {
$display_type_gw_ip = "";
- $display_type_monitor_ip="checked";
- $display_type_both_ip="";
+ $display_type_monitor_ip = "checked";
+ $display_type_both_ip = "";
} else if ($selected_radio == "both_ip") {
$display_type_gw_ip = "";
- $display_type_monitor_ip="";
- $display_type_both_ip="checked";
+ $display_type_monitor_ip = "";
+ $display_type_both_ip = "checked";
}
}
?>
diff --git a/src/usr/local/www/widgets/widgets/installed_packages.widget.php b/src/usr/local/www/widgets/widgets/installed_packages.widget.php
index 5b85b6b..255212a 100644
--- a/src/usr/local/www/widgets/widgets/installed_packages.widget.php
+++ b/src/usr/local/www/widgets/widgets/installed_packages.widget.php
@@ -66,7 +66,7 @@ require_once("functions.inc");
require_once("/usr/local/www/widgets/include/installed_packages.inc");
require_once("pkg-utils.inc");
-if($_REQUEST && $_REQUEST['ajax']) {
+if ($_REQUEST && $_REQUEST['ajax']) {
$package_list = get_pkg_info();
$installed_packages = array_filter($package_list, function($v) {
return (isset($v['installed']) || isset($v['broken']));
@@ -153,13 +153,13 @@ if($_REQUEST && $_REQUEST['ajax']) {
print( "<td>\n");
print( '<a title="' . gettext("Remove") . '" href="pkg_mgr_install.php?mode=delete&amp;pkg=' . $pkg['name'] . '"><i class="fa fa-trash"></i></a>'."\n");
- if($upgradeavail) {
+ if ($upgradeavail) {
print( '<a title="' . gettext("Update") . '" href="pkg_mgr_install.php?mode=reinstallpkg&amp;pkg=' . $pkg['name'] . $vergetstr . '"><i class="fa fa-refresh"></i></a>'."\n");
} else {
print( '<a title="' . gettext("Reinstall") . '" href="pkg_mgr_install.php?mode=reinstallpkg&amp;pkg=' . $pkg['name'] . '"><i class="fa fa-retweet"></i></a>'."\n");
}
- if(!isset($g['disablepackageinfo']) && $pkg['www'] != 'UNKNOWN') {
+ if (!isset($g['disablepackageinfo']) && $pkg['www'] != 'UNKNOWN') {
print( '<a target="_blank" title="' . gettext("View more information") . '" href="' . htmlspecialchars($pkg['www']) . '"><i class="fa fa-info"></i></a>'."\n");
}
diff --git a/src/usr/local/www/widgets/widgets/interface_statistics.widget.php b/src/usr/local/www/widgets/widgets/interface_statistics.widget.php
index 339e3fe..5b0fe02 100644
--- a/src/usr/local/www/widgets/widgets/interface_statistics.widget.php
+++ b/src/usr/local/www/widgets/widgets/interface_statistics.widget.php
@@ -95,7 +95,7 @@ if ($_REQUEST && $_REQUEST['ajax']) {
foreach ($rows as $key => $name) {
print("<tr>");
- print( "<th>" . $name . "</th>");
+ print( "<td><b>" . $name . "</b></td>");
foreach ($ifdescrs as $ifdescr => $ifname) {
$ifinfo = get_interface_info($ifdescr);
diff --git a/src/usr/local/www/widgets/widgets/ipsec.widget.php b/src/usr/local/www/widgets/widgets/ipsec.widget.php
index bffa87f..5011e3a 100644
--- a/src/usr/local/www/widgets/widgets/ipsec.widget.php
+++ b/src/usr/local/www/widgets/widgets/ipsec.widget.php
@@ -182,8 +182,9 @@ if ($_REQUEST && $_REQUEST['ajax']) {
case "mobile" :
foreach ($mobile['pool'] as $pool) {
- if (!is_array($pool['lease']))
+ if (!is_array($pool['lease'])) {
continue;
+ }
foreach ($pool['lease'] as $muser) {
print(" <tr>\n");
@@ -259,7 +260,7 @@ if (isset($config['ipsec']['phase2'])): ?>
<?php endif;
// This function was in index.php It seems that the ipsec widget is the only place it is used
-// so now it lives here. It wouldn't hurt to update this functions and the tab display, but it
+// so now it lives here. It wouldn't hurt to update this function and the tab display, but it
// looks OK for now. The display_widget_tabs() function in guiconfig.inc would need to be updated to match
?>
<script type="text/javascript">
@@ -316,7 +317,7 @@ function get_ipsec_stats() {
ajaxRequest = $.ajax({
url: "/widgets/widgets/ipsec.widget.php",
type: "post",
- data: {
+ data: {
ajax: "ajax",
tab: curtab
}
diff --git a/src/usr/local/www/widgets/widgets/log.widget.php b/src/usr/local/www/widgets/widgets/log.widget.php
index a9d9a27..1d5874f 100644
--- a/src/usr/local/www/widgets/widgets/log.widget.php
+++ b/src/usr/local/www/widgets/widgets/log.widget.php
@@ -150,13 +150,13 @@ if (isset($_POST['lastsawtime'])) {
}
if ($filterent['act'] == "block") {
- $iconfn = "times icon-danger";
+ $iconfn = "times text-danger";
} else if ($filterent['act'] == "reject") {
- $iconfn = "hand-stop-o icon-warning";
+ $iconfn = "hand-stop-o text-warning";
} else if ($filterent['act'] == "match") {
$iconfn = "filter";
} else {
- $iconfn = "check icon-success";
+ $iconfn = "check text-success";
}
$rule = find_rule_by_number($filterent['rulenum'], $filterent['tracker'], $filterent['act']);
@@ -166,7 +166,7 @@ if (isset($_POST['lastsawtime'])) {
$dstIP = str_replace(':', ':<wbr>', $dstIP);
?>
<tr>
- <td><a href="#" onclick="javascript:getURL('diag_logs_filter.php?getrulenum=<?php echo "{$filterent['rulenum']},{$filterent['tracker']},{$filterent['act']}"; ?>', outputrule);"
+ <td><a href="#" onclick="javascript:getURL('status_logs_filter.php?getrulenum=<?php echo "{$filterent['rulenum']},{$filterent['tracker']},{$filterent['act']}"; ?>', outputrule);"
role="button" data-toggle="popover" data-trigger="hover"
data-title="Rule that triggered this action"
data-content="<?=htmlspecialchars($rule)?>"> <i
diff --git a/src/usr/local/www/widgets/widgets/ntp_status.widget.php b/src/usr/local/www/widgets/widgets/ntp_status.widget.php
index 037db1a..536e40e 100644
--- a/src/usr/local/www/widgets/widgets/ntp_status.widget.php
+++ b/src/usr/local/www/widgets/widgets/ntp_status.widget.php
@@ -65,8 +65,8 @@ function getServerDateItems($inDate) {
return date('Y,n,j,G,',$inDate).intval(date('i',$inDate)).','.intval(date('s',$inDate));
// year (4-digit),month,day,hours (0-23),minutes,seconds
// use intval to strip leading zero from minutes and seconds
- // so JavaScript won't try to interpret them in octal
- // (use intval instead of ltrim, which translates '00' to '')
+ // so JavaScript won't try to interpret them in octal
+ // (use intval instead of ltrim, which translates '00' to '')
}
function clockTimeString($inDate, $showSeconds) {
@@ -110,7 +110,7 @@ if ($_REQUEST['updateme']) {
$tmp = $tmp[1];
if (substr($tmp, 0, 6) == '$GPRMC') {
$gps_vars = explode(",", $tmp);
- $gps_ok = ($gps_vars[2] == "A");
+ $gps_ok = ($gps_vars[2] == "A");
$gps_lat_deg = substr($gps_vars[3], 0, 2);
$gps_lat_min = substr($gps_vars[3], 2) / 60.0;
$gps_lon_deg = substr($gps_vars[5], 0, 3);
@@ -123,7 +123,7 @@ if ($_REQUEST['updateme']) {
$gps_lo = $gps_vars[6];
} elseif (substr($tmp, 0, 6) == '$GPGGA') {
$gps_vars = explode(",", $tmp);
- $gps_ok = $gps_vars[6];
+ $gps_ok = $gps_vars[6];
$gps_lat_deg = substr($gps_vars[2], 0, 2);
$gps_lat_min = substr($gps_vars[2], 2) / 60.0;
$gps_lon_deg = substr($gps_vars[4], 0, 3);
@@ -139,7 +139,7 @@ if ($_REQUEST['updateme']) {
$gps_lo = $gps_vars[5];
} elseif (substr($tmp, 0, 6) == '$GPGLL') {
$gps_vars = explode(",", $tmp);
- $gps_ok = ($gps_vars[6] == "A");
+ $gps_ok = ($gps_vars[6] == "A");
$gps_lat_deg = substr($gps_vars[1], 0, 2);
$gps_lat_min = substr($gps_vars[1], 2) / 60.0;
$gps_lon_deg = substr($gps_vars[3], 0, 3);
diff --git a/src/usr/local/www/widgets/widgets/openvpn.widget.php b/src/usr/local/www/widgets/widgets/openvpn.widget.php
index 064f207..8a02f3d 100644
--- a/src/usr/local/www/widgets/widgets/openvpn.widget.php
+++ b/src/usr/local/www/widgets/widgets/openvpn.widget.php
@@ -197,7 +197,7 @@ $clients = openvpn_get_active_clients();
<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
<thead>
<tr>
- <th>Remote/Virtual IP</th>
+ <th>Name/Time</th>
<th>Remote/Virtual IP</th>
<th></th>
</tr>
diff --git a/src/usr/local/www/widgets/widgets/services_status.widget.php b/src/usr/local/www/widgets/widgets/services_status.widget.php
index e6bb352..170ea24 100644
--- a/src/usr/local/www/widgets/widgets/services_status.widget.php
+++ b/src/usr/local/www/widgets/widgets/services_status.widget.php
@@ -65,7 +65,7 @@ require_once("/usr/local/www/widgets/include/services_status.inc");
$services = get_services();
-if($_POST) {
+if ($_POST) {
$validNames = array();
foreach ($services as $service) {
@@ -108,7 +108,7 @@ if (count($services) > 0) {
$service_desc = explode(".",$service['description']);
?>
<tr>
- <td><i class="fa fa-<?=get_service_status($service)? 'check' : 'times'?>-circle"></i></td>
+ <td><i class="fa fa-<?=get_service_status($service) ? 'check-circle text-success' : 'times-circle text-warning'?>"></i></td>
<td><?=$service['name']?></td>
<td><?=$service_desc[0]?></td>
<td><?=get_service_control_GET_links($service)?></td>
@@ -164,4 +164,4 @@ events.push(function(){
});
});
//]]>
-</script> \ No newline at end of file
+</script>
diff --git a/src/usr/local/www/widgets/widgets/system_information.widget.php b/src/usr/local/www/widgets/widgets/system_information.widget.php
index e89e8e1..03c439b 100644
--- a/src/usr/local/www/widgets/widgets/system_information.widget.php
+++ b/src/usr/local/www/widgets/widgets/system_information.widget.php
@@ -120,12 +120,12 @@ $filesystems = get_mounted_filesystems();
(<?php echo php_uname("m"); ?>)
<br />
built on <?php readfile("/etc/version.buildtime"); ?>
- <?php if(!$g['hideuname']): ?>
+ <?php if (!$g['hideuname']): ?>
<br />
<span title="<?php echo php_uname("a"); ?>"><?php echo php_uname("s") . " " . php_uname("r"); ?></span>
<?php endif; ?>
<br/><br/>
- <?php if(!isset($config['system']['firmware']['disablecheck'])): ?>
+ <?php if (!isset($config['system']['firmware']['disablecheck'])): ?>
<div id='updatestatus'><?php echo gettext("Obtaining update status "); ?><i class="fa fa-cog fa-spin"></i></div>
<?php endif; ?>
</td>
@@ -163,12 +163,13 @@ $filesystems = get_mounted_filesystems();
<tr>
<th><?=gettext("CPU Type");?></th>
<td><?=htmlspecialchars(get_single_sysctl("hw.model"))?>
- <div id="cpufreq"><?= get_cpufreq(); ?></div>
+ <div id="cpufreq"><?= get_cpufreq(); ?></div>
<?php
$cpucount = get_cpu_count();
if ($cpucount > 1): ?>
- <div id="cpucount">
- <?= htmlspecialchars($cpucount) ?> CPUs: <?= htmlspecialchars(get_cpu_count(true)); ?></div>
+ <div id="cpucount">
+ <?= htmlspecialchars($cpucount) ?> CPUs: <?= htmlspecialchars(get_cpu_count(true)); ?>
+ </div>
<?php endif; ?>
</td>
</tr>
@@ -208,7 +209,8 @@ $filesystems = get_mounted_filesystems();
<tr>
<th><?=gettext("State table size");?></th>
<td>
- <?php $pfstatetext = get_pfstate();
+ <?php
+ $pfstatetext = get_pfstate();
$pfstateusage = get_pfstate(true);
?>
<div class="progress">
@@ -245,7 +247,7 @@ $filesystems = get_mounted_filesystems();
<tr>
<th><?=gettext("Load average");?></th>
<td>
- <div id="load_average" title="Last 1, 5 and 15 minutes"><?= get_load_average(); ?></div>
+ <div id="load_average" title="Last 1, 5 and 15 minutes"><?= get_load_average(); ?></div>
</td>
</tr>
<tr>
@@ -263,11 +265,11 @@ $filesystems = get_mounted_filesystems();
<td>
<?php $memUsage = mem_usage(); ?>
- <div class="progress" >
- <div id="memUsagePB" class="progress-bar progress-bar-striped" role="progressbar" aria-valuenow="<?=$memUsage?>" aria-valuemin="0" aria-valuemax="100" style="width: <?=$memUsage?>%">
- </div>
+ <div class="progress" >
+ <div id="memUsagePB" class="progress-bar progress-bar-striped" role="progressbar" aria-valuenow="<?=$memUsage?>" aria-valuemin="0" aria-valuemax="100" style="width: <?=$memUsage?>%">
</div>
- <span id="memusagemeter"><?=$memUsage?></span><span>% of <?= sprintf("%.0f", get_single_sysctl('hw.physmem') / (1024*1024)) ?> MB</span>
+ </div>
+ <span id="memusagemeter"><?=$memUsage?></span><span>% of <?= sprintf("%.0f", get_single_sysctl('hw.physmem') / (1024*1024)) ?> MB</span>
</td>
</tr>
<?php if ($showswap == true): ?>
@@ -279,7 +281,7 @@ $filesystems = get_mounted_filesystems();
<div class="progress-bar progress-bar-striped" role="progressbar" aria-valuenow="<?=$swapusage?>" aria-valuemin="0" aria-valuemax="100" style="width: <?=$swapusage?>%">
</div>
</div>
- <span><?=$swapusage?>% of <?= sprintf("%.0f", `/usr/sbin/swapinfo -m | /usr/bin/grep -v Device | /usr/bin/awk '{ print $2;}'`) ?> MB</span>
+ <span><?=$swapusage?>% of <?= sprintf("%.0f", `/usr/sbin/swapinfo -m | /usr/bin/grep -v Device | /usr/bin/awk '{ print $2;}'`) ?> MB</span>
</td>
</tr>
<?php endif; ?>
@@ -287,16 +289,16 @@ $filesystems = get_mounted_filesystems();
<th><?=gettext("Disk usage");?></th>
<td>
<table class="table">
-<?PHP foreach ($filesystems as $fs): ?>
- <tr>
- <th><?=$fs['mountpoint']?></th>
- <td><?=$fs['type'] . ("md" == substr(basename($fs['device']), 0, 2) ? " in RAM" : "")?></td>
- <td><?=$fs['total_size']?></td>
- <td>
- <span><?=$fs['percent_used']?>%</span>
- </td>
- </tr>
-<?PHP endforeach; ?>
+<?php foreach ($filesystems as $fs): ?>
+ <tr>
+ <th><?=$fs['mountpoint']?></th>
+ <td><?=$fs['type'] . ("md" == substr(basename($fs['device']), 0, 2) ? " in RAM" : "")?></td>
+ <td><?=$fs['total_size']?></td>
+ <td>
+ <span><?=$fs['percent_used']?>%</span>
+ </td>
+ </tr>
+<?php endforeach; ?>
</table>
</td>
</tr>
@@ -383,75 +385,88 @@ function stats(x) {
}
function updateMemory(x) {
- if(jQuery('#memusagemeter'))
+ if (jQuery('#memusagemeter')) {
jQuery("#memusagemeter").html(x);
- if(jQuery('#memUsagePB')) {
+ }
+ if (jQuery('#memUsagePB')) {
setProgress('memUsagePB', parseInt(x));
}
}
function updateMbuf(x) {
- if(jQuery('#mbuf'))
+ if (jQuery('#mbuf')) {
jQuery("#mbuf").html(x);
+ }
}
function updateMbufMeter(x) {
- if(jQuery('#mbufusagemeter'))
+ if (jQuery('#mbufusagemeter')) {
jQuery("#mbufusagemeter").html(x + '%');
- if(jQuery('#mbufPB'))
+ }
+ if (jQuery('#mbufPB')) {
setProgress('mbufPB', parseInt(x));
+ }
}
function updateCPU(x) {
- if(jQuery('#cpumeter'))
+ if (jQuery('#cpumeter')) {
jQuery("#cpumeter").html(x + '%');
- if(jQuery('#cpuPB'))
+ }
+ if (jQuery('#cpuPB')) {
setProgress('cpuPB', parseInt(x));
+ }
/* Load CPU Graph widget if enabled */
- if(widgetActive('cpu_graphs')) {
+ if (widgetActive('cpu_graphs')) {
GraphValue(graph[0], x);
}
}
function updateTemp(x) {
- if(jQuery("#tempmeter"))
+ if (jQuery("#tempmeter")) {
jQuery("#tempmeter").html(x + '\u00B0' + 'C');
- if(jQuery('#tempPB'))
+ }
+ if (jQuery('#tempPB')) {
jQuery("#tempPB").progressbar( { value: parseInt(x) } );
+ }
}
function updateDateTime(x) {
- if(jQuery('#datetime'))
+ if (jQuery('#datetime')) {
jQuery("#datetime").html(x);
+ }
}
function updateUptime(x) {
- if(jQuery('#uptime'))
+ if (jQuery('#uptime')) {
jQuery("#uptime").html(x);
+ }
}
function updateState(x) {
- if(jQuery('#pfstate'))
+ if (jQuery('#pfstate')) {
jQuery("#pfstate").html('(' + x + ')');
+ }
}
function updateStateMeter(x) {
- if(jQuery('#pfstateusagemeter'))
+ if (jQuery('#pfstateusagemeter')) {
jQuery("#pfstateusagemeter").html(x + '%');
- if(jQuery('#statePB'))
+ }
+ if (jQuery('#statePB')) {
setProgress('statePB', parseInt(x));
+ }
}
-function updateGatewayStats(x){
- if (widgetActive("gateways")){
+function updateGatewayStats(x) {
+ if (widgetActive("gateways")) {
gateways_split = x.split(",");
- for (var y=0; y<gateways_split.length; y++){
+ for (var y=0; y<gateways_split.length; y++) {
gateways_field_split = gateways_split[y].split("^");
- if(jQuery('#gateway' + (y + 1))) {
+ if (jQuery('#gateway' + (y + 1))) {
jQuery('#gateway' + (y + 1)).html(gateways_field_split[0]);
- if(gateways_field_split[1]) {
+ if (gateways_field_split[1]) {
jQuery('#gateway' + (y + 1)).css('background-color',gateways_field_split[1]);
}
}
@@ -460,21 +475,23 @@ function updateGatewayStats(x){
}
function updateCpuFreq(x) {
- if(jQuery('#cpufreq'))
+ if (jQuery('#cpufreq')) {
jQuery("#cpufreq").html(x);
+ }
}
function updateLoadAverage(x) {
- if(jQuery('#load_average'))
+ if (jQuery('#load_average')) {
jQuery("#load_average").html(x);
+ }
}
-function updateInterfaceStats(x){
- if (widgetActive("interface_statistics")){
+function updateInterfaceStats(x) {
+ if (widgetActive("interface_statistics")) {
statistics_split = x.split(",");
var counter = 1;
- for (var y=0; y<statistics_split.length-1; y++){
- if(jQuery('#stat' + counter)) {
+ for (var y=0; y<statistics_split.length-1; y++) {
+ if (jQuery('#stat' + counter)) {
jQuery('#stat' + counter).html(statistics_split[y]);
counter++;
}
@@ -482,15 +499,16 @@ function updateInterfaceStats(x){
}
}
-function updateInterfaces(x){
- if (widgetActive("interfaces")){
+function updateInterfaces(x) {
+ if (widgetActive("interfaces")) {
interfaces_split = x.split("~");
interfaces_split.each(function(iface){
details = iface.split("^");
- if (details[2] == '')
+ if (details[2] == '') {
ipv4_details = '';
- else
+ } else {
ipv4_details = details[2] + '<br />';
+ }
switch(details[1]) {
case "up":
jQuery('#' + details[0] + '-up').css("display","inline");
@@ -520,10 +538,11 @@ function updateInterfaces(x){
function widgetActive(x) {
var widget = jQuery('#' + x + '-container');
- if ((widget != null) && (widget.css('display') != null) && (widget.css('display') != "none"))
+ if ((widget != null) && (widget.css('display') != null) && (widget.css('display') != "none")) {
return true;
- else
+ } else {
return false;
+ }
}
/* start updater */
diff --git a/src/usr/local/www/widgets/widgets/traffic_graphs.widget.php b/src/usr/local/www/widgets/widgets/traffic_graphs.widget.php
index b1131f8..11835c4 100644
--- a/src/usr/local/www/widgets/widgets/traffic_graphs.widget.php
+++ b/src/usr/local/www/widgets/widgets/traffic_graphs.widget.php
@@ -81,8 +81,9 @@ if (!is_array($a_config["shown"]["item"])) {
}
$ifdescrs = get_configured_interface_with_descr();
-if (ipsec_enabled())
+if (ipsec_enabled()) {
$ifdescrs['enc0'] = "IPsec";
+}
if ($_POST) {
if (isset($_POST["refreshinterval"]) && is_numeric($_POST["refreshinterval"])) {
diff --git a/src/usr/local/www/widgets/widgets/wake_on_lan.widget.php b/src/usr/local/www/widgets/widgets/wake_on_lan.widget.php
index 27f983d..df12e43 100644
--- a/src/usr/local/www/widgets/widgets/wake_on_lan.widget.php
+++ b/src/usr/local/www/widgets/widgets/wake_on_lan.widget.php
@@ -79,7 +79,7 @@ if (is_array($config['wol']['wolentry'])) {
<tbody>
<?php
if (count($wolcomputers) > 0) {
- foreach($wolcomputers as $wolent) {
+ foreach ($wolcomputers as $wolent) {
echo '<tr><td>' . $wolent['descr'] . '<br />' . $wolent['mac'] . '</td>' . "\n";
echo '<td>' . convert_friendly_interface_to_friendly_descr($wolent['interface']) . '</td>' . "\n";
@@ -106,7 +106,7 @@ if (count($wolcomputers) > 0) {
echo "<tr><td colspan=\"4\" align=\"center\">" . gettext("No saved WoL addresses") . ".</td></tr>\n";
}
?>
-</tbody>
+ </tbody>
</table>
<center><a href="status_dhcp_leases.php" class="navlink">DHCP Leases Status</a></center>
</div>
OpenPOWER on IntegriCloud