Skip to content

Commit

Permalink
MDL-29619 Validate urls before generating output
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitagarwal committed Oct 21, 2011
1 parent 22df490 commit b216ddb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions mod/url/lang/en/url.php
Expand Up @@ -44,6 +44,7 @@
$string['displayselectexplain'] = 'Choose display type, unfortunately not all types are suitable for all URLs.';
$string['externalurl'] = 'External URL';
$string['framesize'] = 'Frame height';
$string['invalidstoredurl'] = 'Invalid URL';
$string['chooseavariable'] = 'Choose a variable...';
$string['invalidurl'] = 'Entered URL is invalid';
$string['modulename'] = 'URL';
Expand Down
6 changes: 6 additions & 0 deletions mod/url/view.php
Expand Up @@ -55,6 +55,12 @@

$PAGE->set_url('/mod/url/view.php', array('id' => $cm->id));

// Make sure URL is valid before generating output
$url->externalurl = clean_param($url->externalurl, PARAM_URL);
if (empty($url->externalurl)) {
print_error('invalidstoredurl', 'url');
}

if ($redirect) {
// coming from course page or url index page,
// the redirection is needed for completion tracking and logging
Expand Down

0 comments on commit b216ddb

Please sign in to comment.