From 1f75b1350fd60457b8308230e910d6841766de1d Mon Sep 17 00:00:00 2001 From: x2003bruneau Date: Mon, 27 Feb 2006 19:00:03 +0000 Subject: [PATCH] =?utf8?q?Gestion=20du=20multipart=20suite=20:=20*=20gesti?= =?utf8?q?on=20des=20messages=20en=20html=20*=20gestion=20des=20messages?= =?utf8?q?=20poss=C3=83=C2=A9dant=20plusieurs=20formats=20=3D=3D>=20affich?= =?utf8?q?age=20du=20premier=20par=20d=C3=83=C2=A9faut=20(donc=20text/plai?= =?utf8?q?n=20si=20le=20posteur=20est=20RFC-compliant),=20mais=20laisse=20?= =?utf8?q?le=20choix=20=C3=83=C2=A0=20l'utilisateur=20entre=20les=20diff?= =?utf8?q?=C3=83=C2=A9rents=20formats=20disponibles.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit !!! Toujours pas de distinction entre les différents types de multipart !!! git-svn-id: svn+ssh://murphy/home/svn/banana/trunk@4 9869982d-c50d-0410-be91-f2a2ec7c7c7b --- banana/banana.inc.php.in | 9 +++-- banana/misc.inc.php | 54 +++++++++++++++++++++++-- banana/post.inc.php | 100 +++++++++++++++++++++++++++++++++++++---------- 3 files changed, 135 insertions(+), 28 deletions(-) diff --git a/banana/banana.inc.php.in b/banana/banana.inc.php.in index 6d756bf..f777787 100644 --- a/banana/banana.inc.php.in +++ b/banana/banana.inc.php.in @@ -56,6 +56,7 @@ class Banana $group = empty($_GET['group']) ? null : strtolower($_GET['group']); $artid = empty($_GET['artid']) ? null : strtolower($_GET['artid']); + $partid = empty($_GET['part']) ? 0 : $_GET['part']; $banana->state = Array ('group' => $group, 'artid' => $artid); if (is_null($group)) { @@ -88,7 +89,7 @@ class Banana if (isset($_GET['action'])) { switch ($_GET['action']) { case 'cancel': - $res .= $banana->action_showArticle($group, $artid); + $res .= $banana->action_showArticle($group, $artid, $partid); if ($banana->post->checkcancel()) { $form = '

'._b_('Voulez-vous vraiment annuler ce message ?').'

' . "

" @@ -112,7 +113,7 @@ class Banana return $banana->action_getAttachment($group, $artid, $_GET['pj'], $action); } - return $res . $banana->action_showArticle($group, $artid); + return $res . $banana->action_showArticle($group, $artid, $partid); } } @@ -172,7 +173,7 @@ class Banana return $res.$cuts; } - function action_showArticle($group, $id) + function action_showArticle($group, $id, $part) { $this->_newSpool($group, $this->profile['display'], $this->profile['lastnews']); $this->_newPost($id); @@ -186,7 +187,7 @@ class Banana $cuts = displayshortcuts(); $res = '

'._b_('Message').'

'.$cuts; - $res .= $this->post->to_html(); + $res .= $this->post->to_html($part); $this->nntp->quit(); diff --git a/banana/misc.inc.php b/banana/misc.inc.php index 3258ef1..d90ba56 100644 --- a/banana/misc.inc.php +++ b/banana/misc.inc.php @@ -20,6 +20,45 @@ function to_entities($str) { function is_utf8($s) { return iconv('utf-8', 'utf-8', $s) == $s; } +function textFormat_translate($format) +{ + switch (strtolower($format)) { + case 'plain': return _b_('Texte brut'); + case 'richtext': return _b_('Texte enrichi'); + case 'html': return _b_('HTML'); + default: return $format; + } +} + +/******************************************************************************** + * HTML STUFF + * Taken from php.net + */ + + /** + * @return string + * @param string + * @desc Strip forbidden tags and delegate tag-source check to removeEvilAttributes() + */ +function removeEvilTags($source) +{ + $allowedTags = '