mirror of
https://github.com/moodle/moodle.git
synced 2025-01-29 19:50:14 +01:00
Merge branch 'wip-MDL-41921-master' of git://github.com/marinaglancy/moodle
This commit is contained in:
commit
46e11c6690
@ -51,7 +51,7 @@ class mod_url_mod_form extends moodleform_mod {
|
||||
//-------------------------------------------------------
|
||||
$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');
|
||||
|
||||
@ -165,15 +165,9 @@ class mod_url_mod_form extends moodleform_mod {
|
||||
|
||||
// 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)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user