/* +-------------------------------------------------------------------------+ | 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/ | +-------------------------------------------------------------------------+ */?> $section = "View Graphs"; $guest_account = true; include ('include/auth.php'); include_once ("include/rrd_functions.php"); include_once ("include/functions.php"); include ("include/top_graph_header.php"); if (isset($form[action])) { $action = $form[action]; } else { $action = $args[action]; } if (isset($form[ID])) { $id = $form[ID]; } else { $id = $args[id]; } switch ($args[rraid]) { case 'all': $sql_where = " where id is not null"; break; default: $sql_where = " where id=$rraid"; break; } /* take graph permissions into account here, if the user does not have permission give an "access denied" message */ if ($config["global_auth"]["value"] == "on") { $user = db_fetch_row("select userid from auth_graph where graphid=$graphid and userid=" . GetCurrentUserID($HTTP_COOKIE_VARS["cactilogin"],$config["guest_user"]["value"])); if ($config["graph_policy"]["auth"] == "1") { if (sizeof($user) > 0) { $access_denied = true; } } elseif ($config["graph_policy"]["auth"] == "2") { if (! sizeof($user) > 0) { $access_denied = true; } } if ($access_denied == true) { print "ACCESS DENIED"; exit; } } /* make sure the graph requested exists (sanity) */ $gid = db_fetch_cell("select ID from rrd_graph where id=$graphid"); if (! $gid > 0) { print "GRAPH DOES NOT EXIST"; exit; } $rra_list = db_fetch_assoc("select ID,Name from rrd_rra $sql_where order by steps"); if (sizeof($rra_list) > 0) { foreach ($rra_list as $rra) { ?>