diff options
Diffstat (limited to '')
-rw-r--r-- | graph.php | 20 |
1 files changed, 4 insertions, 16 deletions
@@ -8,29 +8,17 @@ $width = empty($_GET['x']) ? $CONFIG['width'] : $_GET['x']; | |||
8 | $heigth = empty($_GET['y']) ? $CONFIG['heigth'] : $_GET['y']; | 8 | $heigth = empty($_GET['y']) ? $CONFIG['heigth'] : $_GET['y']; |
9 | 9 | ||
10 | if (validate_get($_GET['h'], 'host') === NULL) { | 10 | if (validate_get($_GET['h'], 'host') === NULL) { |
11 | die_img('Error: plugin contains unknown characters.'); | 11 | error_log('CGP Error: plugin contains unknown characters'); |
12 | exit; | 12 | error_image(); |
13 | } | 13 | } |
14 | 14 | ||
15 | if (!file_exists($CONFIG['webdir'].'/plugin/'.$plugin.'.php')) { | 15 | if (!file_exists($CONFIG['webdir'].'/plugin/'.$plugin.'.php')) { |
16 | die_img(sprintf('Error: plugin not available (%s).', $plugin)); | 16 | error_log(sprintf('CGP Error: plugin "%s" is not available', $plugin)); |
17 | exit; | 17 | error_image(); |
18 | } | 18 | } |
19 | 19 | ||
20 | # load plugin | 20 | # load plugin |
21 | include $CONFIG['webdir'].'/plugin/'.$plugin.'.php'; | 21 | include $CONFIG['webdir'].'/plugin/'.$plugin.'.php'; |
22 | 22 | ||
23 | 23 | ||
24 | function die_img($msg) { | ||
25 | header("Content-Type: image/png"); | ||
26 | $image = ImageCreatetruecolor(300, 30); | ||
27 | $black = ImageColorAllocate($image, 0, 0, 0); | ||
28 | $white = ImageColorAllocate($image, 255, 255, 255); | ||
29 | imagefill($image, 0, 0, $white); | ||
30 | imagerectangle($image, 0, 0, 299, 29, $black); | ||
31 | imagestring($image, 2, 10, 9, $msg, $black); | ||
32 | imagepng($image); | ||
33 | imagedestroy($image); | ||
34 | } | ||
35 | |||
36 | ?> | 24 | ?> |