diff options
author | Alib <aliboba@free.fr> | 2010-03-23 17:23:53 +0100 |
---|---|---|
committer | Alib <aliboba@free.fr> | 2010-03-23 17:23:53 +0100 |
commit | 39d5e81996d91fb66039c1655f67b4edde3ef381 (patch) | |
tree | b7287d71d85fb71023e207d4c76a6e8dd900a823 /bin/utils.php | |
parent | 50171cdd7b3b05a62826d88381e6e11ec22d95f3 (diff) | |
parent | 1247a87685d2cf2389d62909f115178d0768748e (diff) | |
download | istreamdev-39d5e81996d91fb66039c1655f67b4edde3ef381.tar.gz istreamdev-39d5e81996d91fb66039c1655f67b4edde3ef381.tar.bz2 |
Merge branch 'jquery' of projects.vdr-developer.org:istreamdev into jquery
Diffstat (limited to 'bin/utils.php')
-rwxr-xr-x | bin/utils.php | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/bin/utils.php b/bin/utils.php index e748c64..4fe3484 100755 --- a/bin/utils.php +++ b/bin/utils.php @@ -92,4 +92,49 @@ function sec2hms ($sec, $padHours = false) return $hms; } + +function isurlvalid($url, $type) +{ + global $vdrstreamdev, $vdrrecpath, $videosource, $audiosource; + + switch ($type) + { + case 'tv': + + // Check that this is a correct URL + if (strncmp($vdrstreamdev, $url, strlen($vdrstreamdev))) + return 0; + + break; + + case 'rec': + if (strncmp($vdrrecpath, $url, strlen($vdrrecpath))) + return 0; + + // Dont allow .. + if (preg_match("$\.\.$", $url)) + return 0; + + break; + + case 'media'; + case 'vid': + + if (strncmp($videosource, $url, strlen($videosource)) && strncmp($audiosource, $url, strlen($audiosource))) + return 0; + + // Dont allow .. + if (preg_match("$\.\.$", $url)) + return 0; + + break; + + default: + return 0; + } + + return 1; +} + + ?> |