2012-10-15 Vanessa Gil <vanessa.gil@artica.es>

* include/functions_api.php: Added function validate_event_
	by_id.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7072 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
vgilc 2012-10-15 08:44:40 +00:00
parent 1ee1923efb
commit a7162b0f6b
2 changed files with 44 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2012-10-15 Vanessa Gil <vanessa.gil@artica.es>
* include/functions_api.php: Added function validate_event_
by_id.
2012-10-11 Sergio Martin <sergio.martin@artica.es>
* include/functions_events.php

View File

@ -5622,4 +5622,43 @@ function api_get_netflow_get_summary ($discard_1, $discard_2, $params) {
return;
}
//http://localhost/pandora_console/include/api.php?op=set&op2=validate_event_by_id&id=23&apipass=1234&user=admin&pass=pandora
function api_set_validate_event_by_id ($id, $trash1, $trash2, $returnType) {
global $config;
$data['type'] = 'string';
$check_id = db_get_value('id_evento', 'tevento', 'id_evento', $id);
if ($check_id) { //event exists
$status = db_get_value('estado', 'tevento', 'id_evento', $id);
if ($status == 1) { //event already validated
$data['data'] = "Event already validated";
} else {
$ack_utimestamp = time();
events_comment_event($id, '', '', "Change status to validated");
$values = array(
'ack_utimestamp' => $ack_utimestamp,
'estado' => 1
);
$result = db_process_sql_update('tevento', $values, array('id_evento' => $id));
if ($result === false) {
$data['data'] = "Error validating event";
}
else {
$data['data'] = "Event validate";
}
}
} else {
$data['data'] = "Event not exists";
}
returnData($returnType, $data);
return;
}
?>