// Additions to Pandora FMS 1.2 graph code and new XML reporting template management
// 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; 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.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
// Global & session management
include ("../include/config.php");
session_start();
include ("../include/functions.php");
include("../include/functions_db.php");
include("../include/languages/language_".$language_code.".php");
// Access control
if (comprueba_login() != 0) {
$REMOTE_ADDR = getenv ("REMOTE_ADDR");
audit_db("Unknown",$REMOTE_ADDR, "ACL Violation","Trying to access graph window without auth");
require ("general/noaccess.php");
exit;
}
// Parsing the refresh before sending any header
if (isset($_GET['refresh']) and is_numeric($_GET['refresh']) and $_GET['refresh']>0) {
header( 'refresh: ' . $_GET['refresh'] );
}
// Read styles
echo '';
// Get input parameters
if (isset($_GET["label"]))
$label = entrada_limpia($_GET["label"]);
if (!isset($_GET["period"]) OR (!isset($_GET["id"]))) {
echo "
".$lang_label["graf_error"]."
";
exit;
}
if (isset($_GET["draw_events"]))
$draw_events = entrada_limpia($_GET["draw_events"]);
else
$draw_events = 0;
if (isset($_GET["period"]))
$period = entrada_limpia($_GET["period"]);
else
$period = 3600; // 1 hour (the most fast query possible)
switch ($period) {
case 3600: $period_label = "Hour";
break;
case 21600: $period_label = "6 Hours";
break;
case 43200: $period_label = "12 Hours";
break;
case 86400: $period_label = "Day";
break;
case 172800: $period_label = "Two days";
break;
case 604800: $period_label = "Last Week";
break;
case 1296000: $period_label = "15 Days";
break;
case 2592000: $period_label = "Last Month";
break;
case 5184000: $period_label = "Two Month";
break;
case 15552000: $period_label = "Six Months";
break;
default: $period_label = "--";
}
if (isset($_GET["draw_alerts"]))
$draw_alerts = entrada_limpia($_GET["draw_alerts"]);
else
$draw_alerts = 0;
if (isset($_GET["refresh"]))
$refresh = entrada_limpia($_GET["refresh"]);
else
$refresh = 0;
if (isset($_GET["period"]))
$period = entrada_limpia($_GET["period"]);
else
$period = 86400; // 1 day default period
if (isset($_GET["id"]))
$id = entrada_limpia($_GET["id"]);
else
$id = 0;
if (isset($_GET["width"]))
$width = entrada_limpia($_GET["width"]);
else
$width = 525;
if (isset($_GET["height"]))
$height = entrada_limpia ($_GET["height"]);
else
$height = 220;
if (isset($_GET["label"]))
$label = entrada_limpia ($_GET["label"]);
else
$label = "";
if (isset($_GET["zoom"])){
$zoom = entrada_limpia ($_GET["zoom"]);
$height=$height*$zoom;
$width=$width*$zoom;
}
else
$zoom = "1";
echo "";
?>