mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 00:04:37 +02:00
2008-07-21 Esteban Sanchez <estebans@artica.es>
* godmode/reporting/graph_builder.php, operation/snmpconsole/snmp_alert.php: Applied patch from Kato Atsushi. * include/functions_reporting.php, operation/reporting/reporting_viewer.php, godmode/reporting/reporting_builder.php: Adopted to changes in get_db_* functions. * include/functions_db.php: Removed quotes sorrounding %d characters in sprintf. Returned empty array on get_simple_alerts_in_agent() and get_combined_alerts_in_agent(). Style correction. Return all fields on get_db_all_fields_in_table(). * ChangeLog: Updated previous commit message format and date. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@964 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
590aa8a794
commit
06f095f3e6
@ -1,34 +1,47 @@
|
|||||||
2008-07-17 Evi Vanoost <vanooste@rcbi.rochester.edu>
|
2008-07-21 Esteban Sanchez <estebans@artica.es>
|
||||||
|
|
||||||
|
* godmode/reporting/graph_builder.php,
|
||||||
|
operation/snmpconsole/snmp_alert.php: Applied patch from Kato
|
||||||
|
Atsushi.
|
||||||
|
|
||||||
|
* include/functions_reporting.php,
|
||||||
|
operation/reporting/reporting_viewer.php,
|
||||||
|
godmode/reporting/reporting_builder.php: Adopted to changes in
|
||||||
|
get_db_* functions.
|
||||||
|
|
||||||
|
* include/functions_db.php: Removed quotes sorrounding %d characters
|
||||||
|
in sprintf. Returned empty array on get_simple_alerts_in_agent() and
|
||||||
|
get_combined_alerts_in_agent(). Style correction. Return all fields on
|
||||||
|
get_db_all_fields_in_table().
|
||||||
|
|
||||||
|
* ChangeLog: Updated previous commit message format and date.
|
||||||
|
|
||||||
|
2008-07-21 Evi Vanoost <vanooste@rcbi.rochester.edu>
|
||||||
|
|
||||||
* godmode/db/*.php
|
* godmode/db/*.php: require_once for config might already have loaded.
|
||||||
-require_once for config might already have loaded
|
Changed mysql_real_escape_string in favor of get_parameter_post.
|
||||||
-Changed mysql_real_escape_string in favor of get_parameter_post
|
Process the DELETE SQL queries through process_sql(). Changed
|
||||||
-Process the DELETE SQL queries through process_sql()
|
comprueba_login() for check_login(). Adhered some things to preferred
|
||||||
-Changed comprueba_login() for check_login()
|
style. Compounded SQL queries into joins, subqueries or functions.
|
||||||
-Adhered some things to preferred style
|
Removed mysql_close() from db_purge.php since the select. After the
|
||||||
-Compounded SQL queries into joins, subqueries or functions
|
delete wouldn't work anymore (database closed).
|
||||||
-Removed mysql_close() from db_purge.php since the select
|
|
||||||
after the delete wouldn't work anymore (database closed)
|
|
||||||
|
|
||||||
* godmode/reporting/reporting_builder.php
|
* godmode/reporting/reporting_builder.php: Fixed a bug that was
|
||||||
-Fixed a bug that was introduced when the SQL functions returned false
|
introduced when the SQL functions returned false.
|
||||||
|
|
||||||
* include/functions_db.php
|
* include/functions_db.php: Made foreach instead of while loops for
|
||||||
-Made foreach instead of while loops for simpler functions
|
simpler functions. Fixed get_reports that failed since SQL function
|
||||||
-Fixed get_reports that failed since SQL function return false
|
return false. All SQL functions now return false in case of empty. New
|
||||||
-All SQL functions now return false in case of empty
|
SQL function process_sql that can handle DELETE. Returns affected rows
|
||||||
-New SQL function process_sql that can handle DELETE. Returns
|
in case of a changing query or an array in case it was a selecting
|
||||||
affected rows in case of a changing query or an array in case
|
query or false in case of error.
|
||||||
it was a selecting query or false in case of error
|
|
||||||
|
|
||||||
* include/functions.php
|
* include/functions.php: Simplified safe_input function.
|
||||||
-Simplified safe_input function
|
|
||||||
|
|
||||||
* index.php
|
* index.php: Updated SQL queries, style changes
|
||||||
-Updated SQL queries, style changes
|
|
||||||
|
|
||||||
* operation/agentes/*.php
|
* operation/agentes/*.php: Style changes and updates to use
|
||||||
-Style changes and updates to use check_login
|
check_login.
|
||||||
|
|
||||||
2008-07-17 Esteban Sanchez <estebans@artica.es>
|
2008-07-17 Esteban Sanchez <estebans@artica.es>
|
||||||
|
|
||||||
@ -190,7 +203,6 @@
|
|||||||
* godmode/reporting/map_builder.php: Sorted lists, and shown module name
|
* godmode/reporting/map_builder.php: Sorted lists, and shown module name
|
||||||
instead description.
|
instead description.
|
||||||
|
|
||||||
|
|
||||||
2008-07-09 Evi Vanoost <vanooste@rcbi.rochester.edu>
|
2008-07-09 Evi Vanoost <vanooste@rcbi.rochester.edu>
|
||||||
|
|
||||||
* pandoradb.sql: Updated indexes
|
* pandoradb.sql: Updated indexes
|
||||||
|
@ -208,9 +208,9 @@ if (isset($chunk1)) {
|
|||||||
echo "<form method='post' action='index.php?sec=greporting&sec2=godmode/reporting/graph_builder&delete_module=1'>";
|
echo "<form method='post' action='index.php?sec=greporting&sec2=godmode/reporting/graph_builder&delete_module=1'>";
|
||||||
if (isset($chunkdata))
|
if (isset($chunkdata))
|
||||||
echo "<input type='hidden' name='chunk' value='$chunkdata'>";
|
echo "<input type='hidden' name='chunk' value='$chunkdata'>";
|
||||||
if (isset($id_agent))
|
if ($id_agent)
|
||||||
echo "<input type='hidden' name='id_agent' value='$id_agent'>";
|
echo "<input type='hidden' name='id_agent' value='$id_agent'>";
|
||||||
if (isset($period))
|
if ($period)
|
||||||
echo "<input type='hidden' name='period' value='$period'>";
|
echo "<input type='hidden' name='period' value='$period'>";
|
||||||
|
|
||||||
echo "<table width='500' cellpadding=4 cellpadding=4 class='databox'>";
|
echo "<table width='500' cellpadding=4 cellpadding=4 class='databox'>";
|
||||||
@ -283,18 +283,11 @@ echo "</b>";
|
|||||||
echo "<td class='datos' colspan=2>";
|
echo "<td class='datos' colspan=2>";
|
||||||
|
|
||||||
print_select_from_sql ('SELECT id_agente, nombre FROM tagente WHERE disabled = 0 ORDER BY nombre', 'id_agent', $id_agent, '', '--', 0);
|
print_select_from_sql ('SELECT id_agente, nombre FROM tagente WHERE disabled = 0 ORDER BY nombre', 'id_agent', $id_agent, '', '--', 0);
|
||||||
if (isset($chunkdata))
|
|
||||||
echo "<input type='hidden' name='chunk' value='$chunkdata'>";
|
|
||||||
|
|
||||||
// -----------------------
|
|
||||||
// SOURCE MODULE FORM
|
// SOURCE MODULE FORM
|
||||||
// -----------------------
|
if (isset ($chunkdata))
|
||||||
if (isset($chunkdata))
|
|
||||||
echo "<input type='hidden' name='chunk' value='$chunkdata'>";
|
echo "<input type='hidden' name='chunk' value='$chunkdata'>";
|
||||||
|
|
||||||
if (isset($id_agent))
|
|
||||||
echo "<input type='hidden' name='id_agent' value='$id_agent'>";
|
|
||||||
|
|
||||||
echo "<tr><td class='datos2'>";
|
echo "<tr><td class='datos2'>";
|
||||||
echo "<b>".$lang_label["modules"]."</b>";
|
echo "<b>".$lang_label["modules"]."</b>";
|
||||||
echo "<td class='datos2' colspan=3>";
|
echo "<td class='datos2' colspan=3>";
|
||||||
|
@ -439,36 +439,38 @@ if ($edit_sla_report_content) {
|
|||||||
$first_id = $report_contents[0]['id_rc'];
|
$first_id = $report_contents[0]['id_rc'];
|
||||||
$last_id = $report_contents[sizeof ($report_contents) - 1]['id_rc'];
|
$last_id = $report_contents[sizeof ($report_contents) - 1]['id_rc'];
|
||||||
}
|
}
|
||||||
foreach ($report_contents as $report_content) {
|
if ($report_contents !== false) {
|
||||||
$data = array ();
|
foreach ($report_contents as $report_content) {
|
||||||
$data[0] = '';
|
$data = array ();
|
||||||
if ($first_id != $report_content['id_rc']) {
|
$data[0] = '';
|
||||||
$data[0] .= '<a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&edit_report=1&id_report='.
|
if ($first_id != $report_content['id_rc']) {
|
||||||
$id_report.'&content_up=1&id_report_content='.$report_content['id_rc'].
|
$data[0] .= '<a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&edit_report=1&id_report='.
|
||||||
'"><img src="images/up.png" title="'.lang_string ('up').'"></a>';
|
$id_report.'&content_up=1&id_report_content='.$report_content['id_rc'].
|
||||||
}
|
'"><img src="images/up.png" title="'.lang_string ('up').'"></a>';
|
||||||
if ($last_id != $report_content['id_rc']) {
|
}
|
||||||
$data[0] .= '<a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&edit_report=1&id_report='.
|
if ($last_id != $report_content['id_rc']) {
|
||||||
$id_report.'&content_down=1&id_report_content='.$report_content['id_rc'].
|
$data[0] .= '<a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&edit_report=1&id_report='.
|
||||||
'"><img src="images/down.png" title="'.lang_string ('down').'"></a>';
|
$id_report.'&content_down=1&id_report_content='.$report_content['id_rc'].
|
||||||
}
|
'"><img src="images/down.png" title="'.lang_string ('down').'"></a>';
|
||||||
$data[1] = get_report_name ($report_content['type']);
|
}
|
||||||
$data[2] = '--';
|
$data[1] = get_report_name ($report_content['type']);
|
||||||
$data[3] = '--';
|
$data[2] = '--';
|
||||||
if (get_report_type_data_source ($report_content['type']) == 'module') {
|
$data[3] = '--';
|
||||||
$data[2] = strtolower (dame_nombre_agente_agentemodulo ($report_content['id_agent_module']));
|
if (get_report_type_data_source ($report_content['type']) == 'module') {
|
||||||
$data[3] = strtolower (get_db_value ('descripcion', 'tagente_modulo', 'id_agente_modulo', $report_content['id_agent_module']));
|
$data[2] = strtolower (dame_nombre_agente_agentemodulo ($report_content['id_agent_module']));
|
||||||
}
|
$data[3] = strtolower (get_db_value ('descripcion', 'tagente_modulo', 'id_agente_modulo', $report_content['id_agent_module']));
|
||||||
$data[4] = human_time_description ($report_content['period']);
|
}
|
||||||
$data[5] = '';
|
$data[4] = human_time_description ($report_content['period']);
|
||||||
if ($report_content['type'] == 'SLA') {
|
$data[5] = '';
|
||||||
$data[5] = '<a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&id_report='.$id_report.'&edit_sla_report_content=1&id_report_content='.$report_content['id_rc'].'"><img src="images/setup.png"></a>';
|
if ($report_content['type'] == 'SLA') {
|
||||||
}
|
$data[5] = '<a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&id_report='.$id_report.'&edit_sla_report_content=1&id_report_content='.$report_content['id_rc'].'"><img src="images/setup.png"></a>';
|
||||||
if ($report_id_user == $config['id_user']) {
|
}
|
||||||
$data[6] = '<a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&id_report='.$id_report.'&delete_report_content=1&id_report_content='.$report_content['id_rc'].'"><img src="images/cross.png"></a>';
|
if ($report_id_user == $config['id_user']) {
|
||||||
}
|
$data[6] = '<a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&id_report='.$id_report.'&delete_report_content=1&id_report_content='.$report_content['id_rc'].'"><img src="images/cross.png"></a>';
|
||||||
|
}
|
||||||
|
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
print_table ($table);
|
print_table ($table);
|
||||||
}
|
}
|
||||||
|
@ -70,11 +70,11 @@ function give_acl ($id_user, $id_group, $access) {
|
|||||||
|
|
||||||
//Joined multiple queries into one. That saves on the query overhead and query cache.
|
//Joined multiple queries into one. That saves on the query overhead and query cache.
|
||||||
if ($id_group == 0) {
|
if ($id_group == 0) {
|
||||||
$query1=sprintf("SELECT `tperfil`.`incident_view`,`tperfil`.`incident_edit`,`tperfil`.`incident_management`,`tperfil`.`agent_view`,`tperfil`.`agent_edit`,`tperfil`.`alert_edit`,`tperfil`.`alert_management`,`tperfil`.`pandora_management`,`tperfil`.`db_management`,`tperfil`.`user_management` FROM `tusuario_perfil`,`tperfil` WHERE `tusuario_perfil`.`id_perfil` = `tperfil`.`id_perfil` AND `tusuario_perfil`.`id_usuario` = '%s'",$id_user);
|
$query1=sprintf("SELECT tperfil.incident_view,tperfil.incident_edit,tperfil.incident_management,tperfil.agent_view,tperfil.agent_edit,tperfil.alert_edit,tperfil.alert_management,tperfil.pandora_management,tperfil.db_management,tperfil.user_management FROM tusuario_perfil,tperfil WHERE tusuario_perfil.id_perfil = tperfil.id_perfil AND tusuario_perfil.id_usuario = '%s'",$id_user);
|
||||||
//GroupID = 0, access doesnt matter (use with caution!) - Any user gets access to group 0
|
//GroupID = 0, access doesnt matter (use with caution!) - Any user gets access to group 0
|
||||||
} else {
|
} else {
|
||||||
$query1=sprintf("SELECT `tperfil`.`incident_view`,`tperfil`.`incident_edit`,`tperfil`.`incident_management`,`tperfil`.`agent_view`,`tperfil`.`agent_edit`,`tperfil`.`alert_edit`,`tperfil`.`alert_management`,`tperfil`.`pandora_management`,`tperfil`.`db_management`,`tperfil`.`user_management` FROM `tusuario_perfil`,`tperfil` WHERE `tusuario_perfil`.`id_perfil` = `tperfil`.`id_perfil`
|
$query1=sprintf("SELECT tperfil.incident_view,tperfil.incident_edit,tperfil.incident_management,tperfil.agent_view,tperfil.agent_edit,tperfil.alert_edit,tperfil.alert_management,tperfil.pandora_management,tperfil.db_management,tperfil.user_management FROM tusuario_perfil,tperfil WHERE tusuario_perfil.id_perfil = tperfil.id_perfil
|
||||||
AND `tusuario_perfil`.`id_usuario` = '%s' AND (`tusuario_perfil`.`id_grupo` = '%d' OR `tusuario_perfil`.`id_grupo`= 1)",$id_user,$id_group);
|
AND tusuario_perfil.id_usuario = '%s' AND (tusuario_perfil.id_grupo = %d OR tusuario_perfil.id_grupo= 1)",$id_user,$id_group);
|
||||||
}
|
}
|
||||||
|
|
||||||
$rowdup = get_db_all_rows_sql($query1);
|
$rowdup = get_db_all_rows_sql($query1);
|
||||||
@ -128,7 +128,7 @@ AND `tusuario_perfil`.`id_usuario` = '%s' AND (`tusuario_perfil`.`id_grupo` = '%
|
|||||||
* @param descripcion Long action description
|
* @param descripcion Long action description
|
||||||
*/
|
*/
|
||||||
function audit_db ($id, $ip, $accion, $descripcion){
|
function audit_db ($id, $ip, $accion, $descripcion){
|
||||||
$sql1 = sprintf ("INSERT INTO `tsesion` (ID_usuario, accion, fecha, IP_origen,descripcion, utimestamp) VALUES ('%s','%s',NOW(),'%s','%s',UNIX_TIMESTAMP(NOW()))",$id,$accion,$ip,$descripcion);
|
$sql1 = sprintf ("INSERT INTO tsesion (ID_usuario, accion, fecha, IP_origen,descripcion, utimestamp) VALUES ('%s','%s',NOW(),'%s','%s',UNIX_TIMESTAMP(NOW()))",$id,$accion,$ip,$descripcion);
|
||||||
mysql_query($sql1);
|
mysql_query($sql1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +141,7 @@ function audit_db ($id, $ip, $accion, $descripcion){
|
|||||||
function logon_db ($id_user, $ip) {
|
function logon_db ($id_user, $ip) {
|
||||||
audit_db ($id_user, $ip, "Logon", "Logged in");
|
audit_db ($id_user, $ip, "Logon", "Logged in");
|
||||||
// Update last registry of user to set last logon. How do we audit when the user was created then?
|
// Update last registry of user to set last logon. How do we audit when the user was created then?
|
||||||
$sql = sprintf ("UPDATE `tusuario` SET `fecha_registro` = NOW() WHERE `id_usuario` = '%s'", $id_user);
|
$sql = sprintf ("UPDATE tusuario SET fecha_registro = NOW() WHERE id_usuario = '%s'", $id_user);
|
||||||
mysql_query ($sql);
|
mysql_query ($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,7 +196,7 @@ function get_agents_in_group ($id_group, $disabled = false) {
|
|||||||
} elseif ($disabled && $id_group != 1) {
|
} elseif ($disabled && $id_group != 1) {
|
||||||
return get_db_all_rows_field_filter ('tagente', 'id_grupo', (int) $id_group, 'nombre');
|
return get_db_all_rows_field_filter ('tagente', 'id_grupo', (int) $id_group, 'nombre');
|
||||||
} else {
|
} else {
|
||||||
$sql = sprintf ("SELECT * FROM `tagente` WHERE `id_grupo` = '%d' AND `disabled` = 0 ORDER BY `nombre`",$id_group);
|
$sql = sprintf ("SELECT * FROM tagente WHERE id_grupo = %d AND disabled = 0 ORDER BY nombre",$id_group);
|
||||||
return get_db_all_rows_sql ($sql);
|
return get_db_all_rows_sql ($sql);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -221,7 +221,11 @@ function get_modules_in_agent ($id_agent) {
|
|||||||
*/
|
*/
|
||||||
function get_simple_alerts_in_agent ($id_agent) {
|
function get_simple_alerts_in_agent ($id_agent) {
|
||||||
$sql = sprintf ("SELECT talerta_agente_modulo.* FROM talerta_agente_modulo, tagente_modulo WHERE talerta_agente_modulo.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.id_agente = %d", $id_agent);
|
$sql = sprintf ("SELECT talerta_agente_modulo.* FROM talerta_agente_modulo, tagente_modulo WHERE talerta_agente_modulo.id_agente_modulo = tagente_modulo.id_agente_modulo AND tagente_modulo.id_agente = %d", $id_agent);
|
||||||
return get_db_all_rows_sql ($sql);
|
$alerts = get_db_all_rows_sql ($sql);
|
||||||
|
|
||||||
|
if ($alerts === false)
|
||||||
|
return array ();
|
||||||
|
return $alerts;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -232,7 +236,11 @@ function get_simple_alerts_in_agent ($id_agent) {
|
|||||||
* @return An array with all combined alerts defined for an agent.
|
* @return An array with all combined alerts defined for an agent.
|
||||||
*/
|
*/
|
||||||
function get_combined_alerts_in_agent ($id_agent) {
|
function get_combined_alerts_in_agent ($id_agent) {
|
||||||
return get_db_all_rows_field_filter ('talerta_agente_modulo', 'id_agent', (int) $id_agent);
|
$alerts = get_db_all_rows_field_filter ('talerta_agente_modulo', 'id_agent', (int) $id_agent);
|
||||||
|
|
||||||
|
if ($alerts === false)
|
||||||
|
return array ();
|
||||||
|
return $alerts;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -485,9 +493,10 @@ function get_monitor_downs_in_period ($id_agent_module, $period, $date = 0) {
|
|||||||
$datelimit = $date - $period;
|
$datelimit = $date - $period;
|
||||||
$sql = sprintf ("SELECT COUNT(`id_agentmodule`) FROM `tevento` WHERE
|
$sql = sprintf ("SELECT COUNT(`id_agentmodule`) FROM `tevento` WHERE
|
||||||
`event_type` = 'monitor_down'
|
`event_type` = 'monitor_down'
|
||||||
AND `id_agentmodule` = '%d'
|
AND `id_agentmodule` = %d
|
||||||
AND `utimestamp` > '%d'
|
AND `utimestamp` > %d
|
||||||
AND `utimestamp` <= '%d'",$id_agent_module, $datelimit, $date);
|
AND `utimestamp` <= %d",
|
||||||
|
$id_agent_module, $datelimit, $date);
|
||||||
|
|
||||||
return get_db_sql ($sql);
|
return get_db_sql ($sql);
|
||||||
}
|
}
|
||||||
@ -508,9 +517,10 @@ function get_monitor_last_down_timestamp_in_period ($id_agent_module, $period, $
|
|||||||
$datelimit = $date - $period;
|
$datelimit = $date - $period;
|
||||||
$sql = sprintf ("SELECT MAX(`timestamp`) FROM `tevento` WHERE
|
$sql = sprintf ("SELECT MAX(`timestamp`) FROM `tevento` WHERE
|
||||||
event_type = 'monitor_down'
|
event_type = 'monitor_down'
|
||||||
AND `id_agentmodule` = '%d'
|
AND `id_agentmodule` = %d
|
||||||
AND `utimestamp` > '%d'
|
AND `utimestamp` > %d
|
||||||
AND `utimestamp` <= '%d'",$id_agent_module, $datelimit, $date);
|
AND `utimestamp` <= %d",
|
||||||
|
$id_agent_module, $datelimit, $date);
|
||||||
|
|
||||||
return get_db_sql ($sql);
|
return get_db_sql ($sql);
|
||||||
}
|
}
|
||||||
@ -527,7 +537,7 @@ function get_monitors_in_group ($id_group) {
|
|||||||
`id_tipo_modulo` = `id_tipo`
|
`id_tipo_modulo` = `id_tipo`
|
||||||
AND `tagente`.`id_agente` = `tagente_modulo`.`id_agente`
|
AND `tagente`.`id_agente` = `tagente_modulo`.`id_agente`
|
||||||
AND `ttipo_modulo`.`nombre` LIKE '%%_proc'
|
AND `ttipo_modulo`.`nombre` LIKE '%%_proc'
|
||||||
AND `tagente`.`id_grupo` = '%d'", $id_group);
|
AND `tagente`.`id_grupo` = %d", $id_group);
|
||||||
return get_db_all_rows_sql ($sql);
|
return get_db_all_rows_sql ($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -544,7 +554,7 @@ function get_monitors_in_agent ($id_agent) {
|
|||||||
WHERE `id_tipo_modulo` = `id_tipo`
|
WHERE `id_tipo_modulo` = `id_tipo`
|
||||||
AND `tagente`.`id_agente` = `tagente_modulo`.`id_agente`
|
AND `tagente`.`id_agente` = `tagente_modulo`.`id_agente`
|
||||||
AND `ttipo_modulo.nombre` LIKE '%%_proc'
|
AND `ttipo_modulo.nombre` LIKE '%%_proc'
|
||||||
AND `tagente`.`id_agente` = '%d'", $id_agent);
|
AND `tagente`.`id_agente` = %d", $id_agent);
|
||||||
return get_db_all_rows_sql ($sql);
|
return get_db_all_rows_sql ($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -584,9 +594,10 @@ function get_alert_fires_in_period ($id_agent_module, $period, $date = 0) {
|
|||||||
$datelimit = $date - $period;
|
$datelimit = $date - $period;
|
||||||
$sql = sprintf ("SELECT COUNT(`id_agentmodule`) FROM `tevento` WHERE
|
$sql = sprintf ("SELECT COUNT(`id_agentmodule`) FROM `tevento` WHERE
|
||||||
`event_type` = 'alert_fired'
|
`event_type` = 'alert_fired'
|
||||||
AND `id_agentmodule` = '%d'
|
AND `id_agentmodule` = %d
|
||||||
AND `utimestamp` > '%d'
|
AND `utimestamp` > %d
|
||||||
AND `utimestamp` <= '%d'",$id_agent_module, $datelimit, $date);
|
AND `utimestamp` <= %d",
|
||||||
|
$id_agent_module, $datelimit, $date);
|
||||||
return (int) get_db_sql ($sql);
|
return (int) get_db_sql ($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -653,9 +664,10 @@ function get_alert_last_fire_timestamp_in_period ($id_agent_module, $period, $da
|
|||||||
$datelimit = $date - $period;
|
$datelimit = $date - $period;
|
||||||
$sql = sprintf ("SELECT MAX(`timestamp`) FROM `tevento` WHERE
|
$sql = sprintf ("SELECT MAX(`timestamp`) FROM `tevento` WHERE
|
||||||
`event_type` = 'alert_fired'
|
`event_type` = 'alert_fired'
|
||||||
AND `id_agentmodule` = '%d'
|
AND `id_agentmodule` = %d
|
||||||
AND `utimestamp` > '%d'
|
AND `utimestamp` > %d
|
||||||
AND `utimestamp` <= '%d'",$id_agent_module, $datelimit, $date);
|
AND `utimestamp` <= %d",
|
||||||
|
$id_agent_module, $datelimit, $date);
|
||||||
return get_db_sql ($sql);
|
return get_db_sql ($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -753,25 +765,25 @@ function dame_generic_string_data ($id) {
|
|||||||
function borrar_incidencia ($id_inc) {
|
function borrar_incidencia ($id_inc) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$sql = sprintf("DELETE FROM `tincidencia` WHERE `id_incidencia` = '%d'",$id_inc);
|
$sql = sprintf ("DELETE FROM `tincidencia` WHERE `id_incidencia` = %d",$id_inc);
|
||||||
mysql_query ($sql);
|
mysql_query ($sql);
|
||||||
$sql = sprintf("SELECT `id_nota` FROM `tnota_inc` WHERE `id_incidencia` = '%d'".$id_inc);
|
$sql = sprintf ("SELECT `id_nota` FROM `tnota_inc` WHERE `id_incidencia` = %d".$id_inc);
|
||||||
$rows = get_db_all_rows_sql ($sql);
|
$rows = get_db_all_rows_sql ($sql);
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
$sql = sprintf("DELETE FROM `tnota` WHERE `id_nota` = '%d'",$row["id_nota"]);
|
$sql = sprintf ("DELETE FROM `tnota` WHERE `id_nota` = %d",$row["id_nota"]);
|
||||||
mysql_query ($sql);
|
mysql_query ($sql);
|
||||||
}
|
}
|
||||||
$sql = "DELETE FROM `tnota_inc` WHERE `id_incidencia` = ".$id_inc;
|
$sql = "DELETE FROM `tnota_inc` WHERE `id_incidencia` = ".$id_inc;
|
||||||
mysql_query ($sql);
|
mysql_query ($sql);
|
||||||
|
|
||||||
// Delete attachments
|
// Delete attachments
|
||||||
$sql = sprintf("SELECT `id_attachment`,`filename` FROM `tattachment` WHERE `id_incidencia` = '%d'",$id_inc);
|
$sql = sprintf ("SELECT `id_attachment`,`filename` FROM `tattachment` WHERE `id_incidencia` = %d",$id_inc);
|
||||||
$rows = get_db_all_rows_sql ($sql);
|
$rows = get_db_all_rows_sql ($sql);
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
// Unlink all attached files for this incident
|
// Unlink all attached files for this incident
|
||||||
unlink ($attachment_store."attachment/pand".$row["id_attachment"]."_".$row["filename"]);
|
unlink ($attachment_store."attachment/pand".$row["id_attachment"]."_".$row["filename"]);
|
||||||
}
|
}
|
||||||
$sql = sprintf("DELETE FROM `tattachment` WHERE `id_incidencia` = '%d'",$id_inc);
|
$sql = sprintf ("DELETE FROM `tattachment` WHERE `id_incidencia` = %d",$id_inc);
|
||||||
mysql_query ($sql);
|
mysql_query ($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -794,7 +806,7 @@ function dame_so_name ($id_os) {
|
|||||||
function update_user_contact ($id_user) {
|
function update_user_contact ($id_user) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$sql = sprintf("UPDATE `tusuario` set `fecha_registro` = NOW() WHERE 'id_usuario' = '%d'",$id_user);
|
$sql = sprintf ("UPDATE `tusuario` set `fecha_registro` = NOW() WHERE 'id_usuario' = %d",$id_user);
|
||||||
mysql_query ($sql);
|
mysql_query ($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1236,9 +1248,9 @@ $sql_cache=array('saved' => 0);
|
|||||||
function get_db_value ($field, $table, $field_search=1, $condition=1){
|
function get_db_value ($field, $table, $field_search=1, $condition=1){
|
||||||
|
|
||||||
if (is_int ($condition)) {
|
if (is_int ($condition)) {
|
||||||
$sql = sprintf ("SELECT %s FROM `%s` WHERE `%s` = '%d' LIMIT 1", $field, $table, $field_search, $condition);
|
$sql = sprintf ("SELECT %s FROM `%s` WHERE `%s` = %d LIMIT 1", $field, $table, $field_search, $condition);
|
||||||
} else if (is_float ($condition) || is_double ($condition)) {
|
} else if (is_float ($condition) || is_double ($condition)) {
|
||||||
$sql = sprintf ("SELECT %s FROM `%s` WHERE `%s` = '%f' LIMIT 1", $field, $table, $field_search, $condition);
|
$sql = sprintf ("SELECT %s FROM `%s` WHERE `%s` = %f LIMIT 1", $field, $table, $field_search, $condition);
|
||||||
} else {
|
} else {
|
||||||
$sql = sprintf ("SELECT %s FROM `%s` WHERE `%s` = '%s' LIMIT 1", $field, $table, $field_search, $condition);
|
$sql = sprintf ("SELECT %s FROM `%s` WHERE `%s` = '%s' LIMIT 1", $field, $table, $field_search, $condition);
|
||||||
}
|
}
|
||||||
@ -1282,9 +1294,9 @@ function get_db_row_sql ($sql) {
|
|||||||
function get_db_row ($table, $field_search, $condition) {
|
function get_db_row ($table, $field_search, $condition) {
|
||||||
|
|
||||||
if (is_int ($condition)) {
|
if (is_int ($condition)) {
|
||||||
$sql = sprintf ("SELECT * FROM `%s` WHERE `%s` = '%d' LIMIT 1", $table, $field_search, $condition);
|
$sql = sprintf ("SELECT * FROM `%s` WHERE `%s` = %d LIMIT 1", $table, $field_search, $condition);
|
||||||
} else if (is_float ($condition) || is_double ($condition)) {
|
} else if (is_float ($condition) || is_double ($condition)) {
|
||||||
$sql = sprintf ("SELECT * FROM `%s` WHERE `%s` = '%f' LIMIT 1", $table, $field_search, $condition);
|
$sql = sprintf ("SELECT * FROM `%s` WHERE `%s` = %f LIMIT 1", $table, $field_search, $condition);
|
||||||
} else {
|
} else {
|
||||||
$sql = sprintf ("SELECT * FROM `%s` WHERE `%s` = '%s' LIMIT 1", $table, $field_search, $condition);
|
$sql = sprintf ("SELECT * FROM `%s` WHERE `%s` = '%s' LIMIT 1", $table, $field_search, $condition);
|
||||||
}
|
}
|
||||||
@ -1335,7 +1347,7 @@ function get_db_all_rows_sql ($sql) {
|
|||||||
* an empty array in case of SELECT without results
|
* an empty array in case of SELECT without results
|
||||||
*/
|
*/
|
||||||
function process_sql ($sql) {
|
function process_sql ($sql) {
|
||||||
global $config;
|
global $config;
|
||||||
global $sql_cache;
|
global $sql_cache;
|
||||||
$retval = array();
|
$retval = array();
|
||||||
|
|
||||||
@ -1357,8 +1369,10 @@ function process_sql ($sql) {
|
|||||||
mysql_free_result ($result);
|
mysql_free_result ($result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $retval;
|
if (! empty ($retval))
|
||||||
|
return $retval;
|
||||||
//Return false, check with === or !==
|
//Return false, check with === or !==
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1409,9 +1423,9 @@ function get_db_all_rows_field_filter ($table, $field, $condition, $order_field
|
|||||||
* @return A matrix with all the values in the table that matches the condition in the field
|
* @return A matrix with all the values in the table that matches the condition in the field
|
||||||
*/
|
*/
|
||||||
function get_db_all_fields_in_table ($table, $field, $condition='') {
|
function get_db_all_fields_in_table ($table, $field, $condition='') {
|
||||||
$sql = sprintf ("SELECT %s FROM `%s`",$field,$table);
|
$sql = sprintf ("SELECT * FROM `%s`", $table);
|
||||||
if($condition != '') {
|
if($condition != '') {
|
||||||
$sql .= sprintf (" WHERE `%s` = '%s'",$field,$condition);
|
$sql .= sprintf (" WHERE `%s` = '%s'", $field, $condition);
|
||||||
}
|
}
|
||||||
return get_db_all_rows_sql ($sql);
|
return get_db_all_rows_sql ($sql);
|
||||||
}
|
}
|
||||||
@ -1424,11 +1438,11 @@ function get_db_all_fields_in_table ($table, $field, $condition='') {
|
|||||||
* @return True if there were alerts fired.
|
* @return True if there were alerts fired.
|
||||||
*/
|
*/
|
||||||
function return_status_agent_module ($id_agentmodule = 0){
|
function return_status_agent_module ($id_agentmodule = 0){
|
||||||
$sql = sprintf ("SELECT `estado` FROM `tagente_estado` WHERE `id_agente_modulo` = '%d'",$id_agentmodule);
|
$sql = sprintf ('SELECT `estado` FROM `tagente_estado` WHERE `id_agente_modulo` = %d', $id_agentmodule);
|
||||||
$estado = get_db_sql($sql);
|
$estado = get_db_sql($sql);
|
||||||
if ($estado == 100) {
|
if ($estado == 100) {
|
||||||
// We need to check if there are any alert on this item
|
// We need to check if there are any alert on this item
|
||||||
$sql = sprintf ("SELECT SUM(times_fired) FROM `talerta_agente_modulo` WHERE `id_agente_modulo` = '%d'",$id_agentmodule);
|
$sql = sprintf ('SELECT SUM(times_fired) FROM `talerta_agente_modulo` WHERE `id_agente_modulo` = %d', $id_agentmodule);
|
||||||
$times_fired = get_db_sql($sql);
|
$times_fired = get_db_sql($sql);
|
||||||
if ($times_fired > 0){
|
if ($times_fired > 0){
|
||||||
return 0;
|
return 0;
|
||||||
@ -1456,7 +1470,7 @@ function return_status_agent_module ($id_agentmodule = 0){
|
|||||||
function return_status_layout ($id_layout = 0) {
|
function return_status_layout ($id_layout = 0) {
|
||||||
$temp_status = 0;
|
$temp_status = 0;
|
||||||
$temp_total = 0;
|
$temp_total = 0;
|
||||||
$sql = sprintf ("SELECT id_agente_modulo, parent_item, id_layout_linked FROM `tlayout_data` WHERE `id_layout` = '%d'",$id_layout);
|
$sql = sprintf ('SELECT id_agente_modulo, parent_item, id_layout_linked FROM `tlayout_data` WHERE `id_layout` = %d', $id_layout);
|
||||||
$result = get_db_all_rows_sql ($sql);
|
$result = get_db_all_rows_sql ($sql);
|
||||||
if ($result === false)
|
if ($result === false)
|
||||||
return 0;
|
return 0;
|
||||||
@ -1656,7 +1670,7 @@ function get_agent_module_value_sumatory ($id_agent_module, $period, $date = 0)
|
|||||||
/* Add data to the beginning */
|
/* Add data to the beginning */
|
||||||
array_unshift ($datas, $previous_data);
|
array_unshift ($datas, $previous_data);
|
||||||
}
|
}
|
||||||
if (sizeof ($datas) == 0) {
|
if ($datas === false) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,6 +248,11 @@ function event_reporting ($id_group, $period, $date = 0, $return = false) {
|
|||||||
ORDER BY utimestamp ASC',
|
ORDER BY utimestamp ASC',
|
||||||
$id_group, $datelimit, $date, $id_group);
|
$id_group, $datelimit, $date, $id_group);
|
||||||
$events = get_db_all_rows_sql ($sql);
|
$events = get_db_all_rows_sql ($sql);
|
||||||
|
if ($events === false) {
|
||||||
|
if (!$return)
|
||||||
|
print_table ($table);
|
||||||
|
return $table;
|
||||||
|
}
|
||||||
foreach ($events as $event) {
|
foreach ($events as $event) {
|
||||||
$data = array ();
|
$data = array ();
|
||||||
if ($event["estado"] == 0)
|
if ($event["estado"] == 0)
|
||||||
@ -523,6 +528,9 @@ function get_agent_monitors_reporting_table ($id_agent, $period = 0, $date = 0)
|
|||||||
$table->data = array ();
|
$table->data = array ();
|
||||||
$monitors = get_monitors_in_agent ($id_agent);
|
$monitors = get_monitors_in_agent ($id_agent);
|
||||||
|
|
||||||
|
if ($monitors === false) {
|
||||||
|
return $table
|
||||||
|
}
|
||||||
foreach ($monitors as $monitor) {
|
foreach ($monitors as $monitor) {
|
||||||
$downs = get_monitor_downs_in_period ($monitor['id_agente_modulo'], $period, $date);
|
$downs = get_monitor_downs_in_period ($monitor['id_agente_modulo'], $period, $date);
|
||||||
if (! $downs) {
|
if (! $downs) {
|
||||||
|
@ -130,6 +130,9 @@ $table->rowclass[0] = 'datos3';
|
|||||||
$group_name = dame_grupo ($report['id_group']);
|
$group_name = dame_grupo ($report['id_group']);
|
||||||
$sql = sprintf ('SELECT * FROM treport_content WHERE id_report = %d ORDER BY `order`', $id_report);
|
$sql = sprintf ('SELECT * FROM treport_content WHERE id_report = %d ORDER BY `order`', $id_report);
|
||||||
$contents = get_db_all_rows_sql ($sql);
|
$contents = get_db_all_rows_sql ($sql);
|
||||||
|
if ($contents === false) {
|
||||||
|
return;
|
||||||
|
};
|
||||||
foreach ($contents as $content) {
|
foreach ($contents as $content) {
|
||||||
$table->data = array ();
|
$table->data = array ();
|
||||||
$table->head = array ();
|
$table->head = array ();
|
||||||
|
@ -227,8 +227,8 @@ if (($alert_update != 0) || ($alert_add == 1)) {
|
|||||||
// Priority
|
// Priority
|
||||||
echo '<tr><td class="datos">'.lang_string("Priority");
|
echo '<tr><td class="datos">'.lang_string("Priority");
|
||||||
echo '<td class="datos">';
|
echo '<td class="datos">';
|
||||||
echo form_priority ($priority);
|
echo print_select (get_priorities (), "alert_priority", $priority, '', '', '');
|
||||||
|
|
||||||
echo '</tr></table>';
|
echo '</tr></table>';
|
||||||
echo '<table cellpadding="4" cellspacing="4" width="650">
|
echo '<table cellpadding="4" cellspacing="4" width="650">
|
||||||
<tr><td align="right">';
|
<tr><td align="right">';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user