示例#1
0
include $config['base_path'] . '/plugins/thold/includes/arrays.php';
thold_initialize_rusage();
plugin_thold_upgrade();
delete_old_thresholds();
set_default_action('thold');
switch (get_request_var('action')) {
    case 'ajax_hosts':
        get_allowed_ajax_hosts(true, false, 'h.id IN (SELECT host_id FROM thold_data)');
        break;
    case 'ajax_hosts_noany':
        get_allowed_ajax_hosts(false, false, 'h.id IN (SELECT host_id FROM thold_data)');
        break;
    case 'thold':
        general_header();
        thold_tabs();
        tholds();
        bottom_footer();
        break;
    case 'disable':
        thold_threshold_disable(get_filter_request_var('id'));
        header('Location: thold_graph.php');
        exit;
    case 'enable':
        thold_threshold_enable(get_filter_request_var('id'));
        header('Location: thold_graph.php');
        exit;
    case 'hoststat':
        general_header();
        thold_tabs();
        hosts();
        bottom_footer();
示例#2
0
function edit()
{
    global $colors, $tabs_thold, $config;
    /* ================= input validation ================= */
    input_validate_input_number(get_request_var_request("id"));
    /* ==================================================== */
    /* set the default tab */
    load_current_session_value("tab", "sess_thold_notify_tab", "general");
    $current_tab = $_REQUEST["tab"];
    if (sizeof($tabs_thold) && isset($_REQUEST['id'])) {
        /* draw the tabs */
        print "<table class='tabs' width='100%' cellspacing='0' cellpadding='3' align='center'><tr>\n";
        foreach (array_keys($tabs_thold) as $tab_short_name) {
            print "<td style='padding:3px 10px 2px 5px;background-color:" . ($tab_short_name == $current_tab ? "silver;" : "#DFDFDF;") . "white-space:nowrap;'" . " width='1%' " . " align='center' class='tab'>\n\t\t\t\t<span class='textHeader'><a href='" . htmlspecialchars($config['url_path'] . "plugins/thold/notify_lists.php?action=edit&id=" . get_request_var_request('id') . "&tab=" . $tab_short_name) . "'>{$tabs_thold[$tab_short_name]}</a></span>\n\t\t\t\t</td>\n\n\t\t\t\t<td width='1'></td>\n";
        }
        print "<td></td>\n</tr></table>\n";
    }
    $header_label = get_notification_header_label();
    if (isset($_REQUEST['id'])) {
        $list = db_fetch_row('SELECT * FROM plugin_notification_lists WHERE id=' . $_REQUEST['id']);
    } else {
        $list = array();
        $current_tab = 'general';
    }
    if ($current_tab == "general") {
        html_start_box("<strong>General Settings</strong> " . htmlspecialchars($header_label), "100%", $colors["header"], "3", "center", "");
        $fields_notification = array("name" => array("method" => "textbox", "friendly_name" => "Name", "description" => "Enter a name for this Notification List", "value" => "|arg1:name|", "max_length" => "80"), "description" => array("method" => "textarea", "friendly_name" => "Description", "description" => "Enter a description for this Notification List", "value" => "|arg1:description|", "class" => "textAreaNotes", "textarea_rows" => "2", "textarea_cols" => "80"), "emails" => array("method" => "textarea", "friendly_name" => "Email Addresses", "description" => "Enter a comma separated list of Email addresses for this notification list.", "value" => "|arg1:emails|", "class" => "textAreaNotes", "textarea_rows" => "4", "textarea_cols" => "80"), "phones" => array("method" => "textarea", "friendly_name" => "Phone Numbers", "description" => "Enter a comma separated list of Phone Numbers for this notification list.", "value" => "|arg1:phones|", "class" => "textAreaNotes", "textarea_rows" => "4", "textarea_cols" => "80"), "id" => array("method" => "hidden_zero", "value" => "|arg1:id|"), "save_component" => array("method" => "hidden", "value" => "1"));
        draw_edit_form(array("config" => array(), "fields" => inject_form_variables($fields_notification, isset($list) ? $list : array())));
        html_end_box();
        form_save_button("notify_lists.php", "return");
    } elseif ($current_tab == "hosts") {
        hosts($header_label);
    } elseif ($current_tab == "tholds") {
        tholds($header_label);
    } else {
        templates($header_label);
    }
}
示例#3
0
function edit()
{
    global $tabs_thold, $config;
    /* ================= input validation ================= */
    get_filter_request_var('id');
    get_filter_request_var('tab', FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => '/^([a-zA-Z]+)$/')));
    /* ==================================================== */
    /* set the default tab */
    load_current_session_value('tab', 'sess_thold_notify_tab', 'general');
    $current_tab = get_request_var('tab');
    if (sizeof($tabs_thold) && isset_request_var('id')) {
        print "<div class='tabs'><nav><ul>\n";
        if (sizeof($tabs_thold)) {
            foreach (array_keys($tabs_thold) as $tab_short_name) {
                print "<li><a class='pic" . ($tab_short_name == $current_tab ? ' selected' : '') . "' href='" . $config['url_path'] . 'plugins/thold/notify_lists.php' . '?action=edit&id=' . get_filter_request_var('id') . '&tab=' . $tab_short_name . "'>" . $tabs_thold[$tab_short_name] . "</a></li>\n";
            }
        }
        print "</ul></nav></div>\n";
    }
    $header_label = get_notification_header_label();
    if (isset_request_var('id')) {
        $list = db_fetch_row('SELECT * FROM plugin_notification_lists WHERE id=' . get_request_var('id'));
    } else {
        $list = array();
        $current_tab = 'general';
    }
    if ($current_tab == 'general') {
        form_start('notify_lists.php');
        html_start_box(__('List General Settings') . ' ' . htmlspecialchars($header_label), '100%', '', '3', 'center', '');
        $fields_notification = array('name' => array('method' => 'textbox', 'friendly_name' => __('Name'), 'description' => __('Enter a name for this Notification List.'), 'value' => '|arg1:name|', 'max_length' => '80'), 'description' => array('method' => 'textarea', 'friendly_name' => __('Description'), 'description' => __('Enter a description for this Notification List.'), 'value' => '|arg1:description|', 'class' => 'textAreaNotes', 'textarea_rows' => '2', 'textarea_cols' => '80'), 'emails' => array('method' => 'textarea', 'friendly_name' => __('Email Addresses'), 'description' => __('Enter a comma separated list of Email addresses for this Notification List.'), 'value' => '|arg1:emails|', 'class' => 'textAreaNotes', 'textarea_rows' => '4', 'textarea_cols' => '80'), 'id' => array('method' => 'hidden_zero', 'value' => '|arg1:id|'), 'save_component' => array('method' => 'hidden', 'value' => '1'));
        draw_edit_form(array('config' => array(), 'fields' => inject_form_variables($fields_notification, isset($list) ? $list : array())));
        html_end_box();
        form_save_button('notify_lists.php', 'return');
    } elseif ($current_tab == 'hosts') {
        hosts($header_label);
    } elseif ($current_tab == 'tholds') {
        tholds($header_label);
    } else {
        templates($header_label);
    }
}