本文整理汇总了PHP中kill_session_var函数的典型用法代码示例。如果您正苦于以下问题:PHP kill_session_var函数的具体用法?PHP kill_session_var怎么用?PHP kill_session_var使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了kill_session_var函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: api_device_save
function api_device_save($id, $host_template_id, $description, $hostname, $snmp_community, $snmp_version, $snmp_username, $snmp_password, $snmp_port, $snmp_timeout, $disabled)
{
/* fetch some cache variables */
if (empty($id)) {
$_host_template_id = 0;
} else {
$_host_template_id = db_fetch_cell("select host_template_id from host where id={$id}");
}
$save["id"] = $id;
$save["host_template_id"] = form_input_validate($host_template_id, "host_template_id", "^[0-9]+\$", false, 3);
$save["description"] = form_input_validate($description, "description", "", false, 3);
$save["hostname"] = form_input_validate($hostname, "hostname", "", false, 3);
$save["snmp_community"] = form_input_validate($snmp_community, "snmp_community", "", true, 3);
$save["snmp_version"] = form_input_validate($snmp_version, "snmp_version", "", true, 3);
$save["snmp_username"] = form_input_validate($snmp_username, "snmp_username", "", true, 3);
$save["snmp_password"] = form_input_validate($snmp_password, "snmp_password", "", true, 3);
$save["snmp_port"] = form_input_validate($snmp_port, "snmp_port", "^[0-9]+\$", false, 3);
$save["snmp_timeout"] = form_input_validate($snmp_timeout, "snmp_timeout", "^[0-9]+\$", false, 3);
$save["disabled"] = form_input_validate($disabled, "disabled", "", true, 3);
$host_id = 0;
if (!is_error_message()) {
$host_id = sql_save($save, "host");
if ($host_id) {
raise_message(1);
/* push out relavant fields to data sources using this host */
push_out_host($host_id, 0);
/* the host substitution cache is now stale; purge it */
kill_session_var("sess_host_cache_array");
/* update title cache for graph and data source */
update_data_source_title_cache_from_host($host_id);
update_graph_title_cache_from_host($host_id);
} else {
raise_message(2);
}
/* if the user changes the host template, add each snmp query associated with it */
if ($host_template_id != $_host_template_id && !empty($host_template_id)) {
$snmp_queries = db_fetch_assoc("select snmp_query_id from host_template_snmp_query where host_template_id={$host_template_id}");
if (sizeof($snmp_queries) > 0) {
foreach ($snmp_queries as $snmp_query) {
db_execute("replace into host_snmp_query (host_id,snmp_query_id,reindex_method) values ({$host_id}," . $snmp_query["snmp_query_id"] . "," . DATA_QUERY_AUTOINDEX_BACKWARDS_UPTIME . ")");
/* recache snmp data */
run_data_query($host_id, $snmp_query["snmp_query_id"]);
}
}
$graph_templates = db_fetch_assoc("select graph_template_id from host_template_graph where host_template_id={$host_template_id}");
if (sizeof($graph_templates) > 0) {
foreach ($graph_templates as $graph_template) {
db_execute("replace into host_graph (host_id,graph_template_id) values ({$host_id}," . $graph_template["graph_template_id"] . ")");
}
}
}
}
return $host_id;
}
示例2: form_save
function form_save()
{
global $settings_graphs;
while (list($tab_short_name, $tab_fields) = each($settings_graphs)) {
while (list($field_name, $field_array) = each($tab_fields)) {
if (isset($field_array["items"]) && is_array($field_array["items"])) {
while (list($sub_field_name, $sub_field_array) = each($field_array["items"])) {
db_execute("replace into settings_graphs (user_id,name,value) values (" . $_SESSION["sess_user_id"] . ",'{$sub_field_name}', '" . (isset($_POST[$sub_field_name]) ? $_POST[$sub_field_name] : "") . "')");
}
} else {
db_execute("replace into settings_graphs (user_id,name,value) values (" . $_SESSION["sess_user_id"] . ",'{$field_name}', '" . (isset($_POST[$field_name]) ? $_POST[$field_name] : "") . "')");
}
}
}
/* reset local settings cache so the user sees the new settings */
kill_session_var("sess_graph_config_array");
header("Location: " . $_POST["referer"]);
}
示例3: plugin_monitor_check_config
function plugin_monitor_check_config()
{
global $config;
// Here we will check to ensure everything is configured
monitor_check_upgrade();
include_once $config['library_path'] . '/database.php';
$r = read_config_option('monitor_refresh');
$result = db_fetch_assoc("SELECT * FROM settings WHERE name='monitor_refresh'");
if (!isset($result[0]['name'])) {
$r = NULL;
}
if ($r == '' or $r < 1 or $r > 300) {
if ($r == '') {
$sql = "REPLACE INTO settings VALUES ('monitor_refresh','300')";
} else {
if ($r == NULL) {
$sql = "INSERT INTO settings VALUES ('monitor_refresh','300')";
} else {
$sql = "UPDATE settings SET value = '300' WHERE name = 'monitor_refresh'";
}
}
$result = db_execute($sql);
kill_session_var('sess_config_array');
}
$r = read_config_option('monitor_width');
$result = db_fetch_assoc("SELECT * FROM settings WHERE name='monitor_width'");
if (!isset($result[0]['name'])) {
$r = NULL;
}
if ($r == '' or $r < 1 or $r > 20) {
if ($r == '') {
$sql = "REPLACE INTO settings VALUES ('monitor_width','10')";
} else {
if ($r == NULL) {
$sql = "INSERT INTO settings VALUES ('monitor_width','10')";
} else {
$sql = "UPDATE settings SET value = '10' WHERE name = 'monitor_width'";
}
}
$result = db_execute($sql) or die(mysql_error());
kill_session_var('sess_config_array');
}
return true;
}
示例4: form_save
function form_save() {
global $settings_graphs;
while (list($tab_short_name, $tab_fields) = each($settings_graphs)) {
while (list($field_name, $field_array) = each($tab_fields)) {
if ((isset($field_array["items"])) && (is_array($field_array["items"]))) {
while (list($sub_field_name, $sub_field_array) = each($field_array["items"])) {
db_replace("settings_graphs",array("user_id"=>$_SESSION["sess_user_id"],"name"=>$sub_field_name,"value"=>(isset($_POST[$sub_field_name]) ? $_POST[$sub_field_name] : "")),array("user_id","name"),true);
}
}else{
db_replace("settings_graphs",array("user_id"=>$_SESSION["sess_user_id"],"name"=>$field_name,"value"=>(isset($_POST[$field_name]) ? $_POST[$field_name] : "")),array("user_id","name"),true);
}
}
}
/* reset local settings cache so the user sees the new settings */
kill_session_var("sess_graph_config_array");
header("Location: " . $_POST["referer"]);
}
示例5: save
function save() {
$save = array();
$save["id"] = array("type" => DB_TYPE_INTEGER, "value" => $_SESSION["sess_user_id"]);
$save["current_theme"] = array("type" => DB_TYPE_STRING, "value" => form_input_validate($_POST["current_theme"], "current_theme", "", true, 3));
if (!is_error_message()) {
$user_id = api_user_save($save);
if ($user_id) {
/* user saved */
raise_message(1);
/* reset local settings cache so the user sees the new settings */
kill_session_var("sess_current_theme");
}else{
/* error saving */
raise_message(2);
}
}
header("Location: user_settings.php");
}
示例6: form_save
function form_save()
{
global $settings_graphs, $cnn_id;
while (list($tab_short_name, $tab_fields) = each($settings_graphs)) {
while (list($field_name, $field_array) = each($tab_fields)) {
if (isset($field_array["items"]) && is_array($field_array["items"])) {
while (list($sub_field_name, $sub_field_array) = each($field_array["items"])) {
if (isset($_POST[$sub_field_name])) {
$value = $cnn_id->qstr(get_request_var_post($sub_field_name));
db_execute("REPLACE INTO settings_graphs (user_id,name,value) values (" . $_SESSION["sess_user_id"] . ",'{$sub_field_name}', " . $value . ")");
}
}
} else {
if (isset($_POST[$field_name])) {
$value = $cnn_id->qstr($_POST[$field_name]);
db_execute("REPLACE INTO settings_graphs (user_id,name,value) values (" . $_SESSION["sess_user_id"] . ",'{$field_name}', " . $value . ")");
}
}
}
}
/* reset local settings cache so the user sees the new settings */
kill_session_var("sess_graph_config_array");
header("Location: " . $_SESSION["graph_settings_referer"]);
}
示例7: debug_log_clear
function debug_log_clear($type = "") {
if ($type == "") {
kill_session_var("debug_log");
}else{
if (isset($_SESSION["debug_log"])) {
unset($_SESSION["debug_log"][$type]);
}
}
}
示例8: utilities_view_poller_cache
function utilities_view_poller_cache()
{
global $poller_actions;
define("MAX_DISPLAY_PAGES", 21);
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request("host_id"));
input_validate_input_number(get_request_var_request("page"));
input_validate_input_number(get_request_var_request("poller_action"));
/* ==================================================== */
/* clean up search 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_x"])) {
kill_session_var("sess_poller_current_page");
kill_session_var("sess_poller_host_id");
kill_session_var("sess_poller_poller_action");
kill_session_var("sess_poller_filter");
unset($_REQUEST["page"]);
unset($_REQUEST["filter"]);
unset($_REQUEST["host_id"]);
unset($_REQUEST["poller_action"]);
}
if (!empty($_SESSION["sess_poller_action"]) && !empty($_REQUEST["poller_action"])) {
if ($_SESSION["sess_poller_poller_action"] != $_REQUEST["poller_action"]) {
$_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_poller_current_page", "1");
load_current_session_value("host_id", "sess_poller_host_id", "-1");
load_current_session_value("poller_action", "sess_poller_poller_action", "-1");
load_current_session_value("filter", "sess_poller_filter", "");
load_current_session_value("sort_column", "sess_poller_sort_column", "data_template_data.name_cache");
load_current_session_value("sort_direction", "sess_poller_sort_direction", "ASC");
$_REQUEST['page_referrer'] = 'view_poller_cache';
load_current_session_value('page_referrer', 'page_referrer', 'view_poller_cache');
?>
<script type="text/javascript">
<!--
function applyPItemFilterChange(objForm) {
strURL = '?poller_action=' + objForm.poller_action.value;
strURL = strURL + '&host_id=' + objForm.host_id.value;
strURL = strURL + '&filter=' + objForm.filter.value;
strURL = strURL + '&action=view_poller_cache';
document.location = strURL;
}
-->
</script>
<?php
html_start_box("<strong>Poller Cache Items</strong>", "100%", "", "3", "center", "");
?>
<tr class='even noprint'>
<td>
<form name="form_pollercache" action="utilities.php">
<table cellpadding="0" cellspacing="0">
<tr>
<td nowrap style='white-space: nowrap;' width="50">
Host:
</td>
<td width="1">
<select name="host_id" onChange="applyPItemFilterChange(document.form_pollercache)">
<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,description,hostname from host order by description");
if (sizeof($hosts) > 0) {
foreach ($hosts as $host) {
print "<option value='" . $host["id"] . "'";
if (get_request_var_request("host_id") == $host["id"]) {
print " selected";
}
print ">" . $host["description"] . "</option>\n";
}
}
?>
</select>
//.........这里部分代码省略.........
示例9: import
function import()
{
global $colors, $hash_type_names;
?>
<form method="post" action="templates_import.php" enctype="multipart/form-data">
<?php
if (isset($_SESSION["import_debug_info"]) && is_array($_SESSION["import_debug_info"])) {
html_start_box("<strong>Import Results</strong>", "100%", "aaaaaa", "3", "center", "");
print "<tr bgcolor='#" . $colors["form_alternate1"] . "'><td><p class='textArea'>Cacti has imported the following items:</p>";
while (list($type, $type_array) = each($_SESSION["import_debug_info"])) {
print "<p><strong>" . $hash_type_names[$type] . "</strong></p>";
while (list($index, $vals) = each($type_array)) {
if ($vals["result"] == "success") {
$result_text = "<span style='color: green;'>[success]</span>";
} else {
$result_text = "<span style='color: red;'>[fail]</span>";
}
if ($vals["type"] == "update") {
$type_text = "<span style='color: gray;'>[update]</span>";
} else {
$type_text = "<span style='color: blue;'>[new]</span>";
}
print "<span style='font-family: monospace;'>{$result_text} " . $vals["title"] . " {$type_text}</span><br>\n";
$dep_text = "";
$there_are_dep_errors = false;
if (isset($vals["dep"]) && sizeof($vals["dep"]) > 0) {
while (list($dep_hash, $dep_status) = each($vals["dep"])) {
if ($dep_status == "met") {
$dep_status_text = "<span style='color: navy;'>Found Dependency:</span>";
} else {
$dep_status_text = "<span style='color: red;'>Unmet Dependency:</span>";
$there_are_dep_errors = true;
}
$dep_text .= "<span style='font-family: monospace;'> + {$dep_status_text} " . hash_to_friendly_name($dep_hash, true) . "</span><br>\n";
}
}
/* only print out dependency details if they contain errors; otherwise it would get too long */
if ($there_are_dep_errors == true) {
print $dep_text;
}
}
}
print "</td></tr>";
html_end_box();
kill_session_var("import_debug_info");
}
html_start_box("<strong>Import Templates</strong>", "100%", $colors["header"], "3", "center", "");
form_alternate_row_color($colors["form_alternate1"], $colors["form_alternate2"], 0);
?>
<td width="50%">
<font class="textEditTitle">Import Template from Local File</font><br>
If the XML file containing template data is located on your local machine, select it here.
</td>
<td>
<input type="file" name="import_file">
</td>
</tr>
<?php
form_alternate_row_color($colors["form_alternate1"], $colors["form_alternate2"], 1);
?>
<td width="50%">
<font class="textEditTitle">Import Template from Text</font><br>
If you have the XML file containing template data as text, you can paste it into this box to
import it.
</td>
<td>
<?php
form_text_area("import_text", "", "10\t", "50", "");
?>
</td>
</tr>
<?php
form_alternate_row_color($colors["form_alternate1"], $colors["form_alternate2"], 0);
?>
<td width="50%">
<font class="textEditTitle">Import RRA Settings</font><br>
Choose whether to allow Cacti to import custom RRA settings from imported templates or whether to use the defaults for this installation.
</td>
<td>
<?php
form_radio_button("import_rra", 1, 1, "Use defaults for this installation (Recommended)", 1);
echo "<br />";
form_radio_button("import_rra", 1, 2, "Use custom RRA settings from the template", 1);
?>
</td>
</tr>
<?php
form_hidden_box("save_component_import", "1", "");
html_end_box();
form_save_button("templates_import.php", "save");
}
示例10: item_edit
function item_edit() {
global $colors, $struct_graph_item, $graph_item_types, $consolidation_functions;
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request("id"));
input_validate_input_number(get_request_var_request("local_graph_id"));
input_validate_input_number(get_request_var_request("host_id"));
/* ==================================================== */
/* if the user pushed the 'clear' button */
if (isset($_REQUEST["clear_x"])) {
kill_session_var("sess_ds_host_id");
unset($_REQUEST["host_id"]);
}
/* remember these search fields in session vars so we don't have to keep passing them around */
load_current_session_value("filter", "sess_ds_filter", "");
load_current_session_value("host_id", "sess_ds_host_id", "-1");
$host = db_fetch_row("select hostname from host where id=" . $_REQUEST["host_id"]);
html_start_box("<strong>Data Source by Host</strong> [host: " . (empty($host["hostname"]) ? "No Host" : $host["hostname"]) . "]", "98%", $colors["header"], "3", "center", "");
include("./include/html/inc_graph_items_filter_table.php");
html_end_box();
if ($_REQUEST["host_id"] == "-1") {
$sql_where = "";
}elseif ($_REQUEST["host_id"] == "0") {
$sql_where = " and data_local.host_id=0";
}elseif (!empty($_REQUEST["host_id"])) {
$sql_where = " and data_local.host_id=" . $_REQUEST["host_id"];
}
if (!empty($_REQUEST["id"])) {
$template_item = db_fetch_row("select * from graph_templates_item where id=" . $_REQUEST["id"]);
$host_id = db_fetch_cell("select host_id from graph_local where id=" . $_REQUEST["local_graph_id"]);
}
$header_label = "[edit graph: " . db_fetch_cell("select title_cache from graph_templates_graph where local_graph_id=" . $_REQUEST["local_graph_id"]) . "]";
html_start_box("<strong>Graph Items</strong> $header_label", "98%", $colors["header"], "3", "center", "");
/* by default, select the LAST DS chosen to make everyone's lives easier */
if (!empty($_REQUEST["local_graph_id"])) {
$default = db_fetch_row("select task_item_id from graph_templates_item where local_graph_id=" . $_REQUEST["local_graph_id"] . " order by sequence DESC");
if (sizeof($default) > 0) {
$struct_graph_item["task_item_id"]["default"] = $default["task_item_id"];
}else{
$struct_graph_item["task_item_id"]["default"] = 0;
}
/* modifications to the default graph items array */
$struct_graph_item["task_item_id"]["sql"] = "select
CONCAT_WS('',data_template_data.name_cache,' (',data_template_rrd.data_source_name,')') as name,
data_template_rrd.id
from data_template_data,data_template_rrd,data_local
left join host on data_local.host_id=host.id
where data_template_rrd.local_data_id=data_local.id
and data_template_data.local_data_id=data_local.id
" . (((!empty($host_id)) || (!empty($_REQUEST["host_id"]))) ? (!empty($host_id) ? " and data_local.host_id=$host_id" : " and data_local.host_id=" . $_REQUEST["host_id"]) : "") . "
order by name";
}
$form_array = array();
while (list($field_name, $field_array) = each($struct_graph_item)) {
$form_array += array($field_name => $struct_graph_item[$field_name]);
$form_array[$field_name]["value"] = (isset($template_item) ? $template_item[$field_name] : "");
$form_array[$field_name]["form_id"] = (isset($template_item) ? $template_item["id"] : "0");
}
draw_edit_form(
array(
"config" => array(
),
"fields" => $form_array
)
);
form_hidden_box("local_graph_id", $_REQUEST["local_graph_id"], "0");
form_hidden_box("graph_template_item_id", (isset($template_item) ? $template_item["id"] : "0"), "");
form_hidden_box("local_graph_template_item_id", (isset($template_item) ? $template_item["local_graph_template_item_id"] : "0"), "");
form_hidden_box("graph_template_id", (isset($template_item) ? $template_item["graph_template_id"] : "0"), "");
form_hidden_box("sequence", (isset($template_item) ? $template_item["sequence"] : "0"), "");
form_hidden_box("_graph_type_id", (isset($template_item) ? $template_item["graph_type_id"] : "0"), "");
form_hidden_box("save_component_item", "1", "");
html_end_box();
form_save_button("graphs.php?action=graph_edit&id=" . $_REQUEST["local_graph_id"]);
}
示例11: host
function host()
{
global $device_actions, $item_rows;
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request('host_template_id'));
input_validate_input_number(get_request_var_request('page'));
input_validate_input_number(get_request_var_request('host_status'));
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_device_current_page');
kill_session_var('sess_device_filter');
kill_session_var('sess_device_host_template_id');
kill_session_var('sess_host_status');
kill_session_var('sess_default_rows');
kill_session_var('sess_host_sort_column');
kill_session_var('sess_host_sort_direction');
unset($_REQUEST['page']);
unset($_REQUEST['filter']);
unset($_REQUEST['host_template_id']);
unset($_REQUEST['host_status']);
unset($_REQUEST['rows']);
unset($_REQUEST['sort_column']);
unset($_REQUEST['sort_direction']);
}
if (!empty($_SESSION['sess_host_status']) && !empty($_REQUEST['host_status'])) {
if ($_SESSION['sess_host_status'] != $_REQUEST['host_status']) {
$_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_device_current_page', '1');
load_current_session_value('filter', 'sess_device_filter', '');
load_current_session_value('host_template_id', 'sess_device_host_template_id', '-1');
load_current_session_value('host_status', 'sess_host_status', '-1');
load_current_session_value('rows', 'sess_default_rows', read_config_option('num_rows_table'));
load_current_session_value('sort_column', 'sess_host_sort_column', 'description');
load_current_session_value('sort_direction', 'sess_host_sort_direction', 'ASC');
/* if the number of rows is -1, set it to the default */
if ($_REQUEST['rows'] == -1) {
$_REQUEST['rows'] = read_config_option('num_rows_table');
}
?>
<script type="text/javascript">
<!--
function applyFilter() {
strURL = 'host.php?host_status=' + $('#host_status').val();
strURL = strURL + '&host_template_id=' + $('#host_template_id').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 = 'host.php?clear_x=1&header=false';
$.get(strURL, function(data) {
$('#main').html(data);
applySkin();
});
}
$(function(data) {
$('#refresh').click(function() {
applyFilter();
});
$('#clear').click(function() {
clearFilter();
});
$('#form_devices').submit(function(event) {
event.preventDefault();
applyFilter();
});
});
-->
</script>
<?php
html_start_box('<strong>Devices</strong>', '100%', '', '3', 'center', 'host.php?action=edit&host_template_id=' . htmlspecialchars(get_request_var_request('host_template_id')) . '&host_status=' . htmlspecialchars(get_request_var_request('host_status')));
?>
//.........这里部分代码省略.........
示例12: syslog_request_validation
/** function syslog_request_validation()
* This is a generic funtion for this page that makes sure that
* we have a good request. We want to protect against people who
* like to create issues with Cacti.
*/
function syslog_request_validation($current_tab)
{
global $title, $colors, $rows, $config, $reset_multi;
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request("rows"));
input_validate_input_number(get_request_var_request("removal"));
input_validate_input_number(get_request_var_request("refresh"));
input_validate_input_number(get_request_var_request("page"));
input_validate_input_number(get_request_var_request("trimval"));
input_validate_input_number(get_request_var_request("id"));
/* ==================================================== */
/* clean up filter string */
if (isset($_REQUEST["filter"])) {
$_REQUEST["filter"] = sanitize_search_string(get_request_var_request("filter"));
}
/* clean up facility string */
if (isset($_REQUEST["efacility"])) {
$_REQUEST["efacility"] = sanitize_search_string(get_request_var_request("efacility"));
}
/* clean up priority string */
if (isset($_REQUEST["elevel"])) {
$_REQUEST["elevel"] = sanitize_search_string(get_request_var_request("elevel"));
}
/* clean up sort solumn */
if (isset($_REQUEST["sort_column"])) {
$_REQUEST["sort_column"] = sanitize_search_string(get_request_var_request("sort_column"));
}
/* clean up sort direction */
if (isset($_REQUEST["sort_direction"])) {
$_REQUEST["sort_direction"] = sanitize_search_string(get_request_var_request("sort_direction"));
}
if ($current_tab != "alerts" && isset($_REQUEST["host"]) && $_REQUEST["host"][0] == -1) {
kill_session_var("sess_syslog_" . $current_tab . "_hosts");
unset($_REQUEST["host"]);
}
api_plugin_hook_function('syslog_request_val');
/* if the user pushed the 'clear' button */
if (isset($_REQUEST["button_clear_x"])) {
kill_session_var("sess_syslog_" . $current_tab . "_hosts");
kill_session_var("sess_syslog_" . $current_tab . "_rows");
kill_session_var("sess_syslog_" . $current_tab . "_trimval");
kill_session_var("sess_syslog_" . $current_tab . "_removal");
kill_session_var("sess_syslog_" . $current_tab . "_refresh");
kill_session_var("sess_syslog_" . $current_tab . "_page");
kill_session_var("sess_syslog_" . $current_tab . "_filter");
kill_session_var("sess_syslog_" . $current_tab . "_efacility");
kill_session_var("sess_syslog_" . $current_tab . "_elevel");
kill_session_var("sess_syslog__id");
kill_session_var("sess_syslog_" . $current_tab . "_sort_column");
kill_session_var("sess_syslog_" . $current_tab . "_sort_direction");
$_REQUEST["page"] = 1;
unset($_REQUEST["hosts"]);
unset($_REQUEST["rows"]);
unset($_REQUEST["trimval"]);
unset($_REQUEST["removal"]);
unset($_REQUEST["refresh"]);
unset($_REQUEST["page"]);
unset($_REQUEST["filter"]);
unset($_REQUEST["efacility"]);
unset($_REQUEST["elevel"]);
unset($_REQUEST["id"]);
unset($_REQUEST["sort_column"]);
unset($_REQUEST["sort_direction"]);
$reset_multi = true;
} else {
/* if any of the settings changed, reset the page number */
$changed = 0;
$changed += syslog_check_changed("hosts", "sess_syslog_" . $current_tab . "_hosts");
$changed += syslog_check_changed("predefined_timespan", "sess_current_timespan");
$changed += syslog_check_changed("date1", "sess_current_date1");
$changed += syslog_check_changed("date2", "sess_current_date2");
$changed += syslog_check_changed("rows", "sess_syslog_" . $current_tab . "_rows");
$changed += syslog_check_changed("removal", "sess_syslog_" . $current_tab . "_removal");
$changed += syslog_check_changed("refresh", "sess_syslog_" . $current_tab . "_refresh");
$changed += syslog_check_changed("filter", "sess_syslog_" . $current_tab . "_filter");
$changed += syslog_check_changed("efacility", "sess_syslog_" . $current_tab . "_efacility");
$changed += syslog_check_changed("elevel", "sess_syslog_" . $current_tab . "_elevel");
$changed += syslog_check_changed("sort_column", "sess_syslog_" . $current_tab . "_sort_column");
$changed += syslog_check_changed("sort_direction", "sess_syslog_" . $current_tab . "_sort_direction");
if ($changed) {
$_REQUEST["page"] = "1";
}
$reset_multi = false;
}
/* remember search fields in session vars */
load_current_session_value("page", "sess_syslog_" . $current_tab . "_page", "1");
load_current_session_value("rows", "sess_syslog_" . $current_tab . "_rows", read_config_option("num_rows_syslog"));
load_current_session_value("trimval", "sess_syslog_" . $current_tab . "_trimval", "75");
load_current_session_value("refresh", "sess_syslog_" . $current_tab . "_refresh", read_config_option("syslog_refresh"));
load_current_session_value("removal", "sess_syslog_" . $current_tab . "_removal", "-1");
load_current_session_value("filter", "sess_syslog_" . $current_tab . "_filter", "");
load_current_session_value("efacility", "sess_syslog_" . $current_tab . "_efacility", "0");
load_current_session_value("elevel", "sess_syslog_" . $current_tab . "_elevel", "0");
load_current_session_value("hosts", "sess_syslog_" . $current_tab . "_hosts", "0");
load_current_session_value("sort_column", "sess_syslog_" . $current_tab . "_sort_column", "logtime");
//.........这里部分代码省略.........
示例13: host
function host()
{
global $colors, $device_actions, $item_rows;
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request("host_template_id"));
input_validate_input_number(get_request_var_request("page"));
input_validate_input_number(get_request_var_request("host_status"));
input_validate_input_number(get_request_var_request("host_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_device_current_page");
kill_session_var("sess_device_filter");
kill_session_var("sess_device_host_template_id");
kill_session_var("sess_host_status");
kill_session_var("sess_host_rows");
kill_session_var("sess_host_sort_column");
kill_session_var("sess_host_sort_direction");
unset($_REQUEST["page"]);
unset($_REQUEST["filter"]);
unset($_REQUEST["host_template_id"]);
unset($_REQUEST["host_status"]);
unset($_REQUEST["host_rows"]);
unset($_REQUEST["sort_column"]);
unset($_REQUEST["sort_direction"]);
}
if (!empty($_SESSION["sess_host_status"]) && !empty($_REQUEST["host_status"])) {
if ($_SESSION["sess_host_status"] != $_REQUEST["host_status"]) {
$_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_device_current_page", "1");
load_current_session_value("filter", "sess_device_filter", "");
load_current_session_value("host_template_id", "sess_device_host_template_id", "-1");
load_current_session_value("host_status", "sess_host_status", "-1");
load_current_session_value("host_rows", "sess_host_rows", read_config_option("num_rows_device"));
load_current_session_value("sort_column", "sess_host_sort_column", "description");
load_current_session_value("sort_direction", "sess_host_sort_direction", "ASC");
/* if the number of rows is -1, set it to the default */
if ($_REQUEST["host_rows"] == -1) {
$_REQUEST["host_rows"] = read_config_option("num_rows_device");
}
?>
<script type="text/javascript">
<!--
function applyViewDeviceFilterChange(objForm) {
strURL = '?host_status=' + objForm.host_status.value;
strURL = strURL + '&host_template_id=' + objForm.host_template_id.value;
strURL = strURL + '&host_rows=' + objForm.host_rows.value;
strURL = strURL + '&filter=' + objForm.filter.value;
document.location = strURL;
}
-->
</script>
<?php
html_start_box("<strong>Devices</strong>", "100%", $colors["header"], "3", "center", "host.php?action=edit&host_template_id=" . get_request_var_request("host_template_id") . "&host_status=" . get_request_var_request("host_status"));
?>
<tr bgcolor="<?php
print $colors["panel"];
?>
">
<form name="form_devices">
<td>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td nowrap style='white-space: nowrap;' width="50">
Type:
</td>
<td width="1">
<select name="host_template_id" onChange="applyViewDeviceFilterChange(document.form_devices)">
<option value="-1"<?php
if (get_request_var_request("host_template_id") == "-1") {
?>
selected<?php
}
?>
>Any</option>
<option value="0"<?php
if (get_request_var_request("host_template_id") == "0") {
?>
selected<?php
}
?>
>None</option>
<?php
//.........这里部分代码省略.........
示例14: template
function template()
{
global $colors, $graph_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_graph_template_current_page");
kill_session_var("sess_graph_template_filter");
kill_session_var("sess_graph_template_sort_column");
kill_session_var("sess_graph_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_graph_template_current_page", "1");
load_current_session_value("filter", "sess_graph_template_filter", "");
load_current_session_value("sort_column", "sess_graph_template_sort_column", "name");
load_current_session_value("sort_direction", "sess_graph_template_sort_direction", "ASC");
html_start_box("<strong>Graph Templates</strong>", "100%", $colors["header"], "3", "center", "graph_templates.php?action=template_edit");
?>
<tr bgcolor="<?php
print $colors["panel"];
?>
">
<form name="form_host_template">
<td>
<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 get_request_var_request("filter");
?>
">
</td>
<td nowrap style='white-space: nowrap;'>
<input type="image" src="images/button_go.gif" alt="Go" border="0" align="absmiddle">
<input type="image" src="images/button_clear.gif" name="clear" alt="Clear" border="0" align="absmiddle">
</td>
</tr>
</table>
</td>
<input type='hidden' name='page' value='1'>
</form>
</tr>
<?php
html_end_box();
/* form the 'where' clause for our main sql query */
$sql_where = "WHERE (graph_templates.name LIKE '%%" . get_request_var_request("filter") . "%%')";
html_start_box("", "100%", $colors["header"], "3", "center", "");
$total_rows = db_fetch_cell("SELECT\n\t\tCOUNT(graph_templates.id)\n\t\tFROM graph_templates\n\t\t{$sql_where}");
$template_list = db_fetch_assoc("SELECT\n\t\tgraph_templates.id,graph_templates.name\n\t\tFROM graph_templates\n\t\t{$sql_where}\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"));
/* generate page list */
$url_page_select = get_page_list(get_request_var_request("page"), MAX_DISPLAY_PAGES, read_config_option("num_rows_device"), $total_rows, "graph_templates.php?filter=" . get_request_var_request("filter"));
$nav = "<tr bgcolor='#" . $colors["header"] . "'>\n\t\t<td colspan='7'>\n\t\t\t<table width='100%' cellspacing='0' cellpadding='0' border='0'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td align='left' class='textHeaderDark'>\n\t\t\t\t\t\t<strong><< ";
if (get_request_var_request("page") > 1) {
$nav .= "<a class='linkOverDark' href='graph_templates.php?filter=" . get_request_var_request("filter") . "&page=" . (get_request_var_request("page") - 1) . "'>";
}
$nav .= "Previous";
if (get_request_var_request("page") > 1) {
$nav .= "</a>";
}
$nav .= "</strong>\n\t\t\t\t\t</td>\n\n\t\t\t\t\t<td align='center' class='textHeaderDark'>\n\t\t\t\t\t\tShowing Rows " . (read_config_option("num_rows_device") * (get_request_var_request("page") - 1) + 1) . " to " . ($total_rows < read_config_option("num_rows_device") || $total_rows < read_config_option("num_rows_device") * get_request_var_request("page") ? $total_rows : read_config_option("num_rows_device") * get_request_var_request("page")) . " of {$total_rows} [{$url_page_select}]\n\t\t\t\t\t</td>\n\n\t\t\t\t\t<td align='right' class='textHeaderDark'>\n\t\t\t\t\t\t<strong>";
if (get_request_var_request("page") * read_config_option("num_rows_device") < $total_rows) {
$nav .= "<a class='linkOverDark' href='graph_templates.php?filter=" . get_request_var_request("filter") . "&page=" . (get_request_var_request("page") + 1) . "'>";
}
$nav .= "Next";
if (get_request_var_request("page") * read_config_option("num_rows_device") < $total_rows) {
$nav .= "</a>";
}
$nav .= " >></strong>\n\t\t\t\t\t</td>\n\n\t\t\t\t</tr>\n\t\t\t</table>\n\t\t</td>\n\t\t</tr>\n";
print $nav;
$display_text = array("name" => array("Template Title", "ASC"));
html_header_sort_checkbox($display_text, get_request_var_request("sort_column"), get_request_var_request("sort_direction"));
$i = 0;
if (sizeof($template_list) > 0) {
foreach ($template_list as $template) {
form_alternate_row_color($colors["alternate"], $colors["light"], $i, 'line' . $template["id"]);
$i++;
form_selectable_cell("<a class='linkEditMain' href='graph_templates.php?action=template_edit&id=" . $template["id"] . "'>" . (strlen(get_request_var_request("filter")) ? eregi_replace("(" . preg_quote(get_request_var_request("filter")) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $template["name"]) : $template["name"]) . "</a>", $template["id"]);
form_checkbox_cell($template["name"], $template["id"]);
form_end_row();
//.........这里部分代码省略.........
示例15: nl2br
}
$upgrade_results .= "<p class='code'>" . (($status == 0) ? $fail_text : $success_text) . nl2br($sql) . "</p>\n";
/* if there are one or more failures, make a note because we are going to print
out a warning to the user later on */
if ($status == 0) {
$failed_sql_query = true;
}
$current_version = $version;
}
}
}
kill_session_var("sess_sql_install_cache");
}else{
print "<em>No SQL queries have been executed.</em>";
}
if ($failed_sql_query == true) {
print "<p><strong><font color='#FF0000'>WARNING:</font></strong> One or more of the SQL queries needed to
upgraded your Cacti installation has failed. Please see below for more details. Your
Cacti MySQL user must have <strong>SELECT, INSERT, UPDATE, DELETE, ALTER, CREATE, and DROP</strong>
permissions. You should try executing the failed queries as 'root' to ensure that you do not have
a permissions problem.</p>\n";
}
print $upgrade_results;
?>