fix api function show graph

This commit is contained in:
Daniel Barbero Martin 2020-11-20 13:01:47 +01:00
parent 436a88e2f4
commit 68ac02db70
2 changed files with 12 additions and 7 deletions

View File

@ -55,8 +55,6 @@ $password = get_parameter('pass', '');
$user = get_parameter('user', '');
$info = get_parameter('info', '');
$other = parseOtherParameter($otherSerialize, $otherMode);
$other = parseOtherParameter($otherSerialize, $otherMode);
$apiPassword = io_output_password(
db_get_value_filter(

View File

@ -13758,12 +13758,19 @@ function api_get_module_graph($id_module, $thrash2, $other, $thrash4)
return;
}
$graph_seconds = (!empty($other) && isset($other['data'][0])) ? $other['data'][0] : SECONDS_1HOUR;
// 1 hour by default.
$graph_threshold = (!empty($other) && isset($other['data'][2]) && $other['data'][2]) ? $other['data'][2] : 0;
if (is_array($other['data']) === true) {
$graph_seconds = (!empty($other) && isset($other['data'][0])) ? $other['data'][0] : SECONDS_1HOUR;
// 1 hour by default.
$graph_threshold = (!empty($other) && isset($other['data'][2]) && $other['data'][2]) ? $other['data'][2] : 0;
// Graph height when send email by alert
$height = (!empty($other) && isset($other['data'][3]) && $other['data'][3]) ? $other['data'][3] : null;
// Graph height when send email by alert
$height = (!empty($other) && isset($other['data'][3]) && $other['data'][3]) ? $other['data'][3] : 225;
} else {
$graph_seconds = $other['data'];
$graph_threshold = 0;
$other['data'][1] = 0;
$height = 225;
}
if (is_nan($graph_seconds) || $graph_seconds <= 0) {
// returnError('error_module_graph', __(''));