".$lang_label["delete_event_ok"].""; audit_db($id_user,$REMOTE_ADDR, "Event deleted","Deleted event: ".return_event_description ($id_evento)); } } else { audit_db($id_user,$REMOTE_ADDR, "ACL Violation", "Trying to delete event ID".$id_evento); } } // Check Event (only incident write access). if (isset($_GET["check"])){ $id_evento = $_GET["check"]; // Look for event_id following parameters: id_group. $id_group = gime_idgroup_from_idevent($id_evento); if (give_acl($id_user, $id_group, "IW") ==1){ $sql2="UPDATE tevento SET estado = 1, id_usuario = '".$id_user."' WHERE id_evento = ".$id_evento; $result2=mysql_query($sql2); if ($result2) { echo "

".$lang_label["validate_event_ok"]."

"; audit_db($id_user,$REMOTE_ADDR, "Event validated","Validate event: ".return_event_description ($id_evento)); } else { echo "

".$lang_label["validate_event_failed"]."

"; } } else { audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to checkout event ".return_event_description ($id_evento)); } } // Mass-process DELETE if (isset($_POST["deletebt"])){ $count=0; while ($count <= $block_size){ if (isset($_POST["eventid".$count])){ $event_id = $_POST["eventid".$count]; // Look for event_id following parameters: id_group. $id_group = gime_idgroup_from_idevent($event_id); if (give_acl($id_user, $id_group, "IM") ==1){ mysql_query("DELETE FROM tevento WHERE id_evento = ".$event_id); audit_db($id_user,$REMOTE_ADDR, "Event deleted","Deleted event: ".return_event_description ($event_id)); } else { audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to delete event ".return_event_description ($event_id)); } } $count++; } } // Mass-process UPDATE if (isset($_POST["updatebt"])){ $count=0; while ($count <= $block_size){ if (isset($_POST["eventid".$count])){ $id_evento = $_POST["eventid".$count]; $id_group = gime_idgroup_from_idevent($id_evento); if (give_acl($id_user, $id_group, "IW") ==1){ $sql2="UPDATE tevento SET estado=1, id_usuario = '".$id_user."' WHERE estado = 0 AND id_evento = ".$id_evento; $result2=mysql_query($sql2); audit_db($id_user,$REMOTE_ADDR, "Event validated","Validate event: ".return_event_description ($id_evento)); } else { audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to checkout event ID".$id_evento); } } $count++; } } // *********************************************************************** // Main code form / page // *********************************************************************** // Get data $offset=0; if (isset($_GET["offset"])) $offset=$_GET["offset"]; if (isset($_GET["group_id"])) $group_id = entrada_limpia($_GET["group_id"]); else $group_id = 0; if (isset($_POST["ev_group"])) $ev_group = $_POST["ev_group"]; elseif (isset($_GET["group_id"])) $ev_group = $_GET["group_id"]; else $ev_group = -1; $event="All"; if (isset($_POST["event"])) $event = entrada_limpia($_POST["event"]); echo "

".$lang_label["events"]." > ".$lang_label["event_main_view"]." ".$lang_label["help"]."

"; echo ""; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
"; echo "

".$lang_label["filter"]."

"; echo "
".$lang_label["group"].""; echo ""; echo "
".$lang_label["events"].""; echo ""; echo ""; echo ""; echo ""; echo "
"; echo "
"; echo ""; echo "
"; echo ""; echo "
"; echo "
"; echo "
"; // How many events do I have in total ? if ($event=="All"){ if (isset($ev_group) && ($ev_group > 1)) { $sql3="SELECT COUNT(id_evento) FROM tevento WHERE id_grupo = '$ev_group' "; } else { $sql3="SELECT COUNT(id_evento) FROM tevento"; } } else { if (isset($ev_group) && ($ev_group > 1)) { $sql3="SELECT COUNT(id_evento) FROM tevento WHERE evento = '$event' AND id_grupo = '$ev_group'"; } else { $sql3="SELECT COUNT(id_evento) FROM tevento WHERE evento = '$event' "; } } $result3=mysql_query($sql3); $row3=mysql_fetch_array($result3); $total_events = $row3[0]; // Show pagination header if ($total_events > 0){ pagination ($total_events, "index.php?sec=eventos&sec2=operation/events/events&group_id=$ev_group&refr=60", $offset); // Show data. echo "
"; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "'; echo ""; $color = 1; $id_evento = 0; // Prepare index for pagination. Prepare queries if ($event=="All"){ if (isset($ev_group) && ($ev_group > 1)) { $sql2="SELECT * FROM tevento WHERE id_grupo = '$ev_group' ORDER BY timestamp DESC LIMIT $offset, $block_size"; } else { $sql2="SELECT * FROM tevento ORDER BY timestamp DESC LIMIT $offset, $block_size"; } } else { if (isset($ev_group) && ($ev_group > 1)) { $sql2="SELECT * FROM tevento WHERE evento = '$event' AND id_grupo = '$ev_group' ORDER BY timestamp DESC LIMIT $offset, $block_size"; } else { $sql2="SELECT * FROM tevento WHERE evento = '$event' ORDER BY timestamp DESC LIMIT $offset, $block_size"; } } $offset_counter=0; // Make query for data (all data, not only distinct). $result2=mysql_query($sql2); while ($row2=mysql_fetch_array($result2)){ $id_grupo = $row2["id_grupo"]; if (give_acl($id_user, $id_grupo, "IR") == 1){ // Only incident read access to view data ! $id_group = $row2["id_grupo"]; if ($color == 1){ $tdcolor = "datos"; $color = 0; } else { $tdcolor = "datos2"; $color = 1; } echo ""; echo ""; } $offset_counter++; } echo "
".$lang_label["status"]."".$lang_label["event_name"]."".$lang_label["agent_name"]."".$lang_label["group"]."".$lang_label["id_user"]."".$lang_label["timestamp"]."".$lang_label["action"].""; echo ""; echo '
"; if ($row2["estado"] == 0) echo ""; else echo ""; echo "".$row2["evento"]; if ($row2["id_agente"] > 0){ echo "".dame_nombre_agente($row2["id_agente"]).""; echo ""; } else { // for SNMP generated alerts echo "".$lang_label["alert"]." / SNMP"; echo ""; echo ""; } if ($row2["estado"] <> 0) echo "".substr($row2["id_usuario"],0,8)." ".dame_nombre_real($row2["id_usuario"]).""; echo "".$row2["timestamp"]; echo ""; if (($row2["estado"] == 0) and (give_acl($id_user,$id_group,"IW") ==1)) echo " "; if (give_acl($id_user,$id_group,"IM") ==1) echo " "; if (give_acl($id_user,$id_group,"IW") == 1) echo ""; echo ""; echo ""; echo "
"; echo "
"; echo " "; if (give_acl($id_user, 0,"IM") ==1){ echo ""; } echo "
"; echo ""; echo ""; echo ""; echo "
"; echo "

".$lang_label["status"]."

"; echo " - ".$lang_label["validated_event"]; echo "
"; echo " - ".$lang_label["not_validated_event"]; echo "
"; echo "

".$lang_label["action"]."

"; echo " - ".$lang_label["validate_event"]; echo "
"; echo " - ".$lang_label["delete_event"]; echo "
"; echo " - ".$lang_label["create_incident"]; echo "
"; } // no events to show ?>