summaryrefslogtreecommitdiff
path: root/app/Core/Response.php
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-05-27 12:54:42 -0400
committerFrédéric Guillot <fred@kanboard.net>2014-05-27 12:54:42 -0400
commit3fb5c556ec75c1a5f54171527a76530764cc24f4 (patch)
treeb3b0875ff7d0991b9cf3b2cd46cce395fcbd8255 /app/Core/Response.php
parentc482e704697301a982e3c989ac795e0f4c2e899a (diff)
Fix some Windows Server issues
Diffstat (limited to 'app/Core/Response.php')
-rw-r--r--app/Core/Response.php22
1 files changed, 17 insertions, 5 deletions
diff --git a/app/Core/Response.php b/app/Core/Response.php
index 87d2fa4a..11d7567a 100644
--- a/app/Core/Response.php
+++ b/app/Core/Response.php
@@ -11,6 +11,18 @@ namespace Core;
class Response
{
/**
+ * Send no cache headers
+ *
+ * @access public
+ */
+ public function nocache()
+ {
+ header('Pragma: no-cache');
+ header('Cache-Control: no-cache, must-revalidate');
+ header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
+ }
+
+ /**
* Send a custom Content-Type header
*
* @access public
@@ -66,7 +78,7 @@ class Response
public function json(array $data, $status_code = 200)
{
$this->status($status_code);
-
+ $this->nocache();
header('Content-Type: application/json');
echo json_encode($data);
@@ -83,7 +95,7 @@ class Response
public function text($data, $status_code = 200)
{
$this->status($status_code);
-
+ $this->nocache();
header('Content-Type: text/plain; charset=utf-8');
echo $data;
@@ -100,7 +112,7 @@ class Response
public function html($data, $status_code = 200)
{
$this->status($status_code);
-
+ $this->nocache();
header('Content-Type: text/html; charset=utf-8');
echo $data;
@@ -117,7 +129,7 @@ class Response
public function xml($data, $status_code = 200)
{
$this->status($status_code);
-
+ $this->nocache();
header('Content-Type: text/xml; charset=utf-8');
echo $data;
@@ -151,7 +163,7 @@ class Response
public function binary($data, $status_code = 200)
{
$this->status($status_code);
-
+ $this->nocache();
header('Content-Transfer-Encoding: binary');
header('Content-Type: application/octet-stream');
echo $data;