array( "name" => "Graph Template", "title_sql" => "select name from graph_templates where id=|id|", "dropdown_sql" => "select id,name from graph_templates order by name" ), "data_template" => array( "name" => "Data Template", "title_sql" => "select name from data_template where id=|id|", "dropdown_sql" => "select id,name from data_template order by name" ), "host_template" => array( "name" => "Host Template", "title_sql" => "select name from host_template where id=|id|", "dropdown_sql" => "select id,name from host_template order by name" ), "data_query" => array( "name" => "Data Query", "title_sql" => "select name from snmp_query where id=|id|", "dropdown_sql" => "select id,name from snmp_query order by name" ) ); switch ($_REQUEST["action"]) { case 'save': form_save(); break; default: include_once("./include/top_header.php"); export(); include_once("./include/bottom_footer.php"); break; } /* -------------------------- The Save Function -------------------------- */ function form_save() { global $export_types; if (isset($_POST["save_component_export"])) { $xml_data = get_item_xml($_POST["export_type"], $_POST["export_item_id"], (((isset($_POST["include_deps"]) ? $_POST["include_deps"] : "") == "") ? false : true)); if ($_POST["output_format"] == "1") { include_once("./include/top_header.php"); print "
" . htmlspecialchars($xml_data) . "
"; include_once("./include/bottom_footer.php"); }elseif ($_POST["output_format"] == "2") { header("Content-type: application/xml"); print $xml_data; }elseif ($_POST["output_format"] == "3") { header("Content-type: application/xml"); header("Content-Disposition: attachment; filename=cacti_" . $_POST["export_type"] . "_" . strtolower(clean_up_file_name(db_fetch_cell(str_replace("|id|", $_POST["export_item_id"], $export_types{$_POST["export_type"]}["title_sql"])))) . ".xml"); print $xml_data; } } } /* --------------------------- Template Export Functions --------------------------- */ function export() { global $colors, $export_types; /* 'graph_template' should be the default */ if (!isset($_REQUEST["export_type"])) { $_REQUEST["export_type"] = "graph_template"; } ?>
">
What would you like to export? 
Export Template [" . $export_types{$_REQUEST["export_type"]}["name"] . "]", "100%", $colors["header"], "3", "center", ""); form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],0); ?> to Export
Choose the exact item to export to XML. Include Dependencies
Some templates rely on other items in Cacti to function properly. It is highly recommended that you select this box or the resulting import may fail. Output Format
Choose the format to output the resulting XML file in. "; form_radio_button("output_format", "3", "2", "Output to the Browser (raw XML)","1",true); print "
"; form_radio_button("output_format", "3", "3", "Save File Locally","1",true); ?>