Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Avoid double-quoting of some message headers; wrap email address stri…

…ngs in <span> for better styling
  • Loading branch information...
commit 61512fe104a0085333fd961fa78680b25cd3ab07 1 parent dd52581
Thomas B. authored October 01, 2012

Showing 1 changed file with 26 additions and 12 deletions. Show diff stats Hide diff stats

  1. 38  program/steps/mail/func.inc
38  program/steps/mail/func.inc
@@ -319,7 +319,7 @@ function rcmail_js_message_list($a_headers, $insert_top=FALSE, $a_show_cols=null
319 319
       $col_name = $col == 'fromto' ? $smart_col : $col;
320 320
 
321 321
       if (in_array($col_name, array('from', 'to', 'cc', 'replyto')))
322  
-        $cont = Q(rcmail_address_string($header->$col_name, 3, false, null, $header->charset), 'show');
  322
+        $cont = rcmail_address_string($header->$col_name, 3, false, null, $header->charset);
323 323
       else if ($col == 'subject') {
324 324
         $cont = trim(rcube_mime::decode_header($header->$col, $header->charset));
325 325
         if (!$cont) $cont = rcube_label('nosubject');
@@ -957,6 +957,8 @@ function rcmail_message_headers($attrib, $headers=NULL)
957 957
   $output_headers = array();
958 958
 
959 959
   foreach ($standard_headers as $hkey) {
  960
+    $ishtml = false;
  961
+
960 962
     if ($headers[$hkey])
961 963
       $value = $headers[$hkey];
962 964
     else if ($headers['others'][$hkey])
@@ -981,24 +983,31 @@ function rcmail_message_headers($attrib, $headers=NULL)
981 983
         continue;
982 984
     }
983 985
     else if ($hkey == 'replyto') {
984  
-      if ($headers['replyto'] != $headers['from'])
  986
+      if ($headers['replyto'] != $headers['from']) {
985 987
         $header_value = rcmail_address_string($value, null, true, $attrib['addicon'], $headers['charset']);
  988
+        $ishtml = true;
  989
+      }
986 990
       else
987 991
         continue;
988 992
     }
989 993
     else if ($hkey == 'mail-reply-to') {
990 994
       if ($headers['mail-replyto'] != $headers['reply-to']
991 995
         && $headers['reply-to'] != $headers['from']
992  
-      )
  996
+      ) {
993 997
         $header_value = rcmail_address_string($value, null, true, $attrib['addicon'], $headers['charset']);
  998
+        $ishtml = true;
  999
+      }
994 1000
       else
995 1001
         continue;
996 1002
     }
997 1003
     else if ($hkey == 'mail-followup-to') {
998 1004
       $header_value = rcmail_address_string($value, null, true, $attrib['addicon'], $headers['charset']);
  1005
+      $ishtml = true;
  1006
+    }
  1007
+    else if (in_array($hkey, array('from', 'to', 'cc', 'bcc'))) {
  1008
+      $header_value = rcmail_address_string($value, $attrib['max'], true, $attrib['addicon'], $headers['charset']);
  1009
+      $ishtml = true;
999 1010
     }
1000  
-    else if (in_array($hkey, array('from', 'to', 'cc', 'bcc')))
1001  
-      $header_value = rcmail_address_string($value, null, true, $attrib['addicon'], $headers['charset']);
1002 1011
     else if ($hkey == 'subject' && empty($value))
1003 1012
       $header_value = rcube_label('nosubject');
1004 1013
     else
@@ -1006,7 +1015,9 @@ function rcmail_message_headers($attrib, $headers=NULL)
1006 1015
 
1007 1016
     $output_headers[$hkey] = array(
1008 1017
         'title' => rcube_label(preg_replace('/(^mail-|-)/', '', $hkey)),
1009  
-        'value' => $header_value, 'raw' => $value
  1018
+        'value' => $header_value,
  1019
+        'raw' => $value,
  1020
+        'html' => $ishtml,
1010 1021
     );
1011 1022
   }
1012 1023
 
@@ -1022,7 +1033,7 @@ function rcmail_message_headers($attrib, $headers=NULL)
1022 1033
 
1023 1034
   foreach ($plugin['output'] as $hkey => $row) {
1024 1035
     $table->add(array('class' => 'header-title'), Q($row['title']));
1025  
-    $table->add(array('class' => 'header '.$hkey), Q($row['value'], ($hkey == 'subject' ? 'strict' : 'show')));
  1036
+    $table->add(array('class' => 'header '.$hkey), $row['html'] ? $row['value'] : Q($row['value'], ($hkey == 'subject' ? 'strict' : 'show')));
1026 1037
   }
1027 1038
 
1028 1039
   return $table->show($attrib);
@@ -1444,7 +1455,7 @@ function rcmail_address_string($input, $max=null, $linked=false, $addicon=null,
1444 1455
       }
1445 1456
 
1446 1457
       if ($addicon && $_SESSION['writeable_abook']) {
1447  
-        $address = html::span(null, $address . html::a(array(
  1458
+        $address .= html::a(array(
1448 1459
             'href' => "#add",
1449 1460
             'onclick' => sprintf("return %s.command('add-contact','%s',this)", JS_OBJECT_NAME, $string),
1450 1461
             'title' => rcube_label('addtoaddressbook'),
@@ -1453,15 +1464,18 @@ function rcmail_address_string($input, $max=null, $linked=false, $addicon=null,
1453 1464
           html::img(array(
1454 1465
             'src' => $CONFIG['skin_path'] . $addicon,
1455 1466
             'alt' => "Add contact",
1456  
-          ))));
  1467
+          )));
1457 1468
       }
1458  
-      $out .= $address;
  1469
+      $out .= html::span('adr', $address);
1459 1470
     }
1460 1471
     else {
  1472
+      $address = '';
1461 1473
       if ($name)
1462  
-        $out .= Q($name);
  1474
+        $address .= Q($name);
1463 1475
       if ($mailto)
1464  
-        $out .= (strlen($out) ? ' ' : '') . sprintf('&lt;%s&gt;', Q($mailto));
  1476
+        $address .= (strlen($address) ? ' ' : '') . sprintf('&lt;%s&gt;', Q($mailto));
  1477
+
  1478
+      $out .= html::span('adr', $address);
1465 1479
     }
1466 1480
 
1467 1481
     if ($c>$j)

0 notes on commit 61512fe

Please sign in to comment.
Something went wrong with that request. Please try again.