mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 13:02:07 +02:00
MDL-52068 repository: Prevent JS errors due to unescaped lang strings
This commit is contained in:
parent
03b8b55f10
commit
28f8993d0f
@ -67,17 +67,21 @@ $repo->callback();
|
||||
// If Moodle is working on HTTPS mode, then we are not allowed to access
|
||||
// parent window, in this case, we need to alert user to refresh the repository
|
||||
// manually.
|
||||
$strhttpsbug = get_string('cannotaccessparentwin', 'repository');
|
||||
$strhttpsbug = json_encode(get_string('cannotaccessparentwin', 'repository'));
|
||||
$strrefreshnonjs = get_string('refreshnonjsfilepicker', 'repository');
|
||||
$js =<<<EOD
|
||||
<html>
|
||||
<head>
|
||||
<script type="text/javascript">
|
||||
if(window.opener){
|
||||
window.opener.M.core_filepicker.active_filepicker.list();
|
||||
window.close();
|
||||
} else {
|
||||
alert("{$strhttpsbug }");
|
||||
try {
|
||||
if (window.opener) {
|
||||
window.opener.M.core_filepicker.active_filepicker.list();
|
||||
window.close();
|
||||
} else {
|
||||
throw new Error('Whoops!');
|
||||
}
|
||||
} catch (e) {
|
||||
alert({$strhttpsbug});
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
Loading…
x
Reference in New Issue
Block a user