From 22b2b86ba9df864f2f51932c4aa9ccbd5697fd0a Mon Sep 17 00:00:00 2001 From: Anthony Borghi <anthony.borghi@veremes.com> Date: Wed, 13 Mar 2019 11:25:29 +0100 Subject: [PATCH] =?UTF-8?q?retouche=20pour=20l'ouverture=20en=20inline=20?= =?UTF-8?q?=C3=A0=20travers=20le=20filedownloader?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vas/rest/index.vhtml | 8 ++++++-- vas/rest/ws/vitis/FileDownloader.class.inc | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/vas/rest/index.vhtml b/vas/rest/index.vhtml index 4e0e614d..44fcbfaf 100755 --- a/vas/rest/index.vhtml +++ b/vas/rest/index.vhtml @@ -1,4 +1,8 @@ <?php - header('Content-type: '.$aValues['output'].'; charset='.$properties["page_encoding"]); + ob_end_flush(); + $aCurrentHeaders = apache_response_headers(); + if(!array_key_exists('Content-Type-Set-By', $aCurrentHeaders)){ + header('Content-type: '.$aValues['output'].'; charset='.$properties["page_encoding"]); + } echo $sMessage; -?> \ No newline at end of file +?> diff --git a/vas/rest/ws/vitis/FileDownloader.class.inc b/vas/rest/ws/vitis/FileDownloader.class.inc index 4f838a82..c2f2e825 100755 --- a/vas/rest/ws/vitis/FileDownloader.class.inc +++ b/vas/rest/ws/vitis/FileDownloader.class.inc @@ -128,8 +128,9 @@ class FileDownloader extends Vitis { return array("status" => 1, "fileName" => $sFileName); } - header("Content-Type: " . $sContentType); - if (in_array($sContentType, array("text/plain", 'application/pdf', 'text/html'))){ + header("Content-Type: " . $sContentType .'; charset='. $this->aProperties["page_encoding"]); + header("Content-Type-Set-By: vitis/filedownloader"); + if (in_array($sContentType, array("text/plain", 'application/pdf', 'text/html', 'application/xml', 'application/json'))){ header("Content-disposition: inline; filename=\"" . rawurlencode($sFileName) . "\""); } else { header("Content-disposition: attachment; filename=\"" . rawurlencode($sFileName) . "\""); -- GitLab