本文整理汇总了PHP中get_browser_query_string函数的典型用法代码示例。如果您正苦于以下问题:PHP get_browser_query_string函数的具体用法?PHP get_browser_query_string怎么用?PHP get_browser_query_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_browser_query_string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: finalize_timespan
function finalize_timespan(&$timespan)
{
if (!isset($timespan["current_value_date1"])) {
/* Default end date is now default time span */
$timespan["current_value_date1"] = date("Y-m-d H:i", $timespan["begin_now"]);
}
if (!isset($timespan["current_value_date2"])) {
/* Default end date is now */
$timespan["current_value_date2"] = date("Y-m-d H:i", $timespan["end_now"]);
}
/* correct bad dates on calendar */
if ($timespan["end_now"] < $timespan["begin_now"]) {
set_preset_timespan($timespan);
$_SESSION["sess_current_timespan"] = read_graph_config_option("default_timespan");
$timespan["current_value_date1"] = date("Y-m-d H:i", $timespan["begin_now"]);
$timespan["current_value_date2"] = date("Y-m-d H:i", $timespan["end_now"]);
}
/* if moved to future although not allow by settings, stop at current time */
if ($timespan["end_now"] > time() && read_graph_config_option("allow_graph_dates_in_future") == "") {
$timespan["end_now"] = time();
# convert end time to human readable format
$timespan["current_value_date2"] = date("Y-m-d H:i", $timespan["end_now"]);
}
$_SESSION["sess_current_timespan_end_now"] = $timespan["end_now"];
$_SESSION["sess_current_timespan_begin_now"] = $timespan["begin_now"];
$_SESSION["sess_current_date1"] = $timespan["current_value_date1"];
$_SESSION["sess_current_date2"] = $timespan["current_value_date2"];
$timespan_sel_pos = strpos(get_browser_query_string(), "&predefined_timespan");
if ($timespan_sel_pos) {
$_SESSION["urlval"] = substr(get_browser_query_string(), 0, $timespan_sel_pos);
} else {
$_SESSION["urlval"] = get_browser_query_string();
}
}
示例2: syslog_messages
/** function syslog_messages()
* This is the main page display function in Syslog. Displays all the
* syslog messages that are relevant to Syslog.
*/
function syslog_messages($tab = "syslog")
{
global $colors, $sql_where, $hostfilter, $severities;
global $config, $syslog_incoming_config, $reset_multi, $syslog_levels;
include "./include/global_arrays.php";
/* force the initial timespan to be 30 minutes for performance reasons */
if (!isset($_SESSION["sess_syslog_init"])) {
$_SESSION["sess_current_timespan"] = 1;
$_SESSION["sess_syslog_init"] = 1;
}
if (file_exists("./lib/timespan_settings.php")) {
include "./lib/timespan_settings.php";
} else {
include "./include/html/inc_timespan_settings.php";
}
include dirname(__FILE__) . "/config.php";
/* create the custom css and javascript for the page */
generate_syslog_cssjs();
$url_curr_page = get_browser_query_string();
$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"];
}
$syslog_messages = get_syslog_messages($sql_where, $row_limit, $tab);
$total_rows = syslog_filter($sql_where, $tab);
/* generate page list */
$url_page_select = get_page_list($_REQUEST["page"], MAX_DISPLAY_PAGES, $row_limit, $total_rows, "syslog.php?tab={$tab}");
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.php?tab={$tab}&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.php?tab={$tab}&page=" . ($_REQUEST["page"] + 1) . "'>";
}
$nav .= "Next";
if ($_REQUEST["page"] * $row_limit < $total_rows) {
$nav .= "</a>";
}
$nav .= " >></strong>\n\t\t\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n";
} else {
$nav = "<tr bgcolor='#" . $colors["header"] . "' class='noprint'>\n\t\t\t\t\t<td colspan='22'>\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='center' class='textHeaderDark'>\n\t\t\t\t\t\t\t\t\tNo Rows Found\n\t\t\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n";
}
print $nav;
if ($tab == "syslog") {
if (api_plugin_user_realm_auth('syslog_alerts.php')) {
$display_text = array("nosortt" => array("Actions", "ASC"), "host_id" => array("Host", "ASC"), "logtime" => array("Date", "ASC"), "message" => array("Message", "ASC"), "facility_id" => array("Facility", "ASC"), "priority_id" => array("Priority", "ASC"));
} else {
$display_text = array("host_id" => array("Host", "ASC"), "logtime" => array("Date", "ASC"), "message" => array("Message", "ASC"), "facility_id" => array("Facility", "ASC"), "priority_id" => array("Priority", "ASC"));
}
html_header_sort($display_text, $_REQUEST["sort_column"], $_REQUEST["sort_direction"]);
$hosts = array_rekey(syslog_db_fetch_assoc("SELECT host_id, host FROM `" . $syslogdb_default . "`.`syslog_hosts`"), "host_id", "host");
$facilities = array_rekey(syslog_db_fetch_assoc("SELECT facility_id, facility FROM `" . $syslogdb_default . "`.`syslog_facilities`"), "facility_id", "facility");
$priorities = array_rekey(syslog_db_fetch_assoc("SELECT priority_id, priority FROM `" . $syslogdb_default . "`.`syslog_priorities`"), "priority_id", "priority");
$i = 0;
if (sizeof($syslog_messages) > 0) {
foreach ($syslog_messages as $syslog_message) {
$title = "'" . str_replace("\"", "", str_replace("'", "", $syslog_message["message"])) . "'";
$tip_options = "CLICKCLOSE, 'true', WIDTH, '40', DELAY, '500', FOLLOWMOUSE, 'true', FADEIN, 450, FADEOUT, 450, BGCOLOR, '#F9FDAF', STICKY, 'true', SHADOWCOLOR, '#797C6E', TITLE, 'Message'";
syslog_row_color($colors["alternate"], $colors["light"], $i, $priorities[$syslog_message["priority_id"]], $title);
$i++;
if (api_plugin_user_realm_auth('syslog_alerts.php')) {
print "<td style='whitspace-nowrap;width:1%;'>";
if ($syslog_message['mtype'] == 'main') {
print "<a href='syslog_alerts.php?id=" . $syslog_message[$syslog_incoming_config["id"]] . "&date=" . $syslog_message["logtime"] . "&action=newedit&type=0'><img src='images/green.gif' align='absmiddle' border=0></a>\n\t\t\t\t\t\t<a href='syslog_removal.php?id=" . $syslog_message[$syslog_incoming_config["id"]] . "&date=" . $syslog_message["logtime"] . "&action=newedit&type=new&type=0'><img src='images/red.gif' align='absmiddle' border=0></a>\n";
}
print "</td>\n";
}
print "<td>" . $hosts[$syslog_message["host_id"]] . "</td>\n";
print "<td>" . $syslog_message["logtime"] . "</td>\n";
print "<td>" . (strlen($_REQUEST["filter"]) ? eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", title_trim($syslog_message[$syslog_incoming_config["textField"]], get_request_var_request("trimval"))) : title_trim($syslog_message[$syslog_incoming_config["textField"]], get_request_var_request("trimval"))) . "</td>\n";
print "<td>" . ucfirst($facilities[$syslog_message["facility_id"]]) . "</td>\n";
print "<td>" . ucfirst($priorities[$syslog_message["priority_id"]]) . "</td>\n";
}
} else {
print "<tr><td><em>No Messages</em></td></tr>";
}
print $nav;
html_end_box(false);
syslog_syslog_legend();
} else {
$display_text = array("name" => array("Alert Name", "ASC"), "severity" => array("Severity", "ASC"), "count" => array("Count", "ASC"), "logtime" => array("Date", "ASC"), "logmsg" => array("Message", "ASC"), "slhost" => array("Host", "ASC"), "facility" => array("Facility", "ASC"), "priority" => array("Priority", "ASC"));
html_header_sort($display_text, $_REQUEST["sort_column"], $_REQUEST["sort_direction"]);
$i = 0;
if (sizeof($syslog_messages) > 0) {
foreach ($syslog_messages as $log) {
$title = "'" . str_replace("\"", "", str_replace("'", "", $log["logmsg"])) . "'";
//.........这里部分代码省略.........
示例3: finalize_timespan
function finalize_timespan(&$timespan) {
if (!isset($timespan["current_value_date1"])) {
/* Default end date is now default time span */
$timespan["current_value_date1"] = date("Y", $timespan["begin_now"]) . "-" . date("m", $timespan["begin_now"]) . "-" . date("d", $timespan["begin_now"]) . " " . date("H", $timespan["begin_now"]) . ":".date("i", $timespan["begin_now"]);
}
if (!isset($timespan["current_value_date2"])) {
/* Default end date is now */
$timespan["current_value_date2"] = date("Y", $timespan["end_now"]) . "-" . date("m", $timespan["end_now"]) . "-" . date("d", $timespan["end_now"]) . " " . date("H", $timespan["end_now"]) . ":" . date("i", $timespan["end_now"]);
}
/* correct bad dates on calendar */
if ($timespan["end_now"] < $timespan["begin_now"]) {
set_preset_timespan($timespan);
$_SESSION["sess_current_timespan"] = read_graph_config_option("default_timespan");
$timespan["current_value_date1"] = date("Y", $timespan["begin_now"]) . "-" . date("m", $timespan["begin_now"]) . "-" . date("d", $timespan["begin_now"]) . " " . date("H", $timespan["begin_now"]) . ":".date("i", $timespan["begin_now"]);
$timespan["current_value_date2"] = date("Y", $timespan["end_now"]) . "-" . date("m", $timespan["end_now"]) . "-" . date("d", $timespan["end_now"]) . " " . date("H", $timespan["end_now"]) . ":" . date("i", $timespan["end_now"]);
}
$_SESSION["sess_current_timespan_end_now"] = $timespan["end_now"];
$_SESSION["sess_current_timespan_begin_now"] = $timespan["begin_now"];
$_SESSION["sess_current_date1"] = $timespan["current_value_date1"];
$_SESSION["sess_current_date2"] = $timespan["current_value_date2"];
$timespan_sel_pos = strpos(get_browser_query_string(),"&predefined_timespan");
if ($timespan_sel_pos) {
$_SESSION["urlval"] = substr(get_browser_query_string(),0,$timespan_sel_pos);
}else {
$_SESSION["urlval"] = get_browser_query_string();
}
}
示例4: array_to_sql_or
$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"] = "";
$_REQUEST["host_id"] = "0";
$set_rra_id = empty($rra_id) ? read_graph_config_option("default_rra_id") : get_request_var("rra_id");
}
}
}
$sql_base = "FROM (graph_templates_graph,graph_local)\r\n\t\t{$sql_join}\r\n\t\t{$sql_where}\r\n\t\t" . (empty($sql_where) ? "WHERE" : "AND") . " graph_templates_graph.local_graph_id > 0\r\n\t\tAND graph_templates_graph.local_graph_id=graph_local.id\r\n\t\tAND graph_templates_graph.title_cache like '%%" . get_request_var_request("filter") . "%%'\r\n\t\t" . (empty($_REQUEST["host_id"]) ? "" : " and graph_local.host_id=" . get_request_var_request("host_id")) . "\r\n\t\t" . (empty($_REQUEST["graph_template_id"]) ? "" : " and graph_local.graph_template_id=" . get_request_var_request("graph_template_id")) . "\r\n\t\t{$sql_or}";
$total_rows = count(db_fetch_assoc("SELECT " . "graph_templates_graph.local_graph_id " . $sql_base));
$graphs = db_fetch_assoc("SELECT " . "graph_templates_graph.local_graph_id, " . "graph_templates_graph.height, " . "graph_templates_graph.title_cache " . $sql_base . " " . "GROUP BY graph_templates_graph.local_graph_id " . "ORDER BY graph_templates_graph.title_cache " . "limit " . $_REQUEST["rows"] * ($_REQUEST["page"] - 1) . "," . $_REQUEST["rows"]);
/* 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=" . get_request_var_request("page"), "page=<PAGE>", get_browser_query_string());
} else {
$nav_url = get_browser_query_string() . (substr_count(get_browser_query_string(), "?") ? "&" : "?") . "page=<PAGE>&host_id=" . get_request_var_request("host_id");
}
$nav_url = preg_replace("/((\\?|&)host_id=[0-9]+|(\\?|&)filter=[a-zA-Z0-9]*)/", "", $nav_url);
html_start_box("", "100%", $colors["header"], "1", "center", "");
html_nav_bar($colors["header"], read_graph_config_option("num_columns"), get_request_var_request("page"), $_REQUEST["rows"], $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());
}
html_nav_bar($colors["header"], read_graph_config_option("num_columns"), get_request_var_request("page"), $_REQUEST["rows"], $total_rows, $nav_url);
html_end_box();
break;
case 'list':
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>";
示例5: draw_navigation_text
//.........这里部分代码省略.........
$current_mappings = explode(',', $current_array['mapping']);
$current_nav = "<ul id='breadcrumbs'>";
$title = '';
$nav_count = 0;
/* resolve all mappings to build the navigation string */
for ($i = 0; $i < count($current_mappings); $i++) {
if (empty($current_mappings[$i])) {
continue;
}
if ($i == 0) {
/* always use the default for level == 0 */
$url = $nav[$current_mappings[$i]]['url'];
if (basename($url) == 'graph_view.php') {
continue;
}
} elseif (isset($nav_level_cache[$i]) && !empty($nav_level_cache[$i]['url'])) {
/* found a match in the url cache for this level */
$url = $nav_level_cache[$i]['url'];
} elseif (!empty($current_array['url'])) {
/* found a default url in the above array */
$url = $current_array['url'];
} else {
/* default to no url */
$url = '';
}
if ($current_mappings[$i] == '?') {
/* '?' tells us to pull title from the cache at this level */
if (isset($nav_level_cache[$i])) {
$current_nav .= (empty($url) ? '' : "<li><a id='nav_{$i}' href='" . htmlspecialchars($url) . "'>") . htmlspecialchars(resolve_navigation_variables($nav[$nav_level_cache[$i]['id']]['title'])) . (empty($url) ? '' : '</a>' . (read_config_option('selected_theme') == 'classic' ? ' -> ' : '') . '</li>');
$title .= htmlspecialchars(resolve_navigation_variables($nav[$nav_level_cache[$i]['id']]['title'])) . ' -> ';
}
} else {
/* there is no '?' - pull from the above array */
$current_nav .= (empty($url) ? '' : "<li><a id='nav_{$i}' href='" . htmlspecialchars($url) . "'>") . htmlspecialchars(resolve_navigation_variables($nav[$current_mappings[$i]]['title'])) . (empty($url) ? '' : '</a>' . (read_config_option('selected_theme') == 'classic' ? ' -> ' : '') . '</li>');
$title .= htmlspecialchars(resolve_navigation_variables($nav[$current_mappings[$i]]['title'])) . ' -> ';
}
$nav_count++;
}
if ($nav_count) {
$current_nav .= "<li><a id='nav_{$i}' href=#>" . htmlspecialchars(resolve_navigation_variables($current_array['title'])) . '</a></li>';
} else {
$current_array = $nav[$current_page . ':' . $current_action];
$url = isset($current_array['url']) ? $current_array['url'] : '';
$current_nav .= "<li><a id='nav_{$i}' href='{$url}'>" . htmlspecialchars(resolve_navigation_variables($current_array['title'])) . '</a></li>';
}
if (isset($_REQUEST['tree_id']) || isset($_REQUEST['leaf_id'])) {
$leaf_sub = '';
$leaf_name = '';
$tree_name = '';
if (isset($_REQUEST['leaf_id']) && $_REQUEST['leaf_id'] != '') {
$leaf = db_fetch_row_prepared('SELECT * FROM graph_tree_items WHERE id = ?', array($_REQUEST['leaf_id']));
if (sizeof($leaf)) {
if ($leaf['host_id'] > 0) {
$leaf_name = db_fetch_cell_prepared('SELECT description FROM host WHERE id = ?', array($leaf['host_id']));
} else {
$leaf_name = $leaf['title'];
}
$tree_name = db_fetch_cell_prepared('SELECT name FROM graph_tree WHERE id = ?', array($leaf['graph_tree_id']));
} else {
$leaf_name = 'Leaf';
}
if (isset($_REQUEST['host_group_data']) && $_REQUEST['host_group_data'] != '') {
$parts = explode(':', $_REQUEST['host_group_data']);
input_validate_input_number($parts[1]);
if ($parts[0] == 'graph_template') {
$leaf_sub = db_fetch_cell_prepared('SELECT name FROM graph_templates WHERE id = ?', array($parts[1]));
} else {
if ($parts[1] > 0) {
$leaf_sub = db_fetch_cell_prepared('SELECT name FROM snmp_query WHERE id = ?', array($parts[1]));
} else {
$leaf_sub = 'Non Query Based';
}
}
} else {
$leaf_sub = '';
}
} else {
$leaf_name = '';
if (isset($_REQUEST['tree_id'])) {
$tree_name = db_fetch_cell_prepared('SELECT name FROM graph_tree WHERE id = ?', array($_REQUEST['tree_id']));
} else {
$tree_name = '';
}
}
$tree_title = $tree_name . ($leaf_name != '' ? ' (' . $leaf_name : '') . ($leaf_sub != '' ? ':' . $leaf_sub . ')' : ($leaf_name != '' ? ')' : ''));
$current_nav .= "<li><a id='nav_title' href=#>" . htmlspecialchars($tree_title) . '</a></li></ul>';
} else {
$current_nav .= '</ul>';
$tree_title = '';
}
$title .= htmlspecialchars(resolve_navigation_variables($current_array['title']) . ' ' . $tree_title);
/* keep a cache for each level we encounter */
$nav_level_cache[$current_array['level']] = array('id' => $current_page . ':' . $current_action, 'url' => get_browser_query_string());
$_SESSION['sess_nav_level_cache'] = $nav_level_cache;
if ($type == 'url') {
return $current_nav;
} else {
return $title;
}
}
示例6: array_to_sql_or
}
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');
$set_rra_id = empty($rra_id) ? read_graph_config_option('default_rra_id') : get_request_var_request('rra_id');
}
}
}
$sql_base = "FROM (graph_templates_graph,graph_local)\n\t\t{$sql_join}\n\t\t{$sql_where}\n\t\t" . (empty($sql_where) ? 'WHERE' : 'AND') . " graph_templates_graph.local_graph_id > 0\n\t\tAND graph_templates_graph.local_graph_id=graph_local.id\n\t\tAND graph_templates_graph.title_cache like '%%" . get_request_var_request('filter') . "%%'\n\t\t" . (empty($_REQUEST['host_id']) ? '' : ' and graph_local.host_id=' . get_request_var_request('host_id')) . "\n\t\t" . (empty($_REQUEST['graph_template_id']) ? '' : ' and graph_local.graph_template_id=' . get_request_var_request('graph_template_id')) . "\n\t\t{$sql_or}";
$total_rows = count(db_fetch_assoc('SELECT ' . 'graph_templates_graph.local_graph_id ' . $sql_base));
$graphs = db_fetch_assoc('SELECT ' . 'graph_templates_graph.local_graph_id, ' . 'graph_templates_graph.height, ' . 'graph_templates_graph.width, ' . 'graph_templates_graph.title_cache ' . $sql_base . ' ' . 'GROUP BY graph_templates_graph.local_graph_id ' . 'ORDER BY graph_templates_graph.title_cache ' . 'limit ' . $_REQUEST['rows'] * ($_REQUEST['page'] - 1) . ',' . $_REQUEST['rows']);
/* do some fancy navigation url construction so we don't have to try and rebuild the url string */
if (preg_match('/page=[0-9]+/', basename($_SERVER['QUERY_STRING']))) {
$nav_url = str_replace('&page=' . get_request_var_request('page'), '', get_browser_query_string());
} else {
$nav_url = get_browser_query_string() . '&host_id=' . get_request_var_request('host_id');
}
$nav_url = preg_replace('/((\\?|&)host_id=[0-9]+|(\\?|&)filter=[a-zA-Z0-9]*)/', '', $nav_url);
html_start_box('', '100%', "", '3', 'center', '');
$nav = html_nav_bar($nav_url, MAX_DISPLAY_PAGES, get_request_var_request("page"), get_request_var_request("rows"), $total_rows, get_request_var_request('columns'), "Graphs", 'page', 'main');
print $nav;
if (get_request_var_request('thumbnails') == 'true') {
html_graph_thumbnail_area($graphs, '', 'graph_start=' . get_current_graph_start() . '&graph_end=' . get_current_graph_end(), '', get_request_var_request('columns'));
} else {
html_graph_area($graphs, '', 'graph_start=' . get_current_graph_start() . '&graph_end=' . get_current_graph_end(), '', get_request_var_request('columns'));
}
print $nav;
html_end_box();
if (!isset($_REQUEST['header']) || $_REQUEST['header'] == false) {
include_once './include/bottom_footer.php';
}
示例7: draw_navigation_text
//.........这里部分代码省略.........
"presets_cdef.php:remove" => array(
"title" => _("(Remove)"),
"mapping" => "index.php:,presets.php:,presets.php:view_cdef",
"level" => "3"
),
"presets_cdef.php:item_edit" => array(
"title" => _("CDEF Items"),
"mapping" => "index.php:,presets.php:,presets.php:view_cdef,presets_cdef.php:edit",
"level" => "4"
),
"presets_color.php:edit" => array(
"title" => _("(Edit)"),
"mapping" => "index.php:,presets.php:,presets.php:view_color",
"level" => "3"
),
"presets_gprint.php:edit" => array(
"title" => _("(Edit)"),
"mapping" => "index.php:,presets.php:,presets.php:view_gprint",
"level" => "3"
),
"presets_gprint.php:remove" => array(
"title" => _("(Remove)"),
"mapping" => "index.php:,presets.php:,presets.php:view_gprint",
"level" => "3"
),
"logs.php:" => array(
"title" => _("Log Management"),
"mapping" => "index.php:",
"level" => "1"
),
"logs.php:view" => array(
"title" => _("View"),
"mapping" => "index.php:,logs.php:",
"level" => "2"
),
"logs.php:save" => array(
"title" => _("View"),
"mapping" => "index.php:,logs.php:",
"level" => "2"
),
"plugins.php:" => array(
"title" => _("Plugins"),
"mapping" => "index.php:",
"level" => "1"
),
"auth_user.php:" => array(
"title" => _("Users"),
"mapping" => "index.php:",
"level" => "1"
),
"auth_group.php:" => array(
"title" => _("Users"),
"mapping" => "index.php:",
"level" => "1"
)
);
$current_page = basename($_SERVER["PHP_SELF"]);
$current_action = (isset($_REQUEST["action"]) ? $_REQUEST["action"] : "");
/* find the current page in the big array */
$current_array = $nav{$current_page . ":" . $current_action};
$current_mappings = explode(",", $current_array["mapping"]);
$current_nav = "";
/* resolve all mappings to build the navigation string */
for ($i=0; ($i<count($current_mappings)); $i++) {
if (empty($current_mappings[$i])) { continue; }
if (isset($nav{$current_mappings[$i]}["url"])) {
/* always use the default for level == 0 */
$url = $nav{$current_mappings[$i]}["url"];
}elseif (!empty($nav_level_cache{$i}["url"])) {
/* found a match in the url cache for this level */
$url = $nav_level_cache{$i}["url"];
}else{
/* default to no url */
$url = "";
}
if ($current_mappings[$i] == "?") {
/* '?' tells us to pull title from the cache at this level */
if (isset($nav_level_cache{$i})) {
$current_nav .= (empty($url) ? "" : "<a href='$url'>") . resolve_navigation_variables($nav{$nav_level_cache{$i}["id"]}["title"]) . (empty($url) ? "" : "</a>") . " -> ";
}
}else{
/* there is no '?' - pull from the above array */
$current_nav .= (empty($url) ? "" : "<a href='$url'>") . resolve_navigation_variables($nav{$current_mappings[$i]}["title"]) . (empty($url) ? "" : "</a>") . " -> ";
}
}
$current_nav .= resolve_navigation_variables($current_array["title"]);
/* keep a cache for each level we encounter */
$nav_level_cache{$current_array["level"]} = array("id" => $current_page . ":" . $current_action, "url" => get_browser_query_string());
$_SESSION["sess_nav_level_cache"] = $nav_level_cache;
print $current_nav;
}
示例8: draw_navigation_text
function draw_navigation_text($type = "url")
{
global $config;
$nav_level_cache = isset($_SESSION["sess_nav_level_cache"]) ? $_SESSION["sess_nav_level_cache"] : array();
$nav = array("graph_view.php:" => array("title" => "Graphs", "mapping" => "", "url" => "graph_view.php", "level" => "0"), "graph_view.php:tree" => array("title" => "Tree Mode", "mapping" => "graph_view.php:", "url" => "graph_view.php?action=tree", "level" => "1"), "graph_view.php:list" => array("title" => "List Mode", "mapping" => "graph_view.php:", "url" => "graph_view.php?action=list", "level" => "1"), "graph_view.php:preview" => array("title" => "Preview Mode", "mapping" => "graph_view.php:", "url" => "graph_view.php?action=preview", "level" => "1"), "graph.php:" => array("title" => "|current_graph_title|", "mapping" => "graph_view.php:,?", "level" => "2"), "graph.php:view" => array("title" => "|current_graph_title|", "mapping" => "graph_view.php:,?", "level" => "2"), "graph.php:zoom" => array("title" => "Zoom", "mapping" => "graph_view.php:,?,graph.php:view", "level" => "3"), "graph.php:properties" => array("title" => "Properties", "mapping" => "graph_view.php:,?,graph.php:view", "level" => "3"), "graph_settings.php:" => array("title" => "Settings", "mapping" => "graph_view.php:", "url" => "graph_settings.php", "level" => "1"), "index.php:" => array("title" => "Console", "mapping" => "", "url" => $config['url_path'] . "index.php", "level" => "0"), "index.php:login" => array("title" => "Console", "mapping" => "", "url" => $config['url_path'] . "index.php", "level" => "0"), "graphs.php:" => array("title" => "Graph Management", "mapping" => "index.php:", "url" => "graphs.php", "level" => "1"), "graphs.php:graph_edit" => array("title" => "(Edit)", "mapping" => "index.php:,graphs.php:", "url" => "", "level" => "2"), "graphs.php:graph_diff" => array("title" => "Change Graph Template", "mapping" => "index.php:,graphs.php:,graphs.php:graph_edit", "url" => "", "level" => "3"), "graphs.php:actions" => array("title" => "Actions", "mapping" => "index.php:,graphs.php:", "url" => "", "level" => "2"), "graphs_items.php:item_edit" => array("title" => "Graph Items", "mapping" => "index.php:,graphs.php:,graphs.php:graph_edit", "url" => "", "level" => "3"), "graphs_new.php:" => array("title" => "Create New Graphs", "mapping" => "index.php:", "url" => "graphs_new.php", "level" => "1"), "graphs_new.php:save" => array("title" => "Create Graphs from Data Query", "mapping" => "index.php:,graphs_new.php:", "url" => "", "level" => "2"), "gprint_presets.php:" => array("title" => "GPRINT Presets", "mapping" => "index.php:", "url" => "gprint_presets.php", "level" => "1"), "gprint_presets.php:edit" => array("title" => "(Edit)", "mapping" => "index.php:,gprint_presets.php:", "url" => "", "level" => "2"), "gprint_presets.php:remove" => array("title" => "(Remove)", "mapping" => "index.php:,gprint_presets.php:", "url" => "", "level" => "2"), "cdef.php:" => array("title" => "CDEF's", "mapping" => "index.php:", "url" => "cdef.php", "level" => "1"), "cdef.php:edit" => array("title" => "(Edit)", "mapping" => "index.php:,cdef.php:", "url" => "", "level" => "2"), "cdef.php:remove" => array("title" => "(Remove)", "mapping" => "index.php:,cdef.php:", "url" => "", "level" => "2"), "cdef.php:item_edit" => array("title" => "CDEF Items", "mapping" => "index.php:,cdef.php:,cdef.php:edit", "url" => "", "level" => "3"), "cdef.php:actions" => array("title" => "Actions", "mapping" => "index.php:,cdef.php:", "url" => "", "level" => "2"), "tree.php:" => array("title" => "Graph Trees", "mapping" => "index.php:", "url" => "tree.php", "level" => "1"), "tree.php:edit" => array("title" => "(Edit)", "mapping" => "index.php:,tree.php:", "url" => "", "level" => "2"), "tree.php:remove" => array("title" => "(Remove)", "mapping" => "index.php:,tree.php:", "url" => "", "level" => "2"), "tree.php:item_edit" => array("title" => "Graph Tree Items", "mapping" => "index.php:,tree.php:,tree.php:edit", "url" => "", "level" => "3"), "tree.php:item_remove" => array("title" => "(Remove Item)", "mapping" => "index.php:,tree.php:,tree.php:edit", "url" => "", "level" => "3"), "color.php:" => array("title" => "Colors", "mapping" => "index.php:", "url" => "color.php", "level" => "1"), "color.php:edit" => array("title" => "(Edit)", "mapping" => "index.php:,color.php:", "url" => "", "level" => "2"), "graph_templates.php:" => array("title" => "Graph Templates", "mapping" => "index.php:", "url" => "graph_templates.php", "level" => "1"), "graph_templates.php:template_edit" => array("title" => "(Edit)", "mapping" => "index.php:,graph_templates.php:", "url" => "", "level" => "2"), "graph_templates.php:actions" => array("title" => "Actions", "mapping" => "index.php:,graph_templates.php:", "url" => "", "level" => "2"), "graph_templates_items.php:item_edit" => array("title" => "Graph Template Items", "mapping" => "index.php:,graph_templates.php:,graph_templates.php:template_edit", "url" => "", "level" => "3"), "graph_templates_inputs.php:input_edit" => array("title" => "Graph Item Inputs", "mapping" => "index.php:,graph_templates.php:,graph_templates.php:template_edit", "url" => "", "level" => "3"), "graph_templates_inputs.php:input_remove" => array("title" => "(Remove)", "mapping" => "index.php:,graph_templates.php:,graph_templates.php:template_edit", "url" => "", "level" => "3"), "host_templates.php:" => array("title" => "Host Templates", "mapping" => "index.php:", "url" => "host_templates.php", "level" => "1"), "host_templates.php:edit" => array("title" => "(Edit)", "mapping" => "index.php:,host_templates.php:", "url" => "", "level" => "2"), "host_templates.php:actions" => array("title" => "Actions", "mapping" => "index.php:,host_templates.php:", "url" => "", "level" => "2"), "graph_templates.php:actions" => array("title" => "Actions", "mapping" => "index.php:,graph_templates.php:", "url" => "", "level" => "2"), "data_templates.php:" => array("title" => "Data Templates", "mapping" => "index.php:", "url" => "data_templates.php", "level" => "1"), "data_templates.php:template_edit" => array("title" => "(Edit)", "mapping" => "index.php:,data_templates.php:", "url" => "", "level" => "2"), "data_templates.php:actions" => array("title" => "Actions", "mapping" => "index.php:,data_templates.php:", "url" => "", "level" => "2"), "data_sources.php:" => array("title" => "Data Sources", "mapping" => "index.php:", "url" => "data_sources.php", "level" => "1"), "data_sources.php:ds_edit" => array("title" => "(Edit)", "mapping" => "index.php:,data_sources.php:", "url" => "", "level" => "2"), "data_sources.php:actions" => array("title" => "Actions", "mapping" => "index.php:,data_sources.php:", "url" => "", "level" => "2"), "host.php:" => array("title" => "Devices", "mapping" => "index.php:", "url" => "host.php", "level" => "1"), "host.php:edit" => array("title" => "(Edit)", "mapping" => "index.php:,host.php:", "url" => "", "level" => "2"), "host.php:actions" => array("title" => "Actions", "mapping" => "index.php:,host.php:", "url" => "", "level" => "2"), "rra.php:" => array("title" => "Round Robin Archives", "mapping" => "index.php:", "url" => "rra.php", "level" => "1"), "rra.php:edit" => array("title" => "(Edit)", "mapping" => "index.php:,rra.php:", "url" => "", "level" => "2"), "rra.php:remove" => array("title" => "(Remove)", "mapping" => "index.php:,rra.php:", "url" => "", "level" => "2"), "data_input.php:" => array("title" => "Data Input Methods", "mapping" => "index.php:", "url" => "data_input.php", "level" => "1"), "data_input.php:actions" => array("title" => "Actions", "mapping" => "index.php:,data_input.php:", "url" => "", "level" => "2"), "data_input.php:edit" => array("title" => "(Edit)", "mapping" => "index.php:,data_input.php:", "url" => "", "level" => "2"), "data_input.php:remove" => array("title" => "(Remove)", "mapping" => "index.php:,data_input.php:", "url" => "", "level" => "2"), "data_input.php:field_edit" => array("title" => "Data Input Fields", "mapping" => "index.php:,data_input.php:,data_input.php:edit", "url" => "", "level" => "3"), "data_input.php:field_remove" => array("title" => "(Remove Item)", "mapping" => "index.php:,data_input.php:,data_input.php:edit", "url" => "", "level" => "3"), "data_queries.php:" => array("title" => "Data Queries", "mapping" => "index.php:", "url" => "data_queries.php", "level" => "1"), "data_queries.php:actions" => array("title" => "Actions", "mapping" => "index.php:,data_queries.php:", "url" => "", "level" => "2"), "data_queries.php:edit" => array("title" => "(Edit)", "mapping" => "index.php:,data_queries.php:", "url" => "", "level" => "2"), "data_queries.php:item_edit" => array("title" => "Associated Graph Templates", "mapping" => "index.php:,data_queries.php:,data_queries.php:edit", "url" => "", "level" => "3"), "data_queries.php:item_remove" => array("title" => "(Remove Item)", "mapping" => "index.php:,data_queries.php:,data_queries.php:edit", "url" => "", "level" => "3"), "utilities.php:" => array("title" => "Utilities", "mapping" => "index.php:", "url" => "utilities.php", "level" => "1"), "utilities.php:view_poller_cache" => array("title" => "View Poller Cache", "mapping" => "index.php:,utilities.php:", "url" => "utilities.php", "level" => "2"), "utilities.php:view_snmp_cache" => array("title" => "View SNMP Cache", "mapping" => "index.php:,utilities.php:", "url" => "utilities.php", "level" => "2"), "utilities.php:clear_poller_cache" => array("title" => "Clear Poller Cache", "mapping" => "index.php:,utilities.php:", "url" => "utilities.php", "level" => "2"), "utilities.php:view_logfile" => array("title" => "View Cacti Log File", "mapping" => "index.php:,utilities.php:", "url" => "utilities.php", "level" => "2"), "utilities.php:clear_logfile" => array("title" => "Clear Cacti Log File", "mapping" => "index.php:,utilities.php:", "url" => "utilities.php", "level" => "2"), "utilities.php:view_user_log" => array("title" => "View User Log File", "mapping" => "index.php:,utilities.php:", "url" => "utilities.php", "level" => "2"), "utilities.php:clear_user_log" => array("title" => "Clear User Log File", "mapping" => "index.php:,utilities.php:", "url" => "utilities.php", "level" => "2"), "utilities.php:view_tech" => array("title" => "Technical Support", "mapping" => "index.php:,utilities.php:", "url" => "utilities.php", "level" => "2"), "settings.php:" => array("title" => "Cacti Settings", "mapping" => "index.php:", "url" => "settings.php", "level" => "1"), "user_admin.php:" => array("title" => "User Management", "mapping" => "index.php:", "url" => "user_admin.php", "level" => "1"), "user_admin.php:user_edit" => array("title" => "(Edit)", "mapping" => "index.php:,user_admin.php:", "url" => "", "level" => "2"), "user_admin.php:actions" => array("title" => "(Action)", "mapping" => "index.php:,user_admin.php:", "url" => "", "level" => "2"), "user_admin.php:graph_perms_edit" => array("title" => "Edit (Graph Permissions)", "mapping" => "index.php:,user_admin.php:", "url" => "", "level" => "2"), "user_admin.php:user_realms_edit" => array("title" => "Edit (Realm Permissions)", "mapping" => "index.php:,user_admin.php:", "url" => "", "level" => "2"), "user_admin.php:graph_settings_edit" => array("title" => "Edit (Graph Settings)", "mapping" => "index.php:,user_admin.php:", "url" => "", "level" => "2"), "about.php:" => array("title" => "About Cacti", "mapping" => "index.php:", "url" => "about.php", "level" => "1"), "templates_export.php:" => array("title" => "Export Templates", "mapping" => "index.php:", "url" => "templates_export.php", "level" => "1"), "templates_export.php:save" => array("title" => "Export Results", "mapping" => "index.php:,templates_export.php:", "url" => "templates_export.php", "level" => "2"), "templates_import.php:" => array("title" => "Import Templates", "mapping" => "index.php:", "url" => "templates_import.php", "level" => "1"));
$nav = api_plugin_hook_function('draw_navigation_text', $nav);
$current_page = basename($_SERVER["PHP_SELF"]);
input_validate_input_regex(get_request_var_request("action"), "^([a-zA-Z0-9_-]+)\$");
$current_action = isset($_REQUEST["action"]) ? $_REQUEST["action"] : "";
/* find the current page in the big array */
if (isset($nav[$current_page . ":" . $current_action])) {
$current_array = $nav[$current_page . ":" . $current_action];
} else {
$current_array = array('mapping' => 'index.php:', 'title' => ucwords(str_replace("_", " ", basename($_SERVER['PHP_SELF'], '.php'))), 'level' => 1);
}
$current_mappings = explode(",", $current_array["mapping"]);
$current_nav = "";
$title = "";
/* resolve all mappings to build the navigation string */
for ($i = 0; $i < count($current_mappings); $i++) {
if (empty($current_mappings[$i])) {
continue;
}
if ($i == 0) {
/* always use the default for level == 0 */
$url = $nav[$current_mappings[$i]]["url"];
} elseif (!empty($nav_level_cache[$i]["url"])) {
/* found a match in the url cache for this level */
$url = $nav_level_cache[$i]["url"];
} elseif (!empty($current_array["url"])) {
/* found a default url in the above array */
$url = $current_array["url"];
} else {
/* default to no url */
$url = "";
}
if ($current_mappings[$i] == "?") {
/* '?' tells us to pull title from the cache at this level */
if (isset($nav_level_cache[$i])) {
$current_nav .= (empty($url) ? "" : "<a href='" . htmlspecialchars($url) . "'>") . htmlspecialchars(resolve_navigation_variables($nav[$nav_level_cache[$i]["id"]]["title"])) . (empty($url) ? "" : "</a>") . " -> ";
$title .= htmlspecialchars(resolve_navigation_variables($nav[$nav_level_cache[$i]["id"]]["title"])) . " -> ";
}
} else {
/* there is no '?' - pull from the above array */
$current_nav .= (empty($url) ? "" : "<a href='" . htmlspecialchars($url) . "'>") . htmlspecialchars(resolve_navigation_variables($nav[$current_mappings[$i]]["title"])) . (empty($url) ? "" : "</a>") . " -> ";
$title .= htmlspecialchars(resolve_navigation_variables($nav[$current_mappings[$i]]["title"])) . " -> ";
}
}
$current_nav .= htmlspecialchars(resolve_navigation_variables($current_array["title"]));
$title .= htmlspecialchars(resolve_navigation_variables($current_array["title"]));
/* keep a cache for each level we encounter */
$nav_level_cache[$current_array["level"]] = array("id" => $current_page . ":" . $current_action, "url" => get_browser_query_string());
$_SESSION["sess_nav_level_cache"] = $nav_level_cache;
if ($type == "url") {
return $current_nav;
} else {
return $title;
}
}
示例9: syslog_messages
/** function syslog_messages()
* This is the main page display function in Syslog. Displays all the
* syslog messages that are relevant to Syslog.
*/
function syslog_messages($tab = 'syslog')
{
global $sql_where, $hostfilter, $severities;
global $config, $syslog_incoming_config, $reset_multi, $syslog_levels;
include dirname(__FILE__) . '/config.php';
include './include/global_arrays.php';
/* force the initial timespan to be 30 minutes for performance reasons */
if (!isset($_SESSION['sess_syslog_init'])) {
$_SESSION['sess_current_timespan'] = 1;
$_SESSION['sess_syslog_init'] = 1;
}
$url_curr_page = get_browser_query_string();
$sql_where = '';
if (get_request_var('rows') == -1) {
$row_limit = read_config_option('num_rows_table');
} elseif (get_request_var('rows') == -2) {
$row_limit = 999999;
} else {
$row_limit = get_request_var('rows');
}
$syslog_messages = get_syslog_messages($sql_where, $row_limit, $tab);
syslog_filter($sql_where, $tab);
if ($tab == 'syslog') {
if (get_request_var('removal') == 1) {
$total_rows = syslog_db_fetch_cell("SELECT SUM(totals)\n\t\t\t\tFROM (\n\t\t\t\t\tSELECT count(*) AS totals\n\t\t\t\t\tFROM `" . $syslogdb_default . "`.`syslog` AS syslog\n\t\t\t\t\t{$sql_where}\n\t\t\t\t\tUNION\n\t\t\t\t\tSELECT count(*) AS totals\n\t\t\t\t\tFROM `" . $syslogdb_default . "`.`syslog_removed` AS syslog\n\t\t\t\t\t{$sql_where}\n\t\t\t\t) AS rowcount");
} elseif (get_request_var("removal") == -1) {
$total_rows = syslog_db_fetch_cell("SELECT count(*) \n\t\t\t\tFROM `" . $syslogdb_default . "`.`syslog` AS syslog\n\t\t\t\t{$sql_where}");
} else {
$total_rows = syslog_db_fetch_cell("SELECT count(*) \n\t\t\t\tFROM `" . $syslogdb_default . "`.`syslog_removed` AS syslog\n\t\t\t\t{$sql_where}");
}
} else {
$total_rows = syslog_db_fetch_cell("SELECT count(*)\n\t\t\tFROM `" . $syslogdb_default . "`.`syslog_logs` AS syslog\n\t\t\tLEFT JOIN `" . $syslogdb_default . "`.`syslog_facilities` AS sf\n\t\t\tON syslog.facility_id=sf.facility_id \n\t\t\tLEFT JOIN `" . $syslogdb_default . "`.`syslog_priorities` AS sp\n\t\t\tON syslog.priority_id=sp.priority_id \n\t\t\tLEFT JOIN `" . $syslogdb_default . "`.`syslog_alert` AS sa\n\t\t\tON syslog.alert_id=sa.id \n\t\t\tLEFT JOIN `" . $syslogdb_default . "`.`syslog_programs` AS spr\n\t\t\tON syslog.program_id=spr.program_id " . $sql_where);
}
if ($tab == 'syslog') {
$nav = html_nav_bar("syslog.php?tab={$tab}", MAX_DISPLAY_PAGES, get_request_var_request('page'), $row_limit, $total_rows, 7, 'Messages', 'page', 'main');
if (api_plugin_user_realm_auth('syslog_alerts.php')) {
$display_text = array('nosortt' => array(__('Actions'), 'ASC'), 'logtime' => array(__('Date'), 'ASC'), 'host_id' => array(__('Host'), 'ASC'), 'program' => array(__('Program'), 'ASC'), 'message' => array(__('Message'), 'ASC'), 'facility_id' => array(__('Facility'), 'ASC'), 'priority_id' => array(__('Priority'), 'ASC'));
} else {
$display_text = array('logtime' => array(__('Date'), 'ASC'), 'host_id' => array(__('Host'), 'ASC'), 'program' => array(__('Program'), 'ASC'), 'message' => array(__('Message'), 'ASC'), 'facility_id' => array(__('Facility'), 'ASC'), 'priority_id' => array(__('Priority'), 'ASC'));
}
print $nav;
html_start_box('', '100%', '', '3', 'center', '');
html_header_sort($display_text, get_request_var('sort_column'), get_request_var('sort_direction'));
$hosts = array_rekey(syslog_db_fetch_assoc('SELECT host_id, host FROM `' . $syslogdb_default . '`.`syslog_hosts`'), 'host_id', 'host');
$facilities = array_rekey(syslog_db_fetch_assoc('SELECT facility_id, facility FROM `' . $syslogdb_default . '`.`syslog_facilities`'), 'facility_id', 'facility');
$priorities = array_rekey(syslog_db_fetch_assoc('SELECT priority_id, priority FROM `' . $syslogdb_default . '`.`syslog_priorities`'), 'priority_id', 'priority');
if (sizeof($syslog_messages)) {
foreach ($syslog_messages as $syslog_message) {
$title = htmlspecialchars($syslog_message['message'], ENT_QUOTES);
syslog_row_color($syslog_message['priority_id'], $title);
if (api_plugin_user_realm_auth('syslog_alerts.php')) {
print "<td class='nowrap left' style='width:1%:padding:1px !important;'>";
if ($syslog_message['mtype'] == 'main') {
print "<a style='padding:1px' href='" . htmlspecialchars('syslog_alerts.php?id=' . $syslog_message[$syslog_incoming_config['id']] . '&action=newedit&type=0') . "'><img src='images/add.png' border='0'></a>\n\t\t\t\t\t\t<a style='padding:1px' href='" . htmlspecialchars('syslog_removal.php?id=' . $syslog_message[$syslog_incoming_config['id']] . '&action=newedit&type=new&type=0') . "'><img src='images/delete.png' border='0'></a>\n";
}
print "</td>\n";
}
print '<td class="left nowrap">' . $syslog_message['logtime'] . "</td>\n";
print '<td class="left nowrap">' . $hosts[$syslog_message['host_id']] . "</td>\n";
print '<td class="left nowrap">' . $syslog_message['program'] . "</td>\n";
print '<td class="left syslogMessage">' . filter_value(title_trim($syslog_message[$syslog_incoming_config['textField']], get_request_var_request('trimval')), get_request_var('filter')) . "</td>\n";
print '<td class="left nowrap">' . ucfirst($facilities[$syslog_message['facility_id']]) . "</td>\n";
print '<td class="left nowrap">' . ucfirst($priorities[$syslog_message['priority_id']]) . "</td>\n";
}
} else {
print "<tr><td class='center' colspan='7'><em>" . __('No Syslog Messages') . "</em></td></tr>";
}
html_end_box(false);
if (sizeof($syslog_messages)) {
print $nav;
}
syslog_syslog_legend();
print "<script type='text/javascript'>\$(function() { \$('button').tooltip({ closed: true }).on('focus', function() { \$('#filter').tooltip('close') }).on('click', function() { \$(this).tooltip('close'); }); })</script>\n";
} else {
$nav = html_nav_bar("syslog.php?tab={$tab}", MAX_DISPLAY_PAGES, get_request_var_request('page'), $row_limit, $total_rows, 8, 'Alert Log Rows', 'page', 'main');
print $nav;
$display_text = array('name' => array('display' => __('Alert Name'), 'sort' => 'ASC', 'align' => 'left'), 'severity' => array('display' => __('Severity'), 'sort' => 'ASC', 'align' => 'left'), 'logtime' => array('display' => __('Date'), 'sort' => 'ASC', 'align' => 'left'), 'logmsg' => array('display' => __('Message'), 'sort' => 'ASC', 'align' => 'left'), 'count' => array('display' => __('Count'), 'sort' => 'ASC', 'align' => 'right'), 'host' => array('display' => __('Host'), 'sort' => 'ASC', 'align' => 'right'), 'facility_id' => array('display' => __('Facility'), 'sort' => 'ASC', 'align' => 'right'), 'priority_id' => array('display' => __('Priority'), 'sort' => 'ASC', 'align' => 'right'));
html_start_box('', '100%', '', '3', 'center', '');
html_header_sort($display_text, get_request_var('sort_column'), get_request_var('sort_direction'));
if (sizeof($syslog_messages)) {
foreach ($syslog_messages as $log) {
$title = htmlspecialchars($log['logmsg'], ENT_QUOTES);
syslog_row_color($log['severity'], $title);
print "<td class='left'><a class='linkEditMain' href='" . htmlspecialchars($config['url_path'] . 'plugins/syslog/syslog.php?id=' . $log['seq'] . '&tab=current') . "'>" . (strlen($log['name']) ? $log['name'] : 'Alert Removed') . "</a></td>\n";
print '<td class="left nowrap">' . (isset($severities[$log['severity']]) ? $severities[$log['severity']] : 'Unknown') . "</td>\n";
print '<td class="left nowrap">' . $log['logtime'] . "</td>\n";
print '<td class="left syslogMessage">' . filter_value(title_trim($log['logmsg'], get_request_var_request('trimval')), get_request_var('filter')) . "</td>\n";
print '<td class="right nowrap">' . $log['count'] . "</td>\n";
print '<td class="right nowrap">' . $log['host'] . "</td>\n";
print '<td class="right nowrap">' . ucfirst($log['facility']) . "</td>\n";
print '<td class="right nowrap">' . ucfirst($log['priority']) . "</td>\n";
print "</tr>\n";
}
} else {
print "<tr><td colspan='11'><em>" . __('No Alert Log Messages') . "</em></td></tr>";
}
//.........这里部分代码省略.........
示例10: hmib_view_graphs
function hmib_view_graphs()
{
global $current_user, $colors, $config, $host_template_hashes, $graph_template_hashes;
include './lib/timespan_settings.php';
include './lib/html_graph.php';
html_graph_validate_preview_request_vars();
if (!isset($_SESSION['sess_hmib_gt'])) {
$_SESSION['sess_hmib_gt'] = implode(',', array_rekey(db_fetch_assoc('SELECT DISTINCT gl.graph_template_id
FROM graph_local AS gl
WHERE gl.host_id IN(
SELECT host_id
FROM plugin_hmib_hrSystem
)'), 'graph_template_id', 'graph_template_id'));
}
$gt = $_SESSION['sess_hmib_gt'];
if (!isset($_SESSION['sess_hmib_hosts'])) {
$_SESSION['sess_hmib_hosts'] = implode(',', array_rekey(db_fetch_assoc('SELECT h.id
FROM host AS h
WHERE h.id IN (
SELECT host_id
FROM plugin_hmib_hrSystem
)
UNION
SELECT h.id
FROM host AS h
INNER JOIN host_template AS ht
ON h.host_template_id=ht.id
WHERE hash="7c13344910097cc599f0d0485305361d" ORDER BY id DESC'), 'id', 'id'));
}
$hosts = $_SESSION['sess_hmib_hosts'];
/* include graph view filter selector */
html_start_box(__('Graph Preview Filters') . (isset_request_var('style') && strlen(get_request_var('style')) ? ' [ ' . __('Custom Graph List Applied - Filtering from List') . ' ]' : ''), '100%', '', '3', 'center', '');
html_graph_preview_filter('hmib.php', 'graphs', "h.id IN ({$hosts})", "gt.id IN ({$gt})");
html_end_box();
/* the user select a bunch of graphs of the 'list' view and wants them displayed here */
$sql_or = '';
if (isset_request_var('style')) {
if (get_request_var('style') == 'selective') {
/* process selected graphs */
if (!isempty_request_var('graph_list')) {
foreach (explode(',', get_request_var('graph_list')) as $item) {
$graph_list[$item] = 1;
}
} else {
$graph_list = array();
}
if (!isempty_request_var('graph_add')) {
foreach (explode(',', get_request_var('graph_add')) as $item) {
$graph_list[$item] = 1;
}
}
/* remove items */
if (!isempty_request_var('graph_remove')) {
foreach (explode(',', get_request_var('graph_remove')) as $item) {
unset($graph_list[$item]);
}
}
$graph_array = array_keys($graph_list);
if (sizeof($graph_array)) {
$sql_or = array_to_sql_or($graph_array, 'gl.id');
}
}
}
$total_graphs = 0;
// Filter sql_where
$sql_where = strlen(get_request_var('filter')) ? "gtg.title_cache LIKE '%" . get_request_var('filter') . "%'" : '';
$sql_where .= (strlen($sql_or) && strlen($sql_where) ? ' AND ' : '') . $sql_or;
// Host Id sql_where
if (get_request_var('host_id') > 0) {
$sql_where .= (strlen($sql_where) ? ' AND' : '') . ' gl.host_id=' . get_request_var('host_id');
}
// Graph Template Id sql_where
if (get_request_var('graph_template_id') > 0) {
$sql_where .= (strlen($sql_where) ? ' AND' : '') . ' gl.graph_template_id=' . get_request_var('graph_template_id');
}
$limit = get_request_var('graphs') * (get_request_var('page') - 1) . ',' . get_request_var('graphs');
$order = 'gtg.title_cache';
$graphs = get_allowed_graphs($sql_where, $order, $limit, $total_graphs);
/* do some fancy navigation url construction so we don't have to try and rebuild the url string */
if (preg_match('/page=[0-9]+/', basename($_SERVER['QUERY_STRING']))) {
$nav_url = str_replace('&page=' . get_request_var('page'), '', get_browser_query_string());
} else {
$nav_url = get_browser_query_string() . '&host_id=' . get_request_var('host_id');
}
$nav_url = preg_replace('/((\\?|&)host_id=[0-9]+|(\\?|&)filter=[a-zA-Z0-9]*)/', '', $nav_url);
$nav = html_nav_bar($nav_url, MAX_DISPLAY_PAGES, get_request_var('page'), get_request_var('graphs'), $total_graphs, get_request_var('columns'), 'Graphs', 'page', 'main');
print $nav;
html_start_box('', '100%', '', '3', 'center', '');
if (get_request_var('thumbnails') == 'true') {
html_graph_thumbnail_area($graphs, '', 'graph_start=' . get_current_graph_start() . '&graph_end=' . get_current_graph_end(), '', get_request_var('columns'));
} else {
html_graph_area($graphs, '', 'graph_start=' . get_current_graph_start() . '&graph_end=' . get_current_graph_end(), '', get_request_var('columns'));
}
html_end_box();
if ($total_graphs > 0) {
print $nav;
}
bottom_footer();
}
示例11: draw_navigation_text
//.........这里部分代码省略.........
"pollers.php:edit" => array("title" => __("(Edit)"), "mapping" => "index.php:,pollers.php:", "url" => "", "level" => "2"),
"device_templates.php:actions" => array("title" => __("Actions"), "mapping" => "index.php:,device_templates.php:", "url" => "", "level" => "2"),
"device_templates.php:save_dt" => array("title" => __("Actions"), "mapping" => "index.php:,device_templates.php:", "url" => "", "level" => "2"),
"device_templates.php:save_dq" => array("title" => __("Actions"), "mapping" => "index.php:,device_templates.php:", "url" => "", "level" => "2"),
"device_templates.php:" => array("title" => __("Device Templates"), "mapping" => "index.php:", "url" => "device_templates.php", "level" => "1"),
"device_templates.php:edit" => array("title" => __("(Edit)"), "mapping" => "index.php:,device_templates.php:", "url" => "", "level" => "2"),
"index.php:" => array("title" => __("Console"), "mapping" => "", "url" => CACTI_URL_PATH . "index.php", "level" => "0"),
"index.php:login" => array("title" => __("Console"), "mapping" => "", "url" => CACTI_URL_PATH . "index.php", "level" => "0"),
"rra.php:" => array("title" => __("Round Robin Archives"), "mapping" => "index.php:", "url" => "rra.php", "level" => "1"),
"rra.php:edit" => array("title" => __("(Edit)"), "mapping" => "index.php:,rra.php:", "url" => "", "level" => "2"),
"rra.php:actions" => array("title" => __("Actions"), "mapping" => "index.php:,rra.php:", "url" => "", "level" => "2"),
"settings.php:" => array("title" => __("Cacti Settings"), "mapping" => "index.php:", "url" => "settings.php", "level" => "1"),
"settings.php:shift" => array("title" => __("Cacti Settings"), "mapping" => "index.php:", "url" => "settings.php", "level" => "1"),
"templates_export.php:" => array("title" => __("Export Templates"), "mapping" => "index.php:", "url" => "templates_export.php", "level" => "1"),
"templates_export.php:create" => array("title" => __("Export Templates"), "mapping" => "index.php:,templates_export.php:", "url" => "templates_export.php", "level" => "2"),
"templates_export.php:save" => array("title" => __("Export Results"), "mapping" => "index.php:,templates_export.php:", "url" => "templates_export.php", "level" => "2"),
"templates_import.php" => array("title" => __("Import Templates"), "mapping" => "index.php:", "url" => "templates_import.php", "level" => "1"),
"templates_import.php:" => array("title" => __("Import Templates"), "mapping" => "index.php:", "url" => "templates_import.php", "level" => "1"),
"templates_import.php:create" => array("title" => __("Import Templates"), "mapping" => "index.php:,templates_import.php", "url" => "templates_import.php", "level" => "1"),
"tree.php:" => array("title" => __("Graph Trees"), "mapping" => "index.php:", "url" => "tree.php", "level" => "1"),
"tree.php:edit" => array("title" => __("(Edit)"), "mapping" => "index.php:,tree.php:", "url" => "", "level" => "2"),
"tree.php:item_edit" => array("title" => __("Graph Tree Items"), "mapping" => "index.php:,tree.php:,tree.php:edit", "url" => "", "level" => "3"),
"tree.php:item_remove" => array("title" => "(Remove Item)", "mapping" => "index.php:,tree.php:,tree.php:edit", "url" => "", "level" => "3"),
"tree.php:remove" => array("title" => __("(Remove)"), "mapping" => "index.php:,tree.php:", "url" => "", "level" => "2"),
"user_admin.php:actions" => array("title" => "(Action)", "mapping" => "index.php:,user_admin.php:", "url" => "", "level" => "2"),
"user_admin.php:" => array("title" => __("User Management"), "mapping" => "index.php:", "url" => "user_admin.php", "level" => "1"),
"user_admin.php:graph_perms_edit" => array("title" => __("Edit (Graph Permissions)"), "mapping" => "index.php:,user_admin.php:", "url" => "", "level" => "2"),
"user_admin.php:graph_settings_edit" => array("title" => __("Edit (Graph Settings)"), "mapping" => "index.php:,user_admin.php:", "url" => "", "level" => "2"),
"user_admin.php:user_edit" => array("title" => __("(Edit)"), "mapping" => "index.php:,user_admin.php:", "url" => "", "level" => "2"),
"user_admin.php:user_realms_edit" => array("title" => __("Edit (Realm Permissions)"), "mapping" => "index.php:,user_admin.php:", "url" => "", "level" => "2"),
"utilities.php:" => array("title" => __("Utilities"), "mapping" => "index.php:", "url" => "utilities.php", "level" => "1"),
"utilities.php:clear_logfile" => array("title" => __("Clear Cacti Log File"), "mapping" => "index.php:,utilities.php:", "url" => "utilities.php", "level" => "2"),
"utilities.php:clear_poller_cache" => array("title" => __("Clear Poller Cache"), "mapping" => "index.php:,utilities.php:", "url" => "utilities.php", "level" => "2"),
"utilities.php:clear_user_log" => array("title" => __("Clear User Log File"), "mapping" => "index.php:,utilities.php:", "url" => "utilities.php", "level" => "2"),
"utilities.php:view_logfile" => array("title" => __("View Cacti Log File"), "mapping" => "index.php:,utilities.php:", "url" => "utilities.php", "level" => "2"),
"utilities.php:view_poller_cache" => array("title" => __("View Poller Cache"), "mapping" => "index.php:,utilities.php:", "url" => "utilities.php", "level" => "2"),
"utilities.php:view_snmp_cache" => array("title" => __("View SNMP Cache"), "mapping" => "index.php:,utilities.php:", "url" => "utilities.php", "level" => "2"),
"utilities.php:view_tech" => array("title" => __("Technical Support"), "mapping" => "index.php:,utilities.php:", "url" => "utilities.php", "level" => "2"),
"utilities.php:view_user_log" => array("title" => __("View User Log File"), "mapping" => "index.php:,utilities.php:", "url" => "utilities.php", "level" => "2"),
"vdef.php:" => array("title" => __("VDEF's"), "mapping" => "index.php:", "url" => "vdef.php", "level" => "1"),
"vdef.php:actions" => array("title" => __("Actions"), "mapping" => "index.php:,vdef.php:", "url" => "", "level" => "2"),
"vdef.php:edit" => array("title" => __("(Edit)"), "mapping" => "index.php:,vdef.php:", "url" => "", "level" => "2"),
"vdef.php:remove" => array("title" => __("(Remove)"), "mapping" => "index.php:,vdef.php:", "url" => "", "level" => "2"),
"vdef.php:item_edit" => array("title" => __("VDEF Items"), "mapping" => "index.php:,vdef.php:,vdef.php:edit", "url" => "", "level" => "3"),
"xaxis_presets.php:" => array("title" => __("X-Axis Presets"), "mapping" => "index.php:", "url" => "xaxis_presets.php", "level" => "1"),
"xaxis_presets.php:edit" => array("title" => __("(Edit)"), "mapping" => "index.php:,xaxis_presets.php:", "url" => "", "level" => "2"),
"xaxis_presets.php:item_edit" => array("title" => __("X-Axis Items"), "mapping" => "index.php:,xaxis_presets.php:,xaxis_presets.php:edit", "url" => "", "level" => "3"),
"xaxis_presets.php:actions" => array("title" => __("Actions"), "mapping" => "index.php:,xaxis_presets.php:", "url" => "", "level" => "2"),
);
$nav = api_plugin_hook_function('draw_navigation_text', $nav);
$current_page = basename($_SERVER["PHP_SELF"]);
input_validate_input_regex(get_request_var_request("action"), "/^([a-zA-Z0-9_-]+)$/");
$current_action = (isset($_REQUEST["action"]) ? $_REQUEST["action"] : "");
/* find the current page in the big array */
$current_array = $nav{$current_page . ":" . $current_action};
$current_mappings = explode(",", $current_array["mapping"]);
$current_nav = "";
/* resolve all mappings to build the navigation string */
for ($i=0; ($i<count($current_mappings)); $i++) {
if (empty($current_mappings[$i])) { continue; }
if ($i == 0) {
/* always use the default for level == 0 */
$url = $nav{$current_mappings[$i]}["url"];
}elseif (!empty($nav_level_cache{$i}["url"])) {
/* found a match in the url cache for this level */
$url = $nav_level_cache{$i}["url"];
}elseif (!empty($current_array["url"])) {
/* found a default url in the above array */
$url = $current_array["url"];
}else{
/* default to no url */
$url = "";
}
if ($current_mappings[$i] == "?") {
/* '?' tells us to pull title from the cache at this level */
if (isset($nav_level_cache{$i})) {
$current_nav .= (empty($url) ? "" : "<a href='" . htmlspecialchars($url) . "'>") . resolve_navigation_variables($nav{$nav_level_cache{$i}["id"]}["title"]) . (empty($url) ? "" : "</a>") . " -> ";
}
}else{
/* there is no '?' - pull from the above array */
$current_nav .= (empty($url) ? "" : "<a href='" . htmlspecialchars($url) . "'>") . resolve_navigation_variables($nav{$current_mappings[$i]}["title"]) . (empty($url) ? "" : "</a>") . " -> ";
}
}
$current_nav .= resolve_navigation_variables($current_array["title"]);
/* keep a cache for each level we encounter */
$nav_level_cache{$current_array["level"]} = array("id" => $current_page . ":" . $current_action, "url" => get_browser_query_string());
$_SESSION["sess_nav_level_cache"] = $nav_level_cache;
print $current_nav;
}
示例12: array
}
/* if cacti's builtin authentication is turned on then make sure to take
graph permissions into account here. if a user does not have rights to a
particular graph; do not show it. they will get an access denied message
if they try and view the graph directly. */
$access_denied = false;
$tree_parameters = array();
if ((!isset($_GET["tree_id"])) && (isset($_SESSION['dhtml_tree']))) {
unset($_SESSION["dhtml_tree"]);
}
if (isset($_GET["tree_id"])) {
$_SESSION["sess_graph_view_last_tree"] = get_browser_query_string();
}
$tree_dropdown_html = draw_tree_dropdown((isset($_GET["tree_id"]) ? $_GET["tree_id"] : "0"));
/* don't even print the table if there is not >1 tree */
if ((!empty($tree_dropdown_html)) && (read_graph_config_option("default_tree_view_mode") == "1")) {
print "
<table width='100%' style='background-color: #f5f5f5; border: 1px solid #bbbbbb;' align='center' cellpadding='3'>
<tr>
$tree_dropdown_html
</tr>
</table>\n";
}
if (isset($_SESSION["sess_view_tree_id"])) {
示例13: finalize_timespan
function finalize_timespan(&$timespan)
{
require_once CACTI_BASE_PATH . "/lib/sys/http.php";
if (!isset($timespan["current_value_date1"])) {
/* Default end date is now default time span */
$timespan["current_value_date1"] = date("Y-m-d H:i", $timespan["begin_now"]);
}
if (!isset($timespan["current_value_date2"])) {
/* Default end date is now */
$timespan["current_value_date2"] = date("Y-m-d H:i", $timespan["end_now"]);
}
/* correct bad dates on calendar */
if ($timespan["end_now"] < $timespan["begin_now"]) {
set_preset_timespan($timespan);
$_SESSION["sess_current_timespan"] = read_graph_config_option("default_timespan");
$timespan["current_value_date1"] = date("Y-m-d H:i", $timespan["begin_now"]);
$timespan["current_value_date2"] = date("Y-m-d H:i", $timespan["end_now"]);
}
/* if moved to future although not allow by settings, stop at current time */
if ($timespan["end_now"] > time() && read_graph_config_option("allow_graph_dates_in_future") == "") {
$timespan["end_now"] = time();
# convert end time to human readable format
$timespan["current_value_date2"] = date("Y-m-d H:i", $timespan["end_now"]);
}
$_SESSION["sess_current_timespan_end_now"] = $timespan["end_now"];
$_SESSION["sess_current_timespan_begin_now"] = $timespan["begin_now"];
$_SESSION["sess_current_date1"] = $timespan["current_value_date1"];
$_SESSION["sess_current_date2"] = $timespan["current_value_date2"];
# sanitize query_string for timespan and timeshift
$browser_query_string = get_browser_query_string();
$browser_query_string = preg_replace('/&predefined_timespan=\\d+/', '', $browser_query_string);
$browser_query_string = preg_replace('/&predefined_timeshift=\\d+/', '', $browser_query_string);
$_SESSION["urlval"] = $browser_query_string;
}
示例14: input_validate_input_number
input_validate_input_number(get_request_var("leaf_id"));
input_validate_input_number(get_request_var("rra_id"));
/* ==================================================== */
if (isset($_GET["hide"])) {
if (($_GET["hide"] == "0") || ($_GET["hide"] == "1")) {
/* only update expand/contract info is this user has rights to keep their own settings */
if ((isset($current_user)) && ($current_user["graph_settings"] == "on")) {
db_execute("delete from settings_tree where graph_tree_item_id=" . $_GET["branch_id"] . " and user_id=" . $_SESSION["sess_user_id"]);
db_execute("insert into settings_tree (graph_tree_item_id,user_id,status) values (" . $_GET["branch_id"] . "," . $_SESSION["sess_user_id"] . "," . $_GET["hide"] . ")");
}
}
}
if (ereg("action=(tree|preview|list)", get_browser_query_string())) {
$_SESSION["sess_graph_view_url_cache"] = get_browser_query_string();
}
/* set default action */
if (!isset($_REQUEST["action"])) { $_REQUEST["action"] = ""; }
switch ($_REQUEST["action"]) {
case 'tree':
if ((read_config_option("auth_method") != 0) && (empty($current_user["show_tree"]))) {
print "<strong><font size='+1' color='FF0000'>YOU DO NOT HAVE RIGHTS FOR TREE VIEW</font></strong>"; exit;
}
/* if cacti's builtin authentication is turned on then make sure to take
graph permissions into account here. if a user does not have rights to a
particular graph; do not show it. they will get an access denied message
if they try and view the graph directly. */
示例15: mikrotik_view_graphs
function mikrotik_view_graphs()
{
global $current_user, $colors, $config, $host_template_hashes, $graph_template_hashes;
include './lib/timespan_settings.php';
include './lib/html_graph.php';
html_graph_validate_preview_request_vars();
/* include graph view filter selector */
html_start_box('<strong>Graph Preview Filters</strong>' . (isset($_REQUEST['style']) && strlen($_REQUEST['style']) ? ' [ Custom Graph List Applied - Filtering from List ]' : ''), '100%', '', '3', 'center', '');
html_graph_preview_filter('mikrotik.php', 'graphs', 'ht.hash IN ("' . implode('","', $host_template_hashes) . '")', 'gt.hash IN ("' . implode('","', $graph_template_hashes) . '")');
html_end_box();
/* the user select a bunch of graphs of the 'list' view and wants them displayed here */
$sql_or = '';
if (isset($_REQUEST['style'])) {
if (get_request_var_request('style') == 'selective') {
/* process selected graphs */
if (!empty($_REQUEST['graph_list'])) {
foreach (explode(',', $_REQUEST['graph_list']) as $item) {
$graph_list[$item] = 1;
}
} else {
$graph_list = array();
}
if (!empty($_REQUEST['graph_add'])) {
foreach (explode(',', $_REQUEST['graph_add']) as $item) {
$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 = array_to_sql_or($graph_array, 'gtg.local_graph_id');
$set_rra_id = empty($rra_id) ? read_graph_config_option('default_rra_id') : get_request_var_request('rra_id');
}
}
}
$total_graphs = 0;
// Filter sql_where
$sql_where = strlen($_REQUEST['filter']) ? "gtg.title_cache LIKE '%" . get_request_var_request('filter') . "%'" : '';
$sql_where .= (strlen($sql_or) && strlen($sql_where) ? ' AND ' : '') . $sql_or;
// Host Id sql_where
if ($_REQUEST['host_id'] > 0) {
$sql_where .= (strlen($sql_where) ? ' AND' : '') . ' gl.host_id=' . $_REQUEST['host_id'];
} else {
$host_ids = mikrotik_host_ids_from_hashes($host_template_hashes);
if (sizeof($host_ids)) {
$sql_where .= (strlen($sql_where) ? ' AND' : '') . ' gl.host_id IN (' . implode(',', $host_ids) . ')';
} else {
$sql_where .= (strlen($sql_where) ? ' AND' : '') . ' 1=0';
}
}
// Graph Template Id sql_where
if ($_REQUEST['graph_template_id'] > 0) {
$sql_where .= (strlen($sql_where) ? ' AND' : '') . ' gl.graph_template_id=' . $_REQUEST['graph_template_id'];
} else {
$graph_template_ids = mikrotik_graph_templates_from_hashes($graph_template_hashes);
if (sizeof($graph_template_ids)) {
$sql_where .= (strlen($sql_where) ? ' AND' : '') . ' gl.graph_template_id IN (' . implode(',', $graph_template_ids) . ')';
} else {
$sql_where .= (strlen($sql_where) ? ' AND' : '') . ' 1=0';
}
}
$limit = $_REQUEST['graphs'] * ($_REQUEST['page'] - 1) . ',' . $_REQUEST['graphs'];
$order = 'gtg.title_cache';
$graphs = get_allowed_graphs($sql_where, $order, $limit, $total_graphs);
/* do some fancy navigation url construction so we don't have to try and rebuild the url string */
if (preg_match('/page=[0-9]+/', basename($_SERVER['QUERY_STRING']))) {
$nav_url = str_replace('&page=' . get_request_var_request('page'), '', get_browser_query_string());
} else {
$nav_url = get_browser_query_string() . '&host_id=' . get_request_var_request('host_id');
}
$nav_url = preg_replace('/((\\?|&)host_id=[0-9]+|(\\?|&)filter=[a-zA-Z0-9]*)/', '', $nav_url);
html_start_box('', '100%', '', '3', 'center', '');
$nav = html_nav_bar($nav_url, MAX_DISPLAY_PAGES, get_request_var_request('page'), get_request_var_request('graphs'), $total_graphs, get_request_var_request('columns'), 'Graphs', 'page', 'main');
print $nav;
if (get_request_var_request('thumbnails') == 'true') {
html_graph_thumbnail_area($graphs, '', 'graph_start=' . get_current_graph_start() . '&graph_end=' . get_current_graph_end(), '', get_request_var_request('columns'));
} else {
html_graph_area($graphs, '', 'graph_start=' . get_current_graph_start() . '&graph_end=' . get_current_graph_end(), '', get_request_var_request('columns'));
}
if ($total_graphs > 0) {
print $nav;
}
html_end_box();
bottom_footer();
}