diff options
Diffstat (limited to 'program/include/rcube_imap.php')
-rw-r--r-- | program/include/rcube_imap.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php index cb8299607..91d36c2a3 100644 --- a/program/include/rcube_imap.php +++ b/program/include/rcube_imap.php @@ -2675,8 +2675,12 @@ class rcube_imap foreach ($a as $val) { $j++; - $address = $val['address']; - $name = preg_replace(array('/^[\'"]/', '/[\'"]$/'), '', trim($val['name'])); + $address = trim($val['address']); + $name = trim($val['name']); + + if (preg_match('/^[\'"]/', $name) && preg_match('/[\'"]$/', $name)) + $name = preg_replace(array('/^[\'"]/', '/[\'"]$/'), '', $name); + if ($name && $address && $name != $address) $string = sprintf('%s <%s>', preg_match("/$special_chars/", $name) ? '"'.addcslashes($name, '"').'"' : $name, $address); else if ($address) @@ -2687,7 +2691,7 @@ class rcube_imap $out[$j] = array('name' => $name, 'mailto' => $address, 'string' => $string); - + if ($max && $j==$max) break; } |