function draw_navigation_text() { $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" => "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"), "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: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:edit" => array("title" => "(Edit)", "mapping" => "index.php:,data_queries.php:", "url" => "", "level" => "2"), "data_queries.php:remove" => array("title" => "(Remove)", "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"), "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:user_remove" => array("title" => "(Remove)", "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"), ); $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 = split(",", $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='$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; }
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('auth_profile.php:' => array('title' => 'User Profile (Edit)', 'mapping' => '', 'url' => '', 'level' => '0'), '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' => '0'), 'graph_view.php:tree_content' => array('title' => 'Tree Mode', 'mapping' => 'graph_view.php:', 'url' => 'graph_view.php?action=tree', 'level' => '0'), 'graph_view.php:list' => array('title' => 'List Mode', 'mapping' => '', 'url' => 'graph_view.php?action=list', 'level' => '0'), 'graph_view.php:preview' => array('title' => 'Preview Mode', 'mapping' => '', 'url' => 'graph_view.php?action=preview', 'level' => '0'), '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' => 'CDEFs', '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'), 'clog.php:' => array('title' => 'View Cacti Log', 'mapping' => '', 'url' => 'clog.php', 'level' => '0'), 'clog.php:preview' => array('title' => 'View Cacti Log', 'mapping' => '', 'url' => 'clog.php', 'level' => '0'), 'clog_user.php:' => array('title' => 'View Cacti Log', 'mapping' => '', 'url' => 'clog_user.php', 'level' => '0'), 'clog_user.php:preview' => array('title' => 'View Cacti Log', 'mapping' => '', 'url' => 'clog_user.php', 'level' => '0'), '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'), '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' => 'Device 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'), 'rrdcleaner.php:' => array('title' => 'RRD Cleaner', 'mapping' => 'index.php:', 'url' => 'rrdcleaner.php', 'level' => '1'), 'rrdcleaner.php:actions' => array('title' => 'Actions', 'mapping' => 'index.php:,rrdcleaner.php:', 'url' => 'rrdcleaner.php?action=actions', 'level' => '2'), 'rrdcleaner.php:restart' => array('title' => 'List unused Files', 'mapping' => 'rrdcleaner.php:', 'url' => 'rrdcleaner.php?action=restart', 'level' => '2'), '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' => 'View 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'), 'utilities.php:view_boost_status' => array('title' => 'Boost Status', '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' => 'Users', '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_domains.php:' => array('title' => 'User Domains', 'mapping' => 'index.php:', 'url' => 'user_domains.php', 'level' => '1'), 'user_domains.php:edit' => array('title' => '(Edit)', 'mapping' => 'user_domains.php:,index.php:', 'url' => 'user_domains.php:edit', 'level' => '2'), 'user_group_admin.php:' => array('title' => 'User Groups', 'mapping' => 'index.php:', 'url' => 'user_group_admin.php', 'level' => '1'), 'user_group_admin.php:edit' => array('title' => '(Edit)', 'mapping' => 'index.php:,user_group_admin.php:', 'url' => '', 'level' => '2'), 'user_group_admin.php:actions' => array('title' => '(Action)', 'mapping' => 'index.php:,user_group_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'), 'reports_admin.php:' => array('title' => 'Reporting', 'mapping' => '', 'url' => 'reports_admin.php', 'level' => '0'), 'reports_admin.php:actions' => array('title' => 'Report Add', 'mapping' => 'reports_admin.php:', 'url' => 'reports_admin.php', 'level' => '1'), 'reports_admin.php:delete' => array('title' => 'Report Delete', 'mapping' => 'reports_admin.php:', 'url' => 'reports_admin.php', 'level' => '1'), 'reports_admin.php:edit' => array('title' => 'Report Edit', 'mapping' => 'reports_admin.php:', 'url' => 'reports_admin.php?action=edit', 'level' => '1'), 'reports_admin.php:item_edit' => array('title' => 'Report Edit Item', 'mapping' => 'reports_admin.php:,reports_admin.php:edit', 'url' => '', 'level' => '2'), 'reports_user.php:' => array('title' => 'Reporting', 'mapping' => '', 'url' => 'reports_user.php', 'level' => '0'), 'reports_user.php:actions' => array('title' => 'Report Add', 'mapping' => 'reports_user.php:', 'url' => 'reports_user.php', 'level' => '1'), 'reports_user.php:delete' => array('title' => 'Report Delete', 'mapping' => 'reports_user.php:', 'url' => 'reports_user.php', 'level' => '1'), 'reports_user.php:edit' => array('title' => 'Report Edit', 'mapping' => 'reports_user.php:', 'url' => 'reports_user.php?action=edit', 'level' => '1'), 'reports_user.php:item_edit' => array('title' => 'Report Edit Item', 'mapping' => 'reports_user.php:,reports_user.php:edit', '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 */ 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 = "<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; } }
function draw_navigation_text() { global $config; $nav_level_cache = (isset($_SESSION["sess_nav_level_cache"]) ? $_SESSION["sess_nav_level_cache"] : array()); $nav = array( "about.php:" => array("title" => __("About Cacti"), "mapping" => "index.php:", "url" => "about.php", "level" => "1"), "cdef.php:actions" => array("title" => __("Actions"), "mapping" => "index.php:,cdef.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:item_edit" => array("title" => __("CDEF Items"), "mapping" => "index.php:,cdef.php:,cdef.php:edit", "url" => "", "level" => "3"), "cdef.php:remove" => array("title" => __("(Remove)"), "mapping" => "index.php:,cdef.php:", "url" => "", "level" => "2"), "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"), "color.php:import" => array("title" => __("Colors"), "mapping" => "index.php:", "url" => "color.php", "level" => "1"), "data_input.php:actions" => array("title" => __("Actions"), "mapping" => "index.php:,data_input.php:", "url" => "", "level" => "2"), "data_input.php:" => array("title" => __("Data Input Methods"), "mapping" => "index.php:", "url" => "data_input.php", "level" => "1"), "data_input.php:edit" => array("title" => __("(Edit)"), "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_input.php:remove" => array("title" => __("(Remove)"), "mapping" => "index.php:,data_input.php:", "url" => "", "level" => "2"), "data_queries.php:actions" => array("title" => __("Actions"), "mapping" => "index.php:,data_queries.php:", "url" => "", "level" => "2"), "data_queries.php:" => array("title" => __("Data Queries"), "mapping" => "index.php:", "url" => "data_queries.php", "level" => "1"), "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"), "data_sources.php:actions" => array("title" => __("Actions"), "mapping" => "index.php:,data_sources.php:", "url" => "", "level" => "2"), "data_sources.php:" => array("title" => __("Data Sources"), "mapping" => "index.php:", "url" => "data_sources.php", "level" => "1"), "data_sources.php:data_source_edit" => array("title" => __("(Edit)"), "mapping" => "index.php:,data_sources.php:", "url" => "", "level" => "2"), "data_sources.php:ds_edit" => array("title" => __("(Edit)"), "mapping" => "index.php:,data_sources.php:", "url" => "", "level" => "2"), "data_sources.php:ds_toggle_status" => array("title" => "(Disable)", "mapping" => "index.php:,data_sources.php:", "url" => "", "level" => "2"), "data_sources_items.php:item_edit" => array("title" => __("Data Source Items"), "mapping" => "index.php:,data_sources.php:,data_sources.php:data_source_edit", "url" => "", "level" => "3"), "data_templates.php:actions" => array("title" => __("Actions"), "mapping" => "index.php:,data_templates.php:", "url" => "", "level" => "2"), "data_templates.php:" => array("title" => __("Data Source 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_items.php:item_edit" => array("title" => __("Data Template Items"), "mapping" => "index.php:,data_templates.php:,data_templates.php:template_edit", "url" => "", "level" => "3"), "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:actions" => array("title" => __("Actions"), "mapping" => "index.php:,gprint_presets.php:", "url" => "", "level" => "2"), "graph.php:" => array("title" => "|current_graph_title|", "mapping" => "graph_view.php:,?", "level" => "2"), "graph.php:properties" => array("title" => __("Properties"), "mapping" => "graph_view.php:,?,graph.php:view", "level" => "3"), "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_settings.php:" => array("title" => __("Settings"), "mapping" => "graph_view.php:", "url" => "graph_settings.php", "level" => "1"), "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"), "graphs.php:actions" => array("title" => __("Actions"), "mapping" => "index.php:,graphs.php:", "url" => "", "level" => "2"), "graphs.php:" => array("title" => __("Graph Management"), "mapping" => "index.php:", "url" => "graphs.php", "level" => "1"), "graphs.php:graph_diff" => array("title" => __("Change Graph Template"), "mapping" => "index.php:,graphs.php:,graphs.php:graph_edit", "url" => "", "level" => "3"), "graphs.php:graph_edit" => array("title" => __("(Edit)"), "mapping" => "index.php:,graphs.php:", "url" => "", "level" => "2"), "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"), "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.php:actions" => array("title" => __("Actions"), "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.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_view.php:" => array("title" => __("Graphs"), "mapping" => "", "url" => "graph_view.php", "level" => "0"), "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_view.php:tree" => array("title" => __("Tree Mode"), "mapping" => "graph_view.php:", "url" => "graph_view.php?action=tree", "level" => "1"), "sites.php:actions" => array("title" => __("Actions"), "mapping" => "index.php:,sites.php:", "url" => "", "level" => "2"), "sites.php:" => array("title" => __("Sites"), "mapping" => "index.php:", "url" => "sites.php", "level" => "1"), "sites.php:edit" => array("title" => __("(Edit)"), "mapping" => "index.php:,sites.php:", "url" => "", "level" => "2"), "devices.php:actions" => array("title" => __("Actions"), "mapping" => "index.php:,devices.php:", "url" => "", "level" => "2"), "devices.php:" => array("title" => __("Devices"), "mapping" => "index.php:", "url" => "devices.php", "level" => "1"), "devices.php:save" => array("title" => __("Devices"), "mapping" => "index.php:", "url" => "devices.php", "level" => "1"), "devices.php:edit" => array("title" => __("(Edit)"), "mapping" => "index.php:,devices.php:", "url" => "", "level" => "2"), "devices.php:create" => array("title" => __("Devices"), "mapping" => "index.php:", "url" => "devices.php", "level" => "1"), "pollers.php:actions" => array("title" => __("Actions"), "mapping" => "index.php:,pollers.php:", "url" => "", "level" => "2"), "pollers.php:" => array("title" => __("Pollers"), "mapping" => "index.php:", "url" => "pollers.php", "level" => "1"), "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; }
function draw_navigation_text() { require_once(CACTI_BASE_PATH . "/lib/sys/http.php"); $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:", "level" => "1" ), "index.php:" => array( "title" => _("Console"), "mapping" => "", "url" => "index.php", "level" => "0" ), "graphs.php:" => array( "title" => _("Graph Management"), "mapping" => "index.php:", "level" => "1" ), "graphs.php:edit" => array( "title" => _("(Edit)"), "mapping" => "index.php:,graphs.php:", "level" => "2" ), "graphs.php:actions" => array( "title" => _("Actions"), "mapping" => "index.php:,graphs.php:", "level" => "2" ), "graphs_items.php:edit" => array( "title" => _("Graph Items"), "mapping" => "index.php:,graphs.php:,graphs.php:edit", "level" => "3" ), "graphs_new.php:" => array( "title" => _("Create New Graphs"), "mapping" => "index.php:", "level" => "1" ), "graphs_new.php:save" => array( "title" => _("Create Graphs from Data Query"), "mapping" => "index.php:,graphs_new.php:", "level" => "2" ), "graph_trees.php:" => array( "title" => _("Graph Trees"), "mapping" => "index.php:", "level" => "1" ), "graph_trees.php:edit" => array( "title" => _("(Edit)"), "mapping" => "index.php:,graph_trees.php:", "level" => "2" ), "graph_trees.php:remove" => array( "title" => _("(Remove)"), "mapping" => "index.php:,graph_trees.php:", "level" => "2" ), "graph_trees.php:item_edit" => array( "title" => _("Graph Tree Items"), "mapping" => "index.php:,graph_trees.php:,graph_trees.php:edit", "level" => "3" ), "graph_trees.php:item_remove" => array( "title" => _("(Remove Item)"), "mapping" => "index.php:,graph_trees.php:,graph_trees.php:edit", "level" => "3" ), "graph_templates.php:" => array( "title" => _("Graph Templates"), "mapping" => "index.php:", "level" => "1" ), "graph_templates.php:sv_add" => array( "title" => _("(Edit)"), "mapping" => "index.php:,graph_templates.php:", "level" => "2" ), "graph_templates.php:edit" => array( "title" => _("(Edit)"), "mapping" => "index.php:,graph_templates.php:", "level" => "2" ), "graph_templates.php:actions" => array( "title" => _("Actions"), "mapping" => "index.php:,graph_templates.php:", "level" => "2" ), "graph_templates_items.php:edit" => array( "title" => _("Graph Template Items"), "mapping" => "index.php:,graph_templates.php:,graph_templates.php:edit", "level" => "3" ), "graph_templates_inputs.php:edit" => array( "title" => _("Graph Item Inputs"), "mapping" => "index.php:,graph_templates.php:,graph_templates.php:edit", "level" => "3" ), "graph_templates_inputs.php:remove" => array( "title" => _("(Remove)"), "mapping" => "index.php:,graph_templates.php:,graph_templates.php:edit", "level" => "3" ), "device_templates.php:" => array( "title" => _("Device Templates"), "mapping" => "index.php:", "level" => "1" ), "device_templates.php:edit" => array( "title" => _("(Edit)"), "mapping" => "index.php:,device_templates.php:", "level" => "2" ), "device_templates.php:actions" => array( "title" => _("Actions"), "mapping" => "index.php:,device_templates.php:", "level" => "2" ), "graph_templates.php:actions" => array( "title" => _("Actions"), "mapping" => "index.php:,graph_templates.php:", "level" => "2" ), "data_templates.php:" => array( "title" => _("Data Templates"), "mapping" => "index.php:", "level" => "1" ), "data_templates.php:edit" => array( "title" => _("(Edit)"), "mapping" => "index.php:,data_templates.php:", "level" => "2" ), "data_templates.php:sv_add" => array( "title" => _("(Edit)"), "mapping" => "index.php:,data_templates.php:", "level" => "2" ), "data_templates.php:item_add" => array( "title" => _("(Edit)"), "mapping" => "index.php:,data_templates.php:", "level" => "2" ), "data_templates.php:actions" => array( "title" => _("Actions"), "mapping" => "index.php:,data_templates.php:", "level" => "2" ), "data_sources.php:" => array( "title" => _("Data Sources"), "mapping" => "index.php:", "level" => "1" ), "data_sources.php:edit" => array( "title" => _("(Edit)"), "mapping" => "index.php:,data_sources.php:", "level" => "2" ), "data_sources.php:item_add" => array( "title" => _("(Edit)"), "mapping" => "index.php:,data_sources.php:", "level" => "2" ), "data_sources.php:actions" => array( "title" => _("Actions"), "mapping" => "index.php:,data_sources.php:", "level" => "2" ), "devices.php:" => array( "title" => _("Devices"), "mapping" => "index.php:", "level" => "1" ), "devices.php:edit" => array( "title" => _("(Edit)"), "mapping" => "index.php:,devices.php:", "level" => "2" ), "devices.php:actions" => array( "title" => _("Actions"), "mapping" => "index.php:,devices.php:", "level" => "2" ), "scripts.php:" => array( "title" => _("Data Input Methods"), "mapping" => "index.php:", "level" => "1" ), "scripts.php:edit" => array( "title" => _("(Edit)"), "mapping" => "index.php:,scripts.php:", "level" => "2" ), "scripts.php:remove" => array( "title" => _("(Remove)"), "mapping" => "index.php:,scripts.php:", "level" => "2" ), "scripts.php:field_edit" => array( "title" => _("Data Input Fields"), "mapping" => "index.php:,scripts.php:,scripts.php:edit", "level" => "3" ), "scripts.php:field_remove" => array( "title" => _("(Remove Item)"), "mapping" => "index.php:,scripts.php:,scripts.php:edit", "level" => "3" ), "data_queries.php:" => array( "title" => _("Data Queries"), "mapping" => "index.php:", "level" => "1" ), "data_queries.php:edit" => array( "title" => _("(Edit)"), "mapping" => "index.php:,data_queries.php:", "level" => "2" ), "data_queries.php:remove" => array( "title" => _("(Remove)"), "mapping" => "index.php:,data_queries.php:", "level" => "2" ), "data_queries.php:item_edit" => array( "title" => _("Associated Graph Templates"), "mapping" => "index.php:,data_queries.php:,data_queries.php:edit", "level" => "3" ), "data_queries.php:item_remove" => array( "title" => _("(Remove Item)"), "mapping" => "index.php:,data_queries.php:,data_queries.php:edit", "level" => "3" ), "utilities.php:" => array( "title" => _("Utilities"), "mapping" => "index.php:", "level" => "1" ), "utilities.php:view_poller_cache" => array( "title" => _("View Poller Cache"), "mapping" => "index.php:,utilities.php:", "level" => "2" ), "utilities.php:view_snmp_cache" => array( "title" => _("View SNMP Cache"), "mapping" => "index.php:,utilities.php:", "level" => "2" ), "utilities.php:rebuild_poller_cache" => array( "title" => _("Rebuild Poller Cache"), "mapping" => "index.php:,utilities.php:", "level" => "2" ), "utilities.php:view_logs" => array( "title" => _("View Cacti Logs"), "mapping" => "index.php:,utilities.php:", "level" => "2" ), "utilities.php:clear_syslog" => array( "title" => _("Clear Cacti Syslog"), "mapping" => "index.php:,utilities.php:", "level" => "2" ), "settings.php:" => array( "title" => _("Cacti Settings"), "mapping" => "index.php:", "level" => "1" ), "user_admin.php:" => array( "title" => _("User Management"), "mapping" => "index.php:", "level" => "1" ), "user_admin.php:actions" => array( "title" => _("User Management"), "mapping" => "index.php:", "level" => "2" ), "user_admin.php:user_edit" => array( "title" => _("(Edit)"), "mapping" => "index.php:,user_admin.php:", "level" => "2" ), "user_admin.php:user_remove" => array( "title" => _("(Remove)"), "mapping" => "index.php:,user_admin.php:", "level" => "2" ), "user_admin.php:graph_perms_edit" => array( "title" => _("Edit (Graph Permissions)"), "mapping" => "index.php:,user_admin.php:", "level" => "2" ), "user_admin.php:user_realms_edit" => array( "title" => _("Edit (Realm Permissions)"), "mapping" => "index.php:,user_admin.php:", "level" => "2" ), "user_admin.php:graph_settings_edit" => array( "title" => _("Edit (Graph Settings)"), "mapping" => "index.php:,user_admin.php:", "level" => "2" ), "user_admin.php:user_settings_edit" => array( "title" => _("Edit (User Settings)"), "mapping" => "index.php:,user_admin.php:", "level" => "2" ), "about.php:" => array( "title" => _("About Cacti"), "mapping" => "index.php:", "level" => "1" ), "packages.php:" => array( "title" => _("Template Packages"), "mapping" => "index.php:", "level" => "1" ), "packages.php:view" => array( "title" => _("(View)"), "mapping" => "index.php:,packages.php:", "level" => "2" ), "packages.php:edit" => array( "title" => _("(Edit)"), "mapping" => "index.php:,packages.php:", "level" => "2" ), "packages.php:edit_metadata" => array( "title" => _("Metadata"), "mapping" => "index.php:,packages.php:,packages.php:edit", "level" => "3" ), "pollers.php:" => array( "title" => _("Pollers"), "mapping" => "index.php:", "level" => "1" ), "pollers.php:edit" => array( "title" => _("(Edit)"), "mapping" => "index.php:,pollers.php:", "level" => "2" ), "pollers.php:actions" => array( "title" => _("Actions"), "mapping" => "index.php:,pollers.php:", "level" => "2" ), "user_changepassword.php:" => array( "title" => _("Change Password"), "mapping" => "index.php:", "level" => "1" ), "user_changepassword.php:save" => array( "title" => _("Change Password"), "mapping" => "index.php:", "level" => "1" ), "user_settings.php:" => array( "title" => _("User Settings"), "mapping" => "index.php:", "level" => "1" ), "presets.php:" => array( "title" => _("Data Presets"), "mapping" => "index.php:", "url" => "presets.php", "level" => "1" ), "presets.php:view_cdef" => array( "title" => _("CDEFs"), "mapping" => "index.php:,presets.php:", "level" => "2" ), "presets.php:view_color" => array( "title" => _("Colors"), "mapping" => "index.php:,presets.php:", "level" => "2" ), "presets.php:view_gprint" => array( "title" => _("GPRINTs"), "mapping" => "index.php:,presets.php:", "level" => "2" ), "presets_cdef.php:edit" => array( "title" => _("(Edit)"), "mapping" => "index.php:,presets.php:,presets.php:view_cdef", "level" => "3" ), "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; }
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; } }