Index: file.php
===================================================================
RCS file: /cvsroot/moodle/moodle/file.php,v
retrieving revision 1.46.2.2
diff -u -F ^f -r1.46.2.2 file.php
--- file.php 25 Apr 2008 18:52:47 -0000 1.46.2.2
+++ file.php 2 May 2008 09:26:53 -0000
@@ -1,5 +1,9 @@
libdir.'/filelib.php');
/// MDL-14072: Prevent NULLs, empties and numbers to be processed by the
/// heavy interlinking. Just a few cpu cycles saved.
@@ -3647,17 +3648,7 @@
//Now decode wwwroot and file.php calls
$search = array ("$@FILEPHP@$");
-
- //Check for the status of the slasharguments config variable
- $slash = $CFG->slasharguments;
-
- //Build the replace string as needed
- if ($slash == 1) {
- $replace = array ($CFG->wwwroot."/file.php/".$restore->course_id);
- } else {
- $replace = array ($CFG->wwwroot."/file.php?file=/".$restore->course_id);
- }
-
+ $replace = array(get_file_url($restore->course_id));
$result = str_replace($search,$replace,$content);
if ($result != $content && debugging()) { //Debug
Index: blog/lib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/blog/lib.php,v
retrieving revision 1.80.2.12
diff -u -F ^f -r1.80.2.12 lib.php
--- blog/lib.php 30 Apr 2008 04:45:22 -0000 1.80.2.12
+++ blog/lib.php 2 May 2008 09:26:59 -0000
@@ -71,10 +71,11 @@
*/
function blog_print_html_formatted_entries($postid, $filtertype, $filterselect, $tagid, $tag) {
- global $CFG, $USER;
+ global $CFG, $USER, $COURSE;
$blogpage = optional_param('blogpage', 0, PARAM_INT);
$bloglimit = optional_param('limit', get_user_preferences('blogpagesize', 10), PARAM_INT);
+ $userid = optional_param('userid', 0, PARAM_INT);
$start = $blogpage * $bloglimit;
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
@@ -89,11 +90,18 @@
if ($CFG->enablerssfeeds) {
blog_rss_print_link($filtertype, $filterselect, $tag);
}
+
+ if ($COURSE->id != SITEID) {
+ $curcontext = get_context_instance(CONTEXT_COURSE, $COURSE->id);
+ if ((isloggedin() && !isguest()) && $CFG->bloglevel >= BLOG_COURSE_LEVEL && has_capability('moodle/blog:view', $curcontext)) {
+ $coursearg = '&courseid='.$COURSE->id;
+ }
+ }
if (has_capability('moodle/blog:create', $sitecontext)) {
//the user's blog is enabled and they are viewing their own blog
$addlink = '
';
echo $addlink;
}
@@ -296,11 +304,7 @@
include_once($CFG->libdir.'/filelib.php');
$icon = mimeinfo("icon", $file);
$type = mimeinfo("type", $file);
- if ($CFG->slasharguments) {
- $ffurl = "$CFG->wwwroot/file.php/$filearea/$file";
- } else {
- $ffurl = "$CFG->wwwroot/file.php?file=/$filearea/$file";
- }
+ $ffurl = get_file_url("$filearea/$file");
$image = "
pixpath/f/$icon\" class=\"icon\" alt=\"\" />";
if ($return == "html") {
Index: files/index.php
===================================================================
RCS file: /cvsroot/moodle/moodle/files/index.php,v
retrieving revision 1.121.2.3
diff -u -F ^f -r1.121.2.3 index.php
--- files/index.php 2 Apr 2008 06:10:00 -0000 1.121.2.3
+++ files/index.php 2 May 2008 09:26:59 -0000
@@ -812,11 +812,8 @@ function displaydir ($wdir) {
print_cell("center", "", 'checkbox');
echo "";
- if ($CFG->slasharguments) {
- $ffurl = str_replace('//', '/', "/file.php/$id/$fileurl");
- } else {
- $ffurl = str_replace('//', '/', "/file.php?file=/$id/$fileurl");
- }
+
+ $ffurl = str_replace('//', '/', get_file_url("$id/$fileurl"));
link_to_popup_window ($ffurl, "display",
" pixpath/f/$icon\" class=\"icon\" alt=\"$strfile\" /> ".htmlspecialchars($file),
480, 640);
Index: lib/filelib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/lib/filelib.php,v
retrieving revision 1.50.2.13
diff -u -F ^f -r1.50.2.13 filelib.php
--- lib/filelib.php 10 Apr 2008 12:08:28 -0000 1.50.2.13
+++ lib/filelib.php 2 May 2008 09:26:59 -0000
@@ -9,6 +9,12 @@ function get_file_url($path, $options=nu
// type of file
switch ($type) {
+ case 'httpscoursefile':
+ $url = "$CFG->httpswwwroot/file.php";
+ break;
+ case 'rssfile':
+ $url = "$CFG->wwwroot/rss/file.php";
+ break;
case 'coursefile':
default:
$url = "$CFG->wwwroot/file.php";
Index: lib/questionlib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/lib/questionlib.php,v
retrieving revision 1.119.2.5
diff -u -F ^f -r1.119.2.5 questionlib.php
--- lib/questionlib.php 28 Feb 2008 12:52:59 -0000 1.119.2.5
+++ lib/questionlib.php 2 May 2008 09:27:00 -0000
@@ -1324,12 +1324,10 @@ function get_question_image($question) {
if (substr(strtolower($question->image), 0, 7) == 'http://') {
$img .= $question->image;
- } else if ($CFG->slasharguments) { // Use this method if possible for better caching
- $img .= "$CFG->wwwroot/file.php/$coursefilesdir/$question->image";
-
} else {
- $img .= "$CFG->wwwroot/file.php?file=/$coursefilesdir/$question->image";
- }
+ require_once($CFG->libdir .'/filelib.php');
+ $img = get_file_url("$courseid/{$question->image}");
+ }
}
return $img;
}
@@ -2084,12 +2082,8 @@ function question_url_check($url){
*/
function question_replace_file_links_in_html($html, $fromcourseid, $tocourseid, $url, $destination, &$changed){
global $CFG;
- if ($CFG->slasharguments) { // Use this method if possible for better caching
- $tourl = "$CFG->wwwroot/file.php/$tocourseid/$destination";
-
- } else {
- $tourl = "$CFG->wwwroot/file.php?file=/$tocourseid/$destination";
- }
+ require_once($CFG->libdir .'/filelib.php');
+ $tourl = get_file_url("$tocourseid/$destination");
$fromurl = question_file_links_base_url($fromcourseid).preg_quote($url, '!');
$searchfor = array('!(<\s*(a|img)\s[^>]*(href|src)\s*=\s*")'.$fromurl.'(")!i',
'!(<\s*(a|img)\s[^>]*(href|src)\s*=\s*\')'.$fromurl.'(\')!i');
Index: lib/weblib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/lib/weblib.php,v
retrieving revision 1.970.2.83
diff -u -F ^f -r1.970.2.83 weblib.php
--- lib/weblib.php 2 May 2008 03:31:49 -0000 1.970.2.83
+++ lib/weblib.php 2 May 2008 09:27:03 -0000
@@ -4278,11 +4278,8 @@ function print_file_picture($path, $cour
} else if ($courseid) {
$output .= ' ");
}
echo " | ";
- if ($CFG->slasharguments) {
- $ffurl = "/file.php/$id$fileurl";
- } else {
- $ffurl = "/file.php?file=/$id$fileurl";
- }
+ $ffurl = get_file_url($id$fileurl);
link_to_popup_window ($ffurl, "display",
" pixpath/f/$icon\" class=\"icon\" alt=\"$strfile\" />",
480, 640);
$file_size = filesize($filename);
- echo "wwwroot.$ffurl."',";
+ echo "$file";
echo " | \n";
Index: mod/data/preset.php
===================================================================
RCS file: /cvsroot/moodle/moodle/mod/data/preset.php,v
retrieving revision 1.24.2.3
diff -u -F ^f -r1.24.2.3 preset.php
--- mod/data/preset.php 16 Apr 2008 03:23:09 -0000 1.24.2.3
+++ mod/data/preset.php 2 May 2008 09:27:03 -0000
@@ -198,7 +198,8 @@
/* now just move the zip into this folder to allow a nice download */
if (!rename($file, $perminantfile)) error("Can't move zip");
- echo "".get_string('download', 'data')."";
+ require_once($CFG->libdir.'/filelib.php');
+ echo "". get_string('download', 'data') ."";
echo '';
break;
Index: mod/data/field/file/field.class.php
===================================================================
RCS file: /cvsroot/moodle/moodle/mod/data/field/file/field.class.php,v
retrieving revision 1.17.2.3
diff -u -F ^f -r1.17.2.3 field.class.php
--- mod/data/field/file/field.class.php 17 Apr 2008 09:41:56 -0000 1.17.2.3
+++ mod/data/field/file/field.class.php 2 May 2008 09:27:03 -0000
@@ -46,14 +46,10 @@
$name = empty($contents[1]) ? $src : $contents[1];
$displayname = empty($contents[1]) ? '' : $contents[1];
- $path = $this->data->course.'/'.$CFG->moddata.'/data/'.$this->data->id.'/'.$this->field->id.'/'.$recordid;
+ require_once($CFG->libdir.'/filelib.php');
+ $source = get_file_url($this->data->course.'/'.$CFG->moddata.'/data/'.$this->data->id.'/'.$this->field->id.'/'.$recordid);
- if ($CFG->slasharguments) {
- $source = $CFG->wwwroot.'/file.php/'.$path;
- } else {
- $source = $CFG->wwwroot.'/file.php?file=/'.$path;
- }
- } else {
+ } else {
$src = '';
$name = '';
$displayname = '';
Index: mod/data/field/picture/field.class.php
===================================================================
RCS file: /cvsroot/moodle/moodle/mod/data/field/picture/field.class.php,v
retrieving revision 1.24
diff -u -F ^f -r1.24 field.class.php
--- mod/data/field/picture/field.class.php 5 Aug 2007 16:42:31 -0000 1.24
+++ mod/data/field/picture/field.class.php 2 May 2008 09:27:03 -0000
@@ -49,12 +49,8 @@
}
$path = $this->data->course.'/'.$CFG->moddata.'/data/'.$this->data->id.'/'.$this->field->id.'/'.$recordid;
-
- if ($CFG->slasharguments) {
- $filepath = $CFG->wwwroot.'/file.php/'.$path.'/'.$filename;
- } else {
- $filepath = $CFG->wwwroot.'/file.php?file=/'.$path.'/'.$filename;
- }
+ require_once($CFG->libdir.'/filelib.php');
+ $filepath = get_file_url("$path/$filename");
}
$str = '';
@@ -102,15 +98,11 @@
$src = $contents[0];
$path = $this->data->course.'/'.$CFG->moddata.'/data/'.$this->data->id.'/'.$this->field->id.'/'.$recordid;
- $thumbnaillocation = $CFG->dataroot .'/'.$this->data->course.'/'.$CFG->moddata.'/data/'.$this->data->id.'/'.$this->field->id.'/'.$recordid.'/thumb/'.$src;
+ $thumbnaillocation = $CFG->dataroot .'/'. $path .'/thumb/'.$src;
- if ($CFG->slasharguments) {
- $source = $CFG->wwwroot.'/file.php/'.$path.'/'.$src;
- $thumbnailsource = file_exists($thumbnaillocation) ? $CFG->wwwroot.'/file.php/'.$path.'/thumb/'.$src : $source;
- } else {
- $source = $CFG->wwwroot.'/file.php?file=/'.$path.'/'.$src;
- $thumbnailsource = file_exists($thumbnaillocation) ? $CFG->wwwroot.'/file.php?file=/'.$path.'/thumb/'.$src : $source;
- }
+ require_once($CFG->libdir.'/filelib.php');
+ $source = get_file_url("$path/$src");
+ $thumbnailsource = file_exists($thumbnaillocation) ? get_file_url("$path/thumb/$src") : $source;
if ($template == 'listtemplate') {
$width = $this->field->param4 ? ' width="'.s($this->field->param4).'" ' : ' ';
Index: mod/exercise/lib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/mod/exercise/Attic/lib.php,v
retrieving revision 1.48.2.2
diff -u -F ^f -r1.48.2.2 lib.php
--- mod/exercise/lib.php 8 Mar 2008 12:57:23 -0000 1.48.2.2
+++ mod/exercise/lib.php 2 May 2008 09:27:04 -0000
@@ -730,13 +730,10 @@ function exercise_print_submission_title
if ($basedir = exercise_file_area($exercise, $submission)) {
if (list($file) = get_directory_list($basedir)) {
$icon = mimeinfo("icon", $file);
- if ($CFG->slasharguments) {
- $ffurl = "file.php/$filearea/$file";
- } else {
- $ffurl = "file.php?file=/$filearea/$file";
- }
+ require_once($CFG->libdir .'/filelib.php');
+ $ffurl = get_file_url("$filearea/$file");
return "

pixpath/f/$icon\" class=\"icon\" alt=\"".get_string('file')."\" />".
- "
wwwroot/$ffurl\">$submission->title";
+ "
$submission->title";
}
}
}
Index: mod/forum/lib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/mod/forum/lib.php,v
retrieving revision 1.609.2.58
diff -u -F ^f -r1.609.2.58 lib.php
--- mod/forum/lib.php 20 Apr 2008 19:37:28 -0000 1.609.2.58
+++ mod/forum/lib.php 2 May 2008 09:27:06 -0000
@@ -3636,11 +3636,7 @@ function forum_print_attachments($post,
foreach ($files as $file) {
$icon = mimeinfo("icon", $file);
$type = mimeinfo("type", $file);
- if ($CFG->slasharguments) {
- $ffurl = "$CFG->wwwroot/file.php/$filearea/$file";
- } else {
- $ffurl = "$CFG->wwwroot/file.php?file=/$filearea/$file";
- }
+ $ffurl = get_file_url("$filearea/$file");
$image = "

pixpath/f/$icon\" class=\"icon\" alt=\"\" />";
if ($return == "html") {
Index: mod/forum/rsslib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/mod/forum/rsslib.php,v
retrieving revision 1.25
diff -u -F ^f -r1.25 rsslib.php
--- mod/forum/rsslib.php 22 Aug 2007 07:38:38 -0000 1.25
+++ mod/forum/rsslib.php 2 May 2008 09:27:06 -0000
@@ -236,6 +236,8 @@
$formatoptions = new object;
$formatoptions->trusttext = true;
+ require_once($CFG->libdir.'/filelib.php');
+
foreach ($recs as $rec) {
unset($item);
unset($user);
@@ -256,11 +258,7 @@
$item->attachments = array();
foreach ($post_files as $file) {
$attachment = new stdClass;
- if ($CFG->slasharguments) {
- $attachment->url = "{$CFG->wwwroot}/file.php/$post_file_area_name/$file";
- } else {
- $attachment->url = "{$CFG->wwwroot}/file.php?file=/$post_file_area_name/$file";
- }
+ $attachment->url = get_file_url("$post_file_area_name/$file");
$attachment->length = filesize("$CFG->dataroot/$post_file_area_name/$file");
$item->attachments[] = $attachment;
}
Index: mod/glossary/lib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/mod/glossary/lib.php,v
retrieving revision 1.193.2.12
diff -u -F ^f -r1.193.2.12 lib.php
--- mod/glossary/lib.php 2 May 2008 04:07:32 -0000 1.193.2.12
+++ mod/glossary/lib.php 2 May 2008 09:27:07 -0000
@@ -1251,11 +1251,7 @@ function glossary_print_attachments($ent
$strattachment = get_string("attachment", "glossary");
foreach ($files as $file) {
$icon = mimeinfo("icon", $file);
- if ($CFG->slasharguments) {
- $ffurl = "$CFG->wwwroot/file.php/$filearea/$file";
- } else {
- $ffurl = "$CFG->wwwroot/file.php?file=/$filearea/$file";
- }
+ $ffurl = get_file_url("$filearea/$file");
$image = "

pixpath/f/$icon\" class=\"icon\" alt=\"\" />";
if ($return == "html") {
Index: mod/lesson/mediafile.php
===================================================================
RCS file: /cvsroot/moodle/moodle/mod/lesson/mediafile.php,v
retrieving revision 1.13
diff -u -F ^f -r1.13 mediafile.php
--- mod/lesson/mediafile.php 24 Jul 2007 07:04:33 -0000 1.13
+++ mod/lesson/mediafile.php 2 May 2008 09:27:07 -0000
@@ -57,13 +57,7 @@
if (is_url($lesson->mediafile)) {
$fullurl = $lesson->mediafile;
} else {
- // get the full url to the file while taking into consideration $CFG->slasharguments
- if ($CFG->slasharguments) {
- $relativeurl = "/file.php/{$course->id}/{$lesson->mediafile}";
- } else {
- $relativeurl = "/file.php?file=/{$course->id}/{$lesson->mediafile}";
- }
- $fullurl = "$CFG->wwwroot$relativeurl";
+ $fullurl = get_file_url($course->id .'/'. $lesson->mediafile);
}
// find the correct type and print it out
@@ -213,4 +207,4 @@
}
print_footer();
-?>
\ No newline at end of file
+?>
Index: mod/scorm/loadSCO.php
===================================================================
RCS file: /cvsroot/moodle/moodle/mod/scorm/loadSCO.php,v
retrieving revision 1.33
diff -u -F ^f -r1.33 loadSCO.php
--- mod/scorm/loadSCO.php 25 Jan 2007 13:49:50 -0000 1.33
+++ mod/scorm/loadSCO.php 2 May 2008 09:27:07 -0000
@@ -108,11 +108,8 @@
} else {
$basedir = $CFG->moddata.'/scorm/'.$scorm->id;
}
- if ($CFG->slasharguments) {
- $result = $CFG->wwwroot.'/file.php/'.$scorm->course.'/'.$basedir.'/'.$launcher;
- } else {
- $result = $CFG->wwwroot.'/file.php?file=/'.$scorm->course.'/'.$basedir.'/'.$launcher;
- }
+ require_once($CFG->libdir.'/filelib.php');
+ $result = get_file_url($scorm->course .'/'. $basedir .'/'. $launcher);
}
}
?>
Index: mod/workshop/locallib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/mod/workshop/Attic/locallib.php,v
retrieving revision 1.43.2.1
diff -u -F ^f -r1.43.2.1 locallib.php
--- mod/workshop/locallib.php 6 Mar 2008 09:41:24 -0000 1.43.2.1
+++ mod/workshop/locallib.php 2 May 2008 09:27:09 -0000
@@ -2858,18 +2858,15 @@ function workshop_print_submission($work
$filearea = workshop_file_area_name($workshop, $submission);
if ($basedir = workshop_file_area($workshop, $submission)) {
if ($files = get_directory_list($basedir)) {
+ require_once($CFG->libdir .'/filelib.php');
foreach ($files as $file) {
$icon = mimeinfo("icon", $file);
- if ($CFG->slasharguments) {
- $ffurl = "file.php/$filearea/$file";
- } else {
- $ffurl = "file.php?file=/$filearea/$file";
- }
+ $ffurl = get_file_url("$filearea/$file");
echo "
".get_string("attachment", "workshop")." $n: \n";
// removed target=\"uploadedfile\" as it does not validate
// MDL-7861
echo " pixpath/f/$icon\" class=\"icon\" alt=\"".get_string('file')."\" />".
- " wwwroot/$ffurl\">$file |
";
+ "
$file";
$n++;
}
}
Index: mod/workshop/submissions.php
===================================================================
RCS file: /cvsroot/moodle/moodle/mod/workshop/Attic/submissions.php,v
retrieving revision 1.60.2.2
diff -u -F ^f -r1.60.2.2 submissions.php
--- mod/workshop/submissions.php 2 Apr 2008 06:10:05 -0000 1.60.2.2
+++ mod/workshop/submissions.php 2 May 2008 09:27:09 -0000
@@ -264,18 +264,15 @@
"workshop")."\" onclick=\"getElementById('editform').action.value='removeattachments';
getElementById('editform').submit();\"/>
\n";
$n = 1;
+ require_once($CFG->libdir .'/filelib.php');
foreach ($files as $file) {
$icon = mimeinfo("icon", $file);
- if ($CFG->slasharguments) {
- $ffurl = "file.php/$filearea/$file";
- } else {
- $ffurl = "file.php?file=/$filearea/$file";
- }
+ $ffurl = get_file_url("$filearea/$file");
// removed target=\"uploadedfile\"
// as it does not validate MDL_7861
echo "".get_string("attachment", "workshop")." $n: pixpath/f/$icon\"
class=\"icon\" alt=\"".get_string('file')."\" />".
- " wwwroot/$ffurl\">$file |
\n";
+ " $file\n";
}
} else {
echo "| ".get_string("noattachments", "workshop")." |
\n";
Index: question/export.php
===================================================================
RCS file: /cvsroot/moodle/moodle/question/export.php,v
retrieving revision 1.43.2.1
diff -u -F ^f -r1.43.2.1 export.php
--- question/export.php 2 Nov 2007 16:20:19 -0000 1.43.2.1
+++ question/export.php 2 May 2008 09:27:09 -0000
@@ -118,12 +118,8 @@
// link to download the finished file
$file_ext = $qformat->export_file_extension();
- if ($CFG->slasharguments) {
- $efile = "{$CFG->wwwroot}/file.php/".$qformat->question_get_export_dir()."/$from_form->exportfilename".$file_ext."?forcedownload=1";
- }
- else {
- $efile = "{$CFG->wwwroot}/file.php?file=/".$qformat->question_get_export_dir()."/$from_form->exportfilename".$file_ext."&forcedownload=1";
- }
+ require_once($CFG->libdir.'/filelib.php');
+ $efile = get_file_url($qformat->question_get_export_dir() .'/'. $from_form->exportfilename.$file_ext, array('forcedownload'=>1));
echo "";
echo "$txt->downloadextra
";
Index: question/format/hotpot/format.php
===================================================================
RCS file: /cvsroot/moodle/moodle/question/format/hotpot/format.php,v
retrieving revision 1.12.4.4
diff -u -F ^f -r1.12.4.4 format.php
--- question/format/hotpot/format.php 5 Feb 2008 04:09:58 -0000 1.12.4.4
+++ question/format/hotpot/format.php 2 May 2008 09:27:09 -0000
@@ -43,11 +43,8 @@
// shouldn't happen !!
$courseid = 0;
}
- if ($CFG->slasharguments) {
- $baseurl = "$CFG->wwwroot/file.php/$courseid/";
- } else {
- $baseurl = "$CFG->wwwroot/file.php?file=/$courseid/";
- }
+ require_once($CFG->libdir.'/filelib.php');
+ $baseurl = get_file_url($courseid);
// get import file name
global $params;
Index: question/format/qti2/format.php
===================================================================
RCS file: /cvsroot/moodle/moodle/question/format/qti2/format.php,v
retrieving revision 1.12.4.1
diff -u -F ^f -r1.12.4.1 format.php
--- question/format/qti2/format.php 2 Nov 2007 16:20:35 -0000 1.12.4.1
+++ question/format/qti2/format.php 2 May 2008 09:27:09 -0000
@@ -405,6 +405,7 @@ function handle_questions_media(&$questi
function quiz_export_prepare_questions($questions, $quizid, $courseid, $shuffleanswers = null) {
global $CFG;
// add the answers to the questions and format the image property
+ require_once($CFG->libdir.'/filelib.php');
foreach ($questions as $key=>$question) {
$questions[$key] = get_question_data($question);
$questions[$key]->courseid = $courseid;
@@ -420,11 +421,7 @@ function handle_questions_media(&$questi
if ($localfile) {
// create the http url that the player will need to access the file
- if ($CFG->slasharguments) { // Use this method if possible for better caching
- $questions[$key]->mediaurl = "$CFG->wwwroot/file.php/$question->image";
- } else {
- $questions[$key]->mediaurl = "$CFG->wwwroot/file.php?file=$question->image";
- }
+ $questions[$key]->mediaurl = get_file_url($question->image);
} else {
$questions[$key]->mediaurl = $question->image;
}
@@ -908,10 +905,9 @@ function xml_entitize(&$collection) {
global $CFG;
if (substr(strtolower($file), 0, 7) == 'http://') {
$url = $file;
- } else if ($CFG->slasharguments) { // Use this method if possible for better caching
- $url = "{$CFG->wwwroot}/file.php/$courseid/{$file}";
} else {
- $url = "{$CFG->wwwroot}/file.php?file=/$courseid/{$file}";
+ require_once($CFG->libdir.'/filelib.php');
+ $url = get_file_url("$courseid/$file");
}
return $url;
}
Index: question/format/qti2/qt_common.php
===================================================================
RCS file: /cvsroot/moodle/moodle/question/format/qti2/qt_common.php,v
retrieving revision 1.4
diff -u -F ^f -r1.4 qt_common.php
--- question/format/qti2/qt_common.php 15 Jun 2007 10:24:29 -0000 1.4
+++ question/format/qti2/qt_common.php 2 May 2008 09:27:09 -0000
@@ -102,10 +102,9 @@ function get_media_tag($file, $courseid
// if it's a moodle library file, it will be served through file.php
if (substr(strtolower($file), 0, 7) == 'http://') {
$media = $file;
- } else if ($CFG->slasharguments) { // Use this method if possible for better caching
- $media = "{$CFG->wwwroot}/file.php/$courseid/$file";
} else {
- $media = "{$CFG->wwwroot}/file.php?file=/$courseid/$file";
+ require_once($CFG->libdir.'/filelib.php');
+ $media = get_file_url("$courseid/$file");
}
$ismultimedia = false;
Index: theme/standardlogo/header.html
===================================================================
RCS file: /cvsroot/moodle/moodle/theme/standardlogo/header.html,v
retrieving revision 1.26.2.1
diff -u -F ^f -r1.26.2.1 header.html
--- theme/standardlogo/header.html 23 Nov 2007 16:41:16 -0000 1.26.2.1
+++ theme/standardlogo/header.html 2 May 2008 09:27:09 -0000
@@ -23,17 +23,11 @@
} else if (file_exists($CFG->dirroot.'/logo.gif')) {
$standardlogo = $CFG->httpswwwroot.'/logo.gif';
} else if (file_exists($CFG->dataroot.'/1/logo.jpg')) {
- if (empty($CFG->slasharguments)) {
- $standardlogo = $CFG->httpswwwroot.'/file.php?file=/1/logo.jpg';
- } else {
- $standardlogo = $CFG->httpswwwroot.'/file.php/1/logo.jpg';
- }
+ require_once($CFG->libdir.'/filelib.php');
+ $standardlogo = get_file_url('1/logo.jpg', null, 'httpscoursefile');
} else if (file_exists($CFG->dataroot.'/1/logo.gif')) {
- if (empty($CFG->slasharguments)) {
- $standardlogo = $CFG->httpswwwroot.'/file.php?file=/1/logo.gif';
- } else {
- $standardlogo = $CFG->httpswwwroot.'/file.php/1/logo.gif';
- }
+ require_once($CFG->libdir.'/filelib.php');
+ $standardlogo = get_file_url('1/logo.gif', null, 'httpscoursefile');
} else {
$standardlogo = $CFG->httpsthemewww .'/'. current_theme().'/logo.gif';
}