From 556d146be087dd3b3a310ab88d1d4501f7e924ea Mon Sep 17 00:00:00 2001 From: Myles Carrick Date: Thu, 14 Apr 2011 14:50:57 +1000 Subject: [PATCH 05/11] MOODLE-32: add validation to length and format --- lang/en/adobeconnect.php | 2 ++ mod_form.php | 7 +++++++ 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/lang/en/adobeconnect.php b/lang/en/adobeconnect.php index 4b6eaf6..a09328a 100644 --- a/lang/en/adobeconnect.php +++ b/lang/en/adobeconnect.php @@ -37,7 +37,9 @@ $string['existingusers'] = '$a existing users'; $string['groupswitch'] = 'Filter by group'; $string['host'] = 'Host'; $string['host_desc'] = 'Where REST calls get sent to'; +$string['invalidurl'] = "The URL needs to start with a letter (a-z)"; $string['joinmeeting'] = 'Join Meeting'; +$string['longurl'] = "That meeting URL is too long. Try shortening it"; $string['meethost_desc'] = 'Domain where the Adobe server is installed'; $string['meetinghost'] = 'Meeting domain'; $string['meetingend'] = 'Meeting end time'; diff --git a/mod_form.php b/mod_form.php index 9a9a809..1aa4b98 100644 --- a/mod_form.php +++ b/mod_form.php @@ -152,6 +152,13 @@ class mod_adobeconnect_mod_form extends moodleform_mod { } + // Check URL for correct length and format + if (strlen($data['meeturl']) > 60) { + $errors['meeturl'] = get_string('longurl', 'adobeconnect'); + } elseif (!preg_match('/^[a-z][^a-z0-9]/i', $data['meeturl'])) { + $errors['meeturl'] = get_string('invalidurl', 'adobeconnect'); + } + // Adding activity if (empty($data['update'])) { -- 1.7.2.2