0) { foreach ($snmp_queries as $snmp_query) { db_execute("replace into host_snmp_query (host_id,snmp_query_id) values ($host_id," . $snmp_query["snmp_query_id"] . ")"); /* recache snmp data */ data_query($host_id, $snmp_query["snmp_query_id"]); } } } } if ((is_error_message()) || ($_POST["host_template_id"] != $_POST["_host_template_id"])) { header("Location: host.php?action=edit&id=" . (empty($host_id) ? $_POST["id"] : $host_id)); }else{ header("Location: host.php"); } } } /* ------------------- Data Query Functions ------------------- */ function host_reload_query() { data_query($_GET["host_id"], $_GET["id"]); } function host_remove_query() { db_execute("delete from host_snmp_cache where snmp_query_id=" . $_GET["id"] . " and host_id=" . $_GET["host_id"]); db_execute("delete from host_snmp_query where snmp_query_id=" . $_GET["id"] . " and host_id=" . $_GET["host_id"]); } /* --------------------- Host Functions --------------------- */ function host_remove() { global $config; if ((read_config_option("remove_verification") == "on") && (!isset($_GET["confirm"]))) { include("./include/top_header.php"); form_confirm("Are You Sure?", "Are you sure you want to delete the host '" . db_fetch_cell("select description from host where id=" . $_GET["id"]) . "'?", $_SERVER["HTTP_REFERER"], "host.php?action=remove&id=" . $_GET["id"]); include("./include/bottom_footer.php"); exit; } if ((read_config_option("remove_verification") == "") || (isset($_GET["confirm"]))) { db_execute("delete from host where id=" . $_GET["id"]); db_execute("delete from host_snmp_query where host_id=" . $_GET["id"]); db_execute("delete from host_snmp_cache where host_id=" . $_GET["id"]); db_execute("update data_local set host_id=0 where host_id=" . $_GET["id"]); db_execute("update graph_local set host_id=0 where host_id=" . $_GET["id"]); } } function host_edit() { global $colors, $paths, $fields_host_edit; display_output_messages(); if (!empty($_GET["id"])) { $host = db_fetch_row("select * from host where id=" . $_GET["id"]); $header_label = "[edit: " . $host["description"] . "]"; }else{ $header_label = "[new]"; } start_box("Polling Hosts $header_label", "98%", $colors["header"], "3", "center", ""); draw_edit_form(array( "config" => array("form_name" => "chk"), "fields" => inject_form_variables($fields_host_edit, (isset($host) ? $host : array())) )); end_box(); if ((isset($_GET["display_dq_details"])) && (isset($_SESSION["debug_log"]["data_query"]))) { start_box("Data Query Debug Information", "98%", $colors["header"], "3", "center", ""); print "
| Add Data Query: |