本文整理汇总了PHP中top_header函数的典型用法代码示例。如果您正苦于以下问题:PHP top_header函数的具体用法?PHP top_header怎么用?PHP top_header使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了top_header函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: form_save
function form_save()
{
global $export_types, $export_errors;
/* ================= input validation ================= */
input_validate_input_number(get_request_var_post('export_item_id'));
/* ==================================================== */
if (isset($_POST['save_component_export'])) {
$export_errors = 0;
$xml_data = get_item_xml($_POST['export_type'], $_POST['export_item_id'], (isset($_POST['include_deps']) ? $_POST['include_deps'] : '') == '' ? false : true);
if ($_POST['output_format'] == '1') {
top_header();
print "<table width='100%' align='center'><tr><td><pre>" . htmlspecialchars($xml_data) . '</pre></td></tr></table>';
bottom_footer();
} elseif ($_POST['output_format'] == '2') {
header('Content-type: application/xml');
if ($export_errors) {
echo "WARNING: Export Errors Encountered. Refresh Browser Window for Details!\n";
}
print $xml_data;
} elseif ($_POST['output_format'] == '3') {
if ($export_errors) {
header('Location: templates_export.php');
} else {
header('Content-type: application/xml');
header('Content-Disposition: attachment; filename=cacti_' . $_POST['export_type'] . '_' . strtolower(clean_up_file_name(db_fetch_cell(str_replace('|id|', $_POST['export_item_id'], $export_types[$_POST['export_type']]['title_sql'])))) . '.xml');
print $xml_data;
}
}
}
}
示例2: form_actions
//.........这里部分代码省略.........
input_validate_input_number($selected_items[$i]);
/* ==================================================== */
$user = db_fetch_row_prepared('SELECT username, realm FROM user_auth WHERE id = ?', array($selected_items[$i]));
if (isset($user) && isset($template)) {
if (user_copy($template['username'], $user['username'], $template['realm'], $user['realm'], true) === false) {
$copy_error = true;
}
}
}
if ($copy_error) {
raise_message(2);
} else {
raise_message(1);
}
}
header('Location: user_admin.php');
exit;
}
/* loop through each of the users and process them */
$user_list = '';
$user_array = array();
$i = 0;
while (list($var, $val) = each($_POST)) {
if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) {
/* ================= input validation ================= */
input_validate_input_number($matches[1]);
/* ==================================================== */
if (get_request_var_post('drp_action') != '2') {
$user_list .= '<li>' . db_fetch_cell_prepared('SELECT username FROM user_auth WHERE id = ?', array($matches[1])) . '</li>';
}
$user_array[$i] = $matches[1];
$i++;
}
}
/* Check for deleting of Graph Export User */
if (get_request_var_post('drp_action') == '1' && isset($user_array) && sizeof($user_array)) {
/* delete */
$exportuser = read_config_option('export_user_id');
if (in_array($exportuser, $user_array)) {
raise_message(22);
header('Location: user_admin.php');
exit;
}
}
top_header();
html_start_box('<strong>' . $user_actions[get_request_var_post('drp_action')] . '</strong>', '40%', '', '3', 'center', '');
print "<form action='user_admin.php' method='post'>\n";
if (isset($user_array) && sizeof($user_array)) {
if (get_request_var_post('drp_action') == '1' && sizeof($user_array)) {
/* delete */
print "\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the selected User(s) will be deleted.</p>\n\t\t\t\t\t\t<p><ul>{$user_list}</ul></p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Delete User(s)'>";
}
$user_id = '';
if (get_request_var_post('drp_action') == '2' && sizeof($user_array)) {
/* copy */
$user_id = $user_array[0];
$user_realm = db_fetch_cell_prepared('SELECT realm FROM user_auth WHERE id = ?', array($user_id));
print "\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\tWhen you click \"Continue\" the selected User will be copied to the new User below<br><br>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\tTemplate Username: <i>" . db_fetch_cell_prepared('SELECT username FROM user_auth WHERE id = ?', array($user_id)) . "</i>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\tUsername: ";
print form_text_box('new_username', '', '', 25);
print "\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\tFull Name: ";
print form_text_box('new_fullname', '', '', 35);
print "\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\tRealm: \n";
print form_dropdown('new_realm', $auth_realms, '', '', $user_realm, '', 0);
print "\t\t\t\t</td>\n\n\t\t\t\t</tr>\n";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Copy User'>";
}
if (get_request_var_post('drp_action') == '3' && sizeof($user_array)) {
/* enable */
print "\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\" the selected User(s) will be enabled.</p>\n\t\t\t\t\t\t<ul>{$user_list}</ul>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Enable User(s)'>";
}
if (get_request_var_post('drp_action') == '4' && sizeof($user_array)) {
/* disable */
print "\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\" the selected User(s) will be disabled.</p>\n\t\t\t\t\t\t<ul>{$user_list}</ul>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Disable User(s)'>";
}
if (get_request_var_post('drp_action') == '5' && sizeof($user_array)) {
/* batch copy */
$usernames = db_fetch_assoc('SELECT id, username FROM user_auth WHERE realm = 0 ORDER BY username');
print "\n\t\t\t\t<tr>\n\t\t\t\t\t<td class='textArea'>When you click \"Continue\" you will overwrite selected the User(s) settings with the selected template User settings and permissions? Original user Full Name, Password, Realm and Enable status will be retained, all other fields will be overwritten from Template User.<br><br></td>\n\t\t\t\t</tr><tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\tTemplate User: \n";
print form_dropdown('template_user', $usernames, 'username', 'id', '', '', 0);
print "\t\t</td>\n\t\t\t\t</tr><tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>User(s) to update:\n\t\t\t\t\t\t<ul>{$user_list}</ul></p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Reset User(s) Settings'>";
}
} else {
print "<tr><td class='even'><span class='textError'>You must select at least one user.</span></td></tr>\n";
$save_html = "<input type='button' value='Return' onClick='window.history.back()'>";
}
print " <tr>\n\t\t\t<td align='right' class='saveRow'>\n\t\t\t\t<input type='hidden' name='action' value='actions'>";
if (get_request_var_post('drp_action') == '2') {
/* copy */
print "\t\t\t\t<input type='hidden' name='selected_items' value='" . $user_id . "'>\n";
} else {
print "\t\t\t\t<input type='hidden' name='selected_items' value='" . (isset($user_array) ? serialize($user_array) : '') . "'>\n";
}
print "\t\t\t\t<input type='hidden' name='drp_action' value='" . get_request_var_post('drp_action') . "'>\n\t\t\t\t{$save_html}\n\t\t\t</td>\n\t\t</tr>\n\t\t";
html_end_box();
bottom_footer();
}
示例3: top_header
<link href="../../plugins/datatables/dataTables.bootstrap.css" rel="stylesheet" type="text/css" />
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
</head>
<body class="skin-blue">
<div class="wrapper">
<?php
top_header();
//function in include/dashboardFunctions.php
?>
<?php
sidebar();
//function in include/dashboardFunctions.php
?>
<?php
editDeleteSubCategory();
//function in include/adminFunctions.php
?>
<?php
footer();
示例4: form_actions
function form_actions()
{
global $host_actions;
/* ================= input validation ================= */
input_validate_input_regex(get_request_var_post('drp_action'), '^([a-zA-Z0-9_]+)$');
/* ==================================================== */
/* 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 */
db_execute('DELETE FROM host_template WHERE ' . array_to_sql_or($selected_items, 'id'));
db_execute('DELETE FROM host_template_snmp_query WHERE ' . array_to_sql_or($selected_items, 'host_template_id'));
db_execute('DELETE FROM host_template_graph WHERE ' . array_to_sql_or($selected_items, 'host_template_id'));
/* "undo" any device that is currently using this template */
db_execute('UPDATE host SET host_template_id=0 WHERE ' . array_to_sql_or($selected_items, 'host_template_id'));
} elseif ($_POST['drp_action'] == '2') {
/* duplicate */
for ($i = 0; $i < count($selected_items); $i++) {
/* ================= input validation ================= */
input_validate_input_number($selected_items[$i]);
/* ==================================================== */
duplicate_host_template($selected_items[$i], $_POST['title_format']);
}
}
header('Location: host_templates.php');
exit;
}
/* setup some variables */
$host_list = '';
$i = 0;
/* loop through each of the host templates 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]);
/* ==================================================== */
$host_list .= '<li>' . htmlspecialchars(db_fetch_cell_prepared('SELECT name FROM host_template WHERE id = ?'), array($matches[1])) . '<br>';
$host_array[$i] = $matches[1];
$i++;
}
}
top_header();
html_start_box('<strong>' . $host_actions[$_POST['drp_action']] . '</strong>', '60%', '', '3', 'center', '');
print "<form action='host_templates.php' autocomplete='off' method='post'>\n";
if (isset($host_array) && sizeof($host_array)) {
if ($_POST['drp_action'] == '1') {
/* delete */
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>Are you sure you want to delete the following Device Template(s)? All Devices currently associated\n\t\t\t\t\t\twith these Device Template(s) will lose that assocation.</p>\n\t\t\t\t\t\t<p><ul>{$host_list}</ul></p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Delete Device Template(s)'>";
} elseif ($_POST['drp_action'] == '2') {
/* duplicate */
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following Device Template(s) will be duplicated. You can\n\t\t\t\t\t\toptionally change the title format for the new Device Template(s).</p>\n\t\t\t\t\t\t<p><ul>{$host_list}</ul></p>\n\t\t\t\t\t\t<p><strong>Title Format:</strong><br>";
form_text_box('title_format', '<template_title> (1)', '', '255', '30', 'text');
print "</p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Duplicate Device Template(s)'>";
}
} else {
print "<tr><td class='even'><span class='textError'>You must select at least one host template.</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' class='saveRow'>\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($host_array) ? serialize($host_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>\n\t\t";
html_end_box();
bottom_footer();
}
示例5: utilities_clear_logfile
function utilities_clear_logfile()
{
load_current_session_value('refresh', 'sess_logfile_refresh', read_config_option('log_refresh_interval'));
$refresh['seconds'] = get_request_var_request('refresh');
$refresh['page'] = 'utilities.php?action=view_logfile';
top_header();
$logfile = read_config_option('path_cactilog');
if ($logfile == '') {
$logfile = './log/cacti.log';
}
html_start_box('<strong>Clear Cacti Log File</strong>', '100%', '', '3', 'center', '');
if (file_exists($logfile)) {
if (is_writable($logfile)) {
$timestamp = date('m/d/Y h:i:s A');
$log_fh = fopen($logfile, 'w');
fwrite($log_fh, $timestamp . " - WEBUI: Cacti Log Cleared from Web Management Interface\n");
fclose($log_fh);
print '<tr><td>Cacti Log File Cleared</td></tr>';
} else {
print "<tr><td><font color='red'><b>Error: Unable to clear log, no write permissions.<b></font></td></tr>";
}
} else {
print "<tr><td><font color='red'><b>Error: Unable to clear log, file does not exist.</b></font></td></tr>";
}
html_end_box();
}
示例6: thold_add_select_host
function thold_add_select_host()
{
global $config;
$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');
$hosts = get_allowed_devices();
top_header();
form_start('thold.php?action=save', 'tholdform');
html_start_box(__('Threshold Creation Wizard'), '50%', '', '3', 'center', '');
if ($host_id == '') {
print '<tr><td class="center">' . __('Please select a Device') . '</td></tr>';
} else {
if ($local_graph_id == '') {
print '<tr><td class="center">' . __('Please select a Graph') . '</td></tr>';
} else {
if ($data_template_rrd_id == '') {
print '<tr><td class="center">' . __('Please select a Data Source') . '</td></tr>';
} else {
print '<tr><td class="center">' . __('Please press \'Create\' to activate your Threshold') . '</td></tr>';
}
}
}
html_end_box();
html_start_box('', '50%', '', '3', 'center', '');
/* display the host dropdown */
?>
<tr><td><table class='filterTable' align='center'>
<tr>
<?php
print html_host_filter(get_request_var('host_id'));
?>
</tr><?php
if ($host_id != '') {
$graphs = get_allowed_graphs('gl.host_id=' . $host_id);
?>
<tr>
<td>
<?php
print __('Graph');
?>
</td>
<td>
<select id='local_graph_id' name='local_graph_id' onChange='applyFilter("graph")'>
<option value=''></option><?php
foreach ($graphs as $row) {
echo "<option value='" . $row['local_graph_id'] . "'" . ($row['local_graph_id'] == $local_graph_id ? ' selected' : '') . '>' . htmlspecialchars($row['title_cache'], ENT_QUOTES) . '</option>';
}
?>
</select>
</td>
</tr><?php
} else {
?>
<tr>
<td>
<input type='hidden' id='local_graph_id' name='local_graph_id' value=''>
</td>
</tr><?php
}
if ($local_graph_id != '') {
$dt_sql = 'SELECT DISTINCT dtr.local_data_id
FROM data_template_rrd AS dtr
LEFT JOIN graph_templates_item AS gti
ON gti.task_item_id=dtr.id
LEFT JOIN graph_local AS gl
ON gl.id=gti.local_graph_id
WHERE gl.id = ' . $local_graph_id;
$local_data_id = db_fetch_cell($dt_sql);
$dss = db_fetch_assoc('SELECT DISTINCT id, data_source_name
FROM data_template_rrd
WHERE local_data_id IN (' . $dt_sql . ') ORDER BY data_source_name');
/* show the data source options */
?>
<tr>
<td>
<?php
print __('Data Source');
?>
</td>
<td>
<input type='hidden' id='local_data_id' name='local_data_id' value='<?php
print $local_data_id;
?>
'>
<select id='data_template_rrd_id' name='data_template_rrd_id' onChange='applyFilter("ds")'>
<option value=''></option><?php
foreach ($dss as $row) {
echo "<option value='" . $row['id'] . "'" . ($row['id'] == $data_template_rrd_id ? ' selected' : '') . '>' . htmlspecialchars($row['data_source_name'], ENT_QUOTES) . '</option>';
}
?>
</select>
</td>
</tr></table></td></tr><?php
} else {
?>
<tr>
<td>
<input type='hidden' id='data_template_rrd_id' name='data_template_rrd_id' value=''>
</td>
//.........这里部分代码省略.........
示例7: field_remove
function field_remove()
{
global $registered_cacti_names;
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request('id'));
input_validate_input_number(get_request_var_request('data_input_id'));
/* ==================================================== */
if (read_config_option('deletion_verification') == 'on' && !isset($_REQUEST['confirm'])) {
top_header();
form_confirm('Are You Sure?', "Are you sure you want to delete the field <strong>'" . htmlspecialchars(db_fetch_cell_prepared('SELECT name FROM data_input_fields WHERE id = ?', array(get_request_var_request('id'))), ENT_QUOTES) . "'</strong>?", htmlspecialchars('data_input.php?action=edit&id=' . $_REQUEST['data_input_id']), htmlspecialchars('data_input.php?action=field_remove&id=' . $_REQUEST['id'] . '&data_input_id=' . $_REQUEST['data_input_id']));
bottom_footer();
exit;
}
if (read_config_option('deletion_verification') == '' || isset($_REQUEST['confirm'])) {
/* get information about the field we're going to delete so we can re-order the seqs */
$field = db_fetch_row_prepared('SELECT input_output,data_input_id FROM data_input_fields WHERE id = ?', array(get_request_var_request('id')));
db_execute_prepared('DELETE FROM data_input_fields WHERE id = ?', array(get_request_var_request('id')));
db_execute_prepared('DELETE FROM data_input_data WHERE data_input_field_id = ?', array(get_request_var_request('id')));
/* when a field is deleted; we need to re-order the field sequences */
if ($field['input_output'] == 'in' && preg_match_all('/<([_a-zA-Z0-9]+)>/', db_fetch_cell_prepared('SELECT input_string FROM data_input WHERE id = ?', array($field['data_input_id'])), $matches)) {
$j = 0;
for ($i = 0; $i < count($matches[1]); $i++) {
if (in_array($matches[1][$i], $registered_cacti_names) == false) {
$j++;
db_execute_prepared("UPDATE data_input_fields SET sequence = ? WHERE data_input_id = ? AND input_output = 'in' AND data_name = ?", array($j, $field['data_input_id'], $matches[1][$i]));
}
}
}
}
}
示例8: form_actions
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_nfilter_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_removal_remove($selected_items[$i]);
}
} else {
if (get_request_var('drp_action') == '2') {
/* disable */
for ($i = 0; $i < count($selected_items); $i++) {
api_syslog_removal_disable($selected_items[$i]);
}
} else {
if (get_request_var('drp_action') == '3') {
/* enable */
for ($i = 0; $i < count($selected_items); $i++) {
api_syslog_removal_enable($selected_items[$i]);
}
} else {
if (get_request_var('drp_action') == '4') {
/* reprocess */
for ($i = 0; $i < count($selected_items); $i++) {
api_syslog_removal_reprocess($selected_items[$i]);
}
}
}
}
}
}
header('Location: syslog_removal.php?header=false');
exit;
}
top_header();
form_start('syslog_removal.php');
html_start_box($syslog_actions[get_request_var('drp_action')], '60%', '', '3', 'center', '');
/* setup some variables */
$removal_array = array();
$removal_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]);
/* ==================================================== */
$removal_info = syslog_db_fetch_cell("SELECT name FROM `" . $syslogdb_default . "`.`syslog_remove` WHERE id=" . $matches[1]);
$removal_list .= '<li>' . $removal_info . '</li>';
$removal_array[] = $matches[1];
}
}
if (sizeof($removal_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 Removal Rule(s).') . "</p>\n\t\t\t\t\t<ul>{$removal_list}</ul>";
print "</td></tr>\n\t\t\t\t</td>\n\t\t\t</tr>\n";
$title = __('Delete Syslog Removal 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 Removal Rule(s).') . "</p>\n\t\t\t\t\t<ul>{$removal_list}</ul>";
print "</td></tr>\n\t\t\t\t</td>\n\t\t\t</tr>\n";
$title = __('Disable Syslog Removal 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 Removal Rule(s).') . "</p>\n\t\t\t\t\t<ul>{$removal_list}</ul>";
print "</td></tr>\n\t\t\t\t</td>\n\t\t\t</tr>\n";
$title = __('Enable Syslog Removal Rule(s)');
} else {
if (get_request_var('drp_action') == '4') {
/* reprocess */
print "<tr>\n\t\t\t\t<td class='textArea'>\n\t\t\t\t\t<p>" . __('Click \'Continue\' to Re-process the following Syslog Removal Rule(s).') . "</p>\n\t\t\t\t\t<ul>{$removal_list}</ul>";
print "</td></tr>\n\t\t\t\t</td>\n\t\t\t</tr>\n";
$title = __('Retroactively Process Syslog Removal 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 Removal Rule.') . "</span></td></tr>\n";
$save_html = "<input type='button' value='" . __('Return') . "' onClick='cactiReturnTo()'>";
}
print "\t<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($removal_array) ? serialize($removal_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>\n";
html_end_box();
form_end();
bottom_footer();
}
示例9: ds_edit
function ds_edit()
{
global $struct_data_source, $struct_data_source_item, $data_source_types;
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request('id'));
input_validate_input_number(get_request_var_request('host_id'));
/* ==================================================== */
api_plugin_hook('data_source_edit_top');
$use_data_template = true;
$host_id = 0;
if (!empty($_REQUEST['id'])) {
$data_local = db_fetch_row_prepared('SELECT host_id, data_template_id FROM data_local WHERE id = ?', array($_REQUEST['id']));
$data = db_fetch_row_prepared('SELECT * FROM data_template_data WHERE local_data_id = ?', array($_REQUEST['id']));
if (isset($data_local['data_template_id']) && $data_local['data_template_id'] >= 0) {
$data_template = db_fetch_row_prepared('SELECT id, name FROM data_template WHERE id = ?', array($data_local['data_template_id']));
$data_template_data = db_fetch_row_prepared('SELECT * FROM data_template_data WHERE data_template_id = ? AND local_data_id = 0', array($data_local['data_template_id']));
} else {
$_SESSION['sess_messages'] = 'Data Source "' . $_REQUEST['id'] . '" does not exist.';
header('Location: data_sources.php');
exit;
}
$header_label = '[edit: ' . htmlspecialchars(get_data_source_title($_REQUEST['id'])) . ']';
if (empty($data_local['data_template_id'])) {
$use_data_template = false;
}
} else {
$header_label = '[new]';
$use_data_template = false;
}
/* handle debug mode */
if (isset($_REQUEST['debug'])) {
if ($_REQUEST['debug'] == '0') {
kill_session_var('ds_debug_mode');
} elseif ($_REQUEST['debug'] == '1') {
$_SESSION['ds_debug_mode'] = true;
}
}
top_header();
if (!empty($_REQUEST['id'])) {
?>
<table width='100%' align='center'>
<tr>
<td class='textInfo' colspan='2' valign='top'>
<?php
print htmlspecialchars(get_data_source_title($_REQUEST['id']));
?>
</td>
<td class='textInfo' align='right' valign='top'>
<span class='linkMarker'>*<a href='<?php
print htmlspecialchars('data_sources.php?action=ds_edit&id=' . (isset($_REQUEST['id']) ? $_REQUEST['id'] : '0'));
?>
&debug=<?php
print isset($_SESSION['ds_debug_mode']) ? '0' : '1';
?>
'>Turn <strong><?php
print isset($_SESSION['ds_debug_mode']) ? 'Off' : 'On';
?>
</strong> Data Source Debug Mode.</a><br>
<?php
if (!empty($data_template['id'])) {
?>
<span class='linkMarker'>*<a href='<?php
print htmlspecialchars('data_templates.php?action=template_edit&id=' . (isset($data_template['id']) ? $data_template['id'] : '0'));
?>
'>Edit Data Template.</a><br><?php
}
if (!empty($_REQUEST['host_id']) || !empty($data_local['host_id'])) {
?>
<span class='linkMarker'>*<a href='<?php
print htmlspecialchars('host.php?action=edit&id=' . (isset($_REQUEST['host_id']) ? $_REQUEST['host_id'] : $data_local['host_id']));
?>
'>Edit Device.</a><br><?php
}
?>
</td>
</tr>
</table>
<br>
<?php
}
html_start_box("<strong>Data Template Selection</strong> {$header_label}", '100%', '', '3', 'center', '');
$form_array = array('data_template_id' => array('method' => 'drop_sql', 'friendly_name' => 'Selected Data Template', 'description' => 'The name given to this data template.', 'value' => isset($data_template) ? $data_template['id'] : '0', 'none_value' => 'None', 'sql' => 'SELECT id,name FROM data_template order by name'), 'host_id' => array('method' => 'drop_sql', 'friendly_name' => 'Device', 'description' => 'Choose the host that this graph belongs to.', 'value' => isset($_REQUEST['host_id']) ? $_REQUEST['host_id'] : $data_local['host_id'], 'none_value' => 'None', 'sql' => "SELECT id,CONCAT_WS('',description,' (',hostname,')') as name FROM host order by description,hostname"), '_data_template_id' => array('method' => 'hidden', 'value' => isset($data_template) ? $data_template['id'] : '0'), '_host_id' => array('method' => 'hidden', 'value' => empty($data_local['host_id']) ? isset($_REQUEST['host_id']) ? $_REQUEST['host_id'] : '0' : $data_local['host_id']), '_data_input_id' => array('method' => 'hidden', 'value' => isset($data['data_input_id']) ? $data['data_input_id'] : '0'), 'data_template_data_id' => array('method' => 'hidden', 'value' => isset($data) ? $data['id'] : '0'), 'local_data_template_data_id' => array('method' => 'hidden', 'value' => isset($data) ? $data['local_data_template_data_id'] : '0'), 'local_data_id' => array('method' => 'hidden', 'value' => isset($data) ? $data['local_data_id'] : '0'));
draw_edit_form(array('config' => array(), 'fields' => $form_array));
html_end_box();
/* only display the "inputs" area if we are using a data template for this data source */
if (!empty($data['data_template_id'])) {
$template_data_rrds = db_fetch_assoc_prepared('SELECT * FROM data_template_rrd WHERE local_data_id = ? ORDER BY data_source_name', array($_REQUEST['id']));
html_start_box('<strong>Supplemental Data Template Data</strong>', '100%', '', '3', 'center', '');
draw_nontemplated_fields_data_source($data['data_template_id'], $data['local_data_id'], $data, '|field|', '<strong>Data Source Fields</strong>', true, true, 0);
draw_nontemplated_fields_data_source_item($data['data_template_id'], $template_data_rrds, '|field|_|id|', '<strong>Data Source Item Fields</strong>', true, true, true, 0);
draw_nontemplated_fields_custom_data($data['id'], 'value_|id|', '<strong>Custom Data</strong>', true, true, 0);
form_hidden_box('save_component_data', '1', '');
html_end_box();
}
if ((isset($_REQUEST['id']) || isset($_REQUEST['new'])) && empty($data['data_template_id'])) {
html_start_box('<strong>Data Source</strong>', '100%', '', '3', 'center', '');
$form_array = array();
while (list($field_name, $field_array) = each($struct_data_source)) {
$form_array += array($field_name => $struct_data_source[$field_name]);
if (!($use_data_template == false || !empty($data_template_data['t_' . $field_name]) || $field_array['flags'] == 'NOTEMPLATE')) {
//.........这里部分代码省略.........
示例10: form_actions
//.........这里部分代码省略.........
} elseif ($_POST['drp_action'] == '7') {
/* resize graphs */
input_validate_input_number(get_request_var_post('graph_width'));
input_validate_input_number(get_request_var_post('graph_height'));
for ($i = 0; $i < count($selected_items); $i++) {
/* ================= input validation ================= */
input_validate_input_number($selected_items[$i]);
/* ==================================================== */
api_resize_graphs($selected_items[$i], $_POST['graph_width'], $_POST['graph_height']);
}
} else {
api_plugin_hook_function('graphs_action_execute', $_POST['drp_action']);
}
/* update snmpcache */
snmpagent_graphs_action_bottom(array($_POST['drp_action'], $selected_items));
api_plugin_hook_function('graphs_action_bottom', array($_POST['drp_action'], $selected_items));
header('Location: graphs.php');
exit;
}
/* setup some variables */
$graph_list = '';
$i = 0;
/* loop through each of the graphs 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]);
/* ==================================================== */
$graph_list .= '<li>' . htmlspecialchars(get_graph_title($matches[1])) . '</li>';
$graph_array[$i] = $matches[1];
$i++;
}
}
top_header();
/* add a list of tree names to the actions dropdown */
add_tree_names_to_actions_array();
html_start_box('<strong>' . $graph_actions[$_POST['drp_action']] . '</strong>', '60%', '', '3', 'center', '');
print "<form action='graphs.php' method='post'>\n";
if (isset($graph_array) && sizeof($graph_array)) {
if ($_POST['drp_action'] == '1') {
/* delete */
$graphs = array();
/* find out which (if any) data sources are being used by this graph, so we can tell the user */
if (isset($graph_array) && sizeof($graph_array)) {
$data_sources = db_fetch_assoc('select
data_template_data.local_data_id,
data_template_data.name_cache
from (data_template_rrd,data_template_data,graph_templates_item)
where graph_templates_item.task_item_id=data_template_rrd.id
and data_template_rrd.local_data_id=data_template_data.local_data_id
and ' . array_to_sql_or($graph_array, 'graph_templates_item.local_graph_id') . '
and data_template_data.local_data_id > 0
group by data_template_data.local_data_id
order by data_template_data.name_cache');
}
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following Graph(s) will be deleted. Please note, Data Source(s) should be deleted only if they are only used by these Graph(s)\n\t\t\t\t\t\tand not others.</p>\n\t\t\t\t\t\t<p><ul>{$graph_list}</ul></p>";
if (isset($data_sources) && sizeof($data_sources)) {
print "<tr><td class='textArea'><p>The following Data Source(s) are in use by these Graph(s):</p>\n";
print '<ul>';
foreach ($data_sources as $data_source) {
print '<li><strong>' . $data_source['name_cache'] . "</strong></li>\n";
}
print '</ul>';
print '<br>';
form_radio_button('delete_type', '1', '2', "Leave the Data Source(s) untouched. Not applicable for Graphs created under 'New Graphs' or WHERE the Graphs were created automatically.", '2');
print '<br>';
示例11: template_add
function template_add()
{
if (!isset_request_var('save') || get_nfilter_request_var('save') == '') {
$data_templates = array_rekey(db_fetch_assoc('SELECT id, name FROM data_template ORDER BY name'), 'id', 'name');
top_header();
form_start('thold_templates.php', 'tholdform');
html_start_box(__('Threshold Template Creation Wizard'), '50%', '', '3', 'center', '');
if (!isset_request_var('data_template_id')) {
set_request_var('data_template_id', '');
}
if (!isset_request_var('data_source_id')) {
set_request_var('data_source_id', '');
}
if (get_filter_request_var('data_template_id') == '') {
print '<tr><td class="center">' . __('Please select a Data Template') . '</td></tr>';
} else {
if (get_filter_request_var('data_source_id') == '') {
print '<tr><td class="center">' . __('Please select a Data Source') . '</td></tr>';
} else {
print '<tr><td class="center">' . __('Please press \'Create\' to create your Threshold Template') . '</td></tr>';
}
}
html_end_box();
html_start_box('', '50%', '', '3', 'center', '');
/* display the data template dropdown */
?>
<tr><td><table class='filterTable' align='center'>
<tr>
<td>
<?php
print __('Data Template');
?>
</td>
<td>
<select id='data_template_id' name='data_template_id' onChange='applyFilter("dt")'>
<option value=''>None</option><?php
foreach ($data_templates as $id => $name) {
echo "<option value='" . $id . "'" . ($id == get_request_var('data_template_id') ? ' selected' : '') . '>' . htmlspecialchars($name, ENT_QUOTES) . '</option>';
}
?>
</select>
</td>
</tr><?php
if (get_request_var('data_template_id') != '') {
$data_template_id = get_request_var('data_template_id');
$data_fields = array();
$temp = db_fetch_assoc_prepared('SELECT id, local_data_template_rrd_id,
data_source_name, data_input_field_id
FROM data_template_rrd
WHERE local_data_template_rrd_id = 0
AND data_template_id = ?', array($data_template_id));
foreach ($temp as $d) {
if ($d['data_input_field_id'] != 0) {
$temp2 = db_fetch_assoc_prepared('SELECT name, data_name FROM data_input_fields WHERE id = ?', array($d['data_input_field_id']));
$data_fields[$d['id']] = $temp2[0]['data_name'] . ' (' . $temp2[0]['name'] . ')';
} else {
$temp2[0]['name'] = $d['data_source_name'];
$data_fields[$d['id']] = $temp2[0]['name'];
}
}
/* display the data source dropdown */
?>
<tr>
<td>
<?php
print __('Data Source');
?>
</td>
<td>
<select id='data_source_id' name='data_source_id' onChange='applyFilter("ds")'>
<option value=''><?php
print __('None');
?>
</option><?php
foreach ($data_fields as $id => $name) {
echo "<option value='" . $id . "'" . ($id == get_request_var('data_source_id') ? ' selected' : '') . '>' . htmlspecialchars($name, ENT_QUOTES) . '</option>';
}
?>
</select>
</td>
</tr>
<?php
} else {
echo "<tr><td><input type='hidden' id='data_source_id' value=''></td></tr>\n";
}
if (get_request_var('data_source_id') != '') {
echo "<tr><td colspan='2'><input type='hidden' name='action' value='add'><input id='save' type='hidden' name='save' value='save'><br><center><input id='go' type='button' value='" . __('Create') . "'></center></td></tr>";
} else {
echo "<tr><td colspan=2><input type=hidden name=action value='add'><br><br><br></td></tr>";
}
echo "</table></td></tr>\n";
html_end_box();
form_end();
?>
<script type='text/javascript'>
function applyFilter(type) {
if (type == 'dt' && $('#data_source_id')) {
$('#data_source_id').val('');
}
//.........这里部分代码省略.........
示例12: mactrack_macw_remove
function mactrack_macw_remove()
{
global $config;
/* ================= input validation ================= */
get_filter_request_var('mac_id');
/* ==================================================== */
if (read_config_option('remove_verification') == 'on' && !isset_request_var('confirm')) {
top_header();
form_confirm(__('Are You Sure?'), __('Are you sure you want to delete the watched Mac Address %s?', db_fetch_cell_prepared('SELECT name FROM mac_track_macwatch WHERE mac_id=?', array(get_request_var('mac_id')))), 'mactrack_macwatch.php', 'mactrack_macwatch.php?action=remove&mac_id=' . get_request_var('mac_id'));
bottom_footer();
exit;
}
if (read_config_option('remove_verification') == '' || isset_request_var('confirm')) {
api_mactrack_macw_remove(get_request_var('mac_id'));
}
}
示例13: form_actions
function form_actions()
{
global $graph_actions;
/* ================= input validation ================= */
input_validate_input_regex(get_request_var_post('drp_action'), "^([a-zA-Z0-9_]+)\$");
/* ==================================================== */
/* 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 */
db_execute("DELETE FROM graph_templates WHERE " . array_to_sql_or($selected_items, "id"));
$graph_template_input = db_fetch_assoc("SELECT id FROM graph_template_input WHERE " . array_to_sql_or($selected_items, "graph_template_id"));
if (sizeof($graph_template_input) > 0) {
foreach ($graph_template_input as $item) {
db_execute("DELETE FROM graph_template_input_defs WHERE graph_template_input_id=" . $item["id"]);
}
}
db_execute("DELETE FROM graph_template_input WHERE " . array_to_sql_or($selected_items, "graph_template_id"));
db_execute("DELETE FROM graph_templates_graph WHERE " . array_to_sql_or($selected_items, "graph_template_id") . " AND local_graph_id=0");
db_execute("DELETE FROM graph_templates_item WHERE " . array_to_sql_or($selected_items, "graph_template_id") . " AND local_graph_id=0");
db_execute("DELETE FROM host_template_graph WHERE " . array_to_sql_or($selected_items, "graph_template_id"));
/* "undo" any graph that is currently using this template */
db_execute("UPDATE graph_templates_graph SET local_graph_template_graph_id=0,graph_template_id=0 WHERE " . array_to_sql_or($selected_items, "graph_template_id"));
db_execute("UPDATE graph_templates_item SET local_graph_template_item_id=0,graph_template_id=0 WHERE " . array_to_sql_or($selected_items, "graph_template_id"));
db_execute("UPDATE graph_local SET graph_template_id=0 WHERE " . array_to_sql_or($selected_items, "graph_template_id"));
} elseif ($_POST["drp_action"] == "2") {
/* duplicate */
for ($i = 0; $i < count($selected_items); $i++) {
/* ================= input validation ================= */
input_validate_input_number($selected_items[$i]);
/* ==================================================== */
duplicate_graph(0, $selected_items[$i], $_POST["title_format"]);
}
}
header("Location: graph_templates.php");
exit;
}
/* setup some variables */
$graph_list = "";
$i = 0;
/* loop through each of the graphs 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]);
/* ==================================================== */
$graph_list .= "<li>" . htmlspecialchars(db_fetch_cell("SELECT name FROM graph_templates WHERE id=" . $matches[1])) . "<br>";
$graph_array[$i] = $matches[1];
$i++;
}
}
top_header();
html_start_box("<strong>" . $graph_actions[$_POST["drp_action"]] . "</strong>", "60%", "", "3", "center", "");
print "<form action='graph_templates.php' method='post'>\n";
if (isset($graph_array) && sizeof($graph_array)) {
if ($_POST["drp_action"] == "1") {
/* delete */
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following Graph Template(s) will be deleted. Any Graph(s) associated with\n\t\t\t\t\t\tthe Template(s) will become individual Graph(s).</p>\n\t\t\t\t\t\t<p><ul>{$graph_list}</ul></p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Delete Graph Template(s)'>";
} elseif ($_POST["drp_action"] == "2") {
/* duplicate */
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following Graph Template(s) will be duplicated. You can\n\t\t\t\t\t\toptionally change the title format for the new Graph Template(s).</p>\n\t\t\t\t\t\t<p><ul>{$graph_list}</ul></p>\n\t\t\t\t\t\t<p><strong>Title Format:</strong><br>";
form_text_box("title_format", "<template_title> (1)", "", "255", "30", "text");
print "</p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Duplicate Graph Template(s)'>";
}
} else {
print "<tr><td class='even'><p><span class='textError'>ERROR: You must select at least one graph template.</span></p></td></tr>\n";
$save_html = "<input type='button' value='Return' onClick='window.history.back()'>";
}
print "\t<tr>\n\t\t\t<td align='right' class='saveRow'>\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($graph_array) ? serialize($graph_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>\n\t\t";
html_end_box();
bottom_footer();
}
示例14: input_remove
function input_remove()
{
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request('id'));
input_validate_input_number(get_request_var_request('graph_template_id'));
/* ==================================================== */
if (read_config_option('deletion_verification') == 'on' && !isset($_REQUEST['confirm'])) {
top_header();
form_confirm('Are You Sure?', "Are you sure you want to delete the input item <strong>'" . htmlspecialchars(db_fetch_cell_prepared('SELECT name FROM graph_template_input WHERE id = ?', array(get_request_var_request('id'))), ENT_QUOTES) . "'</strong>? NOTE: Deleting this item will NOT affect graphs that use this template.", htmlspecialchars('graph_templates.php?action=template_edit&id=' . $_REQUEST['graph_template_id']), htmlspecialchars('graph_templates_inputs.php?action=input_remove&id=' . $_REQUEST['id'] . '&graph_template_id=' . $_REQUEST['graph_template_id']));
bottom_footer();
exit;
}
if (read_config_option('deletion_verification') == '' || isset($_REQUEST['confirm'])) {
db_execute_prepared('DELETE FROM graph_template_input WHERE id = ?', array(get_request_var_request('id')));
db_execute_prepared('DELETE FROM graph_template_input_defs WHERE graph_template_input_id = ?', array(get_request_var_request('id')));
}
}
示例15: data_query_item_remove
function data_query_item_remove()
{
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request('id'));
input_validate_input_number(get_request_var_request('snmp_query_id'));
/* ==================================================== */
if (read_config_option('deletion_verification') == 'on' && !isset($_REQUEST['confirm'])) {
top_header();
form_confirm('Are You Sure?', "Are you sure you want to delete the Data Query Graph <strong>'" . htmlspecialchars(db_fetch_cell_prepared('SELECT name FROM snmp_query_graph WHERE id = ?', array($_REQUEST['id'])), ENT_QUOTES) . "'</strong>?", htmlspecialchars('data_queries.php?action=edit&id=' . $_REQUEST['snmp_query_id']), htmlspecialchars('data_queries.php?action=item_remove&id=' . $_REQUEST['id'] . '&snmp_query_id=' . $_REQUEST['snmp_query_id']));
bottom_footer();
exit;
}
if (read_config_option('deletion_verification') == '' || isset($_REQUEST['confirm'])) {
db_execute_prepared('DELETE FROM snmp_query_graph WHERE id = ?', array($_REQUEST['id']));
db_execute_prepared('DELETE FROM snmp_query_graph_rrd WHERE snmp_query_graph_id = ?', array($_REQUEST['id']));
db_execute_prepared('DELETE FROM snmp_query_graph_rrd_sv WHERE snmp_query_graph_id = ?', array($_REQUEST['id']));
db_execute_prepared('DELETE FROM snmp_query_graph_sv WHERE snmp_query_graph_id = ?', array($_REQUEST['id']));
}
}