? .hg ? .hgignore Index: file.php =================================================================== RCS file: /cvsroot/moodle/moodle/file.php,v retrieving revision 1.44.2.2 diff -u -F ^f -r1.44.2.2 file.php --- file.php 25 Sep 2007 19:09:08 -0000 1.44.2.2 +++ file.php 9 Apr 2008 09:43:27 -0000 @@ -1,5 +1,9 @@ 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); - } - + require_once($CFG->libdir.'/filelib.php'); + $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.62.2.6 diff -u -F ^f -r1.62.2.6 lib.php --- blog/lib.php 17 Aug 2007 08:15:38 -0000 1.62.2.6 +++ blog/lib.php 9 Apr 2008 09:43:32 -0000 @@ -301,11 +301,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.111.2.7 diff -u -F ^f -r1.111.2.7 index.php --- files/index.php 2 Feb 2008 21:10:45 -0000 1.111.2.7 +++ files/index.php 9 Apr 2008 09:43:32 -0000 @@ -799,11 +799,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.39.2.11 diff -u -F ^f -r1.39.2.11 filelib.php --- lib/filelib.php 8 Apr 2008 03:00:30 -0000 1.39.2.11 +++ lib/filelib.php 9 Apr 2008 09:43:33 -0000 @@ -11,6 +11,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.85.2.21 diff -u -F ^f -r1.85.2.21 questionlib.php --- lib/questionlib.php 28 Feb 2008 12:53:05 -0000 1.85.2.21 +++ lib/questionlib.php 9 Apr 2008 09:43:34 -0000 @@ -1314,12 +1314,8 @@ 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/$courseid/$question->image"; - - } else { - $img .= "$CFG->wwwroot/file.php?file=/$courseid/$question->image"; + } else { + $img = get_file_url("$courseid"); } } return $img; Index: lib/weblib.php =================================================================== RCS file: /cvsroot/moodle/moodle/lib/weblib.php,v retrieving revision 1.812.2.102 diff -u -F ^f -r1.812.2.102 weblib.php --- lib/weblib.php 19 Mar 2008 08:23:26 -0000 1.812.2.102 +++ lib/weblib.php 9 Apr 2008 09:43:36 -0000 @@ -3380,11 +3380,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.20.2.4 diff -u -F ^f -r1.20.2.4 preset.php --- mod/data/preset.php 6 Dec 2007 00:45:32 -0000 1.20.2.4 +++ mod/data/preset.php 9 Apr 2008 09:43:38 -0000 @@ -194,7 +194,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.16 diff -u -F ^f -r1.16 field.class.php --- mod/data/field/file/field.class.php 8 Jan 2007 09:14:22 -0000 1.16 +++ mod/data/field/file/field.class.php 9 Apr 2008 09:43:38 -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 = ''; @@ -91,13 +87,8 @@ $src = empty($contents[0])? '':$contents[0]; $name = empty($contents[1])? $src:$contents[1]; - $path = $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; - } + require_once($CFG->libdir.'/filelib.php'); + $source = get_file_url($this->data->course.'/'.$CFG->moddata.'/data/'.$this->data->id.'/'.$this->field->id.'/'.$recordid); $width = $this->field->param1 ? ' width = "'.s($this->field->param1).'" ':' '; $height = $this->field->param2 ? ' height = "'.s($this->field->param2).'" ':' '; Index: mod/data/field/picture/field.class.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/data/field/picture/field.class.php,v retrieving revision 1.21.2.2 diff -u -F ^f -r1.21.2.2 field.class.php --- mod/data/field/picture/field.class.php 5 Aug 2007 16:40:05 -0000 1.21.2.2 +++ mod/data/field/picture/field.class.php 9 Apr 2008 09:43:38 -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 = '
'; @@ -90,15 +86,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/lib.php,v retrieving revision 1.47 diff -u -F ^f -r1.47 lib.php --- mod/exercise/lib.php 8 Jan 2007 09:14:22 -0000 1.47 +++ mod/exercise/lib.php 9 Apr 2008 09:43:39 -0000 @@ -760,13 +760,9 @@ 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"; - } + $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.536.2.41 diff -u -F ^f -r1.536.2.41 lib.php --- mod/forum/lib.php 7 Dec 2007 00:45:06 -0000 1.536.2.41 +++ mod/forum/lib.php 9 Apr 2008 09:43:40 -0000 @@ -2867,11 +2867,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.24.2.1 diff -u -F ^f -r1.24.2.1 rsslib.php --- mod/forum/rsslib.php 22 Aug 2007 07:52:10 -0000 1.24.2.1 +++ mod/forum/rsslib.php 9 Apr 2008 09:43:40 -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.168.2.8 diff -u -F ^f -r1.168.2.8 lib.php --- mod/glossary/lib.php 17 Mar 2008 12:31:45 -0000 1.168.2.8 +++ mod/glossary/lib.php 9 Apr 2008 09:43:41 -0000 @@ -1184,11 +1184,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.10.2.3 diff -u -F ^f -r1.10.2.3 mediafile.php --- mod/lesson/mediafile.php 24 Jul 2007 07:01:43 -0000 1.10.2.3 +++ mod/lesson/mediafile.php 9 Apr 2008 09:43:42 -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/resource/type/directory/resource.class.php =================================================================== RCS file: /cvsroot/moodle/moodle/mod/resource/type/directory/resource.class.php,v retrieving revision 1.34.2.2 diff -u -F ^f -r1.34.2.2 resource.class.php --- mod/resource/type/directory/resource.class.php 8 Nov 2007 05:36:21 -0000 1.34.2.2 +++ mod/resource/type/directory/resource.class.php 9 Apr 2008 09:43:42 -0000 @@ -126,12 +126,7 @@ function display() { } else { $icon = mimeinfo("icon", $file); - - if ($CFG->slasharguments) { - $relativeurl = "/file.php/$relativepath/$file"; - } else { - $relativeurl = "/file.php?file=/$relativepath/$file"; - } + $relativeurl = get_file_url("$relativepath/$file"); $filesize = display_size(filesize("$CFG->dataroot/$relativepath/$file")); } @@ -198,4 +193,4 @@ function setup_elements(&$mform) { } -?> \ 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 9 Apr 2008 09:43:42 -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/locallib.php,v retrieving revision 1.42 diff -u -F ^f -r1.42 locallib.php --- mod/workshop/locallib.php 10 Jan 2007 08:29:42 -0000 1.42 +++ mod/workshop/locallib.php 9 Apr 2008 09:43:43 -0000 @@ -2860,16 +2860,12 @@ function workshop_print_submission($work if ($files = get_directory_list($basedir)) { 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/submissions.php,v retrieving revision 1.56 diff -u -F ^f -r1.56 submissions.php --- mod/workshop/submissions.php 10 Jan 2007 08:29:42 -0000 1.56 +++ mod/workshop/submissions.php 9 Apr 2008 09:43:43 -0000 @@ -267,16 +267,12 @@ $n = 1; 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.28.2.6 diff -u -F ^f -r1.28.2.6 export.php --- question/export.php 10 Oct 2007 21:09:34 -0000 1.28.2.6 +++ question/export.php 9 Apr 2008 09:43:44 -0000 @@ -130,12 +130,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()."/$exportfilename".$file_ext."?forcedownload=1"; - } - else { - $efile = "{$CFG->wwwroot}/file.php?file=/".$qformat->question_get_export_dir()."/$exportfilename".$file_ext."&forcedownload=1"; - } + require_once($CFG->libdir.'/filelib.php'); + $efile = get_file_url($qformat->question_get_export_dir() .'/'. $exportfilename . $file_ext, array('forcedownload'=>1)); echo "

$txt->download

"; echo "

$txt->downloadextra

"; Index: question/format/hotpot/format.php =================================================================== RCS file: /cvsroot/moodle/moodle/question/format/hotpot/format.php,v retrieving revision 1.10.2.3 diff -u -F ^f -r1.10.2.3 format.php --- question/format/hotpot/format.php 5 Feb 2008 04:09:38 -0000 1.10.2.3 +++ question/format/hotpot/format.php 9 Apr 2008 09:43:44 -0000 @@ -39,11 +39,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.11 diff -u -F ^f -r1.11 format.php --- question/format/qti2/format.php 7 Feb 2007 11:36:20 -0000 1.11 +++ question/format/qti2/format.php 9 Apr 2008 09:43:44 -0000 @@ -402,6 +402,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; @@ -417,11 +418,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; } @@ -905,10 +902,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.2 diff -u -F ^f -r1.2 qt_common.php --- question/format/qti2/qt_common.php 24 Mar 2006 19:31:46 -0000 1.2 +++ question/format/qti2/qt_common.php 9 Apr 2008 09:43:44 -0000 @@ -100,10 +100,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.24.2.2 diff -u -F ^f -r1.24.2.2 header.html --- theme/standardlogo/header.html 23 Feb 2007 05:22:24 -0000 1.24.2.2 +++ theme/standardlogo/header.html 9 Apr 2008 09:43:45 -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'; }