diff options
author | bmeeks8 <bmeeks8@bellsouth.net> | 2014-01-01 19:38:15 -0500 |
---|---|---|
committer | bmeeks8 <bmeeks8@bellsouth.net> | 2014-01-01 19:38:15 -0500 |
commit | beecaccfc9db3821f17dfa5a893619a49a010438 (patch) | |
tree | 2ac046e2823164cfd8b662e878d4ba30524541ab /config/widget-snort | |
parent | c7f59df06f608245bbc8ea657ff8ce93bd64e796 (diff) | |
download | pfsense-packages-beecaccfc9db3821f17dfa5a893619a49a010438.tar.gz pfsense-packages-beecaccfc9db3821f17dfa5a893619a49a010438.tar.bz2 pfsense-packages-beecaccfc9db3821f17dfa5a893619a49a010438.zip |
Put year first in timestamp field for proper sorting
Diffstat (limited to 'config/widget-snort')
-rw-r--r-- | config/widget-snort/snort_alerts.widget.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/config/widget-snort/snort_alerts.widget.php b/config/widget-snort/snort_alerts.widget.php index 691b03a3..ddf8ac59 100644 --- a/config/widget-snort/snort_alerts.widget.php +++ b/config/widget-snort/snort_alerts.widget.php @@ -35,9 +35,7 @@ global $config, $g; function sksort(&$array, $subkey="id", $sort_ascending=false) { /* an empty array causes sksort to fail - this test alleviates the error */ if(empty($array)) - { - return false; - } + return false; if (count($array)) { $temp_array[key($array)] = array_shift($array); }; @@ -100,7 +98,9 @@ if (file_exists("/usr/local/pkg/snort/snort.inc")) { continue; $snort_alerts[$counter]['instanceid'] = $a_instance[$instanceid]['interface']; - $snort_alerts[$counter]['timestamp'] = $fields[0]; + // fields[0] is the timestamp. Reverse its date order to YY/MM/DD for proper sorting + $tmp = substr($fields[0],6,2) . '/' . substr($fields[0],0,2) . '/' . substr($fields[0],3,2); + $snort_alerts[$counter]['timestamp'] = str_replace(substr($fields[0],0,8),$tmp,$fields[0]); $snort_alerts[$counter]['timeonly'] = substr($fields[0], strpos($fields[0], '-')+1, -8); $snort_alerts[$counter]['dateonly'] = substr($fields[0], 0, strpos($fields[0], '-')); $snort_alerts[$counter]['src'] = $fields[6]; |