diff options
author | Jim P <jim@pingle.org> | 2012-12-05 09:28:07 -0800 |
---|---|---|
committer | Jim P <jim@pingle.org> | 2012-12-05 09:28:07 -0800 |
commit | cce226127a4ddacc4d46a353770fbf7d47119a70 (patch) | |
tree | 326a9d77a6df1364472c304f2a290547aa9bffc8 /config | |
parent | 197e7e9b3454ac34cf2e0f9ab7e1b8a92f71971f (diff) | |
parent | 81f6a4d63d9766712cc3e5693d899d7405030f96 (diff) | |
download | pfsense-packages-cce226127a4ddacc4d46a353770fbf7d47119a70.tar.gz pfsense-packages-cce226127a4ddacc4d46a353770fbf7d47119a70.tar.bz2 pfsense-packages-cce226127a4ddacc4d46a353770fbf7d47119a70.zip |
Merge pull request #335 from tigersharke/master
Fix for empty array condition.
Diffstat (limited to 'config')
-rw-r--r-- | config/widget-snort/snort_alerts.widget.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/config/widget-snort/snort_alerts.widget.php b/config/widget-snort/snort_alerts.widget.php index 6d6193d8..bb51a387 100644 --- a/config/widget-snort/snort_alerts.widget.php +++ b/config/widget-snort/snort_alerts.widget.php @@ -29,10 +29,14 @@ global $config, $g; /* array sorting */ 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; + } if (count($array)) { $temp_array[key($array)] = array_shift($array); }; - foreach ($array as $key => $val){ $offset = 0; $found = false; @@ -49,6 +53,8 @@ function sksort(&$array, $subkey="id", $sort_ascending=false) { if ($sort_ascending) { $array = array_reverse($temp_array); } else $array = $temp_array; + /* below is the complement for empty array test */ + return true; }; /* check if firewall widget variable is set */ @@ -128,4 +134,4 @@ if (is_array($snort_alerts)) { }; ?> </tbody> -</table>
\ No newline at end of file +</table> |