From: Michael M Slusarz Date: Wed, 10 Dec 2008 09:02:40 +0000 (-0700) Subject: Fixes re: subject display X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=9cd2bfdc9a3d6ad28195ced4ee9d7ab6ca3600d2;p=horde.git Fixes re: subject display --- diff --git a/imp/lib/UI/Mailbox.php b/imp/lib/UI/Mailbox.php index 114449bc4..2c46670d4 100644 --- a/imp/lib/UI/Mailbox.php +++ b/imp/lib/UI/Mailbox.php @@ -221,21 +221,28 @@ class IMP_UI_Mailbox /** * Formats the subject header. * - * @param string $subject The MIME encoded subject header. + * @param string $subject The MIME encoded subject header. + * @param string $htmlspaces Run through Text::htmlSpaces()? * * @return string The formatted subject header. */ - public function getSubject($subject) + public function getSubject($subject, $htmlspaces = false) { $subject = Horde_Mime::decode($subject); - $subject = empty($subject) - ? _("[No Subject]") - : IMP::filterText(preg_replace("/\s+/", ' ', $subject)); + if (empty($subject)) { + return _("[No Subject]"); + } + + $new_subject = $subject = IMP::filterText(preg_replace("/\s+/", ' ', $subject)); if ($_SESSION['imp']['view'] == 'dimp') { require_once 'Horde/Text.php'; - $subject = str_replace(' ', ' ', Text::htmlSpaces($subject)); + $new_subject = str_replace(' ', ' ', Text::htmlSpaces($subject)); + } elseif ($htmlspaces) { + require_once 'Horde/Text.php'; + $new_subject = Text::htmlSpaces($subject); } - return $subject; + + return empty($new_subject) ? $subject : $new_subject; } } diff --git a/imp/mailbox.php b/imp/mailbox.php index 024279ffa..1776984d4 100644 --- a/imp/mailbox.php +++ b/imp/mailbox.php @@ -679,7 +679,6 @@ $fromlinkstyle = $prefs->getValue('from_link'); $imp_ui = new IMP_UI_Mailbox($imp_mbox['mailbox']); /* Display message information. */ -require_once 'Horde/Text.php'; $ids = $msgs = array(); $search_template = null; while (list($seq, $ob) = each($mbox_info['overview'])) { @@ -818,7 +817,7 @@ while (list($seq, $ob) = each($mbox_info['overview'])) { } /* Format the Subject: Header. */ - $msg['subject'] = Text::htmlSpaces($imp_ui->getSubject($ob['envelope']['subject'])); + $msg['subject'] = $imp_ui->getSubject($ob['envelope']['subject'], true); if ($preview_tooltip) { $msg['subject'] = substr(Horde::linkTooltip($target, $msg['preview'], '', '', '', $msg['preview']), 0, -1) . ' id="subject' . $msg['id'] . '">' . $msg['subject'] . ''; } else { diff --git a/imp/message.php b/imp/message.php index 668611e73..05fe754e9 100644 --- a/imp/message.php +++ b/imp/message.php @@ -305,7 +305,8 @@ if (($subject = $mime_headers->getValue('subject'))) { /* Filter the subject text, if requested. */ require_once 'Horde/Text.php'; $subject = IMP::filterText($subject); - $display_headers['subject'] = Text::htmlSpaces($subject); + $disp_subject = Text::htmlSpaces($subject); + $display_headers['subject'] = $disp_subject ? $disp_subject : $subject; $title = sprintf(_("%s: %s"), $page_label, $subject); $shortsub = htmlspecialchars($subject);