Beispiel #1
0
    exit;
}
if (isset($_GET["EnableAptMirror"])) {
    save();
    exit;
}
if (isset($_GET["schedule"])) {
    schedule();
    exit;
}
if (isset($_GET["mirror-schedule"])) {
    schedule_save();
    exit;
}
if (isset($_GET["mirror-del-schedule"])) {
    schedule_delete();
    exit;
}
if (isset($_GET["events"])) {
    events();
    exit;
}
if (isset($_GET["events-list"])) {
    events_list();
    exit;
}
if (isset($_GET["event-id"])) {
    events_id();
    exit;
}
js();
Beispiel #2
0
function form_actions()
{
    global $actions, $assoc_actions;
    /* ================= input validation ================= */
    get_filter_request_var('id');
    get_filter_request_var('drp_action', FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => '/^([a-zA-Z0-9_]+)$/')));
    /* ================= input validation ================= */
    /* if we are to save this form, instead of display it */
    if (isset_request_var('selected_items')) {
        if (isset_request_var('save_list')) {
            if (get_request_var('drp_action') == '2') {
                /* delete */
                schedule_delete();
            } elseif (get_request_var('drp_action') == '1') {
                /* update */
                schedule_update();
            }
            header('Location: maint.php?header=false');
            exit;
        } elseif (isset_request_var('save_hosts')) {
            $selected_items = sanitize_unserialize_selected_items(get_nfilter_request_var('selected_items'));
            if ($selected_items != false) {
                if (get_request_var('drp_action') == '1') {
                    /* associate */
                    for ($i = 0; $i < count($selected_items); $i++) {
                        db_execute('REPLACE INTO plugin_maint_hosts (type, host, schedule) VALUES (1, ' . $selected_items[$i] . ', ' . get_request_var('id') . ')');
                    }
                } elseif (get_request_var('drp_action') == '2') {
                    /* disassociate */
                    for ($i = 0; $i < count($selected_items); $i++) {
                        db_execute('DELETE FROM plugin_maint_hosts WHERE type=1 AND host=' . $selected_items[$i] . ' AND schedule=' . get_request_var('id'));
                    }
                }
            }
            header('Location: maint.php?action=edit&tab=hosts&header=false&id=' . get_request_var('id'));
            exit;
        } elseif (isset_request_var('save_webseer')) {
            $selected_items = sanitize_unserialize_selected_items(get_nfilter_request_var('selected_items'));
            if ($selected_items != false) {
                if (get_request_var('drp_action') == '1') {
                    /* associate */
                    for ($i = 0; $i < count($selected_items); $i++) {
                        db_execute('REPLACE INTO plugin_maint_hosts (type, host, schedule) VALUES (2, ' . $selected_items[$i] . ', ' . get_request_var('id') . ')');
                    }
                } elseif (get_request_var('drp_action') == '2') {
                    /* disassociate */
                    for ($i = 0; $i < count($selected_items); $i++) {
                        db_execute('DELETE FROM plugin_maint_hosts WHERE type=2 AND host=' . $selected_items[$i] . ' AND schedule=' . get_request_var('id'));
                    }
                }
            }
            header('Location: maint.php?action=edit&tab=webseer&header=false&id=' . get_request_var('id'));
            exit;
        } else {
            api_plugin_hook_function('maint_actions_execute');
        }
    }
    /* setup some variables */
    $list = '';
    $array = array();
    $list_name = '';
    if (isset_request_var('id')) {
        $list_name = db_fetch_cell('SELECT name FROM plugin_maint_schedules WHERE id=' . get_request_var('id'));
    }
    if (isset_request_var('save_list')) {
        /* loop through each of the notification lists selected on the previous page and get more info about them */
        while (list($var, $val) = each($_POST)) {
            if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) {
                /* ================= input validation ================= */
                input_validate_input_number($matches[1]);
                /* ==================================================== */
                $list .= '<li><b>' . db_fetch_cell('SELECT name FROM plugin_maint_schedules WHERE id=' . $matches[1]) . '</b></li>';
                $array[] = $matches[1];
            }
        }
        top_header();
        form_start('maint.php');
        html_start_box($actions[get_request_var('drp_action')] . " {$list_name}", '60%', '', '3', 'center', '');
        if (sizeof($array)) {
            if (get_request_var('drp_action') == '1') {
                /* update */
                print "<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>" . __('Click \'Continue\' to Update the following Maintenance Schedule(s).') . "</p>\n\t\t\t\t\t\t<ul>{$list}</ul>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n";
                $save_html = "<input type='button' value='" . __('Cancel') . "' onClick='cactiReturnTo()'>&nbsp;<input type='submit' value='" . __('Continue') . "' title='" . __('Update Maintenance Schedule(s)') . "'>";
            } elseif (get_request_var('drp_action') == '2') {
                /* delete */
                print "<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>" . __('Click \'Continue\' to Delete the following Maintenance Schedule(s).  Any Devices(s) Associated with this Schedule will be Disassociated.') . "</p>\n\t\t\t\t\t\t<ul>{$list}</ul>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n";
                $save_html = "<input type='button' value='" . __('Cancel') . "' onClick='cactiReturnTo()'>&nbsp;<input type='submit' value='" . __('Continue') . "' title='" . __('Delete Maintenance Schedule(s)') . "'>";
            }
        } else {
            print "<tr><td><span class='textError'>" . __('You must select at least one Maintenance Schedule.') . "</span></td></tr>\n";
            $save_html = "<input type='button' value='" . __('Return') . "' onClick='cactiReturnTo()'>";
        }
        print "<tr class='saveRow'>\n\t\t\t<td>\n\t\t\t\t<input type='hidden' name='action' value='actions'>\n\t\t\t\t<input type='hidden' name='save_list' value='1'>\n\t\t\t\t<input type='hidden' name='selected_items' value='" . (isset($array) ? serialize($array) : '') . "'>\n\t\t\t\t<input type='hidden' name='drp_action' value='" . get_request_var('drp_action') . "'>\n\t\t\t\t{$save_html}\n\t\t\t</td>\n\t\t</tr>\n";
        html_end_box();
        form_end();
        bottom_footer();
    } elseif (isset_request_var('save_hosts')) {
        /* loop through each of the notification lists selected on the previous page and get more info about them */
        while (list($var, $val) = each($_POST)) {
            if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) {
                /* ================= input validation ================= */
                input_validate_input_number($matches[1]);
                /* ==================================================== */
                $list .= '<li><b>' . db_fetch_cell('SELECT description FROM host WHERE id=' . $matches[1]) . '</b></li>';
                $array[] = $matches[1];
            }
        }
        top_header();
        form_start('maint.php');
        html_start_box($assoc_actions[get_request_var('drp_action')] . ' ' . __('Device(s)'), '60%', '', '3', 'center', '');
        if (sizeof($array)) {
            if (get_request_var('drp_action') == '1') {
                /* associate */
                print "<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>" . __('Click \'Continue\' to associate the following Device(s) with the Maintenance Schedule \'<b>%s</b>\'.', $list_name) . "</p>\n\t\t\t\t\t\t<ul>{$list}</ul>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n";
                $save_html = "<input type='button' value='" . __('Cancel') . "' onClick='cactiReturnTo()'>&nbsp;<input type='submit' value='" . __('Continue') . "' title='" . __('Associate Maintenance Schedule(s)') . "'>";
            } elseif (get_request_var('drp_action') == '2') {
                /* disassociate */
                print "<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>" . __('Click \'Continue\' to disassociate the following Device(s) with the Maintenance Schedule \'<b>%s</b>\'.', $list_name) . "</p>\n\t\t\t\t\t\t<ul>{$list}</ul>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n";
                $save_html = "<input type='button' value='" . __('Cancel') . "' onClick='cactiReturnTo()'>&nbsp;<input type='submit' value='" . __('Continue') . "' title='" . __('Disassociate Maintenance Schedule(s)') . "'>";
            }
        } else {
            print "<tr><td><span class='textError'>" . __('You must select at least one Device.') . "</span></td></tr>\n";
            $save_html = "<input type='button' value='" . __('Return') . "' onClick='cactiReturnTo()'>";
        }
        print "<tr class='saveRow'>\n\t\t\t<td>\n\t\t\t\t<input type='hidden' name='action' value='actions'>\n\t\t\t\t<input type='hidden' name='id' value='" . get_request_var('id') . "'>\n\t\t\t\t<input type='hidden' name='save_hosts' value='1'>\n\t\t\t\t<input type='hidden' name='selected_items' value='" . (isset($array) ? serialize($array) : '') . "'>\n\t\t\t\t<input type='hidden' name='drp_action' value='" . get_request_var('drp_action') . "'>\n\t\t\t\t{$save_html}\n\t\t\t</td>\n\t\t</tr>\n";
        html_end_box();
        form_end();
        bottom_footer();
    } elseif (isset_request_var('save_webseer')) {
        /* loop through each of the notification lists selected on the previous page and get more info about them */
        while (list($var, $val) = each($_POST)) {
            if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) {
                /* ================= input validation ================= */
                input_validate_input_number($matches[1]);
                /* ==================================================== */
                $list .= '<li><b>' . db_fetch_cell('SELECT description FROM host WHERE id=' . $matches[1]) . '</b></li>';
                $array[] = $matches[1];
            }
        }
        top_header();
        html_start_box($assoc_actions[get_request_var('drp_action')] . ' ' . __('Device(s)'), '60%', '', '3', 'center', '');
        form_start('maint.php');
        if (sizeof($array)) {
            if (get_request_var('drp_action') == '1') {
                /* associate */
                print "<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>" . __('Click \'Continue\' to associate the Device(s) below with the Maintenance Schedule \'<b>%s</b>\'.', $list_name) . "</p>\n\t\t\t\t\t\t<ul>{$list}</ul>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n";
                $save_html = "<input type='button' value='" . __('Cancel') . "' onClick='cactiReturnTo()'>&nbsp;<input type='submit' value='" . __('Continue') . "' title='" . __('Associate Maintenance Schedule(s)') . "'>";
            } elseif (get_request_var('drp_action') == '2') {
                /* disassociate */
                print "<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>" . __('Click \'Continue\' to disassociate the Devices(s) below with the Maintenance Schedule \'<b>%s</b>\'.', $list_name) . "</p>\n\t\t\t\t\t\t<ul>{$list}</ul>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n";
                $save_html = "<input type='button' value='" . __('Cancel') . "' onClick='cactiReturnTo()'>&nbsp;<input type='submit' value='" . __('Continue') . "' title='" . __('Disassociate Maintenance Schedule(s)') . "'>";
            }
        } else {
            print "<tr><td><span class='textError'>" . __('You must select at least one Device.') . "</span></td></tr>\n";
            $save_html = "<input type='button' value='" . __('Return') . "' onClick='cactiReturnTo()'>";
        }
        print "<tr class='saveRow'>\n\t\t\t<td>\n\t\t\t\t<input type='hidden' name='action' value='actions'>\n\t\t\t\t<input type='hidden' name='id' value='" . get_request_var('id') . "'>\n\t\t\t\t<input type='hidden' name='save_webseer' value='1'>\n\t\t\t\t<input type='hidden' name='selected_items' value='" . (isset($array) ? serialize($array) : '') . "'>\n\t\t\t\t<input type='hidden' name='drp_action' value='" . get_request_var('drp_action') . "'>\n\t\t\t\t{$save_html}\n\t\t\t</td>\n\t\t</tr>\n";
        form_end();
        html_end_box();
        bottom_footer();
    } else {
        api_plugin_hook_function('maint_actions_prepare');
    }
}
Beispiel #3
0
	$user=new usersMenus();
	if($user->AsSystemAdministrator==false){
		$tpl=new templates();
		echo "alert('". $tpl->javascript_parse_text("{ERROR_NO_PRIVS}")."');";
		die();exit();
	}
	
	
	if(isset($_GET["popup"])){popup();exit;}
	if(isset($_GET["status"])){status();exit;}
	if(isset($_GET["service-status"])){status_service();exit;}
	if(isset($_GET["repositories"])){repositories();exit;}
	if(isset($_GET["EnableAptMirror"])){save();exit;}
	if(isset($_GET["schedule"])){schedule();exit;}
	if(isset($_GET["mirror-schedule"])){schedule_save();exit;}
	if(isset($_GET["mirror-del-schedule"])){schedule_delete();exit;}
	if(isset($_GET["events"])){events();exit;}
	if(isset($_GET["events-list"])){events_list();exit;}
	if(isset($_GET["event-id"])){events_id();exit;}
js();


function js(){
	$page=CurrentPageName();
	
	if(isset($_GET["in-front-ajax"])){
		echo "document.getElementById('BodyContent').innerHTML='<center><img src=img/wait_verybig.gif></center>';
		$('#BodyContent').load('$page?popup=yes');";
		return;
	}