CRM-12527 - Additional header fixes
authorColeman Watts <coleman@civicrm.org>
Wed, 7 Oct 2015 18:05:35 +0000 (14:05 -0400)
committerColeman Watts <coleman@civicrm.org>
Wed, 7 Oct 2015 18:05:35 +0000 (14:05 -0400)
CRM/Mailing/Page/View.php
Civi/Angular/Page/Modules.php

index 3bc78a2addc0efe1bdc80092d764f82b58a4fe77..49c75879a1ef20a6472a7539735b1471ea39d12f 100644 (file)
@@ -172,14 +172,14 @@ class CRM_Mailing_Page_View extends CRM_Core_Page {
 
     $title = NULL;
     if (isset($this->_mailing->body_html) && empty($_GET['text'])) {
-      $header = 'Content-Type: text/html; charset=utf-8';
+      $header = 'text/html; charset=utf-8';
       $content = $mime->getHTMLBody();
       if (strpos($content, '<head>') === FALSE && strpos($content, '<title>') === FALSE) {
         $title = '<head><title>' . $this->_mailing->subject . '</title></head>';
       }
     }
     else {
-      $header = 'Content-Type: text/plain; charset=utf-8';
+      $header = 'text/plain; charset=utf-8';
       $content = $mime->getTXTBody();
     }
     CRM_Utils_System::setTitle($this->_mailing->subject);
@@ -188,7 +188,7 @@ class CRM_Mailing_Page_View extends CRM_Core_Page {
       CRM_Core_Page_AJAX::returnJsonResponse($content);
     }
     if ($print) {
-      header($header);
+      CRM_Utils_System::setHttpHeader('Content-Type', $header);
       print $title;
       print $content;
       CRM_Utils_System::civiExit();
index 7526773bd2fc0200a7e17ee34554d3794e5d0cd9..2fc3d86368ee3f01ae0a743db81dc84932f0e80f 100644 (file)
@@ -132,9 +132,9 @@ class Modules extends \CRM_Core_Page {
   public function send($type, $data) {
     // Encourage browsers to cache for a long time - 1 year
     $ttl = 60 * 60 * 24 * 364;
-    header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + $ttl));
-    header("Content-Type:      $type");
-    header("Cache-Control: max-age=$ttl, public");
+    \CRM_Utils_System::setHttpHeader('Expires', gmdate('D, d M Y H:i:s \G\M\T', time() + $ttl));
+    \CRM_Utils_System::setHttpHeader("Content-Type", $type);
+    \CRM_Utils_System::setHttpHeader("Cache-Control", "max-age=$ttl, public");
     echo $data;
   }