diff options
Diffstat (limited to '')
-rw-r--r-- | graph.php | 22 |
1 files changed, 15 insertions, 7 deletions
@@ -6,16 +6,24 @@ require_once 'inc/collectd.inc.php'; | |||
6 | 6 | ||
7 | $plugin = validate_get(GET('p'), 'plugin'); | 7 | $plugin = validate_get(GET('p'), 'plugin'); |
8 | $type = validate_get(GET('t'), 'type'); | 8 | $type = validate_get(GET('t'), 'type'); |
9 | $width = empty($_GET['x']) ? $CONFIG['width'] : $_GET['x']; | 9 | $width = GET('x') ? filter_input(INPUT_GET, 'x', FILTER_VALIDATE_INT, array( |
10 | $height = empty($_GET['y']) ? $CONFIG['height'] : $_GET['y']; | 10 | 'min_range' => 10, |
11 | 11 | 'max_range' => $CONFIG['max-width'] | |
12 | if (validate_get(GET('h'), 'host') === NULL) { | 12 | )) : $CONFIG['width']; |
13 | error_log('CGP Error: plugin contains unknown characters'); | 13 | $height = GET('y') ? filter_input(INPUT_GET, 'y', FILTER_VALIDATE_INT, array( |
14 | 'min_range' => 10, | ||
15 | 'max_range' => $CONFIG['max-height'] | ||
16 | )) : $CONFIG['height']; | ||
17 | |||
18 | if ($width === NULL || $height === NULL) { | ||
19 | error_log(sprintf('Invalid image dimension, x="%s", y="%s"', | ||
20 | urlencode(GET('x')), | ||
21 | urlencode(GET('y')))); | ||
14 | error_image(); | 22 | error_image(); |
15 | } | 23 | } |
16 | 24 | ||
17 | if ($width > $CONFIG['max-width'] || $height > $CONFIG['max-height']) { | 25 | if (validate_get(GET('h'), 'host') === NULL) { |
18 | error_log('Resquested image is too large. Please configure max-width and max-height.'); | 26 | error_log('Invalid host: "' . urlencode(GET('h')) . '"'); |
19 | error_image(); | 27 | error_image(); |
20 | } | 28 | } |
21 | 29 | ||