"; print "
"; print "
" . ($title != '' ? $title:'') . '
'; print "
" . ($add_text != '' ? "" . $add_label . '':'') . '
'; print '
'; if ($div === true) { print "
"; } else { print ""; } } else { print "
"; if ($div === true) { print "
"; } else { print "
"; } } $table_suffix++; } /* html_end_box - draws the end of an HTML box @arg $trailing_br (bool) - whether to draw a trailing
tag after ending @arg $div (bool) - div type table the box */ function html_end_box($trailing_br = true, $div = false) { if ($div) { print "\n"; }else { print "
\n"; } if ($trailing_br == true) { print "
"; } } /* html_graph_area - draws an area the contains full sized graphs @arg $graph_array - the array to contains graph information. for each graph in the array, the following two keys must exist $arr[0]["local_graph_id"] // graph id $arr[0]["title_cache"] // graph title @arg $no_graphs_message - display this message if no graphs are found in $graph_array @arg $extra_url_args - extra arguments to append to the url @arg $header - html to use as a header @arg $columns - the number of columns to present */ function html_graph_area(&$graph_array, $no_graphs_message = '', $extra_url_args = '', $header = '', $columns = 0) { global $config; $i = 0; $k = 0; $j = 0; $num_graphs = sizeof($graph_array); if ($columns == 0) { $columns = read_user_setting('num_columns'); } ?> 0) { if ($header != '') { print $header; } foreach ($graph_array as $graph) { if ($i == 0) { print "\n"; } ?>
' graph_width='' graph_height='' title_font_size=''>
" . htmlspecialchars($graph['title_cache']) . '' : '');?>
' class='noprint graphDrillDown'>
\n"; } } while(($i % $columns) != 0) { print ""; $i++; } print "\n"; } else { if ($no_graphs_message != '') { print "$no_graphs_message"; } } } /* html_graph_thumbnail_area - draws an area the contains thumbnail sized graphs @arg $graph_array - the array to contains graph information. for each graph in the array, the following two keys must exist $arr[0]["local_graph_id"] // graph id $arr[0]["title_cache"] // graph title @arg $no_graphs_message - display this message if no graphs are found in $graph_array @arg $extra_url_args - extra arguments to append to the url @arg $header - html to use as a header @arg $columns - the number of columns to present */ function html_graph_thumbnail_area(&$graph_array, $no_graphs_message = '', $extra_url_args = '', $header = '', $columns = 0) { global $config; $i = 0; $k = 0; $j = 0; $num_graphs = sizeof($graph_array); if ($columns == 0) { $columns = read_user_setting('num_columns'); } ?> 0) { if ($header != '') { print $header; } $start = true; foreach ($graph_array as $graph) { if (isset($graph['graph_template_name'])) { if (isset($prev_graph_template_name)) { if ($prev_graph_template_name != $graph['graph_template_name']) { $prev_graph_template_name = $graph['graph_template_name']; } } else { $prev_graph_template_name = $graph['graph_template_name']; } } elseif (isset($graph['data_query_name'])) { if (isset($prev_data_query_name)) { if ($prev_data_query_name != $graph['data_query_name']) { $print = true; $prev_data_query_name = $graph['data_query_name']; } else { $print = false; } } else { $print = true; $prev_data_query_name = $graph['data_query_name']; } if ($print) { if (!$start) { while(($i % $columns) != 0) { print ""; $i++; } print "\n"; } print " " . __('Data Query:') . ' ' . $graph['data_query_name'] . " \n"; $i = 0; } } if ($i == 0) { print "\n"; $start = false; } ?>
' graph_width='' graph_height=''>
" . htmlspecialchars($graph['title_cache']) . '' : '');?>
' class='noprint graphDrillDown'>
\n"; $start = true; } } if (!$start) { while(($i % $columns) != 0) { print ""; $i++; } print "\n"; } } else { if ($no_graphs_message != '') { print "$no_graphs_message"; } } } function graph_drilldown_icons($local_graph_id, $type = 'graph_buttons') { global $config; $aggregate_url = aggregate_build_children_url($local_graph_id); print "
\n"; print "
\n"; print "
\n"; print "
\n"; if (read_config_option('realtime_enabled') == 'on') { print "
\n"; } if (is_realm_allowed(1043)) { print ""; print '
'; } if ($aggregate_url != '') { print $aggregate_url; } api_plugin_hook($type, array('hook' => 'graph_buttons_thumbnails', 'local_graph_id' => $local_graph_id, 'rra' => 0, 'view_type' => '')); print "
\n"; } /* html_nav_bar - draws a navigation bar which includes previous/next links as well as current page information @arg $base_url - the base URL will all filter options except page# @arg $max_pages - the maximum number of pages to display @arg $current_page - the current page in the navigation system @arg $rows_per_page - the number of rows that are displayed on a single page @arg $total_rows - the total number of rows in the navigation system @arg $object - the object types that is being displayed @arg $page_var - the object types that is being displayed @arg $return_to - paint the resulting page into this dom object */ function html_nav_bar($base_url, $max_pages, $current_page, $rows_per_page, $total_rows, $colspan=30, $object = '', $page_var = 'page', $return_to = '') { if ($object == '') $object = __('Rows'); if ($total_rows > $rows_per_page) { if (substr_count($base_url, '?') == 0) { $base_url = trim($base_url) . '?'; } else { $base_url = trim($base_url) . '&'; } $url_page_select = get_page_list($current_page, $max_pages, $rows_per_page, $total_rows, $base_url, $page_var, $return_to); $nav = "\n"; } elseif ($total_rows > 0) { $nav = "\n"; } else { $nav = "\n"; } return $nav; } /* html_header_sort - draws a header row suitable for display inside of a box element. When a user selects a column header, the collback function "filename" will be called to handle the sort the column and display the altered results. @arg $header_items - an array containing a list of column items to display. The format is similar to the html_header, with the exception that it has three dimensions associated with each element (db_column => display_text, default_sort_order) alternatively (db_column => array('display' = 'blah', 'align' = 'blah', 'sort' = 'blah')) @arg $sort_column - the value of current sort column. @arg $sort_direction - the value the current sort direction. The actual sort direction will be opposite this direction if the user selects the same named column. @arg $last_item_colspan - the TD 'colspan' to apply to the last cell in the row @arg $url - a base url to redirect sort actions to */ function html_header_sort($header_items, $sort_column, $sort_direction, $last_item_colspan = 1, $url = '') { /* reverse the sort direction */ if ($sort_direction == 'ASC') { $new_sort_direction = 'DESC'; } else { $new_sort_direction = 'ASC'; } $page = str_replace('.php', '', basename($_SERVER['SCRIPT_NAME'])); if (isset_request_var('action')) { $page .= '_' . get_request_var('action'); } if (isset_request_var('tab')) { $page .= '_' . get_request_var('tab'); } if (isset($_SESSION['sort_data'][$page])) { $order_data = $_SESSION['sort_data'][$page]; } else { $order_data = array(get_request_var('sort_column') => get_request_var('sort_direction')); } foreach($order_data as $key => $direction) { $primarySort = $key; break; } print "\n"; $i = 1; foreach ($header_items as $db_column => $display_array) { $isSort = ''; if (isset($display_array['nohide'])) { $nohide = 'nohide'; } else { $nohide = ''; } if (array_key_exists('display', $display_array)) { $display_text = $display_array['display']; if ($sort_column == $db_column) { $icon = $sort_direction; $direction = $new_sort_direction; if ($db_column == $primarySort) { $isSort = 'primarySort'; } else { $isSort = 'secondarySort'; } } else { if (isset($order_data[$db_column])) { $icon = $order_data[$db_column]; if ($order_data[$db_column] == 'DESC') { $direction = 'ASC'; } else { $direction = 'DESC'; } if ($db_column == $primarySort) { $isSort = 'primarySort'; } else { $isSort = 'secondarySort'; } } else { $icon = ''; if (isset($display_array['sort'])) { $direction = $display_array['sort']; } else { $direction = 'ASC'; } } } if (isset($display_array['align'])) { $align = $display_array['align']; } else { $align = 'left'; } if (isset($display_array['tip'])) { $tip = $display_array['tip']; } else { $tip = ''; } } else { /* by default, you will always sort ascending, with the exception of an already sorted column */ if ($sort_column == $db_column) { $icon = $sort_direction; $direction = $new_sort_direction; $display_text = $display_array[0]; if ($db_column == $primarySort) { $isSort = 'primarySort'; } else { $isSort = 'secondarySort'; } } else { if (isset($order_data[$db_column])) { $icon = $order_data[$db_column]; if ($order_data[$db_column] == 'DESC') { $direction = 'ASC'; } else { $direction = 'DESC'; } if ($db_column == $primarySort) { $isSort = 'primarySort'; } else { $isSort = 'secondarySort'; } } else { $icon = ''; $direction = $display_array[1]; } $display_text = $display_array[0]; } $align = 'left'; $tip = ''; } if (strtolower($icon) == 'asc') { $icon = 'fa fa-sort-asc'; } elseif (strtolower($icon) == 'desc') { $icon = 'fa fa-sort-desc'; } else { $icon = 'fa fa-unsorted'; } if (($db_column == '') || (substr_count($db_column, 'nosort'))) { print '' . $display_text . "\n"; } else { print '"; print "
" . $display_text . "
\n"; } $i++; } print "\n"; } /* html_header_sort_checkbox - draws a header row with a 'select all' checkbox in the last cell suitable for display inside of a box element. When a user selects a column header, the collback function "filename" will be called to handle the sort the column and display the altered results. @arg $header_items - an array containing a list of column items to display. The format is similar to the html_header, with the exception that it has three dimensions associated with each element (db_column => display_text, default_sort_order) alternatively (db_column => array('display' = 'blah', 'align' = 'blah', 'sort' = 'blah')) @arg $sort_column - the value of current sort column. @arg $sort_direction - the value the current sort direction. The actual sort direction will be opposite this direction if the user selects the same named column. @arg $form_action - the url to post the 'select all' form to */ function html_header_sort_checkbox($header_items, $sort_column, $sort_direction, $include_form = true, $form_action = '') { static $page = 0; /* reverse the sort direction */ if ($sort_direction == 'ASC') { $new_sort_direction = 'DESC'; } else { $new_sort_direction = 'ASC'; } $page = str_replace('.php', '', basename($_SERVER['SCRIPT_NAME'])); if (isset_request_var('action')) { $page .= '_' . get_request_var('action'); } if (isset_request_var('tab')) { $page .= '_' . get_request_var('tab'); } if (isset($_SESSION['sort_data'][$page])) { $order_data = $_SESSION['sort_data'][$page]; } else { $order_data = array(get_request_var('sort_column') => get_request_var('sort_direction')); } foreach($order_data as $key => $direction) { $primarySort = $key; break; } /* default to the 'current' file */ if ($form_action == '') { $form_action = get_current_page(); } print "\n"; foreach($header_items as $db_column => $display_array) { $isSort = ''; if (isset($display_array['nohide'])) { $nohide = 'nohide'; } else { $nohide = ''; } $icon = ''; if (array_key_exists('display', $display_array)) { $display_text = $display_array['display']; if ($sort_column == $db_column) { $icon = $sort_direction; $direction = $new_sort_direction; if ($db_column == $primarySort) { $isSort = 'primarySort'; } else { $isSort = 'secondarySort'; } } else { if (isset($order_data[$db_column])) { $icon = $order_data[$db_column]; if ($order_data[$db_column] == 'DESC') { $direction = 'ASC'; } else { $direction = 'DESC'; } if ($db_column == $primarySort) { $isSort = 'primarySort'; } else { $isSort = 'secondarySort'; } } else { $icon = ''; if (isset($display_array['sort'])) { $direction = $display_array['sort']; } else { $direction = 'ASC'; } } } if (isset($display_array['align'])) { $align = $display_array['align']; } else { $align = 'left'; } if (isset($display_array['tip'])) { $tip = $display_array['tip']; } else { $tip = ''; } } else { /* by default, you will always sort ascending, with the exception of an already sorted column */ if ($sort_column == $db_column) { $icon = $sort_direction; $direction = $new_sort_direction; $display_text = $display_array[0]; if ($db_column == $primarySort) { $isSort = 'primarySort'; } else { $isSort = 'secondarySort'; } } else { if (isset($order_data[$db_column])) { $icon = $order_data[$db_column]; if ($order_data[$db_column] == 'DESC') { $direction = 'ASC'; } else { $direction = 'DESC'; } if ($db_column == $primarySort) { $isSort = 'primarySort'; } else { $isSort = 'secondarySort'; } } else { $icon = ''; $direction = $display_array[1]; } $display_text = $display_array[0]; } $align = 'left'; $tip = ''; } if (strtolower($icon) == 'asc') { $icon = 'fa fa-sort-asc'; } elseif (strtolower($icon) == 'desc') { $icon = 'fa fa-sort-desc'; } else { $icon = 'fa fa-unsorted'; } if (($db_column == '') || (substr_count($db_column, 'nosort'))) { print '" . $display_text . "\n"; } else { print '"; print "
" . $display_text . "
\n"; } } print "" . ($include_form ? "
\n":""); print "\n"; $page++; } /* html_header - draws a header row suitable for display inside of a box element @arg $header_items - an array containing a list of items to be included in the header alternatively and array of header names and alignment array('display' = 'blah', 'align' = 'blah') @arg $last_item_colspan - the TD 'colspan' to apply to the last cell in the row */ function html_header($header_items, $last_item_colspan = 1) { print "\n"; $i = 0; foreach($header_items as $item) { if (is_array($item)) { if (isset($item['nohide'])) { $nohide = 'nohide'; } else { $nohide = ''; } if (isset($item['align'])) { $align = $item['align']; } else { $align = 'left'; } print "" . $item['display'] . "\n"; } else { print "" . $item . "\n"; } $i++; } print "\n"; } /* html_section_header - draws a header row suitable for display inside of a box element but for display as a secton title and not as a series of table header columns @arg $header_name - an array of the display name of the header for the section and optional alignment. @arg $last_item_colspan - the TD 'colspan' to apply to the last cell in the row */ function html_section_header($header_item, $last_item_colspan = 1) { print "\n"; if (is_array($header_item) && isset($header_item['display'])) { print "" . $header_item['display'] . "\n"; } else { print "" . $header_item . "\n"; } print "\n"; } /* html_header_checkbox - draws a header row with a 'select all' checkbox in the last cell suitable for display inside of a box element @arg $header_items - an array containing a list of items to be included in the header alternatively and array of header names and alignment array('display' = 'blah', 'align' = 'blah') @arg $form_action - the url to post the 'select all' form to */ function html_header_checkbox($header_items, $include_form = true, $form_action = "", $resizable = true) { /* default to the 'current' file */ if ($form_action == "") { $form_action = get_current_page(); } print "\n"; foreach($header_items as $item) { if (is_array($item)) { if (isset($item['nohide'])) { $nohide = 'nohide'; } else { $nohide = ''; } if (isset($item['align'])) { $align = $item['align']; } else { $align = 'left'; } print "" . $item['display'] . ""; } else { print "" . $item . "\n"; } } print "\n" . ($include_form ? "\n":""); print "\n"; } /* html_create_list - draws the items for an html dropdown given an array of data @arg $form_data - an array containing data for this dropdown. it can be formatted in one of two ways: $array["id"] = "value"; -- or -- $array[0]["id"] = 43; $array[0]["name"] = "Red"; @arg $column_display - used to indentify the key to be used for display data. this is only applicable if the array is formatted using the second method above @arg $column_id - used to indentify the key to be used for id data. this is only applicable if the array is formatted using the second method above @arg $form_previous_value - the current value of this form element */ function html_create_list($form_data, $column_display, $column_id, $form_previous_value) { if (empty($column_display)) { foreach (array_keys($form_data) as $id) { print '\n"; } } else { if (sizeof($form_data) > 0) { foreach ($form_data as $row) { print "\n"; } else { print ">" . title_trim(null_out_substitutions(htmlspecialchars($row[$column_display])), 75) . "\n"; } } } } } /* html_split_string - takes a string and breaks it into a number of
separated segments @arg $string - string to be modified and returned @arg $length - the maximal string length to split to @arg $forgiveness - the maximum number of characters to walk back from to determine the correct break location. @returns $new_string - the modified string to be returned. */ function html_split_string($string, $length = 70, $forgiveness = 10) { $new_string = ""; $j = 0; $done = false; while (!$done) { if (strlen($string) > $length) { for($i = 0; $i < $forgiveness; $i++) { if (substr($string, $length-$i, 1) == " ") { $new_string .= substr($string, 0, $length-$i) . "
"; break; } } $string = substr($string, $length-$i); } else { $new_string .= $string; $done = true; } $j++; if ($j > 4) break; } return $new_string; } /* draw_graph_items_list - draws a nicely formatted list of graph items for display on an edit form @arg $item_list - an array representing the list of graph items. this array should come directly from the output of db_fetch_assoc() @arg $filename - the filename to use when referencing any external url @arg $url_data - any extra GET url information to pass on when referencing any external url @arg $disable_controls - whether to hide all edit/delete functionality on this form */ function draw_graph_items_list($item_list, $filename, $url_data, $disable_controls) { global $config; include($config['include_path'] . '/global_arrays.php'); print ""; DrawMatrixHeaderItem(__('Graph Item'),'',1); DrawMatrixHeaderItem(__('Data Source'),'',1); DrawMatrixHeaderItem(__('Graph Item Type'),'',1); DrawMatrixHeaderItem(__('CF Type'),'',1); DrawMatrixHeaderItem(__('Alpha %'),'',1); DrawMatrixHeaderItem(__('Item Color'),'',4); print ''; $group_counter = 0; $_graph_type_name = ''; $i = 0; if (sizeof($item_list)) { foreach ($item_list as $item) { /* graph grouping display logic */ $this_row_style = ''; $use_custom_class = false; $hard_return = ''; if (!preg_match('/(GPRINT|TEXTALIGN|HRULE|VRULE|TICK)/', $graph_item_types[$item['graph_type_id']])) { $this_row_style = 'font-weight: bold;'; $use_custom_class = true; if ($group_counter % 2 == 0) { $customClass = 'graphItem'; } else { $customClass = 'graphItemAlternate'; } $group_counter++; } $_graph_type_name = $graph_item_types{$item['graph_type_id']}; /* alternating row color */ if ($use_custom_class == false) { print "\n"; } else { print ""; } print ''; if ($disable_controls == false) { print ""; } print __('Item # %d', ($i+1)); if ($disable_controls == false) { print ''; } print ''; if (empty($item['data_source_name'])) { $item['data_source_name'] = __('No Task'); } switch (true) { case preg_match('/(TEXTALIGN)/', $_graph_type_name): $matrix_title = 'TEXTALIGN: ' . ucfirst($item['textalign']); break; case preg_match('/(TICK)/', $_graph_type_name): $matrix_title = '(' . $item['data_source_name'] . '): ' . $item['text_format']; break; case preg_match('/(AREA|STACK|GPRINT|LINE[123])/', $_graph_type_name): $matrix_title = '(' . $item['data_source_name'] . '): ' . $item['text_format']; break; case preg_match('/(HRULE)/', $_graph_type_name): $matrix_title = 'HRULE: ' . $item['value']; break; case preg_match('/(VRULE)/', $_graph_type_name): $matrix_title = 'VRULE: ' . $item['value']; break; case preg_match('/(COMMENT)/', $_graph_type_name): $matrix_title = 'COMMENT: ' . $item['text_format']; break; } if (preg_match('/(TEXTALIGN)/', $_graph_type_name)) { $hard_return = ''; } elseif ($item['hard_return'] == 'on') { $hard_return = "<HR>"; } /* data source */ print "" . htmlspecialchars($matrix_title) . $hard_return . ''; /* graph item type */ print "" . $graph_item_types{$item['graph_type_id']} . ''; if (!preg_match('/(TICK|TEXTALIGN|HRULE|VRULE)/', $_graph_type_name)) { print "" . $consolidation_functions{$item['consolidation_function_id']} . ''; } else { print '' . __('N/A') . ''; } /* alpha type */ if (preg_match('/(AREA|STACK|TICK|LINE[123])/', $_graph_type_name)) { print "" . round((hexdec($item['alpha'])/255)*100) . '%'; } else { print "\n"; } /* color name */ if (!preg_match('/(TEXTALIGN)/', $_graph_type_name)) { print "'; print "" . $item['hex'] . ''; } else { print ''; } if ($disable_controls == false) { print "\n"; if ($i != sizeof($item_list)-1) { print "\n"; } else { print "\n"; } if ($i > 0) { print "\n"; } else { print "\n"; } print "\n"; print "\n"; } print ""; $i++; } } else { print "" . __('No Items') . ""; } } function is_menu_pick_active($menu_url) { static $url_array, $url_parts; $menu_parts = array(); /* break out the URL and variables */ if (!sizeof($url_array)) { $url_array = parse_url($_SERVER['REQUEST_URI']); if (isset($url_array['query'])) { parse_str($url_array['query'], $url_parts); } else { $url_parts = array(); } } $menu_array = parse_url($menu_url); if (basename($url_array['path']) == basename($menu_array['path'])) { if (isset($menu_array['query'])) { parse_str($menu_array['query'], $menu_parts); } else { $menu_parts = array(); } if (isset($menu_parts['id'])) { if (isset($url_parts['id'])) { if ($menu_parts['id'] == $url_parts['id']) { return true; } } } elseif (isset($menu_parts['action'])) { if (isset($url_parts['action'])) { if ($menu_parts['action'] == $url_parts['action']) { return true; } } } else { return true; } } return false; } /* draw_menu - draws the cacti menu for display in the console */ function draw_menu($user_menu = "") { global $config, $user_auth_realm_filenames, $menu, $menu_glyphs; if (!is_array($user_menu)) { $user_menu = $menu; } //print "
";print_r($_SERVER);print "
"; //print "
";print_r($user_menu);print "
";exit; print "
\n"; } /* draw_actions_dropdown - draws a table the allows the user to select an action to perform on one or more data elements @arg $actions_array - an array that contains a list of possible actions. this array should be compatible with the form_dropdown() function @arg $delete_action - if there is a delete action that should surpress removal of rows specify it here. If you don't want any delete actions, set to 0.*/ function draw_actions_dropdown($actions_array, $delete_action = 1) { global $config; if (!isset($actions_array[0])) { $my_actions[0] = __('Choose an action'); $my_actions += $actions_array; $actions_array = $my_actions; } ?>
images/arrow.gif' alt=''> ' title=''>
$children) { if (sizeof($children)) { foreach($children as $page => $name) { if (basename($page) == basename($url)) { return true; } } } } } return false; } function html_show_tabs_left() { global $config, $tabs_left; if (is_realm_allowed(8)) { $show_console_tab = true; } else { $show_console_tab = false; } if (get_selected_theme() == 'classic') { if ($show_console_tab == true) { ?> href="index.php"><?php print __('Console');?> 1 && $config['connection'] != 'online') { // Don't show graphs tab when offline } else { $file = get_current_page(); if ($file == "graph_view.php" || $file == "graph.php") { print "" . __("; } else { print "" . __("; } } } if (is_realm_allowed(21) || is_realm_allowed(22)) { if ($config['poller_id'] > 1) { // Don't show reports tabe if not poller 1 } else { if (substr_count($_SERVER["REQUEST_URI"], "reports_")) { print '' . __('Reporting') . ''; } else { print '' . __('Reporting') . ''; } } } if (is_realm_allowed(18) || is_realm_allowed(19)) { if (substr_count($_SERVER["REQUEST_URI"], "clog")) { print '' . __('Cacti Log'). ''; } else { print '' . __('Cacti Log') . ''; } } if ($config['poller_id'] > 1 && $config['connection'] != 'online') { // Only show external links when online } else { $external_links = db_fetch_assoc('SELECT id, title FROM external_links WHERE style="TAB" AND enabled="on" ORDER BY sortorder'); if (sizeof($external_links)) { foreach($external_links as $tab) { if (is_realm_allowed($tab['id']+10000)) { $parsed_url = parse_url($_SERVER['REQUEST_URI']); $down = false; if (basename($parsed_url['path']) == 'link.php') { if (isset($parsed_url['query'])) { $queries = explode('&', $parsed_url['query']); foreach($queries as $q) { list($var, $value) = explode('=', $q); if ($var == 'id') { if ($value == $tab['id']) { $down = true; break; } } } } } print '' . $tab['title'] . ''; } } } } api_plugin_hook('top_graph_header_tabs'); } else { if ($show_console_tab) { $tabs_left[] = array( 'title' => __('Console'), 'id' => 'maintab-anchor-console', 'image' => '', 'url' => $config['url_path'] . 'index.php', ); } if ($config['poller_id'] > 1 && $config['connection'] != 'online') { // Don't show the graphs tab when offline } else { $tabs_left[] = array( 'title' => __('Graphs'), 'id' => 'maintab-anchor-graphs', 'image' => '', 'url' => $config['url_path'] . 'graph_view.php', ); } if (is_realm_allowed(21) || is_realm_allowed(22)) { if ($config['poller_id'] > 1) { // Don't show the reports tab on other pollers } else { $tabs_left[] = array( 'title' => __('Reporting'), 'id' => 'maintab-anchor-reports', 'image' => '', 'url' => $config['url_path'] . (is_realm_allowed(22) ? 'reports_admin.php':'reports_user.php'), ); } } if (is_realm_allowed(18) || is_realm_allowed(19)) { $tabs_left[] = array( 'title' => __('Cacti Log'), 'id' => 'maintab-anchor-logs', 'image' => '', 'url' => $config['url_path'] . (is_realm_allowed(18) ? 'clog.php':'clog_user.php'), ); } if ($config['poller_id'] > 1 && $config['connection'] != 'online') { // Only show external links when online } else { $external_links = db_fetch_assoc('SELECT id, title FROM external_links WHERE style="TAB" AND enabled="on" ORDER BY sortorder'); if (sizeof($external_links)) { foreach($external_links as $tab) { if (is_realm_allowed($tab['id']+10000)) { $tabs_left[] = array( 'title' => $tab['title'], 'id' => 'maintab-anchor-link' . $tab['id'], 'image' => '', 'url' => $config['url_path'] . 'link.php?id=' . $tab['id'] ); } } } } // Get Plugin Text Out of Band ob_start(); api_plugin_hook('top_graph_header_tabs'); $tab_text = trim(ob_get_clean()); $tab_text = str_replace('', '|', $tab_text); $tab_text = str_replace('', '', $tab_text); $elements = explode('|', $tab_text); foreach($elements as $p) { $p = trim($p); if ($p == '') continue; $altpos = strpos($p, 'alt='); $hrefpos = strpos($p, 'href='); if ($altpos >= 0) { $alt = substr($p, $altpos+4); $parts = explode("'", $alt); if ($parts[0] == '') { $alt = $parts[1]; } else { $alt = $parts[0]; } } else { $alt = 'Title'; } if ($hrefpos >= 0) { $href = substr($p, $hrefpos+5); $parts = explode("'", $href); if ($parts[0] == '') { $href = $parts[1]; } else { $href = $parts[0]; } } else { $href = 'unknown'; } $tabs_left[] = array('title' => ucwords($alt), 'url' => $href); } $i = 0; $me_base = get_current_page(); foreach($tabs_left as $tab) { $tab_base = basename($tab['url']); if ($tab_base == 'graph_view.php' && ($me_base == 'graph_view.php' || $me_base == 'graph.php')) { $tabs_left[$i]['selected'] = true; } elseif (isset_request_var('id') && ($tab_base == 'link.php?id=' . get_nfilter_request_var('id')) && $me_base == 'link.php') { $tabs_left[$i]['selected'] = true; } elseif ($tab_base == 'index.php' && is_console_page($me_base)) { $tabs_left[$i]['selected'] = true; } elseif ($tab_base == $me_base) { $tabs_left[$i]['selected'] = true; } $i++; } $i = 0; print "
\n"; } } function html_graph_tabs_right($current_user) { global $config, $tabs_right; $theme = get_selected_theme(); if ($theme == 'classic') { if (is_view_allowed('show_tree')) { ?>'>images/tab_mode_tree.gif' title='' alt=''>'>images/tab_mode_list.gif' title='' alt=''>'>images/tab_mode_preview.gif' title='' alt=''> 
__('Tree View'), 'image' => 'include/themes/' . $theme . '/images/tab_tree.gif', 'id' => 'tree', 'url' => 'graph_view.php?action=tree', ); } if (is_view_allowed('show_list')) { $tabs_right[] = array( 'title' => __('List View'), 'image' => 'include/themes/' . $theme . '/images/tab_list.gif', 'id' => 'list', 'url' => 'graph_view.php?action=list', ); } if (is_view_allowed('show_preview')) { $tabs_right[] = array( 'title' => __('Preview'), 'image' => 'include/themes/' . $theme . '/images/tab_preview.gif', 'id' => 'preview', 'url' => 'graph_view.php?action=preview', ); } $i = 0; foreach($tabs_right as $tab) { if ($tab['id'] == 'tree') { if (isset_request_var('action') && get_nfilter_request_var('action') == 'tree') { $tabs_right[$i]['selected'] = true; } } elseif ($tab['id'] == 'list') { if (isset_request_var('action') && get_nfilter_request_var('action') == 'list') { $tabs_right[$i]['selected'] = true; } } elseif ($tab['id'] == 'preview') { if (isset_request_var('action') && get_nfilter_request_var('action') == 'preview') { $tabs_right[$i]['selected'] = true; } } elseif (strstr(get_current_page(false), $tab['url'])) { $tabs_right[$i]['selected'] = true; } $i++; } print "
\n"; } } function html_host_filter($host_id = '-1', $call_back = 'applyFilter', $sql_where = '', $noany = false, $nonone = false) { $theme = get_selected_theme(); if (strpos($call_back, '()') === false) { $call_back .= '()'; } if ($theme == 'classic') { ?> 0) { $hostname = db_fetch_cell_prepared("SELECT description FROM host WHERE id = ?", array($host_id)); } elseif ($host_id == 0) { $hostname = 'None'; } else { $hostname = 'Any'; } ?> ' . __('Replacement Method') . '
    '; $ravgnan .= '
  • ' . __('Average') . '
  • '; $ravgnan .= '
  • ' . __('Nan\'s') . '
  • '; $ravgnan .= '
  • ' . __('Last Known Good') . '
  • '; $ravgnan .= '
'; $rstddev = '
  • ' . __('Standard Deviations') . '
      '; for($i = 1; $i <= 10; $i++) { $rstddev .= '
    • ' . __('%s Standard Deviations', $i) . '
    • '; } $rstddev .= '
  • '; $rvarpct = '
  • ' . __('Variance Percentage') . '
      '; for($i = 1; $i <= 10; $i++) { $rvarpct .= '
    • ' . round($i * 100,0) . ' %
    • '; } $rvarpct .= '
  • '; $rvarout = '
  • ' . __('Variance Outliers') . '
      '; for($i = 3; $i <= 10; $i++) { $rvarout .= '
    • ' . __('%d Outliers', $i) . '
    • '; } $rvarout .= '
  • '; $rkills = '
  • ' . __('Kills Per RRA') . '
      '; for($i = 1; $i <= 10; $i++) { $rkills .= '
    • ' . __('%d Spikes', $i) . '
    • '; } $rkills .= '
  • '; ?>