summaryrefslogtreecommitdiff
path: root/roundcubemail/program/include
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2008-04-17 20:05:58 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2008-04-17 20:05:58 +0000
commitd5a39e640b4e075d316a23b74d57d2db2d2ab690 (patch)
tree72ba07b047d497cb40a953e37c4d767439b0744f /roundcubemail/program/include
parentb3ae63b268b6eb7c59f50d419824b630ab09b679 (diff)
- Fix non-RFC dates formatting (#1484901)
git-svn-id: https://svn.roundcube.net/trunk@1324 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include')
-rw-r--r--roundcubemail/program/include/main.inc16
1 files changed, 13 insertions, 3 deletions
diff --git a/roundcubemail/program/include/main.inc b/roundcubemail/program/include/main.inc
index 09a53f0ad..b5004e899 100644
--- a/roundcubemail/program/include/main.inc
+++ b/roundcubemail/program/include/main.inc
@@ -1507,12 +1507,22 @@ function format_date($date, $format=NULL)
global $CONFIG, $sess_user_lang;
$ts = NULL;
-
+
if (is_numeric($date))
$ts = $date;
else if (!empty($date))
- $ts = @strtotime($date);
-
+ {
+ while (($ts = @strtotime($date))===false)
+ {
+ // if we have a date in non-rfc format
+ // remove token from the end and try again
+ $d = explode(' ', $date);
+ array_pop($d);
+ if (!$d) break;
+ $date = implode(' ', $d);
+ }
+ }
+
if (empty($ts))
return '';