Author: arekm                        Date: Thu Nov 24 18:48:30 2005 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- new

---- Files affected:
SOURCES:
   cacti-mysql5.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/cacti-mysql5.patch
diff -u /dev/null SOURCES/cacti-mysql5.patch:1.1
--- /dev/null   Thu Nov 24 19:48:30 2005
+++ SOURCES/cacti-mysql5.patch  Thu Nov 24 19:48:25 2005
@@ -0,0 +1,1179 @@
+diff -urbB cacti-0.8.6g/data_queries.php cacti/data_queries.php
+--- cacti-0.8.6g/data_queries.php      2005-09-09 01:56:25.000000000 +0200
++++ cacti/data_queries.php     2005-11-24 19:32:45.000000000 +0100
+@@ -301,7 +301,7 @@
+               $data_templates = db_fetch_assoc("select
+                       data_template.id,
+                       data_template.name
+-                      from data_template, data_template_rrd, 
graph_templates_item
++                      from (data_template, data_template_rrd, 
graph_templates_item)
+                       where 
graph_templates_item.task_item_id=data_template_rrd.id
+                       and data_template_rrd.data_template_id=data_template.id
+                       and data_template_rrd.local_data_id=0
+@@ -596,7 +596,7 @@
+                               graph_templates.name as graph_template_name,
+                               snmp_query_graph.name
+                               from snmp_query_graph
+-                              left join graph_templates on 
snmp_query_graph.graph_template_id=graph_templates.id
++                              left join graph_templates on 
(snmp_query_graph.graph_template_id=graph_templates.id)
+                               where snmp_query_graph.snmp_query_id=" . 
$snmp_query["id"] . "
+                               order by snmp_query_graph.name");
+ 
+@@ -643,7 +643,7 @@
+                       snmp_query.id,
+                       snmp_query.name,
+                       data_input.name AS data_input_method
+-                      FROM snmp_query INNER JOIN data_input ON 
snmp_query.data_input_id = data_input.id
++                      FROM snmp_query INNER JOIN data_input ON 
(snmp_query.data_input_id = data_input.id)
+                       ORDER BY snmp_query.name");
+ 
+       $i = 0;
+diff -urbB cacti-0.8.6g/data_sources.php cacti/data_sources.php
+--- cacti-0.8.6g/data_sources.php      2005-09-09 01:56:25.000000000 +0200
++++ cacti/data_sources.php     2005-11-24 19:32:45.000000000 +0100
+@@ -137,8 +137,8 @@
+                       data_input_fields.allow_nulls,
+                       data_input_fields.type_code
+                       from data_template_data
+-                      left join data_input_fields on 
data_input_fields.data_input_id=data_template_data.data_input_id
+-                      left join data_local on 
data_template_data.local_data_id=data_local.id
++                      left join data_input_fields on 
(data_input_fields.data_input_id=data_template_data.data_input_id)
++                      left join data_local on 
(data_template_data.local_data_id=data_local.id)
+                       where data_template_data.id=" . 
$_POST["data_template_data_id"] . "
+                       and data_input_fields.input_output='in'");
+ 
+@@ -331,7 +331,7 @@
+                               case '3': /* delete all graphs tied to this 
data source */
+                                       $graphs = db_fetch_assoc("select
+                                               
graph_templates_graph.local_graph_id
+-                                              from 
data_template_rrd,graph_templates_item,graph_templates_graph
++                                              from 
(data_template_rrd,graph_templates_item,graph_templates_graph)
+                                               where 
graph_templates_item.task_item_id=data_template_rrd.id
+                                               and 
graph_templates_item.local_graph_id=graph_templates_graph.local_graph_id
+                                               and " . 
array_to_sql_or($selected_items, "data_template_rrd.local_data_id") . "
+@@ -435,7 +435,7 @@
+                       $graphs = db_fetch_assoc("select
+                               graph_templates_graph.local_graph_id,
+                               graph_templates_graph.title_cache
+-                              from 
data_template_rrd,graph_templates_item,graph_templates_graph
++                              from 
(data_template_rrd,graph_templates_item,graph_templates_graph)
+                               where 
graph_templates_item.task_item_id=data_template_rrd.id
+                               and 
graph_templates_item.local_graph_id=graph_templates_graph.local_graph_id
+                               and " . array_to_sql_or($ds_array, 
"data_template_rrd.local_data_id") . "
+@@ -562,7 +562,7 @@
+               $data = db_fetch_row("select 
id,data_input_id,data_template_id,name,local_data_id from data_template_data 
where local_data_id=" . $_GET["id"]);
+               $template_data = db_fetch_row("select id,data_input_id from 
data_template_data where data_template_id=" . $data["data_template_id"] . " and 
local_data_id=0");
+ 
+-              $host = db_fetch_row("select host.id,host.hostname from 
data_local,host where data_local.host_id=host.id and data_local.id=" . 
$_GET["id"]);
++              $host = db_fetch_row("select host.id,host.hostname from 
(data_local,host) where data_local.host_id=host.id and data_local.id=" . 
$_GET["id"]);
+ 
+               $header_label = "[edit: " . $data["name"] . "]";
+       }else{
+@@ -574,7 +574,7 @@
+       $i = 0;
+       if (!empty($data["data_input_id"])) {
+               /* get each INPUT field for this data input source */
+-              $fields = db_fetch_assoc("select * from data_input_fields where 
data_input_id=" . $data["data_input_id"] . " and input_output='in' order by 
name");
++              $fields = db_fetch_assoc("select * from data_input_fields where 
data_input_id=" . $data["data_input_id"] . " and input_output='in' order by 
sequence");
+ 
+               html_start_box("<strong>Custom Data</strong> [data input: " . 
db_fetch_cell("select name from data_input where id=" . $data["data_input_id"]) 
. "]", "98%", $colors["header"], "3", "center", "");
+ 
+@@ -992,7 +992,7 @@
+ 
+       $total_rows = sizeof(db_fetch_assoc("select
+               data_local.id
+-              from data_local,data_template_data
++              from (data_local,data_template_data)
+               where data_local.id=data_template_data.local_data_id
+               $sql_where"));
+       $data_sources = db_fetch_assoc("select
+@@ -1002,11 +1002,11 @@
+               data_input.name as data_input_name,
+               data_template.name as data_template_name,
+               data_local.host_id
+-              from data_local,data_template_data
++              from (data_local,data_template_data)
+               left join data_input
+-              on data_input.id=data_template_data.data_input_id
++              on (data_input.id=data_template_data.data_input_id)
+               left join data_template
+-              on data_local.data_template_id=data_template.id
++              on (data_local.data_template_id=data_template.id)
+               where data_local.id=data_template_data.local_data_id
+               $sql_where
+               order by data_template_data.name_cache,data_local.host_id
+diff -urbB cacti-0.8.6g/data_templates.php cacti/data_templates.php
+--- cacti-0.8.6g/data_templates.php    2005-09-09 01:56:25.000000000 +0200
++++ cacti/data_templates.php   2005-11-24 19:32:45.000000000 +0100
+@@ -556,7 +556,7 @@
+       $i = 0;
+       if (!empty($_GET["id"])) {
+               /* get each INPUT field for this data input source */
+-              $fields = db_fetch_assoc("select * from data_input_fields where 
data_input_id=" . $template_data["data_input_id"] . " and input_output='in' 
order by name");
++              $fields = db_fetch_assoc("select * from data_input_fields where 
data_input_id=" . $template_data["data_input_id"] . " and input_output='in' 
order by sequence");
+ 
+               html_start_box("<strong>Custom Data</strong> [data input: " . 
db_fetch_cell("select name from data_input where id=" . 
$template_data["data_input_id"]) . "]", "98%", $colors["header"], "3", 
"center", "");
+ 
+@@ -607,8 +607,8 @@
+               data_template.name,
+               data_input.name as data_input_method,
+               data_template_data.active as active
+-              from data_template,data_template_data
+-              left join data_input on data_template_data.data_input_id = 
data_input.id
++              from (data_template,data_template_data)
++              left join data_input on (data_template_data.data_input_id = 
data_input.id)
+               where data_template.id = data_template_data.data_template_id
+               and data_template_data.local_data_id = 0
+               order by data_template.name");
+Tylko w cacti: dev
+Tylko w cacti/docs: build
+diff -urbB cacti-0.8.6g/graph.php cacti/graph.php
+--- cacti-0.8.6g/graph.php     2005-09-09 01:56:25.000000000 +0200
++++ cacti/graph.php    2005-11-24 19:32:45.000000000 +0100
+@@ -132,7 +132,7 @@
+       /* find the step and how often this graph is updated with new data */
+       $ds_step = db_fetch_cell("select
+               data_template_data.rrd_step
+-              from data_template_data,data_template_rrd,graph_templates_item
++              from (data_template_data,data_template_rrd,graph_templates_item)
+               where graph_templates_item.task_item_id=data_template_rrd.id
+               and 
data_template_rrd.local_data_id=data_template_data.local_data_id
+               and graph_templates_item.local_graph_id=" . 
$_GET["local_graph_id"] .
+diff -urbB cacti-0.8.6g/graphs_items.php cacti/graphs_items.php
+--- cacti-0.8.6g/graphs_items.php      2005-09-09 01:56:25.000000000 +0200
++++ cacti/graphs_items.php     2005-11-24 19:32:45.000000000 +0100
+@@ -243,8 +243,8 @@
+               $struct_graph_item["task_item_id"]["sql"] = "select
+                       CONCAT_WS('',data_template_data.name_cache,' 
(',data_template_rrd.data_source_name,')') as name,
+                       data_template_rrd.id
+-                      from data_template_data,data_template_rrd,data_local
+-                      left join host on data_local.host_id=host.id
++                      from (data_template_data,data_template_rrd,data_local)
++                      left join host on (data_local.host_id=host.id)
+                       where data_template_rrd.local_data_id=data_local.id
+                       and data_template_data.local_data_id=data_local.id
+                       " . (((!empty($host_id)) || 
(!empty($_REQUEST["host_id"]))) ? (!empty($host_id) ? " and 
data_local.host_id=$host_id" : " and data_local.host_id=" . 
$_REQUEST["host_id"]) : "") . "
+diff -urbB cacti-0.8.6g/graphs_new.php cacti/graphs_new.php
+--- cacti-0.8.6g/graphs_new.php        2005-09-09 01:56:25.000000000 +0200
++++ cacti/graphs_new.php       2005-11-24 19:32:45.000000000 +0100
+@@ -264,7 +264,7 @@
+                               data_template.name as data_template_name,
+                               data_template_rrd.data_source_name,
+                               data_template_data.*
+-                              from data_template, data_template_rrd, 
data_template_data, graph_templates_item
++                              from (data_template, data_template_rrd, 
data_template_data, graph_templates_item)
+                               where 
graph_templates_item.task_item_id=data_template_rrd.id
+                               and 
data_template_rrd.data_template_id=data_template.id
+                               and 
data_template_data.data_template_id=data_template.id
+@@ -277,7 +277,7 @@
+                       $graph_template = db_fetch_row("select
+                               graph_templates.name as graph_template_name,
+                               graph_templates_graph.*
+-                              from graph_templates, graph_templates_graph
++                              from (graph_templates, graph_templates_graph)
+                               where 
graph_templates.id=graph_templates_graph.graph_template_id
+                               and graph_templates.id=" . $graph_template_id . 
"
+                               and graph_templates_graph.local_graph_id=0");
+@@ -441,14 +441,14 @@
+       $graph_templates = db_fetch_assoc("select
+               graph_templates.id as graph_template_id,
+               graph_templates.name as graph_template_name
+-              from host_graph,graph_templates
++              from (host_graph,graph_templates)
+               where host_graph.graph_template_id=graph_templates.id
+               and host_graph.host_id=" . $_REQUEST["host_id"] . "
+               order by graph_templates.name");
+ 
+       $template_graphs = db_fetch_assoc("select
+               graph_local.graph_template_id
+-              from graph_local,host_graph
++              from (graph_local,host_graph)
+               where graph_local.graph_template_id=host_graph.graph_template_id
+               and graph_local.host_id=host_graph.host_id
+               and graph_local.host_id=" . $host["id"] . "
+@@ -496,7 +496,7 @@
+       $available_graph_templates = db_fetch_assoc("SELECT
+               graph_templates.id, graph_templates.name
+               FROM snmp_query_graph RIGHT JOIN graph_templates
+-              ON snmp_query_graph.graph_template_id = graph_templates.id
++              ON (snmp_query_graph.graph_template_id = graph_templates.id)
+               WHERE (((snmp_query_graph.name) Is Null)) ORDER BY 
graph_templates.name");
+ 
+       /* create a row at the bottom that lets the user create any graph they 
choose */
+@@ -513,7 +513,7 @@
+               snmp_query.id,
+               snmp_query.name,
+               snmp_query.xml_path
+-              from snmp_query,host_snmp_query
++              from (snmp_query,host_snmp_query)
+               where host_snmp_query.snmp_query_id=snmp_query.id
+               and host_snmp_query.host_id=" . $host["id"] . "
+               order by snmp_query.name");
+@@ -562,9 +562,9 @@
+                       foreach ($snmp_query_graphs as $snmp_query_graph) {
+                               $created_graphs = db_fetch_assoc("select 
distinct
+                                       data_local.snmp_index
+-                                      from data_local,data_template_data
+-                                      left join data_input_data on 
data_template_data.id=data_input_data.data_template_data_id
+-                                      left join data_input_fields on 
data_input_data.data_input_field_id=data_input_fields.id
++                                      from (data_local,data_template_data)
++                                      left join data_input_data on 
(data_template_data.id=data_input_data.data_template_data_id)
++                                      left join data_input_fields on 
(data_input_data.data_input_field_id=data_input_fields.id)
+                                       where 
data_local.id=data_template_data.local_data_id
+                                       and 
data_input_fields.type_code='output_type'
+                                       and data_input_data.value='" . 
$snmp_query_graph["id"] . "'
+diff -urbB cacti-0.8.6g/graphs.php cacti/graphs.php
+--- cacti-0.8.6g/graphs.php    2005-09-09 01:56:25.000000000 +0200
++++ cacti/graphs.php   2005-11-24 19:32:45.000000000 +0100
+@@ -218,7 +218,7 @@
+                       /* we need to find out which graph items will be 
affected by saving this particular item */
+                       $item_list = db_fetch_assoc("select
+                               graph_templates_item.id
+-                              from 
graph_template_input_defs,graph_templates_item
++                              from 
(graph_template_input_defs,graph_templates_item)
+                               where 
graph_template_input_defs.graph_template_item_id=graph_templates_item.local_graph_template_item_id
+                               and graph_templates_item.local_graph_id=" . 
$_POST["local_graph_id"] . "
+                               and 
graph_template_input_defs.graph_template_input_id=" . $input["id"]);
+@@ -279,7 +279,7 @@
+                                       case '2': /* delete all data sources 
referenced by this graph */
+                                               $data_sources = 
db_fetch_assoc("select
+                                                       
data_template_data.local_data_id
+-                                                      from 
data_template_rrd,data_template_data,graph_templates_item
++                                                      from 
(data_template_rrd,data_template_data,graph_templates_item)
+                                                       where 
graph_templates_item.task_item_id=data_template_rrd.id
+                                                       and 
data_template_rrd.local_data_id=data_template_data.local_data_id
+                                                       and " . 
array_to_sql_or($selected_items, "graph_templates_item.local_graph_id") . "
+@@ -399,7 +399,7 @@
+                       $data_sources = db_fetch_assoc("select
+                               data_template_data.local_data_id,
+                               data_template_data.name_cache
+-                              from 
data_template_rrd,data_template_data,graph_templates_item
++                              from 
(data_template_rrd,data_template_data,graph_templates_item)
+                               where 
graph_templates_item.task_item_id=data_template_rrd.id
+                               and 
data_template_rrd.local_data_id=data_template_data.local_data_id
+                               and " . array_to_sql_or($graph_array, 
"graph_templates_item.local_graph_id") . "
+@@ -551,11 +551,11 @@
+                       cdef.name as cdef_name,
+                       colors.hex
+                       from graph_templates_item
+-                      left join data_template_rrd on 
graph_templates_item.task_item_id=data_template_rrd.id
+-                      left join data_local on 
data_template_rrd.local_data_id=data_local.id
+-                      left join data_template_data on 
data_local.id=data_template_data.local_data_id
+-                      left join cdef on cdef_id=cdef.id
+-                      left join colors on color_id=colors.id
++                      left join data_template_rrd on 
(graph_templates_item.task_item_id=data_template_rrd.id)
++                      left join data_local on 
(data_template_rrd.local_data_id=data_local.id)
++                      left join data_template_data on 
(data_local.id=data_template_data.local_data_id)
++                      left join cdef on (cdef_id=cdef.id)
++                      left join colors on (color_id=colors.id)
+                       where graph_templates_item.local_graph_id=" . 
$_GET["id"] . "
+                       order by graph_templates_item.sequence");
+ 
+@@ -598,11 +598,12 @@
+               CONCAT_WS(' - 
',data_template_data.name,data_template_rrd.data_source_name) as task_item_id,
+               cdef.name as cdef_id,
+               colors.hex as color_id
+-              from graph_templates_item left join data_template_rrd on 
graph_templates_item.task_item_id=data_template_rrd.id
+-              left join data_local on 
data_template_rrd.local_data_id=data_local.id
+-              left join data_template_data on 
data_local.id=data_template_data.local_data_id
+-              left join cdef on cdef_id=cdef.id
+-              left join colors on color_id=colors.id";
++              from graph_templates_item
++              left join data_template_rrd on 
(graph_templates_item.task_item_id=data_template_rrd.id)
++              left join data_local on 
(data_template_rrd.local_data_id=data_local.id)
++              left join data_template_data on 
(data_local.id=data_template_data.local_data_id)
++              left join cdef on (cdef_id=cdef.id)
++              left join colors on (color_id=colors.id)";
+ 
+       /* first, get information about the graph template as that's what we're 
going to model this
+       graph after */
+@@ -621,7 +622,7 @@
+       $graph_template_inputs = db_fetch_assoc("select
+               graph_template_input.column_name,
+               graph_template_input_defs.graph_template_item_id
+-              from graph_template_input,graph_template_input_defs
++              from (graph_template_input,graph_template_input_defs)
+               where 
graph_template_input.id=graph_template_input_defs.graph_template_input_id
+               and graph_template_input.graph_template_id=" . 
$_GET["graph_template_id"]);
+ 
+@@ -1037,7 +1038,7 @@
+ 
+       $total_rows = db_fetch_cell("select
+               COUNT(graph_templates_graph.id)
+-              from graph_local,graph_templates_graph
++              from (graph_local,graph_templates_graph)
+               where graph_local.id=graph_templates_graph.local_graph_id
+               $sql_where");
+ 
+@@ -1049,8 +1050,8 @@
+               graph_templates_graph.title_cache,
+               graph_templates.name,
+               graph_local.host_id
+-              from graph_local,graph_templates_graph
+-              left join graph_templates on 
graph_local.graph_template_id=graph_templates.id
++              from (graph_local,graph_templates_graph)
++              left join graph_templates on 
(graph_local.graph_template_id=graph_templates.id)
+               where graph_local.id=graph_templates_graph.local_graph_id
+               $sql_where
+               order by graph_templates_graph.title_cache,graph_local.host_id
+diff -urbB cacti-0.8.6g/graph_templates_inputs.php 
cacti/graph_templates_inputs.php
+--- cacti-0.8.6g/graph_templates_inputs.php    2005-09-09 01:56:25.000000000 
+0200
++++ cacti/graph_templates_inputs.php   2005-11-24 19:32:45.000000000 +0100
+@@ -181,9 +181,9 @@
+               graph_template_input_defs.graph_template_input_id
+               from graph_templates_item
+               left join graph_template_input_defs on 
(graph_template_input_defs.graph_template_item_id=graph_templates_item.id and 
graph_template_input_defs.graph_template_input_id=" . $_GET["id"] . ")
+-              left join data_template_rrd on 
graph_templates_item.task_item_id=data_template_rrd.id
+-              left join data_local on 
data_template_rrd.local_data_id=data_local.id
+-              left join data_template_data on 
data_local.id=data_template_data.local_data_id
++              left join data_template_rrd on 
(graph_templates_item.task_item_id=data_template_rrd.id)
++              left join data_local on 
(data_template_rrd.local_data_id=data_local.id)
++              left join data_template_data on 
(data_local.id=data_template_data.local_data_id)
+               where graph_templates_item.local_graph_id=0
+               and graph_templates_item.graph_template_id=" . 
$_GET["graph_template_id"] . "
+               order by graph_templates_item.sequence");
+diff -urbB cacti-0.8.6g/graph_templates_items.php 
cacti/graph_templates_items.php
+--- cacti-0.8.6g/graph_templates_items.php     2005-09-09 01:56:25.000000000 
+0200
++++ cacti/graph_templates_items.php    2005-11-24 19:32:45.000000000 +0100
+@@ -135,7 +135,7 @@
+                                       graph_template_input.id,
+                                       graph_template_input.name,
+                                       graph_templates_item.task_item_id
+-                                      from 
graph_template_input,graph_template_input_defs,graph_templates_item
++                                      from 
(graph_template_input,graph_template_input_defs,graph_templates_item)
+                                       where 
graph_template_input.id=graph_template_input_defs.graph_template_input_id
+                                       and 
graph_template_input_defs.graph_template_item_id=graph_templates_item.id
+                                       and 
graph_template_input.graph_template_id=" . $save["graph_template_id"] . "
+@@ -271,7 +271,7 @@
+       /* delete the graph item input if it is empty */
+       $graph_item_inputs = db_fetch_assoc("select
+               graph_template_input.id
+-              from graph_template_input,graph_template_input_defs
++              from (graph_template_input,graph_template_input_defs)
+               where 
graph_template_input.id=graph_template_input_defs.graph_template_input_id
+               and graph_template_input.graph_template_id=" . 
$_GET["graph_template_id"] . "
+               and graph_template_input_defs.graph_template_item_id=" . 
$_GET["id"] . "
+@@ -319,7 +319,7 @@
+       $struct_graph_item["task_item_id"]["sql"] = "select
+               CONCAT_WS('',data_template.name,' - ',' 
(',data_template_rrd.data_source_name,')') as name,
+               data_template_rrd.id
+-              from data_template_data,data_template_rrd,data_template
++              from (data_template_data,data_template_rrd,data_template)
+               where data_template_rrd.data_template_id=data_template.id
+               and data_template_data.data_template_id=data_template.id
+               and data_template_data.local_data_id=0
+@@ -341,7 +341,7 @@
+               $graph_item_input_fields = db_fetch_assoc("select
+                       graph_template_input.id,
+                       graph_template_input.column_name
+-                      from graph_template_input,graph_template_input_defs
++                      from (graph_template_input,graph_template_input_defs)
+                       where 
graph_template_input.id=graph_template_input_defs.graph_template_input_id
+                       and graph_template_input.graph_template_id=" . 
$_GET["graph_template_id"] . "
+                       and graph_template_input_defs.graph_template_item_id=" 
. $_GET["id"] . "
+diff -urbB cacti-0.8.6g/graph_templates.php cacti/graph_templates.php
+--- cacti-0.8.6g/graph_templates.php   2005-09-09 01:56:25.000000000 +0200
++++ cacti/graph_templates.php  2005-11-24 19:32:45.000000000 +0100
+@@ -292,11 +292,11 @@
+                       cdef.name as cdef_name,
+                       colors.hex
+                       from graph_templates_item
+-                      left join data_template_rrd on 
graph_templates_item.task_item_id=data_template_rrd.id
+-                      left join data_local on 
data_template_rrd.local_data_id=data_local.id
+-                      left join data_template_data on 
data_local.id=data_template_data.local_data_id
+-                      left join cdef on cdef_id=cdef.id
+-                      left join colors on color_id=colors.id
++                      left join data_template_rrd on 
(graph_templates_item.task_item_id=data_template_rrd.id)
++                      left join data_local on 
(data_template_rrd.local_data_id=data_local.id)
++                      left join data_template_data on 
(data_local.id=data_template_data.local_data_id)
++                      left join cdef on (cdef_id=cdef.id)
++                      left join colors on (color_id=colors.id)
+                       where graph_templates_item.graph_template_id=" . 
$_GET["id"] . "
+                       and graph_templates_item.local_graph_id=0
+                       order by graph_templates_item.sequence");
+diff -urbB cacti-0.8.6g/graph_view.php cacti/graph_view.php
+--- cacti-0.8.6g/graph_view.php        2005-09-09 01:56:25.000000000 +0200
++++ cacti/graph_view.php       2005-11-24 19:32:45.000000000 +0100
+@@ -156,8 +156,8 @@
+       if (read_config_option("global_auth") == "on") {
+               $sql_where = "where " . 
get_graph_permissions_sql($current_user["policy_graphs"], 
$current_user["policy_hosts"], $current_user["policy_graph_templates"]);
+ 
+-              $sql_join = "left join host on host.id=graph_local.host_id
+-                      left join graph_templates on 
graph_templates.id=graph_local.graph_template_id
++              $sql_join = "left join host on (host.id=graph_local.host_id)
++                      left join graph_templates on 
(graph_templates.id=graph_local.graph_template_id)
+                       left join user_auth_perms on 
((graph_templates_graph.local_graph_id=user_auth_perms.item_id and 
user_auth_perms.type=1 and user_auth_perms.user_id=" . 
$_SESSION["sess_user_id"] . ") OR (host.id=user_auth_perms.item_id and 
user_auth_perms.type=3 and user_auth_perms.user_id=" . 
$_SESSION["sess_user_id"] . ") OR (graph_templates.id=user_auth_perms.item_id 
and user_auth_perms.type=4 and user_auth_perms.user_id=" . 
$_SESSION["sess_user_id"] . "))";
+       }else{
+               $sql_where = "";
+@@ -207,7 +207,7 @@
+               }
+       }
+ 
+-      $sql_base = "from graph_templates_graph,graph_local
++      $sql_base = "from (graph_templates_graph,graph_local)
+               $sql_join
+               $sql_where
+               " . (empty($sql_where) ? "where" : "and") . " 
graph_templates_graph.local_graph_id > 0
+@@ -426,8 +426,8 @@
+       if (read_config_option("global_auth") == "on") {
+               /* get policy information for the sql where clause */
+               $sql_where = "where " . 
get_graph_permissions_sql($current_user["policy_graphs"], 
$current_user["policy_hosts"], $current_user["policy_graph_templates"]);
+-              $sql_join = "left join host on host.id=graph_local.host_id
+-                      left join graph_templates on 
graph_templates.id=graph_local.graph_template_id
++              $sql_join = "left join host on (host.id=graph_local.host_id)
++                      left join graph_templates on 
(graph_templates.id=graph_local.graph_template_id)
+                       left join user_auth_perms on 
((graph_templates_graph.local_graph_id=user_auth_perms.item_id and 
user_auth_perms.type=1 and user_auth_perms.user_id=" . 
$_SESSION["sess_user_id"] . ") OR (host.id=user_auth_perms.item_id and 
user_auth_perms.type=3 and user_auth_perms.user_id=" . 
$_SESSION["sess_user_id"] . ") OR (graph_templates.id=user_auth_perms.item_id 
and user_auth_perms.type=4 and user_auth_perms.user_id=" . 
$_SESSION["sess_user_id"] . "))";
+ 
+       }else{
+@@ -435,7 +435,7 @@
+               $sql_join = "";
+       }
+ 
+-      $sql_base = "from graph_templates_graph,graph_local
++      $sql_base = "from (graph_templates_graph,graph_local)
+               $sql_join
+               $sql_where
+               " . (empty($sql_where) ? "where" : "and") . " 
graph_templates_graph.local_graph_id > 0
+diff -urbB cacti-0.8.6g/host.php cacti/host.php
+--- cacti-0.8.6g/host.php      2005-09-09 01:56:25.000000000 +0200
++++ cacti/host.php     2005-11-24 19:32:45.000000000 +0100
+@@ -509,7 +514,7 @@
+               $selected_graph_templates = db_fetch_assoc("select
+                       graph_templates.id,
+                       graph_templates.name
+-                      from graph_templates,host_graph
++                      from (graph_templates,host_graph)
+                       where graph_templates.id=host_graph.graph_template_id
+                       and host_graph.host_id=" . $_GET["id"] . "
+                       order by graph_templates.name");
+@@ -517,7 +522,7 @@
+               $available_graph_templates = db_fetch_assoc("SELECT
+                       graph_templates.id, graph_templates.name
+                       FROM snmp_query_graph RIGHT JOIN graph_templates
+-                      ON snmp_query_graph.graph_template_id = 
graph_templates.id
++                      ON (snmp_query_graph.graph_template_id = 
graph_templates.id)
+                       WHERE (((snmp_query_graph.name) Is Null)) ORDER BY 
graph_templates.name");
+ 
+               $i = 0;
+@@ -569,7 +574,7 @@
+                       snmp_query.id,
+                       snmp_query.name,
+                       host_snmp_query.reindex_method
+-                      from snmp_query,host_snmp_query
++                      from (snmp_query,host_snmp_query)
+                       where snmp_query.id=host_snmp_query.snmp_query_id
+                       and host_snmp_query.host_id=" . $_GET["id"] . "
+                       order by snmp_query.name");
+diff -urbB cacti-0.8.6g/host_templates.php cacti/host_templates.php
+--- cacti-0.8.6g/host_templates.php    2005-09-09 01:56:25.000000000 +0200
++++ cacti/host_templates.php   2005-11-24 19:32:45.000000000 +0100
+@@ -261,7 +261,7 @@
+               $selected_graph_templates = db_fetch_assoc("select
+                       graph_templates.id,
+                       graph_templates.name
+-                      from graph_templates,host_template_graph
++                      from (graph_templates,host_template_graph)
+                       where 
graph_templates.id=host_template_graph.graph_template_id
+                       and host_template_graph.host_template_id=" . 
$_GET["id"] . "
+                       order by graph_templates.name");
+@@ -311,7 +311,7 @@
+               $selected_data_queries = db_fetch_assoc("select
+                       snmp_query.id,
+                       snmp_query.name
+-                      from snmp_query,host_template_snmp_query
++                      from (snmp_query,host_template_snmp_query)
+                       where 
snmp_query.id=host_template_snmp_query.snmp_query_id
+                       and host_template_snmp_query.host_template_id=" . 
$_GET["id"] . "
+                       order by snmp_query.name");
+diff -urbB cacti-0.8.6g/include/config_form.php cacti/include/config_form.php
+--- cacti-0.8.6g/include/config_form.php       2005-09-09 01:56:25.000000000 
+0200
++++ cacti/include/config_form.php      2005-11-24 19:32:42.000000000 +0100
+@@ -243,7 +243,7 @@
+               "form_id" => "|arg1:id|",
+               "sql" => "select rra_id as id,data_template_data_id from 
data_template_data_rra where data_template_data_id=|arg1:id|",
+               "sql_all" => "select rra.id from rra order by id",
+-              "sql_print" => "select rra.name from data_template_data_rra,rra 
where data_template_data_rra.rra_id=rra.id and 
data_template_data_rra.data_template_data_id=|arg1:id|",
++              "sql_print" => "select rra.name from 
(data_template_data_rra,rra) where data_template_data_rra.rra_id=rra.id and 
data_template_data_rra.data_template_data_id=|arg1:id|",
+               "flags" => "ALWAYSTEMPLATE"
+               ),
+       "rrd_step" => array(
+@@ -474,8 +474,8 @@
+               "sql" => "select
+                       CONCAT_WS('',case when host.description is null then 
'No Host' when host.description is not null then host.description end,' - 
',data_template_data.name,' (',data_template_rrd.data_source_name,')') as name,
+                       data_template_rrd.id
+-                      from data_template_data,data_template_rrd,data_local
+-                      left join host on data_local.host_id=host.id
++                      from (data_template_data,data_template_rrd,data_local)
++                      left join host on (data_local.host_id=host.id)
+                       where data_template_rrd.local_data_id=data_local.id
+                       and data_template_data.local_data_id=data_local.id
+                       order by name",
+@@ -628,7 +628,7 @@
+               "description" => "Choose what type of host, host template this 
is. The host template will govern what kinds of data should be gathered from 
this type of host.",
+               "value" => "|arg1:host_template_id|",
+               "none_value" => "None",
+-              "sql" => "select id,name from host_template",
++              "sql" => "select id,name from host_template order by name",
+               ),
+       "disabled" => array(
+               "method" => "checkbox",
+diff -urbB cacti-0.8.6g/install/0_8_6_to_0_8_6a.php 
cacti/install/0_8_6_to_0_8_6a.php
+--- cacti-0.8.6g/install/0_8_6_to_0_8_6a.php   2005-09-09 01:56:25.000000000 
+0200
++++ cacti/install/0_8_6_to_0_8_6a.php  2005-11-24 19:32:44.000000000 +0100
+@@ -56,7 +56,7 @@
+                       /* find non-templated graph template items */
+                       $non_templated_items = 
array_rekey(db_fetch_assoc("select
+                               graph_template_input_defs.graph_template_item_id
+-                              from 
graph_template_input,graph_template_input_defs
++                              from 
(graph_template_input,graph_template_input_defs)
+                               where 
graph_template_input_defs.graph_template_input_id=graph_template_input.id
+                               and graph_template_input.column_name = 
'task_item_id'
+                               and graph_template_input.graph_template_id = '" 
. $graph_template["id"] . "'"), "graph_template_item_id", 
"graph_template_item_id");
+diff -urbB cacti-0.8.6g/lib/auth.php cacti/lib/auth.php
+--- cacti-0.8.6g/lib/auth.php  2005-09-09 01:56:25.000000000 +0200
++++ cacti/lib/auth.php 2005-11-24 19:32:36.000000000 +0100
+@@ -130,9 +130,9 @@
+       
+       $graphs = db_fetch_assoc("select
+               graph_templates_graph.local_graph_id
+-              from graph_templates_graph,graph_local
+-              left join host on host.id=graph_local.host_id
+-              left join graph_templates on 
graph_templates.id=graph_local.graph_template_id
++              from (graph_templates_graph,graph_local)
++              left join host on (host.id=graph_local.host_id)
++              left join graph_templates on 
(graph_templates.id=graph_local.graph_template_id)
+               left join user_auth_perms on 
((graph_templates_graph.local_graph_id=user_auth_perms.item_id and 
user_auth_perms.type=1 and user_auth_perms.user_id=" . 
$_SESSION["sess_user_id"] . ") OR (host.id=user_auth_perms.item_id and 
user_auth_perms.type=3 and user_auth_perms.user_id=" . 
$_SESSION["sess_user_id"] . ") OR (graph_templates.id=user_auth_perms.item_id 
and user_auth_perms.type=4 and user_auth_perms.user_id=" . 
$_SESSION["sess_user_id"] . "))
+               where graph_templates_graph.local_graph_id=graph_local.id
+               " . (empty($sql_where) ? "" : "and $sql_where") . "
+diff -urbB cacti-0.8.6g/lib/data_query.php cacti/lib/data_query.php
+--- cacti-0.8.6g/lib/data_query.php    2005-09-09 01:56:25.000000000 +0200
++++ cacti/lib/data_query.php   2005-11-24 19:32:36.000000000 +0100
+@@ -31,7 +31,7 @@
+       include_once($config["library_path"] . "/utility.php");
+ 
+       debug_log_insert("data_query", "Running data query [$snmp_query_id].");
+-      $type_id = db_fetch_cell("select data_input.type_id from 
snmp_query,data_input where snmp_query.data_input_id=data_input.id and 
snmp_query.id=$snmp_query_id");
++      $type_id = db_fetch_cell("select data_input.type_id from 
(snmp_query,data_input) where snmp_query.data_input_id=data_input.id and 
snmp_query.id=$snmp_query_id");
+ 
+       if ($type_id == DATA_INPUT_TYPE_SNMP_QUERY) {
+               debug_log_insert("data_query", "Found type = '3' [snmp 
query].");
+@@ -301,7 +301,7 @@
+       $field = db_fetch_assoc("select
+               data_input_fields.type_code,
+               data_input_data.value
+-              from data_input_fields,data_input_data
++              from (data_input_fields,data_input_data)
+               where data_input_fields.id=data_input_data.data_input_field_id
+               and data_input_data.data_template_data_id=$data_template_data_id
+               and (data_input_fields.type_code='index_type' or 
data_input_fields.type_code='index_value' or 
data_input_fields.type_code='output_type')");
+@@ -372,7 +372,7 @@
+ 
+       $field = data_query_field_list(db_fetch_cell("select
+               data_template_data.id
+-              from graph_templates_item,data_template_rrd,data_template_data
++              from (graph_templates_item,data_template_rrd,data_template_data)
+               where graph_templates_item.task_item_id=data_template_rrd.id
+               and 
data_template_rrd.local_data_id=data_template_data.local_data_id
+               and graph_templates_item.local_graph_id=$local_graph_id
+@@ -441,7 +441,7 @@
+       $sort_field_data = array_rekey(db_fetch_assoc("select
+               graph_local.snmp_index,
+               host_snmp_cache.field_value
+-              from graph_local,host_snmp_cache
++              from (graph_local,host_snmp_cache)
+               where graph_local.host_id=host_snmp_cache.host_id
+               and graph_local.snmp_query_id=host_snmp_cache.snmp_query_id
+               and graph_local.snmp_index=host_snmp_cache.snmp_index
+diff -urbB cacti-0.8.6g/lib/export.php cacti/lib/export.php
+--- cacti-0.8.6g/lib/export.php        2005-09-09 01:56:25.000000000 +0200
++++ cacti/lib/export.php       2005-11-24 19:32:36.000000000 +0100
+@@ -646,7 +646,7 @@
+               /* dep: data template */
<<Diff was trimmed, longer than 597 lines>>
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to