X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=banana%2Fmessage.inc.php;h=66786da8e4fda95df2a96e5cdeb0c77b40d17a5d;hb=1c71a12868e08c6050fa4c283665f82a67e50c10;hp=db4e96860852669366962ab9a9c0db82bf314ac3;hpb=d8d416c4002a3711e16862c9c0d0fcef60d2a309;p=banana.git diff --git a/banana/message.inc.php b/banana/message.inc.php index db4e968..66786da 100644 --- a/banana/message.inc.php +++ b/banana/message.inc.php @@ -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()