From 0fea9ec133fe8448b54048e3b28d487035d973f3 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Wed, 14 Apr 2021 21:07:43 +0100 Subject: [PATCH] MDL-71338 tool_usertours: correct Content-Type on tour export. Replace existing code with standard file serving mechanism, in turn correcting the previously incorrect Content-Type header. --- admin/tool/usertours/classes/manager.php | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/admin/tool/usertours/classes/manager.php b/admin/tool/usertours/classes/manager.php index 9d76b2eaf51..01ebf39d9a1 100644 --- a/admin/tool/usertours/classes/manager.php +++ b/admin/tool/usertours/classes/manager.php @@ -438,17 +438,7 @@ class manager { $filename = 'tour_export_' . $tour->get_id() . '_' . time() . '.json'; // Force download. - header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT'); - header('Cache-Control: private, must-revalidate, pre-check=0, post-check=0, max-age=0'); - header('Expires: ' . gmdate('D, d M Y H:i:s', 0) . 'GMT'); - header('Pragma: no-cache'); - header('Accept-Ranges: none'); - header('Content-disposition: attachment; filename=' . $filename); - header('Content-length: ' . strlen($exportstring)); - header('Content-type: text/calendar; charset=utf-8'); - - echo $exportstring; - die; + send_file($exportstring, $filename, 0, 0, true, true); } /**