diff options
author | Pim van den Berg | 2010-06-05 11:47:24 +0200 |
---|---|---|
committer | Pim van den Berg | 2010-06-05 11:47:24 +0200 |
commit | ec5d8f568a48b578234d736a21e151b315711a82 (patch) | |
tree | cbf0954ed5e68329c307fbce2df7a6d2eb67ec75 | |
parent | Define alternating odd/even css classes for rows in main summary (diff) | |
download | apt-panopticon_cgp-ec5d8f568a48b578234d736a21e151b315711a82.zip apt-panopticon_cgp-ec5d8f568a48b578234d736a21e151b315711a82.tar.gz apt-panopticon_cgp-ec5d8f568a48b578234d736a21e151b315711a82.tar.bz2 apt-panopticon_cgp-ec5d8f568a48b578234d736a21e151b315711a82.tar.xz |
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.
Diffstat (limited to '')
-rw-r--r-- | graph.php | 20 | ||||
-rw-r--r-- | inc/functions.inc.php | 6 | ||||
-rw-r--r-- | layout/error.png | bin | 0 -> 3193 bytes | |||
-rw-r--r-- | layout/error.xcf | bin | 0 -> 13461 bytes |
4 files changed, 10 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 | ?> |
diff --git a/inc/functions.inc.php b/inc/functions.inc.php index b0706d5..04e58e3 100644 --- a/inc/functions.inc.php +++ b/inc/functions.inc.php | |||
@@ -27,4 +27,10 @@ function crc32hex($str) { | |||
27 | return sprintf("%x",crc32($str)); | 27 | return sprintf("%x",crc32($str)); |
28 | } | 28 | } |
29 | 29 | ||
30 | function error_image() { | ||
31 | header("Content-Type: image/png"); | ||
32 | readfile('layout/error.png'); | ||
33 | exit; | ||
34 | } | ||
35 | |||
30 | ?> | 36 | ?> |
diff --git a/layout/error.png b/layout/error.png new file mode 100644 index 0000000..421fbfe --- /dev/null +++ b/layout/error.png | |||
Binary files differ | |||
diff --git a/layout/error.xcf b/layout/error.xcf new file mode 100644 index 0000000..4ff54e3 --- /dev/null +++ b/layout/error.xcf | |||
Binary files differ | |||