if (isset($_POST['save']) && $_POST['save'] == 'save') { header("Location: thold.php?rra={$dt}&view_rrd={$ds}\n\n"); exit; } if (isset($_REQUEST['usetemplate']) && $_REQUEST['usetemplate'] != '') { if (isset($_REQUEST['thold_template_id']) && $_REQUEST['thold_template_id'] != '') { if ($_REQUEST['thold_template_id'] == '0') { thold_add_select_host(); } else { thold_add_graphs_action_execute(); } } else { thold_add_graphs_action_prepare($graph); } } else { thold_add_select_host(); } function thold_add_graphs_action_execute() { global $config, $host, $graph; include_once $config['base_path'] . '/plugins/thold/thold_functions.php'; $message = ""; input_validate_input_number($_REQUEST["thold_template_id"]); $template = db_fetch_row("SELECT * FROM thold_template WHERE id=" . $_REQUEST["thold_template_id"]); $temp = db_fetch_row("SELECT dtr.*\r\n\t\t FROM data_template_rrd AS dtr\r\n\t\t LEFT JOIN graph_templates_item AS gti\r\n\t\t ON gti.task_item_id=dtr.id\r\n\t\t LEFT JOIN graph_local AS gl\r\n\t\t ON gl.id=gti.local_graph_id\r\n\t\t WHERE gl.id={$graph}"); $data_template_id = $temp['data_template_id']; $local_data_id = $temp['local_data_id']; $data_source = db_fetch_row("SELECT * FROM data_local WHERE id=" . $local_data_id); $data_template_id = $data_source['data_template_id']; /* allow duplicate thresholds, but only from differing templates */ $existing = db_fetch_assoc('SELECT id
function thold_add() { $host_id = $local_graph_id = $data_template_rrd_id = $local_data_id = ''; $host_id = get_filter_request_var('host_id'); $local_graph_id = get_filter_request_var('local_graph_id'); $data_template_rrd_id = get_filter_request_var('data_template_rrd_id'); $local_data_id = get_filter_request_var('local_data_id'); if (preg_match('/(data_sources.php|graph_view.php|graph.php)/', $_SERVER['HTTP_REFERER'])) { $_SESSION['data_return'] = $_SERVER['HTTP_REFERER']; } if (isset_request_var('local_graph_id') && !isset_request_var('host_id')) { $host_id = db_fetch_cell('SELECT host_id FROM graph_local WHERE id = ' . $local_graph_id); } if (isset_request_var('doaction') && get_request_var('doaction') != '') { if (get_request_var('doaction') == 1) { header('Location:' . $config['url_path'] . "plugins/thold/thold.php?action=add&local_graph_id={$local_graph_id}"); } else { $data_template_id = db_fetch_row("SELECT dtr.*\n\t\t\t\t FROM data_template_rrd AS dtr\n\t\t\t\t LEFT JOIN graph_templates_item AS gti\n\t\t\t\t ON gti.task_item_id=dtr.id\n\t\t\t\t LEFT JOIN graph_local AS gl\n\t\t\t\t ON gl.id=gti.local_graph_id\n\t\t\t\t WHERE gl.id={$local_graph_id}"); header('Location:' . $config['url_path'] . "plugins/thold/thold_templates.php?action=add&data_template_id={$data_template_id}"); } exit; } if (isset_request_var('usetemplate') && get_nfilter_request_var('usetemplate') != '') { if (isset_request_var('thold_template_id') && get_filter_request_var('thold_template_id') != '') { if (get_request_var('thold_template_id') == '0') { thold_add_select_host(); } else { thold_add_graphs_action_execute(); } } else { thold_add_graphs_action_prepare(); } } else { thold_add_select_host(); } }