Merge branch 'w19_MDL-32849_m23_urlrewriting' of git://github.com/skodak/moodle

This commit is contained in:
Sam Hemelryk 2012-05-09 10:41:58 +12:00
commit 45d79572b5
5 changed files with 16 additions and 6 deletions

View File

@ -123,10 +123,15 @@ function min_get_slash_argument() {
$relativepath = '';
if (stripos($_SERVER['SERVER_SOFTWARE'], 'iis') !== false) {
if (!empty($_GET['file']) and strpos($_GET['file'], '/') === 0) {
// server is using url rewriting, most probably IIS
return $_GET['file'];
} else if (stripos($_SERVER['SERVER_SOFTWARE'], 'iis') !== false) {
if (isset($_SERVER['PATH_INFO']) and $_SERVER['PATH_INFO'] !== '') {
$relativepath = urldecode($_SERVER['PATH_INFO']);
}
} else {
if (isset($_SERVER['PATH_INFO'])) {
$relativepath = $_SERVER['PATH_INFO'];

View File

@ -1818,7 +1818,7 @@ M.util.load_flowplayer = function() {
if (M.cfg.jsrev == -10) {
var jsurl = M.cfg.wwwroot + '/lib/flowplayer/flowplayer-3.2.8.min.js';
} else {
var jsurl = M.cfg.wwwroot + '/lib/javascript.php?file=/lib/flowplayer/flowplayer-3.2.8.min.js&rev=' + M.cfg.jsrev;
var jsurl = M.cfg.wwwroot + '/lib/javascript.php?jsfile=/lib/flowplayer/flowplayer-3.2.8.min.js&rev=' + M.cfg.jsrev;
}
var fileref = document.createElement('script');
fileref.setAttribute('type','text/javascript');

View File

@ -43,7 +43,7 @@ if ($slashargument = min_get_slash_argument()) {
} else {
$rev = min_optional_param('rev', 0, 'INT');
$file = min_optional_param('file', '', 'RAW');
$file = min_optional_param('jsfile', '', 'RAW'); // 'file' would collide with URL rewriting!
}
// some security first - pick only files with .js extension in dirroot

View File

@ -407,7 +407,7 @@ class page_requirements_manager {
}
if (!empty($CFG->cachejs) and !empty($CFG->jsrev) and $CFG->jsrev > 0 and strpos($url, '/lib/editor/') !== 0 and substr($url, -3) === '.js') {
if (empty($CFG->slasharguments)) {
return new moodle_url($CFG->httpswwwroot.'/lib/javascript.php', array('rev'=>$CFG->jsrev, 'file'=>$url));
return new moodle_url($CFG->httpswwwroot.'/lib/javascript.php', array('rev'=>$CFG->jsrev, 'jsfile'=>$url));
} else {
$returnurl = new moodle_url($CFG->httpswwwroot.'/lib/javascript.php');
$returnurl->set_slashargument('/'.$CFG->jsrev.$url);

View File

@ -209,12 +209,17 @@ function combo_not_found($message = '') {
}
function combo_params() {
// note: buggy or misconfigured IIS does return the query string in REQUEST_URL
if (isset($_SERVER['REQUEST_URI']) and strpos($_SERVER['REQUEST_URI'], '?') !== false) {
if (isset($_SERVER['QUERY_STRING']) and strpos($_SERVER['QUERY_STRING'], 'file=/') === 0) {
// url rewriting
$slashargument = substr($_SERVER['QUERY_STRING'], 6);
return array($slashargument, true);
} else if (isset($_SERVER['REQUEST_URI']) and strpos($_SERVER['REQUEST_URI'], '?') !== false) {
$parts = explode('?', $_SERVER['REQUEST_URI'], 2);
return array($parts[1], false);
} else if (isset($_SERVER['QUERY_STRING']) and strpos($_SERVER['QUERY_STRING'], '?') !== false) {
// note: buggy or misconfigured IIS does return the query string in REQUEST_URI
return array($_SERVER['QUERY_STRING'], false);
} else if ($slashargument = min_get_slash_argument()) {