' . print_image("images/normalscreen.png", true, array("title" => __('Normal screen'))) . ''; } else { // Fullscreen $link = '' . print_image("images/fullscreen.png", true, array("title" => __('Full screen'))) . ''; } // Header ui_print_page_header (__("SNMP Console"), "images/computer_error.png", false, "", false, $link); // OPERATIONS // Delete SNMP Trap entry Event (only incident management access). if (isset ($_GET["delete"])){ $id_trap = (int) get_parameter_get ("delete", 0); if ($id_trap > 0 && check_acl ($config['id_user'], 0, "IM")) { $result = db_process_sql_delete('ttrap', array('id_trap' => $id_trap)); ui_print_result_message ($result, __('Successfully deleted'), __('Could not be deleted')); } else { db_pandora_audit("ACL Violation", "Trying to delete SNMP event ID #".$id_trap); } } // Check Event (only incident write access). if (isset ($_GET["check"])) { $id_trap = (int) get_parameter_get ("check", 0); if ($id_trap > 1 && check_acl ($config['id_user'], 0, "IW")) { $values = array( 'status' => 1, 'id_usuario' => $config["id_user"]); $result = db_process_sql_update('ttrap', $values, array('id_trap' => $id_trap)); ui_print_result_message ($result, __('Successfully updated'), __('Could not be updated')); } else { db_pandora_audit("ACL Violation", "Trying to checkout SNMP Trap ID".$id_trap); } } // Mass-process DELETE if (isset ($_POST["deletebt"])) { $trap_ids = get_parameter_post ("snmptrapid", array ()); if (is_array ($trap_ids) && check_acl ($config['id_user'], 0, "IW")) { foreach ($trap_ids as $id_trap) { db_process_sql_delete('ttrap', array('id_trap' => $id_trap)); } } else { db_pandora_audit("ACL Violation", "Trying to mass-delete SNMP Trap ID"); } } // Mass-process UPDATE if (isset ($_POST["updatebt"])) { $trap_ids = get_parameter_post ("snmptrapid", array ()); if (is_array ($trap_ids) && check_acl ($config['id_user'], 0, "IW")) { foreach ($trap_ids as $id_trap) { $sql = sprintf ("UPDATE ttrap SET status = 1, id_usuario = '%s' WHERE id_trap = %d", $config["id_user"], $id_trap); db_process_sql ($sql); } } else { db_pandora_audit("ACL Violation", "Trying to mass-delete SNMP Trap ID"); } } switch ($config["dbtype"]) { case "mysql": $sql = sprintf ("SELECT * FROM ttrap ORDER BY timestamp DESC LIMIT %d,%d",$offset,$pagination); break; case "postgresql": $sql = sprintf ("SELECT * FROM ttrap ORDER BY timestamp DESC LIMIT %d OFFSET %d", $pagination, $offset); break; case "oracle": $set = array(); $set['limit'] = $pagination; $set['offset'] = $offset; $sql = sprintf ("SELECT * FROM ttrap ORDER BY timestamp DESC"); $sql = oracle_recode_query ($sql, $set); break; } $traps = db_get_all_rows_sql ($sql); if (($config['dbtype'] == 'oracle') && ($traps !== false)) { for ($i=0; $i < count($traps); $i++) { unset($traps[$i]['rnum']); } } // No traps if (empty ($traps)) { echo '