MDL-36710 calendar: Correcting the validation checks
authorAnkit Agarwal <ankit@moodle.com>
Tue, 27 Nov 2012 07:33:11 +0000 (15:33 +0800)
committerAnkit Agarwal <ankit@moodle.com>
Tue, 27 Nov 2012 07:33:36 +0000 (15:33 +0800)
calendar/managesubscriptions_form.php

index caf3400..28344cd 100644 (file)
@@ -122,8 +122,10 @@ class calendar_addsubscription_form extends moodleform {
                     $errors['importfile'] = get_string('errorrequiredurlorfile', 'calendar');
                 }
             }
-        } else if (($data['importfrom'] == CALENDAR_IMPORT_FROM_URL) && (clean_param($data['url'], PARAM_URL) !== $data['url'])) {
-            $errors['url']  = get_string('invalidurl', 'error');
+        } else if (($data['importfrom'] == CALENDAR_IMPORT_FROM_URL)) {
+            if (clean_param($data['url'], PARAM_URL) !== $data['url']) {
+                $errors['url']  = get_string('invalidurl', 'error');
+            }
         } else {
             // Shouldn't happen.
             $errors['url'] = get_string('errorrequiredurlorfile', 'calendar');