From: x2003bruneau Date: Thu, 2 Mar 2006 12:23:41 +0000 (+0000) Subject: * Supprime du code inutile X-Git-Tag: 1.8~277 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=e27ae1a3403375ffa4f6cf2b7b70f0fad17d7dbd;p=banana.git * Supprime du code inutile * Ajoute le support de la couleur de fond pour les messages en html git-svn-id: svn+ssh://murphy/home/svn/banana/trunk@17 9869982d-c50d-0410-be91-f2a2ec7c7c7b --- diff --git a/banana/misc.inc.php b/banana/misc.inc.php index 1197c69..04bd09c 100644 --- a/banana/misc.inc.php +++ b/banana/misc.inc.php @@ -65,6 +65,9 @@ function htmlToPlainText($res) { $res = trim(html_entity_decode(strip_tags($res, '
'))); $res = preg_replace("@]>@i", "\n", $res); + if (!is_utf8($res)) { + $res = utf8_encode($res); + } return $res; } @@ -304,9 +307,9 @@ function wrap($text, $_prefix="") function formatbody($_text, $format='plain') { if ($format == 'html') { - $res = '
'.removeEvilTags(html_entity_decode(to_entities($_text))).'
'; + $res = '
'.removeEvilTags($_text).'
'; } else if ($format == 'richtext') { - $res = '
'.richtextToHtml(html_entity_decode(to_entities($_text))).'
'; + $res = '
'.richtextToHtml($_text).'
'; $format = 'html'; } else { $res = "\n\n" . to_entities(wrap($_text, ""))."\n\n"; diff --git a/banana/post.inc.php b/banana/post.inc.php index a1cb4d4..c994908 100644 --- a/banana/post.inc.php +++ b/banana/post.inc.php @@ -318,11 +318,14 @@ class BananaPost preg_match("@text/([^;]+);@", $this->headers['content-type'], $format); $format = $format[1]; - $res .= ''; + $res .= 'body, $format); + if (preg_match('@]*bgcolor="?([#0-9a-f]+)"?[^>]*>@i', $this->body, $bgcolor)) { + $res .= ' bgcolor="'.$bgcolor[1].'"'; + } + $res .= '>'.formatbody($this->body, $format); } else { - $res .= '
'.formatbody($this->body).'
'; + $res .= '>
'.formatbody($this->body).'
'; } $res .= '';