mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-65412 core_customfield: check configdata link exists
This commit is contained in:
parent
bc342f101a
commit
baf5551cac
1 changed files with 10 additions and 8 deletions
|
@ -105,14 +105,16 @@ class field_controller extends \core_customfield\field_controller {
|
||||||
$errors['configdata[displaysize]'] = get_string('errorconfigdisplaysize', 'customfield_text');
|
$errors['configdata[displaysize]'] = get_string('errorconfigdisplaysize', 'customfield_text');
|
||||||
}
|
}
|
||||||
|
|
||||||
$link = $data['configdata']['link'];
|
if (isset($data['configdata']['link'])) {
|
||||||
if (strlen($link)) {
|
$link = $data['configdata']['link'];
|
||||||
require_once($CFG->dirroot . '/lib/validateurlsyntax.php');
|
if (strlen($link)) {
|
||||||
if (strpos($link, '$$') === false) {
|
require_once($CFG->dirroot . '/lib/validateurlsyntax.php');
|
||||||
$errors['configdata[link]'] = get_string('errorconfiglinkplaceholder', 'customfield_text');
|
if (strpos($link, '$$') === false) {
|
||||||
} else if (!validateUrlSyntax(str_replace('$$', 'XYZ', $link), 's+H?S?F-E-u-P-a?I?p?f?q?r?')) {
|
$errors['configdata[link]'] = get_string('errorconfiglinkplaceholder', 'customfield_text');
|
||||||
// This validation is more strict than PARAM_URL - it requires the protocol and it must be either http or https.
|
} else if (!validateUrlSyntax(str_replace('$$', 'XYZ', $link), 's+H?S?F-E-u-P-a?I?p?f?q?r?')) {
|
||||||
$errors['configdata[link]'] = get_string('errorconfigdisplaysize', 'customfield_text');
|
// This validation is more strict than PARAM_URL - it requires the protocol and it must be either http or https.
|
||||||
|
$errors['configdata[link]'] = get_string('errorconfigdisplaysize', 'customfield_text');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue