X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=banana%2Fmessage.inc.php;h=66786da8e4fda95df2a96e5cdeb0c77b40d17a5d;hb=1c71a12868e08c6050fa4c283665f82a67e50c10;hp=87485bccdd7a73017cbcd5dc184100dee381e5ef;hpb=7972645bb364b21a1b23d8818bb1ca6f45d36d93;p=banana.git diff --git a/banana/message.inc.php b/banana/message.inc.php index 87485bc..66786da 100644 --- a/banana/message.inc.php +++ b/banana/message.inc.php @@ -49,15 +49,15 @@ final class BananaMessage extends BananaMimePart case 'from': return _b_('De'); case 'subject': return _b_('Sujet'); case 'newsgroups': return _b_('Forums'); - case 'followup-to': return _b_('Suivi à'); - case 'to': return _b_('À'); - case 'cc': return _b_('Copie à'); - case 'bcc': return _b_('Copie cachée à'); - case 'reply-to': return _b_('Répondre à'); + case 'followup-to': return _b_('Suivi à'); + case 'to': return _b_('À'); + case 'cc': return _b_('Copie à'); + case 'bcc': return _b_('Copie cachée à'); + case 'reply-to': return _b_('Répondre à'); case 'date': return _b_('Date'); case 'organization': return _b_('Organisation'); case 'in-reply-to': - case 'references': return _b_('Références'); + case 'references': return _b_('Références'); case 'x-face': return _b_('Image'); } return $hdr; @@ -107,12 +107,9 @@ final class BananaMessage extends BananaMimePart return $rsl; case "subject": - $link = null; $text = stripslashes($text); - if (function_exists('hook_getSubject')) { - $link = hook_getSubject($text); - } - return banana_catchFormats($text) . $link; + $text = banana_htmlentities($text); + return banana_catchFormats($text); default: return $text; @@ -177,7 +174,7 @@ final class BananaMessage extends BananaMimePart static public function formatDate($text) { - return utf8_encode(strftime("%A %d %B %Y, %H:%M (fuseau serveur)", strtotime($text))); + return strftime("%A %d %B %Y, %H:%M (fuseau serveur)", strtotime($text)); } public function translateHeaders() @@ -209,7 +206,7 @@ final class BananaMessage extends BananaMimePart if (isset($refs['references'])) { $text = str_replace('><', '> <', $refs['references']); return preg_split('/\s/', strtr($text, Banana::$spool->ids)); - } elseif (isset($refs['in-reply-to'])) { + } elseif (isset($refs['in-reply-to']) && isset(Banana::$spool->ids[$refs['in-reply-to']])) { return array(Banana::$spool->ids[$refs['in-reply-to']]); } else { return array(); @@ -231,11 +228,11 @@ final class BananaMessage extends BananaMimePart exit; } - public function getFormattedBody($type = null) + public function getFormattedBody(&$reqtype = null) { $types = Banana::$msgshow_mimeparts; - if (!is_null($type)) { - array_unshift($types, $type); + if (!is_null($reqtype)) { + array_unshift($types, $reqtype); } foreach ($types as $type) { @list($type, $subtype) = explode('/', $type); @@ -243,25 +240,26 @@ final class BananaMessage extends BananaMimePart if (empty($parts)) { continue; } - foreach ($parts as &$part) { - list($type, $subtype) = $part->getType(); - switch ($subtype) { - case 'html': return banana_formatHtml($part); - case 'enriched': case 'richtext': return banana_formatRichText($part); - default: return banana_formatPlainText($part); - } - } + $reqtype = implode('/', $parts[0]->getType()); + return $parts[0]->toHtml(); } return null; } public function quote() { - $part = $this->toPlainText(); - if (is_null($part)) { - return banana_quoteHtml($this->toHtml()); + foreach (Banana::$msgedit_mimeparts as $type) { + @list($type, $subtype) = explode('/', $type); + $parts = $this->getParts($type, $subtype); + if (empty($parts)) { + continue; + } + if ($parts[0] === $this) { + return parent::quote(); + } + return $parts[0]->quote(); } - return banana_quotePlainText($part); + return null; } public function canCancel() @@ -281,5 +279,5 @@ final class BananaMessage extends BananaMimePart } } -// vim:set et sw=4 sts=4 ts=4: +// vim:set et sw=4 sts=4 ts=4 enc=utf-8: ?>