function make_sensor_filter($conn, $alias = "acid_event") { $sensor_where = ""; if (Session::allowedSensors() != "") { $user_sensors = explode(",", Session::allowedSensors()); $snortsensors = GetSnortSensorSids($conn); $sids = array(); foreach ($user_sensors as $user_sensor) { //echo "Sids de $user_sensor ".$snortsensors[$user_sensor][0]."<br>"; if (count($snortsensors[$user_sensor]) > 0) { foreach ($snortsensors[$user_sensor] as $sid) { if ($sid != "") { $sids[] = $sid; } } } } $sensor_where = count($sids) > 0 ? " AND {$alias}.sid in (" . implode(",", $sids) . ")" : " AND {$alias}.sid in (0)"; // Vacio } return $sensor_where; }
if (ossim_error()) { die(ossim_error()); } // Default values (customize them into each type) $nodata_text = _("No events found"); $text_column = _("Event"); $value_column = _("Count"); $f_url = "javascript:return false;"; $db = new ossim_db(); $conn = $db->connect(); $conn2 = $db->snort_connect(); $sensor_where = ""; $sensor_where_ossim = ""; if (Session::allowedSensors() != "") { $user_sensors = explode(",", Session::allowedSensors()); $snortsensors = GetSnortSensorSids($conn2); $sids = array(); foreach ($user_sensors as $user_sensor) { //echo "Sids de $user_sensor ".$snortsensors[$user_sensor][0]."<br>"; if (count($snortsensors[$user_sensor]) > 0) { foreach ($snortsensors[$user_sensor] as $sid) { if ($sid != "") { $sids[] = $sid; } } } } if (count($sids) > 0) { $sensor_where = " AND a.sid in (" . implode(",", $sids) . ")"; $sensor_where_ossim = " AND a.snort_sid in (" . implode(",", $sids) . ")"; } else {