From f06f7cc0c2051e3e5e507d6b95583fcc32b7890e Mon Sep 17 00:00:00 2001 From: PiBa-NL Date: Sun, 16 Sep 2012 12:17:17 +0200 Subject: (line endings UNIX format..) Firewall log alternating colored rows Firewall log sortable Fixed several sorting issues in widgets and other pages Sorting now possible on multiple rows in the header tables Sorting now possible for text that starts with IPv4:port --- etc/inc/filter_log.inc | 2 +- usr/local/www/css/table.css | 42 +++++++++++ usr/local/www/diag_dump_states.php | 1 - usr/local/www/diag_dump_states_sources.php | 1 - usr/local/www/diag_logs_filter.php | 51 +++++++------ usr/local/www/diag_routes.php | 12 ++- usr/local/www/head.inc | 10 ++- usr/local/www/javascript/filter_log.js | 4 +- usr/local/www/javascript/sorttable.js | 87 +++++++++++++++++----- usr/local/www/status_captiveportal.php | 1 - usr/local/www/status_lb_pool.php | 1 - usr/local/www/status_openvpn.php | 3 +- usr/local/www/themes/pfsense-dropdown/all.css | 2 +- usr/local/www/themes/pfsense_ng/all.css | 4 - .../widgets/captive_portal_status.widget.php | 1 - usr/local/www/widgets/widgets/openvpn.widget.php | 26 ++++--- 16 files changed, 181 insertions(+), 67 deletions(-) create mode 100644 usr/local/www/css/table.css diff --git a/etc/inc/filter_log.inc b/etc/inc/filter_log.inc index 2bfc895..d55d332 100644 --- a/etc/inc/filter_log.inc +++ b/etc/inc/filter_log.inc @@ -257,7 +257,7 @@ function find_rule_by_number_buffer($rulenum, $type){ list(,$rulename,) = explode("\"",$ruleString); $rulename = str_replace("USER_RULE: ",'USER_RULE ',$rulename); } - return "@".$rulenum." ".$rulename; + return $rulename." (@".$rulenum.")"; } function find_action_image($action) { diff --git a/usr/local/www/css/table.css b/usr/local/www/css/table.css new file mode 100644 index 0000000..29ae503 --- /dev/null +++ b/usr/local/www/css/table.css @@ -0,0 +1,42 @@ +/* Element CSS Definitions for (MultiRow-)tables +if theme changes are needed include a table.css in the /themes/yourtheme/ */ +.listMR { + background-color: #DDD; + font-size: 11px; + padding-left: 6px; + padding-top: 2px; + padding-bottom: 2px; +} +.listMRlr { + border-right: 1px solid #999999; + border-bottom: 1px solid #999999; + border-left: 1px solid #999999; + font-size: 11px; + padding-right: 6px; + padding-left: 6px; + padding-top: 4px; + padding-bottom: 4px; +} +.listMRr { + border-right: 1px solid #999999; + border-bottom: 1px solid #999999; + font-size: 11px; + padding-right: 6px; + padding-left: 6px; + padding-top: 4px; + padding-bottom: 4px; +} +.listMRodd { + background-color: #FFFFFF; +} +.listMReven { + background-color: #F0F0F0; +} +.listMRDescriptionL { + border-right: none; + border-bottom: 2px solid #999999; +} +.listMRDescriptionR { + border-left: none; + border-bottom: 2px solid #999999; +} diff --git a/usr/local/www/diag_dump_states.php b/usr/local/www/diag_dump_states.php index b368542..ef00595 100755 --- a/usr/local/www/diag_dump_states.php +++ b/usr/local/www/diag_dump_states.php @@ -78,7 +78,6 @@ include("head.inc"); ?> "> -
diff --git a/usr/local/www/diag_dump_states_sources.php b/usr/local/www/diag_dump_states_sources.php index 6081291..791cd68 100644 --- a/usr/local/www/diag_dump_states_sources.php +++ b/usr/local/www/diag_dump_states_sources.php @@ -68,7 +68,6 @@ include("head.inc"); ?> "> - diff --git a/usr/local/www/diag_logs_filter.php b/usr/local/www/diag_logs_filter.php index ce076ab..193585a 100755 --- a/usr/local/www/diag_logs_filter.php +++ b/usr/local/www/diag_logs_filter.php @@ -116,7 +116,8 @@ include("head.inc");
- +
"> + - - - - + + + - - + + - - + - - + + ".find_rule_by_number_buffer($filterent['rulenum'],$filterent['act']).""); + echo(""); $int = strtolower($filterent['interface']); $proto = strtolower($filterent['proto']); @@ -188,14 +193,14 @@ include("head.inc"); $srcstr = $filterent['srcip'] . get_port_with_service($filterent['srcport'], $proto); $dststr = $filterent['dstip'] . get_port_with_service($filterent['dstport'], $proto); ?> - - + - - + + + +
@@ -130,7 +131,7 @@ include("head.inc"); | |

- Show/hide rule descriptions + Show/hide rule descriptions
@@ -148,32 +149,36 @@ include("head.inc"); printf(gettext("Max(%s)"),$nentries);?>
+ + - - + +
+ $rowIndex = 0; + foreach ($filterlog as $filterent): + $evenRowClass = $rowIndex % 2 ? " listMReven" : " listMRodd"; + $rowIndex++;?> +
', outputrule);"> <?php echo $filterent['act'];?>
".find_rule_by_number_buffer($filterent['rulenum'],$filterent['act'])." + "> Icon Reverse Resolve with DNS " title="" onclick="return confirm('')"> Icon Easy Rule: Add to Block List + "> Icon Reverse Resolve with DNS " title="" onclick="return confirm('')"> @@ -206,12 +211,12 @@ include("head.inc"); if ($filterent['proto'] == "TCP") $filterent['proto'] .= ":{$filterent['tcpflags']}"; ?> -
-
+
@@ -235,6 +241,7 @@ include("head.inc");
diff --git a/usr/local/www/diag_routes.php b/usr/local/www/diag_routes.php index 980150f..e4a364f 100644 --- a/usr/local/www/diag_routes.php +++ b/usr/local/www/diag_routes.php @@ -86,18 +86,24 @@ include('head.inc'); $elements = ($tabindex == 0 ? 8 : 8); $name = ($tabindex == 0 ? 'IPv4' : 'IPv6'); ?> - +
+ $line) { if ($i == 0) continue; + if ($line == "") continue; if ($i == 1) $class = 'listhdrr'; else $class = 'listlr'; - print("\n"); + if ($i == 1) + print("\n"); + else + print("\n"); + $j = 0; foreach (explode(' ', $line) as $entry) { if ($entry == '') continue; @@ -112,6 +118,8 @@ include('head.inc'); if ($j == $elements - 1) print('' . "\n"); print("\n"); + if ($i == 1) + print("\n"); } print("
 
\n"); } diff --git a/usr/local/www/head.inc b/usr/local/www/head.inc index 6301d14..e73ab0a 100755 --- a/usr/local/www/head.inc +++ b/usr/local/www/head.inc @@ -33,7 +33,15 @@ $pagetitle = gentitle( $pgtitle ); <?php echo($config['system']['hostname'] . "." . $config['system']['domain'] . " - " . $pagetitle); ?> - "; + else: + echo ""; + endif; + ?> + + "; ?> diff --git a/usr/local/www/javascript/filter_log.js b/usr/local/www/javascript/filter_log.js index 1acb5c2..76c21e2 100644 --- a/usr/local/www/javascript/filter_log.js +++ b/usr/local/www/javascript/filter_log.js @@ -121,12 +121,12 @@ if (typeof updateDelay != 'undefined') { timer = setInterval('fetch_new_rules()', updateDelay); } -function showRuleDescriptions(){ +function toggleListDescriptions(){ var ss = document.styleSheets; for (var i=0; i + for (var i=0; i=0; i--) { - tbody.appendChild(newrows[i]); + for (var i=newrows.length-1; i>=0; i-=sortableMultirow) { + for(var j=sortableMultirow-1;j>=0;j--) + { + tbody.appendChild(newrows[i-j]); + } } delete newrows; }, @@ -346,12 +386,25 @@ sorttable = { function ip2ulong(ip) { ip += ""; var ulip = false; - var octets = []; - if (ip.match(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/)) { - octets = ip.split('.'); + var octets = []; + ipmatch = ip.match(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/);// IP only + if (ipmatch) { + ipmatch+=""; + octets = ipmatch.split('.'); for (i=0; i < 4; i++) { - ulip += octets[i] * Math.pow(256, (3-i)); + ulip += octets[i] * Math.pow(256, (5-i)); } + } else { + ipportmatch = ip.match(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\:[0-9]{1,5}\b/);// IP:port + if (ipportmatch) { + ipportmatch += ""; + ipport = ipportmatch.split(':'); + octets = ipport[0].split('.'); + for (i=0; i < 4; i++) { + ulip += octets[i] * Math.pow(256, (5-i)); + } + ulip += parseInt(ipport[1]); + } } return ulip; } diff --git a/usr/local/www/status_captiveportal.php b/usr/local/www/status_captiveportal.php index e3474f2..0963a61 100755 --- a/usr/local/www/status_captiveportal.php +++ b/usr/local/www/status_captiveportal.php @@ -67,7 +67,6 @@ include("head.inc"); ?> - -

diff --git a/usr/local/www/status_openvpn.php b/usr/local/www/status_openvpn.php index 326e94a..330333d 100644 --- a/usr/local/www/status_openvpn.php +++ b/usr/local/www/status_openvpn.php @@ -106,7 +106,6 @@ $clients = openvpn_get_active_clients(); include("head.inc"); ?> "> - -