aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/graph.php
diff options
context:
space:
mode:
Diffstat (limited to 'graph.php')
-rw-r--r--graph.php22
1 files changed, 15 insertions, 7 deletions
diff --git a/graph.php b/graph.php
index 3e33b92..2d62d92 100644
--- a/graph.php
+++ b/graph.php
@@ -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']
12if (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
18if ($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
17if ($width > $CONFIG['max-width'] || $height > $CONFIG['max-height']) { 25if (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