function form_actions() { global $colors, $config, $syslog_actions, $fields_syslog_action_edit; include dirname(__FILE__) . "/config.php"; /* if we are to save this form, instead of display it */ if (isset($_POST["selected_items"])) { $selected_items = unserialize(stripslashes($_POST["selected_items"])); if ($_POST["drp_action"] == "1") { /* delete */ for ($i = 0; $i < count($selected_items); $i++) { /* ================= input validation ================= */ input_validate_input_number($selected_items[$i]); /* ==================================================== */ api_syslog_alert_remove($selected_items[$i]); } } else { if ($_POST["drp_action"] == "2") { /* disable */ for ($i = 0; $i < count($selected_items); $i++) { /* ================= input validation ================= */ input_validate_input_number($selected_items[$i]); /* ==================================================== */ api_syslog_alert_disable($selected_items[$i]); } } else { if ($_POST["drp_action"] == "3") { /* enable */ for ($i = 0; $i < count($selected_items); $i++) { /* ================= input validation ================= */ input_validate_input_number($selected_items[$i]); /* ==================================================== */ api_syslog_alert_enable($selected_items[$i]); } } } } header("Location: syslog_alerts.php"); exit; } include_once $config['base_path'] . "/include/top_header.php"; html_start_box("<strong>" . $syslog_actions[$_POST["drp_action"]] . "</strong>", "60%", $colors["header_panel"], "3", "center", ""); print "<form action='syslog_alerts.php' method='post'>\n"; /* setup some variables */ $alert_array = array(); $alert_list = ""; /* loop through each of the clusters selected on the previous page and get more info about them */ while (list($var, $val) = each($_POST)) { if (ereg("^chk_([0-9]+)\$", $var, $matches)) { /* ================= input validation ================= */ input_validate_input_number($matches[1]); /* ==================================================== */ $alert_info = syslog_db_fetch_cell("SELECT name FROM `" . $syslogdb_default . "`.`syslog_alert` WHERE id=" . $matches[1]); $alert_list .= "<li>" . $alert_info . "</li>"; $alert_array[] = $matches[1]; } } if (sizeof($alert_array)) { if ($_POST["drp_action"] == "1") { /* delete */ print "\t<tr>\n\t\t\t\t\t<td class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>\n\t\t\t\t\t\t<p>If you click 'Continue', the following Syslog Alert Rule(s) will be deleted</p>\n\t\t\t\t\t\t<ul>{$alert_list}</ul>"; print "</td></tr>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n"; $title = "Delete Syslog Alert Rule(s)"; } else { if ($_POST["drp_action"] == "2") { /* disable */ print "\t<tr>\n\t\t\t\t\t<td class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>\n\t\t\t\t\t\t<p>If you click 'Continue', the following Syslog Alert Rule(s) will be disabled</p>\n\t\t\t\t\t\t<ul>{$alert_list}</ul>"; print "</td></tr>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n"; $title = "Disable Syslog Alert Rule(s)"; } else { if ($_POST["drp_action"] == "3") { /* enable */ print "\t<tr>\n\t\t\t\t\t<td class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>\n\t\t\t\t\t\t<p>If you click 'Continue', the following Syslog Alert Rule(s) will be enabled</p>\n\t\t\t\t\t\t<ul>{$alert_list}</ul>"; print "</td></tr>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n"; $title = "Enable Syslog Alert Rule(s)"; } } } $save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='{$title}'"; } else { print "<tr><td bgcolor='#" . $colors["form_alternate1"] . "'><span class='textError'>You must select at least one Syslog Alert Rule.</span></td></tr>\n"; $save_html = "<input type='button' value='Return' onClick='window.history.back()'>"; } print "\t<tr>\n\t\t\t<td align='right' bgcolor='#eaeaea'>\n\t\t\t\t<input type='hidden' name='action' value='actions'>\n\t\t\t\t<input type='hidden' name='selected_items' value='" . (isset($alert_array) ? serialize($alert_array) : '') . "'>\n\t\t\t\t<input type='hidden' name='drp_action' value='" . $_POST["drp_action"] . "'>\n\t\t\t\t{$save_html}\n\t\t\t</td>\n\t\t</tr>"; html_end_box(); include_once $config['base_path'] . "/include/bottom_footer.php"; }
function form_actions() { global $config, $syslog_actions, $fields_syslog_action_edit; include dirname(__FILE__) . '/config.php'; get_filter_request_var('drp_action', FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => '/^([a-zA-Z0-9_]+)$/'))); /* if we are to save this form, instead of display it */ if (isset_request_var('selected_items')) { $selected_items = sanitize_unserialize_selected_items(get_request_var('selected_items')); if ($selected_items != false) { if (get_request_var('drp_action') == '1') { /* delete */ for ($i = 0; $i < count($selected_items); $i++) { api_syslog_alert_remove($selected_items[$i]); } } else { if (get_request_var('drp_action') == '2') { /* disable */ for ($i = 0; $i < count($selected_items); $i++) { api_syslog_alert_disable($selected_items[$i]); } } else { if (get_request_var('drp_action') == '3') { /* enable */ for ($i = 0; $i < count($selected_items); $i++) { api_syslog_alert_enable($selected_items[$i]); } } } } } header('Location: syslog_alerts.php?header=false'); exit; } top_header(); form_start('syslog_alerts.php'); html_start_box($syslog_actions[get_request_var('drp_action')], '60%', '', '3', 'center', ''); /* setup some variables */ $alert_array = array(); $alert_list = ''; /* loop through each of the clusters 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]); /* ==================================================== */ $alert_info = syslog_db_fetch_cell('SELECT name FROM `' . $syslogdb_default . '`.`syslog_alert` WHERE id=' . $matches[1]); $alert_list .= '<li>' . $alert_info . '</li>'; $alert_array[] = $matches[1]; } } if (sizeof($alert_array)) { if (get_request_var('drp_action') == '1') { /* delete */ print "<tr>\n\t\t\t\t<td class='textArea'>\n\t\t\t\t\t<p>" . __('Click \'Continue\' to Delete the following Syslog Alert Rule(s).') . "</p>\n\t\t\t\t\t<ul>{$alert_list}</ul>"; print "</td></tr>\n\t\t\t\t</td>\n\t\t\t</tr>\n"; $title = __('Delete Syslog Alert Rule(s)'); } else { if (get_request_var('drp_action') == '2') { /* disable */ print "<tr>\n\t\t\t\t<td class='textArea'>\n\t\t\t\t\t<p>" . __('Click \'Continue\' to Disable the following Syslog Alert Rule(s).') . "</p>\n\t\t\t\t\t<ul>{$alert_list}</ul>"; print "</td></tr>\n\t\t\t\t</td>\n\t\t\t</tr>\n"; $title = __('Disable Syslog Alert Rule(s)'); } else { if (get_request_var('drp_action') == '3') { /* enable */ print "<tr>\n\t\t\t\t<td class='textArea'>\n\t\t\t\t\t<p>" . __('Click \'Continue\' to Enable the following Syslog Alert Rule(s).') . "</p>\n\t\t\t\t\t<ul>{$alert_list}</ul>"; print "</td></tr>\n\t\t\t\t</td>\n\t\t\t</tr>\n"; $title = __('Enable Syslog Alert Rule(s)'); } } } $save_html = "<input type='button' value='" . __('Cancel') . "' onClick='cactiReturnTo()'> <input type='submit' value='" . __('Continue') . "' title='{$title}'"; } else { print "<tr><td class='even'><span class='textError'>" . __('You must select at least one Syslog Alert Rule.') . "</span></td></tr>\n"; $save_html = "<input type='button' value='" . __('Return') . "' onClick='cactiReturnTo()'>"; } print "<tr>\n\t\t<td align='right' class='saveRow'>\n\t\t\t<input type='hidden' name='action' value='actions'>\n\t\t\t<input type='hidden' name='selected_items' value='" . (isset($alert_array) ? serialize($alert_array) : '') . "'>\n\t\t\t<input type='hidden' name='drp_action' value='" . get_request_var('drp_action') . "'>\n\t\t\t{$save_html}\n\t\t</td>\n\t</tr>"; html_end_box(); form_end(); bottom_footer(); }