diff options
author | TheTroll <trolldev@gmail.com> | 2010-03-23 13:59:27 +0100 |
---|---|---|
committer | TheTroll <trolldev@gmail.com> | 2010-03-23 13:59:27 +0100 |
commit | be27c9fd4fc24205475c1f8eb4332bde6959c8dc (patch) | |
tree | a7104b8a2831d1fd39c08036f5f495b90c5dd1ff /bin/utils.php | |
parent | 4568b0e65d4f029384aeec26e2b2df6b8f37ffc2 (diff) | |
download | istreamdev-be27c9fd4fc24205475c1f8eb4332bde6959c8dc.tar.gz istreamdev-be27c9fd4fc24205475c1f8eb4332bde6959c8dc.tar.bz2 |
Now check URL validity
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; +} + + ?> |