summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--PROGRESS.md171
-rw-r--r--etc/inc/authgui.inc36
-rw-r--r--usr/local/www/bootstrap/css/pfSense.css1
-rw-r--r--usr/local/www/carp_status.php2
-rw-r--r--usr/local/www/classes/Form.class.php7
-rw-r--r--usr/local/www/diag_authentication.php100
-rw-r--r--usr/local/www/diag_limiter_info.php123
-rw-r--r--usr/local/www/diag_ndp.php122
-rw-r--r--usr/local/www/diag_pf_info.php153
-rw-r--r--usr/local/www/diag_ping.php224
-rw-r--r--usr/local/www/diag_routes.php273
-rw-r--r--usr/local/www/diag_states_summary.php97
-rw-r--r--usr/local/www/diag_system_activity.php142
-rw-r--r--usr/local/www/diag_system_pftop.php250
-rw-r--r--usr/local/www/edit.php183
-rw-r--r--usr/local/www/exec.php399
-rw-r--r--usr/local/www/firewall_rules.php4
-rwxr-xr-xusr/local/www/halt.php26
-rw-r--r--usr/local/www/interfaces_assign.php2
-rw-r--r--usr/local/www/interfaces_groups.php2
-rw-r--r--usr/local/www/interfaces_vlan.php2
-rw-r--r--usr/local/www/jquery/pfSense.js11
-rw-r--r--usr/local/www/system_advanced_sysctl.php2
-rw-r--r--usr/local/www/system_authservers.php2
-rw-r--r--usr/local/www/system_gateways.php2
-rw-r--r--usr/local/www/vpn_ipsec.php6
-rw-r--r--usr/local/www/vpn_ipsec_keys.php2
-rw-r--r--usr/local/www/vpn_l2tp_users.php2
-rw-r--r--usr/local/www/widgets/widgets/captive_portal_status.widget.php4
30 files changed, 1061 insertions, 1292 deletions
diff --git a/.gitignore b/.gitignore
index c6e1931..7bdd0ef 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,4 +8,5 @@ upload.sh
.project
.settings/
# PhpStorm
-.idea \ No newline at end of file
+.idea
+*.php-e
diff --git a/PROGRESS.md b/PROGRESS.md
index 198f12b..3c2b685 100644
--- a/PROGRESS.md
+++ b/PROGRESS.md
@@ -8,7 +8,6 @@ Use the ✅ emoji (`✅`) to show that the bootstrap conversion is com
Use the 🔄 emoji (`🔄`) to show that the bootstrap conversion is in progress
### PHP file status
-
|Page/file |Status |User |Comments |
|---------------------------------------------|:-------------------------:|------------------------|------------------------------------------------------------|
|bandwidth_by_ip.php | | | |
@@ -19,26 +18,26 @@ Use the 🔄 emoji (`🔄`) to show that the bootstrap conversion is i
|diag_backup.php | ✅ | | |
|diag_confbak.php | ✅ | | |
|diag_defaults.php | ✅ | | |
-|diag_dns.php | 🔄 | sbeaver | |
+|diag_dns.php | ✅ | | |
|diag_dump_states.php | | | |
|diag_dump_states_sources.php | | | |
|diag_gmirror.php | | | |
-|diag_ipsec.php | | | |
|diag_ipsec_leases.php | | | |
+|diag_ipsec.php | | | |
|diag_ipsec_sad.php | | | |
|diag_ipsec_spd.php | | | |
|diag_ipsec_xml.php | | | |
-|diag_limiter_info.php | | | |
-|diag_logs.php | | | |
+|diag_limiter_info.php | ✅ | | |
|diag_logs_auth.php | | | |
|diag_logs_dhcp.php | | | |
-|diag_logs_filter.php | | | |
|diag_logs_filter_dynamic.php | | | |
+|diag_logs_filter.php | | | |
|diag_logs_filter_summary.php | | | |
|diag_logs_gateways.php | | | |
|diag_logs_ipsec.php | | | |
|diag_logs_ntpd.php | | | |
|diag_logs_openvpn.php | | | |
+|diag_logs.php | | | |
|diag_logs_ppp.php | | | |
|diag_logs_relayd.php | | | |
|diag_logs_resolver.php | | | |
@@ -47,210 +46,210 @@ Use the 🔄 emoji (`🔄`) to show that the bootstrap conversion is i
|diag_logs_vpn.php | | | |
|diag_logs_wireless.php | | | |
|diag_nanobsd.php | | | |
-|diag_ndp.php | | | |
+|diag_ndp.php | ✅ | | |
|diag_packet_capture.php | | | |
|diag_patterns.php | | | |
-|diag_pf_info.php | | | |
-|diag_ping.php | | | |
+|diag_pf_info.php | ✅ | | |
+|diag_ping.php | ✅ | | |
|diag_pkglogs.php | | | |
|diag_resetstate.php | | | |
-|diag_routes.php | | | |
+|diag_routes.php | ✅ | | |
|diag_smart.php | | | |
|diag_sockets.php | | | |
-|diag_states_summary.php | | | |
-|diag_system_activity.php | | | |
-|diag_system_pftop.php | | | |
+|diag_states_summary.php | ✅ | | |
+|diag_system_activity.php | ✅ | | |
+|diag_system_pftop.php | ✅ | | |
|diag_tables.php | | | |
|diag_testport.php | | | |
|diag_traceroute.php | | | |
|easyrule.php | | | |
-|edit.php | | | |
-|exec.php | | | |
-|firewall_aliases.php | ✅ | | |
+|edit.php | ✅ | | |
+|exec.php | ✅ | | |
|firewall_aliases_edit.php | ✅ | | |
|firewall_aliases_import.php | ✅ | | |
-|firewall_nat.php | | | |
-|firewall_nat_1to1.php | | | |
+|firewall_aliases.php | ✅ | | |
|firewall_nat_1to1_edit.php | | | |
+|firewall_nat_1to1.php | | | |
|firewall_nat_edit.php | | | |
-|firewall_nat_npt.php | | | |
|firewall_nat_npt_edit.php | | | |
-|firewall_nat_out.php | | | |
+|firewall_nat_npt.php | | | |
|firewall_nat_out_edit.php | | | |
-|firewall_rules.php | ✅ | | |
+|firewall_nat_out.php | | | |
+|firewall_nat.php | | | |
|firewall_rules_edit.php | ✅ | | |
-|firewall_schedule.php | | | |
+|firewall_rules.php | ✅ | | |
|firewall_schedule_edit.php | | | |
-|firewall_shaper.php | | | |
+|firewall_schedule.php | | | |
|firewall_shaper_layer7.php | | | |
+|firewall_shaper.php | | | |
|firewall_shaper_queues.php | | | |
|firewall_shaper_vinterface.php | | | |
|firewall_shaper_wizards.php | | | |
-|firewall_virtual_ip.php | | | |
|firewall_virtual_ip_edit.php | | | |
+|firewall_virtual_ip.php | | | |
|getserviceproviders.php | | | |
|getstats.php | | | |
-|graph.php | | | |
|graph_cpu.php | | | |
-|halt.php | | | |
+|graph.php | | | |
+|halt.php | ✅ | | |
|help.php | | | |
|ifstats.php | | | |
|index.php | ✅ | | |
-|interfaces.php | 🔄 | psophis | |
|interfaces_assign.php | ✅ | | |
-|interfaces_bridge.php | | | |
|interfaces_bridge_edit.php | | | |
-|interfaces_gif.php | | | |
+|interfaces_bridge.php | | | |
|interfaces_gif_edit.php | | | |
-|interfaces_gre.php | | | |
+|interfaces_gif.php | | | |
|interfaces_gre_edit.php | | | |
-|interfaces_groups.php | ✅ | psophis | |
-|interfaces_groups_edit.php | ✅ | psophis | |
-|interfaces_lagg.php | | | |
+|interfaces_gre.php | | | |
+|interfaces_groups_edit.php | | | |
+|interfaces_groups.php | | | |
|interfaces_lagg_edit.php | | | |
-|interfaces_ppps.php | | | |
+|interfaces_lagg.php | | | |
+|interfaces.php | | | |
|interfaces_ppps_edit.php | | | |
-|interfaces_qinq.php | | | |
+|interfaces_ppps.php | | | |
|interfaces_qinq_edit.php | | | |
-|interfaces_vlan.php | ✅ | psophis | |
-|interfaces_vlan_edit.php | ✅ | psophis | |
-|interfaces_wireless.php | | | |
+|interfaces_qinq.php | | | |
+|interfaces_vlan_edit.php | ✅ | | |
+|interfaces_vlan.php | ✅ | | |
|interfaces_wireless_edit.php | | | |
+|interfaces_wireless.php | | | |
|license.php | | | |
-|load_balancer_monitor.php | | | |
|load_balancer_monitor_edit.php | | | |
-|load_balancer_pool.php | | | |
+|load_balancer_monitor.php | | | |
|load_balancer_pool_edit.php | | | |
-|load_balancer_relay_action.php | | | |
+|load_balancer_pool.php | | | |
|load_balancer_relay_action_edit.php | | | |
-|load_balancer_relay_protocol.php | | | |
+|load_balancer_relay_action.php | | | |
|load_balancer_relay_protocol_edit.php | | | |
+|load_balancer_relay_protocol.php | | | |
|load_balancer_setting.php | | | |
-|load_balancer_virtual_server.php | | | |
|load_balancer_virtual_server_edit.php | | | |
-|pkg.php | | | |
+|load_balancer_virtual_server.php | | | |
|pkg_edit.php | | | |
-|pkg_mgr.php | ✅ | | |
-|pkg_mgr_install.php | ✅ | | |
|pkg_mgr_installed.php | ✅ | | |
+|pkg_mgr_install.php | ✅ | | |
+|pkg_mgr.php | ✅ | | |
|pkg_mgr_settings.php | | | |
+|pkg.php | | | |
|reboot.php | | | |
|restart_httpd.php | | | |
-|services_captiveportal.php | | | |
|services_captiveportal_filemanager.php | | | |
-|services_captiveportal_hostname.php | | | |
|services_captiveportal_hostname_edit.php | | | |
-|services_captiveportal_ip.php | | | |
+|services_captiveportal_hostname.php | | | |
|services_captiveportal_ip_edit.php | | | |
-|services_captiveportal_mac.php | | | |
+|services_captiveportal_ip.php | | | |
|services_captiveportal_mac_edit.php | | | |
-|services_captiveportal_vouchers.php | | | |
+|services_captiveportal_mac.php | | | |
+|services_captiveportal.php | | | |
|services_captiveportal_vouchers_edit.php | | | |
-|services_captiveportal_zones.php | | | |
+|services_captiveportal_vouchers.php | | | |
|services_captiveportal_zones_edit.php | | | |
-|services_dhcp.php | | | |
+|services_captiveportal_zones.php | | | |
|services_dhcp_edit.php | | | |
+|services_dhcp.php | | | |
|services_dhcp_relay.php | | | |
-|services_dhcpv6.php | | | |
|services_dhcpv6_edit.php | | | |
+|services_dhcpv6.php | | | |
|services_dhcpv6_relay.php | | | |
-|services_dnsmasq.php | | | |
|services_dnsmasq_domainoverride_edit.php | | | |
|services_dnsmasq_edit.php | | | |
-|services_dyndns.php | | | |
+|services_dnsmasq.php | | | |
|services_dyndns_edit.php | | | |
-|services_igmpproxy.php | | | |
+|services_dyndns.php | | | |
|services_igmpproxy_edit.php | | | |
-|services_ntpd.php | | | |
+|services_igmpproxy.php | | | |
|services_ntpd_gps.php | | | |
+|services_ntpd.php | | | |
|services_ntpd_pps.php | | | |
-|services_rfc2136.php | | | |
|services_rfc2136_edit.php | | | |
+|services_rfc2136.php | | | |
|services_router_advertisements.php | | | |
|services_snmp.php | | | |
-|services_unbound.php | | | |
|services_unbound_acls.php | | | |
|services_unbound_advanced.php | | | |
|services_unbound_domainoverride_edit.php | | | |
|services_unbound_host_edit.php | | | |
-|services_wol.php | | | |
+|services_unbound.php | | | |
|services_wol_edit.php | | | |
+|services_wol.php | | | |
|stats.php | | | |
-|status.php | | | |
-|status_captiveportal.php | | | |
|status_captiveportal_expire.php | | | |
+|status_captiveportal.php | | | |
|status_captiveportal_test.php | | | |
|status_captiveportal_voucher_rolls.php | | | |
|status_captiveportal_vouchers.php | | | |
-|status_dhcp_leases.php | | | |
-|status_dhcpv6_leases.php | | | |
+|status_dhcp_leases.php | ✅ | | |
+|status_dhcpv6_leases.php | ✅ | | |
|status_filter_reload.php | | | |
|status_gateway_groups.php | | | |
|status_gateways.php | | | |
-|status_graph.php | | | |
|status_graph_cpu.php | | | |
+|status_graph.php | | | |
|status_interfaces.php | | | |
|status_lb_pool.php | | | |
|status_lb_vs.php | | | |
|status_ntpd.php | | | |
|status_openvpn.php | | | |
+|status.php | | | |
|status_queues.php | | | |
-|status_rrd_graph.php | | | |
|status_rrd_graph_img.php | | | |
+|status_rrd_graph.php | | | |
|status_rrd_graph_settings.php | | | |
|status_services.php | | | |
|status_upnp.php | | | |
|status_wireless.php | | | |
-|system.php | ✅ | | |
|system_advanced_admin.php | ✅ | | |
|system_advanced_firewall.php | ✅ | | |
|system_advanced_misc.php | ✅ | | |
|system_advanced_network.php | ✅ | | |
|system_advanced_notifications.php | ✅ | | |
-|system_advanced_sysctl.php | ✅ | psophis | |
-|system_authservers.php | | | |
+|system_advanced_sysctl.php | | | |
+|system_authservers.php | ✅ | | |
|system_camanager.php | | | |
|system_certmanager.php | | | |
|system_crlmanager.php | | | |
-|system_firmware.php | | | |
|system_firmware_auto.php | | | |
|system_firmware_check.php | | | |
+|system_firmware.php | | | |
|system_firmware_restorefullbackup.php | | | |
|system_firmware_settings.php | | | |
-|system_gateway_groups.php | | | |
|system_gateway_groups_edit.php | | | |
-|system_gateways.php | | | |
-|system_gateways_edit.php | | | |
-|system_groupmanager.php | | | |
-|system_groupmanager_addprivs.php | | | |
+|system_gateway_groups.php | | | |
+|system_gateways_edit.php | ✅ | | |
+|system_gateways.php | ✅ | | |
+|system_groupmanager_addprivs.php | ✅ | | |
+|system_groupmanager.php | ✅ | | |
|system_hasync.php | | | |
-|system_routes.php | | | |
+|system.php | ✅ | | |
|system_routes_edit.php | | | |
-|system_usermanager.php | | | |
+|system_routes.php | | | |
|system_usermanager_addprivs.php | | | |
|system_usermanager_passwordmg.php | | | |
-|system_usermanager_settings.php | | | |
+|system_usermanager.php | ✅ | | |
|system_usermanager_settings_ldapacpicker.php | | | |
+|system_usermanager_settings.php | | | |
|system_usermanager_settings_test.php | | | |
|uploadconfig.php | | | |
-|vpn_ipsec.php | | | |
-|vpn_ipsec_keys.php | | | |
-|vpn_ipsec_keys_edit.php | | | |
+|vpn_ipsec_keys_edit.php | ✅ | | |
+|vpn_ipsec_keys.php | ✅ | | |
|vpn_ipsec_mobile.php | ✅ | | |
|vpn_ipsec_phase1.php | | | |
|vpn_ipsec_phase2.php | | | |
-|vpn_ipsec_settings.php | | | |
+|vpn_ipsec.php | ✅ | | |
+|vpn_ipsec_settings.php | ✅ | | |
|vpn_l2tp.php | ✅ | | |
-|vpn_l2tp_users.php | ✅ | | |
|vpn_l2tp_users_edit.php | ✅ | | |
+|vpn_l2tp_users.php | ✅ | | |
|vpn_openvpn_client.php | | | |
|vpn_openvpn_csc.php | | | |
|vpn_openvpn_server.php | | | |
-|vpn_pppoe.php | | | |
|vpn_pppoe_edit.php | | | |
+|vpn_pppoe.php | | | |
|vpn_pptp.php | | | |
-|vpn_pptp_users.php | | | |
|vpn_pptp_users_edit.php | | | |
+|vpn_pptp_users.php | | | |
|wizard.php | | | |
|xmlrpc.php | | | |
diff --git a/etc/inc/authgui.inc b/etc/inc/authgui.inc
index 66a3ecc..d920944 100644
--- a/etc/inc/authgui.inc
+++ b/etc/inc/authgui.inc
@@ -212,6 +212,7 @@ if ($local_ip == false) {
<head>
<link rel="stylesheet" href="/bootstrap/css/pfSense.css" />
<title><?=gettext("Login"); ?></title>
+ <script>var events = events || [];</script>
</head>
<body id="login" class="no-menu">
<div id="jumbotron">
@@ -262,24 +263,21 @@ if ($local_ip == false) {
</div>
</div>
</div>
- </div>
- <script src="/jquery/jquery-1.11.1.min.js"></script>
- <script>
- $(function() {
- document.cookie=
- "cookie_test=1" +
- "<?php echo $config['system']['webgui']['protocol'] == 'https' ? '; secure' : '';?>";
-
- if (document.cookie.indexOf("cookie_test") == -1)
- document.getElementById("no_cookies").className = '';
-
- // Delete it
- document.cookie = "cookie_test=1; expires=Thu, 01-Jan-1970 00:00:01 GMT";
- });
- </script>
-</body>
-</html>
+
+ <script>
+ events.push(function() {
+ document.cookie=
+ "cookie_test=1" +
+ "<?php echo $config['system']['webgui']['protocol'] == 'https' ? '; secure' : '';?>";
+
+ if (document.cookie.indexOf("cookie_test") == -1)
+ document.getElementById("no_cookies").className = '';
+
+ // Delete it
+ document.cookie = "cookie_test=1; expires=Thu, 01-Jan-1970 00:00:01 GMT";
+ });
+ </script>
<?php
-} // end function
+require('foot.inc');
-?> \ No newline at end of file
+} // end function \ No newline at end of file
diff --git a/usr/local/www/bootstrap/css/pfSense.css b/usr/local/www/bootstrap/css/pfSense.css
index 22f3bba..1cfc905 100644
--- a/usr/local/www/bootstrap/css/pfSense.css
+++ b/usr/local/www/bootstrap/css/pfSense.css
@@ -54,6 +54,7 @@ tr.disabled th {
/** Content structure */
.table-responsive {
clear: both;
+ margin-bottom: 0px;
}
.form-horizontal {
diff --git a/usr/local/www/carp_status.php b/usr/local/www/carp_status.php
index 7c157ee..1052115 100644
--- a/usr/local/www/carp_status.php
+++ b/usr/local/www/carp_status.php
@@ -196,7 +196,7 @@ if ($carpcount > 0):
<td>
<td><?=convert_friendly_interface_to_friendly_descr($carp['interface'])?>@<?=$vhid?></td>
<td><?=$ipaddress?></td>
- <td><i class="icon icon-<?=$icon?>">$status</td>
+ <td><i class="icon icon-<?=$icon?>">$status</i></td>
</tr>
<?php }?>
</table>
diff --git a/usr/local/www/classes/Form.class.php b/usr/local/www/classes/Form.class.php
index a280dd6..8ea9e69 100644
--- a/usr/local/www/classes/Form.class.php
+++ b/usr/local/www/classes/Form.class.php
@@ -46,7 +46,7 @@ class Form extends Form_Element
protected $_sections = array();
protected $_global = array();
- public function __construct(Form_Button $submit = null)
+ public function __construct($submit = null)
{
if (!isset($submit))
$submit = new Form_Button(
@@ -54,7 +54,8 @@ class Form extends Form_Element
'Save'
);
- $this->addGlobal($submit);
+ if (false !== $submit)
+ $this->addGlobal($submit);
}
public function add(Form_Section $section)
@@ -112,4 +113,4 @@ class Form extends Form_Element
</form>
EOT;
}
-} \ No newline at end of file
+}
diff --git a/usr/local/www/diag_authentication.php b/usr/local/www/diag_authentication.php
index 58b7d08..ddd5345 100644
--- a/usr/local/www/diag_authentication.php
+++ b/usr/local/www/diag_authentication.php
@@ -1,7 +1,7 @@
<?php
/*
diag_authentication.php
- part of the pfSense project (https://www.pfsense.org)
+ part of the pfSense project (https://www.pfsense.org)
Copyright (C) 2010 Ermal Luçi
Copyright (C) 2013-2015 Electric Sheep Fencing, LP
All rights reserved.
@@ -29,7 +29,7 @@
*/
/*
- pfSense_MODULE: auth
+ pfSense_MODULE: auth
*/
##|+PRIV
@@ -51,16 +51,19 @@ if ($_POST) {
if (!$authcfg)
$input_errors[] = $_POST['authmode'] . " " . gettext("is not a valid authentication server");
- if (empty($_POST['username']) || empty($_POST['passwordfld']))
+ if (empty($_POST['username']) || empty($_POST['password']))
$input_errors[] = gettext("A username and password must be specified.");
if (!$input_errors) {
- if (authenticate_user($_POST['username'], $_POST['passwordfld'], $authcfg)) {
+ if (authenticate_user($_POST['username'], $_POST['password'], $authcfg)) {
$savemsg = gettext("User") . ": " . $_POST['username'] . " " . gettext("authenticated successfully.");
$groups = getUserGroups($_POST['username'], $authcfg);
- $savemsg .= "<br />" . gettext("This user is a member of these groups") . ": <br />";
+ $savemsg .= "&nbsp;" . gettext("This user is a member of groups") . ": <br />";
+ $savemsg .= "<ul>";
foreach ($groups as $group)
- $savemsg .= "{$group} ";
+ $savemsg .= "<li>" . "{$group} " . "</li>";
+ $savemsg .= "</ul>";
+
} else {
$input_errors[] = gettext("Authentication failed.");
}
@@ -71,42 +74,49 @@ $shortcut_section = "authentication";
include("head.inc");
?>
-<?php if ($input_errors) print_input_errors($input_errors)?>
-<?php if ($savemsg) print_info_box($savemsg)?>
- <div id="container">
- <form class="form-horizontal" action="diag_authentication.php" method="post">
- <div class="form-group">
- <label for="authmode" class="col-sm-2 control-label"><?=gettext("Authentication Server")?></label>
- <div class="col-sm-10">
- <select name="authmode" id="authmode" class="formselect" >
- <?php
- foreach (auth_get_authserver_list() as $auth_server):
- $selected = ($auth_server['name'] == $pconfig['authmode'])
- ?>
- <option value="<?=$auth_server['name']?>" <?=($selected?'selected="selected"':'')?>>
- <?=$auth_server['name']?>
- </option>
- <?php endforeach?>
- </select>
- </div>
- </div>
-
- <div class="form-group">
- <label for="authmode" class="col-sm-2 control-label"><?=gettext("Username")?></label>
- <div class="col-sm-10">
- <input name="username" value="<?=htmlspecialchars($pconfig['username'])?>" />
- </div>
- </div>
-
- <div class="form-group">
- <label for="authmode" class="col-sm-2 control-label"><?=gettext("Password")?></label>
- <div class="col-sm-10">
- <input name="password" type="password" value="<?=htmlspecialchars($pconfig['password'])?>" />
- </div>
- </div>
-
- <button type="submit" class="btn btn-primary"><?=gettext("Test");?></button>
- </form>
- </div>
-</div>
-<?php include("foot.inc")?>
+<?php
+if ($input_errors)
+ print_input_errors($input_errors);
+
+if ($savemsg)
+ print('<div class="alert alert-success" role="alert">'. $savemsg.'</div>');
+
+require('classes/Form.class.php');
+
+$form = new Form(new Form_Button(
+ 'Submit',
+ gettext('Test')
+));
+
+$section = new Form_Section('Authentication Test');
+
+foreach (auth_get_authserver_list() as $auth_server)
+ $serverlist[$auth_server['name']] = $auth_server['name'];
+
+$section->addInput(new Form_Select(
+ 'authmode',
+ 'Authentication Server',
+ $pconfig['authmode'],
+ $serverlist
+))->setHelp('Select the authentication server to test against');
+
+$section->addInput(new Form_Input(
+ 'username',
+ 'Username',
+ 'text',
+ $pconfig['username'],
+ ['placeholder' => 'Username']
+));
+
+$section->addInput(new Form_Input(
+ 'password',
+ 'Password',
+ 'password',
+ $pconfig['password'],
+ ['placeholder' => 'Password']
+));
+
+$form->add($section);
+print $form;
+
+include("foot.inc"); \ No newline at end of file
diff --git a/usr/local/www/diag_limiter_info.php b/usr/local/www/diag_limiter_info.php
index c3f8045..b2aa4a1 100644
--- a/usr/local/www/diag_limiter_info.php
+++ b/usr/local/www/diag_limiter_info.php
@@ -1,36 +1,36 @@
<?php
/* $Id$ */
/*
- diag_limiter_info.php
- Copyright (C) 2010 Scott Ullrich
- Copyright (C) 2013-2015 Electric Sheep Fencing, LP
- All rights reserved.
+ diag_limiter_info.php
+ Copyright (C) 2010 Scott Ullrich
+ Copyright (C) 2013-2015 Electric Sheep Fencing, LP
+ All rights reserved.
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
+ 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.
+ 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.
+ 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.
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS 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
- AUTHOR 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.
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS 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
+ AUTHOR 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_BUILDER_BINARIES: /usr/bin/top
- pfSense_MODULE: system
+ pfSense_MODULE: system
*/
##|+PRIV
@@ -47,8 +47,8 @@ $shortcut_section = "trafficshaper-limiters";
if($_REQUEST['getactivity']) {
$text = `/sbin/ipfw pipe show`;
- if($text == "")
- $text = "We could not find any limiters on this system.";
+ if($text == "")
+ $text = "Unable to find any limiters on this system.";
echo "Limiters:\n";
echo $text;
$text = `/sbin/ipfw queue show`;
@@ -61,59 +61,36 @@ if($_REQUEST['getactivity']) {
include("head.inc");
+if ($input_errors)
+ print_input_errors($input_errors);
+
?>
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<script type="text/javascript">
-//<![CDATA[
+<script>
function getlimiteractivity() {
- var url = "/diag_limiter_info.php";
- var pars = 'getactivity=yes';
- jQuery.ajax(
- url,
+ $.ajax(
+ '/diag_limiter_info.php',
{
type: 'post',
- data: pars,
- complete: activitycallback
- });
- }
- function activitycallback(transport) {
- jQuery('#limiteractivitydiv').html('<font face="Courier" size="2"><pre style="text-align:left;">' + transport.responseText + '<\/pre><\/font>');
- setTimeout('getlimiteractivity()', 2000);
+ data: {
+ getactivity: 'yes'
+ },
+ success: function (data) {
+ $('#xhrOutput').html(data);
+ },
+ });
}
- setTimeout('getlimiteractivity()', 5000);
-//]]>
+
+ events.push(function(){
+ setInterval('getlimiteractivity()', 2500);
+ getlimiteractivity();
+ });
</script>
-<div id="maincontent">
-<?php
- if($savemsg) {
- echo "<div id=\"savemsg\">";
- print_info_box($savemsg);
- echo "</div>";
- }
- if ($input_errors)
- print_input_errors($input_errors);
-?>
-<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="diag limiter info">
- <tr>
- <td>
- <table id="backuptable" class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0" summary="tabcont">
- <tr>
- <td align="center">
- <table summary="results">
- <tr><td>
- <div id="limiteractivitydiv">
- <?=gettext("Gathering Limiter information, please wait...");?>
- </div>
- </td></tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
+
+<div class="panel panel-default">
+ <div class="panel-heading">Limiter Information</div>
+ <div class="panel-body">
+ <pre id="xhrOutput"><?=gettext("Gathering Limiter information, please wait...")?></pre>
+ </div>
</div>
-<?php include("fend.inc"); ?>
-</body>
-</html>
+
+<?php include("foot.inc"); \ No newline at end of file
diff --git a/usr/local/www/diag_ndp.php b/usr/local/www/diag_ndp.php
index 03f80be..1e34d98 100644
--- a/usr/local/www/diag_ndp.php
+++ b/usr/local/www/diag_ndp.php
@@ -1,7 +1,7 @@
<?php
/*
diag_ndp.php
- part of the pfSense project (https://www.pfsense.org)
+ part of the pfSense project (https://www.pfsense.org)
Copyright (C) 2004-2010 Scott Ullrich <sullrich@gmail.com>
Copyright (C) 2011 Seth Mos <seth.mos@dds.nl>
All rights reserved.
@@ -34,7 +34,7 @@
/*
pfSense_BUILDER_BINARIES: /bin/cat /usr/sbin/arp
- pfSense_MODULE: arp
+ pfSense_MODULE: arp
*/
##|+PRIV
@@ -60,8 +60,8 @@ foreach ($ifdescrs as $key =>$interface) {
$hwif[$config['interfaces'][$key]['if']] = $interface;
}
-/* Array ( [0] => Neighbor [1] => Linklayer [2] => Address
-[3] => Netif [4] => Expire [5] => S
+/* Array ( [0] => Neighbor [1] => Linklayer [2] => Address
+[3] => Netif [4] => Expire [5] => S
[6] => Flags ) */
$data = array();
array_shift($rawdata);
@@ -77,10 +77,10 @@ foreach ($rawdata as $line) {
/* FIXME: Not ipv6 compatible dns resolving. PHP needs fixing */
function _getHostName($mac,$ip)
-{
+{
if(is_ipaddr($ip)) {
list($ip, $scope) = explode("%", $ip);
- if(gethostbyaddr($ip) <> "" and gethostbyaddr($ip) <> $ip)
+ if(gethostbyaddr($ip) != "" and gethostbyaddr($ip) != $ip)
return gethostbyaddr($ip);
else
return "";
@@ -97,7 +97,7 @@ foreach ($data as &$entry) {
else
$entry['dnsresolve'] = "Z_ ";
}
-
+
// Sort the data alpha first
$data = msort($data, "dnsresolve");
@@ -106,73 +106,49 @@ $mac_man = load_mac_manufacturer_table();
$pgtitle = array(gettext("Diagnostics"),gettext("NDP Table"));
include("head.inc");
-
?>
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<?php include("fbegin.inc"); ?>
-
-<div id="loading">
- <img src="/themes/<?=$g['theme'];?>/images/misc/loader.gif" alt="loader" /><?= gettext("Loading, please wait..."); ?>
- <p>&nbsp;</p>
-</div>
-
-<?php
-
-// Flush buffers out to client so that they see Loading, please wait....
-for ($i = 0; $i < ob_get_level(); $i++) { ob_end_flush(); }
-ob_implicit_flush(1);
-
-?>
-<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="diag ndp">
- <tr>
- <td>
- <table class="tabcont sortable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="tabcont">
+<div class="table-responsive">
+ <table class="table table-striped table-hover">
+ <thead>
+ <tr>
+ <th><?= gettext("IPv6 address"); ?></th>
+ <th><?= gettext("MAC address"); ?></th>
+ <th><?= gettext("Hostname"); ?></th>
+ <th><?= gettext("Interface"); ?></th>
+ </tr>
+ </thead>
+ <tbody>
+ <?php foreach ($data as $entry): ?>
<tr>
- <td class="listhdrr"><?= gettext("IPv6 address"); ?></td>
- <td class="listhdrr"><?= gettext("MAC address"); ?></td>
- <td class="listhdrr"><?= gettext("Hostname"); ?></td>
- <td class="listhdr"><?= gettext("Interface"); ?></td>
- <td class="list"></td>
+ <td><?=$entry['ipv6']?></td>
+ <td>
+ <?php
+ $mac=trim($entry['mac']);
+ $mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]);
+ ?>
+ <?=$mac?>
+
+ <? if(isset($mac_man[$mac_hi])):?>
+ (<?=$mac_man[$mac_hi]?>)
+ <?endif?>
+
+ </td>
+ <td>
+ <?=htmlspecialchars(str_replace("Z_ ", "", $entry['dnsresolve']))?>
+ </td>
+ <td>
+ <?php
+ if(isset($hwif[$entry['interface']]))
+ echo $hwif[$entry['interface']];
+ else
+ echo $entry['interface'];
+ ?>
+ </td>
</tr>
- <?php foreach ($data as $entry): ?>
- <tr>
- <td class="listlr"><?=$entry['ipv6'];?></td>
- <td class="listr">
- <?php
- $mac=trim($entry['mac']);
- $mac_hi = strtoupper($mac[0] . $mac[1] . $mac[3] . $mac[4] . $mac[6] . $mac[7]);
- print $mac;
- if(isset($mac_man[$mac_hi])){ print "<br /><font size=\"-2\"><i>{$mac_man[$mac_hi]}</i></font>"; }
- ?>
- </td>
- <td class="listr">
- <?php
- echo "&nbsp;". str_replace("Z_ ", "", $entry['dnsresolve']);
- ?>
- </td>
- <td class="listr">
- <?php
- if(isset($hwif[$entry['interface']]))
- echo $hwif[$entry['interface']];
- else
- echo $entry['interface'];
- ?>
- </td>
- </tr>
- <?php endforeach; ?>
- </table>
- </td>
- </tr>
-</table>
-
-<?php include("fend.inc"); ?>
-
-<script type="text/javascript">
-//<![CDATA[
- jQuery('#loading').html('');
-//]]>
-</script>
-</body>
-</html>
+ <?php endforeach; ?>
+ </tbody>
+ </table>
+</div>
+
+<?php include("foot.inc"); \ No newline at end of file
diff --git a/usr/local/www/diag_pf_info.php b/usr/local/www/diag_pf_info.php
index 560ed7c..6e3920d 100644
--- a/usr/local/www/diag_pf_info.php
+++ b/usr/local/www/diag_pf_info.php
@@ -1,36 +1,36 @@
<?php
/* $Id$ */
/*
- diag_pf_info.php
- Copyright (C) 2010 Scott Ullrich
- Copyright (C) 2013-2015 Electric Sheep Fencing, LP
- 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.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS 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
- AUTHOR 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.
+ diag_pf_info.php
+ Copyright (C) 2010 Scott Ullrich
+ Copyright (C) 2013-2015 Electric Sheep Fencing, LP
+ 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.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS 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
+ AUTHOR 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_BUILDER_BINARIES: /usr/bin/top
- pfSense_MODULE: system
+ pfSense_MODULE: system
*/
##|+PRIV
@@ -44,6 +44,11 @@ require("guiconfig.inc");
$pgtitle = gettext("Diagnostics: pfInfo");
+if (stristr($_POST['Submit'], gettext("No"))) {
+ header("Location: index.php");
+ exit;
+}
+
if($_REQUEST['getactivity']) {
$text = `/sbin/pfctl -vvsi`;
$text .= "<p/>";
@@ -58,57 +63,57 @@ if($_REQUEST['getactivity']) {
include("head.inc");
+if ($input_errors)
+ print_input_errors($input_errors);
+
+require('classes/Form.class.php');
+$form = new Form(false);
+$form->addGlobal(new Form_Input(
+ 'getactivity',
+ null,
+ 'hidden',
+ 'yes'
+));
+$section = new Form_Section('Auto update page');
+
+$section->addInput(new Form_Checkbox(
+ 'refresh',
+ 'Refresh',
+ 'Automatically refresh the output below',
+ true
+));
+
+$form->add($section);
+print $form;
+
?>
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<script type="text/javascript">
-jQuery(document).ready(function() {setTimeout('getpfinfo()', 5000);});
-//<![CDATA[
+<script>
function getpfinfo() {
- jQuery.ajax({
- type: "POST",
- url: "/diag_pf_info.php",
- data: 'getactivity=yes',
- async: false,
- complete: activitycallback
+ if (!$('#refresh').is(':checked'))
+ return;
+
+ $.ajax(
+ '/diag_pf_info.php',
+ {
+ type: 'post',
+ data: $(document.forms[0]).serialize(),
+ success: function (data) {
+ $('#xhrOutput').html(data);
+ },
});
}
- function activitycallback(transport) {
- jQuery('#pfactivitydiv').html('<font face="Courier" size="2"><pre style="text-align:left;">' + transport.responseText + '<\/pre><\/font>');
- setTimeout('getpfinfo()', 2000);
- }
-//]]>
+
+ events.push(function(){
+ setInterval('getpfinfo()', 2500);
+ getpfinfo();
+ });
</script>
-<div id="maincontent">
-<?php
- if($savemsg) {
- echo "<div id=\"savemsg\">";
- print_info_box($savemsg);
- echo "</div>";
- }
- if ($input_errors)
- print_input_errors($input_errors);
-?>
-<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="diag pf info">
- <tr>
- <td>
- <table id="backuptable" class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0" summary="tabcont">
- <tr>
- <td align="center">
- <table summary="results">
- <tr><td>
- <div id="pfactivitydiv">
- <?=gettext("Gathering PF information, please wait...");?>
- </div>
- </td></tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
+
+<div class="panel panel-default">
+ <div class="panel-heading"><?=gettext('Output')?></div>
+ <div class="panel panel-body">
+ <pre id="xhrOutput"><?=gettext("Gathering PF information, please wait...")?></pre>
+ </div>
</div>
-<?php include("fend.inc"); ?>
-</body>
-</html>
+
+<?php include("foot.inc"); \ No newline at end of file
diff --git a/usr/local/www/diag_ping.php b/usr/local/www/diag_ping.php
index 0c289cf..d4db925 100644
--- a/usr/local/www/diag_ping.php
+++ b/usr/local/www/diag_ping.php
@@ -33,7 +33,7 @@
/*
pfSense_BUILDER_BINARIES: /sbin/ping /sbin/ping6
- pfSense_MODULE: routing
+ pfSense_MODULE: routing
*/
##|+PRIV
@@ -47,10 +47,18 @@ $allowautocomplete = true;
$pgtitle = array(gettext("Diagnostics"), gettext("Ping"));
require_once("guiconfig.inc");
-
define('MAX_COUNT', 10);
define('DEFAULT_COUNT', 3);
+function create_sourceaddresslist() {
+ $list = array('any' => 'Any');
+
+ foreach (get_possible_traffic_source_addresses(true) as $sipname)
+ $list[$sipname['value']] = $sipname['name'];
+
+ return $list;
+}
+
if ($_POST || $_REQUEST['host']) {
unset($input_errors);
unset($do_ping);
@@ -79,118 +87,118 @@ if ($_POST || $_REQUEST['host']) {
$count = DEFAULT_COUNT;
}
}
+
if (!isset($do_ping)) {
$do_ping = false;
$host = '';
$count = DEFAULT_COUNT;
}
-include("head.inc"); ?>
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="ping">
-<tr><td>
-<?php if ($input_errors) print_input_errors($input_errors); ?>
-<form action="diag_ping.php" method="post" name="iform" id="iform">
-<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="tabcont">
-<tr>
- <td colspan="2" valign="top" class="listtopic"><?=gettext("Ping"); ?></td>
-</tr>
-<tr>
- <td width="22%" valign="top" class="vncellreq"><?=gettext("Host"); ?></td>
- <td width="78%" class="vtable">
- <?=$mandfldhtml;?><input name="host" type="text" class="formfld unknown" id="host" size="20" value="<?=htmlspecialchars($host);?>" /></td>
-</tr>
-<tr>
- <td width="22%" valign="top" class="vncellreq"><?=gettext("IP Protocol"); ?></td>
- <td width="78%" class="vtable">
- <select name="ipproto" class="formselect">
- <option value="ipv4" <?php if ($ipproto == "ipv4") echo "selected=\"selected\"" ?>>IPv4</option>
- <option value="ipv6" <?php if ($ipproto == "ipv6") echo "selected=\"selected\"" ?>>IPv6</option>
- </select>
- </td>
-</tr>
-<tr>
- <td width="22%" valign="top" class="vncell"><?=gettext("Source Address"); ?></td>
- <td width="78%" class="vtable">
- <select name="sourceip" class="formselect">
- <option value="">Default</option>
- <?php $sourceips = get_possible_traffic_source_addresses(true);
- foreach ($sourceips as $sipvalue => $sipname):
- $selected = "";
- if (!link_interface_to_bridge($sipvalue) && ($sipvalue == $sourceip))
- $selected = "selected=\"selected\"";
- ?>
- <option value="<?=$sipvalue;?>" <?=$selected;?>>
- <?=htmlspecialchars($sipname);?>
- </option>
- <?php endforeach; ?>
- </select>
- </td>
-</tr>
-<tr>
- <td width="22%" valign="top" class="vncellreq"><?= gettext("Count"); ?></td>
- <td width="78%" class="vtable">
- <select name="count" class="formfld" id="count">
- <?php for ($i = 1; $i <= MAX_COUNT; $i++): ?>
- <option value="<?=$i;?>" <?php if ($i == $count) echo "selected=\"selected\""; ?>><?=$i;?></option>
- <?php endfor; ?>
- </select>
- </td>
-</tr>
-<tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Ping"); ?>" />
- </td>
-</tr>
-<tr>
- <td valign="top" colspan="2">
- <?php if ($do_ping) {
- echo "<font face=\"terminal\" size=\"2\">";
- echo "<strong>" . gettext("Ping output") . ":</strong><br />";
+if($do_ping) {
?>
- <script type="text/javascript">
- //<![CDATA[
- window.onload=function(){
- document.getElementById("pingCaptured").wrap='off';
- }
- //]]>
- </script>
+ <script type="text/javascript">
+ //<![CDATA[
+ window.onload=function(){
+ document.getElementById("pingCaptured").wrap='off';
+ }
+ //]]>
+ </script>
<?php
- echo "<textarea id=\"pingCaptured\" style=\"width:98%\" name=\"code\" rows=\"15\" cols=\"66\" readonly=\"readonly\">";
- $ifscope = '';
- $command = "/sbin/ping";
- if ($ipproto == "ipv6") {
- $command .= "6";
- $ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ipv6($sourceip);
- 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))
- $host .= "%{$ifscope}";
- }
-
- $cmd = "{$command} {$srcip} -c" . escapeshellarg($count) . " " . escapeshellarg($host);
- //echo "Ping command: {$cmd}\n";
- system($cmd);
- echo('</textarea>&nbsp;</font>');
+ $ifscope = '';
+ $command = "/sbin/ping";
+ if ($ipproto == "ipv6") {
+ $command .= "6";
+ $ifaddr = is_ipaddr($sourceip) ? $sourceip : get_interface_ipv6($sourceip);
+ 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))
+ $host .= "%{$ifscope}";
}
- ?>
- </td>
-</tr>
-<tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">&nbsp;</td>
-</tr>
-</table>
-</form>
-</td></tr>
-</table>
-<?php include("fend.inc"); ?>
-</body>
-</html>
+
+ $cmd = "{$command} {$srcip} -c" . escapeshellarg($count) . " " . escapeshellarg($host);
+ //echo "Ping command: {$cmd}\n";
+ $result = shell_exec($cmd);
+
+ if(empty($result))
+ $input_errors[] = "Host \"" . $host . "\" did not respond or could not be resolved.";
+
+}
+
+include('head.inc');
+
+if ($input_errors)
+ print_input_errors($input_errors);
+
+require('classes/Form.class.php');
+
+$form = new Form(new Form_Button(
+ 'submit',
+ 'Ping'
+));
+
+$section = new Form_Section('Ping');
+
+$section->addInput(new Form_Input(
+ 'host',
+ 'Hostname',
+ 'text',
+ $host,
+ ['placeholder' => 'Hostname to ping']
+));
+
+$group = new Form_Group('IP Protocol');
+$group->add(new Form_Checkbox(
+ 'ipproto',
+ null,
+ 'IPv4',
+ ('ipv6' != $ipproto), # negative check, so this would be checked by default
+ 'ipv4'
+))->displayAsRadio();
+$group->add(new Form_Checkbox(
+ 'ipproto',
+ null,
+ 'IPv6',
+ ('ipv6' == $ipproto),
+ 'ipv6'
+))->displayAsRadio();
+$group->setHelp('Select the protocol to use');
+$section->add($group);
+
+$section->addInput(new Form_Select(
+ 'sourceip',
+ 'Source address',
+ $pconfig['source'],
+ create_sourceaddresslist()
+))->setHelp('Select source address for the ping');
+
+$section->addInput(new Form_Select(
+ 'count',
+ 'Maximum number of pings',
+ $count,
+ array_combine(range(1, MAX_COUNT), range(1, MAX_COUNT))
+))->setHelp('Select the maximum number pings');
+
+$form->add($section);
+print $form;
+
+if($do_ping && !empty($result) && !$input_errors) {
+?>
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h2 class="panel-title">Results</h2>
+ </div>
+
+ <div class="panel-body">
+ <pre><?= $result ?></pre>
+ </div>
+ </div>
+<?php
+}
+
+include('foot.inc');
diff --git a/usr/local/www/diag_routes.php b/usr/local/www/diag_routes.php
index 14196f4..031eb3b 100644
--- a/usr/local/www/diag_routes.php
+++ b/usr/local/www/diag_routes.php
@@ -31,7 +31,7 @@
*/
/*
- pfSense_BUILDER_BINARIES: /usr/bin/netstat
+ pfSense_BUILDER_BINARIES: /usr/bin/netstat
pfSense_MODULE: routing
*/
##|+PRIV
@@ -43,6 +43,9 @@
include('guiconfig.inc');
+$limit='100';
+$filter='';
+
if (isset($_REQUEST['isAjax'])) {
$netstat = "/usr/bin/netstat -rW";
if (isset($_REQUEST['IPv6'])) {
@@ -51,6 +54,7 @@ if (isset($_REQUEST['isAjax'])) {
} else {
$netstat .= " -f inet";
echo "IPv4\n";
+
}
if (!isset($_REQUEST['resolve']))
$netstat .= " -n";
@@ -73,166 +77,141 @@ $shortcut_section = "routing";
include('head.inc');
+require('classes/Form.class.php');
+
+$form = new Form(new Form_Button(
+ 'update',
+ 'Update'
+));
+$form->addGlobal(new Form_Input(
+ 'isAjax',
+ null,
+ 'hidden',
+ 1
+));
+$section = new Form_Section('Traceroute');
+
+$section->addInput(new Form_Checkbox(
+ 'resolve',
+ 'Resolve names',
+ 'Enable',
+ $resolve
+))->setHelp('Enabling name resolution may cause the query should take longer.'.
+ ' You can stop it at any time by clicking the Stop button in your browser.');
+
+$validLimits = array('10', '50', '100', '200', '500', '1000', 'all');
+$section->addInput(new Form_Select(
+ 'limit',
+ 'Rows to display',
+ $limit,
+ array_combine($validLimits, $validLimits)
+));
+
+$section->addInput(new Form_Input(
+ 'filter',
+ 'Filter',
+ 'text',
+ $host
+))->setHelp('Use a regular expression to filter IP address or hostnames');
+
+$form->add($section);
+print $form;
?>
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-
-<?php include("fbegin.inc"); ?>
-
-<script type="text/javascript">
-//<![CDATA[
-
- function update_routes(section) {
- var url = "diag_routes.php";
- var limit = jQuery('#limit option:selected').text();
- var filter = jQuery('#filter').val();
- var params = "isAjax=true&limit=" + limit + "&filter=" + filter;
- if (jQuery('#resolve').is(':checked'))
- params += "&resolve=true";
- if (section == "IPv6")
- params += "&IPv6=true";
- var myAjax = new Ajax.Request(
- url,
- {
- method: 'post',
- parameters: params,
- onComplete: update_routes_callback
- });
- }
+<script>
+function update_routes(section) {
+ $.ajax(
+ '/diag_routes.php',
+ {
+ type: 'post',
+ data: $(document.forms[0]).serialize() +'&'+ section +'=true',
+ success: update_routes_callback,
+ });
+}
- function update_routes_callback(transport) {
- // First line contains section
- var responseTextArr = transport.responseText.split("\n");
- var section = responseTextArr.shift();
- var tbody = '';
- var field = '';
- var elements = 8;
- var tr_class = '';
-
- var thead = '<tr><td class="listtopic" colspan="' + elements + '"><strong>' + section + '<\/strong><\/td><\/tr>' + "\n";
- for (var i = 0; i < responseTextArr.length; i++) {
- if (responseTextArr[i] == "")
+function update_routes_callback(html) {
+ // First line contains section
+ var responseTextArr = html.split("\n");
+ var section = responseTextArr.shift();
+ var tbody = '';
+ var field = '';
+ var tr_class = '';
+ var thead = '<tr>';
+
+ for (var i = 0; i < responseTextArr.length; i++) {
+ if (responseTextArr[i] == "")
+ continue;
+ var tmp = '<tr>';
+ var j = 0;
+ var entry = responseTextArr[i].split(" ");
+ for (var k = 0; k < entry.length; k++) {
+ if (entry[k] == "")
continue;
- var tmp = '';
- if (i == 0) {
- tr_class = 'listhdrr';
- tmp += '<tr class="sortableHeaderRowIdentifier">' + "\n";
- } else {
- tr_class = 'listlr';
- tmp += '<tr>' + "\n";
- }
- var j = 0;
- var entry = responseTextArr[i].split(" ");
- for (var k = 0; k < entry.length; k++) {
- if (entry[k] == "")
- continue;
- if (i == 0 && j == (elements - 1))
- tr_class = 'listhdr';
- tmp += '<td class="' + tr_class + '">' + entry[k] + '<\/td>' + "\n";
- if (i > 0)
- tr_class = 'listr';
- j++;
- }
- // The 'Expire' field might be blank
- if (j == (elements - 1))
- tmp += '<td class="listr">&nbsp;<\/td>' + "\n";
- tmp += '<\/tr>' + "\n";
if (i == 0)
- thead += tmp;
+ tmp += '<th>' + entry[k] + '<\/th>';
else
- tbody += tmp;
+ tmp += '<td>' + entry[k] + '<\/td>';
+ j++;
}
- jQuery('#' + section + ' > thead').html(thead);
- jQuery('#' + section + ' > tbody').html(tbody);
+
+ tmp += '<td><\/td>';
+
+ if (i == 0)
+ thead += tmp;
+ else
+ tbody += tmp;
}
-//]]>
-</script>
+ $('#' + section + ' > thead').html(thead);
+ $('#' + section + ' > tbody').html(tbody);
+}
-<script type="text/javascript">
-//<![CDATA[
+function update_all_routes() {
+ update_routes("IPv4");
+ update_routes("IPv6");
+}
- function update_all_routes() {
- update_routes("IPv4");
- update_routes("IPv6");
- }
+events.push(function(){
+ setInterval('update_all_routes()', 5000);
+ update_all_routes();
- jQuery(document).ready(function(){setTimeout('update_all_routes()', 5000);});
+ $(document.forms[0]).on('submit', function(e){
+ update_all_routes();
-//]]>
+ e.preventDefault();
+ });
+});
</script>
-<div id="mainarea">
-<form action="diag_routes.php" method="post">
-<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="6" summary="diag routes">
-
-<tr>
-<td class="vncellreq" width="22%"><?=gettext("Name resolution");?></td>
-<td class="vtable" width="78%">
-<input type="checkbox" class="formfld" id="resolve" name="resolve" value="yes" <?php if ($_POST['resolve'] == 'yes') echo "checked=\"checked\""; ?> /><?=gettext("Enable");?>
-<br />
-<span class="expl"><?=gettext("Enable this to attempt to resolve names when displaying the tables.");?></span>
-</td>
-</tr>
-
-<tr>
-<td class="vncellreq" width="22%"><?=gettext("Number of rows");?></td>
-<td class="vtable" width="78%">
-<select id="limit" name="limit">
-<?php
- foreach (array("10", "50", "100", "200", "500", "1000", gettext("all")) as $item) {
- echo "<option value=\"{$item}\" " . ($item == "100" ? "selected=\"selected\"" : "") . ">{$item}</option>\n";
- }
-?>
-</select>
-<br />
-<span class="expl"><?=gettext("Select how many rows to display.");?></span>
-</td>
-</tr>
-
-<tr>
-<td class="vncellreq" width="22%"><?=gettext("Filter expression");?></td>
-<td class="vtable" width="78%">
-<input type="text" class="formfld search" name="filter" id="filter" />
-<br />
-<span class="expl"><?=gettext("Use a regular expression to filter IP address or hostnames.");?></span>
-</td>
-</tr>
-
-<tr>
-<td class="vncellreq" width="22%">&nbsp;</td>
-<td class="vtable" width="78%">
-<input type="button" class="formbtn" name="update" onclick="update_all_routes();" value="<?=gettext("Update"); ?>" />
-<br />
-<br />
-<span class="vexpl"><span class="red"><strong><?=gettext("Note:")?></strong></span> <?=gettext("By enabling name resolution, the query should take a bit longer. You can stop it at any time by clicking the Stop button in your browser.");?></span>
-</td>
-</tr>
-
-</table>
-</form>
-
-<table class="tabcont sortable" width="100%" cellspacing="0" cellpadding="6" border="0" id="IPv4" summary="ipv4 routes">
- <thead>
- <tr><td class="listtopic"><strong>IPv4</strong></td></tr>
- </thead>
- <tbody>
- <tr><td class="listhdrr"><?=gettext("Gathering data, please wait...");?></td></tr>
- </tbody>
-</table>
-<table class="tabcont sortable" width="100%" cellspacing="0" cellpadding="6" border="0" id="IPv6" summary="ipv6 routes">
- <thead>
- <tr><td class="listtopic"><strong>IPv6</strong></td></tr>
- </thead>
- <tbody>
- <tr><td class="listhdrr"><?=gettext("Gathering data, please wait...");?></td></tr>
- </tbody>
-</table>
-
+<div class="panel panel-default">
+ <div class="panel-heading">IPv4 Routes</div>
+ <div class="panel panel-body">
+ <table class="table table-striped table-compact" id="IPv4">
+ <thead>
+ <!-- filled by xhr -->
+ </thead>
+ <tbody>
+ <tr>
+ <td><?=gettext("Gathering data, please wait...")?></td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
</div>
-<?php
-include('fend.inc');
-?>
+<div class="panel panel-default">
+ <div class="panel-heading">IPv6 Routes</div>
+ <div class="panel panel-body">
+ <table class="table table-striped table-compact" id="IPv6">
+ <thead>
+ <!-- filled by xhr -->
+ </thead>
+ <tbody>
+ <tr>
+ <td><?=gettext("Gathering data, please wait...")?></td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+</div>
-</body>
-</html>
+<?php include("foot.inc"); \ No newline at end of file
diff --git a/usr/local/www/diag_states_summary.php b/usr/local/www/diag_states_summary.php
index e54061b..c882bc1 100644
--- a/usr/local/www/diag_states_summary.php
+++ b/usr/local/www/diag_states_summary.php
@@ -33,7 +33,7 @@
/*
pfSense_BUILDER_BINARIES: /sbin/pfctl
- pfSense_MODULE: filter
+ pfSense_MODULE: filter
*/
##|+PRIV
@@ -120,7 +120,6 @@ if(count($states) > 0) {
addipinfo($allipinfo, $srcip, $proto, $srcport, $dstport);
addipinfo($allipinfo, $dstip, $proto, $srcport, $dstport);
-
}
}
@@ -134,7 +133,6 @@ function build_port_info($portarr, $proto) {
$ports = array();
asort($portarr);
foreach (array_reverse($portarr, TRUE) as $port => $count) {
- $str = "";
$service = getservbyport($port, strtolower($proto));
$port = "{$proto}/{$port}";
if ($service)
@@ -144,59 +142,68 @@ function build_port_info($portarr, $proto) {
return implode($ports, ', ');
}
-function print_summary_table($label, $iparr, $sort = TRUE) { ?>
-
-<h3><?php echo $label; ?></h3>
-<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" summary="states summary">
- <tr>
- <td class="listhdrr"><?=gettext("IP");?></td>
- <td class="listhdrr"># <?=gettext("States");?></td>
- <td class="listhdrr"><?=gettext("Proto");?></td>
- <td class="listhdrr"># <?=gettext("States");?></td>
- <td class="listhdrr"><?=gettext("Src Ports");?></td>
- <td class="listhdrr"><?=gettext("Dst Ports");?></td>
- </tr>
-<?php if ($sort)
+function print_summary_table($label, $iparr, $sort = TRUE)
+{
+ if ($sort)
uksort($iparr, "sort_by_ip");
- foreach($iparr as $ip => $ipinfo) { ?>
- <tr>
- <td class="vncell"><?php echo $ip; ?></td>
- <td class="vncell"><?php echo $ipinfo['seen']; ?></td>
- <td class="vncell">&nbsp;</td>
- <td class="vncell">&nbsp;</td>
- <td class="vncell">&nbsp;</td>
- <td class="vncell">&nbsp;</td>
- </tr>
- <?php foreach($ipinfo['protos'] as $proto => $protoinfo) { ?>
- <tr>
- <td class="list">&nbsp;</td>
- <td class="list">&nbsp;</td>
- <td class="listlr"><?php echo $proto; ?></td>
- <td class="listr" align="center"><?php echo $protoinfo['seen']; ?></td>
- <td class="listr" align="center"><span title="<?php echo build_port_info($protoinfo['srcports'], $proto); ?>"><?php echo count($protoinfo['srcports']); ?></span></td>
- <td class="listr" align="center"><span title="<?php echo build_port_info($protoinfo['dstports'], $proto); ?>"><?php echo count($protoinfo['dstports']); ?></span></td>
- </tr>
- <?php } ?>
-<?php } ?>
-
-</table>
+?>
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <h2 class="panel-title"><?=$label?></h2>
+ </div>
+ <div class="panel-body">
+ <div class="table-responsive">
+ <table class="table table-hover table-condensed table-striped">
+ <thead>
+ <tr>
+ <th ><?=gettext("IP");?></th>
+ <th class="text-center"># <?=gettext("States");?></th>
+ <th ><?=gettext("Proto");?></th>
+ <th class="text-center"># <?=gettext("States");?></th>
+ <th class="text-center"><?=gettext("Src Ports");?></th>
+ <th class="text-center"><?=gettext("Dst Ports");?></th>
+ </tr>
+ </thead>
+ <tbody>
+<?php foreach($iparr as $ip => $ipinfo):
+ $protocolCount = count($ipinfo['protos']);
+ $rowSpan = '';
+ $i = 0;
+
+ if ($protocolCount > 1)
+ $rowSpan = ' rowspan="' . $protocolCount . '"';
+?>
+ <tr>
+ <td<?= $rowSpan ?>><?php echo $ip; ?></td>
+ <td<?= $rowSpan ?> class="text-center"><?php echo $ipinfo['seen']; ?></td>
+
+<?php foreach($ipinfo['protos'] as $proto => $protoinfo): ?>
+<?php if ($protocolCount > 1 && $i > 0): ?>
+ </tr><tr>
+<?php endif; ?>
+ <td><?php echo $proto; ?></td>
+ <td class="text-center" ><?php echo $protoinfo['seen']; ?></td>
+ <td class="text-center" ><span title="<?php echo build_port_info($protoinfo['srcports'], $proto); ?>"><?php echo count($protoinfo['srcports']); ?></span></td>
+ <td class="text-center" ><span title="<?php echo build_port_info($protoinfo['dstports'], $proto); ?>"><?php echo count($protoinfo['dstports']); ?></span></td>
+<?php $i++; endforeach; ?>
+ </tr>
+<?php endforeach; ?>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </div>
<?php
}
$pgtitle = array(gettext("Diagnostics"),gettext("State Table Summary"));
require_once("guiconfig.inc");
include("head.inc");
-echo "<body>";
-include("fbegin.inc");
-
print_summary_table(gettext("By Source IP"), $srcipinfo);
print_summary_table(gettext("By Destination IP"), $dstipinfo);
print_summary_table(gettext("Total per IP"), $allipinfo);
print_summary_table(gettext("By IP Pair"), $pairipinfo, FALSE);
-?>
-<?php include("fend.inc"); ?>
-</body>
-</html>
+include("foot.inc"); \ No newline at end of file
diff --git a/usr/local/www/diag_system_activity.php b/usr/local/www/diag_system_activity.php
index cc2c41e..9843a3e 100644
--- a/usr/local/www/diag_system_activity.php
+++ b/usr/local/www/diag_system_activity.php
@@ -1,37 +1,37 @@
<?php
/* $Id$ */
/*
- diag_system_activity.php
- Copyright (C) 2013-2015 Electric Sheep Fencing, LP
-
- Copyright (C) 2008-2009 Scott Ullrich
- 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.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS 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
- AUTHOR 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.
+ diag_system_activity.php
+ Copyright (C) 2013-2015 Electric Sheep Fencing, LP
+
+ Copyright (C) 2008-2009 Scott Ullrich
+ 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.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS 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
+ AUTHOR 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_BUILDER_BINARIES: /usr/bin/top
- pfSense_MODULE: system
+ pfSense_MODULE: system
*/
##|+PRIV
@@ -43,7 +43,7 @@
require("guiconfig.inc");
-$pgtitle = gettext("Diagnostics: System Activity");
+$pgtitle = array(gettext("Diagnostics"),gettext("System Activity"));
if($_REQUEST['getactivity']) {
$text = `/usr/bin/top -aHS | /usr/bin/cut -c1-105`;
@@ -53,60 +53,38 @@ if($_REQUEST['getactivity']) {
include("head.inc");
+if ($input_errors)
+ print_input_errors($input_errors);
+
?>
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<script type="text/javascript">
-//<![CDATA[
- function getcpuactivity() {
- scroll(0,0);
- var url = "/diag_system_activity.php";
- var pars = 'getactivity=yes';
- jQuery.ajax(
- url,
- {
- type: 'post',
- data: pars,
- complete: activitycallback
- });
- }
- function activitycallback(transport) {
- jQuery('#cpuactivitydiv').html('<font face="Courier" size="2"><pre style="text-align:left;">' + transport.responseText + '<\/pre><\/font>');
- setTimeout('getcpuactivity()', 2500);
- }
- setTimeout('getcpuactivity()', 1000);
-//]]>
+<script>
+function getcpuactivity() {
+ $.ajax(
+ '/diag_system_activity.php',
+ {
+ method: 'post',
+ data: {
+ getactivity: 'yes'
+ },
+ dataType: "html",
+ success: function (data) {
+ $('#xhrOutput').html(data);
+ },
+ }
+ );
+}
+
+events.push(function(){
+ setInterval('getcpuactivity()', 2500);
+ getcpuactivity();
+});
</script>
-<div id="maincontent">
-<?php
- if($savemsg) {
- echo "<div id=\"savemsg\">";
- print_info_box($savemsg);
- echo "</div>";
- }
- if ($input_errors)
- print_input_errors($input_errors);
-?>
-<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="diag system activity">
- <tr>
- <td>
- <table id="backuptable" class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0" summary="tabcont">
- <tr>
- <td align="center">
- <table summary="results">
- <tr><td>
- <div id="cpuactivitydiv">
- <?=gettext("Gathering CPU activity, please wait...");?>
- </div>
- </td></tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
-</table>
+
+<div class="panel panel-default">
+ <div class="panel-heading"><?=gettext('CPU Activity')?></div>
+ <div class="panel panel-body">
+ <pre id="xhrOutput"><?=gettext("Gathering CPU activity, please wait...")?></pre>
+ </div>
</div>
-<?php include("fend.inc"); ?>
-</body>
-</html>
+
+<?php include("foot.inc"); \ No newline at end of file
diff --git a/usr/local/www/diag_system_pftop.php b/usr/local/www/diag_system_pftop.php
index f5cc443..f80107a 100644
--- a/usr/local/www/diag_system_pftop.php
+++ b/usr/local/www/diag_system_pftop.php
@@ -1,31 +1,31 @@
<?php
/* $Id$ */
/*
- diag_system_pftop.php
- Copyright (C) 2008-2009 Scott Ullrich
- Copyright (C) 2013-2015 Electric Sheep Fencing, LP
- 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.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS 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
- AUTHOR 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.
+ diag_system_pftop.php
+ Copyright (C) 2008-2009 Scott Ullrich
+ Copyright (C) 2013-2015 Electric Sheep Fencing, LP
+ 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.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS 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
+ AUTHOR 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.
*/
/*
@@ -67,7 +67,7 @@ if($_REQUEST['getactivity']) {
}
$text = `pftop -b {$sorttype} -v {$viewtype} {$numstate}`;
- echo $text;
+ echo trim($text);
exit;
}
@@ -90,126 +90,100 @@ if($_REQUEST['sorttype'] && in_array($_REQUEST['sorttype'], $sorttypes)
$numstate = "100";
}
+if ($input_errors)
+ print_input_errors($input_errors);
+
+require('classes/Form.class.php');
+$form = new Form(false);
+$form->addGlobal(new Form_Input(
+ 'getactivity',
+ null,
+ 'hidden',
+ 'yes'
+));
+$section = new Form_Section('pfTop Configuration');
+
+$validViews = array(
+ 'default', 'label', 'long',
+ 'queue', 'rules', 'size',
+ 'speed', 'state', 'time',
+);
+$section->addInput(new Form_Select(
+ 'viewtype',
+ 'View',
+ $viewtype,
+ array_combine($validViews, $validViews)
+));
+
+$section->addInput(new Form_Select(
+ 'sorttype',
+ 'Sort by',
+ $sorttype,
+ array(
+ 'none' => 'None',
+ 'age' => 'Age',
+ 'bytes' => 'Bytes',
+ 'dest' => 'Destination Address',
+ 'dport' => 'Destination Port',
+ 'exp' => 'Expiry',
+ 'peak' => 'Peak',
+ 'pkt' => 'Packet',
+ 'rate' => 'Rate',
+ 'size' => 'Size',
+ 'sport' => 'Source Port',
+ 'src' => 'Source Address',
+ )
+));
+
+$validStates = array(50, 100, 200, 500, 100, 'all');
+$section->addInput(new Form_Select(
+ 'states',
+ 'Maximum # of States',
+ $numstate,
+ array_combine($validStates, $validStates)
+));
+
+$form->add($section);
+print $form;
?>
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<form method="post" action="diag_system_pftop.php">
-<script type="text/javascript">
-//<![CDATA[
+
+<script>
function getpftopactivity() {
- var url = "/diag_system_pftop.php";
- var pars = 'getactivity=yes&sorttype=' + jQuery('#sorttype').val() + '&viewtype=' + jQuery('#viewtype').val() + '&states=' + jQuery('#states').val();
- jQuery.ajax(
- url,
+ $.ajax(
+ '/diag_system_pftop.php',
{
- type: 'post',
- data: pars,
- complete: activitycallback
- });
+ method: 'post',
+ data: $(document.forms[0]).serialize(),
+ dataType: "html",
+ success: function (data) {
+ $('#xhrOutput').html(data);
+ },
+ }
+ );
}
- function activitycallback(transport) {
- jQuery('#pftopactivitydiv').html('<font face="Courier" size="2"><pre style="text-align:left;">' + transport.responseText + '<\/pre><\/font>');
- setTimeout('getpftopactivity()', 2500);
- }
- setTimeout('getpftopactivity()', 1000);
-//]]>
+
+ events.push(function(){
+ setInterval('getpftopactivity()', 2500);
+ getpftopactivity();
+ });
</script>
-<div id="maincontent">
<?php
- if($savemsg) {
- echo "<div id=\"savemsg\">";
- print_info_box($savemsg);
- echo "</div>";
- }
- if ($input_errors)
- print_input_errors($input_errors);
?>
- <div id="mainarea" style="padding-bottom: 0px;">
- <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0" summary="diag system pftop">
- <tr>
- <td class="list">
- <div id='viewtypediv'><?=gettext("View type:"); ?>
- <select name='viewtype' id='viewtype'>
- <option value='default' <?php echo ($viewtype == "default") ? "selected=\"selected\"" : ""; ?>><?=gettext("Default");?></option>
- <option value='label' <?php echo ($viewtype == "label") ? "selected=\"selected\"" : ""; ?>><?=gettext("Label");?></option>
- <option value='long' <?php echo ($viewtype == "long") ? "selected=\"selected\"" : ""; ?>><?=gettext("Long");?></option>
- <option value='queue' <?php echo ($viewtype == "queue") ? "selected=\"selected\"" : ""; ?>><?=gettext("Queue");?></option>
- <option value='rules' <?php echo ($viewtype == "rules") ? "selected=\"selected\"" : ""; ?>><?=gettext("Rules");?></option>
- <option value='size' <?php echo ($viewtype == "size") ? "selected=\"selected\"" : ""; ?>><?=gettext("Size");?></option>
- <option value='speed' <?php echo ($viewtype == "speed") ? "selected=\"selected\"" : ""; ?>><?=gettext("Speed");?></option>
- <option value='state' <?php echo ($viewtype == "state") ? "selected=\"selected\"" : ""; ?>><?=gettext("State");?></option>
- <option value='time' <?php echo ($viewtype == "time") ? "selected=\"selected\"" : ""; ?>><?=gettext("Time");?></option>
- </select>
- </div>
- </td>
- <td class="list">
- <div id='sorttypediv'><?=gettext("Sort type:"); ?>
- <select name='sorttype' id='sorttype'>
- <option value='age' <?php echo ($sorttype == "age") ? "selected=\"selected\"" : ""; ?>><?=gettext("Age");?></option>
- <option value='bytes' <?php echo ($sorttype == "bytes") ? "selected=\"selected\"" : ""; ?>><?=gettext("Bytes");?></option>
- <option value='dest' <?php echo ($sorttype == "dest") ? "selected=\"selected\"" : ""; ?>><?=gettext("Destination Address");?></option>
- <option value='dport' <?php echo ($sorttype == "dport") ? "selected=\"selected\"" : ""; ?>><?=gettext("Destination Port");?></option>
- <option value='exp' <?php echo ($sorttype == "exp") ? "selected=\"selected\"" : ""; ?>><?=gettext("Expiry");?></option>
- <option value='none' <?php echo ($sorttype == "none") ? "selected=\"selected\"" : ""; ?>><?=gettext("None");?></option>
- <option value='peak' <?php echo ($sorttype == "peak") ? "selected=\"selected\"" : ""; ?>><?=gettext("Peak");?></option>
- <option value='pkt' <?php echo ($sorttype == "pkt") ? "selected=\"selected\"" : ""; ?>><?=gettext("Packet");?></option>
- <option value='rate' <?php echo ($sorttype == "rate") ? "selected=\"selected\"" : ""; ?>><?=gettext("Rate");?></option>
- <option value='size' <?php echo ($sorttype == "size") ? "selected=\"selected\"" : ""; ?>><?=gettext("Size");?></option>
- <option value='sport' <?php echo ($sorttype == "sport") ? "selected=\"selected\"" : ""; ?>><?=gettext("Source Port");?></option>
- <option value='src' <?php echo ($sorttype == "src") ? "selected=\"selected\"" : ""; ?>><?=gettext("Source Address");?></option>
- </select>
- </div>
- </td>
- <td class="list">
- <div id='statesdiv'><?=gettext("Number of States:"); ?>
- <select name='states' id='states'>
- <option value='50' <?php echo ($numstate == "50") ? "selected=\"selected\"" : ""; ?>>50</option>
- <option value='100' <?php echo ($numstate == "100") ? "selected=\"selected\"" : ""; ?>>100</option>
- <option value='200' <?php echo ($numstate == "200") ? "selected=\"selected\"" : ""; ?>>200</option>
- <option value='500' <?php echo ($numstate == "500") ? "selected=\"selected\"" : ""; ?>>500</option>
- <option value='1000' <?php echo ($numstate == "1000") ? "selected=\"selected\"" : ""; ?>>1000</option>
- <option value='all' <?php echo ($numstate == "all") ? "selected=\"selected\"" : ""; ?>>all</option>
- </select>
- </div>
- </td>
- </tr>
- <tr>
- <td colspan="3" align="center">
- <table id="backuptable" class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0" summary="tabcont">
- <tr>
- <td align="center">
- <table summary="results">
- <tr>
- <td>
- <div id="pftopactivitydiv"><?=gettext("Gathering pfTOP activity, please wait...");?></div>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
+<div class="panel panel-default">
+ <div class="panel-heading"><?=gettext('Output')?></div>
+ <div class="panel panel-body">
+ <pre id="xhrOutput"><?=gettext("Gathering pfTOP activity, please wait...")?></pre>
</div>
</div>
-</form>
-<?php include("fend.inc"); ?>
-<script type="text/javascript">
-//<![CDATA[
-jQuery("#viewtype").change(function() {
- var selected = jQuery("#viewtype option:selected");
- switch(selected.val()) {
- case "queue":
- case "label":
- case "rules":
- jQuery("#sorttype, #sorttypediv, #statesdiv, #states").hide();
- break;
- default:
- jQuery("#sorttype, #sorttypediv, #statesdiv, #states").show();
- }
+
+<script>
+events.push(function(){
+ $('#viewtype').on('change', function(){
+ if (['queue', 'label', 'rules'].indexOf($(this).val()) > -1)
+ $("#sorttype, #sorttypediv, #statesdiv, #states").parents('.form-group').hide();
+ else
+ $("#sorttype, #sorttypediv, #statesdiv, #states").parents('.form-group').show();
+ });
});
-//]]>
</script>
-</body>
-</html>
+<?php include("foot.inc"); \ No newline at end of file
diff --git a/usr/local/www/edit.php b/usr/local/www/edit.php
index 4d2c34f..f18a72d 100644
--- a/usr/local/www/edit.php
+++ b/usr/local/www/edit.php
@@ -46,24 +46,25 @@ if($_POST['action']) {
switch($_POST['action']) {
case 'load':
if(strlen($_POST['file']) < 1) {
- echo "|5|" . gettext("No file name specified") . ".|";
+ print('|5|' . '<div class="alert alert-danger" role="alert">'.gettext("No file name specified").'</div>' . '|');
} elseif(is_dir($_POST['file'])) {
- echo "|4|" . gettext("Loading a directory is not supported") . ".|";
+ print('|4|' . '<div class="alert alert-danger" role="alert">' . gettext("Loading a directory is not supported") .'</div>' . '|');
} elseif(! is_file($_POST['file'])) {
- echo "|3|" . gettext("File does not exist or is not a regular file") . ".|";
+ print('|3|' . '<div class="alert alert-danger" role="alert">' . gettext("File does not exist or is not a regular file") . '</div>' . '|');
} else {
$data = file_get_contents(urldecode($_POST['file']));
if($data === false) {
- echo "|1|" . gettext("Failed to read file") . ".|";
+ print('|1|' . '<div class="alert alert-danger" role="alert">' . gettext("Failed to read file") . '</div>' . '|');
} else {
$data = base64_encode($data);
- echo "|0|{$_POST['file']}|{$data}|";
+ print("|0|{$_POST['file']}|{$data}|");
}
}
exit;
+
case 'save':
if(strlen($_POST['file']) < 1) {
- echo "|" . gettext("No file name specified") . ".|";
+ print('|' . '<div class="alert alert-danger" role="alert">'.gettext("No file name specified").'</div>' . '|');
} else {
conf_mount_rw();
$_POST['data'] = str_replace("\r", "", base64_decode($_POST['data']));
@@ -75,11 +76,11 @@ if($_POST['action']) {
disable_security_checks();
}
if($ret === false) {
- echo "|" . gettext("Failed to write file") . ".|";
- } elseif($ret <> strlen($_POST['data'])) {
- echo "|" . gettext("Error while writing file") . ".|";
+ print('|' . '<div class="alert alert-danger" role="alert">' . gettext("Failed to write file") . '</div>' . '|');
+ } elseif($ret != strlen($_POST['data'])) {
+ print('|' . '<div class="alert alert-danger" role="alert">' . gettext("Error while writing file") . '</div>' . '|');
} else {
- echo "|" . gettext("File successfully saved") . ".|";
+ print('|' . '<div class="alert alert-success" role="alert">' . gettext("File saved successfully") . '</div>' . '|');
}
}
exit;
@@ -87,25 +88,45 @@ if($_POST['action']) {
exit;
}
-$closehead = false;
require("head.inc");
-outputCSSFileInline("code-syntax-highlighter/SyntaxHighlighter.css");
-outputJavaScriptFileInline("filebrowser/browser.js");
-outputJavaScriptFileInline("javascript/base64.js");
-
?>
-</head>
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
+<!-- file status box -->
+<div style="display:none; background:#eeeeee;" id="fileStatusBox">
+ <strong id="fileStatus"></strong>
+</div>
+
+<div class="panel panel-default">
+ <div class="panel-heading"><?=gettext("Save / Load a file from the filesystem")?></div>
+ <div class="panel-body">
+ <form>
+ <input type="text" class="form-control" id="fbTarget"/>
+ <input type="button" class="btn btn-default btn-sm" onclick="loadFile();" value="<?=gettext('Load')?>" />
+ <input type="button" class="btn btn-default btn-sm" id="fbOpen" value="<?=gettext('Browse')?>" />
+ <input type="button" class="btn btn-default btn-sm" onclick="saveFile();" value="<?=gettext('Save')?>" />
+ </form>
+
+ <div id="fbBrowser" style="display:none; border:1px dashed gray; width:98%;"></div>
+
+ <div style="background:#eeeeee;" id="fileOutput">
+ <script type="text/javascript">
+ //<![CDATA[
+ window.onload=function(){
+ document.getElementById("fileContent").wrap='off';
+ }
+ //]]>
+ </script>
+ <textarea id="fileContent" name="fileContent" class="form-control" rows="30" cols=""></textarea>
+ </div>
-<script type="text/javascript">
-//<![CDATA[
+ </div>
+</div>
+
+<script>
function loadFile() {
- jQuery("#fileStatus").html("<?=gettext("Loading file"); ?> ...");
+ jQuery("#fileStatus").html("");
jQuery("#fileStatusBox").show(500);
-
jQuery.ajax(
- "<?=$_SERVER['SCRIPT_NAME'];?>", {
+ "<?=$_SERVER['SCRIPT_NAME']?>", {
type: "post",
data: "action=load&file=" + jQuery("#fbTarget").val(),
complete: loadComplete
@@ -120,38 +141,26 @@ outputJavaScriptFileInline("javascript/base64.js");
if(values.shift() == "0") {
var file = values.shift();
- var fileContent = Base64.decode(values.join("|"));
- jQuery("#fileStatus").html("<?=gettext("File successfully loaded"); ?>.");
- jQuery("#fileContent").val(fileContent);
-
- var lang = "none";
- if(file.indexOf(".php") > 0) lang = "php";
- else if(file.indexOf(".inc") > 0) lang = "php";
- else if(file.indexOf(".xml") > 0) lang = "xml";
- else if(file.indexOf(".js" ) > 0) lang = "js";
- else if(file.indexOf(".css") > 0) lang = "css";
+ var fileContent = window.atob(values.join("|"));
- if(jQuery("#highlight").checked && lang != "none") {
- jQuery("fileContent").prop("className",lang + ":showcolumns");
- dp.SyntaxHighlighter.HighlightAll("fileContent", true, false);
- }
+ jQuery("#fileContent").val(fileContent);
}
else {
jQuery("#fileStatus").html(values[0]);
jQuery("#fileContent").val("");
}
+
jQuery("#fileContent").show(1000);
}
function saveFile(file) {
- jQuery("#fileStatus").html("<?=gettext("Saving file"); ?> ...");
+ jQuery("#fileStatus").html("");
jQuery("#fileStatusBox").show(500);
-
var fileContent = Base64.encode(jQuery("#fileContent").val());
fileContent = fileContent.replace(/\+/g,"%2B");
-
+
jQuery.ajax(
- "<?=$_SERVER['SCRIPT_NAME'];?>", {
+ "<?=$_SERVER['SCRIPT_NAME']?>", {
type: "post",
data: "action=save&file=" + jQuery("#fbTarget").val() +
"&data=" + fileContent,
@@ -162,93 +171,15 @@ outputJavaScriptFileInline("javascript/base64.js");
}
);
}
-//]]>
-</script>
-
-<!-- file status box -->
-<div style="display:none; background:#eeeeee;" id="fileStatusBox">
- <div class="vexpl" style="padding-left:15px;">
- <strong id="fileStatus"></strong>
- </div>
-</div>
-
-<br />
-
-<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="file editor">
- <tr>
- <td class="tabcont" align="center">
-
-<!-- controls -->
-<table width="100%" cellpadding="9" cellspacing="9" summary="controls">
- <tr>
- <td align="center" class="list">
- <?=gettext("Save / Load from path"); ?>:
- <input type="text" class="formfld file" id="fbTarget" size="45" />
- <input type="button" class="formbtn" onclick="loadFile();" value="<?=gettext('Load');?>" />
- <input type="button" class="formbtn" id="fbOpen" value="<?=gettext('Browse');?>" />
- <input type="button" class="formbtn" onclick="saveFile();" value="<?=gettext('Save');?>" />
- <br />
- <?php
- /*
- <input type="checkbox" id="highlight" /><?=gettext("Enable syntax highlighting");
- */
- ?>
- </td>
- </tr>
-</table>
-
-<!-- filebrowser -->
-<div id="fbBrowser" style="display:none; border:1px dashed gray; width:98%;"></div>
-
-<!-- file viewer/editor -->
-<table width="100%" summary="file editor">
- <tr>
- <td valign="top">
- <div style="background:#eeeeee;" id="fileOutput">
- <script type="text/javascript">
- //<![CDATA[
- window.onload=function(){
- document.getElementById("fileContent").wrap='off';
- }
- //]]>
- </script>
- <textarea id="fileContent" name="fileContent" style="width:100%;" rows="30" cols=""></textarea>
- </div>
- </td>
- </tr>
-</table>
-
- </td>
- </tr>
-</table>
-
-<script type="text/javascript" src="/code-syntax-highlighter/shCore.js"></script>
-<script type="text/javascript" src="/code-syntax-highlighter/shBrushCss.js"></script>
-<script type="text/javascript" src="/code-syntax-highlighter/shBrushJScript.js"></script>
-<script type="text/javascript" src="/code-syntax-highlighter/shBrushPhp.js"></script>
-<script type="text/javascript" src="/code-syntax-highlighter/shBrushXml.js"></script>
-<script type="text/javascript">
-//<![CDATA[
- jQuery(window).load(
- function() {
- jQuery("#fbTarget").focus();
-
- NiftyCheck();
- Rounded("div#fileStatusBox", "all", "#ffffff", "#eeeeee", "smooth");
- }
- );
<?php if($_GET['action'] == "load"): ?>
- jQuery(window).load(
- function() {
- jQuery("#fbTarget").val("<?=htmlspecialchars($_GET['path']);?>");
- loadFile();
- }
- );
+ events.push(function() {
+ jQuery("#fbTarget").val("<?=htmlspecialchars($_GET['path'])?>");
+ loadFile();
+ });
<?php endif; ?>
-//]]>
</script>
-<?php include("fend.inc"); ?>
-</body>
-</html>
+<?php include("foot.inc");
+
+outputJavaScriptFileInline("filebrowser/browser.js"); \ No newline at end of file
diff --git a/usr/local/www/exec.php b/usr/local/www/exec.php
index 61fbcc5..d263621 100644
--- a/usr/local/www/exec.php
+++ b/usr/local/www/exec.php
@@ -8,29 +8,29 @@
Copyright (C) 2013-2015 Electric Sheep Fencing, LP
- 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.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS 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
- AUTHOR 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.
+ 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.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS 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
+ AUTHOR 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: shell
+ pfSense_MODULE: shell
*/
##|+PRIV
@@ -84,262 +84,183 @@ function puts( $arg ) { echo "$arg\n"; }
// "Constants".
-$Version = '';
+$Version = '';
$ScriptName = $REQUEST['SCRIPT_NAME'];
// Get year.
-$arrDT = localtime();
+$arrDT = localtime();
$intYear = $arrDT[5] + 1900;
$closehead = false;
$pgtitle = array(gettext("Diagnostics"),gettext("Execute command"));
include("head.inc");
?>
-
-<script type="text/javascript">
-//<![CDATA[
-
- // Create recall buffer array (of encoded strings).
-
+<script>
+ // Create recall buffer array (of encoded strings).
<?php
if (isBlank( $_POST['txtRecallBuffer'] )) {
- puts( " var arrRecallBuffer = new Array;" );
+ puts( " var arrRecallBuffer = new Array;" );
} else {
- puts( " var arrRecallBuffer = new Array(" );
+ puts( " var arrRecallBuffer = new Array(" );
$arrBuffer = explode( "&", $_POST['txtRecallBuffer'] );
for ($i=0; $i < (count( $arrBuffer ) - 1); $i++)
- puts( " '" . htmlspecialchars($arrBuffer[$i], ENT_QUOTES | ENT_HTML401) . "'," );
- puts( " '" . htmlspecialchars($arrBuffer[count( $arrBuffer ) - 1], ENT_QUOTES | ENT_HTML401) . "'" );
- puts( " );" );
+ puts( " '" . htmlspecialchars($arrBuffer[$i], ENT_QUOTES | ENT_HTML401) . "'," );
+ puts( " '" . htmlspecialchars($arrBuffer[count( $arrBuffer ) - 1], ENT_QUOTES | ENT_HTML401) . "'" );
+ puts( " );" );
}
-
?>
+ // Set pointer to end of recall buffer.
+ var intRecallPtr = arrRecallBuffer.length-1;
+
+ // Functions to extend String class.
+ function str_encode() { return escape( this ) }
+ function str_decode() { return unescape( this ) }
+
+ // Extend string class to include encode() and decode() functions.
+ String.prototype.encode = str_encode
+ String.prototype.decode = str_decode
+
+ // Function: is Blank
+ // Returns boolean true or false if argument is blank.
+ function isBlank( strArg ) { return strArg.match( /^\s*$/ ) }
+
+ // Function: frmExecPlus onSubmit (event handler)
+ // Builds the recall buffer from the command string on submit.
+ function frmExecPlus_onSubmit( form ) {
+ if (!isBlank(form.txtCommand.value)) {
+ // If this command is repeat of last command, then do not store command.
+ if (form.txtCommand.value.encode() == arrRecallBuffer[arrRecallBuffer.length-1]) { return true }
+
+ // Stuff encoded command string into the recall buffer.
+ if (isBlank(form.txtRecallBuffer.value))
+ form.txtRecallBuffer.value = form.txtCommand.value.encode();
+ else
+ form.txtRecallBuffer.value += '&' + form.txtCommand.value.encode();
+ }
+
+ return true;
+ }
- // Set pointer to end of recall buffer.
- var intRecallPtr = arrRecallBuffer.length-1;
-
- // Functions to extend String class.
- function str_encode() { return escape( this ) }
- function str_decode() { return unescape( this ) }
-
- // Extend string class to include encode() and decode() functions.
- String.prototype.encode = str_encode
- String.prototype.decode = str_decode
-
- // Function: is Blank
- // Returns boolean true or false if argument is blank.
- function isBlank( strArg ) { return strArg.match( /^\s*$/ ) }
-
- // Function: frmExecPlus onSubmit (event handler)
- // Builds the recall buffer from the command string on submit.
- function frmExecPlus_onSubmit( form ) {
-
- if (!isBlank(form.txtCommand.value)) {
- // If this command is repeat of last command, then do not store command.
- if (form.txtCommand.value.encode() == arrRecallBuffer[arrRecallBuffer.length-1]) { return true }
-
- // Stuff encoded command string into the recall buffer.
- if (isBlank(form.txtRecallBuffer.value))
- form.txtRecallBuffer.value = form.txtCommand.value.encode();
- else
- form.txtRecallBuffer.value += '&' + form.txtCommand.value.encode();
- }
-
- return true;
- }
-
- // Function: btnRecall onClick (event handler)
- // Recalls command buffer going either up or down.
- function btnRecall_onClick( form, n ) {
+ // Function: btnRecall onClick (event handler)
+ // Recalls command buffer going either up or down.
+ function btnRecall_onClick( form, n ) {
- // If nothing in recall buffer, then error.
- if (!arrRecallBuffer.length) {
- alert( '<?=gettext("Nothing to recall"); ?>!' );
- form.txtCommand.focus();
- return;
- }
+ // If nothing in recall buffer, then error.
+ if (!arrRecallBuffer.length) {
+ alert( '<?=gettext("Nothing to recall"); ?>!' );
+ form.txtCommand.focus();
+ return;
+ }
- // Increment recall buffer pointer in positive or negative direction
- // according to <n>.
- intRecallPtr += n;
+ // Increment recall buffer pointer in positive or negative direction
+ // according to <n>.
+ intRecallPtr += n;
- // Make sure the buffer stays circular.
- if (intRecallPtr < 0) { intRecallPtr = arrRecallBuffer.length - 1 }
- if (intRecallPtr > (arrRecallBuffer.length - 1)) { intRecallPtr = 0 }
+ // Make sure the buffer stays circular.
+ if (intRecallPtr < 0) { intRecallPtr = arrRecallBuffer.length - 1 }
+ if (intRecallPtr > (arrRecallBuffer.length - 1)) { intRecallPtr = 0 }
- // Recall the command.
- form.txtCommand.value = arrRecallBuffer[intRecallPtr].decode();
- }
+ // Recall the command.
+ form.txtCommand.value = arrRecallBuffer[intRecallPtr].decode();
+ }
- // Function: Reset onClick (event handler)
- // Resets form on reset button click event.
- function Reset_onClick( form ) {
+ // Function: Reset onClick (event handler)
+ // Resets form on reset button click event.
+ function Reset_onClick( form ) {
- // Reset recall buffer pointer.
- intRecallPtr = arrRecallBuffer.length;
+ // Reset recall buffer pointer.
+ intRecallPtr = arrRecallBuffer.length;
- // Clear form (could have spaces in it) and return focus ready for cmd.
- form.txtCommand.value = '';
- form.txtCommand.focus();
+ // Clear form (could have spaces in it) and return focus ready for cmd.
+ form.txtCommand.value = '';
+ form.txtCommand.focus();
- return true;
- }
+ return true;
+ }
//]]>
</script>
-<style type="text/css">
-/*<![CDATA[*/
-
-input {
- font-family: courier new, courier;
- font-weight: normal;
- font-size: 9pt;
-}
-
-pre {
- border: 2px solid #435370;
- background: #F0F0F0;
- padding: 1em;
- font-family: courier new, courier;
- white-space: pre;
- line-height: 10pt;
- font-size: 10pt;
-}
-
-.label {
- font-family: tahoma, verdana, arial, helvetica;
- font-size: 11px;
- font-weight: bold;
-}
+<?php
-.button {
- font-family: tahoma, verdana, arial, helvetica;
- font-weight: bold;
- font-size: 11px;
-}
+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>');
-/*]]>*/
-</style>
-</head>
-<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
-<?php include("fbegin.inc"); ?>
-<?php if (isBlank($_POST['txtCommand'])): ?>
-<p class="red"><strong><?=gettext("Note: this function is unsupported. Use it " .
-"on your own risk"); ?>!</strong></p>
-<?php endif; ?>
-<?php if ($ulmsg) echo "<p><strong>" . $ulmsg . "</strong></p>\n"; ?>
+if (!isBlank($_POST['txtCommand'])):?>
+ <div class="panel panel-success responsive">
+ <div class="panel-heading">Shell Output - <?=htmlspecialchars($_POST['txtCommand'])?></div>
+ <div class="panel-body">
+ <pre>
<?php
+ putenv("PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin");
+ putenv("SCRIPT_FILENAME=" . strtok($_POST['txtCommand'], " "));
+ print htmlspecialchars(system($_POST['txtCommand'].' 2>&1'));
+?>
+ </pre>
+ </div>
+ </div>
+<? endif ?>
-if (!isBlank($_POST['txtCommand'])) {
- puts("<pre>");
- puts("\$ " . htmlspecialchars($_POST['txtCommand']));
- putenv("PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin");
- putenv("SCRIPT_FILENAME=" . strtok($_POST['txtCommand'], " ")); /* PHP scripts */
- $ph = popen($_POST['txtCommand'] . ' 2>&1', "r" );
- while ($line = fgets($ph)) echo htmlspecialchars($line);
- pclose($ph);
- puts("&nbsp;</pre>");
-}
-
+<form action="exec.php" method="post" enctype="multipart/form-data" name="frmExecPlus" onsubmit="return frmExecPlus_onSubmit( this );">
+ <div class="panel panel-default">
+ <div class="panel-heading"><?=gettext('Execute Shell Command')?></div>
+ <div class="panel-body">
+ <input id="txtCommand" name="txtCommand" placeholder="Command" type="text" class="col-sm-4" value="<?=htmlspecialchars($_POST['txtCommand'])?>" />
+ <br /><br />
+ <input type="hidden" name="txtRecallBuffer" value="<?=htmlspecialchars($_POST['txtRecallBuffer']) ?>" />
+ <input type="button" class="btn btn-default btn-sm" name="btnRecallPrev" value="<" onclick="btnRecall_onClick( this.form, -1 );" />
+ <input type="submit" class="btn btn-default btn-sm" value="<?=gettext("Execute"); ?>" />
+ <input type="button" class="btn btn-default btn-sm" name="btnRecallNext" value=">" onclick="btnRecall_onClick( this.form, 1 );" />
+ <input type="button" class="btn btn-default btn-sm" value="<?=gettext("Clear"); ?>" onclick="return Reset_onClick( this.form );" />
+ </div>
+ </div>
+
+ <div class="panel panel-default">
+ <div class="panel-heading"><?=gettext('Download file')?></div>
+ <div class="panel-body">
+ <input name="dlPath" type="text" id="dlPath" placeholder="File to download" class="col-sm-4"/>
+ <br /><br />
+ <input name="submit" type="submit" class="btn btn-default btn-sm" id="download" value="<?=gettext("Download"); ?>" />
+ </div>
+ </div>
-if (!isBlank($_POST['txtPHPCommand'])) {
- puts("<pre>");
- require_once("config.inc");
- require_once("functions.inc");
- echo eval($_POST['txtPHPCommand']);
- puts("&nbsp;</pre>");
+<?php
+ if ($ulmsg)
+ print('<div class="alert alert-success" role="alert">' . $ulmsg .'</div>');
+?>
+ <div class="panel panel-default">
+ <div class="panel-heading"><?=gettext('Upload a file')?></div>
+ <div class="panel-body">
+ <input name="ulfile" type="file" class="btn btn-default btn-sm btn-file" id="ulfile" />
+ <br />
+ <input name="submit" type="submit" class="btn btn-default btn-sm pull-left" id="upload" value="<?=gettext("Upload"); ?>" />
+
+ </div>
+ </div>
+<?php
+ if (!isBlank($_POST['txtPHPCommand'])) {
+ puts("<div class=\"panel panel-success responsive\"><div class=\"panel-heading\">PHP response</div>");
+ puts("<pre>");
+ require_once("config.inc");
+ require_once("functions.inc");
+ echo eval($_POST['txtPHPCommand']);
+ puts("&nbsp;</pre>");
+ puts("</div>");
}
-
?>
-<div id="niftyOutter">
-<form action="exec.php" method="post" enctype="multipart/form-data" name="frmExecPlus" onsubmit="return frmExecPlus_onSubmit( this );">
- <table summary="exec">
- <tr>
- <td colspan="2" valign="top" class="vnsepcell"><?=gettext("Execute Shell command"); ?></td>
- </tr>
- <tr>
- <td class="label" align="right"><?=gettext("Command"); ?>:</td>
- <td class="type"><input id="txtCommand" name="txtCommand" type="text" class="formfld unknown" size="80" value="<?=htmlspecialchars($_POST['txtCommand']);?>" /></td>
- </tr>
- <tr>
- <td valign="top">&nbsp;&nbsp;&nbsp;</td>
- <td valign="top" class="label">
- <input type="hidden" name="txtRecallBuffer" value="<?=htmlspecialchars($_POST['txtRecallBuffer']) ?>" />
- <input type="button" class="button" name="btnRecallPrev" value="<" onclick="btnRecall_onClick( this.form, -1 );" />
- <input type="submit" class="button" value="<?=gettext("Execute"); ?>" />
- <input type="button" class="button" name="btnRecallNext" value=">" onclick="btnRecall_onClick( this.form, 1 );" />
- <input type="button" class="button" value="<?=gettext("Clear"); ?>" onclick="return Reset_onClick( this.form );" />
- </td>
- </tr>
- <tr>
- <td colspan="2" valign="top" height="16"></td>
- </tr>
- <tr>
- <td colspan="2" valign="top" class="vnsepcell"><?=gettext("Download"); ?></td>
- </tr>
- <tr>
- <td align="right"><?=gettext("File to download"); ?>:</td>
- <td>
- <input name="dlPath" type="text" class="formfld file" id="dlPath" size="50" />
- </td></tr>
- <tr>
- <td valign="top">&nbsp;&nbsp;&nbsp;</td>
- <td valign="top" class="label">
- <input name="submit" type="submit" class="button" id="download" value="<?=gettext("Download"); ?>" />
- </td>
- </tr>
- <tr>
- <td colspan="2" valign="top" height="16"></td>
- </tr>
- <tr>
- <td colspan="2" valign="top" class="vnsepcell"><?=gettext("Upload"); ?></td>
- </tr>
- <tr>
- <td align="right"><?=gettext("File to upload"); ?>:</td>
- <td valign="top" class="label">
- <input name="ulfile" type="file" class="formfld file" id="ulfile" />
- </td></tr>
- <tr>
- <td valign="top">&nbsp;&nbsp;&nbsp;</td>
- <td valign="top" class="label">
- <input name="submit" type="submit" class="button" id="upload" value="<?=gettext("Upload"); ?>" /></td>
- </tr>
- <tr>
- <td colspan="2" valign="top" height="16"></td>
- </tr>
- <tr>
- <td colspan="2" valign="top" class="vnsepcell"><?=gettext("PHP Execute"); ?></td>
- </tr>
- <tr>
- <td align="right"><?=gettext("Command"); ?>:</td>
- <td class="type"><textarea id="txtPHPCommand" name="txtPHPCommand" rows="9" cols="80"><?=htmlspecialchars($_POST['txtPHPCommand']);?></textarea></td>
- </tr>
- <tr>
- <td valign="top">&nbsp;&nbsp;&nbsp;</td>
- <td valign="top" class="label">
- <input type="submit" class="button" value="<?=gettext("Execute"); ?>" />
- <p>
- <strong><?=gettext("Example"); ?>:</strong> interfaces_sync_setup();
- </p>
- </td>
- </tr>
-
- </table>
+ <div class="panel panel-default responsive">
+ <div class="panel-heading"><?=gettext('Execute PHP Commands')?></div>
+ <div class="panel-body">
+ <textarea id="txtPHPCommand" placeholder="Command" name="txtPHPCommand" rows="9" cols="80"><?=htmlspecialchars($_POST['txtPHPCommand'])?></textarea>
+ <br />
+ <input type="submit" class="btn btn-default btn-sm" value="<?=gettext("Execute")?>" />
+ <?=gettext("Example"); ?>: <code>print("Hello World!");</code>
+ </div>
+ </div>
</form>
-</div>
-<?php include("fend.inc"); ?>
-<script type="text/javascript">
-//<![CDATA[
-document.forms[0].txtCommand.focus();
-//]]>
-</script>
-</body>
-</html>
<?php
+include("foot.inc");
if($_POST)
- conf_mount_ro();
-
-?>
+ conf_mount_ro(); \ No newline at end of file
diff --git a/usr/local/www/firewall_rules.php b/usr/local/www/firewall_rules.php
index 7186870..cea0a5b 100644
--- a/usr/local/www/firewall_rules.php
+++ b/usr/local/www/firewall_rules.php
@@ -227,8 +227,6 @@ include("head.inc");
$nrules = 0;
?>
-<form action="firewall_rules.php" method="post">
-
<?php if ($savemsg) print_info_box($savemsg);?>
<?php if (is_subsystem_dirty('filter')): ?><p>
<?php 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); ?>
@@ -656,7 +654,6 @@ display_top_tabs($tab_array);
<a href="#" role="button" class="btn btn-danger">
<?=gettext("delete selected");?>
</a>
- <!-- onclick="return confirm('<?=gettext('Do you really want to delete the selected rules?');?>')" />-->
<?php endif;?>
</nav>
@@ -686,5 +683,4 @@ display_top_tabs($tab_array);
<?php endif;?>
</p>
<input type="hidden" name="if" value="<?=htmlspecialchars($if);?>" />
-</form>
<?php include("foot.inc");?> \ No newline at end of file
diff --git a/usr/local/www/halt.php b/usr/local/www/halt.php
index 322fbd4..49e99c5 100755
--- a/usr/local/www/halt.php
+++ b/usr/local/www/halt.php
@@ -50,7 +50,7 @@ require("guiconfig.inc");
require("functions.inc");
require("captiveportal.inc");
-if (stristr($_POST['Submit'], gettext("No"))) {
+if ($_POST['save'] == 'No') {
header("Location: index.php");
exit;
}
@@ -58,28 +58,28 @@ if (stristr($_POST['Submit'], gettext("No"))) {
$pgtitle = array(gettext("Diagnostics"),gettext("Halt system"));
include('head.inc');
-if ($_SERVER['REQUEST_METHOD'] == 'POST') {
-?>
- <meta http-equiv="refresh" content="70;url=/">
- <div class="alert alert-success" role="alert">
- <?=gettext("The system is halting now. This may take one minute or so.")?>
- </div>
+if ($_POST['save'] == 'Yes') {
+ print('<meta http-equiv="refresh" content="70;url=/">');
+ print('<div class="alert alert-success" role="alert">'.gettext("The system is halting now. This may take one minute or so.").'</div>');
-<?php
if(DEBUG)
print("Not actually halting (DEBUG is set true)<br>");
else
system_halt();
} else {
-?>
+?>
+<!-- Simple HTML version -->
<div class="panel panel-default">
- <div class="panel-heading">Are you sure you want to halt the system?</div>
- <div class="panel-body">Click "Yes" to halt the system immediately, or "No" to go to the system dashboard. (There will be a brief delay before the dashboard appears.)<br /><br />
+ <div class="panel-heading">
+ <h2 class="panel-title">Are you sure you want to halt the system?</h2>
+ </div>
+ <div class="panel-body">
+ <p>Click "Yes" 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">
- <input type="submit" class="btn btn-danger pull-center" name="Submit" value="Yes">
- <a href="/" class="btn btn-default">No</a>
+ <input type="submit" class="btn btn-danger pull-center" name="save" value="Yes">
+ <input type="submit" class="btn btn-default" name="save" value="No">
</form>
</div>
</div>
diff --git a/usr/local/www/interfaces_assign.php b/usr/local/www/interfaces_assign.php
index 7fa8071..1a6030d 100644
--- a/usr/local/www/interfaces_assign.php
+++ b/usr/local/www/interfaces_assign.php
@@ -492,7 +492,7 @@ display_top_tabs($tab_array);
</td>
<td>
<?php if ($ifname != 'wan'):?>
- <input type="submit" name="del[<?=$ifname?>]" class="btn btn-danger" value="<?=gettext("delete interface")?>" onclick="return confirm('<?=gettext("Do you really want to delete this interface?"); ?>')"/>
+ <input type="submit" name="del[<?=$ifname?>]" class="btn btn-danger" value="<?=gettext("delete interface")?>"/>
<?php endif;?>
</td>
</tr>
diff --git a/usr/local/www/interfaces_groups.php b/usr/local/www/interfaces_groups.php
index 0d7b0b0..b2a7bae 100644
--- a/usr/local/www/interfaces_groups.php
+++ b/usr/local/www/interfaces_groups.php
@@ -115,7 +115,7 @@ display_top_tabs($tab_array);
<td><?=htmlspecialchars($ifgroupentry['descr']);?></td>
<td>
<a class="btn btn-primary btn-sm" role="button" href="interfaces_groups_edit.php?id=<?=$i; ?>"><?=gettext('Edit'); ?></a>
- <a class="btn btn-danger btn-sm" role="button" href="interfaces_groups.php?act=del&amp;id=<?=$i; ?>" onclick="return confirm('<?=gettext("Do you really want to delete this group? All elements that still use it will become invalid (e.g. filter rules)!"); ?>')"><?=gettext("Delete"); ?></a>
+ <a class="btn btn-danger btn-sm" role="button" href="interfaces_groups.php?act=del&amp;id=<?=$i; ?>"><?=gettext("Delete"); ?></a>
</td>
</tr>
<?php $i++; endforeach; endif; ?>
diff --git a/usr/local/www/interfaces_vlan.php b/usr/local/www/interfaces_vlan.php
index 3e02b1a..9c9da84 100644
--- a/usr/local/www/interfaces_vlan.php
+++ b/usr/local/www/interfaces_vlan.php
@@ -117,7 +117,7 @@ display_top_tabs($tab_array);
<td><?=htmlspecialchars($vlan['descr']);?></td>
<td>
<a class="btn btn-primary btn-sm" role="button" href="interfaces_vlan_edit.php?id=<?=$i?>"><?=gettext('Edit')?></a>
- <a class="btn btn-danger btn-sm" role="button" href="interfaces_vlan.php?act=del&amp;id=<?=$i?>" onclick="return confirm('<?=gettext("Do you really want to delete this VLAN?")?>')"><?=gettext('Delete')?></a></td>
+ <a class="btn btn-danger btn-sm" role="button" href="interfaces_vlan.php?act=del&amp;id=<?=$i?>"><?=gettext('Delete')?></a></td>
</td>
</tr>
<?php
diff --git a/usr/local/www/jquery/pfSense.js b/usr/local/www/jquery/pfSense.js
index a1a46c4..25a34a4 100644
--- a/usr/local/www/jquery/pfSense.js
+++ b/usr/local/www/jquery/pfSense.js
@@ -97,6 +97,12 @@ $(function() {
});
};
+ // Add confirm to all btn-danger buttons
+ $('.btn-danger').on('click', function(e){
+ if (!confirm('Are you sure you wish to '+ $.trim(this.textContent) +'?'))
+ e.preventDefault();
+ });
+
// Enable popovers globally
$('[data-toggle="popover"]').popover()
@@ -105,8 +111,11 @@ $(function() {
$( $(el).attr('data-target') ).addClass('collapse');
});
+ // Focus first input
+ $(':input:enabled:visible:first').focus();
+
runEvents();
bindCollapseToOptions();
allowUserGroupDuplication();
syncIpAddressMasks();
-}); \ No newline at end of file
+});
diff --git a/usr/local/www/system_advanced_sysctl.php b/usr/local/www/system_advanced_sysctl.php
index 42a35a8..d228c34 100644
--- a/usr/local/www/system_advanced_sysctl.php
+++ b/usr/local/www/system_advanced_sysctl.php
@@ -181,7 +181,7 @@ if ($act != "edit" ): ?>
<td>
<a class="btn btn-xs btn-primary" href="system_advanced_sysctl.php?act=edit&amp;id=<?=$i;?>"><?=gettext('Edit'); ?></a>
<?php if (isset($tunable['modified'])): ?>
- <a class="btn btn-xs btn-danger" href="system_advanced_sysctl.php?act=del&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this entry?"); ?>')"><?=gettext('Delete/Reset'); ?></a>
+ <a class="btn btn-xs btn-danger" href="system_advanced_sysctl.php?act=del&amp;id=<?=$i;?>"><?=gettext('Delete/Reset'); ?></a>
<?php endif; ?>
</td>
</tr>
diff --git a/usr/local/www/system_authservers.php b/usr/local/www/system_authservers.php
index eea6085..38521e0 100644
--- a/usr/local/www/system_authservers.php
+++ b/usr/local/www/system_authservers.php
@@ -345,7 +345,7 @@ if (!($act == "new" || $act == "edit" || $input_errors))
<td>
<?php if ($i < (count($a_server) - 1)): ?>
<a href="system_authservers.php?act=edit&amp;id=<?=$i?>" class="btn btn-xs btn-primary">edit</a>
- <a href="system_authservers.php?act=del&amp;id=<?=$i?>" class="btn btn-xs btn-danger" onclick="return confirm('<?=gettext("Do you really want to delete this Server?")?>')">delete</a>
+ <a href="system_authservers.php?act=del&amp;id=<?=$i?>" class="btn btn-xs btn-danger">delete</a>
<?php endif?>
</td>
</tr>
diff --git a/usr/local/www/system_gateways.php b/usr/local/www/system_gateways.php
index 228d541..c80dfd8 100644
--- a/usr/local/www/system_gateways.php
+++ b/usr/local/www/system_gateways.php
@@ -254,7 +254,7 @@ foreach ($a_gateways as $i => $gateway):
copy
</a>
<? if (is_numeric($gateway['attribute'])): ?>
- <a class="btn btn-xs btn-danger" href="system_gateways.php?act=del&amp;id=<?=$i?>" onclick="return confirm('<?=gettext("Do you really want to delete this gateway?")?>')">
+ <a class="btn btn-xs btn-danger" href="system_gateways.php?act=del&amp;id=<?=$i?>">
delete
</a>
<a class="btn btn-xs btn-default" href="?act=toggle&amp;id=<?=$i?>">
diff --git a/usr/local/www/vpn_ipsec.php b/usr/local/www/vpn_ipsec.php
index fb20474..dd0abc8 100644
--- a/usr/local/www/vpn_ipsec.php
+++ b/usr/local/www/vpn_ipsec.php
@@ -360,8 +360,7 @@ include("head.inc");
<?php // TODO: add mouseover behaviour which indicates insert position when moving ?>
<button class="btn btn-xs btn-default" type="submit" name="move_<?=$i?>" value="move_<?=$i?>"><?=gettext("move selected entries before this")?></button>
<a class="btn btn-xs btn-primary" href="vpn_ipsec_phase1.php?p1index=<?=$i?>" title="<?=gettext("edit phase1 entry"); ?>">edit</a>
- <button class="btn btn-xs btn-danger" type="submit" name="del_<?=$i?>" value="del_<?=$i?>" title="<?=gettext('delete phase1 entry'); ?>"
- onclick="return confirm('<?=gettext("Do you really want to delete this phase1 and all associated phase2 entries?"); ?>')">delete</button>
+ <button class="btn btn-xs btn-danger" type="submit" name="del_<?=$i?>" value="del_<?=$i?>" title="<?=gettext('delete phase1 entry'); ?>">delete</button>
<?php if (!isset($ph1ent['mobile'])): ?>
<a class="btn btn-xs btn-success" href="vpn_ipsec_phase1.php?dup=<?=$i?>" title="<?=gettext("copy phase1 entry"); ?>">copy</a>
<?php endif; ?>
@@ -474,8 +473,7 @@ include("head.inc");
<?php // TODO: add mouseover behaviour which indicates insert position when moving ?>
<button class="btn btn-xs btn-default" type="submit" name="movep2_<?=$j?>" value="movep2_<?=$j?>"><?=gettext("move selected entries before this")?></button>
<a class="btn btn-xs btn-primary" href="vpn_ipsec_phase2.php?p2index=<?=$ph2ent['uniqid']?>" title="<?=gettext("edit phase2 entry"); ?>">edit</a>
- <button class="btn btn-xs btn-danger" type="submit" name="delp2_<?=$ph2index?>" value="delp2_<?=$ph2index?>" title="<?=gettext('delete phase2 entry'); ?>"
- onclick="return confirm('<?=gettext("Do you really want to delete this phase2 entry?"); ?>')">delete</button>
+ <button class="btn btn-xs btn-danger" type="submit" name="delp2_<?=$ph2index?>" value="delp2_<?=$ph2index?>" title="<?=gettext('delete phase2 entry'); ?>">delete</button>
<a class="btn btn-xs btn-success" href="vpn_ipsec_phase2.php?dup=<?=$ph2ent['uniqid']?>" title="<?=gettext("add a new Phase 2 based on this one"); ?>">copy</a>
</td>
</tr>
diff --git a/usr/local/www/vpn_ipsec_keys.php b/usr/local/www/vpn_ipsec_keys.php
index 1ed5731..db931b0 100644
--- a/usr/local/www/vpn_ipsec_keys.php
+++ b/usr/local/www/vpn_ipsec_keys.php
@@ -156,7 +156,7 @@ if (is_subsystem_dirty('ipsec'))
</td>
<td>
<a class="btn btn-primary btn-xs" href="vpn_ipsec_keys_edit.php?id=<?=$i?>">edit key</a>
- <a class="btn btn-danger btn-xs" href="vpn_ipsec_keys.php?act=del&amp;id=<?=$i?>" onclick="return confirm('<?=gettext("Do you really want to delete this Pre-Shared Key?"); ?>')">delete key</a>
+ <a class="btn btn-danger btn-xs" href="vpn_ipsec_keys.php?act=del&amp;id=<?=$i?>">delete key</a>
</td>
</tr>
<?php $i++; endforeach; ?>
diff --git a/usr/local/www/vpn_l2tp_users.php b/usr/local/www/vpn_l2tp_users.php
index b97fb7d..d03a7a6 100644
--- a/usr/local/www/vpn_l2tp_users.php
+++ b/usr/local/www/vpn_l2tp_users.php
@@ -111,7 +111,7 @@ include("head.inc");
</td>
<td>
<a class="btn btn-xs btn-primary" href="vpn_l2tp_users_edit.php?id=<?=$i?>"><?= gettext('edit') ?></a>
- <a class="btn btn-xs btn-danger" href="vpn_l2tp_users.php?act=del&amp;id=<?=$i?>" onclick="return confirm('<?=gettext("Do you really want to delete this user?")?>')"><?=gettext("delete")?></a>
+ <a class="btn btn-xs btn-danger" href="vpn_l2tp_users.php?act=del&amp;id=<?=$i?>"><?=gettext("delete")?></a>
</td>
</tr>
<?php $i++; endforeach?>
diff --git a/usr/local/www/widgets/widgets/captive_portal_status.widget.php b/usr/local/www/widgets/widgets/captive_portal_status.widget.php
index faba5c5..9b4f67b 100644
--- a/usr/local/www/widgets/widgets/captive_portal_status.widget.php
+++ b/usr/local/www/widgets/widgets/captive_portal_status.widget.php
@@ -123,8 +123,8 @@ if ($_GET['order']) {
<td><?php if ($cpent[11] && ($cpent[11] > 0)) echo date("m/d/Y H:i:s", $cpent[11]);?></td>
<?php endif; ?>
<td>
- <a href="?order=<?=htmlspecialchars($_GET['order']);?>&amp;showact=<?=$showact;?>&amp;act=del&amp;zone=<?=$cpent[10];?>&amp;id=<?=$cpent[5];?>" onclick="return confirm('Do you really want to disconnect this client?')">
- <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" alt="x" />
+ <a href="?order=<?=htmlspecialchars($_GET['order']);?>&amp;showact=<?=$showact;?>&amp;act=del&amp;zone=<?=$cpent[10];?>&amp;id=<?=$cpent[5];?>" class="btn btn-xs btn-danger">
+ delete
</a>
</td>
</tr>
OpenPOWER on IntegriCloud