- a few if()s less

release-0.6
alecpl 15 years ago
parent f7f9346feb
commit 539df6b502

@ -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']); $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']); $week_limit = mktime(0, 0, 0, $now_date['mon'], $now_date['mday']-6, $now_date['year']);
// define date format depending on current time // define date format depending on current time
if ($CONFIG['prettydate'] && !$format && $timestamp > $today_limit && $timestamp < $now) if (!$format) {
return sprintf('%s %s', rcube_label('today'), date($CONFIG['date_today'] ? $CONFIG['date_today'] : 'H:i', $timestamp)); if ($CONFIG['prettydate'] && $timestamp > $today_limit && $timestamp < $now)
else if ($CONFIG['prettydate'] && !$format && $timestamp > $week_limit && $timestamp < $now) return sprintf('%s %s', rcube_label('today'), date($CONFIG['date_today'] ? $CONFIG['date_today'] : 'H:i', $timestamp));
$format = $CONFIG['date_short'] ? $CONFIG['date_short'] : 'D H:i'; else if ($CONFIG['prettydate'] && $timestamp > $week_limit && $timestamp < $now)
else if (!$format) $format = $CONFIG['date_short'] ? $CONFIG['date_short'] : 'D H:i';
$format = $CONFIG['date_long'] ? $CONFIG['date_long'] : 'd.m.Y H:i'; else
$format = $CONFIG['date_long'] ? $CONFIG['date_long'] : 'd.m.Y H:i';
}
// strftime() format // strftime() format
if (preg_match('/%[a-z]+/i', $format)) if (preg_match('/%[a-z]+/i', $format))

Loading…
Cancel
Save