// Add date
$('msgHeadersColl').select('.date').invoke('update', r.minidate);
- $('msgHeaderDate').select('.date').invoke('update', r.fulldate);
+ $('msgHeaderDate').select('.date').invoke('update', r.localdate);
// Add from/to/cc headers
[ 'from', 'to', 'cc' ].each(function(a) {
*
* @param string $date The date string.
*
- * @return string The date string with the local time added on. If not
- * in MIMP mode, the output has been run through
- * htmlspecialchars().
+ * @return string The local formatted time string.
*/
- public function addLocalTime($date)
+ public function getLocalTime($date)
{
if (empty($date)) {
$ltime = false;
}
if (($ltime === false) || ($ltime === -1)) {
- return ($_SESSION['imp']['view'] == 'mimp')
- ? $date
- : htmlspecialchars($date);
+ return '';
}
$time_str = strftime($GLOBALS['prefs']->getValue('time_format'), $ltime);
(date('d') != @date('d', $ltime))) {
/* Not today, use the date. */
$date_str = strftime($GLOBALS['prefs']->getValue('date_format'), $ltime);
- $local_date = sprintf('[%s %s %s]', $date_str, $time_str, $tz);
- } else {
- /* Else, it's today, use the time only. */
- $local_date = sprintf('[%s %s]', $time_str, $tz);
+ return sprintf('%s %s %s', $date_str, $time_str, $tz);
}
- return ($_SESSION['imp']['view'] == 'mimp')
- ? $date . ' ' . $local_date
- : htmlspecialchars($date) . ' <small>' . htmlspecialchars($local_date) . '</small>';
+ /* Else, it's today, use the time only. */
+ return sprintf('%s %s', $time_str, $tz);
}
/**
} elseif ($val = $mime_headers->getValue($head)) {
if ($head == 'date') {
/* Add local time to date header. */
- $val = nl2br($imp_ui->addLocalTime($envelope['date']));
+ $val = htmlspecialchars($imp_ui->getLocalTime($envelope['date']));
if ($preview) {
- $result['fulldate'] = $val;
+ $result['localdate'] = $val;
}
} elseif (!$preview) {
$val = htmlspecialchars($val);
$basic_headers = $imp_ui->basicHeaders();
$display_headers = $msgAddresses = array();
-$format_date = $imp_ui->addLocalTime(nl2br($envelope['date']));
+$format_date = $imp_ui->getLocalTime($envelope['date']);
if (!empty($format_date)) {
$display_headers['date'] = $format_date;
}
$basic_headers = $imp_ui->basicHeaders();
$display_headers = $msgAddresses = array();
-$format_date = $imp_ui->addLocalTime(nl2br($envelope['date']));
+$format_date = $imp_ui->getLocalTime($envelope['date']);
if (!empty($format_date)) {
$display_headers['date'] = $format_date;
}
$curr_msg['idx'] = $idx;
/* Get headers for the message. */
- $curr_msg['date'] = $imp_ui->addLocalTime(nl2br($envelope['date']));
+ $curr_msg['date'] = $imp_ui->getLocalTime($envelope['date']);
if (IMP::isSpecialFolder($mbox)) {
$curr_msg['addr_to'] = true;