From b8c07fda7609510f8414839cfbc67322c2e9abc4 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Thu, 23 May 2013 12:32:36 +0000 Subject: [PATCH] 2013-05-23 Miguel de Dios * godmode/reporting/reporting_builder.item_editor.php: fixed ACL for the custom graphs. Fixes: #2233 MERGED FROM THE BRANCH 4 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8196 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 9 +++++++++ .../reporting_builder.item_editor.php | 18 +++++++++--------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 930b2545af..98ed1f7494 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,12 @@ +2013-05-23 Miguel de Dios + + * godmode/reporting/reporting_builder.item_editor.php: fixed ACL for + the custom graphs. + + Fixes: #2233 + +MERGED FROM THE BRANCH 4 + 2013-05-23 Miguel de Dios * operation/agentes/alerts_status.functions.php, diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index e873ce94cc..f5d641ee29 100644 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -13,6 +13,8 @@ // GNU General Public License for more details. global $config; +require_once ('include/functions_custom_graphs.php'); + // Login check check_login (); @@ -834,16 +836,14 @@ html_print_input_hidden('id_item', $idItem); html_print_select($graphs, 'id_custom_graph', $value_selected, 'change_custom_graph();', __('None'), 0); } else { - switch ($config["dbtype"]) { - case "mysql": - $query_sql = 'SELECT id_graph, name FROM tgraph WHERE private = 0 OR (private = 1 AND id_user = "'.$config["id_user"].'")'; - break; - case "postgresql": - case "oracle": - $query_sql = 'SELECT id_graph, name FROM tgraph WHERE private = 0 OR (private = 1 AND id_user = \''.$config["id_user"].'\')'; - break; + $list_custom_graphs = custom_graphs_get_user ($config['id_user'], false, true, "IR"); + + $graphs = array(); + foreach ($list_custom_graphs as $custom_graph) { + $graphs[$custom_graph['id_graph']] = $custom_graph['name']; } - html_print_select_from_sql($query_sql, 'id_custom_graph', $idCustomGraph, 'change_custom_graph();', __('None'), 0); + html_print_select($graphs, 'id_custom_graph', + $idCustomGraph, 'change_custom_graph();', __('None'), 0); } $style_button_create_custom_graph = 'style="display: none;"';