fix broken graphs with disabled short tags

git-svn-id: http://www.observium.org/svn/observer/trunk@1613 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2010-08-02 16:38:03 +00:00
parent 9de41e19b4
commit fb3befd29d
9 changed files with 33 additions and 34 deletions

View File

@ -1,4 +1,4 @@
<?
<?php
if(is_numeric($id) && application_permitted($id))
{

View File

@ -1,4 +1,4 @@
<?
<?php
if ($_SESSION['userlevel'] >= "5")
{

View File

@ -1,4 +1,4 @@
<?
<?php
if(is_numeric($id) && device_permitted($id))
{

View File

@ -21,8 +21,18 @@ if($_GET['debug']) {
include("includes/functions.inc.php");
include("includes/authenticate.inc.php");
if(!$config['allow_unauth_graphs']) {
if(!$_SESSION['authenticated']) { echo("not authenticated"); exit; }
$from = mres($_GET['from']);
$to = mres($_GET['to']);
$width = mres($_GET['width']);
$height = mres($_GET['height']);
$title = mres($_GET['title']);
$vertical = mres($_GET['vertical']);
$legend = mres($_GET['legend']);
$id = mres($_GET['id']);
if(!$config['allow_unauth_graphs'])
{
if(!$_SESSION['authenticated']) { graph_error("Not authenticated"); exit; }
}
# if($_GET['device']) {
@ -43,15 +53,6 @@ if($_GET['debug']) {
if($debug) {print_r($graphtype);}
$from = mres($_GET['from']);
$to = mres($_GET['to']);
$width = mres($_GET['width']);
$height = mres($_GET['height']);
$title = mres($_GET['title']);
$vertical = mres($_GET['vertical']);
$legend = mres($_GET['legend']);
$id = mres($_GET['id']);
$graphfile = $config['temp_dir'] . "/" . strgen() . ".png";
# $os = gethostosbyid($device_id);
@ -76,15 +77,17 @@ if(is_file($config['install_dir'] . "/html/includes/graphs/$type/$subtype.inc.ph
graph_error("Graph Template Missing");
}
function graph_error ($string) {
global $width, $height;
header('Content-type: image/png');
$im = imagecreate($width+79, $height);
$orange = imagecolorallocate($im, 255, 225, 225);
$px = (imagesx($im) - 7.5 * strlen($string)) / 2;
imagestring($im, 3, $px, $height / 2 - 8, $string, imagecolorallocate($im, 128, 0, 0));
imagepng($im);
imagedestroy($im);
function graph_error ($string)
{
global $width, $height;
header('Content-type: image/png');
$im = imagecreate($width+79, $height);
$orange = imagecolorallocate($im, 255, 225, 225);
$px = (imagesx($im) - 7.5 * strlen($string)) / 2;
imagestring($im, 3, $px, $height / 2 - 8, $string, imagecolorallocate($im, 128, 0, 0));
imagepng($im);
imagedestroy($im);
exit();
}
@ -102,9 +105,6 @@ if(!$auth)
$rrd_cmd = $config['rrdtool'] . " graph $graphfile $rrd_options" . $rrd_switches;
$woo = shell_exec($rrd_cmd);
if($_GET['debug']) { echo("<pre>".$rrd_cmd."</pre>"); }
# $thing = popen($config['rrdtool'] . " -",'w');
# fputs($thing, "graph $graphfile $rrd_options");
# pclose($thing);
if(is_file($graphfile)) {
header('Content-type: image/png');
$fd = fopen($graphfile,'r');fpassthru($fd);fclose($fd);
@ -118,5 +118,4 @@ if(!$auth)
}
}
?>

View File

@ -1,8 +1,8 @@
<?
<?php
if(is_numeric($_GET['id']))
if(is_numeric($id))
{
$sql = mysql_query("SELECT * FROM `mempools` AS C, `devices` AS D where C.`mempool_id` = '".mres($_GET['id'])."' AND C.device_id = D.device_id");
$sql = mysql_query("SELECT * FROM `mempools` AS C, `devices` AS D where C.`mempool_id` = '".mres($id)."' AND C.device_id = D.device_id");
$mempool = mysql_fetch_assoc($sql);
if(is_numeric($mempool['device_id']) && device_permitted($mempool['device_id']))

View File

@ -1,4 +1,4 @@
<?
<?php
### FIXME

View File

@ -1,4 +1,4 @@
<?
<?php
if(is_numeric($id) && port_permitted($id)) {
$port = get_port_by_id($id);

View File

@ -1,4 +1,4 @@
<?
<?php
$sql = mysql_query("SELECT * FROM `processors` where `processor_id` = '".mres($_GET['id'])."'");
$proc = mysql_fetch_assoc($sql);

View File

@ -1,4 +1,4 @@
<?
<?php
if(is_numeric($id))
{