From 73ab762c360a7348f3630d12b18b95ec8345d457 Mon Sep 17 00:00:00 2001 From: x2003bruneau Date: Thu, 2 Mar 2006 20:24:23 +0000 Subject: [PATCH] =?utf8?q?=3D=3Futf-8=3Fq=3F*=3D20Principalement=3D20du=3D?= =?utf8?q?20nettoyage=3D20de=3D20code?= =20*=20Am=C3=83=C2=A9lioration=20des=20filtres=20html?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit git-svn-id: svn+ssh://murphy/home/svn/banana/trunk@23 9869982d-c50d-0410-be91-f2a2ec7c7c7b --- banana/banana.inc.php.in | 43 ++++++++++++++++++++++++------------------- banana/misc.inc.php | 6 +++--- banana/post.inc.php | 2 +- 3 files changed, 28 insertions(+), 23 deletions(-) diff --git a/banana/banana.inc.php.in b/banana/banana.inc.php.in index 80661eb..4bc8826 100644 --- a/banana/banana.inc.php.in +++ b/banana/banana.inc.php.in @@ -25,9 +25,6 @@ class Banana /** Maximum allowed file size for attachment */ var $maxfilesize = 100000; - /** Indicate wether posting html messages is allowed - */ - var $can_html = false; /** Regexp for selecting newsgroups to show (if empty, match all newsgroups) * ex : '^xorg\..*' for xorg.* @@ -42,16 +39,16 @@ class Banana /** Boundary for multipart messages */ - var $boundary = "bananaBoundary42"; - /** Global headers to use for text/plain messages + var $boundary = 'bananaBoundary42'; + /** Global headers to use for messages */ - var $custom = "Content-Type: text/plain; charset=utf-8\nMime-Version: 1.0\nContent-Transfer-Encoding: 8bit\nUser-Agent: Banana @VERSION@\n"; + var $custom = "Mime-Version: 1.0\nUser-Agent: Banana @VERSION@\n"; /** Global headers to use from multipart messages */ - var $custom_mp = "Content-Type: multipart/mixed; boundary=\"bananaBoundary42\"\nContent-Transfer-Encoding: 7bit\nUser-Agent: Banana @VERSION@\n"; - /** Body part headers to use from multipart messages + var $custom_mp = "Content-Type: multipart/mixed; boundary=\"bananaBoundary42\"\nContent-Transfer-Encoding: 7bit\n"; + /** Body type when using plain text */ - var $custom_bd = "Content-Type: text/plain; charset=utf-8\nContent-Transfert-Encoding: 8bit"; + var $custom_plain= "Content-Type: text/plain; charset=utf-8\nContent-Transfert-Encoding: 8bit\n"; /** News serveur to use */ @@ -304,7 +301,7 @@ class Banana $html .= ''._b_('Organisation').''.$this->profile['org'].''; $html .= ''._b_('Corps').''; $html .= ''; + . to_entities($body).($this->profile['sig'] ? "\n\n-- \n".htmlentities($this->profile['sig']) : '').''; $html .= ''._b_('Pièces jointes').''; $html .= ''; $html .= ''; @@ -344,20 +341,20 @@ class Banana $msg .= "References: $refs{$post->headers['message-id']}\n"; } - $body = wrap($body, "", $this->wrap); + $body_headers = $this->custom_plain; + $body = wrap($body, "", $this->wrap); // include attachment in the body $uploaded = $this->_upload('newpj'); switch ($uploaded['error']) { case UPLOAD_ERR_OK: - $this->custom = $this->custom_mp; - $body = "\n--".$this->boundary."\n".$this->custom_bd."\n\n".$body."\n--".$this->boundary."\n"; - - $body .= 'Content-Type: '.$uploaded['type'].'; name="'.$uploaded['name']."\"\n"; - $body .= 'Content-Transfer-Encoding: '.$uploaded['encoding']."\n\n"; - $body .= 'Content-Disposition: attachment; filename="'.$uploaded['name']."\"\n"; - $body .= $uploaded['data']; - $body .= '--'.$this->boundary.'--'; + $this->custom = $this->custom_mp.$this->custom; + $body = $this->_make_part($body_headers, $body); + $file_head = 'Content-Type: '.$uploaded['type'].'; name="'.$uploaded['name']."\"\n" + . 'Content-Transfer-Encoding: '.$uploaded['encoding']."\n" + . 'Content-Disposition: attachment; filename="'.$uploaded['name']."\"\n"; + $body .= $this->_make_part($file_head, $uploaded['data']); + $body .= "\n--".$this->boundary.'--'; break; case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE: @@ -375,6 +372,9 @@ class Banana case UPLOAD_ERR_NO_TMP_DIR: return '

'._b_('Une erreur est survenue sur le serveur lors de l\'upload de ') .$uploaded['name'].'

'.$this->action_showThread($group, $artid); + + default: + $this->custom = $body_headers.$this->custom; } // finalise and post the message @@ -454,6 +454,11 @@ class Banana return $file; } + + function _make_part($headers, $body) + { + return "\n--".$this->boundary."\n".$headers."\n".$body; + } } ?> diff --git a/banana/misc.inc.php b/banana/misc.inc.php index 9b568d8..7520adf 100644 --- a/banana/misc.inc.php +++ b/banana/misc.inc.php @@ -42,7 +42,7 @@ function textFormat_translate($format) */ function removeEvilTags($source) { - $allowedTags = '