Example #1
0
    ini_set('error_append_string', null);
}
include_once 'ressources/class.templates.inc';
include_once 'ressources/class.ldap.inc';
include_once 'ressources/class.users.menus.inc';
include_once 'ressources/class.squid.inc';
include_once 'ressources/class.tcpip.inc';
$usersmenus = new usersMenus();
if (!$usersmenus->AsSquidAdministrator) {
    $tpl = new templates();
    $alert = $tpl->_ENGINE_parse_body('{ERROR_NO_PRIVS}');
    echo "alert('{$alert}');";
    die;
}
if (isset($_GET["hosts"])) {
    hosts();
    exit;
}
if (isset($_GET["host-js"])) {
    hosts_js();
    exit;
}
if (isset($_GET["host-popup"])) {
    hosts_popup();
    exit;
}
if (isset($_GET["host-tab"])) {
    hosts_tab();
    exit;
}
if (isset($_GET["delete-host-js"])) {
Example #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);
    }
}
if(isset($_GET["verbose"])){$GLOBALS["VERBOSE"]=true;ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string',null);ini_set('error_append_string',null);}
	include_once('ressources/class.templates.inc');
	include_once('ressources/class.ldap.inc');
	include_once('ressources/class.users.menus.inc');
	include_once('ressources/class.squid.inc');
	include_once('ressources/class.tcpip.inc');
	
$usersmenus=new usersMenus();
if(!$usersmenus->AsSquidAdministrator){
	$tpl=new templates();
	$alert=$tpl->_ENGINE_parse_body('{ERROR_NO_PRIVS}');
	echo "alert('$alert');";
	die();	
}

if(isset($_GET["hosts"])){hosts();exit;}
if(isset($_GET["host-js"])){hosts_js();exit;}
if(isset($_GET["delete-host-js"])){hosts_js_delete();exit;}
if(isset($_POST["delete-host-id"])){hosts_delete();exit;}
if(isset($_POST["domain"])){domain_save();exit;}

if(isset($_GET["table"])){table();exit;}


js();



function js(){
	header("content-type: application/x-javascript");
	$ID=$_GET["ID"];
Example #4
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);
    }
}