0) { $ndata = explode('-', get_nfilter_request_var('id')); $tree_id = $ndata[1]; input_validate_input_number($tree_id); } }else{ $tree_id = read_user_setting('default_tree_id'); } if (isset_request_var('id') && get_nfilter_request_var('id') != '#') { if (substr_count(get_nfilter_request_var('id'), 'tree_anchor')) { $parent = -1; }else{ $ndata = explode('_', get_nfilter_request_var('id')); foreach($ndata as $node) { $pnode = explode('-', $node); if ($pnode[0] == 'tbranch') { $parent = $pnode[1]; input_validate_input_number($parent); $tree_id = db_fetch_cell("SELECT graph_tree_id FROM graph_tree_items WHERE id=$parent"); break; } } } } api_tree_get_main($tree_id, $parent); break; case 'tree_content': html_validate_tree_vars(); if (!is_view_allowed('show_tree')) { print "YOU DO NOT HAVE RIGHTS FOR TREE VIEW"; return; } ?> YOU DO NOT HAVE RIGHTS FOR PREVIEW VIEW"; return; } html_graph_validate_preview_request_vars(); /* 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('graph_view.php', 'preview'); 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]); } } $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_user_setting('default_rra_id') : get_request_var('rra_id'); } } } $total_graphs = 0; $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; $sql_where .= (get_request_var('host_id') >= 0 ? (strlen($sql_where) ? ' AND':'') . ' gl.host_id=' . get_request_var('host_id'):''); $sql_where .= (get_request_var('graph_template_id') > 0 ? (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); html_start_box('', '100%', '', '3', 'center', ''); $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; 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')); } if ($total_graphs > 0) { print $nav; } html_end_box(); if (!isset_request_var('header') || get_nfilter_request_var('header') == 'false') { bottom_footer(); } break; case 'list': top_graph_header(); if (!is_view_allowed('show_list')) { print "YOU DO NOT HAVE RIGHTS FOR LIST VIEW"; return; } /* reset the graph list on a new viewing */ if (!isset_request_var('page')) { set_request_var('graph_list', ''); set_request_var('page', 1); } /* ================= input validation and session storage ================= */ $filters = array( 'rows' => array( 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => read_config_option('num_rows_table') ), 'page' => array( 'filter' => FILTER_VALIDATE_INT, 'default' => '1' ), 'filter' => array( 'filter' => FILTER_CALLBACK, 'pageset' => true, 'default' => '', 'options' => array('options' => 'sanitize_search_string') ), 'graph_template_id' => array( 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '0' ), 'host_id' => array( 'filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1' ), 'graph_list' => array( 'filter' => FILTER_DEFAULT, 'default' => '' ), 'graph_add' => array( 'filter' => FILTER_DEFAULT, 'default' => '' ), 'graph_remove' => array( 'filter' => FILTER_DEFAULT, 'default' => '' ) ); validate_store_request_vars($filters, 'sess_gl'); /* ================= input validation ================= */ /* save selected graphs into url */ 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]); } } /* update the revised graph list session variable */ set_request_var('graph_list', implode(',', array_keys($graph_list))); load_current_session_value('graph_list', 'sess_graph_view_list_graph_list', ''); /* display graph view filter selector */ html_start_box('Graph List View Filters' . (isset_request_var('style') && strlen(get_request_var('style')) ? ' [ Custom Graph List Applied - Filter FROM List ]':''), '100%', '', '3', 'center', ''); ?>
Template Graphs Search '>
'> '>
" . htmlspecialchars($graph['title_cache']) . '', $graph['local_graph_id']); form_selectable_cell($graph['description'], $graph['local_graph_id']); form_selectable_cell($graph['template_name'], $graph['local_graph_id']); form_selectable_cell($graph['height'] . 'x' . $graph['width'], $graph['local_graph_id']); form_checkbox_cell($graph['title_cache'], $graph['local_graph_id']); form_end_row(); } print $nav; } html_end_box(); ?>
 
'>