resolve rra_id issues in graph.php

This commit is contained in:
cigamit committed 2016-03-19 09:11:11 -05:00
1 parent 8ad3e23e68
commit da00540959
2 files changed
+7 -6

No files matched your search

+4 -3
View File
@@ -44,6 +44,7 @@ get_filter_request_var('view_type', FILTER_VALIDATE_REGEXP, array('options' => a
api_plugin_hook_function('graph');
include_once('./lib/html_tree.php');
top_graph_header();
if (!isset_request_var('rra_id')) {
@@ -51,9 +52,9 @@ if (!isset_request_var('rra_id')) {
}
if (get_request_var('rra_id') == 'all') {
$sql_where = ' WHERE id IS NOT NULL';
$sql_where = ' AND dspr.id IS NOT NULL';
}else{
$sql_where = ' WHERE id=' . get_request_var('rra_id');
$sql_where = ' AND dspr.id=' . get_request_var('rra_id');
}
/* make sure the graph requested exists (sanity) */
@@ -74,7 +75,7 @@ if (get_request_var('action') != 'properties') {
print "<table width='100%' class='cactiTable'>";
}
$rras = get_associated_rras(get_request_var('local_graph_id'));
$rras = get_associated_rras(get_request_var('local_graph_id'), $sql_where);
switch (get_request_var('action')) {
case 'view':
+3 -3
View File
@@ -2712,8 +2712,8 @@ function resolve_navigation_variables($text) {
/* get_associated_rras - returns a list of all RRAs referenced by a particular graph
@arg $local_graph_id - (int) the ID of the graph to retrieve a list of RRAs for
@returns - (array) an array containing the name and id of each RRA found */
function get_associated_rras($local_graph_id) {
return db_fetch_assoc_prepared('SELECT DISTINCT ' . SQL_NO_CACHE . '
function get_associated_rras($local_graph_id, $sql_where = '') {
return db_fetch_assoc_prepared('SELECT DISTINCT ' . SQL_NO_CACHE . "
dspr.id, dspr.steps, dspr.rows, dspr.name, dtd.rrd_step
FROM graph_templates_item AS gti
LEFT JOIN data_template_rrd AS dtr
@@ -2725,7 +2725,7 @@ function get_associated_rras($local_graph_id) {
LEFT JOIN data_source_profiles_rra AS dspr
ON dsp.id=dspr.data_source_profile_id
AND dtd.local_data_id != 0
WHERE gti.local_graph_id = ?', array($local_graph_id));
WHERE gti.local_graph_id = ? $sql_where", array($local_graph_id));
}
/* get_browser_query_string - returns the full url, including args requested by the browser