From 83827cf523939bd6983655cf5708fdf3ed2585f1 Mon Sep 17 00:00:00 2001 From: Nate Jones Date: Sat, 12 Jul 2014 05:32:35 +0000 Subject: [PATCH] Functions: Created is_uuid() function for validation. --- resources/functions.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/resources/functions.php b/resources/functions.php index 2f740e7c61..e400c726a0 100644 --- a/resources/functions.php +++ b/resources/functions.php @@ -106,6 +106,14 @@ //echo uuid(); } + if (!function_exists('is_uuid')) { + function is_uuid($uuid) { + //uuid version 4 + $regex = '/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i'; + return preg_match($regex, $uuid); + } + } + if (!function_exists('recursive_copy')) { function recursive_copy($src,$dst) { $dir = opendir($src);