improved graph errors

git-svn-id: http://www.observium.org/svn/observer/trunk@1627 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong 2010-08-02 22:25:26 +00:00
parent 4d5380e2cc
commit 55823e3844

View File

@ -94,11 +94,21 @@ function graph_error ($string)
if(!$auth) if(!$auth)
{ {
graph_error("Unauthorized"); if($width < 200)
{
graph_error("No Auth");
} else {
graph_error("No Authorisation");
}
} else { } else {
if($no_file) if($no_file)
{ {
graph_error("Missing RRD"); if($width < 200)
{
graph_error("No RRD");
} else {
graph_error("Missing RRD Datafile");
}
} else { } else {
if($rrd_options) if($rrd_options)
{ {
@ -106,15 +116,25 @@ 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>"); }
if(is_file($graphfile)) { if(is_file($graphfile) && 0) {
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);
unlink($graphfile); unlink($graphfile);
} else { } else {
graph_error("Drawing Error"); if($width < 200)
{
graph_error("Draw Error");
} else {
graph_error("Error Drawing Graph");
}
} }
} else { } else {
graph_error("Definition Error"); if($width < 200)
{
graph_error("Def Error");
} else {
graph_error("Graph Definition Error");
}
} }
} }
} }