From: Mischa POSLAWSKY Date: Sun, 6 Dec 2020 06:33:51 +0000 (+0100) Subject: mail: lay out sender and date as subheader X-Git-Tag: v5.0~25 X-Git-Url: http://git.shiar.nl/minimedit.git/commitdiff_plain/b3e01444d0f6253ae14d6223daa325686718fb63 mail: lay out sender and date as subheader Similar to the GMail interface. --- diff --git a/mail/index.php b/mail/index.php index b4846cc..d4d4c29 100644 --- a/mail/index.php +++ b/mail/index.php @@ -17,13 +17,17 @@ if ($msgid) { $filename = "$mailbox/$msgid"; list ($headerdata, $rawbody) = explode("\n\n", file_get_contents($filename), 2); $head = parsemailhead($headerdata); + $head['date']->setTimezone(new DateTimeZone(date_default_timezone_get())); $Page->title = 'Mailbericht ' . $head['date']->format('Y-m-d H:i'); printf("

%s

\n", htmlspecialchars($head['Subject'] ?? 'Mailbericht zonder onderwerp')); - print '
'; - printf('
Ontvangen:
%s
', $head['date']->format('c')); - printf('
Verzender:
%s
', htmlspecialchars($head['From'])); + printf('

%s %s

'."\n", + htmlspecialchars($head['From']), + htmlspecialchars(implode(', ', array_column($head['from'], 'display'))), + htmlspecialchars($head['Date']), + showdate(preg_split('/\D/', $head['date']->format('c'))) + ); print '
'; if (preg_match('{^text/plain}', $head['Content-Type'] ?? 'text/plain')) { @@ -71,10 +75,12 @@ foreach (array_reverse($rows) as $filename) { $head = parsemailhead($headerdata); print $head['Subject']; - printf(' %s', + printf(' %s', + htmlspecialchars($head['Date']), showdate(explode('-', $head['date']->format('Y-m-d'))) ); - printf(' %s', + printf(' %s', + htmlspecialchars($head['From']), htmlspecialchars(implode(', ', array_column($head['from'], 'display'))) ); print "\n";