Merge branch 'MDL-50268-master' of git://github.com/lameze/moodle

This commit is contained in:
Andrew Nicols
2016-01-19 07:56:41 +08:00
6 changed files with 10 additions and 8 deletions
@@ -62,7 +62,7 @@ class restore_structure_parser_processor extends grouped_parser_processor {
}
// Decode file.php calls
$search = array ("$@FILEPHP@$");
$replace = array(get_file_url($this->courseid));
$replace = array(moodle_url::make_legacyfile_url($this->courseid, null));
$result = str_replace($search, $replace, $cdata);
// Now $@SLASH@$ and $@FORCEDOWNLOAD@$ MDL-18799
$search = array('$@SLASH@$', '$@FORCEDOWNLOAD@$');
+4 -1
View File
@@ -508,7 +508,9 @@ function httpsrequired() {
/**
* Given a physical path to a file, returns the URL through which it can be reached in Moodle.
*
* @deprecated use moodle_url factory methods instead
* @deprecated since 3.1 - replacement legacy file API methods can be found on the moodle_url class, for example:
* The moodle_url::make_legacyfile_url() method can be used to generate a legacy course file url. To generate
* course module file.php url the moodle_url::make_file_url() should be used.
*
* @param string $path Physical path to a file
* @param array $options associative array of GET variables to append to the URL
@@ -516,6 +518,7 @@ function httpsrequired() {
* @return string URL to file
*/
function get_file_url($path, $options=null, $type='coursefile') {
debugging('Function get_file_url() is deprecated, please use moodle_url factory methods instead.', DEBUG_DEVELOPER);
global $CFG;
$path = str_replace('//', '/', $path);
+2 -2
View File
@@ -80,12 +80,12 @@ function rss_get_link($contextid, $userid, $componentname, $id, $tooltiptext='')
*/
function rss_get_url($contextid, $userid, $componentname, $additionalargs) {
global $CFG;
require_once($CFG->libdir.'/filelib.php');
if (empty($userid)) {
$userid = guest_user()->id;
}
$usertoken = rss_get_token($userid);
return get_file_url($contextid.'/'.$usertoken.'/'.$componentname.'/'.$additionalargs.'/rss.xml', null, 'rssfile');
$url = '/rss/file.php';
return moodle_url::make_file_url($url, '/'.$contextid.'/'.$usertoken.'/'.$componentname.'/'.$additionalargs.'/rss.xml');
}
/**
+1 -1
View File
@@ -728,7 +728,7 @@ class moodle_url {
if ($forcedownload) {
$params['forcedownload'] = 1;
}
$path = rtrim($path, '/');
$url = new moodle_url($urlbase, $params);
$url->set_slashargument($path);
return $url;
+1 -2
View File
@@ -298,8 +298,7 @@ class WikiToMarkdown {
$line = preg_replace("/ ([a-zA-Z]+):([0-9]+)\(([^)]+)\)/i",
" [\\3](".$CFG->wwwroot."/mod/\\1/view.php?id=\\2) ", $line );
require_once($CFG->libdir.'/filelib.php');
$coursefileurl = get_file_url($this->courseid);
$coursefileurl = array(moodle_url::make_legacyfile_url($this->courseid, null));
// Replace picture resource link
$line = preg_replace("#/([a-zA-Z0-9./_-]+)(png|gif|jpg)\(([^)]+)\)#i",
+1 -1
View File
@@ -2169,7 +2169,7 @@ function scorm_get_sco_and_launch_url($scorm, $scoid, $context) {
// This SCORM content sits in a repository that allows relative links.
$scolaunchurl = "$CFG->wwwroot/pluginfile.php/$context->id/mod_scorm/imsmanifest/$scorm->revision/$launcher";
} else if ($scorm->scormtype === SCORM_TYPE_LOCAL or $scorm->scormtype === SCORM_TYPE_LOCALSYNC) {
// Note: do not convert this to use get_file_url() or moodle_url()
// Note: do not convert this to use moodle_url().
// SCORM does not work without slasharguments and moodle_url() encodes querystring vars.
$scolaunchurl = "$CFG->wwwroot/pluginfile.php/$context->id/mod_scorm/content/$scorm->revision/$launcher";
}