summaryrefslogtreecommitdiff
path: root/program/steps/mail
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2012-10-01 21:41:54 +0200
committerThomas Bruederli <thomas@roundcube.net>2012-10-01 21:41:54 +0200
commit61512fe104a0085333fd961fa78680b25cd3ab07 (patch)
treeaa96b5b3c0d929bf3cb5749d5964f781e80ef0a5 /program/steps/mail
parentdd525814ca2725e9b11692551d01a5bdf7931b04 (diff)
Avoid double-quoting of some message headers; wrap email address strings in <span> for better styling
Diffstat (limited to 'program/steps/mail')
-rw-r--r--program/steps/mail/func.inc38
1 files changed, 26 insertions, 12 deletions
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 45582d40d..c4791a0ce 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -319,7 +319,7 @@ function rcmail_js_message_list($a_headers, $insert_top=FALSE, $a_show_cols=null
$col_name = $col == 'fromto' ? $smart_col : $col;
if (in_array($col_name, array('from', 'to', 'cc', 'replyto')))
- $cont = Q(rcmail_address_string($header->$col_name, 3, false, null, $header->charset), 'show');
+ $cont = rcmail_address_string($header->$col_name, 3, false, null, $header->charset);
else if ($col == 'subject') {
$cont = trim(rcube_mime::decode_header($header->$col, $header->charset));
if (!$cont) $cont = rcube_label('nosubject');
@@ -957,6 +957,8 @@ function rcmail_message_headers($attrib, $headers=NULL)
$output_headers = array();
foreach ($standard_headers as $hkey) {
+ $ishtml = false;
+
if ($headers[$hkey])
$value = $headers[$hkey];
else if ($headers['others'][$hkey])
@@ -981,24 +983,31 @@ function rcmail_message_headers($attrib, $headers=NULL)
continue;
}
else if ($hkey == 'replyto') {
- if ($headers['replyto'] != $headers['from'])
+ if ($headers['replyto'] != $headers['from']) {
$header_value = rcmail_address_string($value, null, true, $attrib['addicon'], $headers['charset']);
+ $ishtml = true;
+ }
else
continue;
}
else if ($hkey == 'mail-reply-to') {
if ($headers['mail-replyto'] != $headers['reply-to']
&& $headers['reply-to'] != $headers['from']
- )
+ ) {
$header_value = rcmail_address_string($value, null, true, $attrib['addicon'], $headers['charset']);
+ $ishtml = true;
+ }
else
continue;
}
else if ($hkey == 'mail-followup-to') {
$header_value = rcmail_address_string($value, null, true, $attrib['addicon'], $headers['charset']);
+ $ishtml = true;
+ }
+ else if (in_array($hkey, array('from', 'to', 'cc', 'bcc'))) {
+ $header_value = rcmail_address_string($value, $attrib['max'], true, $attrib['addicon'], $headers['charset']);
+ $ishtml = true;
}
- else if (in_array($hkey, array('from', 'to', 'cc', 'bcc')))
- $header_value = rcmail_address_string($value, null, true, $attrib['addicon'], $headers['charset']);
else if ($hkey == 'subject' && empty($value))
$header_value = rcube_label('nosubject');
else
@@ -1006,7 +1015,9 @@ function rcmail_message_headers($attrib, $headers=NULL)
$output_headers[$hkey] = array(
'title' => rcube_label(preg_replace('/(^mail-|-)/', '', $hkey)),
- 'value' => $header_value, 'raw' => $value
+ 'value' => $header_value,
+ 'raw' => $value,
+ 'html' => $ishtml,
);
}
@@ -1022,7 +1033,7 @@ function rcmail_message_headers($attrib, $headers=NULL)
foreach ($plugin['output'] as $hkey => $row) {
$table->add(array('class' => 'header-title'), Q($row['title']));
- $table->add(array('class' => 'header '.$hkey), Q($row['value'], ($hkey == 'subject' ? 'strict' : 'show')));
+ $table->add(array('class' => 'header '.$hkey), $row['html'] ? $row['value'] : Q($row['value'], ($hkey == 'subject' ? 'strict' : 'show')));
}
return $table->show($attrib);
@@ -1444,7 +1455,7 @@ function rcmail_address_string($input, $max=null, $linked=false, $addicon=null,
}
if ($addicon && $_SESSION['writeable_abook']) {
- $address = html::span(null, $address . html::a(array(
+ $address .= html::a(array(
'href' => "#add",
'onclick' => sprintf("return %s.command('add-contact','%s',this)", JS_OBJECT_NAME, $string),
'title' => rcube_label('addtoaddressbook'),
@@ -1453,15 +1464,18 @@ function rcmail_address_string($input, $max=null, $linked=false, $addicon=null,
html::img(array(
'src' => $CONFIG['skin_path'] . $addicon,
'alt' => "Add contact",
- ))));
+ )));
}
- $out .= $address;
+ $out .= html::span('adr', $address);
}
else {
+ $address = '';
if ($name)
- $out .= Q($name);
+ $address .= Q($name);
if ($mailto)
- $out .= (strlen($out) ? ' ' : '') . sprintf('&lt;%s&gt;', Q($mailto));
+ $address .= (strlen($address) ? ' ' : '') . sprintf('&lt;%s&gt;', Q($mailto));
+
+ $out .= html::span('adr', $address);
}
if ($c>$j)