summaryrefslogtreecommitdiff
path: root/program/include
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2007-03-01 20:40:00 +0000
committerthomascube <thomas@roundcube.net>2007-03-01 20:40:00 +0000
commitff52bee1a2c1b3f6654c8bfe41d1a3d8630e2b55 (patch)
treef05d427a343a690662bacd0f832910cbdb8d075b /program/include
parent87e2fddb32da8580f73c5ec0628e9eacfb4e0043 (diff)
Solved wrong caching of message preview (#1484153, #1484236)
Diffstat (limited to 'program/include')
-rw-r--r--program/include/main.inc8
-rw-r--r--program/include/rcube_shared.inc37
2 files changed, 35 insertions, 10 deletions
diff --git a/program/include/main.inc b/program/include/main.inc
index 7e7f216de..b19c7f412 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -190,13 +190,6 @@ function rcmail_authenticate_session()
setcookie('sessauth', rcmail_auth_hash(session_id(), $now));
}
- if (!$valid)
- write_log('timeouts',
- "REQUEST: " . var_export($_REQUEST, true) .
- "\nEXPECTED: " . rcmail_auth_hash(session_id(), $_SESSION['auth_time']) .
- "\nOR LAST: " . rcmail_auth_hash(session_id(), $_SESSION['last_auth']) .
- "\nSESSION: " . var_export($_SESSION, true));
-
return $valid;
}
@@ -559,6 +552,7 @@ function rcmail_login($user, $pass, $host=NULL)
$_SESSION['username'] = $user;
$_SESSION['user_lang'] = $sess_user_lang;
$_SESSION['password'] = encrypt_passwd($pass);
+ $_SESSION['login_time'] = mktime();
// force reloading complete list of subscribed mailboxes
rcmail_set_imap_prop();
diff --git a/program/include/rcube_shared.inc b/program/include/rcube_shared.inc
index ba63c825f..558fbf7d9 100644
--- a/program/include/rcube_shared.inc
+++ b/program/include/rcube_shared.inc
@@ -1216,17 +1216,48 @@ function send_nocacheing_headers()
// send header with expire date 30 days in future
-function send_future_expire_header()
+function send_future_expire_header($offset=2600000)
{
if (headers_sent())
return;
- header("Expires: ".gmdate("D, d M Y H:i:s", mktime()+2600000)." GMT");
- header("Cache-Control: ");
+ header("Expires: ".gmdate("D, d M Y H:i:s", mktime()+$offset)." GMT");
+ header("Cache-Control: max-age=$offset");
header("Pragma: ");
}
+// check request for If-Modified-Since and send an according response
+function send_modified_header($mdate, $etag=null)
+{
+ if (headers_sent())
+ return;
+
+ $iscached = false;
+ if ($_SERVER['HTTP_IF_MODIFIED_SINCE'] && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $mdate)
+ $iscached = true;
+
+ $etag = $etag ? "\"$etag\"" : null;
+ if ($etag && $_SERVER['HTTP_IF_NONE_MATCH'] == $etag)
+ $iscached = true;
+
+ if ($iscached)
+ header("HTTP/1.x 304 Not Modified");
+ else
+ header("Last-Modified: ".gmdate("D, d M Y H:i:s", $mdate)." GMT");
+
+ header("Cache-Control: max-age=0");
+ header("Expires: ");
+ header("Pragma: ");
+
+ if ($etag)
+ header("Etag: $etag");
+
+ if ($iscached)
+ exit;
+}
+
+
// function to convert an array to a javascript array
function array2js($arr, $type='')
{