]> git.mjollnir.org Git - s9y.git/commitdiff
Allow to use Cache-Control
authorgarvinhicking <garvinhicking>
Wed, 30 Aug 2006 09:51:59 +0000 (09:51 +0000)
committergarvinhicking <garvinhicking>
Wed, 30 Aug 2006 09:51:59 +0000 (09:51 +0000)
docs/NEWS
index.php
serendipity_config.inc.php

index 943183795fbb0f7a09f670daa5e3f59a3409e060..cf41f79587e7fa26e5adc5e6931e08eee1ff76f6 100644 (file)
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -3,6 +3,9 @@
 Version 1.1-beta4 ()
 ------------------------------------------------------------------------
 
+    * Allow to set $serendipity['CacheControl'] to make serendipity emit
+      Cache-Control: HTTP headers. Thanks to annonymous from the forums!
+      
     * Use seperate PHP session ID when using HTTPS login. Set 'secure'
       cookie parameters when using HTTPS. Thanks to lynoure!
 
index 061b499fb5414c0834f6d9d30b3ea4598e96f0e4..24a684227b9814c5c19d6a88571e08f57e354637 100644 (file)
--- a/index.php
+++ b/index.php
@@ -23,6 +23,15 @@ header('X-Blog: Serendipity'); // Used for installer detection
 ob_start();
 include('serendipity_config.inc.php');
 header('Content-Type: text/html; charset='. LANG_CHARSET);
+if ($serendipity['CacheControl']) {
+    if (!empty($HTTP_SERVER_VARS['SERVER_SOFTWARE']) && strstr($HTTP_SERVER_VARS['SERVER_SOFTWARE'], 'Apache/2')) {
+        header('Cache-Control: no-cache, pre-check=0, post-check=0');
+    } else {
+        header('Cache-Control: private, pre-check=0, post-check=0, max-age=0');
+    }
+    header('Expires: 0');
+    header('Pragma: no-cache'); 
+}
 $track_referer = true;
 $uri = $_SERVER['REQUEST_URI'];
 
index 1de8dea54ebb116b4ac3efce0c51bd55a3be0746..ddaf7503b0d9cdfeee13e8f18c89a36faee6285c 100644 (file)
@@ -87,6 +87,10 @@ if (!isset($serendipity['useHTTP-Auth'])) {
     $serendipity['useHTTP-Auth'] = true;
 }
 
+if (!isset($serendipity['CacheControl'])) {
+    $serendipity['CacheControl'] = false;
+}
+
 // Should IFRAMEs be used for previewing entries and sending trackbacks?
 $serendipity['use_iframe'] = true;