Skip to content
Browse files

Merge branch 'wip-MDL-41921-m25' of git://github.com/marinaglancy/moo…

…dle into MOODLE_25_STABLE
  • Loading branch information...
2 parents a348f55 + b0aea95 commit 46b23b69faba9e6668f3340dca619951715682df @stronk7 stronk7 committed Oct 1, 2013
Showing with 4 additions and 10 deletions.
  1. +4 −10 mod/url/mod_form.php
View
14 mod/url/mod_form.php
@@ -51,7 +51,7 @@ function definition() {
//-------------------------------------------------------
$mform->addElement('header', 'content', get_string('contentheader', 'url'));
$mform->addElement('url', 'externalurl', get_string('externalurl', 'url'), array('size'=>'60'), array('usefilepicker'=>true));
- $mform->setType('externalurl', PARAM_URL);
+ $mform->setType('externalurl', PARAM_RAW_TRIMMED);
$mform->addRule('externalurl', null, 'required', null, 'client');
$mform->setExpanded('content');
@@ -174,15 +174,9 @@ function validation($data, $files) {
// NOTE: do not try to explain the difference between URL and URI, people would be only confused...
- if (empty($data['externalurl'])) {
- $errors['externalurl'] = get_string('required');
-
- } else {
- $url = trim($data['externalurl']);
- if (empty($url)) {
- $errors['externalurl'] = get_string('required');
-
- } else if (preg_match('|^/|', $url)) {
+ if (!empty($data['externalurl'])) {
+ $url = $data['externalurl'];
+ if (preg_match('|^/|', $url)) {
// links relative to server root are ok - no validation necessary
} else if (preg_match('|^[a-z]+://|i', $url) or preg_match('|^https?:|i', $url) or preg_match('|^ftp:|i', $url)) {

0 comments on commit 46b23b6

Please sign in to comment.
Something went wrong with that request. Please try again.