From 6a4bc3d04eca64d9db794b427e6377c8f9a673f6 Mon Sep 17 00:00:00 2001 From: Ian C Date: Fri, 30 Nov 2018 16:09:34 +0000 Subject: Initial working version. --- common.php | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 common.php (limited to 'common.php') diff --git a/common.php b/common.php new file mode 100644 index 0000000..cc9ce1c --- /dev/null +++ b/common.php @@ -0,0 +1,48 @@ +. +*/ + +function Sanatise($line) +{ + $line = preg_replace('/[^A-Za-z0-9\-:_\.\/]/', '', $line); + + return $line; +} + +function EndsWith($line, $c) +{ + return substr($line, -1) == $c; +} + +function GuessMimeType($fname) +{ + switch(pathinfo($fname, PATHINFO_EXTENSION)) + { + case 'gif': + return 'image/gif'; + case 'png': + return 'image/png'; + case 'jpeg': + return 'image/jpeg'; + } + + return 'text/plain'; +} + +?> -- cgit v1.2.3