1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
|
<?/*
+-------------------------------------------------------------------------+
| Copyright (C) 2002 Ian Berry |
| |
| This program is free software; you can redistribute it and/or |
| modify it under the terms of the GNU General Public License |
| as published by the Free Software Foundation; either version 2 |
| of the License, or (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
+-------------------------------------------------------------------------+
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
+-------------------------------------------------------------------------+
| This code is currently maintained and debugged by Ian Berry, any |
| questions or comments regarding this code should be directed to: |
| - iberry@raxnet.net |
+-------------------------------------------------------------------------+
| - raXnet - http://www.raxnet.net/ |
+-------------------------------------------------------------------------+
*/?>
<? include ('include/config.php');
$array_settings = LoadSettingsIntoArray($HTTP_COOKIE_VARS["cactilogin"],"guest");
/* if cookie has been set, use it */
if (isset($tree_id) == false) {
if (isset($HTTP_COOKIE_VARS["current_tree"]) == true) {
$tree_id = $HTTP_COOKIE_VARS["current_tree"];
}
}else{
header ("Set-Cookie: current_tree=$tree_id; path=/;");
}
?>
<html>
<head>
<title>cacti</title>
<link href="css/main.css" rel="stylesheet">
<?
$page_refresh = $array_settings["preview"]["pagerefresh"];
echo "<meta http-equiv=refresh content=\"$page_refresh\"; url=\"$PHP_SELF?$QUERY_STRING\">\r\n";
?>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#454E53" colspan="<?print $array_settings["preview"]["columnnumber"];?>" nowrap>
<map name="tabs">
<area alt="Console" coords="7,5,87,35" href="index.php">
<area alt="Graphs" coords="166,5,241,32" href="graph_view.php?action=tree" shape="RECT">
<area alt="Documentation" coords="88,5,165,32" href="docs/MANUAL.htm">
</map>
<img src="images/top_tabs_main.gif" border="0" usemap="#tabs"><br>
</td>
<td bgcolor="#454E53" align="right" nowrap>
<a href="graph_settings.php"><img src="images/top_tabs_graph_settings<?if (basename($SCRIPT_FILENAME) == "graph_settings.php") { print "_down"; }?>.gif" border="0" alt="Settings"></a><a href="graph_view.php?action=tree"><img src="images/top_tabs_graph_tree<?if ($action == "tree") { print "_down"; }?>.gif" border="0" alt="Tree View"></a><a href="graph_view.php?action=list"><img src="images/top_tabs_graph_list<?if ($action == "list") { print "_down"; }?>.gif" border="0" alt="List View"></a><a href="graph_view.php?action=preview"><img src="images/top_tabs_graph_preview<?if ($action == "preview") { print "_down"; }?>.gif" border="0" alt="Preview View"></a><br>
</td>
</tr>
<tr>
<td colspan="3" bgcolor="#<?print $color_panel;?>">
<img src="images/transparent_line.gif" width="170" height="5" border="0"><br>
</td>
</tr>
<tr>
<?if ($action == "tree") {?>
<form name="form_tree_id">
<?
include ("include/database.php");
if ($config["global_auth"]["value"] == "on") {
if ($config["graph_policy"]["auth"] == "1") {
$sql_where = "where agh.userid is null";
}elseif ($config["graph_policy"]["auth"] == "2") {
$sql_where = "where agh.userid is not null";
}
$sql_id = mysql_query("select gh.*,agh.userid
from graph_hierarchy gh
left join auth_graph_hierarchy agh on (gh.id=agh.hierarchyid and agh.userid=" . GetCurrentUserID($HTTP_COOKIE_VARS["cactilogin"], $config["guest_user"]["value"]) . ")
$sql_where
order by gh.name", $cnn_id);
}else{
$sql_id = mysql_query("select * from graph_hierarchy order by name", $cnn_id);
}
$rows = mysql_num_rows($sql_id); $i = 0;
/* set a default tree if none is already selected */
if (isset($tree_id) == false) {
if (isset($array_settings["hierarchical"]["treeid"]) == true) {
$tree_id = $array_settings["hierarchical"]["treeid"];
}else{
if ($rows != 0) {
$tree_id = mysql_result($sql_id, 0, "id");
}
}
}
/* make the dropdown list of trees */
if ($rows > 1) {
?>
<td valign="middle" height="30" colspan="3" bgcolor="#<?print $color_panel;?>">
Select a Graph Hierarchy:
<select name="cbo_tree_id" onChange="window.location=document.form_tree_id.cbo_tree_id.options[document.form_tree_id.cbo_tree_id.selectedIndex].value">
<?while ($i < $rows) { ?>
<option value="graph_view.php?action=tree&tree_id=<?print mysql_result($sql_id, $i, "id"); ?>"
<?if ($tree_id == mysql_result($sql_id, $i, "id")) { ?>
selected <? $tree_name = mysql_result($sql_id, $i, "name"); } ?>><? print mysql_result($sql_id, $i, "name"); ?></option>
<?$i++;
} ?>
</select>
<?
/* there is only one tree; use it */
}elseif ($rows == 1) {?>
<td valign="middle" height="5" colspan="3" bgcolor="#<?print $color_panel;?>">
<?$tree_id = mysql_result($sql_id, 0, "id");
$tree_name = mysql_result($sql_id, 0, "name");
}
?>
</td>
</form>
<?}else{?>
<td height="5" colspan="3" bgcolor="#<?print $color_panel;?>">
</td>
<?}?>
</tr>
<?if ($showinfo == true) {?>
<tr>
<td valign="top" height="1" colspan="3" bgcolor="#<?print $color_panel;?>">
<?$graph_data_array["print_source"] = true;
print trim(rrdtool_function_graph($graphid, $rraid, $graph_data_array));?>
</td>
</tr>
<tr height="5" bgcolor="#<?print $color_dark_outline;?>"><td colspan="3"><img src="images/transparent_line.gif" width="20" height="5" border="0"></td></tr>
<?}?>
</table>
<table width="100%" cellspacing="0" cellpadding="0"
<tr height="5"><td colspan="3"> </td></tr>
<tr>
<td bgcolor="#<?print $color_light;?>" width="1%"></td>
<td valign="top" colspan="2">
|