diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index bba8cb1cc3..5ecac3a944 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -9941,7 +9941,14 @@ function api_get_module_graph($id_module, $thrash2, $other, $thrash4) { $other['data'][0] : SECONDS_1HOUR; // 1 hour by default - + + $graph_threshold = + (!empty($other) && isset($other['data'][2])) + ? + $other['data'][2] + : + 0; + if (is_nan($graph_seconds) || $graph_seconds <= 0) { // returnError('error_module_graph', __('')); return; @@ -9952,41 +9959,44 @@ function api_get_module_graph($id_module, $thrash2, $other, $thrash4) { $id_module, $graph_seconds, false, 600, 300, '', '', false, false, true, time(), '', 0, 0, true, true, ui_get_full_url(false) . '/', 1, false, '', false, true, - true, 'white', null, false, false, $config['type_module_charts']); + true, 'white', null, false, false, $config['type_module_charts'], + false, false); - $graph_image_file_encoded = false; + $graph_image_file_encoded = false; if (preg_match("/{"op"} = "get"; $params->{"op2"} = "module_graph"; $params->{"id"} = $module->{'id_agente_modulo'}; - + my $cid =''; my $subst_func = sub { my $hours = shift; + my $threshold = shift; my $period = $hours * 3600; # Hours to seconds - $params->{"other"} = $period . '%7C0'; + if($threshold == 0){ + $params->{"other"} = $period . '%7C0%7C0'; + $cid = 'module_graph_' . $hours . 'h'; + } + else{ + $params->{"other"} = $period . '%7C0%7C1'; + $cid = 'module_graphth_' . $hours . 'h'; + } + $params->{"other_mode"} = 'url_encode_separator_%7C'; - my $cid = 'module_graph_' . $hours . 'h'; if (! exists($module_graph_list->{$cid}) && defined $url) { # Get the module graph image in base 64 @@ -1150,7 +1160,8 @@ sub pandora_execute_action ($$$$$$$$$;$) { eval { no warnings; local $SIG{__DIE__}; - $field3 =~ s/$macro_regexp/$subst_func->($1)/ige; + $field3 =~ s/$macro_regexp/$subst_func->($1, 0)/ige; + $field3 =~ s/$macro_regexp2/$subst_func->($1, 1)/ige; }; # Default content type