=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/
--
--
-+
-+
-+
-
-
-
-@@ -178,7 +179,6 @@
- |
-
-
--
-
-
- \n");
-- fwrite($fp,"\n");
- fwrite($fp," | \n");
- fwrite($fp,"\n");
- }
-@@ -1383,16 +1374,7 @@
- include_once($config["library_path"] . "/tree.php");
- include_once($config["library_path"] . "/data_query.php");
-
-- fwrite($fp, "\n");
-+ fwrite($fp, "\n");
-+ fwrite($fp, "\n");
-+
- }
-
- /* get_graph_tree_array_export - returns a list of graph trees taking permissions into account if
-@@ -1478,8 +1485,7 @@
- $dhtml_tree = array();
- $dhtml_tree[0] = $start;
- $dhtml_tree[1] = read_graph_config_option("expand_hosts");
-- $dhtml_tree[2] = "foldersTree = gFld(\"\", \"\")\n";
-- $i = 2;
-+ $i = 1;
-
- $tree_list = get_graph_tree_array_export();
-
-@@ -1499,7 +1505,6 @@
- if (((read_config_option("export_tree_isolation") == "on") && ($tree_id == $tree["id"])) ||
- (read_config_option("export_tree_isolation") == "off")) {
-
-- $i++;
-
- $hier_sql = "SELECT DISTINCT
- graph_tree_items.id,
-@@ -1522,19 +1527,53 @@
- $dhtml_tree_id = 0;
-
- if (sizeof($hierarchy) > 0) {
-+ $last_tier = 1;
-+ $openli = false;
-+ $lasthost = false;
-+ $opentree = false;
- foreach ($hierarchy as $leaf) {
- if ($dhtml_tree_id <> $tree["id"]) {
-- $dhtml_tree[$i] = "ou0 = insFld(foldersTree, gFld(\"" . get_tree_name($tree["id"]) . "\", \"" . clean_up_export_name(get_tree_name($tree["id"])) . "_leaf.html\"))\n";
-+ if ($opentree) {
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\t\n\t\t\n\t\n";
-+ }
-+ $i++;
-+ $clean_id = clean_up_export_name(get_tree_name($tree["id"]));
-+ $dhtml_tree[$i] = "\t\n\t\t- " . get_tree_name($tree["id"]) . "\n\t\t\t
\n";
-+ $opentree = true;
- }
- $dhtml_tree_id = $tree["id"];
-
-- $i++;
- $tier = tree_tier($leaf["order_key"]);
-
- if ($leaf["host_id"] > 0) { //It's a host
-- $dhtml_tree[$i] = "ou" . ($tier) . " = insFld(ou" . ($tier-1) . ", gFld(\"Host: " . $leaf["hostname"] . "\", \"" . clean_up_export_name($leaf["hostname"] . "_" . $leaf["id"]) . ".html\"))\n";
-+ if ($tier > $last_tier) {
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\t\n";
-+ } elseif ($tier < $last_tier) {
-+ if (!$lasthost) {
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\t\t \n";
-+ }
-+ for ($x = $tier; $x < $last_tier; $x++) {
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\t \n\t\t\t\t\n";
-+ $openli = false;
-+ }
-+ } elseif ($openli && !$lasthost) {
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\t\t\n";
-+ $openli = false;
-+ }
-+ $last_tier = $tier;
-+ $lasthost = true;
-+ $i++;
-+ $clean_id = clean_up_export_name($leaf["hostname"] . "_" . $leaf["id"]);
-+ $dhtml_tree[$i] = "\t\t\t\tHost: " . htmlspecialchars($leaf["hostname"]) . "\n";
-
- if (read_config_option("export_tree_expand_hosts") == "on") {
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\t\t\t\n";
- if ($leaf["host_grouping_type"] == HOST_GROUPING_GRAPH_TEMPLATE) {
- $graph_templates = db_fetch_assoc("SELECT
- graph_templates.id,
-@@ -1552,7 +1591,8 @@
- if (sizeof($graph_templates) > 0) {
- foreach ($graph_templates as $graph_template) {
- $i++;
-- $dhtml_tree[$i] = "ou" . ($tier+1) . " = insFld(ou" . ($tier) . ", gFld(\" " . $graph_template["name"] . "\", \"" . clean_up_export_name($leaf["hostname"] . "_gt_" . $leaf["id"]) . "_" . $graph_template["id"] . ".html\"))\n";
-+ $clean_id = clean_up_export_name($leaf["hostname"] . "_gt_" . $leaf["id"] . "_" . $graph_template["id"]);
-+ $dhtml_tree[$i] = "\t\t\t\t\t\t- " . htmlspecialchars($graph_template["name"]) . "
\n";
- }
- }
- }else if ($leaf["host_grouping_type"] == HOST_GROUPING_DATA_QUERY_INDEX) {
-@@ -1567,36 +1607,77 @@
-
- array_push($data_queries, array(
- "id" => "0",
-- "name" => "Graph Template Based"
-+ "name" => "Non Query Based"
- ));
-
- if (sizeof($data_queries) > 0) {
-- foreach ($data_queries as $data_query) {
-- $i++;
--
-- $dhtml_tree[$i] = "ou" . ($tier+1) . " = insFld(ou" . ($tier) . ", gFld(\" " . $data_query["name"] . "\", \"" . clean_up_export_name($leaf["hostname"] . "_dq_" . $leaf["title"] . "_" . $leaf["id"]) . "_" . $data_query["id"] . ".html\"))\n";
-+ foreach ($data_queries as $data_query) {
-+ $i++;
-+ $clean_id = clean_up_export_name($leaf["hostname"] . "_dq_" . $leaf["title"] . "_" . $leaf["id"] . "_" . $data_query["id"]);
-+ $dhtml_tree[$i] = "\t\t\t\t\t\t- " . htmlspecialchars($data_query["name"]) . "\n";
-
-- /* fetch a list of field names that are sorted by the preferred sort field */
-- $sort_field_data = get_formatted_data_query_indexes($leaf["host_id"], $data_query["id"]);
-+ /* fetch a list of field names that are sorted by the preferred sort field */
-+ $sort_field_data = get_formatted_data_query_indexes($leaf["host_id"], $data_query["id"]);
-
-- if ($data_query["id"] > 0) {
-- while (list($snmp_index, $sort_field_value) = each($sort_field_data)) {
-+ if ($data_query["id"] > 0) {
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\t\t\t\t\t
\n";
-+ while (list($snmp_index, $sort_field_value) = each($sort_field_data)) {
-+ $i++;
-+ $clean_id = clean_up_export_name($leaf["hostname"] . "_dqi_" . $leaf["id"] . "_" . $data_query["id"] . "_" . $snmp_index);
-+ $dhtml_tree[$i] = "\t\t\t\t\t\t\t\t- " . htmlspecialchars($sort_field_value) . "
\n";
-+ }
- $i++;
-- $dhtml_tree[$i] = "ou" . ($tier+2) . " = insFld(ou" . ($tier+1) . ", gFld(\" " . $sort_field_value . "\", \"" . clean_up_export_name($leaf["hostname"] . "_dqi_" . $leaf["title"] . "_" . $leaf["id"]) . "_" . $data_query["id"] . "_" . $snmp_index . ".html\"))\n";
-+ $dhtml_tree[$i] = "\t\t\t\t\t\t\t \n";
- }
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\t\t\t\t \n";
- }
- }
-- }
- }
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\t\t\t \n";
- }
-- }else {
-- $dhtml_tree[$i] = "ou" . ($tier) . " = insFld(ou" . ($tier-1) . ", gFld(\"" . $leaf["title"] . "\", \"" . clean_up_export_name(get_tree_name($tree["id"]) . "_" . $leaf["title"] . "_" . $leaf["id"]) . "_leaf.html\"))\n";
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\t\t\n";
-+ }else { //It's not a host
-+ if ($tier > $last_tier) {
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\t\n";
-+ } elseif ($tier < $last_tier) {
-+ if (!$lasthost) {
-+ $i++;
-+ $dhtml_tree[$i] = "\n";
-+ }
-+ for ($x = $tier; $x < $last_tier; $x++) {
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\t\t \n\t\t\t\t\n";
-+ $openli = false;
-+ }
-+ } elseif ($openli && !$lasthost) {
-+ $i++;
-+ $dhtml_tree[$i] = "\n";
-+ $openli = false;
-+ }
-+ $last_tier = $tier;
-+ $i++;
-+ $clean_id = clean_up_export_name(get_tree_name($tree["id"]) . "_" . $leaf["title"] . "_" . $leaf["id"]);
-+ $dhtml_tree[$i] = "\t\t\t\t" . htmlspecialchars($leaf["title"]) . "\n";
-+ $openli = true;
-+ $lasthost = false;
- }
- }
-+ for ($x = $last_tier; $x > 1; $x--) {
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\t\t\t\n\t\t\t\t\n";
-+ }
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\t\n\t\t\n\t\n";
- }else{
- if ($dhtml_tree_id <> $tree["id"]) {
-- $dhtml_tree[$i] = "ou0 = insFld(foldersTree, gFld(\"" . get_tree_name($tree["id"]) . "\", \"" . clean_up_export_name(get_tree_name($tree["id"])) . "_leaf.html\"))\n";
- $i++;
-+ $clean_id = clean_up_export_name(get_tree_name($tree["id"]));
-+ $dhtml_tree[$i] = "\t";
- }
- }
- }
-@@ -1612,10 +1693,10 @@
- $dir - the export directory where graphs will either be staged or located.
- */
- function create_export_directory_structure($cacti_root_path, $dir) {
-- /* create the treeview sub-directory */
-- if (!is_dir("$dir/treeview")) {
-- if (!mkdir("$dir/treeview", 0755)) {
-- export_fatal("Create directory '" . $dir . "/treeview' failed. Can not continue");
-+ /* create the jquery sub-directory */
-+ if (!is_dir("$dir/js")) {
-+ if (!mkdir("$dir/js", 0755)) {
-+ export_fatal("Create directory '" . $dir . "/js' failed. Can not continue");
- }
- }
-
-@@ -1626,8 +1707,6 @@
- }
- }
-
-- $treeview_dir = $dir . "/treeview";
--
- /* css */
- copy("$cacti_root_path/include/main.css", "$dir/main.css");
-
-@@ -1639,18 +1718,15 @@
- copy("$cacti_root_path/images/shadow_gray.gif", "$dir/shadow_gray.gif");
-
- /* java scripts for the tree */
-- copy("$cacti_root_path/include/treeview/ftiens4_export.js", "$treeview_dir/ftiens4.js");
-- copy("$cacti_root_path/include/treeview/ua.js", "$treeview_dir/ua.js");
--
-- /* images for the tree */
-- copy("$cacti_root_path/include/treeview/ftv2blank.gif", "$treeview_dir/ftv2blank.gif");
-- copy("$cacti_root_path/include/treeview/ftv2lastnode.gif", "$treeview_dir/ftv2lastnode.gif");
-- copy("$cacti_root_path/include/treeview/ftv2mlastnode.gif", "$treeview_dir/ftv2mlastnode.gif");
-- copy("$cacti_root_path/include/treeview/ftv2mnode.gif", "$treeview_dir/ftv2mnode.gif");
-- copy("$cacti_root_path/include/treeview/ftv2node.gif", "$treeview_dir/ftv2node.gif");
-- copy("$cacti_root_path/include/treeview/ftv2plastnode.gif", "$treeview_dir/ftv2plastnode.gif");
-- copy("$cacti_root_path/include/treeview/ftv2pnode.gif", "$treeview_dir/ftv2pnode.gif");
-- copy("$cacti_root_path/include/treeview/ftv2vertline.gif", "$treeview_dir/ftv2vertline.gif");
-+ copy("$cacti_root_path/include/js/jquery/jquery.js", "$dir/js/jquery.js");
-+ copy("$cacti_root_path/include/js/jquery/jquery.jstree.js", "$dir/js/jquery.jstree.js");
-+ copy("$cacti_root_path/include/js/jquery/jquery.cookie.js", "$dir/js/jquery.cookie.js");
-+
-+ /* theme info for java scripts */
-+ copy("$cacti_root_path/include/js/jquery/themes/default/style.css", "$dir/js/style.css");
-+ copy("$cacti_root_path/include/js/jquery/themes/default/d.png", "$dir/js/d.png");
-+ copy("$cacti_root_path/include/js/jquery/themes/default/d.gif", "$dir/js/d.gif");
-+ copy("$cacti_root_path/include/js/jquery/themes/default/throbber.gif", "$dir/js/throbber.gif");
- }
-
- function get_host_description($host_id) {
-@@ -1738,8 +1814,9 @@
-
-
-
--
--
-+
-+
-+
-
-
-
---- a/lib/html_tree.php
-+++ b/lib/html_tree.php
-@@ -495,17 +495,9 @@
- include_once($config["library_path"] . "/data_query.php");
-
- ?>
--
-+
- \n";
-+ $i = 2;
-
- $tree_list = get_graph_tree_array();
-
-@@ -567,7 +583,6 @@
-
- if (sizeof($tree_list) > 0) {
- foreach ($tree_list as $tree) {
-- $i++;
- $hierarchy = db_fetch_assoc("select
- graph_tree_items.id,
- graph_tree_items.title,
-@@ -583,21 +598,45 @@
- and graph_tree_items.local_graph_id = 0
- order by graph_tree_items.order_key");
-
-- $dhtml_tree[$i] = "ou0 = insFld(foldersTree, gFld(\"" . htmlspecialchars($tree["name"]) . "\", \"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"]) . "\"))\n";
- $i++;
-- $dhtml_tree[$i] = "ou0.xID = \"tree_" . $tree["id"] . "\"\n";
-+ $dhtml_tree[$i] = "\t\n\t\t- " . htmlspecialchars($tree["name"]) . "\n";
-
- if (sizeof($hierarchy) > 0) {
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\t
\n";
-+ $last_tier = 1;
-+ $openli = false;
-+ $lasthost = false;
- foreach ($hierarchy as $leaf) {
-- $i++;
- $tier = tree_tier($leaf["order_key"]);
-
-- if ($leaf["host_id"] > 0) {
-- $dhtml_tree[$i] = "ou" . ($tier) . " = insFld(ou" . abs(($tier-1)) . ", gFld(\"" . "Host: " . htmlspecialchars($leaf["hostname"]) . "\", \"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"] . "&leaf_id=" . $leaf["id"]) . "\"))\n";
-+ if ($leaf["host_id"] > 0) { //It's a host
-+ if ($tier > $last_tier) {
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\t\n";
-+ } elseif ($tier < $last_tier) {
-+ if (!$lasthost) {
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\t\t \n";
-+ }
-+ for ($x = $tier; $x < $last_tier; $x++) {
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\t \n\t\t\t\t\n";
-+ $openli = false;
-+ }
-+ } elseif ($openli && !$lasthost) {
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\t\t\n";
-+ $openli = false;
-+ }
-+ $last_tier = $tier;
-+ $lasthost = true;
- $i++;
-- $dhtml_tree[$i] = "ou" . ($tier) . ".xID = \"tree_" . $tree["id"] . "_leaf_" . $leaf["id"] . "\"\n";
-+ $dhtml_tree[$i] = "\t\t\t\tHost: " . htmlspecialchars($leaf["hostname"]) . "\n";
-
- if (read_graph_config_option("expand_hosts") == "on") {
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\t\t\t\n";
- if ($leaf["host_grouping_type"] == HOST_GROUPING_GRAPH_TEMPLATE) {
- $graph_templates = db_fetch_assoc("select
- graph_templates.id,
-@@ -612,9 +651,7 @@
- if (sizeof($graph_templates) > 0) {
- foreach ($graph_templates as $graph_template) {
- $i++;
-- $dhtml_tree[$i] = "ou" . ($tier+1) . " = insFld(ou" . ($tier) . ", gFld(\" " . htmlspecialchars($graph_template["name"]) . "\", \"graph_view.php?action=tree&tree_id=" . $tree["id"] . "&leaf_id=" . $leaf["id"] . "&host_group_data=graph_template:" . $graph_template["id"] . "\"))\n";
-- $i++;
-- $dhtml_tree[$i] = "ou" . ($tier+1) . ".xID = \"tree_" . $tree["id"] . "_leaf_" . $leaf["id"] . "_hgd_gt_" . $graph_template["id"] . "\"\n";
-+ $dhtml_tree[$i] = "\t\t\t\t\t\t- " . htmlspecialchars($graph_template["name"]) . "
\n";
- }
- }
- }else if ($leaf["host_grouping_type"] == HOST_GROUPING_DATA_QUERY_INDEX) {
-@@ -645,33 +682,71 @@
- if ((($data_query["id"] == 0) && ($non_template_graphs > 0)) ||
- (($data_query["id"] > 0) && (sizeof($sort_field_data) > 0))) {
- $i++;
-- $dhtml_tree[$i] = "ou" . ($tier+1) . " = insFld(ou" . ($tier) . ", gFld(\" " . htmlspecialchars($data_query["name"]) . "\", \"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"] . "&leaf_id=" . $leaf["id"] . "&host_group_data=data_query:" . $data_query["id"]) . "\"))\n";
-- $i++;
-- $dhtml_tree[$i] = "ou" . ($tier+1) . ".xID = \"tree_" . $tree["id"] . "_leaf_" . $leaf["id"] . "_hgd_dq_" . $data_query["id"] . "\"\n";
--
-+ $dhtml_tree[$i] = "\t\t\t\t\t\t- " . htmlspecialchars($data_query["name"]) . "\n";
- if ($data_query["id"] > 0) {
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\t\t\t\t\t
\n";
- while (list($snmp_index, $sort_field_value) = each($sort_field_data)) {
- $i++;
-- $dhtml_tree[$i] = "ou" . ($tier+2) . " = insFld(ou" . ($tier+1) . ", gFld(\" " . htmlspecialchars($sort_field_value) . "\", \"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"] . "&leaf_id=" . $leaf["id"] . "&host_group_data=data_query_index:" . $data_query["id"] . ":" . urlencode($snmp_index)) . "\"))\n";
-- $i++;
-- $dhtml_tree[$i] = "ou" . ($tier+2) . ".xID = \"tree_" . $tree["id"] . "_leaf_" . $leaf["id"] . "_hgd_dqi" . $data_query["id"] . "_" . urlencode($snmp_index) . "\"\n";
-+ $dhtml_tree[$i] = "\t\t\t\t\t\t\t\t- " . htmlspecialchars($sort_field_value) . "
\n";
- }
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\t\t\t\t\t \n";
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\t\t\t\t \n";
- }
- }
- }
- }
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\t\t\t\t \n";
-+ }
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\t\t\t\n";
-+ }
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\t\t\n";
-+ }else{ //It's not a host
-+ if ($tier > $last_tier) {
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\t\n";
-+ } elseif ($tier < $last_tier) {
-+ if (!$lasthost) {
-+ $i++;
-+ $dhtml_tree[$i] = "\n";
- }
-+ for ($x = $tier; $x < $last_tier; $x++) {
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\t\t \n\t\t\t\t\n";
-+ $openli = false;
-+ }
-+ } elseif ($openli && !$lasthost) {
-+ $i++;
-+ $dhtml_tree[$i] = "\n";
-+ $openli = false;
- }
-- }else{
-- $dhtml_tree[$i] = "ou" . ($tier) . " = insFld(ou" . abs(($tier-1)) . ", gFld(\"" . htmlspecialchars($leaf["title"]) . "\", \"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"] . "&leaf_id=" . $leaf["id"]) . "\"))\n";
-+ $last_tier = $tier;
- $i++;
-- $dhtml_tree[$i] = "ou" . ($tier) . ".xID = \"tree_" . $tree["id"] . "_leaf_" . $leaf["id"] . "\"\n";
-+ $dhtml_tree[$i] = "\t\t\t\t" . htmlspecialchars($leaf["title"]) . "\n";
-+ $openli = true;
-+ $lasthost = false;
- }
- }
-+ for ($x = $last_tier; $x > 1; $x--) {
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\t\t\t\n\t\t\t\t\n";
-+ }
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\t\n";
- }
-+ $i++;
-+ $dhtml_tree[$i] = "\t\t\n\t\n";
- }
- }
-
-+ $i++;
-+ $dhtml_tree[$i] = "\n";
-+
- return $dhtml_tree;
- }
-
-@@ -758,14 +833,6 @@
- }
- }
-
-- print "";
--
- /* ================= input validation ================= */
- input_validate_input_number(get_request_var_post("graphs"));
- input_validate_input_number(get_request_var_post("page"));
diff --git a/src/patches/cacti/cacti-0.8.8b-html-injection.patch b/src/patches/cacti/cacti-0.8.8b-html-injection.patch
deleted file mode 100644
index 1326dffb7..000000000
--- a/src/patches/cacti/cacti-0.8.8b-html-injection.patch
+++ /dev/null
@@ -1,19 +0,0 @@
-------------------------------------------------------------------------
-r7443 | rony | 2014-03-30 18:43:28 -0500 (Sun, 30 Mar 2014) | 2 lines
-
-bug#0002431: CVE-2014-2326 Unspecified HTML Injection Vulnerability
-
-------------------------------------------------------------------------
-Index: branches/0.8.8/cdef.php
-===================================================================
---- branches/0.8.8/cdef.php (revision 7442)
-+++ branches/0.8.8/cdef.php (revision 7443)
-@@ -431,7 +431,7 @@
- ">Item #
-
-
-- :
-+ :
- |
-
- ">
diff --git a/src/patches/cacti/cacti-0.8.8b-remote-command-execution.patch b/src/patches/cacti/cacti-0.8.8b-remote-command-execution.patch
deleted file mode 100644
index c357a06d7..000000000
--- a/src/patches/cacti/cacti-0.8.8b-remote-command-execution.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-------------------------------------------------------------------------
-r7442 | rony | 2014-03-30 18:41:56 -0500 (Sun, 30 Mar 2014) | 2 lines
-
-bug#0002433: CVE-2014-2328 Unspecified Remote Command Execution Vulnerability
-
-------------------------------------------------------------------------
-Index: branches/0.8.8/lib/graph_export.php
-===================================================================
---- branches/0.8.8/lib/graph_export.php (revision 7441)
-+++ branches/0.8.8/lib/graph_export.php (revision 7442)
-@@ -339,7 +339,7 @@
- chdir($stExportDir);
-
- /* set the initial command structure */
-- $stExecute = 'ncftpput -R -V -r 1 -u '.$aFtpExport['username'].' -p '.$aFtpExport['password'];
-+ $stExecute = 'ncftpput -R -V -r 1 -u ' . cacti_escapeshellarg($aFtpExport['username']) . ' -p ' . cacti_escapeshellarg($aFtpExport['password']);
-
- /* if the user requested passive mode, use it */
- if ($aFtpExport['passive']) {
-@@ -347,7 +347,7 @@
- }
-
- /* setup the port, server, remote directory and all files */
-- $stExecute .= ' -P ' . $aFtpExport['port'] . ' ' . $aFtpExport['server'] . ' ' . $aFtpExport['remotedir'] . ".";
-+ $stExecute .= ' -P ' . cacti_escapeshellarg($aFtpExport['port']) . ' ' . cacti_escapeshellarg($aFtpExport['server']) . ' ' . cacti_escapeshellarg($aFtpExport['remotedir']) . ".";
-
- /* run the command */
- $iExecuteReturns = 0;
diff --git a/src/patches/cacti/cacti-0.8.8b-rra-comments.patch b/src/patches/cacti/cacti-0.8.8b-rra-comments.patch
deleted file mode 100644
index c5becfe77..000000000
--- a/src/patches/cacti/cacti-0.8.8b-rra-comments.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-------------------------------------------------------------------------
-r7418 | gandalf | 2013-08-13 13:32:49 -0600 (Tue, 13 Aug 2013) | 1 line
-
-fix COMMENT handling, even in case COMMENT is empty, with or without HR and with variable substitution
-------------------------------------------------------------------------
-Index: branches/0.8.8/lib/rrd.php
-===================================================================
---- branches/0.8.8/lib/rrd.php (revision 7417)
-+++ branches/0.8.8/lib/rrd.php (revision 7418)
-@@ -1343,20 +1343,20 @@
- $need_rrd_nl = TRUE;
-
- if ($graph_item_types{$graph_item["graph_type_id"]} == "COMMENT") {
-+ # perform variable substitution first (in case this will yield an empty results or brings command injection problems)
-+ $comment_arg = rrd_substitute_host_query_data($graph_variables["text_format"][$graph_item_id], $graph, $graph_item);
-+ # next, compute the argument of the COMMENT statement and perform injection counter measures
-+ if (trim($comment_arg) == '') { # an empty COMMENT must be treated with care
-+ $comment_arg = cacti_escapeshellarg(' ' . $hardreturn[$graph_item_id]);
-+ } else {
-+ $comment_arg = cacti_escapeshellarg($comment_arg . $hardreturn[$graph_item_id]);
-+ }
-+
-+ # create rrdtool specific command line
- if (read_config_option("rrdtool_version") != "rrd-1.0.x") {
-- $comment_string = $graph_item_types{$graph_item["graph_type_id"]} . ":" . str_replace(":", "\:", cacti_escapeshellarg($graph_variables["text_format"][$graph_item_id] . $hardreturn[$graph_item_id])) . " ";
-- if (trim($comment_string) == 'COMMENT:"\n"') {
-- $txt_graph_items .= 'COMMENT:" \n"'; # rrdtool will skip a COMMENT that holds a NL only; so add a blank to make NL work
-- } else if (trim($comment_string) != "COMMENT:\"\"") {
-- $txt_graph_items .= rrd_substitute_host_query_data($comment_string, $graph, $graph_item);
-- }
-+ $txt_graph_items .= $graph_item_types{$graph_item["graph_type_id"]} . ":" . str_replace(":", "\:", $comment_arg) . " ";
- }else {
-- $comment_string = $graph_item_types{$graph_item["graph_type_id"]} . ":" . cacti_escapeshellarg($graph_variables["text_format"][$graph_item_id] . $hardreturn[$graph_item_id]) . " ";
-- if (trim($comment_string) == 'COMMENT:"\n"') {
-- $txt_graph_items .= 'COMMENT:" \n"'; # rrdtool will skip a COMMENT that holds a NL only; so add a blank to make NL work
-- } else if (trim($comment_string) != "COMMENT:\"\"") {
-- $txt_graph_items .= rrd_substitute_host_query_data($comment_string, $graph, $graph_item);
-- }
-+ $txt_graph_items .= $graph_item_types{$graph_item["graph_type_id"]} . ":" . $comment_arg . " ";
- }
- }elseif (($graph_item_types{$graph_item["graph_type_id"]} == "GPRINT") && (!isset($graph_data_array["graph_nolegend"]))) {
- $graph_variables["text_format"][$graph_item_id] = str_replace(":", "\:", $graph_variables["text_format"][$graph_item_id]); /* escape colons */
diff --git a/src/patches/cacti/cacti-0.8.8b-sanitize-variables.patch b/src/patches/cacti/cacti-0.8.8b-sanitize-variables.patch
deleted file mode 100644
index 37ded2ec0..000000000
--- a/src/patches/cacti/cacti-0.8.8b-sanitize-variables.patch
+++ /dev/null
@@ -1,155 +0,0 @@
-------------------------------------------------------------------------
-r7420 | cigamit | 2013-08-17 21:41:24 -0600 (Sat, 17 Aug 2013) | 1 line
-
-Bug #0002383 : Sanitize the step and id variables
-------------------------------------------------------------------------
-Index: branches/0.8.8/host.php
-===================================================================
---- branches/0.8.8/host.php (revision 7419)
-+++ branches/0.8.8/host.php (revision 7420)
-@@ -149,6 +149,9 @@
- if ($_POST["snmp_version"] == 3 && ($_POST["snmp_password"] != $_POST["snmp_password_confirm"])) {
- raise_message(4);
- }else{
-+ input_validate_input_number(get_request_var_post("id"));
-+ input_validate_input_number(get_request_var_post("host_template_id"));
-+
- $host_id = api_device_save($_POST["id"], $_POST["host_template_id"], $_POST["description"],
- trim($_POST["hostname"]), $_POST["snmp_community"], $_POST["snmp_version"],
- $_POST["snmp_username"], $_POST["snmp_password"],
-Index: branches/0.8.8/lib/api_device.php
-===================================================================
---- branches/0.8.8/lib/api_device.php (revision 7419)
-+++ branches/0.8.8/lib/api_device.php (revision 7420)
-@@ -107,7 +107,7 @@
- $_host_template_id = db_fetch_cell("select host_template_id from host where id=$id");
- }
-
-- $save["id"] = $id;
-+ $save["id"] = form_input_validate($id, "id", "^[0-9]+$", false, 3);
- $save["host_template_id"] = form_input_validate($host_template_id, "host_template_id", "^[0-9]+$", false, 3);
- $save["description"] = form_input_validate($description, "description", "", false, 3);
- $save["hostname"] = form_input_validate(trim($hostname), "hostname", "", false, 3);
-Index: branches/0.8.8/install/index.php
-===================================================================
---- branches/0.8.8/install/index.php (revision 7419)
-+++ branches/0.8.8/install/index.php (revision 7420)
-@@ -310,27 +310,28 @@
- }
-
- /* pre-processing that needs to be done for each step */
--if (empty($_REQUEST["step"])) {
-- $_REQUEST["step"] = 1;
--}else{
-- if ($_REQUEST["step"] == "1") {
-- $_REQUEST["step"] = "2";
-- }elseif (($_REQUEST["step"] == "2") && ($_REQUEST["install_type"] == "1")) {
-- $_REQUEST["step"] = "3";
-- }elseif (($_REQUEST["step"] == "2") && ($_REQUEST["install_type"] == "3")) {
-- $_REQUEST["step"] = "8";
-- }elseif (($_REQUEST["step"] == "8") && ($old_version_index <= array_search("0.8.5a", $cacti_versions))) {
-- $_REQUEST["step"] = "9";
-- }elseif ($_REQUEST["step"] == "8") {
-- $_REQUEST["step"] = "3";
-- }elseif ($_REQUEST["step"] == "9") {
-- $_REQUEST["step"] = "3";
-- }elseif ($_REQUEST["step"] == "3") {
-- $_REQUEST["step"] = "4";
-+if (isset($_REQUEST["step"]) && $_REQUEST["step"] > 0) {
-+ $step = intval($_REQUEST["step"]);
-+ if ($step == "1") {
-+ $step = "2";
-+ } elseif (($step == "2") && ($_REQUEST["install_type"] == "1")) {
-+ $step = "3";
-+ } elseif (($step == "2") && ($_REQUEST["install_type"] == "3")) {
-+ $step = "8";
-+ } elseif (($step == "8") && ($old_version_index <= array_search("0.8.5a", $cacti_versions))) {
-+ $step = "9";
-+ } elseif ($step == "8") {
-+ $step = "3";
-+ } elseif ($step == "9") {
-+ $step = "3";
-+ } elseif ($step == "3") {
-+ $step = "4";
- }
-+} else {
-+ $step = 1;
- }
-
--if ($_REQUEST["step"] == "4") {
-+if ($step == "4") {
- include_once("../lib/data_query.php");
- include_once("../lib/utility.php");
-
-@@ -366,7 +367,7 @@
-
- header ("Location: ../index.php");
- exit;
--}elseif (($_REQUEST["step"] == "8") && ($_REQUEST["install_type"] == "3")) {
-+}elseif (($step == "8") && ($_REQUEST["install_type"] == "3")) {
- /* if the version is not found, die */
- if (!is_int($old_version_index)) {
- print " Error
-@@ -505,7 +506,7 @@
-
- |
- |
--
-+
-
- Thanks for taking the time to download and install cacti, the complete graphing
- solution for your network. Before you can start making cool graphs, there are a few
-@@ -530,7 +531,7 @@
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
--
-+
-
- Please select the type of installation
-
-@@ -551,7 +552,7 @@
- print "Server Operating System Type: " . $config["cacti_server_os"] . " "; ?>
-
-
--
-+
-
- Make sure all of these values are correct before continuing.
-
-
--
-+
-
- Upgrade results:
-
-@@ -659,7 +660,7 @@
- print $upgrade_results;
- ?>
-
--
-+
-
- Important Upgrade Notice
-
-@@ -673,7 +674,7 @@
-
-
-
-- finishnext.gif" alt="FinishNext">
-+ finishnext.gif" alt="FinishNext">
- |
-
-
-@@ -681,7 +682,7 @@
-
- |