From 112aed6035ba7f79e2f3a1ccbc22ef77a2621f47 Mon Sep 17 00:00:00 2001 From: David Balch Date: Wed, 19 Nov 2014 14:14:50 +0000 Subject: [PATCH] MDL-9443 core_files: Also filter .xhtml resources. Change the filters to treat .xhtml files the same as .html, so they are filtered by both "All files" and "HTML files only". --- lib/filelib.php | 4 ++-- mod/resource/lib.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/filelib.php b/lib/filelib.php index 0d3ba4db597..45ea442d06b 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -2320,7 +2320,7 @@ function send_file($path, $filename, $lifetime = null , $filter=0, $pathisstring } else { // Try to put the file through filters - if ($mimetype == 'text/html') { + if ($mimetype == 'text/html' || $mimetype == 'application/xhtml+xml') { $options = new stdClass(); $options->noclean = true; $options->nocache = true; // temporary workaround for MDL-5136 @@ -2494,7 +2494,7 @@ function send_stored_file($stored_file, $lifetime=null, $filter=0, $forcedownloa readfile_accel($stored_file, $mimetype, !$dontdie); } else { // Try to put the file through filters - if ($mimetype == 'text/html') { + if ($mimetype == 'text/html' || $mimetype == 'application/xhtml+xml') { $options = new stdClass(); $options->noclean = true; $options->nocache = true; // temporary workaround for MDL-5136 diff --git a/mod/resource/lib.php b/mod/resource/lib.php index a0d1d5e6d77..943985404e2 100644 --- a/mod/resource/lib.php +++ b/mod/resource/lib.php @@ -383,7 +383,7 @@ function resource_pluginfile($course, $cm, $context, $filearea, $args, $forcedow // should we apply filters? $mimetype = $file->get_mimetype(); - if ($mimetype === 'text/html' or $mimetype === 'text/plain') { + if ($mimetype === 'text/html' or $mimetype === 'text/plain' or $mimetype === 'application/xhtml+xml') { $filter = $DB->get_field('resource', 'filterfiles', array('id'=>$cm->instance)); $CFG->embeddedsoforcelinktarget = true; } else {