0) { $ndata = explode('-', $_REQUEST['id']); $tree_id = $ndata[1]; input_validate_input_number($tree_id); } }else{ $tree_id = read_graph_config_option('default_tree_id'); } if (isset($_REQUEST['id']) && $_REQUEST['id'] != '#') { if (substr_count($_REQUEST['id'], 'tree_anchor')) { $parent = -1; }else{ $ndata = explode('_', $_REQUEST['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); exit; break; case 'tree_content': 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['style']) && strlen($_REQUEST['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['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; $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; $sql_where .= ($_REQUEST['host_id'] > 0 ? (strlen($sql_where) ? ' AND':'') . ' gl.host_id=' . $_REQUEST['host_id']:''); $sql_where .= ($_REQUEST['graph_template_id'] > 0 ? (strlen($sql_where) ? ' AND':'') . ' gl.graph_template_id=' . $_REQUEST['graph_template_id']:''); $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(); if (!isset($_REQUEST['header']) || $_REQUEST['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; } /* ================= input validation ================= */ input_validate_input_number(get_request_var_request('host_id')); input_validate_input_number(get_request_var_request('graph_template_id')); input_validate_input_number(get_request_var_request('rows')); input_validate_input_number(get_request_var_request('page')); /* ==================================================== */ /* clean up search string */ if (isset($_REQUEST['filter'])) { $_REQUEST['filter'] = sanitize_search_string(get_request_var_request('filter')); } /* reset the graph list on a new viewing */ if (!isset($_REQUEST['page'])) { $_REQUEST['graph_list'] = ''; $_REQUEST['page'] = 1; } /* if the user pushed the 'clear' button */ if (isset($_REQUEST['clear'])) { kill_session_var('sess_graph_view_list_current_page'); kill_session_var('sess_graph_view_list_filter'); kill_session_var('sess_graph_view_list_host'); kill_session_var('sess_graph_view_list_graph_template'); kill_session_var('sess_graph_view_list_rows'); kill_session_var('sess_graph_view_list_graph_list'); unset($_REQUEST['page']); unset($_REQUEST['rows']); unset($_REQUEST['filter']); unset($_REQUEST['host_id']); unset($_REQUEST['graph_template_id']); unset($_REQUEST['graph_list']); unset($_REQUEST['graph_add']); unset($_REQUEST['graph_remove']); }else{ /* if any of the settings changed, reset the page number */ $changed = false; $changed += check_changed('host_id', 'sess_graph_view_list_host'); $changed += check_changed('rows', 'sess_graph_view_list_rows'); $changed += check_changed('graph_template_id', 'sess_graph_view_list_graph_template'); $changed += check_changed('filter', 'sess_graph_view_list_filter'); if ($changed) $_REQUEST['page'] = 1; } load_current_session_value('host_id', 'sess_graph_view_list_host', '0'); load_current_session_value('graph_template_id', 'sess_graph_view_list_graph_template', '0'); load_current_session_value('filter', 'sess_graph_view_list_filter', ''); load_current_session_value('page', 'sess_graph_view_list_current_page', '1'); load_current_session_value('rows', 'sess_default_rows', read_config_option('num_rows_table')); load_current_session_value('graph_list', 'sess_graph_view_list_graph_list', ''); /* save selected graphs into url */ 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]); } } /* update the revised graph list session variable */ $_REQUEST['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['style']) && strlen($_REQUEST['style']) ? ' [ Custom Graph List Applied - Filter FROM List ]':''), '100%', '', '3', 'center', ''); ?>
" . 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(); ?> |