MDL-47073 lib: Replace backslashes with slashes in jquery plugin urls

This patch replaces backslash characters in the generated jQuery
plugin URL to forward slashes when slasharguments is disabled and
 the Moodle server is running on IIS.
Thanks to Ryan Panning <Ryan.Panning@district196.org> for
reporting this issue and for suggesting a fix.
This commit is contained in:
Jun Pataleta 2015-10-30 16:53:26 -05:00
parent 821ab27c19
commit bbbdfc8610
2 changed files with 40 additions and 0 deletions

View file

@ -556,6 +556,8 @@ class page_requirements_manager {
$path = realpath("$componentdir/jquery/$file");
if (strpos($path, $CFG->dirroot) === 0) {
$url = $CFG->httpswwwroot.preg_replace('/^'.preg_quote($CFG->dirroot, '/').'/', '', $path);
// Replace all occurences of backslashes characters in url to forward slashes.
$url = str_replace('\\', '/', $url);
$url = new moodle_url($url);
} else {
// Bad luck, fix your server!