, 2003-2006
// Raul Mateos , 2005-2006
// Load globar var
require("include/config.php");
//require("include/functions.php");
//require("include/functions_db.php");
if (comprueba_login() == 0) {
$accion = "";
$id_usuario =$_SESSION["id_usuario"];
if (give_acl($id_usuario, 0, "AR")==1) {
// OPERATIONS
// Delete Event (only incident management access).
if (isset($_GET["delete"])){
$id_evento = $_GET["delete"];
// Look for event_id following parameters: id_group.
$id_group = gime_idgroup_from_idevent($id_evento);
if (give_acl($id_usuario, $id_group, "IM") ==1){
$sql2="DELETE FROM tevento WHERE id_evento =".$id_evento;
$result2=mysql_query($sql2);
if ($result) {echo "".$lang_label["delete_event_ok"]."
";}
} else {
audit_db($id_usuario,$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_usuario, $id_group, "IW") ==1){
$sql2="UPDATE tevento SET estado=1, id_usuario = '".$id_usuario."' WHERE id_evento = ".$id_evento;
$result2=mysql_query($sql2);
if ($result2) { echo "".$lang_label["validate_event_ok"]."
";}
} else {
audit_db($id_usuario,$REMOTE_ADDR, "ACL Violation","Trying to checkout event ID".$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_usuario, $id_group, "IM") ==1){
mysql_query("DELETE FROM tevento WHERE id_evento =".$event_id);
} else {
audit_db($id_usuario,$REMOTE_ADDR, "ACL Violation","Trying to delete event ID".$id_evento);
}
}
$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_usuario, $id_group, "IW") ==1){
$sql2="UPDATE tevento SET estado=1, id_usuario = '".$id_usuario."' WHERE estado = 0 and id_evento = ".$id_evento;
$result2=mysql_query($sql2);
} else {
audit_db($id_usuario,$REMOTE_ADDR, "ACL Violation","Trying to checkout event ID".$id_evento);
}
}
$count++;
}
}
echo "".$lang_label["events"]."
";
echo "".$lang_label["event_main_view"]."![](images/help.gif)
";
// Prepare index for pagination
$event_list[]="";
$sql2="SELECT * FROM tevento ORDER BY timestamp DESC";
$result2=mysql_query($sql2);
if (mysql_num_rows($result2)){
while ($row2=mysql_fetch_array($result2)){ // Jump offset records
$id_grupo = $row2["id_grupo"];
if (give_acl($id_usuario, $id_grupo, "IR") == 1) // Only incident read access to view data !
$event_list[]=$row2["id_evento"];
}
if (isset($_GET["offset"]))
$offset=$_GET["offset"];
else
$offset=0;
$offset_counter=0;
echo "";
echo "";
echo " - ".$lang_label["validated_event"];
echo " ";
echo " - ".$lang_label["not_validated_event"];
echo " | ";
echo "";
echo " - ".$lang_label["validate_event"];
echo " ";
echo " - ".$lang_label["delete_event"];
echo " | ";
echo "
";
echo "
";
//pagination
$total_eventos = count($event_list);
pagination($total_eventos, "index.php?sec=eventos&sec2=operation/events/events", $offset);
/*
if ($total_eventos > $block_size){
// If existes more registers tha$row["id_usuario"]n i can put in a page, calculate index markers
$index_counter = ceil($total_eventos/$block_size);
for ($i = 1; $i <= $index_counter; $i++) {
$inicio_bloque = ($i * $block_size - $block_size);
$final_bloque = $i * $block_size;
if ($total_eventos < $final_bloque)
$final_bloque = $total_eventos;
echo '';
$inicio_bloque_fake = $inicio_bloque + 1;
if ($inicio_bloque == $offset)
echo '[ '.$inicio_bloque_fake.' - '.$final_bloque.' ]';
else
echo '[ '.$inicio_bloque_fake.' - '.$final_bloque.' ]';
echo ' ';
}
echo "
";
// if exists more registers than i can put in a page (defined by $block_size config parameter)
// get offset for index calculation
}
echo "";
*/
if (isset($_GET["offset"])){
$offset=entrada_limpia($_GET["offset"]);
} else {
$offset=0;
}
echo "
";
echo "";
}
else {echo "".$lang_label["no_event"]."";}
}
else {
audit_db($id_user,$REMOTE_ADDR, "ACL Violation","Trying to access event viewer");
require ("general/noaccess.php");
}
}
?>