]> git.wh0rd.org - tt-rss.git/commitdiff
no-cache fixes for safari
authorAndrew Dolgov <fox@bah.spb.su>
Fri, 2 Mar 2007 11:34:34 +0000 (12:34 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Fri, 2 Mar 2007 11:34:34 +0000 (12:34 +0100)
backend.php
functions.php
prefs.php
tt-rss.php

index 656dcbf9c2155ee4618ddd3a4755d3702886844e..b1ddcd5af8e260f9d5fe469d46d41697ca377301 100644 (file)
@@ -1,11 +1,8 @@
 <?php
        require_once "sessions.php";
        require_once "modules/backend-rpc.php";
-       
-       header("Cache-Control: no-cache, max-age=0, must-revalidate");
-       header("Pragma: no-cache");
-       header("Expires: " . gmdate("D, d M Y H:i:s", time()) . " GMT");
-       
+
+
 /*     if ($_GET["debug"]) {
                define('DEFAULT_ERROR_LEVEL', E_ALL);
        } else {
@@ -23,6 +20,8 @@
        require_once "db-prefs.php";
        require_once "functions.php";
 
+       no_cache_incantation();
+
        $script_started = getmicrotime();
 
        $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME); 
index 49955b63f0cb267891f2a58602193b0c9645f26b..f014b8d2942ac658f9c5a263c31354ec9d0b4c33 100644 (file)
                require_once "login_form.php";
        }
 
+       // from http://developer.apple.com/internet/safari/faq.html
+       function no_cache_incantation() {
+               header("Expires: Mon, 22 Dec 1980 00:00:00 GMT"); // Happy birthday to me :)
+               header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
+               header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); // HTTP/1.1
+               header("Cache-Control: post-check=0, pre-check=0", false);
+               header("Pragma: no-cache"); // HTTP/1.0
+       }
+
 ?>
index ad77d86621b21b2c0bf7ab752bb951874e77ce0e..93c246b908e1592f7f0586e98ff08a945096e1f6 100644 (file)
--- a/prefs.php
+++ b/prefs.php
@@ -12,9 +12,7 @@
 
        $dt_add = get_script_dt_add();
 
-       header("Cache-Control: no-cache, max-age=0, must-revalidate");
-       header("Pragma: no-cache");
-       header("Expires: " . gmdate("D, d M Y H:i:s", time()) . " GMT");
+       no_cache_incantation();
 
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
index ab850f2f44deb11b8f30c0ba509a9dcab7d24aff..bc337ee3153f6e9cf355c5f77600f326ac23120d 100644 (file)
@@ -12,9 +12,7 @@
 
        $dt_add = get_script_dt_add();
 
-       header("Cache-Control: no-cache, max-age=0, must-revalidate");
-       header("Pragma: no-cache");
-       header("Expires: " . gmdate("D, d M Y H:i:s", time()) . " GMT");
+       no_cache_incantation();
 
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"