mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
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:
@ -1,4 +1,4 @@
|
|||||||
<?
|
<?php
|
||||||
|
|
||||||
if(is_numeric($id) && application_permitted($id))
|
if(is_numeric($id) && application_permitted($id))
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?
|
<?php
|
||||||
|
|
||||||
if ($_SESSION['userlevel'] >= "5")
|
if ($_SESSION['userlevel'] >= "5")
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?
|
<?php
|
||||||
|
|
||||||
if(is_numeric($id) && device_permitted($id))
|
if(is_numeric($id) && device_permitted($id))
|
||||||
{
|
{
|
||||||
|
@ -21,8 +21,18 @@ if($_GET['debug']) {
|
|||||||
include("includes/functions.inc.php");
|
include("includes/functions.inc.php");
|
||||||
include("includes/authenticate.inc.php");
|
include("includes/authenticate.inc.php");
|
||||||
|
|
||||||
if(!$config['allow_unauth_graphs']) {
|
$from = mres($_GET['from']);
|
||||||
if(!$_SESSION['authenticated']) { echo("not authenticated"); exit; }
|
$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']) {
|
# if($_GET['device']) {
|
||||||
@ -43,15 +53,6 @@ if($_GET['debug']) {
|
|||||||
|
|
||||||
if($debug) {print_r($graphtype);}
|
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";
|
$graphfile = $config['temp_dir'] . "/" . strgen() . ".png";
|
||||||
|
|
||||||
# $os = gethostosbyid($device_id);
|
# $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");
|
graph_error("Graph Template Missing");
|
||||||
}
|
}
|
||||||
|
|
||||||
function graph_error ($string) {
|
function graph_error ($string)
|
||||||
global $width, $height;
|
{
|
||||||
header('Content-type: image/png');
|
global $width, $height;
|
||||||
$im = imagecreate($width+79, $height);
|
header('Content-type: image/png');
|
||||||
$orange = imagecolorallocate($im, 255, 225, 225);
|
$im = imagecreate($width+79, $height);
|
||||||
$px = (imagesx($im) - 7.5 * strlen($string)) / 2;
|
$orange = imagecolorallocate($im, 255, 225, 225);
|
||||||
imagestring($im, 3, $px, $height / 2 - 8, $string, imagecolorallocate($im, 128, 0, 0));
|
$px = (imagesx($im) - 7.5 * strlen($string)) / 2;
|
||||||
imagepng($im);
|
imagestring($im, 3, $px, $height / 2 - 8, $string, imagecolorallocate($im, 128, 0, 0));
|
||||||
imagedestroy($im);
|
imagepng($im);
|
||||||
|
imagedestroy($im);
|
||||||
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -102,9 +105,6 @@ if(!$auth)
|
|||||||
$rrd_cmd = $config['rrdtool'] . " graph $graphfile $rrd_options" . $rrd_switches;
|
$rrd_cmd = $config['rrdtool'] . " graph $graphfile $rrd_options" . $rrd_switches;
|
||||||
$woo = shell_exec($rrd_cmd);
|
$woo = shell_exec($rrd_cmd);
|
||||||
if($_GET['debug']) { echo("<pre>".$rrd_cmd."</pre>"); }
|
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)) {
|
if(is_file($graphfile)) {
|
||||||
header('Content-type: image/png');
|
header('Content-type: image/png');
|
||||||
$fd = fopen($graphfile,'r');fpassthru($fd);fclose($fd);
|
$fd = fopen($graphfile,'r');fpassthru($fd);fclose($fd);
|
||||||
@ -118,5 +118,4 @@ if(!$auth)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -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);
|
$mempool = mysql_fetch_assoc($sql);
|
||||||
|
|
||||||
if(is_numeric($mempool['device_id']) && device_permitted($mempool['device_id']))
|
if(is_numeric($mempool['device_id']) && device_permitted($mempool['device_id']))
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?
|
<?php
|
||||||
|
|
||||||
### FIXME
|
### FIXME
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?
|
<?php
|
||||||
|
|
||||||
if(is_numeric($id) && port_permitted($id)) {
|
if(is_numeric($id) && port_permitted($id)) {
|
||||||
$port = get_port_by_id($id);
|
$port = get_port_by_id($id);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?
|
<?php
|
||||||
|
|
||||||
$sql = mysql_query("SELECT * FROM `processors` where `processor_id` = '".mres($_GET['id'])."'");
|
$sql = mysql_query("SELECT * FROM `processors` where `processor_id` = '".mres($_GET['id'])."'");
|
||||||
$proc = mysql_fetch_assoc($sql);
|
$proc = mysql_fetch_assoc($sql);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?
|
<?php
|
||||||
|
|
||||||
if(is_numeric($id))
|
if(is_numeric($id))
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user