diff --git a/alerts.php b/alerts.php index e2a13c8579..80a52a5b78 100755 --- a/alerts.php +++ b/alerts.php @@ -185,6 +185,13 @@ function RunFollowUp() $alert['query'] = GenSQL($alert['rule']); } $chk = dbFetchRows($alert['query'], array($alert['device_id'])); + //make sure we can json_encode all the datas later + $cnt = count($chk); + for ($i = 0; $i < $cnt; $i++) { + if (isset($chk[$i]['ip'])) { + $chk[$i]['ip'] = inet6_ntop($chk[$i]['ip']); + } + } $o = sizeof($alert['details']['rule']); $n = sizeof($chk); $ret = 'Alert #'.$alert['id']; diff --git a/includes/alerts.inc.php b/includes/alerts.inc.php index 137a7f3fb4..5504f226d9 100644 --- a/includes/alerts.inc.php +++ b/includes/alerts.inc.php @@ -171,8 +171,11 @@ function RunRules($device) } $sql = $rule['query']; $qry = dbFetchRows($sql, array($device)); - if (isset($qry[0]['ip'])) { - $qry[0]['ip'] = inet6_ntop($qry[0]['ip']); + $cnt = count($qry); + for ($i = 0; $i < $cnt; $i++) { + if (isset($qry[$i]['ip'])) { + $qry[$i]['ip'] = inet6_ntop($qry[$i]['ip']); + } } $s = sizeof($qry); if ($s == 0 && $inv === false) {