From: x2003bruneau Date: Mon, 27 Feb 2006 19:00:03 +0000 (+0000) Subject: Gestion du multipart suite : X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=1f75b1350fd60457b8308230e910d6841766de1d;p=banana.git Gestion du multipart suite : * gestion des messages en html * gestion des messages possédant plusieurs formats ==> affichage du premier par défaut (donc text/plain si le posteur est RFC-compliant), mais laisse le choix à l'utilisateur entre les différents formats disponibles. !!! 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 --- 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 = '