diff --git a/src/www/diag_logs_filter_summary.php b/src/www/diag_logs_filter_summary.php index 393f31201..5c406a2d4 100644 --- a/src/www/diag_logs_filter_summary.php +++ b/src/www/diag_logs_filter_summary.php @@ -1,30 +1,30 @@ - All rights reserved. + Copyright (C) 2014-2015 Deciso B.V. - J. Schellevis + Copyright (C) 2009 Jim Pingle + 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. */ require_once("guiconfig.inc"); @@ -47,33 +47,33 @@ $filterlog = conv_log_filter($filter_logfile, $lines, $lines); $gotlines = count($filterlog); // Set readable fieldnames $fields = array( - 'act' => gettext("Actions"), - 'interface' => gettext("Interfaces"), - 'proto' => gettext("Protocols"), - 'srcip' => gettext("Source IPs"), - 'dstip' => gettext("Destination IPs"), - 'srcport' => gettext("Source Ports"), - 'dstport' => gettext("Destination Ports")); + 'act' => gettext("Actions"), + 'interface' => gettext("Interfaces"), + 'proto' => gettext("Protocols"), + 'srcip' => gettext("Source IPs"), + 'dstip' => gettext("Destination IPs"), + 'srcport' => gettext("Source Ports"), + 'dstport' => gettext("Destination Ports")); $summary = array(); foreach (array_keys($fields) as $f) { - $summary[$f] = array(); + $summary[$f] = array(); } // Fill summary array with filterlog data foreach ($filterlog as $fe) { - foreach (array_keys($fields) as $field) { - if (isset($fe[$field])) { - if (!isset($summary[$field])) { - $summary[$field] = array(); - } - if (!isset($summary[$field][$fe[$field]])) { - $summary[$field][$fe[$field]] = 0; - } - $summary[$field][$fe[$field]]++; - } - } + foreach (array_keys($fields) as $field) { + if (isset($fe[$field])) { + if (!isset($summary[$field])) { + $summary[$field] = array(); + } + if (!isset($summary[$field][$fe[$field]])) { + $summary[$field][$fe[$field]] = 0; + } + $summary[$field][$fe[$field]]++; + } + } } // Custom sorting function @@ -86,27 +86,27 @@ function cmp($a, $b) { // Setup full data array for pie and table function d3pie_data($summary, $num) { - $data=array(); - foreach (array_keys($summary) as $stat) { - uasort($summary[$stat] , 'cmp'); - $other=0; - foreach(array_keys($summary[$stat]) as $key) { + $data=array(); + foreach (array_keys($summary) as $stat) { + uasort($summary[$stat] , 'cmp'); + $other=0; + foreach(array_keys($summary[$stat]) as $key) { - if (!isset($data[$stat])) { - $data[$stat] = array(); - } - if ( count($data[$stat]) < $num ) { - $data[$stat][] = array('label' => $key, 'value' => $summary[$stat][$key]); - } else { - $other+=$summary[$stat][$key]; - } - } - if ($other > 0) { - $data[$stat][] = array('label' => gettext("other"), 'value' => $other); - } - } + if (!isset($data[$stat])) { + $data[$stat] = array(); + } + if ( count($data[$stat]) < $num ) { + $data[$stat][] = array('label' => $key, 'value' => $summary[$stat][$key]); + } else { + $other+=$summary[$stat][$key]; + } + } + if ($other > 0) { + $data[$stat][] = array('label' => gettext("other"), 'value' => $other); + } + } - return $data; + return $data; } include("head.inc"); ?> @@ -114,102 +114,104 @@ include("head.inc"); ?> -
-
-
- - 0) print_input_errors($input_errors); ?> -
-
-
- - - - - -
- - -
-
- " /> -
-
-
-
-
-
+
+
+
+ + 0) print_input_errors($input_errors); ?> +
+
+
+ + + + + +
+ + +
+
+ " /> +
+
+
+
+
+
-
- - - - -
-

-
-
- -
- - - - - - - - - - - -
- - " title="".gettext("Reverse Resolve with DNS").""> - -
-
-
- -
-
-
-
+
+ + + + +
+

+
+
+ +
+ + + + + + + + + + + + + +
+ + " title=""> + +
+
+
+ +
+
+
+