本文整理汇总了PHP中display_output_messages函数的典型用法代码示例。如果您正苦于以下问题:PHP display_output_messages函数的具体用法?PHP display_output_messages怎么用?PHP display_output_messages使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了display_output_messages函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mactrack_macw_edit
function mactrack_macw_edit()
{
global $fields_mactrack_macw_edit;
/* ================= input validation ================= */
get_filter_request_var('mac_id');
/* ==================================================== */
display_output_messages();
if (!isempty_request_var('mac_id')) {
$mac_record = db_fetch_row_prepared('SELECT * FROM mac_track_macwatch WHERE mac_id = ?', array(get_request_var('mac_id')));
$header_label = __('MacTrack MacWatch [edit: %s]', $mac_record['name']);
} else {
$header_label = __('MacTrack MacWatch [new]');
}
form_start('mactrack_macwatch.php', 'mactrack_macwatch');
html_start_box($header_label, '100%', '', '3', 'center', '');
draw_edit_form(array('config' => array('no_form_tag' => true), 'fields' => inject_form_variables($fields_mactrack_macw_edit, isset($mac_record) ? $mac_record : array())));
html_end_box();
form_save_button('mactrack_macwatch.php', 'return');
}
示例2: host_edit
function host_edit() {
global $colors, $fields_host_edit, $reindex_types;
display_output_messages();
if (!empty($_GET["id"])) {
$host = db_fetch_row("select * from host where id=" . $_GET["id"]);
$header_label = "[edit: " . $host["description"] . "]";
}else{
$header_label = "[new]";
}
if (!empty($host["id"])) {
?>
<table width="98%" align="center">
<tr>
<td class="textInfo" colspan="2">
<?php print $host["description"];?> (<?php print $host["hostname"];?>)
</td>
</tr>
<tr>
<td class="textHeader">
SNMP Information<br>
<span style="font-size: 10px; font-weight: normal; font-family: monospace;">
<?php
if (($host["snmp_community"] == "") && ($host["snmp_username"] == "")) {
print "<span style='color: #ab3f1e; font-weight: bold;'>SNMP not in use</span>\n";
}else{
$snmp_system = cacti_snmp_get($host["hostname"], $host["snmp_community"], ".1.3.6.1.2.1.1.1.0", $host["snmp_version"], $host["snmp_username"], $host["snmp_password"], $host["snmp_port"], $host["snmp_timeout"], SNMP_WEBUI);
if ($snmp_system == "") {
print "<span style='color: #ff0000; font-weight: bold;'>SNMP error</span>\n";
}else{
$snmp_uptime = cacti_snmp_get($host["hostname"], $host["snmp_community"], ".1.3.6.1.2.1.1.3.0", $host["snmp_version"], $host["snmp_username"], $host["snmp_password"], $host["snmp_port"], $host["snmp_timeout"], SNMP_WEBUI);
$snmp_hostname = cacti_snmp_get($host["hostname"], $host["snmp_community"], ".1.3.6.1.2.1.1.5.0", $host["snmp_version"], $host["snmp_username"], $host["snmp_password"], $host["snmp_port"], $host["snmp_timeout"], SNMP_WEBUI);
print "<strong>System:</strong> $snmp_system<br>\n";
print "<strong>Uptime:</strong> $snmp_uptime<br>\n";
print "<strong>Hostname:</strong> $snmp_hostname<br>\n";
}
}
?>
</span>
</td>
<td class="textInfo" valign="top">
<span style="color: #c16921;">*</span><a href="graphs_new.php?host_id=<?php print $host["id"];?>">Create Graphs for this Host</a>
</td>
</tr>
</table>
<br>
<?php
}
html_start_box("<strong>Devices</strong> $header_label", "98%", $colors["header"], "3", "center", "");
/* preserve the host template id if passed in via a GET variable */
if (!empty($_GET["host_template_id"])) {
$fields_host_edit["host_template_id"]["value"] = $_GET["host_template_id"];
}
draw_edit_form(array(
"config" => array("form_name" => "chk"),
"fields" => inject_form_variables($fields_host_edit, (isset($host) ? $host : array()))
));
html_end_box();
if ((isset($_GET["display_dq_details"])) && (isset($_SESSION["debug_log"]["data_query"]))) {
html_start_box("<strong>Data Query Debug Information</strong>", "98%", $colors["header"], "3", "center", "");
print "<tr><td><span style='font-family: monospace;'>" . debug_log_return("data_query") . "</span></td></tr>";
html_end_box();
}
if (!empty($host["id"])) {
html_start_box("<strong>Associated Graph Templates</strong>", "98%", $colors["header"], "3", "center", "");
html_header(array("Graph Template Name", "Status"), 2);
$selected_graph_templates = db_fetch_assoc("select
graph_templates.id,
graph_templates.name
from graph_templates,host_graph
where graph_templates.id=host_graph.graph_template_id
and host_graph.host_id=" . $_GET["id"] . "
order by graph_templates.name");
$available_graph_templates = db_fetch_assoc("SELECT
graph_templates.id, graph_templates.name
FROM snmp_query_graph RIGHT JOIN graph_templates
ON snmp_query_graph.graph_template_id = graph_templates.id
WHERE (((snmp_query_graph.name) Is Null)) ORDER BY graph_templates.name");
$i = 0;
if (sizeof($selected_graph_templates) > 0) {
foreach ($selected_graph_templates as $item) {
$i++;
//.........这里部分代码省略.........
示例3: 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>
//.........这里部分代码省略.........
示例4: settings
function settings()
{
global $tabs_graphs, $settings_graphs, $current_user, $graph_views, $current_user;
/* you cannot have per-user graph settings if cacti's user management is not turned on */
if (read_config_option('auth_method') == 0) {
raise_message(6);
display_output_messages();
return;
}
if ($_REQUEST['action'] == 'edit') {
if (isset($_SERVER['HTTP_REFERER'])) {
$timespan_sel_pos = strpos($_SERVER['HTTP_REFERER'], '&predefined_timespan');
if ($timespan_sel_pos) {
$_SERVER['HTTP_REFERER'] = substr($_SERVER['HTTP_REFERER'], 0, $timespan_sel_pos);
}
}
$_SESSION['profile_referer'] = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : 'graph_view.php';
}
print "<form method='post' action='auth_profile.php'>\n";
html_start_box('<strong>User Settings</strong>', '100%', '', '3', 'center', '');
$current_user = db_fetch_row_prepared('SELECT * FROM user_auth WHERE id = ?', array($_SESSION['sess_user_id']));
if (!sizeof($current_user)) {
return;
}
/* file: user_admin.php, action: user_edit (host) */
$fields_user = array('username' => array('method' => 'value', 'friendly_name' => 'User Name', 'description' => 'The login name for this user.', 'value' => '|arg1:username|', 'max_length' => '40', 'size' => '40'), 'full_name' => array('method' => 'textbox', 'friendly_name' => 'Full Name', 'description' => 'A more descriptive name for this user, that can include spaces or special characters.', 'value' => '|arg1:full_name|', 'max_length' => '120', 'size' => '60'), 'email_address' => array('method' => 'textbox', 'friendly_name' => 'E-Mail Address', 'description' => 'An E-Mail Address you be reached at.', 'value' => '|arg1:email_address|', 'max_length' => '60', 'size' => '60'));
draw_edit_form(array('config' => array('no_form_tag' => true), 'fields' => inject_form_variables($fields_user, isset($current_user) ? $current_user : array())));
html_end_box();
if (is_view_allowed('graph_settings') == true) {
if (read_config_option('auth_method') != 0) {
$settings_graphs['tree']['default_tree_id']['sql'] = get_graph_tree_array(true);
}
html_start_box('<strong>Graph Settings</strong>', '100%', '', '3', 'center', '');
while (list($tab_short_name, $tab_fields) = each($settings_graphs)) {
$collapsible = true;
print "<tr class='spacer tableHeader" . ($collapsible ? ' collapsible' : '') . "' id='row_{$tab_short_name}'><td colspan='2' style='cursor:pointer;' class='tableSubHeaderColumn'>" . $tabs_graphs[$tab_short_name] . ($collapsible ? "<div style='float:right;padding-right:4px;'><i class='fa fa-angle-double-up'></i></div>" : "") . "</td></tr>\n";
$form_array = array();
while (list($field_name, $field_array) = each($tab_fields)) {
$form_array += array($field_name => $tab_fields[$field_name]);
if (isset($field_array['items']) && is_array($field_array['items'])) {
while (list($sub_field_name, $sub_field_array) = each($field_array['items'])) {
if (graph_config_value_exists($sub_field_name, $_SESSION['sess_user_id'])) {
$form_array[$field_name]['items'][$sub_field_name]['form_id'] = 1;
}
$form_array[$field_name]['items'][$sub_field_name]['value'] = db_fetch_cell_prepared('SELECT value FROM settings_graphs WHERE name = ? AND user_id = ?', array($sub_field_name, $_SESSION['sess_user_id']));
}
} else {
if (graph_config_value_exists($field_name, $_SESSION['sess_user_id'])) {
$form_array[$field_name]['form_id'] = 1;
}
$form_array[$field_name]['value'] = db_fetch_cell_prepared('SELECT value FROM settings_graphs WHERE name = ? AND user_id = ?', array($field_name, $_SESSION['sess_user_id']));
}
}
draw_edit_form(array('config' => array('no_form_tag' => true), 'fields' => $form_array));
}
html_end_box();
}
?>
<script type="text/javascript">
<!--
var themeFonts=<?php
print read_config_option('font_method');
?>
;
function graphSettings() {
if (themeFonts == 1) {
$('#row_fonts').hide();
$('#row_custom_fonts').hide();
$('#row_title_size').hide();
$('#row_title_font').hide();
$('#row_legend_size').hide();
$('#row_legend_font').hide();
$('#row_axis_size').hide();
$('#row_axis_font').hide();
$('#row_unit_size').hide();
$('#row_unit_font').hide();
}else{
var custom_fonts = $('#custom_fonts').is(':checked');
switch(custom_fonts) {
case true:
$('#row_fonts').show();
$('#row_title_size').show();
$('#row_title_font').show();
$('#row_legend_size').show();
$('#row_legend_font').show();
$('#row_axis_size').show();
$('#row_axis_font').show();
$('#row_unit_size').show();
$('#row_unit_font').show();
break;
case false:
$('#row_fonts').show();
$('#row_title_size').hide();
$('#row_title_font').hide();
$('#row_legend_size').hide();
$('#row_legend_font').hide();
$('#row_axis_size').hide();
$('#row_axis_font').hide();
//.........这里部分代码省略.........
示例5: host_edit
function host_edit()
{
global $colors, $fields_host_edit, $reindex_types;
/* ================= input validation ================= */
input_validate_input_number(get_request_var("id"));
/* ==================================================== */
display_output_messages();
if (!empty($_GET["id"])) {
$host = db_fetch_row("select * from host where id=" . $_GET["id"]);
$header_label = "[edit: " . $host["description"] . "]";
} else {
$header_label = "[new]";
}
if (!empty($host["id"])) {
?>
<table width="100%" align="center">
<tr>
<td class="textInfo" colspan="2">
<?php
print $host["description"];
?>
(<?php
print $host["hostname"];
?>
)
</td>
</tr>
<tr>
<td class="textHeader">
<?php
if ($host["availability_method"] == AVAIL_SNMP || $host["availability_method"] == AVAIL_SNMP_AND_PING || $host["availability_method"] == AVAIL_SNMP_OR_PING) {
?>
SNMP Information<br>
<span style="font-size: 10px; font-weight: normal; font-family: monospace;">
<?php
if ($host["snmp_community"] == "" && $host["snmp_username"] == "" || $host["snmp_version"] == 0) {
print "<span style='color: #ab3f1e; font-weight: bold;'>SNMP not in use</span>\n";
} else {
$snmp_system = cacti_snmp_get($host["hostname"], $host["snmp_community"], ".1.3.6.1.2.1.1.1.0", $host["snmp_version"], $host["snmp_username"], $host["snmp_password"], $host["snmp_auth_protocol"], $host["snmp_priv_passphrase"], $host["snmp_priv_protocol"], $host["snmp_context"], $host["snmp_port"], $host["snmp_timeout"], read_config_option("snmp_retries"), SNMP_WEBUI);
/* modify for some system descriptions */
/* 0000937: System output in hosts.php poor for Alcatel */
if (substr_count($snmp_system, "00:")) {
$snmp_system = str_replace("00:", "", $snmp_system);
$snmp_system = str_replace(":", " ", $snmp_system);
}
if ($snmp_system == "") {
print "<span style='color: #ff0000; font-weight: bold;'>SNMP error</span>\n";
} else {
$snmp_uptime = cacti_snmp_get($host["hostname"], $host["snmp_community"], ".1.3.6.1.2.1.1.3.0", $host["snmp_version"], $host["snmp_username"], $host["snmp_password"], $host["snmp_auth_protocol"], $host["snmp_priv_passphrase"], $host["snmp_priv_protocol"], $host["snmp_context"], $host["snmp_port"], $host["snmp_timeout"], read_config_option("snmp_retries"), SNMP_WEBUI);
$snmp_hostname = cacti_snmp_get($host["hostname"], $host["snmp_community"], ".1.3.6.1.2.1.1.5.0", $host["snmp_version"], $host["snmp_username"], $host["snmp_password"], $host["snmp_auth_protocol"], $host["snmp_priv_passphrase"], $host["snmp_priv_protocol"], $host["snmp_context"], $host["snmp_port"], $host["snmp_timeout"], read_config_option("snmp_retries"), SNMP_WEBUI);
$snmp_location = cacti_snmp_get($host["hostname"], $host["snmp_community"], ".1.3.6.1.2.1.1.6.0", $host["snmp_version"], $host["snmp_username"], $host["snmp_password"], $host["snmp_auth_protocol"], $host["snmp_priv_passphrase"], $host["snmp_priv_protocol"], $host["snmp_context"], $host["snmp_port"], $host["snmp_timeout"], read_config_option("snmp_retries"), SNMP_WEBUI);
$snmp_contact = cacti_snmp_get($host["hostname"], $host["snmp_community"], ".1.3.6.1.2.1.1.4.0", $host["snmp_version"], $host["snmp_username"], $host["snmp_password"], $host["snmp_auth_protocol"], $host["snmp_priv_passphrase"], $host["snmp_priv_protocol"], $host["snmp_context"], $host["snmp_port"], $host["snmp_timeout"], read_config_option("snmp_retries"), SNMP_WEBUI);
print "<strong>System:</strong>" . html_split_string($snmp_system) . "<br>\n";
$days = intval($snmp_uptime / (60 * 60 * 24 * 100));
$remainder = $snmp_uptime % (60 * 60 * 24 * 100);
$hours = intval($remainder / (60 * 60 * 100));
$remainder = $remainder % (60 * 60 * 100);
$minutes = intval($remainder / (60 * 100));
print "<strong>Uptime:</strong> {$snmp_uptime}";
print " ({$days} days, {$hours} hours, {$minutes} minutes)<br>\n";
print "<strong>Hostname:</strong> {$snmp_hostname}<br>\n";
print "<strong>Location:</strong> {$snmp_location}<br>\n";
print "<strong>Contact:</strong> {$snmp_contact}<br>\n";
}
}
?>
</span>
<?php
}
if ($host["availability_method"] == AVAIL_PING || $host["availability_method"] == AVAIL_SNMP_AND_PING || $host["availability_method"] == AVAIL_SNMP_OR_PING) {
/* create new ping socket for host pinging */
$ping = new Net_Ping();
$ping->host = $host;
$ping->port = $host["ping_port"];
/* perform the appropriate ping check of the host */
if ($ping->ping($host["availability_method"], $host["ping_method"], $host["ping_timeout"], $host["ping_retries"])) {
$host_down = false;
$color = "#000000";
} else {
$host_down = true;
$color = "#ff0000";
}
?>
<br>Ping Results<br>
<span style="font-size: 10px; font-weight: normal; color: <?php
print $color;
?>
; font-family: monospace;">
<?php
print $ping->ping_response;
?>
</span>
<?php
} else {
if ($host["availability_method"] == AVAIL_NONE) {
?>
No Availability Check In Use<br>
<?php
}
//.........这里部分代码省略.........
示例6: 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();
}
示例7: template_edit
function template_edit() {
/* ================= input validation ================= */
input_validate_input_number(get_request_var("id"));
/* ==================================================== */
display_output_messages();
$graph_template_tabs = array(
"general" => __("General"),
"items" => __("Items"),
"graphs" => __("Graphs"),
);
if (!empty($_REQUEST["id"])) {
$graph_template = db_fetch_row("select * from graph_templates where id=" . $_REQUEST["id"]);
$header_label = __("[edit: ") . $graph_template["name"] . "]";
}else{
$graph_template = array();
$header_label = __("[new]");
#$_REQUEST["id"] = 0;
}
/* set the default settings category */
if (!isset($_REQUEST["tab"])) {
/* there is no selected tab; select the first one */
$current_tab = array_keys($graph_template_tabs);
$current_tab = $current_tab[0];
}else{
$current_tab = $_REQUEST["tab"];
}
/* draw the categories tabs on the top of the page */
print "<table width='100%' cellspacing='0' cellpadding='0' align='center'><tr>";
print "<td><div class='tabs'>";
if (sizeof($graph_template_tabs) > 0) {
foreach (array_keys($graph_template_tabs) as $tab_short_name) {
print "<div class='tabDefault'><a " . (($tab_short_name == $current_tab) ? "class='tabSelected'" : "class='tabDefault'") . " href='" . htmlspecialchars("graph_templates.php?action=template_edit" . (isset($_REQUEST['id']) ? "&id=" . $_REQUEST['id'] . "&template_id=" . $_REQUEST['id']: "") . "&filter=&device_id=-1&tab=$tab_short_name") . "'>$graph_template_tabs[$tab_short_name]</a></div>";
if (!isset($_REQUEST["id"])) break;
}
}
print "</div></td></tr></table>";
if (!isset($_REQUEST["tab"])) {
$_REQUEST["tab"] = "general";
}
switch (get_request_var_request("tab")) {
case "graphs":
include_once(CACTI_BASE_PATH . "/lib/graph/graphs_form.php");
include_once(CACTI_BASE_PATH . "/lib/utility.php");
include_once(CACTI_BASE_PATH . "/lib/api_graph.php");
include_once(CACTI_BASE_PATH . "/lib/api_tree.php");
include_once(CACTI_BASE_PATH . "/lib/api_data_source.php");
include_once(CACTI_BASE_PATH . "/lib/template.php");
include_once(CACTI_BASE_PATH . "/lib/html_tree.php");
include_once(CACTI_BASE_PATH . "/lib/html_form_template.php");
include_once(CACTI_BASE_PATH . "/lib/rrd.php");
include_once(CACTI_BASE_PATH . "/lib/data_query.php");
graph();
break;
case "items":
/* graph item list goes here */
if (!empty($_REQUEST["id"])) {
graph_template_display_items();
}
break;
default:
graph_template_display_general($graph_template, $header_label);
break;
}
}
示例8: mactrack_maca_edit
function mactrack_maca_edit() {
global $colors, $fields_mactrack_maca_edit;
/* ================= input validation ================= */
input_validate_input_number(get_request_var("mac_id"));
/* ==================================================== */
display_output_messages();
if (!empty($_GET["mac_id"])) {
$mac_record = db_fetch_row("SELECT * FROM mac_track_macauth WHERE mac_id=" . $_GET["mac_id"]);
$header_label = "[edit: " . $mac_record["mac_address"] . "]";
}else{
$header_label = "[new]";
}
html_start_box("<strong>MacTrack MacAuth</strong> $header_label", "100%", $colors["header"], "3", "center", "");
draw_edit_form(array(
"config" => array("form_name" => "chk"),
"fields" => inject_form_variables($fields_mactrack_maca_edit, (isset($mac_record) ? $mac_record : array()))
));
html_end_box();
if (isset($mac_record)) {
mactrack_save_button("mactrack_macauth.php", "save", "", "mac_id");
}else{
mactrack_save_button("cancel", "save", "", "mac_id");
}
}
示例9: mactrack_view_graphs
//.........这里部分代码省略.........
$graph_list[$item] = 1;
}
}
/* remove items */
if (! empty($_REQUEST["graph_remove"])) {
foreach (explode(",",$_REQUEST["graph_remove"]) as $item) {
unset($graph_list[$item]);
}
}
$i = 0;
foreach ($graph_list as $item => $value) {
$graph_array[$i] = $item;
$i++;
}
if ((isset($graph_array)) && (sizeof($graph_array) > 0)) {
/* build sql string including each graph the user checked */
$sql_or = "AND " . array_to_sql_or($graph_array, "graph_templates_graph.local_graph_id");
/* clear the filter vars so they don't affect our results */
$_REQUEST["filter"] = "";
$set_rra_id = empty($rra_id) ? read_graph_config_option("default_rra_id") : $_REQUEST["rra_id"];
}
}
}
$sql_base = "FROM (graph_templates_graph,graph_local)
$sql_join
$sql_where
" . (empty($sql_where) ? "WHERE" : "AND") . " graph_templates_graph.local_graph_id > 0
AND graph_templates_graph.local_graph_id=graph_local.id
" . (strlen($_REQUEST["filter"]) ? "AND graph_templates_graph.title_cache like '%%" . $_REQUEST["filter"] . "%%'":"") . "
" . (empty($_REQUEST["graph_template_id"]) ? "" : " and graph_local.graph_template_id=" . $_REQUEST["graph_template_id"]) . "
$sql_or";
$total_rows = count(db_fetch_assoc("SELECT
graph_templates_graph.local_graph_id
$sql_base"));
/* reset the page if you have changed some settings */
if (ROWS_PER_PAGE * ($_REQUEST["page"]-1) >= $total_rows) {
$_REQUEST["page"] = "1";
}
$graphs = db_fetch_assoc("SELECT
graph_templates_graph.local_graph_id,
graph_templates_graph.title_cache
$sql_base
GROUP BY graph_templates_graph.local_graph_id
ORDER BY graph_templates_graph.title_cache
LIMIT " . (ROWS_PER_PAGE*($_REQUEST["page"]-1)) . "," . ROWS_PER_PAGE);
?>
<script type="text/javascript">
<!--
function applyGraphPreviewFilterChange(objForm) {
strURL = '?report=graphs&graph_template_id=' + objForm.graph_template_id.value;
strURL = strURL + '&filter=' + objForm.filter.value;
document.location = strURL;
}
-->
</script>
<?php
/* include graph view filter selector */
display_output_messages();
mactrack_tabs();
html_start_box("<strong>Network Device Graphs</strong>", "100%", $colors["header"], "1", "center", "");
mactrack_graph_view_filter();
/* include time span selector */
if (read_graph_config_option("timespan_sel") == "on") {
mactrack_timespan_selector();
}
html_end_box();
/* do some fancy navigation url construction so we don't have to try and rebuild the url string */
if (ereg("page=[0-9]+",basename($_SERVER["QUERY_STRING"]))) {
$nav_url = str_replace("page=" . $_REQUEST["page"], "page=<PAGE>", basename($_SERVER["PHP_SELF"]) . "?" . $_SERVER["QUERY_STRING"]);
}else{
$nav_url = basename($_SERVER["PHP_SELF"]) . "?" . $_SERVER["QUERY_STRING"] . "&page=<PAGE>";
}
$nav_url = ereg_replace("((\?|&)filter=[a-zA-Z0-9]*)", "", $nav_url);
html_start_box("", "100%", $colors["header"], "3", "center", "");
mactrack_nav_bar($_REQUEST["page"], ROWS_PER_PAGE, $total_rows, $nav_url);
if (read_graph_config_option("thumbnail_section_preview") == "on") {
html_graph_thumbnail_area($graphs, "","graph_start=" . get_current_graph_start() . "&graph_end=" . get_current_graph_end());
}else{
html_graph_area($graphs, "", "graph_start=" . get_current_graph_start() . "&graph_end=" . get_current_graph_end());
}
if ($total_rows) {
mactrack_nav_bar($_REQUEST["page"], ROWS_PER_PAGE, $total_rows, $nav_url);
}
html_end_box();
}
示例10: settings
function settings()
{
global $tabs_graphs, $settings_graphs, $current_user, $graph_views, $current_user;
$current_user = db_fetch_row_prepared('SELECT * FROM user_auth WHERE id = ?', array($_SESSION['sess_user_id']));
/* you cannot have per-user graph settings if cacti's user management is not turned on */
if (read_config_option('auth_method') == 0) {
raise_message(6);
display_output_messages();
return;
}
/* Find out whether this user has right here */
if (!is_view_allowed('graph_settings')) {
print "<strong><font class='txtErrorTextBox'>YOU DO NOT HAVE RIGHTS TO CHANGE GRAPH SETTINGS</font></strong>";
bottom_footer();
exit;
}
if (read_config_option('auth_method') != 0) {
$settings_graphs['tree']['default_tree_id']['sql'] = get_graph_tree_array(true);
}
print "<form method='post' action='graph_settings.php'>\n";
html_start_box('<strong>Graph Settings</strong>', '100%', '', '3', 'center', '');
while (list($tab_short_name, $tab_fields) = each($settings_graphs)) {
$collapsible = true;
print "<tr class='spacer tableHeader" . ($collapsible ? ' collapsible' : '') . "' id='row_{$tab_short_name}'><td colspan='2' style='cursor:pointer;' class='tableSubHeaderColumn'>" . $tabs_graphs[$tab_short_name] . ($collapsible ? "<div style='float:right;padding-right:4px;'><i class='fa fa-angle-double-up'></i></div>" : "") . "</td></tr>\n";
$form_array = array();
while (list($field_name, $field_array) = each($tab_fields)) {
$form_array += array($field_name => $tab_fields[$field_name]);
if (isset($field_array['items']) && is_array($field_array['items'])) {
while (list($sub_field_name, $sub_field_array) = each($field_array['items'])) {
if (graph_config_value_exists($sub_field_name, $_SESSION['sess_user_id'])) {
$form_array[$field_name]['items'][$sub_field_name]['form_id'] = 1;
}
$form_array[$field_name]['items'][$sub_field_name]['value'] = db_fetch_cell_prepared('SELECT value FROM settings_graphs WHERE name = ? AND user_id = ?', array($sub_field_name, $_SESSION['sess_user_id']));
}
} else {
if (graph_config_value_exists($field_name, $_SESSION['sess_user_id'])) {
$form_array[$field_name]['form_id'] = 1;
}
$form_array[$field_name]['value'] = db_fetch_cell_prepared('SELECT value FROM settings_graphs WHERE name = ? AND user_id = ?', array($field_name, $_SESSION['sess_user_id']));
}
}
draw_edit_form(array('config' => array('no_form_tag' => true), 'fields' => $form_array));
}
html_end_box();
?>
<script type="text/javascript">
<!--
var themeFonts=<?php
print read_config_option('font_method');
?>
;
function graphSettings() {
if (themeFonts == 1) {
$('#row_fonts').hide();
$('#row_custom_fonts').hide();
$('#row_title_size').hide();
$('#row_title_font').hide();
$('#row_legend_size').hide();
$('#row_legend_font').hide();
$('#row_axis_size').hide();
$('#row_axis_font').hide();
$('#row_unit_size').hide();
$('#row_unit_font').hide();
}else{
var custom_fonts = $('#custom_fonts').is(':checked');
switch(custom_fonts) {
case true:
$('#row_fonts').show();
$('#row_title_size').show();
$('#row_title_font').show();
$('#row_legend_size').show();
$('#row_legend_font').show();
$('#row_axis_size').show();
$('#row_axis_font').show();
$('#row_unit_size').show();
$('#row_unit_font').show();
break;
case false:
$('#row_fonts').show();
$('#row_title_size').hide();
$('#row_title_font').hide();
$('#row_legend_size').hide();
$('#row_legend_font').hide();
$('#row_axis_size').hide();
$('#row_axis_font').hide();
$('#row_unit_size').hide();
$('#row_unit_font').hide();
break;
}
}
if ($('#timespan_sel').is(':checked')) {
$('#row_default_rra_id').hide();
$('#row_default_timespan').show();
$('#row_default_timeshift').show();
$('#row_allow_graph_dates_in_future').show();
$('#row_first_weekdayid').show();
$('#row_day_shift_start').show();
//.........这里部分代码省略.........
示例11: template
function template() {
global $colors, $host_actions;
display_output_messages();
html_start_box("<strong>Host Templates</strong>", "98%", $colors["header"], "3", "center", "host_templates.php?action=edit");
html_header_checkbox(array("Template Title"));
$host_templates = db_fetch_assoc("select * from host_template order by name");
$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";
}
示例12: db_fetch_cell
Logged in as <strong><?php print db_fetch_cell("select username from user_auth where id=" . $_SESSION["sess_user_id"]);?></strong> (<a href="logout.php">Logout</a>)
<?php } ?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#f5f5f5" colspan="1" height="8" width="135" style="background-image: url(images/shadow_gray.gif); background-repeat: repeat-x; border-right: #aaaaaa 1px solid;">
<img src="images/transparent_line.gif" width="135" height="2" border="0"><br>
</td>
<td colspan="2" height="8" style="background-image: url(images/shadow.gif); background-repeat: repeat-x;" bgcolor="#ffffff">
</td>
</tr>
<tr height="5">
<td valign="top" rowspan="2" width="135" style="padding: 5px; border-right: #aaaaaa 1px solid;" bgcolor='#f5f5f5'>
<table bgcolor="#f5f5f5" width="100%" cellpadding="1" cellspacing="0" border="0">
<?php draw_menu();?>
</table>
<img src="images/transparent_line.gif" width="135" height="5" border="0"><br>
<p align="center"><a href='about.php'><img src="images/cacti_logo.gif" border="0"></a></p>
<img src="images/transparent_line.gif" width="135" height="5" border="0"><br>
</td>
<td></td>
</tr>
<tr>
<td width="135" height="500"></td>
<td width="100%" valign="top"><?php display_output_messages();?>
示例13: template
function template()
{
global $colors, $host_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 */
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_host_template_current_page");
kill_session_var("sess_host_template_filter");
kill_session_var("sess_host_template_sort_column");
kill_session_var("sess_host_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_host_template_current_page", "1");
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");
display_output_messages();
html_start_box("<strong>Host Templates</strong>", "100%", $colors["header"], "3", "center", "host_templates.php?action=edit");
include "./include/html/inc_graph_template_filter_table.php";
html_end_box();
/* form the 'where' clause for our main sql query */
$sql_where = "WHERE (host_template.name LIKE '%%" . $_REQUEST["filter"] . "%%')";
html_start_box("", "100%", $colors["header"], "3", "center", "");
$total_rows = db_fetch_cell("SELECT\n\t\tCOUNT(host_template.id)\n\t\tFROM host_template\n\t\t{$sql_where}");
$template_list = db_fetch_assoc("SELECT\n\t\thost_template.id,host_template.name\n\t\tFROM host_template\n\t\t{$sql_where}\n\t\tORDER BY " . $_REQUEST['sort_column'] . " " . $_REQUEST['sort_direction'] . " LIMIT " . read_config_option("num_rows_device") * ($_REQUEST["page"] - 1) . "," . read_config_option("num_rows_device"));
/* generate page list */
$url_page_select = get_page_list($_REQUEST["page"], MAX_DISPLAY_PAGES, read_config_option("num_rows_device"), $total_rows, "host_templates.php?filter=" . $_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 ($_REQUEST["page"] > 1) {
$nav .= "<a class='linkOverDark' href='host_templates.php?filter=" . $_REQUEST["filter"] . "&page=" . ($_REQUEST["page"] - 1) . "'>";
}
$nav .= "Previous";
if ($_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") * ($_REQUEST["page"] - 1) + 1) . " to " . ($total_rows < read_config_option("num_rows_device") || $total_rows < read_config_option("num_rows_device") * $_REQUEST["page"] ? $total_rows : read_config_option("num_rows_device") * $_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 ($_REQUEST["page"] * read_config_option("num_rows_device") < $total_rows) {
$nav .= "<a class='linkOverDark' href='host_templates.php?filter=" . $_REQUEST["filter"] . "&page=" . ($_REQUEST["page"] + 1) . "'>";
}
$nav .= "Next";
if ($_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, $_REQUEST["sort_column"], $_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='host_templates.php?action=edit&id=" . $template["id"] . "'>" . (strlen($_REQUEST["filter"]) ? eregi_replace("(" . preg_quote($_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();
}
/* put the nav bar on the bottom as well */
print $nav;
} 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";
}
示例14: mactrack_device_edit
function mactrack_device_edit() {
global $colors, $config, $fields_mactrack_device_edit;
/* ================= input validation ================= */
input_validate_input_number(get_request_var("device_id"));
/* ==================================================== */
display_output_messages();
if (!empty($_GET["device_id"])) {
$device = db_fetch_row("select * from mac_track_devices where device_id=" . $_GET["device_id"]);
$header_label = "[edit: " . $device["device_name"] . "]";
}else{
$header_label = "[new]";
}
if (!empty($device["device_id"])) {
?>
<table width="100%" align="center">
<tr>
<td class="textInfo" colspan="2">
<?php print $device["device_name"];?> (<?php print $device["hostname"];?>)
</td>
</tr>
<tr>
<td class="textHeader">
SNMP Information<br>
<span style="font-size: 10px; font-weight: normal; font-family: monospace;">
<?php
/* force php to return numeric oid's */
if (function_exists("snmp_set_oid_numeric_print")) {
snmp_set_oid_numeric_print(TRUE);
}
$snmp_system = cacti_snmp_get($device["hostname"], $device["snmp_readstring"], ".1.3.6.1.2.1.1.1.0", $device["snmp_version"], $device["snmp_username"], $device["snmp_password"], $device["snmp_auth_protocol"], $device["snmp_priv_passphrase"], $device["snmp_priv_protocol"], $device["snmp_context"], $device["snmp_port"], $device["snmp_timeout"], $device["snmp_retries"], SNMP_WEBUI);
if ($snmp_system == "") {
print "<span style='color: #ff0000; font-weight: bold;'>SNMP error</span>\n";
}else{
$snmp_uptime = cacti_snmp_get($device["hostname"], $device["snmp_readstring"], ".1.3.6.1.2.1.1.3.0", $device["snmp_version"], $device["snmp_username"], $device["snmp_password"], $device["snmp_auth_protocol"], $device["snmp_priv_passphrase"], $device["snmp_priv_protocol"], $device["snmp_context"], $device["snmp_port"], $device["snmp_timeout"], $device["snmp_retries"], SNMP_WEBUI);
$snmp_hostname = cacti_snmp_get($device["hostname"], $device["snmp_readstring"], ".1.3.6.1.2.1.1.5.0", $device["snmp_version"], $device["snmp_username"], $device["snmp_password"], $device["snmp_auth_protocol"], $device["snmp_priv_passphrase"], $device["snmp_priv_protocol"], $device["snmp_context"], $device["snmp_port"], $device["snmp_timeout"], $device["snmp_retries"], SNMP_WEBUI);
$snmp_objid = cacti_snmp_get($device["hostname"], $device["snmp_readstring"], ".1.3.6.1.2.1.1.2.0", $device["snmp_version"], $device["snmp_username"], $device["snmp_password"], $device["snmp_auth_protocol"], $device["snmp_priv_passphrase"], $device["snmp_priv_protocol"], $device["snmp_context"], $device["snmp_port"], $device["snmp_timeout"], $device["snmp_retries"], SNMP_WEBUI);
$snmp_objid = str_replace("enterprises", ".1.3.6.1.4.1", $snmp_objid);
$snmp_objid = str_replace("OID: ", "", $snmp_objid);
$snmp_objid = str_replace(".iso", ".1", $snmp_objid);
print "<strong>System:</strong> $snmp_system<br>\n";
print "<strong>Uptime:</strong> $snmp_uptime<br>\n";
print "<strong>Hostname:</strong> $snmp_hostname<br>\n";
print "<strong>ObjectID:</strong> $snmp_objid<br>\n";
if (isset($_GET["scan"]))
print $_GET["scan"]==1 ? "<span style='color:#088A08'><strong>Port Scanning:</strong> Complete</span><br>\n" : "<span style='color:#ff0000'><strong>Port Scanning:</strong> Fail</span><br>\n";
}
?>
</span>
</td>
</tr>
</table>
<br>
<?php
}
html_start_box("<strong>MacTrack Devices</strong> $header_label", "100%", $colors["header"], "3", "center", "");
/* preserve the devices site id between refreshes via a GET variable */
if (!empty($_GET["site_id"])) {
$fields_host_edit["site_id"]["value"] = $_GET["site_id"];
}
draw_edit_form(array(
"config" => array("form_name" => "chk"),
"fields" => inject_form_variables($fields_mactrack_device_edit, (isset($device) ? $device : array()))
));
html_end_box();
if (isset($device)) {
mactrack_save_button($config["url_path"] . "plugins/mactrack/mactrack_devices.php", "save", "", "device_id");
}else{
mactrack_save_button("cancel", "save", "", "device_id");
}
print "<script type='text/javascript' src='" . URL_PATH . "plugins/mactrack/mactrack_snmp.js'></script>";
}
示例15: if
</td>
<td align="right">
<?php if (read_config_option("auth_method") != 0) { ?>
Logged in as <strong><?php print db_fetch_cell("select username from user_auth where id=" . $_SESSION["sess_user_id"]);?></strong> (<a href="logout.php">Logout</a>)
<?php } ?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#f5f5f5" colspan="1" height="8" width="135" style="background-image: url(images/shadow_gray.gif); background-repeat: repeat-x; border-right: #aaaaaa 1px solid;">
<img src="images/transparent_line.gif" width="135" height="2" border="0"><br>
</td>
<td colspan="2" height="8" style="background-image: url(images/shadow.gif); background-repeat: repeat-x;" bgcolor="#ffffff">
</td>
</tr>
<tr>
<td valign="top" colspan="1" rowspan="2" width="135" style="padding: 5px; border-right: #aaaaaa 1px solid;" bgcolor='#f5f5f5'>
<table bgcolor="#f5f5f5" width="100%" cellpadding="1" cellspacing="0" border="0">
<?php draw_menu();?>
</table>
<img src="images/transparent_line.gif" width="135" height="5" border="0"><br>
<p align="center"><a href='about.php'><img src="images/cacti_logo.gif" border="0"></a></p>
<img src="images/transparent_line.gif" width="135" height="5" border="0"><br>
</td>
<td width="100%" colspan="2" valign="top" style="padding: 5px; border-right: #aaaaaa 1px solid;"><?php display_output_messages();?>