From 5793a8cd003643974206e44ea752ab0966cfa8c0 Mon Sep 17 00:00:00 2001 From: Pim van den Berg Date: Sat, 18 May 2013 16:05:43 +0200 Subject: integrate jsrrdgraph in CGP --- inc/functions.inc.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'inc/functions.inc.php') diff --git a/inc/functions.inc.php b/inc/functions.inc.php index a72a589..6642e51 100644 --- a/inc/functions.inc.php +++ b/inc/functions.inc.php @@ -30,6 +30,21 @@ function validate_get($value, $type) { return $value; } +function validateRRDPath($base, $path) { + $realpath = realpath(sprintf('%s/%s', $base, $path)); + + if (strpos($realpath, $base) === false) + return false; + + if (strpos($realpath, $base) !== 0) + return false; + + if (!preg_match('/\.rrd$/', $realpath)) + return false; + + return $realpath; +} + function crc32hex($str) { return sprintf("%x",crc32($str)); } -- cgit v1.1