Files
cacti/graph.php
T
Ian Berry 85dd291c42 making everything work under E_ALL
git-svn-id: svn+ssh://repo.cacti.net/var/data/svnroot/cacti/trunk/cacti@483 860744bd-22fc-0310-8c96-e9fe5004b5ca
2003-02-09 09:19:28 +00:00

86 lines
3.9 KiB
PHP

<?php
/*
+-------------------------------------------------------------------------+
| Copyright (C) 2003 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: a php-based graphing solution |
+-------------------------------------------------------------------------+
| Most of this code has been designed, written and is maintained by |
| Ian Berry. See about.php for specific developer credit. Any questions |
| or comments regarding this code should be directed to: |
| - iberry@raxnet.net |
+-------------------------------------------------------------------------+
| - raXnet - http://www.raxnet.net/ |
+-------------------------------------------------------------------------+
*/
include_once ("include/rrd_functions.php");
include_once ("include/functions.php");
include ("include/top_graph_header.php");
if ($_GET["rra_id"] == "all") {
$sql_where = " where id is not null";
}else{
$sql_where = " where id=" . $_GET["rra_id"];
}
/* take graph permissions into account here, if the user does not have permission
give an "access denied" message */
if (read_config_option("global_auth") == "on") {
$user_auth = db_fetch_row("select user_id from user_auth_graph where local_graph_id=" . $_GET["local_graph_id"] . " and user_id=" . $_SESSION["sess_user_id"]);
$access_denied = false;
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 "<strong><font size='+1' color='FF0000'>ACCESS DENIED</font></strong>"; exit;
}
}
/* make sure the graph requested exists (sanity) */
if (!(db_fetch_cell("select local_graph_id from graph_templates_graph where local_graph_id=" . $_GET["local_graph_id"]))) {
print "<strong><font size='+1' color='FF0000'>GRAPH DOES NOT EXIST</font></strong>"; exit;
}
$rras = db_fetch_assoc("select id,name from rra $sql_where order by steps");
$graph_title = db_fetch_cell("select title from graph_templates_graph where local_graph_id=" . $_GET["local_graph_id"]);
print "<table width='98%' style='background-color: #f5f5f5; border: 1px solid #bbbbbb;' align='center' cellpadding='3'>";
print "<tr bgcolor='#" . $colors["header_panel"] . "'><td colspan='3' class='textHeaderDark'><strong>Viewing Graph '$graph_title'</strong></td></tr>";
$i = 0;
if (sizeof($rras) > 0) {
foreach ($rras as $rra) {
print "<tr><td>";
print " <div align='center'><img src='graph_image.php?local_graph_id=" . $_GET["local_graph_id"] . "&rra_id=" . $rra["id"] . "' border='0' alt='$graph_title'></div>\n
<div align='center'><strong>" . $rra["name"] . "</strong> [<a href='graph.php?local_graph_id=" . $_GET["local_graph_id"] . "&rra_id=" . $rra["id"] . "&show_source=true'>source</a>]</div><br>\n";
print "</td></tr>";
$i++;
}
}
print "</table>";
print "<br><br>";
include_once ("include/bottom_footer.php");
?>