mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
2010-12-21 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_reporting.php, include/fgraph.php, include/functions_db.php, images/image_problem.opaque.png: fixed the bug because this bug was two things the access to graph with not login in the same machine to generate, and the transparent png that not crash with the pdf library. Fixes: #3139079 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3674 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
81f338d24a
commit
1a6e5dc031
@ -1,3 +1,13 @@
|
|||||||
|
2010-12-21 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
|
* include/functions_reporting.php, include/fgraph.php,
|
||||||
|
include/functions_db.php, images/image_problem.opaque.png: fixed the bug
|
||||||
|
because this bug was two things the access to graph with not login in the
|
||||||
|
same machine to generate, and the transparent png that not crash with the
|
||||||
|
pdf library.
|
||||||
|
|
||||||
|
Fixes: #3139079
|
||||||
|
|
||||||
2010-12-20 Miguel de Dios <miguel.dedios@artica.es>
|
2010-12-20 Miguel de Dios <miguel.dedios@artica.es>
|
||||||
|
|
||||||
* godmode/reporting/reporting_builder.php: fixed the action to sort up or
|
* godmode/reporting/reporting_builder.php: fixed the action to sort up or
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
* @subpackage Graphs
|
* @subpackage Graphs
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
if (isset($config)) {
|
if (isset($config)) {
|
||||||
|
|
||||||
/**#@+
|
/**#@+
|
||||||
* If is set global var $config include this files
|
* If is set global var $config include this files
|
||||||
*/
|
*/
|
||||||
@ -28,8 +28,10 @@ if (isset($config)) {
|
|||||||
require_once ($config['homedir'].'/include/functions_fsgraph.php');
|
require_once ($config['homedir'].'/include/functions_fsgraph.php');
|
||||||
require_once ($config['homedir'].'/include/functions_reporting.php');
|
require_once ($config['homedir'].'/include/functions_reporting.php');
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
/**#@+
|
/**#@+
|
||||||
* If is not set global var $config include this files
|
* If is not set global var $config include this files
|
||||||
*/
|
*/
|
||||||
@ -37,7 +39,9 @@ else {
|
|||||||
require_once ($config['homedir'].'/include/pandora_graph.php');
|
require_once ($config['homedir'].'/include/pandora_graph.php');
|
||||||
require_once ($config['homedir'].'/include/functions_reporting.php');
|
require_once ($config['homedir'].'/include/functions_reporting.php');
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enterprise_include ('include/functions_reporting.php');
|
enterprise_include ('include/functions_reporting.php');
|
||||||
|
|
||||||
set_time_limit (0);
|
set_time_limit (0);
|
||||||
@ -54,9 +58,8 @@ if (! isset ($config["id_user"])) {
|
|||||||
require_once('../mobile/include/user.class.php');
|
require_once('../mobile/include/user.class.php');
|
||||||
session_start ();
|
session_start ();
|
||||||
session_write_close ();
|
session_write_close ();
|
||||||
$user = $_SESSION['user'];
|
if (isset ($_SESSION['user'])) {
|
||||||
if(!empty($user)) {
|
$config["id_user"] = $_SESSION['user']->getIdUser();
|
||||||
$config["id_user"] = $user->getIdUser();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -73,13 +76,17 @@ if (($_SERVER['SERVER_ADDR'] != $_SERVER['REMOTE_ADDR'])
|
|||||||
*
|
*
|
||||||
* @param string image File that show when has a problem.
|
* @param string image File that show when has a problem.
|
||||||
*/
|
*/
|
||||||
function graphic_error ($image = 'image_problem.png') {
|
function graphic_error ($image = 'image_problem.opaque.png') {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
Header ('Content-type: image/png');
|
Header ('Content-type: image/png');
|
||||||
$img = imagecreatefromPng ($config['homedir'].'/images/'.$image);
|
|
||||||
imagealphablending ($img, true);
|
$image_file = $config['homedir'].'/images/'.$image;
|
||||||
imagesavealpha ($img, true);
|
|
||||||
|
$img = imagecreatefromPng ($image_file);
|
||||||
|
|
||||||
|
//imagealphablending ($img, true);
|
||||||
|
//imagesavealpha ($img, true);
|
||||||
imagepng ($img);
|
imagepng ($img);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -2328,7 +2335,6 @@ function myErrorHandler($errno, $errstr, $errfile, $errline)
|
|||||||
|
|
||||||
// Generic parameter handling
|
// Generic parameter handling
|
||||||
// **************************
|
// **************************
|
||||||
|
|
||||||
$id_agent = (int) get_parameter ('id_agent');
|
$id_agent = (int) get_parameter ('id_agent');
|
||||||
$tipo = (string) get_parameter ('tipo');
|
$tipo = (string) get_parameter ('tipo');
|
||||||
$pure = (bool) get_parameter ('pure');
|
$pure = (bool) get_parameter ('pure');
|
||||||
@ -2362,132 +2368,132 @@ $baseline = (int) get_parameter ('baseline', 0);
|
|||||||
|
|
||||||
if ($graphic_type) {
|
if ($graphic_type) {
|
||||||
switch ($graphic_type) {
|
switch ($graphic_type) {
|
||||||
case 'sparse':
|
case 'sparse':
|
||||||
grafico_modulo_sparse ($id, $period, $draw_events, $width, $height,
|
grafico_modulo_sparse ($id, $period, $draw_events, $width, $height,
|
||||||
$label, $unit_name, $draw_alerts, $avg_only, $pure, $date, $baseline);
|
$label, $unit_name, $draw_alerts, $avg_only, $pure, $date, $baseline);
|
||||||
break;
|
break;
|
||||||
case 'sparse_mobile':
|
case 'sparse_mobile':
|
||||||
grafico_modulo_sparse($id, $period, $draw_events, $width, $height,
|
grafico_modulo_sparse($id, $period, $draw_events, $width, $height,
|
||||||
$label, $unit_name, $draw_alerts, $avg_only, $pure, $date,
|
$label, $unit_name, $draw_alerts, $avg_only, $pure, $date,
|
||||||
0, 0, false);
|
0, 0, false);
|
||||||
break;
|
break;
|
||||||
case "boolean":
|
case "boolean":
|
||||||
grafico_modulo_boolean ($id, $period, $draw_events, $width, $height ,
|
grafico_modulo_boolean ($id, $period, $draw_events, $width, $height ,
|
||||||
$label, $unit_name, $draw_alerts, 1, $pure, $date);
|
$label, $unit_name, $draw_alerts, 1, $pure, $date);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "estado_incidente":
|
case "estado_incidente":
|
||||||
graph_incidents_status ();
|
graph_incidents_status ();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "prioridad_incidente":
|
case "prioridad_incidente":
|
||||||
grafico_incidente_prioridad ();
|
grafico_incidente_prioridad ();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "db_agente_modulo":
|
case "db_agente_modulo":
|
||||||
graph_db_agentes_modulos ($width, $height);
|
graph_db_agentes_modulos ($width, $height);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "db_agente_paquetes":
|
case "db_agente_paquetes":
|
||||||
grafico_db_agentes_paquetes ($width, $height);
|
grafico_db_agentes_paquetes ($width, $height);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "db_agente_purge":
|
case "db_agente_purge":
|
||||||
grafico_db_agentes_purge ($id, $width, $height);
|
grafico_db_agentes_purge ($id, $width, $height);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "event_module":
|
case "event_module":
|
||||||
graph_event_module ($width, $height, $id_agent);
|
graph_event_module ($width, $height, $id_agent);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "group_events":
|
case "group_events":
|
||||||
grafico_eventos_grupo ($width, $height,$url);
|
grafico_eventos_grupo ($width, $height,$url);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "user_events":
|
case "user_events":
|
||||||
grafico_eventos_usuario ($width, $height);
|
grafico_eventos_usuario ($width, $height);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "total_events":
|
case "total_events":
|
||||||
grafico_eventos_total ();
|
grafico_eventos_total ();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "group_incident":
|
case "group_incident":
|
||||||
graphic_incident_group ();
|
graphic_incident_group ();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "user_incident":
|
case "user_incident":
|
||||||
graphic_incident_user ();
|
graphic_incident_user ();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "source_incident":
|
case "source_incident":
|
||||||
graphic_incident_source ();
|
graphic_incident_source ();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "user_activity":
|
case "user_activity":
|
||||||
graphic_user_activity ($width, $height);
|
graphic_user_activity ($width, $height);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "agentaccess":
|
case "agentaccess":
|
||||||
graphic_agentaccess ($id, $width, $height, $period);
|
graphic_agentaccess ($id, $width, $height, $period);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "agentmodules":
|
case "agentmodules":
|
||||||
graphic_agentmodules ($id, $width, $height);
|
graphic_agentmodules ($id, $width, $height);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "progress":
|
case "progress":
|
||||||
$percent = (int) get_parameter ('percent');
|
$percent = (int) get_parameter ('percent');
|
||||||
progress_bar ($percent,$width,$height, $mode);
|
progress_bar ($percent,$width,$height, $mode);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "combined":
|
case "combined":
|
||||||
// Split id to get all parameters
|
// Split id to get all parameters
|
||||||
$module_list = array();
|
$module_list = array();
|
||||||
$module_list = explode (",", $id);
|
$module_list = explode (",", $id);
|
||||||
$weight_list = array();
|
$weight_list = array();
|
||||||
$weight_list = explode (",", $weight_l);
|
$weight_list = explode (",", $weight_l);
|
||||||
graphic_combined_module ($module_list, $weight_list, $period, $width, $height,
|
graphic_combined_module ($module_list, $weight_list, $period, $width, $height,
|
||||||
$label, $unit_name, $draw_events, $draw_alerts, $pure, $stacked, $date);
|
$label, $unit_name, $draw_events, $draw_alerts, $pure, $stacked, $date);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "alerts_fired_pipe":
|
case "alerts_fired_pipe":
|
||||||
$data = array ();
|
$data = array ();
|
||||||
$data[__('Alerts fired')] = (float) get_parameter ('fired');
|
$data[__('Alerts fired')] = (float) get_parameter ('fired');
|
||||||
$data[__('Alerts not fired')] = (float) get_parameter ('not_fired');
|
$data[__('Alerts not fired')] = (float) get_parameter ('not_fired');
|
||||||
generic_pie_graph ($width, $height, $data);
|
generic_pie_graph ($width, $height, $data);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'monitors_health_pipe':
|
case 'monitors_health_pipe':
|
||||||
$data = array ();
|
$data = array ();
|
||||||
$data[__('Monitors OK')] = (float) get_parameter ('not_down');
|
$data[__('Monitors OK')] = (float) get_parameter ('not_down');
|
||||||
$data[__('Monitors BAD')] = (float) get_parameter ('down');
|
$data[__('Monitors BAD')] = (float) get_parameter ('down');
|
||||||
generic_pie_graph ($width, $height, $data);
|
generic_pie_graph ($width, $height, $data);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'string':
|
case 'string':
|
||||||
grafico_modulo_string ($id, $period, $draw_events, $width, $height, $label, $unit_name, $draw_alerts, $avg_only, $pure, $date);
|
grafico_modulo_string ($id, $period, $draw_events, $width, $height, $label, $unit_name, $draw_alerts, $avg_only, $pure, $date);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'log4x':
|
case 'log4x':
|
||||||
grafico_modulo_log4x ($id, $period, $draw_events, $width, $height, $label, $unit_name, $draw_alerts, $avg_only, $pure, $date);
|
grafico_modulo_log4x ($id, $period, $draw_events, $width, $height, $label, $unit_name, $draw_alerts, $avg_only, $pure, $date);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'sql_graph_vbar':
|
case 'sql_graph_vbar':
|
||||||
graph_custom_sql_graph ($report_id, $width, $height, 1);
|
graph_custom_sql_graph ($report_id, $width, $height, 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'sql_graph_hbar':
|
case 'sql_graph_hbar':
|
||||||
graph_custom_sql_graph ($report_id, $width, $height, 2);
|
graph_custom_sql_graph ($report_id, $width, $height, 2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'sql_graph_pie':
|
case 'sql_graph_pie':
|
||||||
graph_custom_sql_graph ($report_id, $width, $height, 3);
|
graph_custom_sql_graph ($report_id, $width, $height, 3);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'graphic_error':
|
case 'graphic_error':
|
||||||
default:
|
default:
|
||||||
graphic_error ();
|
graphic_error ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,11 +50,12 @@ function check_login () {
|
|||||||
require_once($config["homedir"].'/mobile/include/user.class.php');
|
require_once($config["homedir"].'/mobile/include/user.class.php');
|
||||||
session_start ();
|
session_start ();
|
||||||
session_write_close ();
|
session_write_close ();
|
||||||
$user = $_SESSION['user'];
|
if (isset($_SESSION['user'])) {
|
||||||
$id_user = $user->getIdUser();
|
$user = $_SESSION['user'];
|
||||||
|
$id_user = $user->getIdUser();
|
||||||
if (is_user ($id_user)) {
|
if (is_user ($id_user)) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pandora_audit("No session", "Trying to access without a valid session", "N/A");
|
pandora_audit("No session", "Trying to access without a valid session", "N/A");
|
||||||
|
@ -178,11 +178,17 @@ function get_agentmodule_data_max ($id_agent_module, $period, $date = 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set initial conditions
|
// Set initial conditions
|
||||||
if ($uncompressed_module || $interval_data[0]['utimestamp'] == $datelimit) {
|
if (empty($iterval_data)) {
|
||||||
$max = $interval_data[0]['datos'];
|
|
||||||
} else {
|
|
||||||
$max = 0;
|
$max = 0;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if ($uncompressed_module || $interval_data[0]['utimestamp'] == $datelimit) {
|
||||||
|
$max = $interval_data[0]['datos'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$max = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($interval_data as $data) {
|
foreach ($interval_data as $data) {
|
||||||
if ($data['datos'] > $max) {
|
if ($data['datos'] > $max) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user