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("Custom Data [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("Custom Data [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 */ $graph_template_items = db_fetch_assoc("select data_template_rrd.data_template_id - from graph_templates_item,data_template_rrd + from (graph_templates_item,data_template_rrd) where graph_templates_item.task_item_id=data_template_rrd.id and graph_templates_item.graph_template_id=$id and graph_templates_item.local_graph_id=0 diff -urbB cacti-0.8.6g/lib/functions.php cacti/lib/functions.php --- cacti-0.8.6g/lib/functions.php 2005-09-09 01:56:25.000000000 +0200 +++ cacti/lib/functions.php 2005-11-24 19:32:36.000000000 +0100 @@ -678,7 +678,7 @@ data_template_data.data_input_id, data_input.type_id, data_input.input_string - from data_template_data,data_input + from (data_template_data,data_input) where data_template_data.data_input_id=data_input.id and data_template_data.local_data_id=$local_data_id"); @@ -692,7 +692,7 @@ data_input_data.value from data_input_fields left join data_input_data - on data_input_fields.id=data_input_data.data_input_field_id + on (data_input_fields.id=data_input_data.data_input_field_id) where data_input_fields.data_input_id=" . $data_source["data_input_id"] . " and data_input_data.data_template_data_id=" . $data_source["id"] . " and data_input_fields.input_output='in'"); @@ -726,7 +726,7 @@ $data_source = db_fetch_row("select data_template_rrd.data_source_name, data_template_data.name - from data_template_rrd,data_template_data + from (data_template_rrd,data_template_data) where data_template_rrd.local_data_id=data_template_data.local_data_id and data_template_rrd.id=$data_template_rrd_id"); @@ -830,7 +830,7 @@ data_local.snmp_query_id, data_local.snmp_index, data_template_data.name - from data_template_data,data_local + from (data_template_data,data_local) where data_template_data.local_data_id=data_local.id and data_local.id=$local_data_id"); @@ -850,7 +850,7 @@ graph_local.snmp_query_id, graph_local.snmp_index, graph_templates_graph.title - from graph_templates_graph,graph_local + from (graph_templates_graph,graph_local) where graph_templates_graph.local_graph_id=graph_local.id and graph_local.id=$local_graph_id"); @@ -869,7 +869,7 @@ $host_part = ""; $ds_part = ""; /* try any prepend the name with the host description */ - $host_name = db_fetch_cell("select host.description from host,data_local where data_local.host_id=host.id and data_local.id=$local_data_id"); + $host_name = db_fetch_cell("select host.description from (host,data_local) where data_local.host_id=host.id and data_local.id=$local_data_id"); if (!empty($host_name)) { $host_part = strtolower(clean_up_name($host_name)) . "_"; @@ -1424,7 +1420,7 @@ rra.name, rra.timespan, data_template_data.rrd_step - from graph_templates_item,data_template_data_rra,data_template_rrd,data_template_data,rra + from (graph_templates_item,data_template_data_rra,data_template_rrd,data_template_data,rra) 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 data_template_data.id=data_template_data_rra.data_template_data_id diff -urbB cacti-0.8.6g/lib/graph_export.php cacti/lib/graph_export.php --- cacti-0.8.6g/lib/graph_export.php 2005-09-09 01:56:25.000000000 +0200 +++ cacti/lib/graph_export.php 2005-11-24 19:32:36.000000000 +0100 @@ -332,8 +339,9 @@ graph_templates_graph.title_cache, graph_templates.name, graph_local.host_id - from graph_templates_graph left join graph_templates on graph_templates_graph.graph_template_id=graph_templates.id - left join graph_local on graph_templates_graph.local_graph_id=graph_local.id + from graph_templates_graph + left join graph_templates on (graph_templates_graph.graph_template_id=graph_templates.id) + left join graph_local on (graph_templates_graph.local_graph_id=graph_local.id) where graph_templates_graph.local_graph_id!=0 and graph_templates_graph.export='on' order by graph_templates_graph.title_cache"); @@ -550,8 +558,8 @@ graph_templates.name, graph_local.host_id from graph_templates_graph - left join graph_templates on graph_templates_graph.graph_template_id=graph_templates.id - left join graph_local on graph_templates_graph.local_graph_id=graph_local.id + left join graph_templates on (graph_templates_graph.graph_template_id=graph_templates.id) + left join graph_local on (graph_templates_graph.local_graph_id=graph_local.id) where graph_local.host_id=".get_host_id($parent_tree_item_id)." and graph_templates_graph.local_graph_id!=0 and graph_templates_graph.export='on' @@ -568,9 +576,9 @@ graph_local.host_id, graph_tree_items.id as gtid from graph_templates_graph - left join graph_tree_items on graph_templates_graph.local_graph_id=graph_tree_items.local_graph_id - left join graph_templates on graph_templates_graph.graph_template_id=graph_templates.id - left join graph_local on graph_templates_graph.local_graph_id=graph_local.id + left join graph_tree_items on (graph_templates_graph.local_graph_id=graph_tree_items.local_graph_id) + left join graph_templates on (graph_templates_graph.graph_template_id=graph_templates.id) + left join graph_local on (graph_templates_graph.local_graph_id=graph_local.id) where graph_tree_items.graph_tree_id =".$tree_id." and graph_templates_graph.local_graph_id!=0 and graph_templates_graph.export='on' @@ -776,7 +784,7 @@ graph_tree_items.host_grouping_type, host.description as hostname from graph_tree_items - left join host on host.id=graph_tree_items.host_id + left join host on (host.id=graph_tree_items.host_id) where graph_tree_items.graph_tree_id=" . $tree_id . " and graph_tree_items.local_graph_id = 0 order by graph_tree_items.order_key"); @@ -796,7 +804,7 @@ $graph_templates = db_fetch_assoc("select graph_templates.id, graph_templates.name - from graph_local,graph_templates,graph_templates_graph + from (graph_local,graph_templates,graph_templates_graph) where graph_local.id=graph_templates_graph.local_graph_id and graph_templates_graph.graph_template_id=graph_templates.id and graph_local.host_id=" . $leaf["host_id"] . " @@ -813,7 +821,7 @@ $data_queries = db_fetch_assoc("select snmp_query.id, snmp_query.name - from graph_local,snmp_query + from (graph_local,snmp_query) where graph_local.snmp_query_id=snmp_query.id and graph_local.host_id=" . $leaf["host_id"] . " group by snmp_query.id diff -urbB cacti-0.8.6g/lib/html_form_template.php cacti/lib/html_form_template.php --- cacti-0.8.6g/lib/html_form_template.php 2005-09-09 01:56:25.000000000 +0200 +++ cacti/lib/html_form_template.php 2005-11-24 19:32:36.000000000 +0100 @@ -125,8 +125,8 @@ when host.description is not null then '' end,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) ? "" : " and data_local.host_id=$host_id") . " @@ -139,7 +139,7 @@ $current_def_value = db_fetch_row("select graph_templates_item." . $item["column_name"] . ", graph_templates_item.id - from graph_templates_item,graph_template_input_defs + from (graph_templates_item,graph_template_input_defs) where graph_template_input_defs.graph_template_item_id=graph_templates_item.local_graph_template_item_id and graph_template_input_defs.graph_template_input_id=" . $item["id"] . " and graph_templates_item.local_graph_id=$local_graph_id @@ -148,7 +148,7 @@ $current_def_value = db_fetch_row("select graph_templates_item." . $item["column_name"] . ", graph_templates_item.id - from graph_templates_item,graph_template_input_defs + from (graph_templates_item,graph_template_input_defs) where graph_template_input_defs.graph_template_item_id=graph_templates_item.id and graph_template_input_defs.graph_template_input_id=" . $item["id"] . " and graph_templates_item.graph_template_id=" . $graph_template_id . " @@ -397,13 +397,13 @@ global $colors; $data = db_fetch_row("select id,data_input_id,data_template_id,name,local_data_id from data_template_data where id=$data_template_data_id"); - $host_id = db_fetch_cell("select host.id from data_local,host where data_local.host_id=host.id and data_local.id=" . $data["local_data_id"]); + $host_id = db_fetch_cell("select host.id from (data_local,host) where data_local.host_id=host.id and data_local.id=" . $data["local_data_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"); $draw_any_items = false; /* 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"); /* loop through each field found */ $i = 0; @@ -481,7 +481,7 @@ if (($field["type_code"] == "index_type") && (db_fetch_cell("select local_data_id from data_template_data where id=$data_template_data_id") > 0)) { $index_type = db_fetch_assoc("select host_snmp_cache.field_name - from data_template_data,data_local,host_snmp_cache + from (data_template_data,data_local,host_snmp_cache) where data_template_data.local_data_id=data_local.id and data_local.snmp_query_id=host_snmp_cache.snmp_query_id and data_template_data.id=$data_template_data_id @@ -496,7 +496,7 @@ $output_type = db_fetch_assoc("select snmp_query_graph.id, snmp_query_graph.name - from data_template_data,data_local,snmp_query_graph + from (data_template_data,data_local,snmp_query_graph) where data_template_data.local_data_id=data_local.id and data_local.snmp_query_id=snmp_query_graph.snmp_query_id and data_template_data.id=$data_template_data_id diff -urbB cacti-0.8.6g/lib/html_tree.php cacti/lib/html_tree.php --- cacti-0.8.6g/lib/html_tree.php 2005-09-09 01:56:25.000000000 +0200 +++ cacti/lib/html_tree.php 2005-11-24 19:32:36.000000000 +0100 @@ -49,8 +49,8 @@ /* get policy information for the sql where clause */ $sql_where = get_graph_permissions_sql($current_user["policy_graphs"], $current_user["policy_hosts"], $current_user["policy_graph_templates"]); $sql_where = (empty($sql_where) ? "" : "and (" . $sql_where . " OR graph_tree_items.local_graph_id=0)"); - $sql_join = "left join graph_local on graph_templates_graph.local_graph_id=graph_local.id - left join graph_templates on graph_templates.id=graph_local.graph_template_id + $sql_join = "left join graph_local on (graph_templates_graph.local_graph_id=graph_local.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"] . "))"; } @@ -75,7 +75,7 @@ from graph_tree_items left join graph_templates_graph on (graph_tree_items.local_graph_id=graph_templates_graph.local_graph_id and graph_tree_items.local_graph_id>0) left join settings_tree on (graph_tree_items.id=settings_tree.graph_tree_item_id and settings_tree.user_id=$user_id) - left join host on graph_tree_items.host_id=host.id + left join host on (graph_tree_items.host_id=host.id) $sql_join where graph_tree_items.graph_tree_id=$tree_id and graph_tree_items.order_key like '$search_key%' @@ -118,7 +118,7 @@ $graph_templates = db_fetch_assoc("select graph_templates.id, graph_templates.name - from graph_local,graph_templates,graph_templates_graph + from (graph_local,graph_templates,graph_templates_graph) where graph_local.id=graph_templates_graph.local_graph_id and graph_templates_graph.graph_template_id=graph_templates.id and graph_local.host_id=" . $leaf["host_id"] . " @@ -133,7 +133,7 @@ $graphs = db_fetch_assoc("select graph_templates_graph.title_cache, graph_templates_graph.local_graph_id - from graph_local,graph_templates,graph_templates_graph + from (graph_local,graph_templates,graph_templates_graph) where graph_local.id=graph_templates_graph.local_graph_id and graph_templates_graph.graph_template_id=graph_templates.id and graph_local.graph_template_id=" . $graph_template["id"] . " @@ -202,7 +202,7 @@ CONCAT_WS('',description,' (',hostname,')') as hostname from graph_tree_items left join graph_templates_graph on (graph_tree_items.local_graph_id=graph_templates_graph.local_graph_id and graph_tree_items.local_graph_id>0) - left join host on host.id=graph_tree_items.host_id + left join host on (host.id=graph_tree_items.host_id) where graph_tree_items.graph_tree_id=$tree_id order by graph_tree_items.order_key"); @@ -370,7 +370,7 @@ graph_tree_items.host_grouping_type, host.description as hostname from graph_tree_items - left join host on host.id=graph_tree_items.host_id + left join host on (host.id=graph_tree_items.host_id) $sql_join where graph_tree_items.graph_tree_id=" . $tree["id"] . " $sql_where @@ -392,7 +392,7 @@ $graph_templates = db_fetch_assoc("select graph_templates.id, graph_templates.name - from graph_local,graph_templates,graph_templates_graph + from (graph_local,graph_templates,graph_templates_graph) where graph_local.id=graph_templates_graph.local_graph_id and graph_templates_graph.graph_template_id=graph_templates.id and graph_local.host_id=" . $leaf["host_id"] . " @@ -409,7 +409,7 @@ $data_queries = db_fetch_assoc("select snmp_query.id, snmp_query.name - from graph_local,snmp_query + from (graph_local,snmp_query) where graph_local.snmp_query_id=snmp_query.id and graph_local.host_id=" . $leaf["host_id"] . " group by snmp_query.id @@ -477,15 +477,15 @@ $sql_where = get_graph_permissions_sql($current_user["policy_graphs"], $current_user["policy_hosts"], $current_user["policy_graph_templates"]); $sql_where = (empty($sql_where) ? "" : "and $sql_where"); $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 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"] . "))"; } /* get information for the headers */ if (!empty($tree_id)) { $tree_name = db_fetch_cell("select name from graph_tree where id=$tree_id"); } if (!empty($leaf_id)) { $leaf_name = $leaf["title"]; } - if (!empty($leaf_id)) { $host_name = db_fetch_cell("select host.description from graph_tree_items,host where graph_tree_items.host_id=host.id and graph_tree_items.id=$leaf_id"); } + if (!empty($leaf_id)) { $host_name = db_fetch_cell("select host.description from (graph_tree_items,host) where graph_tree_items.host_id=host.id and graph_tree_items.id=$leaf_id"); } $host_group_data_array = explode(":", $host_group_data); @@ -528,7 +528,7 @@ graph_tree_items.rra_id, graph_tree_items.order_key, graph_templates_graph.title_cache as title_cache - from graph_tree_items,graph_local + from (graph_tree_items,graph_local) left join graph_templates_graph on (graph_tree_items.local_graph_id=graph_templates_graph.local_graph_id and graph_tree_items.local_graph_id>0) $sql_join where graph_tree_items.graph_tree_id=$tree_id @@ -550,7 +550,7 @@ $graph_templates = db_fetch_assoc("select graph_templates.id, graph_templates.name - from graph_local,graph_templates,graph_templates_graph + from (graph_local,graph_templates,graph_templates_graph) where graph_local.id=graph_templates_graph.local_graph_id and graph_templates_graph.graph_template_id=graph_templates.id and graph_local.host_id=" . $leaf["host_id"] . " @@ -569,7 +569,7 @@ $graphs = db_fetch_assoc("select graph_templates_graph.title_cache, graph_templates_graph.local_graph_id - from graph_local,graph_templates_graph + from (graph_local,graph_templates_graph) $sql_join where graph_local.id=graph_templates_graph.local_graph_id and graph_local.graph_template_id=" . $graph_template["id"] . " @@ -589,7 +589,7 @@ $data_queries = db_fetch_assoc("select snmp_query.id, snmp_query.name - from graph_local,snmp_query + from (graph_local,snmp_query) where graph_local.snmp_query_id=snmp_query.id and graph_local.host_id=" . $leaf["host_id"] . " " . (!isset($data_query_id) ? "" : "and snmp_query.id=$data_query_id") . " @@ -614,7 +614,7 @@ graph_templates_graph.title_cache, graph_templates_graph.local_graph_id, graph_local.snmp_index - from graph_local,graph_templates_graph + from (graph_local,graph_templates_graph) $sql_join where graph_local.id=graph_templates_graph.local_graph_id and graph_local.snmp_query_id=" . $data_query["id"] . " diff -urbB cacti-0.8.6g/lib/import.php cacti/lib/import.php --- cacti-0.8.6g/lib/import.php 2005-09-09 01:56:25.000000000 +0200 +++ cacti/lib/import.php 2005-11-24 19:32:36.000000000 +0100 @@ -114,7 +114,7 @@ /* import into: graph_templates_graph */ unset($save); - $save["id"] = (empty($_graph_template_id) ? "0" : db_fetch_cell("select graph_templates_graph.id 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")); + $save["id"] = (empty($_graph_template_id) ? "0" : db_fetch_cell("select graph_templates_graph.id 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")); $save["graph_template_id"] = $graph_template_id; /* parse information from the hash */ @@ -251,7 +251,7 @@ /* import into: data_template_data */ unset($save); - $save["id"] = (empty($_data_template_id) ? "0" : db_fetch_cell("select data_template_data.id from data_template,data_template_data where data_template.id=data_template_data.data_template_id and data_template.id=$data_template_id and data_template_data.local_data_id=0")); + $save["id"] = (empty($_data_template_id) ? "0" : db_fetch_cell("select data_template_data.id from (data_template,data_template_data) where data_template.id=data_template_data.data_template_id and data_template.id=$data_template_id and data_template_data.local_data_id=0")); $save["data_template_id"] = $data_template_id; reset($struct_data_source); diff -urbB cacti-0.8.6g/lib/poller.php cacti/lib/poller.php --- cacti-0.8.6g/lib/poller.php 2005-09-09 01:56:25.000000000 +0200 +++ cacti/lib/poller.php 2005-11-24 19:32:36.000000000 +0100 @@ -167,7 +203,7 @@ $host = db_fetch_row("select hostname,snmp_community,snmp_version,snmp_username,snmp_password,snmp_port,snmp_timeout from host where id=$host_id"); $data_query = db_fetch_row("select reindex_method,sort_field from host_snmp_query where host_id=$host_id and snmp_query_id=$data_query_id"); - $data_query_type = db_fetch_cell("select data_input.type_id from data_input,snmp_query where data_input.id=snmp_query.data_input_id and snmp_query.id=$data_query_id"); + $data_query_type = db_fetch_cell("select data_input.type_id from (data_input,snmp_query) where data_input.id=snmp_query.data_input_id and snmp_query.id=$data_query_id"); $data_query_xml = get_data_query_array($data_query_id); switch ($data_query["reindex_method"]) { @@ -252,7 +288,7 @@ poller_item.rrd_path, poller_item.rrd_name, poller_item.rrd_num - from poller_output,poller_item + from (poller_output,poller_item) where (poller_output.local_data_id=poller_item.local_data_id and poller_output.rrd_name=poller_item.rrd_name)"); if (sizeof($results) > 0) { @@ -273,7 +309,7 @@ $rrd_field_names = array_rekey(db_fetch_assoc("select data_template_rrd.data_source_name, data_input_fields.data_name - from data_template_rrd,data_input_fields + from (data_template_rrd,data_input_fields) where data_template_rrd.data_input_field_id=data_input_fields.id and data_template_rrd.local_data_id=" . $item["local_data_id"]), "data_name", "data_source_name"); diff -urbB cacti-0.8.6g/lib/rrd.php cacti/lib/rrd.php --- cacti-0.8.6g/lib/rrd.php 2005-09-09 01:56:25.000000000 +0200 +++ cacti/lib/rrd.php 2005-11-24 19:32:36.000000000 +0100 @@ -167,9 +167,9 @@ rra_cf.consolidation_function_id, (rra.rows*rra.steps) as rra_order from data_template_data - left join data_template_data_rra on data_template_data.id=data_template_data_rra.data_template_data_id - left join rra on data_template_data_rra.rra_id=rra.id - left join rra_cf on rra.id=rra_cf.rra_id + left join data_template_data_rra on (data_template_data.id=data_template_data_rra.data_template_data_id) + left join rra on (data_template_data_rra.rra_id=rra.id) + left join rra_cf on (rra.id=rra_cf.rra_id) where data_template_data.local_data_id=$local_data_id and (rra.steps is not null or rra.rows is not null) order by rra_cf.consolidation_function_id,rra_order"); @@ -460,7 +461,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=$local_graph_id @@ -526,7 +527,7 @@ graph_templates_graph.unit_value, graph_templates_graph.unit_exponent_value, graph_templates_graph.export - from graph_templates_graph,graph_local + from (graph_templates_graph,graph_local) where graph_local.id=graph_templates_graph.local_graph_id and graph_templates_graph.local_graph_id=$local_graph_id"); @@ -548,9 +549,9 @@ data_template_rrd.data_source_name, data_template_rrd.local_data_template_rrd_id from graph_templates_item - left join data_template_rrd on graph_templates_item.task_item_id=data_template_rrd.id - left join colors on graph_templates_item.color_id=colors.id - left join graph_templates_gprint on graph_templates_item.gprint_id=graph_templates_gprint.id + left join data_template_rrd on (graph_templates_item.task_item_id=data_template_rrd.id) + left join colors on (graph_templates_item.color_id=colors.id) + left join graph_templates_gprint on (graph_templates_item.gprint_id=graph_templates_gprint.id) where graph_templates_item.local_graph_id=$local_graph_id order by graph_templates_item.sequence"); diff -urbB cacti-0.8.6g/lib/template.php cacti/lib/template.php --- cacti-0.8.6g/lib/template.php 2005-09-09 01:56:25.000000000 +0200 +++ cacti/lib/template.php 2005-11-24 19:32:36.000000000 +0100 @@ -54,7 +54,7 @@ data_input_data.value, data_input_data.t_value from data_input_fields left join data_input_data - on data_input_fields.id=data_input_data.data_input_field_id + on (data_input_fields.id=data_input_data.data_input_field_id) where data_input_data.data_template_data_id=" . $data_template["id"] . " and data_input_fields.input_output='in'"); @@ -349,7 +349,7 @@ $graph_item_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.graph_template_id=" . $graph_template_item["graph_template_id"] . " and graph_template_input.id=graph_template_input_defs.graph_template_input_id and graph_template_input_defs.graph_template_item_id=$graph_template_item_id"); @@ -418,7 +418,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=$graph_template_id"); @@ -609,7 +609,7 @@ data_template.id, data_template.name, data_template_rrd.data_source_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 @@ -657,7 +657,7 @@ $data_input_field = array_rekey(db_fetch_assoc("select data_input_fields.id, data_input_fields.type_code - from snmp_query,data_input,data_input_fields + from (snmp_query,data_input,data_input_fields) where snmp_query.data_input_id=data_input.id and data_input.id=data_input_fields.data_input_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') @@ -714,7 +714,7 @@ graph_templates_item.id, data_template_rrd.id as data_template_rrd_id, data_template_rrd.data_template_id - from graph_templates_item,data_template_rrd + from (graph_templates_item,data_template_rrd) where graph_templates_item.task_item_id=data_template_rrd.id and graph_templates_item.graph_template_id=$graph_template_id and local_graph_id=0 diff -urbB cacti-0.8.6g/lib/tree.php cacti/lib/tree.php --- cacti-0.8.6g/lib/tree.php 2005-09-09 01:56:25.000000000 +0200 +++ cacti/lib/tree.php 2005-11-24 19:32:36.000000000 +0100 @@ -213,7 +213,7 @@ CONCAT_WS('',description,' (',hostname,')') as hostname from graph_tree_items left join graph_templates_graph on (graph_tree_items.local_graph_id=graph_templates_graph.local_graph_id and graph_tree_items.local_graph_id>0) - left join host on host.id=graph_tree_items.host_id + left join host on (host.id=graph_tree_items.host_id) $sql_where order by graph_tree_items.order_key"); diff -urbB cacti-0.8.6g/lib/utility.php cacti/lib/utility.php --- cacti-0.8.6g/lib/utility.php 2005-09-09 01:56:25.000000000 +0200 +++ cacti/lib/utility.php 2005-11-24 19:32:36.000000000 +0100 @@ -58,7 +58,7 @@ data_template_data.id as data_template_data_id, data_template_data.data_template_id, data_template_data.active - from data_template_data,data_input + from (data_template_data,data_input) where data_template_data.data_input_id=data_input.id and data_template_data.local_data_id=$local_data_id"); @@ -82,7 +81,7 @@ $outputs = db_fetch_assoc("select snmp_query_graph_rrd.snmp_field_name, data_template_rrd.id as data_template_rrd_id - from snmp_query_graph_rrd,data_template_rrd + from (snmp_query_graph_rrd,data_template_rrd) where snmp_query_graph_rrd.data_template_rrd_id=data_template_rrd.local_data_template_rrd_id and snmp_query_graph_rrd.snmp_query_graph_id=" . $field["output_type"] . " and snmp_query_graph_rrd.data_template_id=" . $data_input["data_template_id"] . " @@ -201,7 +200,7 @@ data_template_data.data_input_id, data_template_data.local_data_id, data_template_data.local_data_template_data_id - from data_local,data_template_data + from (data_local,data_template_data) where " . (empty($local_data_id) ? "data_local.host_id=$host_id" : "data_local.id=$local_data_id") . " and data_local.id=data_template_data.local_data_id and data_template_data.data_input_id>0"); diff -urbB cacti-0.8.6g/tree.php cacti/tree.php --- cacti-0.8.6g/tree.php 2005-09-09 01:56:25.000000000 +0200 +++ cacti/tree.php 2005-11-24 19:32:45.000000000 +0100 @@ -250,7 +250,7 @@ Choose a graph from this list to add it to the tree. - + diff -urbB cacti-0.8.6g/user_admin.php cacti/user_admin.php --- cacti-0.8.6g/user_admin.php 2005-09-09 01:56:25.000000000 +0200 +++ cacti/user_admin.php 2005-11-24 19:32:45.000000000 +0100 @@ -729,7 +729,7 @@ html_header(array("User Name", "Full Name", "Realm", "Default Graph Policy", "Last Login"), 2); - $user_list = db_fetch_assoc("select id, user_auth.username, full_name, realm, policy_graphs, DATE_FORMAT(max(time),'%M %e %Y %H:%i:%s') as time from user_auth left join user_log on user_auth.id = user_log.user_id group by id"); + $user_list = db_fetch_assoc("select id, user_auth.username, full_name, realm, policy_graphs, DATE_FORMAT(max(time),'%M %e %Y %H:%i:%s') as time from user_auth left join user_log on (user_auth.id = user_log.user_id) group by id"); $i = 0; if (sizeof($user_list) > 0) { diff -urbB cacti-0.8.6g/utilities.php cacti/utilities.php --- cacti-0.8.6g/utilities.php 2005-09-09 01:56:25.000000000 +0200 +++ cacti/utilities.php 2005-11-24 19:32:45.000000000 +0100 @@ -203,7 +203,7 @@ $snmp_cache = db_fetch_assoc("select host_snmp_cache.*, host.description, snmp_query.name - from host_snmp_cache,snmp_query,host + from (host_snmp_cache,snmp_query,host) where host_snmp_cache.host_id=host.id and host_snmp_cache.snmp_query_id=snmp_query.id order by host_snmp_cache.host_id,host_snmp_cache.snmp_query_id,host_snmp_cache.snmp_index"); @@ -247,7 +247,7 @@ poller_item.*, data_template_data.name_cache, data_local.host_id - from poller_item,data_template_data,data_local + from (poller_item,data_template_data,data_local) where poller_item.local_data_id=data_template_data.local_data_id and data_template_data.local_data_id=data_local.id");