X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=banana%2Fmessage.inc.php;h=01686a1e72f1e7e1e77283f82ccb4ded22b1d45c;hb=edff14de60605e402071bd12a924f18063d82562;hp=db4e96860852669366962ab9a9c0db82bf314ac3;hpb=598a1c538cde55ef90fcacd7d09d36e025f64dee;p=banana.git diff --git a/banana/message.inc.php b/banana/message.inc.php index db4e968..01686a1 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 = html_entities($text); + return banana_catchFormats($text); default: return $text; @@ -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()