YOU DO NOT HAVE RIGHTS FOR TREE VIEW"; exit;
}
/* if cacti's builtin authentication is turned on then make sure to take
graph permissions into account here. if a user does not have rights to a
particular graph; do not show it. they will get an access denied message
if they try and view the graph directly. */
if (read_config_option("global_auth") == "on") {
/* take tree permissions into account here, if the user does not have permission
give an "access denied" message */
$user_auth = db_fetch_row("select user_id from user_auth_tree where tree_id=" . $_SESSION["sess_view_tree_id"] . " and user_id=" . $_SESSION["sess_user_id"]);
if ($current_user["graph_policy"] == "1") {
if (sizeof($user_auth) > 0) { $access_denied = true; }
}elseif ($current_user["graph_policy"] == "2") {
if (sizeof($user_auth) == 0) { $access_denied = true; }
}
if ($access_denied == true) {
print "ACCESS DENIED"; exit;
}
}
print "
|
[root] - " . db_fetch_cell("select name from graph_tree where id=" . $_SESSION["sess_view_tree_id"]) . "
|
\n";
grow_graph_tree($_SESSION["sess_view_tree_id"], $start_branch, $user_id, $tree_parameters);
break;
case 'preview':
if ($current_user["show_preview"] == "") {
print "YOU DO NOT HAVE RIGHTS FOR PREVIEW VIEW"; exit;
}
/* graph permissions */
if (read_config_option("global_auth") == "on") {
if ($current_user["graph_policy"] == "1") {
$sql_where = "where user_auth_graph.user_id is null";
}elseif ($current_user["graph_policy"] == "2") {
$sql_where = "where user_auth_graph.user_id is not null";
}
$graphs = db_fetch_assoc("select
graph_templates_graph.local_graph_id,
graph_templates_graph.title
from graph_templates_graph
left join user_auth_graph on (graph_templates_graph.local_graph_id=user_auth_graph.local_graph_id and user_auth_graph.user_id=" . $_SESSION["sess_user_id"] . ")
$sql_where
and graph_templates_graph.local_graph_id > 0
order by graph_templates_graph.title");
}else{
$graphs = db_fetch_assoc("select
local_graph_id,title
from graph_templates_graph
where local_graph_id > 0
order by title");
}
print "";
if (sizeof($graphs) > 0) {
foreach ($graphs as $graph) {
print "![" . $graph["title"] . "](graph_image.php?local_graph_id=" . $graph["local_graph_id"] . "&rra_id=" . read_graph_config_option("default_rra_id") . "&graph_start=-" . read_graph_config_option("timespan") . "&graph_height=" . read_graph_config_option("default_height") . "&graph_width=" . read_graph_config_option("default_width") . "&graph_nolegend=true) | \n";
$i++;
$k++;
if (($i == read_graph_config_option("num_columns")) && ($k < sizeof($graphs))) {
$i = 0;
print "
| |
\n";
}
}
}
print "
";
break;
case 'list':
if ($current_user["show_list"] == "") {
print "YOU DO NOT HAVE RIGHTS FOR LIST VIEW"; exit;
}
/* graph permissions */
if (read_config_option("global_auth") == "on") {
if ($current_user["graph_policy"] == "1") {
$sql_where = "where user_auth_graph.user_id is null";
}elseif ($current_user["graph_policy"] == "2") {
$sql_where = "where user_auth_graph.user_id is not null";
}
$graphs = db_fetch_assoc("select
graph_templates_graph.local_graph_id,
graph_templates_graph.title
from graph_templates_graph
left join user_auth_graph on (graph_templates_graph.local_graph_id=user_auth_graph.local_graph_id and user_auth_graph.user_id=" . $_SESSION["sess_user_id"] . ")
$sql_where
and graph_templates_graph.local_graph_id > 0
order by graph_templates_graph.title");
}else{
$graphs = db_fetch_assoc("select
local_graph_id,title
from graph_templates_graph
where local_graph_id > 0
order by title");
}
print "";
break;
}
print "";print $_SESSION["sess_debug_buffer"];print "
";session_unregister("sess_debug_buffer");
include_once ("include/bottom_footer.php");