summaryrefslogtreecommitdiff
path: root/program/include/main.inc
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2005-12-14 23:47:32 +0000
committerthomascube <thomas@roundcube.net>2005-12-14 23:47:32 +0000
commit749b07c78a29b03c63812c3ec3630b16db4baa8f (patch)
tree5e6749f18a5a65a6bd0b97b356d41358e3676fea /program/include/main.inc
parent9fc381f4e8712fec0e7b67c0f4e7af0980261e16 (diff)
IMAP bugfixes, better signature handling
Diffstat (limited to 'program/include/main.inc')
-rw-r--r--program/include/main.inc13
1 files changed, 8 insertions, 5 deletions
diff --git a/program/include/main.inc b/program/include/main.inc
index 40ca1d4d7..6c4591dac 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -1098,15 +1098,18 @@ function format_date($date, $format=NULL)
$now = time(); // local time
$now -= (int)date('Z'); // make GMT time
$now += ($CONFIG['timezone'] * 3600); // user's time
+ $now_date = getdate();
- $day_secs = 60*((int)date('H', $now)*60 + (int)date('i', $now));
- $week_secs = 60 * 60 * 24 * 7;
- $diff = $now - $timestamp;
+ //$day_secs = 60*((int)date('H', $now)*60 + (int)date('i', $now));
+ //$week_secs = 60 * 60 * 24 * 7;
+ //$diff = $now - $timestamp;
+ $today_limit = mktime(0, 0, 0, $now_date['mon'], $now_date['mday'], $now_date['year']);
+ $week_limit = mktime(0, 0, 0, $now_date['mon'], $now_date['mday']-6, $now_date['year']);
// define date format depending on current time
- if ($CONFIG['prettydate'] && !$format && $diff < $day_secs)
+ if ($CONFIG['prettydate'] && !$format && $timestamp > $today_limit)
return sprintf('%s %s', rcube_label('today'), date('H:i', $timestamp));
- else if ($CONFIG['prettydate'] && !$format && $diff < $week_secs)
+ else if ($CONFIG['prettydate'] && !$format && $timestamp > $week_limit)
$format = $CONFIG['date_short'] ? $CONFIG['date_short'] : 'D H:i';
else if (!$format)
$format = $CONFIG['date_long'] ? $CONFIG['date_long'] : 'd.m.Y H:i';