From: skodak Date: Wed, 15 Dec 2004 06:32:32 +0000 (+0000) Subject: fixed $course->id X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=62faef84c4e7b189a9f92a6d3429b2e3b94f1477;p=moodle.git fixed $course->id --- diff --git a/files/mimetypes.php b/files/mimetypes.php index 60a5bc7119..bf35810e4b 100644 --- a/files/mimetypes.php +++ b/files/mimetypes.php @@ -123,10 +123,16 @@ function send_file($path, $filename, $lifetime=86400 , $filter=false, $pathisstr readfile($path); } } else { // Try to put the file through filters + global $course; + if (!empty($course->id)) { + $courseid = $course->id; + } else { + $courseid = SITEID; + } if ($mimetype == 'text/html') { $options->noclean = true; $text = $pathisstring ? $path : implode('', file($path)); - $output = format_text($text, FORMAT_HTML, $options, $course->id); + $output = format_text($text, FORMAT_HTML, $options, $courseid); @header('Content-length: '.strlen($output)); @header('Content-type: text/html'); @@ -135,7 +141,7 @@ function send_file($path, $filename, $lifetime=86400 , $filter=false, $pathisstr $options->newlines = false; $options->noclean = true; $text = htmlentities($pathisstring ? $path : implode('', file($path))); - $output = '
'. format_text($text, FORMAT_MOODLE, $options, $course->id) .'
'; + $output = '
'. format_text($text, FORMAT_MOODLE, $options, $courseid) .'
'; @header('Content-length: '.strlen($output)); @header('Content-type: text/html; charset='. get_string('thischarset')); //add encoding