本文整理汇总了PHP中sanitize_search_string函数的典型用法代码示例。如果您正苦于以下问题:PHP sanitize_search_string函数的具体用法?PHP sanitize_search_string怎么用?PHP sanitize_search_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sanitize_search_string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: graphs
function graphs()
{
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request("host_id"));
input_validate_input_number(get_request_var_request("graph_type"));
/* ==================================================== */
/* clean up search string */
if (isset($_REQUEST["filter"])) {
$_REQUEST["filter"] = sanitize_search_string(get_request_var("filter"));
}
/* if the user pushed the 'clear' button */
if (isset($_REQUEST["clear_x"])) {
kill_session_var("sess_graphs_new_filter");
unset($_REQUEST["filter"]);
$changed = true;
} else {
/* if any of the settings changed, reset the page number */
$changed = false;
$changed += check_changed("host_id", "sess_graphs_new_host_id");
$changed += check_changed("graph_type", "sess_graphs_new_graph_type");
$changed += check_changed("filter", "sess_graphs_new_filter");
}
load_current_session_value("host_id", "sess_graphs_new_host_id", db_fetch_cell("select id from host order by description,hostname limit 1"));
load_current_session_value("graph_type", "sess_graphs_new_graph_type", read_config_option("default_graphs_new_dropdown"));
load_current_session_value("filter", "sess_graphs_new_filter", "");
$host = db_fetch_row("select id,description,hostname,host_template_id from host where id=" . $_REQUEST["host_id"]);
$row_limit = read_config_option("num_rows_data_query");
$debug_log = debug_log_return("new_graphs");
$header = " [ " . htmlspecialchars($host["description"]) . " (" . htmlspecialchars($host["hostname"]) . ") " . (!empty($host["host_template_id"]) ? htmlspecialchars(db_fetch_cell("select name from host_template where id=" . $host["host_template_id"])) : '') . " ]";
html_start_box("<strong>New Graphs for</strong> {$header}", "100%", "", "3", "center", "");
form_alternate_row();
print "<td>";
if (!empty($debug_log)) {
debug_log_clear("new_graphs");
if (read_config_option("cacti_popup_messages") == "on") {
?>
<div id='message'>
<?php
print "<table align='center' class='cactiTable' width='100%'><tr><td style='align:center;padding:3px;font-weight:bold;font-size:10pt;text-align:center;'>Graphs Created</td><td style='width:1px;align:right;'><input type='button' value='Clear' onClick='javascript:document.getElementById(\"message\").style.display=\"none\"' style='align=right;'></td></tr></table>";
?>
<?php
print "<table align='left' style='width:100%;'><tr><td><ul style='text-align:left;white-space:nowrap;color:#000000;padding:2px 10px;margin:10px;'>" . $debug_log . "</ul></td></tr></table>";
?>
</div>
<?php
} else {
?>
<table width='100%' class='textArea' align='center'>
<tr class='even'>
<td style="padding: 3px; font-family: monospace;">
<ul style='margin:0px 5px;padding-left:10px'><?php
print $debug_log;
?>
</ul>
</td>
</tr>
</table>
<br><?php
}
}
?>
<script type="text/javascript">
<!--
<?php
if (read_config_option("cacti_popup_messages") == "on") {
?>
var obj = document.getElementById('message');
if (obj) {
if (window.innerHeight) {
height = window.innerHeight;
width = window.innerWidth;
}else{
height = document.body.clientHeight;
width = document.body.clientWidth;
}
obj.style.class = "popupBox";
cw = obj.offsetWidth;
// Adjust for IE6
if (!cw) cw = 150;
ch = obj.offsetHeight;
obj.style.top = '65px';
obj.style.left = ((width/2) - (cw/2) - 88)+'px';
}
<?php
}
?>
function applyGraphsNewFilterChange(objForm) {
strURL = '?graph_type=' + objForm.graph_type.value;
strURL = strURL + '&host_id=' + objForm.host_id.value;
strURL = strURL + '&filter=' + objForm.filter.value;;
document.location = strURL;
}
-->
</script>
<form name="form_graphs_new" action="graphs_new.php">
<table width="100%" class="textHeader" cellpadding="2" align="left">
<tr>
//.........这里部分代码省略.........
示例2: graphs
function graphs()
{
global $item_rows;
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request('host_id'));
input_validate_input_number(get_request_var_request('graph_type'));
input_validate_input_number(get_request_var_request('rows'));
/* ==================================================== */
/* clean up search string */
if (isset($_REQUEST['filter'])) {
$_REQUEST['filter'] = sanitize_search_string(get_request_var_request('filter'));
}
/* if the user pushed the 'clear' button */
if (isset($_REQUEST['clear_x'])) {
kill_session_var('sess_graphs_new_filter');
kill_session_var('sess_default_rows');
unset($_REQUEST['filter']);
unset($_REQUEST['rows']);
$changed = true;
} else {
/* if any of the settings changed, reset the page number */
$changed = false;
$changed += check_changed('host_id', 'sess_graphs_new_host_id');
$changed += check_changed('graph_type', 'sess_graphs_new_graph_type');
$changed += check_changed('filter', 'sess_graphs_new_filter');
$changed += check_changed('rows', 'sess_default_rows');
}
load_current_session_value('host_id', 'sess_graphs_new_host_id', db_fetch_cell('SELECT id FROM host ORDER BY description, hostname LIMIT 1'));
load_current_session_value('graph_type', 'sess_graphs_new_graph_type', read_config_option('default_graphs_new_dropdown'));
load_current_session_value('filter', 'sess_graphs_new_filter', '');
load_current_session_value('rows', 'sess_default_rows', read_config_option('num_rows_table'));
if (!empty($_REQUEST['host_id'])) {
$host = db_fetch_row_prepared('SELECT id, description, hostname, host_template_id FROM host WHERE id = ?', array($_REQUEST['host_id']));
$header = ' [ ' . htmlspecialchars($host['description']) . ' (' . htmlspecialchars($host['hostname']) . ') ' . (!empty($host['host_template_id']) ? htmlspecialchars(db_fetch_cell_prepared('SELECT name FROM host_template WHERE id = ?', array($host['host_template_id']))) : '') . ' ]';
} else {
$host = array();
$header = 'None Host Type';
}
$row_limit = get_request_var_request('rows');
html_start_box("<strong>New Graphs for</strong> {$header}", '100%', '', '3', 'center', '');
form_alternate_row();
print '<td class="even">';
?>
<script type='text/javascript'>
<!--
function applyFilter() {
strURL = '?graph_type=' + $('#graph_type').val();
strURL = strURL + '&host_id=' + $('#host_id').val();
strURL = strURL + '&filter=' + $('#filter').val();;
strURL = strURL + '&rows=' + $('#rows').val();;
document.location = strURL;
}
-->
</script>
<form name='form_graphs_new' action='graphs_new.php'>
<table width='100%' cellpadding='2' cellspacing='0' border='0' align='left'>
<tr>
<?php
print html_host_filter($_REQUEST['host_id']);
?>
<td style='white-space:nowrap;' width='1'>
Graph Types
</td>
<td width='1'>
<select id='graph_type' name='graph_type' onChange='applyFilter()'>
<option value='-2'<?php
if ($_REQUEST['graph_type'] == '-2') {
?>
selected<?php
}
?>
>All</option>
<option value='-1'<?php
if ($_REQUEST['graph_type'] == '-1') {
?>
selected<?php
}
?>
>Graph Template Based</option>
<?php
$snmp_queries = db_fetch_assoc_prepared('SELECT
snmp_query.id,
snmp_query.name,
snmp_query.xml_path
FROM (snmp_query, host_snmp_query)
WHERE host_snmp_query.snmp_query_id = snmp_query.id
AND host_snmp_query.host_id = ?
ORDER BY snmp_query.name', array($host['id']));
if (sizeof($snmp_queries) > 0) {
foreach ($snmp_queries as $query) {
print "<option value='" . $query['id'] . "'";
if ($_REQUEST['graph_type'] == $query['id']) {
print ' selected';
}
print '>' . $query['name'] . "</option>\n";
}
}
?>
//.........这里部分代码省略.........
示例3: include
+-------------------------------------------------------------------------+
| Cacti: The Complete RRDTool-based Graphing Solution |
+-------------------------------------------------------------------------+
| This code is designed, written, and maintained by the Cacti Group. See |
| about.php and/or the AUTHORS file for specific developer information. |
+-------------------------------------------------------------------------+
| http://www.cacti.net/ |
+-------------------------------------------------------------------------+
*/
$no_http_headers = true;
include(dirname(__FILE__) . "/../../include/global.php");
include_once(dirname(__FILE__) . "/../../lib/functions.php");
/* input validation */
if (isset($_REQUEST["q"])) {
$q = strtolower(sanitize_search_string(get_request_var("q")));
} else {
return;
}
$graph_perms = db_fetch_cell("SELECT policy_graphs FROM user_auth WHERE id=" . $_SESSION["sess_user_id"]);
if ($graph_perms == 1) {
$sql = "SELECT
local_graph_id AS id,
title_cache AS name
FROM graph_templates_graph
WHERE local_graph_id > 0
AND local_graph_id NOT IN (SELECT item_id FROM user_auth_perms WHERE user_auth_perms.type=1 AND user_auth_perms.user_id=". $_SESSION["sess_user_id"] . ")
ORDER BY title_cache";
}else{
示例4: template
function template()
{
global $host_actions, $item_rows;
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request('page'));
input_validate_input_number(get_request_var_request('rows'));
/* ==================================================== */
/* clean up has_hosts string */
if (isset($_REQUEST['has_hosts'])) {
$_REQUEST['has_hosts'] = sanitize_search_string(get_request_var_request('has_hosts'));
}
/* clean up search string */
if (isset($_REQUEST['filter'])) {
$_REQUEST['filter'] = sanitize_search_string(get_request_var_request('filter'));
}
/* clean up sort_column */
if (isset($_REQUEST['sort_column'])) {
$_REQUEST['sort_column'] = sanitize_search_string(get_request_var_request('sort_column'));
}
/* clean up sort_direction string */
if (isset($_REQUEST['sort_direction'])) {
$_REQUEST['sort_direction'] = sanitize_search_string(get_request_var_request('sort_direction'));
}
/* if the user pushed the 'clear' button */
if (isset($_REQUEST['clear_x'])) {
kill_session_var('sess_host_template_current_page');
kill_session_var('sess_host_template_hosts');
kill_session_var('sess_host_template_filter');
kill_session_var('sess_default_rows');
kill_session_var('sess_host_template_sort_column');
kill_session_var('sess_host_template_sort_direction');
unset($_REQUEST['page']);
unset($_REQUEST['has_hosts']);
unset($_REQUEST['filter']);
unset($_REQUEST['rows']);
unset($_REQUEST['sort_column']);
unset($_REQUEST['sort_direction']);
} else {
$changed = 0;
$changed += check_changed('has_hosts', 'sess_host_template_has_hosts');
$changed += check_changed('rows', 'sess_default_rows');
$changed += check_changed('filter', 'sess_host_template_filter');
if ($changed) {
$_REQUEST['page'] = 1;
}
}
/* remember these search fields in session vars so we don't have to keep passing them around */
load_current_session_value('page', 'sess_host_template_current_page', '1');
load_current_session_value('has_hosts', 'sess_host_template_has_hosts', 'true');
load_current_session_value('filter', 'sess_host_template_filter', '');
load_current_session_value('sort_column', 'sess_host_template_sort_column', 'name');
load_current_session_value('sort_direction', 'sess_host_template_sort_direction', 'ASC');
load_current_session_value('rows', 'sess_default_rows', read_config_option('num_rows_table'));
display_output_messages();
html_start_box('<strong>Device Templates</strong>', '100%', '', '3', 'center', 'host_templates.php?action=edit');
?>
<tr class='even noprint'>
<td>
<form id="form_host_template" action="host_templates.php">
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<td width="50">
Search
</td>
<td>
<input id='filter' type="text" name="filter" size="25" value="<?php
print htmlspecialchars(get_request_var_request('filter'));
?>
">
</td>
<td style='white-space:nowrap;'>
Device Templates
</td>
<td>
<select id='rows' name="rows" onChange="applyFilter()">
<?php
if (sizeof($item_rows) > 0) {
foreach ($item_rows as $key => $value) {
print "<option value='" . $key . "'";
if (get_request_var_request('rows') == $key) {
print ' selected';
}
print '>' . htmlspecialchars($value) . "</option>\n";
}
}
?>
</select>
</td>
<td>
<input type="checkbox" id='has_hosts' <?php
print $_REQUEST['has_hosts'] == 'true' ? 'checked' : '';
?>
>
</td>
<td>
<label for='has_hosts' style='white-space:nowrap;'>Has Devices</label>
</td>
<td>
<input type="button" id='refresh' value="Go" title="Set/Refresh Filters">
</td>
//.........这里部分代码省略.........
示例5: template
function template()
{
global $ds_actions;
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request("page"));
/* ==================================================== */
/* clean up search string */
if (isset($_REQUEST["filter"])) {
$_REQUEST["filter"] = sanitize_search_string(get_request_var("filter"));
}
/* clean up sort_column string */
if (isset($_REQUEST["sort_column"])) {
$_REQUEST["sort_column"] = sanitize_search_string(get_request_var("sort_column"));
}
/* clean up sort_direction string */
if (isset($_REQUEST["sort_direction"])) {
$_REQUEST["sort_direction"] = sanitize_search_string(get_request_var("sort_direction"));
}
/* if the user pushed the 'clear' button */
if (isset($_REQUEST["clear_x"])) {
kill_session_var("sess_data_template_current_page");
kill_session_var("sess_data_template_filter");
kill_session_var("sess_data_template_sort_column");
kill_session_var("sess_data_template_sort_direction");
unset($_REQUEST["page"]);
unset($_REQUEST["filter"]);
unset($_REQUEST["sort_column"]);
unset($_REQUEST["sort_direction"]);
}
/* remember these search fields in session vars so we don't have to keep passing them around */
load_current_session_value("page", "sess_data_template_current_page", "1");
load_current_session_value("filter", "sess_data_template_filter", "");
load_current_session_value("sort_column", "sess_data_template_sort_column", "name");
load_current_session_value("sort_direction", "sess_data_template_sort_direction", "ASC");
html_start_box("<strong>Data Templates</strong>", "100%", "", "3", "center", "data_templates.php?action=template_edit");
?>
<tr class='even noprint'>
<td>
<form name="form_data_template" action="data_templates.php">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td nowrap style='white-space: nowrap;' width="50">
Search:
</td>
<td width="1">
<input type="text" name="filter" size="40" value="<?php
print htmlspecialchars(get_request_var_request("filter"));
?>
">
</td>
<td nowrap style='white-space: nowrap;'>
<input type="submit" value="Go" title="Set/Refresh Filters">
<input type="submit" name="clear_x" value="Clear" title="Clear Filters">
</td>
</tr>
</table>
<input type='hidden' name='page' value='1'>
</form>
</td>
</tr>
<?php
html_end_box();
/* form the 'where' clause for our main sql query */
$sql_where = "WHERE data_template.id=data_template_data.data_template_id AND data_template_data.local_data_id=0";
$rows_where = "";
if (strlen($_REQUEST['filter'])) {
$sql_where .= " AND (data_template.name like '%%" . get_request_var_request("filter") . "%%')";
$rows_where = "WHERE (data_template.name like '%%" . get_request_var_request("filter") . "%%')";
}
/* print checkbox form for validation */
print "<form name='chk' method='post' action='data_templates.php'>\n";
html_start_box("", "100%", "", "3", "center", "");
$total_rows = db_fetch_cell("SELECT\n\t\tCOUNT(data_template.id)\n\t\tFROM data_template\n\t\t{$rows_where}");
$template_list = db_fetch_assoc("SELECT\n\t\tdata_template.id,\n\t\tdata_template.name,\n\t\tdata_input.name AS data_input_method,\n\t\tdata_template_data.active AS active\n\t\tFROM (data_template,data_template_data)\n\t\tLEFT JOIN data_input\n\t\tON (data_template_data.data_input_id = data_input.id)\n\t\t{$sql_where}\n\t\tGROUP BY data_template.id\n\t\tORDER BY " . get_request_var_request("sort_column") . " " . get_request_var_request("sort_direction") . " LIMIT " . read_config_option("num_rows_device") * (get_request_var_request("page") - 1) . "," . read_config_option("num_rows_device"));
$nav = html_nav_bar("data_templates.php?filter=" . get_request_var_request("filter"), MAX_DISPLAY_PAGES, get_request_var_request("page"), read_config_option("num_rows_device"), $total_rows, 5);
print $nav;
$display_text = array("name" => array("Template Name", "ASC"), "id" => array("ID", "ASC"), "data_input_method" => array("Data Input Method", "ASC"), "active" => array("Status", "ASC"));
html_header_sort_checkbox($display_text, get_request_var_request("sort_column"), get_request_var_request("sort_direction"), false);
if (sizeof($template_list) > 0) {
foreach ($template_list as $template) {
form_alternate_row('line' . $template["id"], true);
form_selectable_cell("<a class='linkEditMain' href='" . htmlspecialchars("data_templates.php?action=template_edit&id=" . $template["id"]) . "'>" . (strlen(get_request_var_request("filter")) ? preg_replace("/(" . preg_quote(get_request_var_request("filter"), "/") . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", htmlspecialchars($template["name"])) : htmlspecialchars($template["name"])) . "</a>", $template["id"]);
form_selectable_cell($template['id'], $template["id"]);
form_selectable_cell(empty($template["data_input_method"]) ? "<em>None</em>" : htmlspecialchars($template["data_input_method"]), $template["id"]);
form_selectable_cell($template["active"] == "on" ? "Active" : "Disabled", $template["id"]);
form_checkbox_cell($template["name"], $template["id"]);
form_end_row();
}
/* put the nav bar on the bottom as well */
print $nav;
} else {
print "<tr><td><em>No Data Templates</em></td></tr>\n";
}
html_end_box(false);
/* draw the dropdown containing a list of available actions for this form */
draw_actions_dropdown($ds_actions);
print "</form>\n";
}
示例6: syslog_alerts
function syslog_alerts()
{
global $colors, $syslog_actions, $config, $message_types, $severities;
include dirname(__FILE__) . "/config.php";
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request("id"));
input_validate_input_number(get_request_var_request("page"));
input_validate_input_number(get_request_var_request("enabled"));
input_validate_input_number(get_request_var_request("rows"));
/* ==================================================== */
/* clean up filter */
if (isset($_REQUEST["filter"])) {
$_REQUEST["filter"] = sanitize_search_string(get_request_var("filter"));
}
/* clean up sort_column */
if (isset($_REQUEST["sort_column"])) {
$_REQUEST["sort_column"] = sanitize_search_string(get_request_var("sort_column"));
}
/* clean up sort direction */
if (isset($_REQUEST["sort_direction"])) {
$_REQUEST["sort_direction"] = sanitize_search_string(get_request_var("sort_direction"));
}
/* if the user pushed the 'clear' button */
if (isset($_REQUEST["clear"])) {
kill_session_var("sess_syslog_alerts_page");
kill_session_var("sess_syslog_alerts_rows");
kill_session_var("sess_syslog_alerts_filter");
kill_session_var("sess_syslog_alerts_enabled");
kill_session_var("sess_syslog_alerts_sort_column");
kill_session_var("sess_syslog_alerts_sort_direction");
$_REQUEST["page"] = 1;
unset($_REQUEST["filter"]);
unset($_REQUEST["enabled"]);
unset($_REQUEST["rows"]);
unset($_REQUEST["sort_column"]);
unset($_REQUEST["sort_direction"]);
} else {
/* if any of the settings changed, reset the page number */
$changed = 0;
$changed += syslog_check_changed("filter", "sess_syslog_alerts_filter");
$changed += syslog_check_changed("enabled", "sess_syslog_alerts_enabled");
$changed += syslog_check_changed("rows", "sess_syslog_alerts_rows");
$changed += syslog_check_changed("sort_column", "sess_syslog_alerts_sort_column");
$changed += syslog_check_changed("sort_direction", "sess_syslog_alerts_sort_direction");
if ($changed) {
$_REQUEST["page"] = "1";
}
}
/* remember these search fields in session vars so we don't have to keep passing them around */
load_current_session_value("page", "sess_syslog_alerts_paage", "1");
load_current_session_value("rows", "sess_syslog_alerts_rows", "-1");
load_current_session_value("enabled", "sess_syslog_alerts_enabled", "-1");
load_current_session_value("filter", "sess_syslog_alerts_filter", "");
load_current_session_value("sort_column", "sess_syslog_alerts_sort_column", "name");
load_current_session_value("sort_direction", "sess_syslog_alerts_sort_direction", "ASC");
html_start_box("<strong>Syslog Alert Filters</strong>", "100%", $colors["header"], "3", "center", "syslog_alerts.php?action=edit");
syslog_filter();
html_end_box();
html_start_box("", "100%", $colors["header"], "3", "center", "");
$sql_where = "";
if ($_REQUEST["rows"] == "-1") {
$row_limit = read_config_option("num_rows_syslog");
} elseif ($_REQUEST["rows"] == -2) {
$row_limit = 999999;
} else {
$row_limit = $_REQUEST["rows"];
}
$alerts = syslog_get_alert_records($sql_where, $row_limit);
$rows_query_string = "SELECT COUNT(*)\n\t\tFROM `" . $syslogdb_default . "`.`syslog_alert`\n\t\t{$sql_where}";
$total_rows = syslog_db_fetch_cell($rows_query_string);
?>
<script type="text/javascript">
<!--
function applyChange(objForm) {
strURL = '?enabled=' + objForm.enabled.value;
strURL = strURL + '&filter=' + objForm.filter.value;
strURL = strURL + '&rows=' + objForm.rows.value;
document.location = strURL;
}
-->
</script>
<?php
/* generate page list */
$url_page_select = get_page_list($_REQUEST["page"], MAX_DISPLAY_PAGES, $row_limit, $total_rows, "syslog_alerts.php?filter=" . $_REQUEST["filter"]);
if ($total_rows > 0) {
$nav = "<tr bgcolor='#" . $colors["header"] . "'>\n\t\t\t\t\t<td colspan='13'>\n\t\t\t\t\t\t<table width='100%' cellspacing='0' cellpadding='0' border='0'>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td align='left' class='textHeaderDark'>\n\t\t\t\t\t\t\t\t\t<strong><< ";
if ($_REQUEST["page"] > 1) {
$nav .= "<a class='linkOverDark' href='syslog_alerts.php?report=arp&page=" . ($_REQUEST["page"] - 1) . "'>";
}
$nav .= "Previous";
if ($_REQUEST["page"] > 1) {
$nav .= "</a>";
}
$nav .= "</strong>\n\t\t\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t\t\t<td align='center' class='textHeaderDark'>\n\t\t\t\t\t\t\t\t\tShowing Rows " . ($total_rows == 0 ? "None" : $row_limit * ($_REQUEST["page"] - 1) + 1 . " to " . ($total_rows < $row_limit || $total_rows < $row_limit * $_REQUEST["page"] ? $total_rows : $row_limit * $_REQUEST["page"]) . " of {$total_rows} [{$url_page_select}]") . "\n\t\t\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t\t\t<td align='right' class='textHeaderDark'>\n\t\t\t\t\t\t\t\t\t<strong>";
if ($_REQUEST["page"] * $row_limit < $total_rows) {
$nav .= "<a class='linkOverDark' href='syslog_alerts.php?report=arp&page=" . ($_REQUEST["page"] + 1) . "'>";
}
$nav .= "Next";
if ($_REQUEST["page"] * $row_limit < $total_rows) {
$nav .= "</a>";
//.........这里部分代码省略.........
示例7: snmpagent_utilities_run_eventlog
function snmpagent_utilities_run_eventlog()
{
global $item_rows;
define("MAX_DISPLAY_PAGES", 21);
$severity_levels = array(SNMPAGENT_EVENT_SEVERITY_LOW => 'LOW', SNMPAGENT_EVENT_SEVERITY_MEDIUM => 'MEDIUM', SNMPAGENT_EVENT_SEVERITY_HIGH => 'HIGH', SNMPAGENT_EVENT_SEVERITY_CRITICAL => 'CRITICAL');
$severity_colors = array(SNMPAGENT_EVENT_SEVERITY_LOW => '#00FF00', SNMPAGENT_EVENT_SEVERITY_MEDIUM => '#FFFF00', SNMPAGENT_EVENT_SEVERITY_HIGH => '#FF0000', SNMPAGENT_EVENT_SEVERITY_CRITICAL => '#FF00FF');
$receivers = db_fetch_assoc("SELECT DISTINCT manager_id, hostname FROM snmpagent_notifications_log INNER JOIN snmpagent_managers ON snmpagent_managers.id = snmpagent_notifications_log.manager_id");
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request("receiver"));
if (!in_array(get_request_var_request("severity"), array_keys($severity_levels)) && get_request_var_request("severity") != '-1' && get_request_var_request("severity") != "") {
die_html_input_error();
}
input_validate_input_number(get_request_var_request("page"));
input_validate_input_number(get_request_var_request("rows"));
/* ==================================================== */
/* clean up search filter */
if (isset($_REQUEST["filter"])) {
$_REQUEST["filter"] = sanitize_search_string(get_request_var("filter"));
}
if (isset($_REQUEST["purge_x"])) {
db_execute("TRUNCATE table snmpagent_notifications_log;");
/* reset filters */
$_REQUEST["clear_x"] = true;
}
/* if the user pushed the 'clear' button */
if (isset($_REQUEST["clear_x"])) {
kill_session_var("sess_snmpagent__logs_receiver");
kill_session_var("sess_snmpagent__logs_severity");
kill_session_var("sess_snmpagent__logs_current_page");
kill_session_var("sess_snmpagent__logs_filter");
kill_session_var("sess_default_rows");
unset($_REQUEST["receiver"]);
unset($_REQUEST["severity"]);
unset($_REQUEST["page"]);
unset($_REQUEST["filter"]);
unset($_REQUEST["rows"]);
}
/* reset the current page if the user changed the severity */
if (isset($_SESSION["sess_snmpagent__logs_severity"]) && get_request_var_request("severity") != $_SESSION["sess_snmpagent__logs_severity"]) {
kill_session_var("sess_snmpagent__logs_current_page");
unset($_REQUEST["page"]);
}
/* remember these search fields in session vars so we don't have to keep passing them around */
load_current_session_value("receiver", "sess_snmpagent__logs_receiver", "-1");
load_current_session_value("page", "sess_snmpagent__logs_current_page", "1");
load_current_session_value("severity", "sess_snmpagent__logs_severity", "-1");
load_current_session_value("filter", "sess_snmpagent__logs_filter", "");
load_current_session_value('rows', 'sess_default_rows', read_config_option('num_rows_table'));
/* if the number of rows is -1, set it to the default */
if ($_REQUEST["rows"] == -1) {
$_REQUEST["rows"] = read_config_option("num_rows_table");
}
$_REQUEST['page_referrer'] = 'view_snmpagent_events';
load_current_session_value('page_referrer', 'page_referrer', 'view_snmpagent_events');
?>
<script type="text/javascript">
<!--
function applyFilter() {
strURL = 'utilities.php?action=view_snmpagent_events';
strURL = strURL + '&severity=' + $('#severity').val();
strURL = strURL + '&receiver=' + $('#receiver').val();
strURL = strURL + '&rows=' + $('#rows').val();
strURL = strURL + '&filter=' + $('#filter').val();
strURL = strURL + '&page=' + $('#page').val();
strURL = strURL + '&header=false';
$.get(strURL, function(data) {
$('#main').html(data);
applySkin();
});
}
function clearFilter() {
strURL = 'utilities.php?action=view_snmpagent_events&clear_x=1&header=false';
$.get(strURL, function(data) {
$('#main').html(data);
applySkin();
});
}
$(function(data) {
$('#refresh').click(function() {
applyFilter();
});
$('#clear').click(function() {
clearFilter();
});
$('#form_snmpagent_notifications').submit(function(event) {
event.preventDefault();
applyFilter();
});
});
-->
</script>
<?php
html_start_box("<strong>SNMPAgent Notification Log</strong>", "100%", "", "3", "center", "");
//.........这里部分代码省略.........
示例8: ds
function ds()
{
global $ds_actions, $item_rows;
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request("ds_rows"));
input_validate_input_number(get_request_var_request("host_id"));
input_validate_input_number(get_request_var_request("template_id"));
input_validate_input_number(get_request_var_request("method_id"));
input_validate_input_number(get_request_var_request("page"));
/* ==================================================== */
/* clean up search string */
if (isset($_REQUEST["filter"])) {
$_REQUEST["filter"] = sanitize_search_string(get_request_var("filter"));
}
/* clean up sort_column string */
if (isset($_REQUEST["sort_column"])) {
$_REQUEST["sort_column"] = sanitize_search_string(get_request_var("sort_column"));
}
/* clean up sort_direction string */
if (isset($_REQUEST["sort_direction"])) {
$_REQUEST["sort_direction"] = sanitize_search_string(get_request_var("sort_direction"));
}
/* if the user pushed the 'clear' button */
if (isset($_REQUEST["clear_x"])) {
kill_session_var("sess_ds_current_page");
kill_session_var("sess_ds_filter");
kill_session_var("sess_ds_sort_column");
kill_session_var("sess_ds_sort_direction");
kill_session_var("sess_ds_rows");
kill_session_var("sess_ds_host_id");
kill_session_var("sess_ds_template_id");
kill_session_var("sess_ds_method_id");
unset($_REQUEST["page"]);
unset($_REQUEST["filter"]);
unset($_REQUEST["sort_column"]);
unset($_REQUEST["sort_direction"]);
unset($_REQUEST["ds_rows"]);
unset($_REQUEST["host_id"]);
unset($_REQUEST["template_id"]);
unset($_REQUEST["method_id"]);
}
/* remember these search fields in session vars so we don't have to keep passing them around */
load_current_session_value("page", "sess_ds_current_page", "1");
load_current_session_value("filter", "sess_ds_filter", "");
load_current_session_value("sort_column", "sess_ds_sort_column", "name_cache");
load_current_session_value("sort_direction", "sess_ds_sort_direction", "ASC");
load_current_session_value("ds_rows", "sess_ds_rows", read_config_option("num_rows_data_source"));
load_current_session_value("host_id", "sess_ds_host_id", "-1");
load_current_session_value("template_id", "sess_ds_template_id", "-1");
load_current_session_value("method_id", "sess_ds_method_id", "-1");
$host = db_fetch_row("select hostname from host where id=" . get_request_var_request("host_id"));
/* if the number of rows is -1, set it to the default */
if (get_request_var_request("ds_rows") == -1) {
$_REQUEST["ds_rows"] = read_config_option("num_rows_data_source");
}
?>
<script type="text/javascript">
<!--
function applyDSFilterChange(objForm) {
strURL = '?host_id=' + objForm.host_id.value;
strURL = strURL + '&filter=' + objForm.filter.value;
strURL = strURL + '&ds_rows=' + objForm.ds_rows.value;
strURL = strURL + '&template_id=' + objForm.template_id.value;
strURL = strURL + '&method_id=' + objForm.method_id.value;
document.location = strURL;
}
-->
</script>
<?php
html_start_box("<strong>Data Sources</strong> [host: " . (empty($host["hostname"]) ? "No Host" : htmlspecialchars($host["hostname"])) . "]", "100%", "", "3", "center", "data_sources.php?action=ds_edit&host_id=" . get_request_var_request("host_id"));
?>
<tr class='even noprint'>
<td>
<form name="form_data_sources" action="data_sources.php">
<table cellpadding="1" cellspacing="0">
<tr>
<td width="50">
Host:
</td>
<td>
<select name="host_id" onChange="applyDSFilterChange(document.form_data_sources)">
<option value="-1"<?php
if (get_request_var_request("host_id") == "-1") {
?>
selected<?php
}
?>
>Any</option>
<option value="0"<?php
if (get_request_var_request("host_id") == "0") {
?>
selected<?php
}
?>
>None</option>
<?php
$hosts = db_fetch_assoc("select id,CONCAT_WS('',description,' (',hostname,')') as name from host order by description,hostname");
if (sizeof($hosts) > 0) {
//.........这里部分代码省略.........
示例9: data_query
function data_query() {
global $colors;
/* clean up sort_column */
if (isset($_REQUEST["sort_column"])) {
$_REQUEST["sort_column"] = sanitize_search_string(get_request_var("sort_column"));
}
/* clean up search string */
if (isset($_REQUEST["sort_direction"])) {
$_REQUEST["sort_direction"] = sanitize_search_string(get_request_var("sort_direction"));
}
/* remember these search fields in session vars so we don't have to keep passing them around */
load_current_session_value("sort_column", "sess_data_queries_sort_column", "name");
load_current_session_value("sort_direction", "sess_data_queries_sort_direction", "ASC");
html_start_box("<strong>Data Queries</strong>", "98%", $colors["header"], "3", "center", "data_queries.php?action=edit");
$display_text = array(
"name" => array("Name", "ASC"),
"data_input_method" => array("Data Input Method", "ASC"));
html_header_sort($display_text, $_REQUEST["sort_column"], $_REQUEST["sort_direction"], 3);
$snmp_queries = db_fetch_assoc("SELECT
snmp_query.id,
snmp_query.name,
data_input.name AS data_input_method
FROM snmp_query INNER JOIN data_input ON (snmp_query.data_input_id = data_input.id)
ORDER BY " . $_REQUEST['sort_column'] . " " . $_REQUEST['sort_direction']);
$i = 0;
if (sizeof($snmp_queries) > 0) {
foreach ($snmp_queries as $snmp_query) {
form_alternate_row_color($colors["alternate"],$colors["light"],$i); $i++;
?>
<td>
<a class="linkEditMain" href="data_queries.php?action=edit&id=<?php print $snmp_query["id"];?>"><?php print $snmp_query["name"];?></a>
</td>
<td>
<?php print $snmp_query["data_input_method"]; ?>
</td>
<td align="right">
<a href="data_queries.php?action=remove&id=<?php print $snmp_query["id"];?>"><img src="images/delete_icon.gif" width="10" height="10" border="0" alt="Delete"></a>
</td>
</tr>
<?php
}
}
html_end_box();
}
示例10: list_rrd
function list_rrd()
{
global $config, $item_rows, $ds_actions, $rra_path, $hash_version_codes;
/* suppress warnings */
error_reporting(0);
/* install the rrdclean error handler */
set_error_handler('rrdclean_error_handler');
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request('page'));
input_validate_input_number(get_request_var_request('age'));
input_validate_input_number(get_request_var_request('rows'));
/* ==================================================== */
/* clean up search string */
if (isset($_REQUEST['filter'])) {
$_REQUEST['filter'] = sanitize_search_string(get_request_var('filter'));
}
/* clean up sort_column string */
if (isset($_REQUEST['sort_column'])) {
$_REQUEST['sort_column'] = sanitize_search_string(get_request_var('sort_column'));
}
/* clean up sort_direction string */
if (isset($_REQUEST['sort_direction'])) {
$_REQUEST['sort_direction'] = sanitize_search_string(get_request_var('sort_direction'));
}
/* if the user pushed the 'clear' button */
if (isset($_REQUEST['clear_x'])) {
kill_session_var('sess_rrdclean_current_page');
kill_session_var('sess_rrdclean_age');
kill_session_var('sess_default_rows');
kill_session_var('sess_rrdclean_filter');
kill_session_var('sess_rrdclean_sort_column');
kill_session_var('sess_rrdclean_sort_direction');
unset($_REQUEST['page']);
unset($_REQUEST['age']);
unset($_REQUEST['rows']);
unset($_REQUEST['filter']);
unset($_REQUEST['sort_column']);
unset($_REQUEST['sort_direction']);
}
/* remember these search fields in session vars so we don't have to keep passing them around */
load_current_session_value('page', 'sess_rrdclean_current_page', '1');
load_current_session_value('age', 'sess_rrdclean_current_age', '1');
load_current_session_value('rows', 'sess_rrdclean_rows', read_config_option('num_rows_table'));
load_current_session_value('filter', 'sess_rrdclean_filter', '');
load_current_session_value('sort_column', 'sess_rrdclean_sort_column', 'name');
load_current_session_value('sort_direction', 'sess_rrdclean_sort_direction', 'ASC');
$width = '100%';
if (isset($hash_version_codes[$config['cacti_version']])) {
if ($hash_version_codes[$config['cacti_version']] > 13) {
$width = '100%';
}
}
html_start_box('<strong>RRD Cleaner</strong>', $width, '', '3', 'center', '');
filter();
html_end_box();
$sql_where = 'WHERE in_cacti=0';
/* form the 'where' clause for our main sql query */
if ($_REQUEST['filter'] != '') {
$sql_where .= " AND (rc.name LIKE '%" . $_REQUEST['filter'] . "%' OR rc.name_cache LIKE '%" . $_REQUEST['filter'] . "%' OR dt.name LIKE '%" . $_REQUEST['filter'] . "%')";
}
$secsback = $_REQUEST['age'];
if ($REQUEST['age'] != 0) {
$sql_where .= " AND last_mod>='" . date("Y-m-d H:i:s", time() - 86400 * 7) . "'";
} else {
$sql_where .= " AND last_mod<='" . date("Y-m-d H:i:s", time() - $secsback) . "'";
}
print "<form action='rrdcleaner.php' method='post'>\n";
html_start_box('', $width, '', '3', 'center', '');
$total_rows = db_fetch_cell("SELECT COUNT(rc.name) \n\t\tFROM data_source_purge_temp AS rc\n\t\tLEFT JOIN data_template AS dt\n\t\tON dt.id = rc.data_template_id\n\t\t{$sql_where}");
$total_size = db_fetch_cell("SELECT ROUND(SUM(size),2) \n\t\tFROM data_source_purge_temp AS rc\n\t\tLEFT JOIN data_template AS dt\n\t\tON dt.id = rc.data_template_id\n\t\t{$sql_where}");
$file_list = db_fetch_assoc("SELECT rc.id, rc.name, rc.last_mod, rc.size, \n\t\trc.name_cache, rc.local_data_id, rc.data_template_id, dt.name AS data_template_name\n\t\tFROM data_source_purge_temp AS rc\n\t\tLEFT JOIN data_template AS dt\n\t\tON dt.id = rc.data_template_id\n\t\t{$sql_where} \n\t\tORDER BY " . $_REQUEST['sort_column'] . ' ' . $_REQUEST['sort_direction'] . '
LIMIT ' . $_REQUEST['rows'] * ($_REQUEST['page'] - 1) . ',' . $_REQUEST['rows']);
$nav = html_nav_bar($config['url_path'] . 'rrdcleaner.php?filter' . get_request_var_request('filter'), MAX_DISPLAY_PAGES, get_request_var_request('page'), get_request_var_request('rows'), $total_rows, 8, 'RRD Files', 'page', 'main');
print $nav;
$display_text = array('name' => array('RRD File Name', 'ASC'), 'name_cache' => array('DS Name', 'ASC'), 'local_data_id' => array('DS ID', 'ASC'), 'data_template_id' => array('Template ID', 'ASC'), 'data_template_name' => array('Template', 'ASC'), 'last_mod' => array('Last Modified', 'DESC'), 'size' => array('Size [KB]', 'DESC'));
html_header_sort_checkbox($display_text, $_REQUEST['sort_column'], $_REQUEST['sort_direction'], false);
if (sizeof($file_list)) {
foreach ($file_list as $file) {
$data_template_name = empty($file['data_template_name']) ? '<em>None</em>' : $file['data_template_name'];
form_alternate_row('line' . $file['id'], true);
form_selectable_cell(($_REQUEST['filter'] != '' ? eregi_replace('(' . preg_quote($_REQUEST['filter']) . ')', "<span class='filteredValue'>\\1</span>", $file['name']) : $file['name']) . '</a>', $file['id']);
form_selectable_cell($file['local_data_id'] != 0 ? "<a class='linkEditMain' href='../../data_sources.php?action=ds_edit&id=" . $file['local_data_id'] . "'>" . ($_REQUEST['filter'] != '' ? eregi_replace('(' . preg_quote($_REQUEST['filter']) . ')', "<span class='filteredValue'>\\1</span>", title_trim(htmlentities($file['name_cache']), read_config_option('max_title_length'))) : title_trim(htmlentities($file['name_cache']), read_config_option('max_title_length'))) . '</a>' : '<i>Deleted</i>', $file['id']);
form_selectable_cell($file['local_data_id'] > 0 ? $file['local_data_id'] : '<i>Deleted</i>', $file['id']);
form_selectable_cell($file['data_template_id'] > 0 ? $file['data_template_id'] : '<i>Deleted</i>', $file['id']);
form_selectable_cell($file['data_template_id'] > 0 ? $_REQUEST['filter'] != '' ? eregi_replace('(' . preg_quote($_REQUEST['filter']) . ')', "<span class='filteredValue'>\\1</span>", $file['data_template_name']) . '</a>' : $file['data_template_name'] : '<i>Deleted</i>', $file['id']);
form_selectable_cell($file['last_mod'], $file['id']);
form_selectable_cell($file['size'], $file['id']);
form_checkbox_cell($file['id'], $file['id']);
form_end_row();
$i++;
}
/* put the nav bar on the bottom as well */
print $nav;
} else {
print "<tr><td><em>No unused RRD Files</em></td></tr>\n";
}
html_end_box(false);
rrdcleaner_legend($total_size);
draw_actions_dropdown($ds_actions);
print "</form>\n";
//.........这里部分代码省略.........
示例11: update_show_current
function update_show_current()
{
global $plugins, $pluginslist, $plugin_architecture, $config, $status_names, $actions, $item_rows;
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request("page"));
input_validate_input_number(get_request_var_request("rows"));
/* ==================================================== */
/* clean up search string */
if (isset($_REQUEST["filter"])) {
$_REQUEST["filter"] = sanitize_search_string(get_request_var("filter"));
}
/* clean up sort_column */
if (isset($_REQUEST["sort_column"])) {
$_REQUEST["sort_column"] = sanitize_search_string(get_request_var("sort_column"));
}
/* clean up search string */
if (isset($_REQUEST["sort_direction"])) {
$_REQUEST["sort_direction"] = sanitize_search_string(get_request_var("sort_direction"));
}
/* if the user pushed the 'clear' button */
if (isset($_REQUEST["clear_x"])) {
kill_session_var("sess_plugins_filter");
kill_session_var("sess_plugins_rows");
kill_session_var("sess_plugins_sort_column");
kill_session_var("sess_plugins_sort_direction");
unset($_REQUEST["page"]);
unset($_REQUEST["rows"]);
unset($_REQUEST["filter"]);
unset($_REQUEST["sort_column"]);
unset($_REQUEST["sort_direction"]);
$_REQUEST["page"] = 1;
}
/* remember these search fields in session vars so we don't have to keep passing them around */
load_current_session_value("filter", "sess_plugins_filter", "");
load_current_session_value("rows", "sess_plugins_rows", "-1");
load_current_session_value("sort_column", "sess_plugins_sort_column", "name");
load_current_session_value("sort_direction", "sess_plugins_sort_direction", "ASC");
load_current_session_value("page", "sess_plugins_current_page", "1");
$table = plugins_load_temp_table();
?>
<script type="text/javascript">
<!--
function applyFilterChange(objForm) {
strURL = '?rows=' + objForm.rows.value;
strURL = strURL + '&filter=' + objForm.filter.value;
document.location = strURL;
}
-->
</script>
<?php
html_start_box("<strong>Plugin Management</strong> (Cacti Version: " . $config["cacti_version"] . (isset($plugin_architecture['version']) ? ", Plugin Architecture Version: " . $plugin_architecture['version'] : "") . ")", "100%", "", "3", "center", "");
?>
<tr class='even noprint'>
<td class="noprint">
<form name="form_plugins" method="get" action="plugins.php">
<table cellpadding="0" cellspacing="0">
<tr class="noprint">
<td nowrap style='white-space: nowrap;' width="50">
Search:
</td>
<td width="1">
<input type="text" name="filter" size="40" value="<?php
print get_request_var_request("filter");
?>
">
</td>
<td nowrap style='white-space: nowrap;' width="50">
Rows:
</td>
<td width="1">
<select name="rows" onChange="applyFilterChange(document.form_plugins)">
<option value="-1"<?php
if (get_request_var_request("rows") == "-1") {
?>
selected<?php
}
?>
>Default</option>
<?php
if (sizeof($item_rows) > 0) {
foreach ($item_rows as $key => $value) {
print "<option value='" . $key . "'";
if (get_request_var_request("rows") == $key) {
print " selected";
}
print ">" . htmlspecialchars($value) . "</option>\n";
}
}
?>
</select>
</td>
<td nowrap style='white-space: nowrap;'>
<input type="submit" value="Go" title="Set/Refresh Filters">
</td>
<td nowrap style='white-space: nowrap;'>
<input type="submit" name="clear_x" value="Clear" title="Clear Filters">
</td>
</tr>
</table>
<input type='hidden' name='page' value='1'>
//.........这里部分代码省略.........
示例12: template
function template() {
global $colors, $host_actions;
/* clean up sort_column */
if (isset($_REQUEST["sort_column"])) {
$_REQUEST["sort_column"] = sanitize_search_string(get_request_var("sort_column"));
}
/* clean up search string */
if (isset($_REQUEST["sort_direction"])) {
$_REQUEST["sort_direction"] = sanitize_search_string(get_request_var("sort_direction"));
}
/* remember these search fields in session vars so we don't have to keep passing them around */
load_current_session_value("sort_column", "sess_host_template_column", "name");
load_current_session_value("sort_direction", "sess_host_template_sort_direction", "ASC");
display_output_messages();
html_start_box("<strong>Host Templates</strong>", "98%", $colors["header"], "3", "center", "host_templates.php?action=edit");
$display_text = array(
"name" => array("Template Title", "ASC"));
html_header_sort_checkbox($display_text, $_REQUEST["sort_column"], $_REQUEST["sort_direction"]);
$host_templates = db_fetch_assoc("SELECT *
FROM host_template
ORDER BY " . $_REQUEST['sort_column'] . " " . $_REQUEST['sort_direction']);
$i = 0;
if (sizeof($host_templates) > 0) {
foreach ($host_templates as $host_template) {
form_alternate_row_color($colors["alternate"],$colors["light"],$i); $i++;
?>
<td>
<a class="linkEditMain" href="host_templates.php?action=edit&id=<?php print $host_template["id"];?>"><?php print $host_template["name"];?></a>
</td>
<td style="<?php print get_checkbox_style();?>" width="1%" align="right">
<input type='checkbox' style='margin: 0px;' name='chk_<?php print $host_template["id"];?>' title="<?php print $host_template["name"];?>">
</td>
</tr>
<?php
}
}else{
print "<tr><td><em>No Host Templates</em></td></tr>\n";
}
html_end_box(false);
/* draw the dropdown containing a list of available actions for this form */
draw_actions_dropdown($host_actions);
print "</form>\n";
}
示例13: data
function data()
{
global $input_types, $di_actions, $item_rows;
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request('page'));
input_validate_input_number(get_request_var_request('rows'));
/* ==================================================== */
/* clean up search string */
if (isset($_REQUEST['filter'])) {
$_REQUEST['filter'] = sanitize_search_string(get_request_var_request('filter'));
}
/* clean up sort_column */
if (isset($_REQUEST['sort_column'])) {
$_REQUEST['sort_column'] = sanitize_search_string(get_request_var_request('sort_column'));
}
/* clean up search string */
if (isset($_REQUEST['sort_direction'])) {
$_REQUEST['sort_direction'] = sanitize_search_string(get_request_var_request('sort_direction'));
}
/* if the user pushed the 'clear' button */
if (isset($_REQUEST['clear_x'])) {
kill_session_var('sess_data_input_filter');
kill_session_var('sess_default_rows');
kill_session_var('sess_data_input_sort_column');
kill_session_var('sess_data_input_sort_direction');
unset($_REQUEST['page']);
unset($_REQUEST['filter']);
unset($_REQUEST['rows']);
unset($_REQUEST['sort_column']);
unset($_REQUEST['sort_direction']);
$_REQUEST['page'] = 1;
}
/* remember these search fields in session vars so we don't have to keep passing them around */
load_current_session_value('filter', 'sess_data_input_filter', '');
load_current_session_value('sort_column', 'sess_data_input_sort_column', 'name');
load_current_session_value('sort_direction', 'sess_data_input_sort_direction', 'ASC');
load_current_session_value('page', 'sess_data_input_current_page', '1');
load_current_session_value('rows', 'sess_default_rows', read_config_option('num_rows_table'));
html_start_box('<strong>Data Input Methods</strong>', '100%', '', '3', 'center', 'data_input.php?action=edit');
?>
<tr class='even noprint'>
<td class="noprint">
<form id="form_data_input" method="get" action="data_input.php">
<table cellpadding="2" cellspacing="0">
<tr class="noprint">
<td width="50">
Search
</td>
<td>
<input id='filter' type="text" name="filter" size="25" value="<?php
print htmlspecialchars(get_request_var_request('filter'));
?>
">
</td>
<td style='white-space:nowrap;'>
Input Methods
</td>
<td>
<select id='rows' name="rows" onChange="applyFilter()">
<?php
if (sizeof($item_rows) > 0) {
foreach ($item_rows as $key => $value) {
print "<option value='" . $key . "'";
if (get_request_var_request('rows') == $key) {
print ' selected';
}
print '>' . htmlspecialchars($value) . "</option>\n";
}
}
?>
</select>
</td>
<td>
<input type="submit" id='refresh' value="Go" title="Set/Refresh Filters">
</td>
<td>
<input type="button" id='clear' name="clear_x" value="Clear" title="Clear Filters">
</td>
</tr>
</table>
<input type='hidden' id='page' name='page' value='<?php
print $_REQUEST['page'];
?>
'>
</form>
<script type='text/javascript'>
function applyFilter() {
strURL = 'data_input.php?filter='+$('#filter').val()+'&rows='+$('#rows').val()+'&page='+$('#page').val()+'&header=false';
$.get(strURL, function(data) {
$('#main').html(data);
applySkin();
});
}
function clearFilter() {
strURL = 'data_input.php?clear_x=1&header=false';
$.get(strURL, function(data) {
$('#main').html(data);
applySkin();
});
//.........这里部分代码省略.........
示例14: template_request_validation
function template_request_validation()
{
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request("page"));
input_validate_input_number(get_request_var_request("rows"));
/* ==================================================== */
/* clean up search string */
if (isset($_REQUEST["filter"])) {
$_REQUEST["filter"] = sanitize_search_string(get_request_var("filter"));
}
/* clean up sort_column */
if (isset($_REQUEST["sort_column"])) {
$_REQUEST["sort_column"] = sanitize_search_string(get_request_var("sort_column"));
}
/* clean up search string */
if (isset($_REQUEST["sort_direction"])) {
$_REQUEST["sort_direction"] = sanitize_search_string(get_request_var("sort_direction"));
}
/* if the user pushed the 'clear' button */
if (isset($_REQUEST["clear"])) {
kill_session_var("sess_tt_current_page");
kill_session_var("sess_tt_filter");
kill_session_var("sess_tt_rows");
kill_session_var("sess_tt_sort_column");
kill_session_var("sess_tt_sort_direction");
unset($_REQUEST["page"]);
unset($_REQUEST["filter"]);
unset($_REQUEST["rows"]);
unset($_REQUEST["sort_column"]);
unset($_REQUEST["sort_direction"]);
} else {
/* if any of the settings changed, reset the page number */
$changed = 0;
$changed += thold_request_check_changed('filter', 'sess_tt_filter');
$changed += thold_request_check_changed('rows', 'sess_tt_rows');
$changed += thold_request_check_changed('sort_column', 'sess_tt_sort_column');
$changed += thold_request_check_changed('sort_direction', 'sess_tt_sort_direction');
if ($changed) {
$_REQUEST['page'] = '1';
}
}
/* remember these search fields in session vars so we don't have to keep passing them around */
load_current_session_value("page", "sess_tt_current_page", "1");
load_current_session_value("filter", "sess_tt_filter", "");
load_current_session_value("rows", "sess_tt_rows", read_config_option("alert_num_rows"));
load_current_session_value("sort_column", "sess_tt_sort_column", "name");
load_current_session_value("sort_direction", "sess_tt_sort_direction", "ASC");
/* if the number of rows is -1, set it to the default */
if ($_REQUEST["rows"] == -1) {
$_REQUEST["rows"] = read_config_option("alert_num_rows");
if ($_REQUEST["rows"] < 2) {
$_REQUEST["rows"] = 30;
}
}
}
示例15: read_graph_config_option
case 'list':
define("ROWS_PER_PAGE", read_graph_config_option("list_graphs_per_page"));
if ((read_config_option("auth_method") != 0) && (empty($current_user["show_list"]))) {
print "<strong><font size='+1' color='FF0000'>YOU DO NOT HAVE RIGHTS FOR LIST VIEW</font></strong>"; exit;
}
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request("host_id"));
input_validate_input_number(get_request_var_request("graph_template_id"));
/* ==================================================== */
/* clean up search string */
if (isset($_REQUEST["filter"])) {
$_REQUEST["filter"] = sanitize_search_string(get_request_var_request("filter"));
}
/* reset the page counter to '1' if a search in initiated */
if (isset($_REQUEST["filter"])) {
$_REQUEST["page"] = "1";
}
load_current_session_value("host_id", "sess_graph_view_list_host", "0");
load_current_session_value("graph_template_id", "sess_graph_view_list_graph_template", "0");
load_current_session_value("filter", "sess_graph_view_list_filter", "");
load_current_session_value("page", "sess_graph_view_list_current_page", "");
/* if the user pushed the 'clear' button */
if (isset($_REQUEST["clear_x"])) {
kill_session_var("sess_graph_view_list_current_page");