cvs: phpweb / downloads.php get_download.php /include site.inc

From: Date: Sat, 03 May 2003 15:49:19 +0000
Subject: cvs: phpweb / downloads.php get_download.php /include site.inc
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-17251@lists.php.net to get a copy of this message
goba Sat May 3 11:49:19 2003 EDT Modified files: /phpweb downloads.php get_download.php /phpweb/include site.inc Log: Add a header_nocache() function instead of repeaing the same headers on all pages where this is needed Index: phpweb/downloads.php diff -u phpweb/downloads.php:1.157 phpweb/downloads.php:1.158 --- phpweb/downloads.php:1.157 Thu Feb 20 06:31:34 2003 +++ phpweb/downloads.php Sat May 3 11:49:18 2003 @@ -8,8 +8,8 @@ require_once 'prepend.inc'; -header("Cache-Control: private"); -header("Pragma: no-cache"); +// Try to make this page non-cached +header_nocache(); $SIDEBAR_DATA = ' <h3>Binaries for other systems</h3> Index: phpweb/get_download.php diff -u phpweb/get_download.php:1.13 phpweb/get_download.php:1.14 --- phpweb/get_download.php:1.13 Thu May 1 09:26:24 2003 +++ phpweb/get_download.php Sat May 3 11:49:18 2003 @@ -2,8 +2,7 @@ include_once 'prepend.inc'; // Try to make this page non-cached -header("Cache-Control: private"); -header("Pragma: no-cache"); +header_nocache(); // If there is no such file, then drop out an invalid file error message if (!isset($df) || !file_exists($DOCUMENT_ROOT . '/distributions/' . $df)) { Index: phpweb/include/site.inc diff -u phpweb/include/site.inc:1.243 phpweb/include/site.inc:1.244 --- phpweb/include/site.inc:1.243 Thu May 1 07:49:26 2003 +++ phpweb/include/site.inc Sat May 3 11:49:18 2003 @@ -1,6 +1,6 @@ <?php // -*- C++ -*- -// $Id: site.inc,v 1.243 2003/05/01 11:49:26 goba Exp $ +// $Id: site.inc,v 1.244 2003/05/03 15:49:18 goba Exp $ // Define $MIRRORS array, and some constants include_once 'mirrors.inc'; @@ -128,6 +128,18 @@ // Always exit (the page is not to be displayed) exit; +} + +// Use this function to write out proper headers on +// pages where the content should not be publicly cached +function header_nocache() +{ + // Only try to send out headers in case + // those were not sent already + if (!headers_sent()) { + header("Cache-Control: private"); + header("Pragma: no-cache"); + } } // Guess the current site from what Apache tells us.

« previous php.mirrors (#17251) next »