From c931ace58d93cc4313b866c5324474c46c204872 Mon Sep 17 00:00:00 2001 From: garvinhicking Date: Wed, 30 Aug 2006 09:51:59 +0000 Subject: [PATCH] Allow to use Cache-Control --- docs/NEWS | 3 +++ index.php | 9 +++++++++ serendipity_config.inc.php | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/docs/NEWS b/docs/NEWS index 9431837..cf41f79 100644 --- 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! diff --git a/index.php b/index.php index 061b499..24a6842 100644 --- 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']; diff --git a/serendipity_config.inc.php b/serendipity_config.inc.php index 1de8dea..ddaf750 100644 --- a/serendipity_config.inc.php +++ b/serendipity_config.inc.php @@ -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; -- 2.39.5