summaryrefslogtreecommitdiff
path: root/program/include
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2009-11-26 17:42:19 +0000
committeralecpl <alec@alec.pl>2009-11-26 17:42:19 +0000
commit539df6b502d0ada19b3e972f552457684cb654ba (patch)
tree70d1a3beab3bcc779c93c64dc41d2abdb6d336af /program/include
parentf7f9346feb02dafc8d7337790aacb0a9afb2b9a6 (diff)
- a few if()s less
Diffstat (limited to 'program/include')
-rw-r--r--program/include/main.inc16
1 files changed, 9 insertions, 7 deletions
diff --git a/program/include/main.inc b/program/include/main.inc
index 89ae1b97f..ae34a8023 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -906,13 +906,15 @@ function format_date($date, $format=NULL)
$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 && $timestamp > $today_limit && $timestamp < $now)
- return sprintf('%s %s', rcube_label('today'), date($CONFIG['date_today'] ? $CONFIG['date_today'] : 'H:i', $timestamp));
- else if ($CONFIG['prettydate'] && !$format && $timestamp > $week_limit && $timestamp < $now)
- $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';
+ // define date format depending on current time
+ if (!$format) {
+ if ($CONFIG['prettydate'] && $timestamp > $today_limit && $timestamp < $now)
+ return sprintf('%s %s', rcube_label('today'), date($CONFIG['date_today'] ? $CONFIG['date_today'] : 'H:i', $timestamp));
+ else if ($CONFIG['prettydate'] && $timestamp > $week_limit && $timestamp < $now)
+ $format = $CONFIG['date_short'] ? $CONFIG['date_short'] : 'D H:i';
+ else
+ $format = $CONFIG['date_long'] ? $CONFIG['date_long'] : 'd.m.Y H:i';
+ }
// strftime() format
if (preg_match('/%[a-z]+/i', $format))