From 4301092c83fb59f61016f874dfffa2a5767e0775 Mon Sep 17 00:00:00 2001 From: TheWitness Date: Wed, 20 May 2020 23:08:39 -0400 Subject: [PATCH] Additional fixes to #3553 undefined error when directly visit a none-exist graph --- aggregate_graphs.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/aggregate_graphs.php b/aggregate_graphs.php index e25a0247f5..b5ed178851 100644 --- a/aggregate_graphs.php +++ b/aggregate_graphs.php @@ -660,12 +660,23 @@ function graph_edit() { 'items' => __('Items'), 'preview' => __('Preview') ); - } else { + } elseif (cacti_sizeof($graphs)) { $template = array(); $aggregate_tabs = array( 'details' => __('Details'), 'preview' => __('Preview') ); + } else { + raise_message('missing_aggregate', __('Aggregate Graphs Accessed does not Exist'), MESSAGE_LEVEL_ERROR); + + if (isset($_SERVER['HTTP_REFERER'])) { + $referer = sanitize_uri($_SERVER['HTTP_REFERER']); + header('Location: ' . $referer); + } else { + header('Location: aggregate_graphs.php'); + } + + exit; } /* ================= input validation and session storage ================= */ @@ -812,6 +823,7 @@ function graph_edit() { html_end_box(true, true); if (isset($template)) { + draw_aggregate_graph_items_list(0, $template['graph_template_id'], $aginfo); }