本文整理汇总了PHP中inject_form_variables函数的典型用法代码示例。如果您正苦于以下问题:PHP inject_form_variables函数的具体用法?PHP inject_form_variables怎么用?PHP inject_form_variables使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了inject_form_variables函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: inject_form_variables
function inject_form_variables(&$form_array, $arg1 = array(), $arg2 = array(), $arg3 = array(), $arg4 = array()) {
$check_fields = array("value", "array", "friendly_name", "description", "sql", "sql_print", "form_id", "items");
/* loop through each available field */
while (list($field_name, $field_array) = each($form_array)) {
/* loop through each sub-field that we are going to check for variables */
foreach ($check_fields as $field_to_check) {
if (isset($field_array[$field_to_check]) && (is_array($form_array[$field_name][$field_to_check]))) {
/* if the field/sub-field combination is an array, resolve it recursively */
$form_array[$field_name][$field_to_check] = inject_form_variables($form_array[$field_name][$field_to_check], $arg1);
}elseif (isset($field_array[$field_to_check]) && (!is_array($field_array[$field_to_check])) && (ereg("\|(arg[123]):([a-zA-Z0-9_]*)\|", $field_array[$field_to_check], $matches))) {
/* an empty field name in the variable means don't treat this as an array */
if ($matches[2] == "") {
if (is_array(${$matches[1]})) {
/* the existing value is already an array, leave it alone */
$form_array[$field_name][$field_to_check] = ${$matches[1]};
}else{
/* the existing value is probably a single variable */
$form_array[$field_name][$field_to_check] = str_replace($matches[0], ${$matches[1]}, $field_array[$field_to_check]);
}
}else{
/* copy the value down from the array/key specified in the variable */
$form_array[$field_name][$field_to_check] = str_replace($matches[0], ((isset(${$matches[1]}{$matches[2]})) ? ${$matches[1]}{$matches[2]} : ""), $field_array[$field_to_check]);
}
}
}
}
return $form_array;
}
示例2: syslog_action_edit
function syslog_action_edit()
{
global $colors, $message_types, $syslog_freqs, $syslog_times;
include dirname(__FILE__) . "/config.php";
/* ================= input validation ================= */
input_validate_input_number(get_request_var("id"));
input_validate_input_number(get_request_var("type"));
/* ==================================================== */
if (isset($_GET["id"])) {
$report = syslog_db_fetch_row("SELECT *\n\t\t\tFROM `" . $syslogdb_default . "`.`syslog_reports`\n\t\t\tWHERE id=" . $_GET["id"]);
$header_label = "[edit: " . $report["name"] . "]";
} else {
$header_label = "[new]";
$report["name"] = "New Report Record";
}
html_start_box("<strong>Report Edit</strong> {$header_label}", "100%", $colors["header"], "3", "center", "");
$fields_syslog_report_edit = array("spacer0" => array("method" => "spacer", "friendly_name" => "Report Details"), "name" => array("method" => "textbox", "friendly_name" => "Report Name", "description" => "Please describe this Report.", "value" => "|arg1:name|", "max_length" => "250"), "enabled" => array("method" => "drop_array", "friendly_name" => "Enabled?", "description" => "Is this Report Enabled?", "value" => "|arg1:enabled|", "array" => array("on" => "Enabled", "" => "Disabled"), "default" => "on"), "type" => array("method" => "drop_array", "friendly_name" => "String Match Type", "description" => "Define how you would like this string matched.", "value" => "|arg1:type|", "array" => $message_types, "default" => "matchesc"), "message" => array("method" => "textbox", "friendly_name" => "Syslog Message Match String", "description" => "The matching component of the syslog message.", "value" => "|arg1:message|", "default" => "", "max_length" => "255"), "timespan" => array("method" => "drop_array", "friendly_name" => "Report Frequency", "description" => "How often should this Report be sent to the distribution list?", "value" => "|arg1:timespan|", "array" => $syslog_freqs, "default" => "del"), "timepart" => array("method" => "drop_array", "friendly_name" => "Send Time", "description" => "What time of day should this report be sent?", "value" => "|arg1:timepart|", "array" => $syslog_times, "default" => "del"), "message" => array("friendly_name" => "Syslog Message Match String", "description" => "The matching component of the syslog message.", "method" => "textbox", "max_length" => "255", "value" => "|arg1:message|", "default" => ""), "body" => array("friendly_name" => "Report Body Text", "textarea_rows" => "5", "textarea_cols" => "60", "description" => "The information that will be contained in the body of the report.", "method" => "textarea", "class" => "textAreaNotes", "value" => "|arg1:body|", "default" => ""), "email" => array("friendly_name" => "Report e-mail Addresses", "textarea_rows" => "3", "textarea_cols" => "60", "description" => "Comma delimited list of e-mail addresses to send the report to.", "method" => "textarea", "class" => "textAreaNotes", "value" => "|arg1:email|", "default" => ""), "notes" => array("friendly_name" => "Report Notes", "textarea_rows" => "3", "textarea_cols" => "60", "description" => "Space for Notes on the Report", "method" => "textarea", "class" => "textAreaNotes", "value" => "|arg1:notes|", "default" => ""), "id" => array("method" => "hidden_zero", "value" => "|arg1:id|"), "_id" => array("method" => "hidden_zero", "value" => "|arg1:id|"), "save_component_report" => array("method" => "hidden", "value" => "1"));
draw_edit_form(array("config" => array("form_name" => "chk"), "fields" => inject_form_variables($fields_syslog_report_edit, isset($report) ? $report : array())));
html_end_box();
form_save_button("syslog_reports.php", "", "id");
}
示例3: template_edit
function template_edit()
{
global $struct_data_source, $struct_data_source_item, $data_source_types, $fields_data_template_template_edit;
/* ================= input validation ================= */
input_validate_input_number(get_request_var("id"));
input_validate_input_number(get_request_var("view_rrd"));
/* ==================================================== */
if (!empty($_GET["id"])) {
$template_data = db_fetch_row("select * from data_template_data where data_template_id=" . $_GET["id"] . " and local_data_id=0");
$template = db_fetch_row("select * from data_template where id=" . $_GET["id"]);
$header_label = "[edit: " . $template["name"] . "]";
} else {
$header_label = "[new]";
}
html_start_box("<strong>Data Templates</strong> " . htmlspecialchars($header_label), "100%", "", "3", "center", "");
draw_edit_form(array("config" => array(), "fields" => inject_form_variables($fields_data_template_template_edit, isset($template) ? $template : array(), isset($template_data) ? $template_data : array(), $_GET)));
html_end_box();
html_start_box("<strong>Data Source</strong>", "100%", "", "3", "center", "");
/* make sure 'data source path' doesn't show up for a template... we should NEVER template this field */
unset($struct_data_source["data_source_path"]);
$form_array = array();
while (list($field_name, $field_array) = each($struct_data_source)) {
$form_array += array($field_name => $struct_data_source[$field_name]);
if ($field_array["flags"] == "ALWAYSTEMPLATE") {
$form_array[$field_name]["description"] = "<em>This field is always templated.</em>";
} else {
$form_array[$field_name]["description"] = "";
$form_array[$field_name]["sub_checkbox"] = array("name" => "t_" . $field_name, "friendly_name" => "Use Per-Data Source Value (Ignore this Value)", "value" => isset($template_data["t_" . $field_name]) ? $template_data["t_" . $field_name] : "");
}
$form_array[$field_name]["value"] = isset($template_data[$field_name]) ? $template_data[$field_name] : "";
$form_array[$field_name]["form_id"] = isset($template_data) ? $template_data["data_template_id"] : "0";
}
draw_edit_form(array("config" => array("no_form_tag" => true), "fields" => inject_form_variables($form_array, isset($template_data) ? $template_data : array())));
html_end_box();
/* fetch ALL rrd's for this data source */
if (!empty($_GET["id"])) {
$template_data_rrds = db_fetch_assoc("select id,data_source_name from data_template_rrd where data_template_id=" . $_GET["id"] . " and local_data_id=0 order by data_source_name");
}
/* select the first "rrd" of this data source by default */
if (empty($_GET["view_rrd"])) {
$_GET["view_rrd"] = isset($template_data_rrds[0]["id"]) ? $template_data_rrds[0]["id"] : "0";
}
/* get more information about the rrd we chose */
if (!empty($_GET["view_rrd"])) {
$template_rrd = db_fetch_row("select * from data_template_rrd where id=" . $_GET["view_rrd"]);
}
$i = 0;
if (isset($template_data_rrds)) {
if (sizeof($template_data_rrds) > 1) {
/* draw the data source tabs on the top of the page */
print "\t<table class='tabs' width='100%' cellspacing='0' cellpadding='3' align='center'>\n\t\t\t\t<tr>\n";
foreach ($template_data_rrds as $template_data_rrd) {
$i++;
print "\t<td " . ($template_data_rrd["id"] == $_GET["view_rrd"] ? "class='tabSelected tab'" : "class='tabNotSelected tab'") . " width='" . (strlen($template_data_rrd["data_source_name"]) * 9 + 50) . "' align='center'>\n\t\t\t\t\t\t\t<span class='textHeader'><a href='" . htmlspecialchars("data_templates.php?action=template_edit&id=" . $_GET["id"] . "&view_rrd=" . $template_data_rrd["id"]) . "'>{$i}: " . htmlspecialchars($template_data_rrd["data_source_name"]) . "</a> <a href='" . htmlspecialchars("data_templates.php?action=rrd_remove&id=" . $template_data_rrd["id"] . "&data_template_id=" . $_GET["id"]) . "'><img src='images/delete_icon.gif' border='0' alt='Delete'></a></span>\n\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t<td width='1'></td>\n";
}
print "\n\t\t\t\t<td></td>\n\n\t\t\t\t</tr>\n\t\t\t</table>\n";
} elseif (sizeof($template_data_rrds) == 1) {
$_GET["view_rrd"] = $template_data_rrds[0]["id"];
}
}
html_start_box("", "100%", "", "3", "center", "");
print "\t<tr class='cactiTableTitle'>\n\t\t\t<td class='textHeaderDark'>\n\t\t\t\t<strong>Data Source Item</strong> [" . (isset($template_rrd) ? htmlspecialchars($template_rrd["data_source_name"]) : "") . "]\n\t\t\t</td>\n\t\t\t<td class='textHeaderDark' align='right'>\n\t\t\t\t" . (!empty($_GET["id"]) ? "<strong><a class='linkOverDark' href='" . htmlspecialchars("data_templates.php?action=rrd_add&id=" . $_GET["id"]) . "'>New</a> </strong>" : "") . "\n\t\t\t</td>\n\t\t</tr>\n";
/* data input fields list */
if (empty($template_data["data_input_id"]) || db_fetch_cell("select type_id from data_input where id=" . $template_data["data_input_id"]) != "1" && db_fetch_cell("select type_id from data_input where id=" . $template_data["data_input_id"]) != "5") {
unset($struct_data_source_item["data_input_field_id"]);
} else {
$struct_data_source_item["data_input_field_id"]["sql"] = "select id,CONCAT(data_name,' - ',name) as name from data_input_fields where data_input_id=" . $template_data["data_input_id"] . " and input_output='out' and update_rra='on' order by data_name,name";
}
$form_array = array();
while (list($field_name, $field_array) = each($struct_data_source_item)) {
$form_array += array($field_name => $struct_data_source_item[$field_name]);
$form_array[$field_name]["description"] = "";
$form_array[$field_name]["value"] = isset($template_rrd) ? $template_rrd[$field_name] : "";
$form_array[$field_name]["sub_checkbox"] = array("name" => "t_" . $field_name, "friendly_name" => "Use Per-Data Source Value (Ignore this Value)", "value" => isset($template_rrd) ? $template_rrd["t_" . $field_name] : "");
}
draw_edit_form(array("config" => array("no_form_tag" => true), "fields" => $form_array + array("data_template_rrd_id" => array("method" => "hidden", "value" => isset($template_rrd) ? $template_rrd["id"] : "0"))));
html_end_box();
$i = 0;
if (!empty($_GET["id"])) {
/* get each INPUT field for this data input source */
$fields = db_fetch_assoc("select * from data_input_fields where data_input_id=" . $template_data["data_input_id"] . " and input_output='in' order by name");
html_start_box("<strong>Custom Data</strong> [data input: " . htmlspecialchars(db_fetch_cell("select name from data_input where id=" . $template_data["data_input_id"])) . "]", "100%", "", "3", "center", "");
/* loop through each field found */
if (sizeof($fields) > 0) {
foreach ($fields as $field) {
$data_input_data = db_fetch_row("select t_value,value from data_input_data where data_template_data_id=" . $template_data["id"] . " and data_input_field_id=" . $field["id"]);
if (sizeof($data_input_data) > 0) {
$old_value = $data_input_data["value"];
} else {
$old_value = "";
}
form_alternate_row();
?>
<td width="50%">
<strong><?php
print $field["name"];
?>
</strong><br>
<?php
form_checkbox("t_value_" . $field["data_name"], $data_input_data["t_value"], "Use Per-Data Source Value (Ignore this Value)", "", "", $_GET["id"]);
//.........这里部分代码省略.........
示例4: host_edit
function host_edit()
{
global $fields_host_edit, $reindex_types;
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request('id'));
/* ==================================================== */
api_plugin_hook('host_edit_top');
if (!empty($_REQUEST['id'])) {
$host = db_fetch_row_prepared('SELECT * FROM host WHERE id = ?', array($_REQUEST['id']));
$header_label = '[edit: ' . htmlspecialchars($host['description']) . ']';
} else {
$header_label = '[new]';
}
if (!empty($host['id'])) {
?>
<table width='100%' align='center'>
<tr>
<td class='textInfo' colspan='2'>
<?php
print htmlspecialchars($host['description']);
?>
(<?php
print htmlspecialchars($host['hostname']);
?>
)
</td>
<td rowspan='2' class='textInfo' valign='top' align='right'>
<span class='linkMarker'>*</span><a class='hyperLink' href='<?php
print htmlspecialchars('graphs_new.php?host_id=' . $host['id']);
?>
'>Create Graphs for this Device</a><br>
<span class='linkMarker'>*</span><a class='hyperLink' href='<?php
print htmlspecialchars('data_sources.php?host_id=' . $host['id'] . '&ds_rows=30&filter=&template_id=-1&method_id=-1&page=1');
?>
'>Data Source List</a><br>
<span class='linkMarker'>*</span><a class='hyperLink' href='<?php
print htmlspecialchars('graphs.php?host_id=' . $host['id'] . '&graph_rows=30&filter=&template_id=-1&page=1');
?>
'>Graph List</a>
<?php
api_plugin_hook('device_edit_top_links');
?>
</td>
</tr>
<tr>
<td valign='top' class='textHeader'>
<div id='ping_results'>Pinging Device <i style='font-size:12px;' class='fa fa-spin fa-spinner'></i><br><br></div>
</td>
</tr>
</table>
<?php
}
html_start_box("<strong>Device</strong> {$header_label}", '100%', '', '3', 'center', '');
/* preserve the host template id if passed in via a GET variable */
if (!empty($_REQUEST['host_template_id'])) {
$fields_host_edit['host_template_id']['value'] = $_REQUEST['host_template_id'];
}
draw_edit_form(array('config' => array('form_name' => 'chk'), 'fields' => inject_form_variables($fields_host_edit, isset($host) ? $host : array())));
/* we have to hide this button to make a form change in the main form trigger the correct
* submit action */
echo "<div style='display:none;'><input type='submit' value='Default Submit Button'></div>";
html_end_box();
?>
<script type="text/javascript">
<!--
// default snmp information
var snmp_community = $('#snmp_community').val();
var snmp_username = $('#snmp_username').val();
var snmp_password = $('#snmp_password').val();
var snmp_auth_protocol = $('#snmp_auth_protocol').val();
var snmp_priv_passphrase = $('#snmp_priv_passphrase').val();
var snmp_priv_protocol = $('#snmp_priv_protocol').val();
var snmp_context = $('#snmp_context').val();
var snmp_port = $('#snmp_port').val();
var snmp_timeout = $('#snmp_timeout').val();
var max_oids = $('#max_oids').val();
// default ping methods
var ping_method = $('#ping_method').val();
var ping_port = $('#ping_port').val();
var ping_timeout = $('#ping_timeout').val();
var ping_retries = $('#ping_retries').val();
function setPing() {
availability_method = $('#availability_method').val();
ping_method = $('#ping_method').val();
switch(availability_method) {
case '0': // none
$('#row_ping_method').css('display', 'none');
$('#row_ping_port').css('display', 'none');
$('#row_ping_timeout').css('display', 'none');
$('#row_ping_retries').css('display', 'none');
break;
case '2': // snmp
case '5': // snmp sysDesc
case '6': // snmp getNext
$('#row_ping_method').css('display', 'none');
//.........这里部分代码省略.........
示例5: mactrack_site_edit
function mactrack_site_edit()
{
global $fields_mactrack_site_edit;
/* ================= input validation ================= */
get_filter_request_var('site_id');
/* ==================================================== */
display_output_messages();
if (!isempty_request_var('site_id')) {
$site = db_fetch_row('SELECT * FROM mac_track_sites WHERE site_id=' . get_request_var('site_id'));
$header_label = __('MacTrack Site [edit: %s]', $site['site_name']);
} else {
$header_label = __('MacTrack Site [new]');
}
form_start('mactrack_sites.php');
html_start_box($header_label, '100%', '', '3', 'center', '');
draw_edit_form(array('config' => array('no_form_tag' => true), 'fields' => inject_form_variables($fields_mactrack_site_edit, isset($site) ? $site : array())));
html_end_box();
form_save_button('mactrack_sites.php', 'return', 'site_id');
}
示例6: ds_edit
function ds_edit()
{
global $colors, $struct_data_source, $struct_data_source_item, $data_source_types;
/* ================= input validation ================= */
input_validate_input_number(get_request_var("id"));
/* ==================================================== */
$use_data_template = true;
$host_id = 0;
if (!empty($_GET["id"])) {
$data_local = db_fetch_row("select host_id,data_template_id from data_local where id='" . $_GET["id"] . "'");
$data = db_fetch_row("select * from data_template_data where local_data_id='" . $_GET["id"] . "'");
if (isset($data_local["data_template_id"]) && $data_local["data_template_id"] >= 0) {
$data_template = db_fetch_row("select id,name from data_template where id='" . $data_local["data_template_id"] . "'");
$data_template_data = db_fetch_row("select * from data_template_data where data_template_id='" . $data_local["data_template_id"] . "' and local_data_id=0");
} else {
$_SESSION["sess_messages"] = 'Data Source "' . $_GET["id"] . '" does not exist.';
header("Location: data_sources.php");
exit;
}
$header_label = "[edit: " . get_data_source_title($_GET["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($_GET["debug"])) {
if ($_GET["debug"] == "0") {
kill_session_var("ds_debug_mode");
} elseif ($_GET["debug"] == "1") {
$_SESSION["ds_debug_mode"] = true;
}
}
include_once "./include/top_header.php";
if (!empty($_GET["id"])) {
?>
<table width="100%" align="center">
<tr>
<td class="textInfo" colspan="2" valign="top">
<?php
print get_data_source_title($_GET["id"]);
?>
</td>
<td class="textInfo" align="right" valign="top">
<span style="color: #c16921;">*<a href='data_sources.php?action=ds_edit&id=<?php
print isset($_GET["id"]) ? $_GET["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>
</td>
</tr>
</table>
<br>
<?php
}
html_start_box("<strong>Data Template Selection</strong> {$header_label}", "100%", $colors["header"], "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" => "Host", "description" => "Choose the host that this graph belongs to.", "value" => isset($_GET["host_id"]) ? $_GET["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($_GET["host_id"]) ? $_GET["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("select * from data_template_rrd where local_data_id=" . $_GET["id"] . " order by data_source_name");
html_start_box("<strong>Supplemental Data Template Data</strong>", "100%", $colors["header"], "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($_GET["id"]) || isset($_GET["new"])) && empty($data["data_template_id"])) {
html_start_box("<strong>Data Source</strong>", "100%", $colors["header"], "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")) {
$form_array[$field_name]["description"] = "";
}
$form_array[$field_name]["value"] = isset($data[$field_name]) ? $data[$field_name] : "";
$form_array[$field_name]["form_id"] = empty($data["id"]) ? "0" : $data["id"];
if (!($use_data_template == false || !empty($data_template_data["t_" . $field_name]) || $field_array["flags"] == "NOTEMPLATE")) {
$form_array[$field_name]["method"] = "template_" . $form_array[$field_name]["method"];
}
}
draw_edit_form(array("config" => array("no_form_tag" => true), "fields" => inject_form_variables($form_array, isset($data) ? $data : array())));
html_end_box();
/* fetch ALL rrd's for this data source */
if (!empty($_GET["id"])) {
$template_data_rrds = db_fetch_assoc("select id,data_source_name from data_template_rrd where local_data_id=" . $_GET["id"] . " order by data_source_name");
}
/* select the first "rrd" of this data source by default */
if (empty($_GET["view_rrd"])) {
$_GET["view_rrd"] = isset($template_data_rrds[0]["id"]) ? $template_data_rrds[0]["id"] : "0";
}
//.........这里部分代码省略.........
示例7: syslog_action_edit
function syslog_action_edit()
{
global $colors, $message_types, $severities;
include dirname(__FILE__) . "/config.php";
/* ================= input validation ================= */
input_validate_input_number(get_request_var("id"));
input_validate_input_number(get_request_var("type"));
/* ==================================================== */
if (isset($_GET["id"]) && $_GET["action"] == "edit") {
$alert = syslog_db_fetch_row("SELECT *\n\t\t\tFROM `" . $syslogdb_default . "`.`syslog_alert`\n\t\t\tWHERE id=" . $_GET["id"]);
$header_label = "[edit: " . $alert["name"] . "]";
} else {
if (isset($_GET["id"]) && $_GET["action"] == "newedit") {
$syslog_rec = syslog_db_fetch_row("SELECT * FROM `" . $syslogdb_default . "`.`syslog` WHERE seq=" . $_GET["id"] . " AND logtime='" . $_GET["date"] . "'");
$header_label = "[new]";
if (sizeof($syslog_rec)) {
$alert["message"] = $syslog_rec["message"];
}
$alert["name"] = "New Alert Rule";
} else {
$header_label = "[new]";
$alert["name"] = "New Alert Rule";
}
}
$alert_retention = read_config_option("syslog_alert_retention");
if ($alert_retention != '' && $alert_retention > 0 && $alert_retention < 365) {
$repeat_end = $alert_retention * 24 * 60 / 5;
}
$repeatarray = array(0 => 'Not Set', 1 => '5 Minutes', 2 => '10 Minutes', 3 => '15 Minutes', 4 => '20 Minutes', 6 => '30 Minutes', 8 => '45 Minutes', 12 => '1 Hour', 24 => '2 Hours', 36 => '3 Hours', 48 => '4 Hours', 72 => '6 Hours', 96 => '8 Hours', 144 => '12 Hours', 288 => '1 Day', 576 => '2 Days', 2016 => '1 Week', 4032 => '2 Weeks', 8640 => 'Month');
if ($repeat_end) {
foreach ($repeatarray as $i => $value) {
if ($i > $repeat_end) {
unset($repeatarray[$i]);
}
}
}
html_start_box("<strong>Alert Edit</strong> {$header_label}", "100%", $colors["header"], "3", "center", "");
$fields_syslog_alert_edit = array("spacer0" => array("method" => "spacer", "friendly_name" => "Alert Details"), "name" => array("method" => "textbox", "friendly_name" => "Alert Name", "description" => "Please describe this Alert.", "value" => "|arg1:name|", "max_length" => "250", "size" => 80), "severity" => array("method" => "drop_array", "friendly_name" => "Severity", "description" => "What is the Severity Level of this Alert?", "value" => "|arg1:severity|", "array" => $severities, "default" => "1"), "method" => array("method" => "drop_array", "friendly_name" => "Reporting Method", "description" => "Define how to Alert on the syslog messages.", "value" => "|arg1:method|", "array" => array("0" => "Individual", "1" => "Threshold"), "default" => "0"), "num" => array("method" => "textbox", "friendly_name" => "Threshold", "description" => "For the 'Threshold' method, If the number seen is above this value\n\t\tan Alert will be triggered.", "value" => "|arg1:num|", "size" => "4", "max_length" => "10", "default" => "1"), "type" => array("method" => "drop_array", "friendly_name" => "String Match Type", "description" => "Define how you would like this string matched. If using the SQL Expression type you may use any valid SQL expression\n\t\tto generate the alarm. Available fields include 'message', 'facility', 'priority', and 'host'.", "value" => "|arg1:type|", "array" => $message_types, "on_change" => "changeTypes()", "default" => "matchesc"), "message" => array("friendly_name" => "Syslog Message Match String", "description" => "The matching component of the syslog message.", "textarea_rows" => "2", "textarea_cols" => "70", "method" => "textarea", "class" => "textAreaNotes", "value" => "|arg1:message|", "default" => ""), "enabled" => array("method" => "drop_array", "friendly_name" => "Alert Enabled", "description" => "Is this Alert Enabled?", "value" => "|arg1:enabled|", "array" => array("on" => "Enabled", "" => "Disabled"), "default" => "on"), "repeat_alert" => array("friendly_name" => "Re-Alert Cycle", "method" => "drop_array", "array" => $repeatarray, "default" => "0", "description" => "Do not resend this alert again for the same host, until this amount of time has elapsed. For threshold\n\t\tbased alarms, this applies to all hosts.", "value" => "|arg1:repeat_alert|"), "notes" => array("friendly_name" => "Alert Notes", "textarea_rows" => "5", "textarea_cols" => "70", "description" => "Space for Notes on the Alert", "method" => "textarea", "class" => "textAreaNotes", "value" => "|arg1:notes|", "default" => ""), "spacer1" => array("method" => "spacer", "friendly_name" => "Alert Actions"), "open_ticket" => array("method" => "drop_array", "friendly_name" => "Open Ticket", "description" => "Should a Help Desk Ticket be opened for this Alert", "value" => "|arg1:open_ticket|", "array" => array("on" => "Yes", "" => "No"), "default" => ""), "email" => array("method" => "textarea", "friendly_name" => "E-Mails to Notify", "textarea_rows" => "5", "textarea_cols" => "70", "description" => "Please enter a comma delimited list of e-mail addresses to inform. If you\n\t\twish to send out e-mail to a recipient in SMS format, please prefix that recipient's e-mail address\n\t\twith <b>'sms@'</b>. For example, if the recipients SMS address is <b>'2485551212@mycarrier.net'</b>, you would\n\t\tenter it as <b>'sms@2485551212@mycarrier.net'</b> and it will be formatted as an SMS message.", "class" => "textAreaNotes", "value" => "|arg1:email|", "max_length" => "255"), "command" => array("friendly_name" => "Alert Command", "textarea_rows" => "5", "textarea_cols" => "70", "description" => "When an Alert is triggered, run the following command. The following replacement variables\n\t\tare available <b>'<HOSTNAME>'</b>, <b>'<ALERTID>'</b>, <b>'<MESSAGE>'</b>,\n\t\t<b>'<FACILITY>'</b>, <b>'<PRIORITY>'</b>, <b>'<SEVERITY>'</b>. Please\n\t\tnote that <b>'<HOSTNAME>'</b> is only available on individual thresholds.", "method" => "textarea", "class" => "textAreaNotes", "value" => "|arg1:command|", "default" => ""), "id" => array("method" => "hidden_zero", "value" => "|arg1:id|"), "_id" => array("method" => "hidden_zero", "value" => "|arg1:id|"), "save_component_alert" => array("method" => "hidden", "value" => "1"));
echo "<form method='post' autocomplete='off' onsubmit='changeTypes()' action='syslog_alerts.php' name='chk'>";
draw_edit_form(array("config" => array("no_form_tag" => true), "fields" => inject_form_variables($fields_syslog_alert_edit, isset($alert) ? $alert : array())));
html_end_box();
form_save_button("syslog_alerts.php", "", "id");
?>
<script type='text/javascript'>
function changeTypes() {
if (document.getElementById('type').value == 'sql') {
document.getElementById('message').rows = 6;
}else{
document.getElementById('message').rows = 2;
}
}
</script>
<?php
}
示例8: data_query_edit
function data_query_edit() {
global $colors, $fields_data_query_edit, $config;
if (!empty($_GET["id"])) {
$snmp_query = db_fetch_row("select * from snmp_query where id=" . $_GET["id"]);
$header_label = "[edit: " . $snmp_query["name"] . "]";
}else{
$header_label = "[new]";
}
html_start_box("<strong>Data Queries</strong> $header_label", "98%", $colors["header"], "3", "center", "");
draw_edit_form(array(
"config" => array(),
"fields" => inject_form_variables($fields_data_query_edit, (isset($snmp_query) ? $snmp_query : array()))
));
html_end_box();
if (!empty($snmp_query["id"])) {
$xml_filename = str_replace("<path_cacti>", $config["base_path"], $snmp_query["xml_path"]);
if ((file_exists($xml_filename)) && (is_file($xml_filename))) {
$text = "<font color='#0d7c09'><strong>Successfully located XML file</strong></font>";
$xml_file_exists = true;
}else{
$text = "<font color='#ff0000'><strong>Could not locate XML file.</strong></font>";
$xml_file_exists = false;
}
html_start_box("", "98%", "aaaaaa", "3", "center", "");
print "<tr bgcolor='#f5f5f5'><td>$text</td></tr>";
html_end_box();
if ($xml_file_exists == true) {
html_start_box("<strong>Associated Graph Templates</strong>", "98%", $colors["header"], "3", "center", "data_queries.php?action=item_edit&snmp_query_id=" . $snmp_query["id"]);
print " <tr bgcolor='#" . $colors["header_panel"] . "'>
<td><span style='color: white; font-weight: bold;'>Name</span></td>
<td><span style='color: white; font-weight: bold;'>Graph Template Name</span></td>
<td></td>
</tr>";
$snmp_query_graphs = db_fetch_assoc("select
snmp_query_graph.id,
graph_templates.name as graph_template_name,
snmp_query_graph.name
from snmp_query_graph
left join graph_templates on snmp_query_graph.graph_template_id=graph_templates.id
where snmp_query_graph.snmp_query_id=" . $snmp_query["id"] . "
order by snmp_query_graph.name");
$i = 0;
if (sizeof($snmp_query_graphs) > 0) {
foreach ($snmp_query_graphs as $snmp_query_graph) {
form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],$i); $i++;
?>
<td>
<strong><a href="data_queries.php?action=item_edit&id=<?php print $snmp_query_graph["id"];?>&snmp_query_id=<?php print $snmp_query["id"];?>"><?php print $snmp_query_graph["name"];?></a></strong>
</td>
<td>
<?php print $snmp_query_graph["graph_template_name"];?>
</td>
<td align="right">
<a href="data_queries.php?action=item_remove&id=<?php print $snmp_query_graph["id"];?>&snmp_query_id=<?php print $snmp_query["id"];?>"><img src="images/delete_icon.gif" width="10" height="10" border="0" alt="Delete"></a>
</td>
</tr>
<?php
}
}else{
print "<tr><td><em>No Graph Templates Defined.</em></td></tr>";
}
html_end_box();
}
}
form_save_button("data_queries.php");
}
示例9: data_edit
function data_edit()
{
global $fields_data_input_edit;
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request('id'));
/* ==================================================== */
if (!empty($_REQUEST['id'])) {
$data_input = db_fetch_row_prepared('SELECT * FROM data_input WHERE id = ?', array(get_request_var_request('id')));
$header_label = '[edit: ' . htmlspecialchars($data_input['name']) . ']';
} else {
$header_label = '[new]';
}
html_start_box("<strong>Data Input Methods</strong> {$header_label}", '100%', '', '3', 'center', '');
draw_edit_form(array('config' => array(), 'fields' => inject_form_variables($fields_data_input_edit, isset($data_input) ? $data_input : array())));
html_end_box();
if (!empty($_REQUEST['id'])) {
html_start_box('<strong>Input Fields</strong>', '100%', '', '3', 'center', 'data_input.php?action=field_edit&type=in&data_input_id=' . htmlspecialchars(get_request_var_request('id')));
print "<tr class='tableHeader'>";
DrawMatrixHeaderItem('Name', '', 1);
DrawMatrixHeaderItem('Field Order', '', 1);
DrawMatrixHeaderItem('Friendly Name', '', 2);
print '</tr>';
$fields = db_fetch_assoc_prepared("SELECT id, data_name, name, sequence FROM data_input_fields WHERE data_input_id = ? AND input_output = 'in' ORDER BY sequence, data_name", array(get_request_var_request('id')));
$i = 0;
if (sizeof($fields) > 0) {
foreach ($fields as $field) {
form_alternate_row('', true);
?>
<td>
<a class="linkEditMain" href="<?php
print htmlspecialchars('data_input.php?action=field_edit&id=' . $field['id'] . '&data_input_id=' . $_REQUEST['id']);
?>
"><?php
print htmlspecialchars($field['data_name']);
?>
</a>
</td>
<td>
<?php
print $field['sequence'];
if ($field['sequence'] == '0') {
print ' (Not In Use)';
}
?>
</td>
<td>
<?php
print htmlspecialchars($field['name']);
?>
</td>
<td align="right">
<a href="<?php
print htmlspecialchars('data_input.php?action=field_remove&id=' . $field['id'] . '&data_input_id=' . $_REQUEST['id']);
?>
"><img src="images/delete_icon.gif" style="height:10px;width:10px;" border="0" alt="Delete"></a>
</td>
</tr>
<?php
}
} else {
print '<tr><td><em>No Input Fields</em></td></tr>';
}
html_end_box();
html_start_box('<strong>Output Fields</strong>', '100%', '', '3', 'center', 'data_input.php?action=field_edit&type=out&data_input_id=' . $_REQUEST['id']);
print "<tr class='tableHeader'>";
DrawMatrixHeaderItem('Name', '', 1);
DrawMatrixHeaderItem('Field Order', '', 1);
DrawMatrixHeaderItem('Friendly Name', '', 1);
DrawMatrixHeaderItem('Update RRA', '', 2);
print '</tr>';
$fields = db_fetch_assoc_prepared("SELECT id, name, data_name, update_rra, sequence FROM data_input_fields WHERE data_input_id = ? and input_output = 'out' ORDER BY sequence, data_name", array(get_request_var_request('id')));
$i = 0;
if (sizeof($fields) > 0) {
foreach ($fields as $field) {
form_alternate_row('', true);
?>
<td>
<a class="linkEditMain" href="<?php
print htmlspecialchars('data_input.php?action=field_edit&id=' . $field['id'] . '&data_input_id=' . $_REQUEST['id']);
?>
"><?php
print htmlspecialchars($field['data_name']);
?>
</a>
</td>
<td>
<?php
print $field['sequence'];
if ($field['sequence'] == '0') {
print ' (Not In Use)';
}
?>
</td>
<td>
<?php
print htmlspecialchars($field['name']);
?>
</td>
<td>
<?php
//.........这里部分代码省略.........
示例10: graph_template_display_general
function graph_template_display_general($graph_template, $header_label) {
global $colors;
require_once(CACTI_BASE_PATH . "/lib/graph/graph_info.php");
require_once(CACTI_BASE_PATH . "/lib/graph_template/graph_template_info.php");
# fetch all settings for this graph template
if (isset($graph_template["id"])) {
$template_graph = db_fetch_row("select * from graph_templates_graph where graph_template_id=" . $graph_template["id"] . " and local_graph_id=0");
}else {
$template_graph = array();
}
print "<form method='post' action='" . basename($_SERVER["PHP_SELF"]) . "' name='graph_template_edit'>\n";
# the template header
html_start_box("<strong>" . __("Graph Template") . "</strong> $header_label", "100", $colors["header"], "0", "center", "", true);
$header_items = array(__("Field"), __("Value"));
print "<tr><td>";
html_header($header_items, 1, true, 'header_template');
draw_edit_form(array(
"config" => array("no_form_tag" => true),
"fields" => inject_form_variables(graph_template_form_list(), (isset($graph_template) ? $graph_template : array()), (isset($template_graph) ? $template_graph : array()))
));
print "</table></td></tr>"; /* end of html_header */
html_end_box(false);
form_hidden_box("graph_template_id", (isset($template_graph["graph_template_id"]) ? $template_graph["graph_template_id"] : "0"), "");
form_hidden_box("graph_template_graph_id", (isset($template_graph["id"]) ? $template_graph["id"] : "0"), "");
form_hidden_box("save_component_template", 1, "");
# the global graph template fields go here
# html_start_box("<strong>" . __("Graph Template") . "</strong>", "100", $colors["header"], "0", "center", "", true, "table_graph_template");
/* id tags of tables (set via html_start_box) required for initial js on load */
html_start_box("<strong>" . __("Graph Template Labels") . "</strong>", "100", $colors["header"], "0", "center", "", true, "table_graph_template_labels");
draw_template_edit_form('header_graph_labels', graph_labels_form_list(), $template_graph, false);
html_end_box(false);
/* TODO: we should not use rrd version in the code, when going data-driven */
if ( read_config_option("rrdtool_version") != RRD_VERSION_1_0 && read_config_option("rrdtool_version") != RRD_VERSION_1_2) {
html_start_box("<strong>" . __("Graph Template Right Axis Settings") . "</strong>", "100", $colors["header"], "0", "center", "", true, "table_graph_template_right_axis");
draw_template_edit_form('header_graph_right_axis', graph_right_axis_form_list(), $template_graph, false);
}
html_end_box(false);
html_start_box("<strong>" . __("Graph Template Size") . "</strong>", "100", $colors["header"], "0", "center", "", true, "table_graph_template_size");
draw_template_edit_form('header_graph_size', graph_size_form_list(), $template_graph, false);
html_end_box(false);
html_start_box("<strong>" . __("Graph Template Limits") . "</strong>", "100", $colors["header"], "0", "center", "", true, "table_graph_template_limits");
draw_template_edit_form('header_graph_limits', graph_limits_form_list(), $template_graph, false);
html_end_box(false);
html_start_box("<strong>" . __("Graph Template Grid") . "</strong>", "100", $colors["header"], "0", "center", "", true, "table_graph_template_grid");
draw_template_edit_form('header_graph_grid', graph_grid_form_list(), $template_graph, false);
html_end_box(false);
html_start_box("<strong>" . __("Graph Template Color") . "</strong>", "100", $colors["header"], "0", "center", "", true, "table_graph_template_color");
draw_template_edit_form('header_graph_color', graph_color_form_list(), $template_graph, false);
html_end_box(false);
html_start_box("<strong>" . __("Graph Template Legend") . "</strong>", "100", $colors["header"], "0", "center", "", true, "table_graph_template_legend");
draw_template_edit_form('header_graph_legend', graph_legend_form_list(), $template_graph, false);
html_end_box(false);
html_start_box("<strong>" . __("Graph Template Misc") . "</strong>", "100", $colors["header"], "0", "center", "", true, "table_graph_template_misc");
draw_template_edit_form('header_graph_misc', graph_misc_form_list(), $template_graph, false);
html_end_box(false);
html_start_box("<strong>" . __("Graph Template Cacti Specifics") . "</strong>", "100", $colors["header"], "0", "center", "", true, "table_graph_template_cacti");
draw_template_edit_form('header_graph_cacti', graph_cacti_form_list(), $template_graph, false);
html_end_box(false);
# the id tag is required for our js code!
form_hidden_box("hidden_rrdtool_version", read_config_option("rrdtool_version"), "");
# html_end_box(false);
form_save_button_alt("url!graph_templates.php");
include_once(CACTI_BASE_PATH . "/access/js/colorpicker.js");
include_once(CACTI_BASE_PATH . "/access/js/graph_template_options.js");
}
示例11: mactrack_snmp_edit
function mactrack_snmp_edit()
{
global $config, $fields_mactrack_snmp_edit;
include_once $config['base_path'] . '/plugins/mactrack/lib/mactrack_functions.php';
/* ================= input validation ================= */
get_filter_request_var('id');
get_filter_request_var('page');
/* ==================================================== */
/* clean up rule name */
if (isset_request_var('name')) {
set_request_var('name', sanitize_search_string(get_request_var('name')));
}
/* remember these search fields in session vars so we don't have to keep passing them around */
load_current_session_value('page', 'sess_mactrack_edit_current_page', '1');
load_current_session_value('rows', 'sess_default_rows', read_config_option('num_rows_table'));
/* display the mactrack snmp option set */
$snmp_group = array();
if (!isempty_request_var('id')) {
$snmp_group = db_fetch_row_prepared('SELECT * FROM mac_track_snmp where id = ?', array(get_request_var('id')));
$header_label = __('SNMP Option Set [edit: %s]', $snmp_group['name']);
} else {
$header_label = __('SNMP Option Set [new]');
}
form_start('mactrack_snmp.php', 'mactrack_snmp_group');
html_start_box($header_label, '100%', '', '3', 'center', '');
draw_edit_form(array('config' => array('no_form_tag' => true), 'fields' => inject_form_variables($fields_mactrack_snmp_edit, $snmp_group)));
html_end_box();
form_hidden_box('id', isset_request_var('id') ? get_request_var('id') : '0', '');
form_hidden_box('save_component_mactrack_snmp', '1', '');
if (!isempty_request_var('id')) {
$items = db_fetch_assoc_prepared('SELECT * FROM mac_track_snmp_items WHERE snmp_id= ? ORDER BY sequence', array(get_request_var('id')));
html_start_box(__('Mactrack SNMP Options'), '100%', '', '3', 'center', 'mactrack_snmp.php?action=item_edit&id=' . get_request_var('id'));
print "<tr class='tableHeader'>";
DrawMatrixHeaderItem(__('Item'), '', 1);
DrawMatrixHeaderItem(__('Version'), '', 1);
DrawMatrixHeaderItem(__('Community'), '', 1);
DrawMatrixHeaderItem(__('Port'), '', 1);
DrawMatrixHeaderItem(__('Timeout'), '', 1);
DrawMatrixHeaderItem(__('Retries'), '', 1);
DrawMatrixHeaderItem(__('Max OIDs'), '', 1);
DrawMatrixHeaderItem(__('Username'), '', 1);
DrawMatrixHeaderItem(__('Auth Proto'), '', 1);
DrawMatrixHeaderItem(__('Priv Proto'), '', 1);
DrawMatrixHeaderItem(__('Actions'), '', 1);
print '</tr>';
$i = 1;
if (sizeof($items)) {
foreach ($items as $item) {
form_alternate_row();
$form_data = '<td><a class="linkEditMain" href="' . htmlspecialchars('mactrack_snmp.php?action=item_edit&item_id=' . $item['id'] . '&id=' . $item['snmp_id']) . '">Item#' . $i . '</a></td>';
$form_data .= '<td>' . $item['snmp_version'] . '</td>';
$form_data .= '<td>' . ($item['snmp_version'] == 3 ? __('N/A') : $item['snmp_readstring']) . '</td>';
$form_data .= '<td>' . $item['snmp_port'] . '</td>';
$form_data .= '<td>' . $item['snmp_timeout'] . '</td>';
$form_data .= '<td>' . $item['snmp_retries'] . '</td>';
$form_data .= '<td>' . $item['max_oids'] . '</td>';
$form_data .= '<td>' . ($item['snmp_version'] == 3 ? $item['snmp_username'] : __('N/A')) . '</td>';
$form_data .= '<td>' . ($item['snmp_version'] == 3 ? $item['snmp_auth_protocol'] : __('N/A')) . '</td>';
$form_data .= '<td>' . ($item['snmp_version'] == 3 ? $item['snmp_priv_protocol'] : __('N/A')) . '</td>';
$form_data .= '<td class="right">' . ($i < sizeof($items) ? '<a class="remover fa fa-caret-down moveArrow" href="' . htmlspecialchars($config['url_path'] . 'plugins/mactrack/mactrack_snmp.php?action=item_movedown&item_id=' . $item["id"] . '&id=' . $item["snmp_id"]) . '"></a>' : '<span class="moveArrowNone"></span>') . ($i > 1 ? '<a class="remover fa fa-caret-up moveArrow" href="' . htmlspecialchars($config['url_path'] . 'plugins/mactrack/mactrack_snmp.php?action=item_moveup&item_id=' . $item["id"] . '&id=' . $item["snmp_id"]) . '"></a>' : '<span class="moveArrowNone"></span>');
$form_data .= '<a class="delete deleteMarker fa fa-remove" href="' . htmlspecialchars($config['url_path'] . 'plugins/mactrack/mactrack_snmp.php?action=item_remove&item_id=' . $item["id"] . '&id=' . $item["snmp_id"]) . '"></a>' . '</td></tr>';
print $form_data;
$i++;
}
} else {
print '<tr><td colspan="5"><em>' . __('No SNMP Items') . '</em></td></tr>';
}
html_end_box();
}
form_save_button('mactrack_snmp.php');
}
示例12: site_edit
function site_edit() {
global $colors;
require_once(CACTI_BASE_PATH . "/lib/site/site_info.php");
/* ================= input validation ================= */
input_validate_input_number(get_request_var("id"));
/* ==================================================== */
display_output_messages();
if (!empty($_GET["id"])) {
$site = db_fetch_row("select * from sites where id=" . get_request_var("id"));
$header_label = "[edit: " . $site["name"] . "]";
}else{
$header_label = "[new]";
}
print "<form method='post' action='" . basename($_SERVER["PHP_SELF"]) . "' name='site_edit'>\n";
html_start_box("<strong>" . __("Site") . "</strong> $header_label", "100", $colors["header"], 0, "center", "");
$header_items = array(__("Field"), __("Value"));
print "<tr><td>";
html_header($header_items, 1, true, 'site_edit');
draw_edit_form(array(
"config" => array("form_name" => "chk", "no_form_tag" => true),
"fields" => inject_form_variables(site_form_list(), (isset($site) ? $site : array()))
));
print "</table></td></tr>"; /* end of html_header */
html_end_box();
form_hidden_box("id", (isset($site["id"]) ? $site["id"] : "0"), "");
form_hidden_box("hidden_id", (isset($site["hidden_id"]) ? $site["hidden_id"] : "0"), "");
form_hidden_box("save_component_site", "1", "");
form_save_button_alt();
}
示例13: rra_edit
function rra_edit()
{
global $fields_rra_edit;
/* ================= input validation ================= */
input_validate_input_number(get_request_var("id"));
/* ==================================================== */
if (!empty($_GET["id"])) {
$rra = db_fetch_row("select * from rra where id=" . $_GET["id"]);
$header_label = "[edit: " . htmlspecialchars($rra["name"]) . "]";
} else {
$header_label = "[new]";
}
html_start_box("<strong>Round Robin Archives</strong> {$header_label}", "100%", "", "3", "center", "");
draw_edit_form(array("config" => array(), "fields" => inject_form_variables($fields_rra_edit, isset($rra) ? $rra : array())));
html_end_box();
form_save_button("rra.php");
}
示例14: edit_devices
function edit_devices()
{
global $device_edit;
/* ================= input validation ================= */
get_filter_request_var('id');
/* ==================================================== */
$device = array();
if (!isempty_request_var('id')) {
$device = db_fetch_row('SELECT * FROM plugin_flowview_devices WHERE id=' . get_request_var('id'), FALSE);
$header_label = '[edit: ' . $device['name'] . ']';
} else {
$header_label = '[new]';
}
form_start('flowview_devices.php', 'chk');
html_start_box("Device: {$header_label}", '100%', '', '3', 'center', '');
draw_edit_form(array('config' => array('no_form_tag' => true), 'fields' => inject_form_variables($device_edit, $device)));
html_end_box();
form_save_button('flowview_devices.php?tab=listeners');
}
示例15: syslog_action_edit
function syslog_action_edit()
{
global $message_types;
include dirname(__FILE__) . '/config.php';
/* ================= input validation ================= */
get_filter_request_var('id');
get_filter_request_var('type');
get_filter_request_var('date');
/* ==================================================== */
if (isset_request_var('id') && get_nfilter_request_var('action') == 'edit') {
$removal = syslog_db_fetch_row('SELECT *
FROM `' . $syslogdb_default . '`.`syslog_remove`
WHERE id=' . get_request_var('id'));
if (sizeof($removal)) {
$header_label = __('Removal Rule Edit [edit: %s]', $removal['name']);
} else {
$header_label = __('Removal Rule Edit [new]');
$removal['name'] = __('New Removal Record');
}
} else {
if (isset_request_var('id') && get_nfilter_request_var('action') == 'newedit') {
$syslog_rec = syslog_db_fetch_row('SELECT * FROM `' . $syslogdb_default . '`.`syslog` WHERE seq=' . get_request_var('id') . (isset_request_var('date') ? " AND logtime='" . get_request_var('date') . "'" : ""));
$header_label = __('Removal Rule Edit [new]');
if (sizeof($syslog_rec)) {
$removal['message'] = $syslog_rec['message'];
}
$removal['name'] = __('New Removal Rule');
} else {
$header_label = '[new]';
$removal['name'] = __('New Removal Record');
}
}
$fields_syslog_removal_edit = array('spacer0' => array('method' => 'spacer', 'friendly_name' => __('Removel Rule Details')), 'name' => array('method' => 'textbox', 'friendly_name' => __('Removal Rule Name'), 'description' => __('Please describe this Removal Rule.'), 'value' => '|arg1:name|', 'max_length' => '250', 'size' => 80), 'enabled' => array('method' => 'drop_array', 'friendly_name' => __('Enabled?'), 'description' => __('Is this Removal Rule Enabled?'), 'value' => '|arg1:enabled|', 'array' => array('on' => __('Enabled'), '' => __('Disabled')), 'default' => 'on'), 'type' => array('method' => 'drop_array', 'friendly_name' => __('String Match Type'), 'description' => __('Define how you would like this string matched. If using the SQL Expression type you may use any valid SQL expression
to generate the alarm. Available fields include \'message\', \'facility\', \'priority\', and \'host\'.'), 'value' => '|arg1:type|', 'array' => $message_types, 'on_change' => 'changeTypes()', 'default' => 'matchesc'), 'message' => array('friendly_name' => __('Syslog Message Match String'), 'description' => __('Enter the matching component of the syslog message, the facility or host name, or the SQL where clause if using the SQL Expression Match Type.'), 'method' => 'textarea', 'textarea_rows' => '2', 'textarea_cols' => '70', 'class' => 'textAreaNotes', 'value' => '|arg1:message|', 'default' => ''), 'rmethod' => array('method' => 'drop_array', 'friendly_name' => __('Method of Removal'), 'value' => '|arg1:method|', 'array' => array('del' => __('Deletion'), 'trans' => __('Transferal')), 'default' => 'del'), 'notes' => array('friendly_name' => __('Removal Rule Notes'), 'textarea_rows' => '5', 'textarea_cols' => '70', 'description' => __('Space for Notes on the Removal rule'), 'method' => 'textarea', 'class' => 'textAreaNotes', 'value' => '|arg1:notes|', 'default' => ''), 'id' => array('method' => 'hidden_zero', 'value' => '|arg1:id|'), '_id' => array('method' => 'hidden_zero', 'value' => '|arg1:id|'), 'save_component_removal' => array('method' => 'hidden', 'value' => '1'));
form_start('syslog_removal.php', 'syslog_edit');
html_start_box($header_label, '100%', '', '3', 'center', '');
draw_edit_form(array('config' => array('no_form_tag' => true), 'fields' => inject_form_variables($fields_syslog_removal_edit, isset($removal) ? $removal : array())));
html_end_box();
form_save_button('syslog_removal.php', '', 'id');
?>
<script type='text/javascript'>
function changeTypes() {
if ($('#type').val == 'sql') {
$('#message').prop('rows', 5);
}else{
$('#message').prop('rows', 2);
}
}
</script>
<?php
}