summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2008-04-13 09:15:39 +0000
committeralecpl <alec@alec.pl>2008-04-13 09:15:39 +0000
commit3f5cef86665d068478fe7298f8b811e4de47b605 (patch)
treed97287b879b04739d3e8135643123ff5153aea98 /program
parentf21ebb47c7ed6b62f9e8400c93c727be19c51367 (diff)
- reverted r1295
- disable caching for unseen messages to allow marking as read remarked messages
Diffstat (limited to 'program')
-rw-r--r--program/include/rcube_shared.inc16
-rw-r--r--program/steps/mail/show.inc6
2 files changed, 13 insertions, 9 deletions
diff --git a/program/include/rcube_shared.inc b/program/include/rcube_shared.inc
index c9cf4fbbf..f3ff0aa02 100644
--- a/program/include/rcube_shared.inc
+++ b/program/include/rcube_shared.inc
@@ -236,18 +236,22 @@ function send_future_expire_header($offset=2600000)
* @param int Modified date as unix timestamp
* @param string Etag value for caching
*/
-function send_modified_header($mdate, $etag=null)
+function send_modified_header($mdate, $etag=null, $skip_check=false)
{
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)
- $iscached = ($_SERVER['HTTP_IF_NONE_MATCH'] == $etag);
+
+ if (!$skip_check)
+ {
+ if ($_SERVER['HTTP_IF_MODIFIED_SINCE'] && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $mdate)
+ $iscached = true;
+
+ if ($etag)
+ $iscached = ($_SERVER['HTTP_IF_NONE_MATCH'] == $etag);
+ }
if ($iscached)
header("HTTP/1.x 304 Not Modified");
diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc
index 1fe4aa9b4..a530184d8 100644
--- a/program/steps/mail/show.inc
+++ b/program/steps/mail/show.inc
@@ -30,7 +30,7 @@ if ($_GET['_uid'])
// set message charset as default
if (!empty($MESSAGE['headers']->charset))
$IMAP->set_charset($MESSAGE['headers']->charset);
-
+
// go back to list if message not found (wrong UID)
if (!$MESSAGE['headers'])
{
@@ -53,13 +53,13 @@ if ($_GET['_uid'])
$mbox_name = $IMAP->get_mailbox_name();
// calculate Etag for this request
- $etag = md5($MESSAGE['UID'].$mbox_name.session_id().intval($MESSAGE['headers']->mdn_sent).intval($MESSAGE['headers']->seen).intval($MESSAGE['is_safe']).intval($PRINT_MODE));
+ $etag = md5($MESSAGE['UID'].$mbox_name.session_id().intval($MESSAGE['headers']->mdn_sent).intval($MESSAGE['is_safe']).intval($PRINT_MODE));
// allow caching, unless remote images are present
if ((bool)$MESSAGE['is_safe'])
send_nocacheing_headers();
else if (empty($CONFIG['devel_mode']))
- send_modified_header($_SESSION['login_time'], $etag);
+ send_modified_header($_SESSION['login_time'], $etag, !$MESSAGE['headers']->seen);
$MESSAGE['subject'] = rcube_imap::decode_mime_string($MESSAGE['headers']->subject, $MESSAGE['headers']->charset);
$OUTPUT->set_pagetitle($MESSAGE['subject']);