From cf157c19e58205dfb763ba367ea89df6bd73e17d Mon Sep 17 00:00:00 2001
From: "Committo,Ergo:sum" <esj@rezo.net>
Date: Tue, 18 Apr 2006 11:31:15 +0000
Subject: [PATCH] =?UTF-8?q?Fin=20de=20mise=20en=20squelette=20des=20formul?=
 =?UTF-8?q?aires=20de=20forum,=20grace=20=C3=A0=20la=20nouvelle=20fonction?=
 =?UTF-8?q?nalit=C3=A9=20#225=20impl=C3=A9ment=C3=A9e=20par=20[6192]?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 dist/choix_mots.html                      |  3 ++-
 ecrire/balise/formulaire_forum.php        | 26 ++++++-----------------
 formulaires/formulaire_forum_previsu.html | 10 +++++++--
 3 files changed, 16 insertions(+), 23 deletions(-)

diff --git a/dist/choix_mots.html b/dist/choix_mots.html
index 77d6bef166..74bf8c5006 100644
--- a/dist/choix_mots.html
+++ b/dist/choix_mots.html
@@ -7,7 +7,7 @@
 			name='ajouter_mot[]'
 		    	value='#ID_MOT'
 		    	id='mot#ID_MOT' 
-			[(#ID_MOT|in_any{#ENV*{ajouter_mot}, ''}|?
+			[(#ID_MOT|in_any{#ENV**{ajouter_mot}, ''}|?
 				{'checked="checked"',''})] />[
 		(#LOGO_MOT|lien)
 		<br />]
@@ -16,3 +16,4 @@
 (#COMPTEUR_BOUCLE|alterner{'',</tr>})]</BOUCLE_M>
 		  </table>
 </B_M>
+<br />
diff --git a/ecrire/balise/formulaire_forum.php b/ecrire/balise/formulaire_forum.php
index 82a8e95de2..39915fcdfa 100644
--- a/ecrire/balise/formulaire_forum.php
+++ b/ecrire/balise/formulaire_forum.php
@@ -149,6 +149,8 @@ $ajouter_mot, $ajouter_groupe, $afficher_texte, $url_param_retour)
 		$email_auteur = _request('email_auteur');
 		$nom_site_forum = _request('nom_site_forum');
 		$url_site = _request('url_site');
+		$ajouter_mot = _request('ajouter_mot');
+		$ajouter_groupe = _request('ajouter_groupe');
 
 		if ($afficher_texte != 'non') 
 			$previsu = inclure_previsu($texte, $titre, $email_auteur, $auteur, $url_site, $nom_site_forum, $ajouter_mot);
@@ -195,32 +197,16 @@ $ajouter_mot, $ajouter_groupe, $afficher_texte, $url_param_retour)
 		'alea' => $alea,
 		'hash' => $hash,
 		'ajouter_groupe' => $ajouter_groupe,
-		'ajouter_mot' => (is_array($ajouter_mot) ? $ajouter_mot : array()),
+		'ajouter_mot' => (is_array($ajouter_mot) ? $ajouter_mot : array($ajouter_mot)),
 
 		));
 }
 
 function inclure_previsu($texte,$titre, $email_auteur, $auteur, $url_site, $nom_site_forum, $ajouter_mot)
 {
-	$mots_forum = $erreur = $bouton = '';
-	if (is_array($ajouter_mot)) {
-		$result_mots = spip_query("SELECT id_mot, titre, type
-			FROM spip_mots
-			WHERE id_mot IN (" #securite XSS
-			. preg_replace('/[^0-9,]/', '', join(',',$ajouter_mot))
-			. ") ORDER BY 0+type,type,0+titre,titre");
-		if (spip_num_rows($result_mots)>0) {
-			$mots_forum = "<p>"._T('forum_avez_selectionne')."</p><ul>";
-			while ($row = spip_fetch_array($result_mots)) {
-				$mots_forum .= "<li style='font-size: 80%;'> "
-				. typo($row['type']) . "&nbsp;: <b>"
-				. typo($row['titre']) ."</b></li>";
-			}
-			$mots_forum .= '</ul>';
-		}
-	}
+	$erreur = $bouton = '';
 
-	if (strlen($texte) < 10 AND !$mots_forum)
+	if (strlen($texte) < 10 AND !$ajouter_mot)
 		$erreur = _T('forum_attention_dix_caracteres');
 	else if (strlen($titre) < 3)
 		$erreur = _T('forum_attention_trois_caracteres');
@@ -240,7 +226,7 @@ function inclure_previsu($texte,$titre, $email_auteur, $auteur, $url_site, $nom_
 			'texte' => safehtml(propre($texte)),
 			'url_site' => safehtml($url_site),
 			'nom_site_forum' => safehtml(typo($nom_site_forum)),
-			'mots_forum' => $mots_forum,
+			'ajouter_mot' => (is_array($ajouter_mot) ? $ajouter_mot : array($ajouter_mot)),
 			'erreur' => $erreur,
 			'bouton' => $bouton
 			)
diff --git a/formulaires/formulaire_forum_previsu.html b/formulaires/formulaire_forum_previsu.html
index 783eff1f64..071d096374 100644
--- a/formulaires/formulaire_forum_previsu.html
+++ b/formulaires/formulaire_forum_previsu.html
@@ -10,7 +10,13 @@
 
 [<p /><a [href="(#ENV{url_site}|attribut_html)"]>(#ENV*{nom_site_forum})</a>]
 
-[(#ENV*{mots_forum})]
+<B_M>
+ <p><:forum_avez_selectionne:></p><ul>
+<BOUCLE_M(MOTS){id_mot IN #ENV**{ajouter_mot}}{par num type}{par type}{par num titre}{par titre}>
+<li style='font-size: 80%;'>#TYPE&nbsp;: <b>#TITRE</b></li>
+</BOUCLE_M>
+</ul>
+</B_M>
 
 [<p align='right' style='color: red;'>(#ENV*{erreur})</p>]
 
@@ -18,4 +24,4 @@
 
 </div>
 
-<br />
\ No newline at end of file
+<br />
-- 
GitLab