From ec5d8f568a48b578234d736a21e151b315711a82 Mon Sep 17 00:00:00 2001 From: Pim van den Berg Date: Sat, 5 Jun 2010 11:47:24 +0200 Subject: remove php gd dependency Image error messages were shown using PHP GD. People who haven't installed PHP GD don't understand what is going on when an image is not shown. It is replaced by a static image referring to the error log for more information. --- graph.php | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'graph.php') diff --git a/graph.php b/graph.php index effecef..e170598 100644 --- a/graph.php +++ b/graph.php @@ -8,29 +8,17 @@ $width = empty($_GET['x']) ? $CONFIG['width'] : $_GET['x']; $heigth = empty($_GET['y']) ? $CONFIG['heigth'] : $_GET['y']; if (validate_get($_GET['h'], 'host') === NULL) { - die_img('Error: plugin contains unknown characters.'); - exit; + error_log('CGP Error: plugin contains unknown characters'); + error_image(); } if (!file_exists($CONFIG['webdir'].'/plugin/'.$plugin.'.php')) { - die_img(sprintf('Error: plugin not available (%s).', $plugin)); - exit; + error_log(sprintf('CGP Error: plugin "%s" is not available', $plugin)); + error_image(); } # load plugin include $CONFIG['webdir'].'/plugin/'.$plugin.'.php'; -function die_img($msg) { - header("Content-Type: image/png"); - $image = ImageCreatetruecolor(300, 30); - $black = ImageColorAllocate($image, 0, 0, 0); - $white = ImageColorAllocate($image, 255, 255, 255); - imagefill($image, 0, 0, $white); - imagerectangle($image, 0, 0, 299, 29, $black); - imagestring($image, 2, 10, 9, $msg, $black); - imagepng($image); - imagedestroy($image); -} - ?> -- cgit v1.1