From a4e157ad8252c6d4ef34543e9f548c3616809a91 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 1 Dec 2009 12:47:16 -0700 Subject: [PATCH] Fix showing reply-to in popup window when it is the same as to address --- imp/lib/Views/ShowMessage.php | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/imp/lib/Views/ShowMessage.php b/imp/lib/Views/ShowMessage.php index c53b12515..d3970290f 100644 --- a/imp/lib/Views/ShowMessage.php +++ b/imp/lib/Views/ShowMessage.php @@ -160,21 +160,10 @@ class IMP_Views_ShowMessage } } - if (empty($result['reply-to']) || - ($result['from'] == $result['reply-to'])) { - unset($result['reply-to']); - } - /* Build the rest of the headers. */ foreach ($headers_list as $head => $str) { if (!$preview && isset($result[$head])) { - /* JS requires camelized name for reply-to. */ - if ($head == 'reply-to') { - $head = 'replyTo'; - $result[$head] = $result['reply-to']; - unset($result['reply-to']); - } - $headers[] = array('id' => Horde_String::ucfirst($head), 'name' => $str, 'value' => ''); + $headers[$head] = array('id' => Horde_String::ucfirst($head), 'name' => $str, 'value' => ''); } elseif ($val = $mime_headers->getValue($head)) { if ($head == 'date') { /* Add local time to date header. */ @@ -185,12 +174,26 @@ class IMP_Views_ShowMessage } elseif (!$preview) { $val = htmlspecialchars($val); } + if (!$preview) { - $headers[] = array('id' => Horde_String::ucfirst($head), 'name' => $str, 'value' => $val); + $headers[$head] = array('id' => Horde_String::ucfirst($head), 'name' => $str, 'value' => $val); } } } + if (empty($result['reply-to']) || + ($result['from'] == $result['reply-to'])) { + unset($result['reply-to'], $headers['reply-to']); + } + + /* JS requires camelized name for reply-to. */ + if (!$preview && isset($headers['reply-to'])) { + $head = 'replyTo'; + $result['replyTo'] = $result['reply-to']; + unset($result['reply-to']); + $headers['reply-to']['id'] = Horde_String::ucfirst($head); + } + /* Grab maillog information. */ if (!empty($GLOBALS['conf']['maillog']['use_maillog']) && ($tmp = IMP_Dimp::getMsgLogInfo($envelope['message-id']))) { @@ -214,7 +217,7 @@ class IMP_Views_ShowMessage $headers[] = array('name' => $user_hdr, 'value' => htmlspecialchars($user_val)); } } - $result['headers'] = $headers; + $result['headers'] = array_values($headers); } /* Process the subject. */ -- 2.11.0