From 7ea5589cb50c63ce4e11c3ac478ca2a4fc5150dd Mon Sep 17 00:00:00 2001
From: "Committo,Ergo:sum" <esj@rezo.net>
Date: Thu, 26 Oct 2006 07:20:35 +0000
Subject: [PATCH] =?UTF-8?q?Tache=20#605=20sur=20la=20cr=C3=A9ation=20ou=20?=
 =?UTF-8?q?la=20modification=20d'un=20groupe=20de=20mots-cl=C3=A9.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .gitattributes                          |   1 +
 ecrire/action/instituer_groupe_mots.php |  55 ++++
 ecrire/exec/mots_tous.php               | 235 ++++++++---------
 ecrire/exec/mots_type.php               | 332 +++++++++++-------------
 4 files changed, 308 insertions(+), 315 deletions(-)
 create mode 100644 ecrire/action/instituer_groupe_mots.php

diff --git a/.gitattributes b/.gitattributes
index 2175ca0514..873e2d6dbe 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -318,6 +318,7 @@ ecrire/action/instituer_auteur.php -text
 ecrire/action/instituer_breve.php -text
 ecrire/action/instituer_collaboration.php -text
 ecrire/action/instituer_forum.php -text
+ecrire/action/instituer_groupe_mots.php -text
 ecrire/action/instituer_langue_rubrique.php -text
 ecrire/action/instituer_mot.php -text
 ecrire/action/instituer_syndic.php -text
diff --git a/ecrire/action/instituer_groupe_mots.php b/ecrire/action/instituer_groupe_mots.php
new file mode 100644
index 0000000000..74345b9cc0
--- /dev/null
+++ b/ecrire/action/instituer_groupe_mots.php
@@ -0,0 +1,55 @@
+<?php
+
+/***************************************************************************\
+ *  SPIP, Systeme de publication pour l'internet                           *
+ *                                                                         *
+ *  Copyright (c) 2001-2006                                                *
+ *  Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James  *
+ *                                                                         *
+ *  Ce programme est un logiciel libre distribue sous licence GNU/GPL.     *
+ *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
+\***************************************************************************/
+
+if (!defined("_ECRIRE_INC_VERSION")) return;
+
+include_spip('inc/actions');
+include_spip('inc/filtres');
+include_spip('base/abstract_sql');
+
+function action_instituer_groupe_mots_dist()
+{
+	$var_f = charger_fonction('controler_action_auteur', 'inc');
+	$var_f();
+
+	$arg = _request('arg');
+
+	if (!preg_match(",^(-?\d+)$,", $arg, $r)) {
+		 spip_log("action_instituer_groupe_mots_dist $arg pas compris");
+	} else action_instituer_groupe_mots_post($r);
+}
+
+
+function action_instituer_groupe_mots_post($r)
+{
+	global $acces_comite, $acces_forum, $acces_minirezo, $new, $articles, $breves, $change_type, $descriptif, $id_groupe, $obligatoire, $rubriques, $syndic, $texte, $unseul;
+
+	$id_groupe = $r[1];
+
+	if ($id_groupe < 0){
+		spip_query("DELETE FROM spip_groupes_mots WHERE id_groupe=" . (0- $id_groupe));
+	} else {
+		$change_type = (corriger_caracteres($change_type));
+		$texte = (corriger_caracteres($texte));
+		$descriptif = (corriger_caracteres($descriptif));
+
+		if ($id_groupe) {	// modif groupe
+			spip_query("UPDATE spip_mots SET type=" . _q($change_type) . " WHERE id_groupe=$id_groupe");
+
+			spip_query("UPDATE spip_groupes_mots SET titre=" . _q($change_type) . ", texte=" . _q($texte) . ", descriptif=" . _q($descriptif) . ", unseul=" . _q($unseul) . ", obligatoire=" . _q($obligatoire) . ", articles=" . _q($articles) . ", breves=" . _q($breves) . ", rubriques=" . _q($rubriques) . ", syndic=" . _q($syndic) . ",	minirezo=" . _q($acces_minirezo) . ", comite=" . _q($acces_comite) . ", forum=" . _q($acces_forum) . " WHERE id_groupe=$id_groupe");
+
+		} else {	// creation groupe
+		  spip_abstract_insert('spip_groupes_mots', "(titre, texte, descriptif, unseul,  obligatoire, articles, breves, rubriques, syndic, minirezo, comite, forum)", "(" . _q($change_type) . ", " . _q($texte) . " , " . _q($descriptif) . " , " . _q($unseul) . " , " . _q($obligatoire) . " , " . _q($articles) . " ," . _q($breves) . " , " . _q($rubriques) . " , " . _q($syndic) . " , " . _q($acces_minirezo) . " ,  " . _q($acces_comite) . " , " . _q($acces_forum) . " )");
+		}
+	}
+}
+?>
diff --git a/ecrire/exec/mots_tous.php b/ecrire/exec/mots_tous.php
index 6e97af7743..a4bab07c93 100644
--- a/ecrire/exec/mots_tous.php
+++ b/ecrire/exec/mots_tous.php
@@ -13,161 +13,136 @@
 if (!defined("_ECRIRE_INC_VERSION")) return;
 
 include_spip('inc/presentation');
-include_spip('base/abstract_sql');
+include_spip('inc/actions');
 
 // http://doc.spip.org/@exec_mots_tous_dist
 function exec_mots_tous_dist()
 {
-  global $acces_comite, $acces_forum, $acces_minirezo, $new, $articles, $breves, $change_type, $conf_mot, $connect_statut, $connect_toutes_rubriques, $descriptif, $id_groupe, $modifier_groupe, $obligatoire, $rubriques, $spip_lang, $spip_lang_right, $supp_group, $son_groupe, $syndic, $texte, $unseul;
+	global $conf_mot, $spip_lang, $spip_lang_right, $son_groupe;
 
-  $id_groupe = intval($id_groupe);
-  $conf_mot = intval($conf_mot);
+	$conf_mot = intval($conf_mot);
 
-  if (acces_mots()) {
-	if ($modifier_groupe == "oui") {
-		$change_type = (corriger_caracteres($change_type));
-		$texte = (corriger_caracteres($texte));
-		$descriptif = (corriger_caracteres($descriptif));
+	pipeline('exec_init',array('args'=>array('exec'=>'mots_tous'),'data'=>''));
+	debut_page(_T('titre_page_mots_tous'), "naviguer", "mots");
+	debut_gauche();
 
-		if (!$new) {	// modif groupe
-			spip_query("UPDATE spip_mots SET type=" . _q($change_type) . " WHERE id_groupe=$id_groupe");
+	echo pipeline('affiche_gauche',array('args'=>array('exec'=>'mots_tous'),'data'=>''));
+	creer_colonne_droite();
+	echo pipeline('affiche_droite',array('args'=>array('exec'=>'mots_tous'),'data'=>''));
+	debut_droite();
 
-
-			spip_query("UPDATE spip_groupes_mots SET titre=" . _q($change_type) . ", texte=" . _q($texte) . ", descriptif=" . _q($descriptif) . ", unseul=" . _q($unseul) . ", obligatoire=" . _q($obligatoire) . ", articles=" . _q($articles) . ", breves=" . _q($breves) . ", rubriques=" . _q($rubriques) . ", syndic=" . _q($syndic) . ",	minirezo=" . _q($acces_minirezo) . ", comite=" . _q($acces_comite) . ", forum=" . _q($acces_forum) . " WHERE id_groupe=$id_groupe");
-
-		} else {	// creation groupe
-		  spip_abstract_insert('spip_groupes_mots', "(titre, texte, descriptif, unseul,  obligatoire, articles, breves, rubriques, syndic, minirezo, comite, forum)", "(" . _q($change_type) . ", " . _q($texte) . " , " . _q($descriptif) . " , " . _q($unseul) . " , " . _q($obligatoire) . " , " . _q($articles) . " ," . _q($breves) . " , " . _q($rubriques) . " , " . _q($syndic) . " , " . _q($acces_minirezo) . " ,  " . _q($acces_comite) . " , " . _q($acces_forum) . " )");
-		}
+	gros_titre(_T('titre_mots_tous'));
+	if (acces_mots()) {
+	  echo typo(_T('info_creation_mots_cles')) . aide ("mots") ;
 	}
-	if ($supp_group){
-		spip_query("DELETE FROM spip_groupes_mots WHERE id_groupe=" . intval($supp_group));
-	}
- }
-
-
-pipeline('exec_init',array('args'=>array('exec'=>'mots_tous'),'data'=>''));
-debut_page(_T('titre_page_mots_tous'), "naviguer", "mots");
-debut_gauche();
-
-echo pipeline('affiche_gauche',array('args'=>array('exec'=>'mots_tous'),'data'=>''));
-creer_colonne_droite();
-echo pipeline('affiche_droite',array('args'=>array('exec'=>'mots_tous'),'data'=>''));
-debut_droite();
-
-gros_titre(_T('titre_mots_tous'));
- if (acces_mots()) {
-  echo typo(_T('info_creation_mots_cles')) . aide ("mots") ;
-  }
- echo "<br><br>";
-
+	echo "<br /><br />";
 
 //
 // On boucle d'abord sur les groupes de mots
 //
 
- $result_groupes = spip_query("SELECT *, ".creer_objet_multi ("titre", "$spip_lang")." FROM spip_groupes_mots ORDER BY multi");
-
-
-while ($row_groupes = spip_fetch_array($result_groupes)) {
-	$id_groupe = $row_groupes['id_groupe'];
-	$titre_groupe = typo($row_groupes['titre']);
-	$descriptif = $row_groupes['descriptif'];
-	$texte = $row_groupes['texte'];
-	$unseul = $row_groupes['unseul'];
-	$obligatoire = $row_groupes['obligatoire'];
-	$articles = $row_groupes['articles'];
-	$breves = $row_groupes['breves'];
-	$rubriques = $row_groupes['rubriques'];
-	$syndic = $row_groupes['syndic'];
-	$acces_minirezo = $row_groupes['minirezo'];
-	$acces_comite = $row_groupes['comite'];
-	$acces_forum = $row_groupes['forum'];
-
-	// Afficher le titre du groupe
-	debut_cadre_enfonce("groupe-mot-24.gif", false, '', $titre_groupe);
-	// Affichage des options du groupe (types d'elements, permissions...)
-	echo "<font face='Verdana,Arial,Sans,sans-serif' size=1>";
-	if ($articles == "oui") echo "> "._T('info_articles_2')." &nbsp;&nbsp;";
-	if ($breves == "oui") echo "> "._T('info_breves_02')." &nbsp;&nbsp;";
-	if ($rubriques == "oui") echo "> "._T('info_rubriques')." &nbsp;&nbsp;";
-	if ($syndic == "oui") echo "> "._T('icone_sites_references')." &nbsp;&nbsp;";
-
-	if ($unseul == "oui" OR $obligatoire == "oui") echo "<br>";
-	if ($unseul == "oui") echo "> "._T('info_un_mot')." &nbsp;&nbsp;";
-	if ($obligatoire == "oui") echo "> "._T('info_groupe_important')." &nbsp;&nbsp;";
-
-	echo "<br />";
-	if ($acces_minirezo == "oui") echo "> "._T('info_administrateurs')." &nbsp;&nbsp;";
-	if ($acces_comite == "oui") echo "> "._T('info_redacteurs')." &nbsp;&nbsp;";
-	if ($acces_forum == "oui") echo "> "._T('info_visiteurs_02')." &nbsp;&nbsp;";
-
-	echo "</font>";
-	if ($descriptif) {
-		echo "<div style='border: 1px dashed #aaaaaa;'>";
-		echo "<font size='2' face='Verdana,Arial,Sans,sans-serif'>";
-		echo "<b>",_T('info_descriptif'),"</b> ";
-		echo propre($descriptif);
-		echo "&nbsp; ";
+	$result_groupes = spip_query($q="SELECT *, ".creer_objet_multi ("titre", "$spip_lang")." FROM spip_groupes_mots ORDER BY multi");
+
+	while ($row_groupes = spip_fetch_array($result_groupes)) {
+		$id_groupe = $row_groupes['id_groupe'];
+		$titre_groupe = typo($row_groupes['titre']);
+		$descriptif = $row_groupes['descriptif'];
+		$texte = $row_groupes['texte'];
+		$unseul = $row_groupes['unseul'];
+		$obligatoire = $row_groupes['obligatoire'];
+		$articles = $row_groupes['articles'];
+		$breves = $row_groupes['breves'];
+		$rubriques = $row_groupes['rubriques'];
+		$syndic = $row_groupes['syndic'];
+		$acces_minirezo = $row_groupes['minirezo'];
+		$acces_comite = $row_groupes['comite'];
+		$acces_forum = $row_groupes['forum'];
+
+		// Afficher le titre du groupe
+		debut_cadre_enfonce("groupe-mot-24.gif", false, '', $titre_groupe);
+		// Affichage des options du groupe (types d'elements, permissions...)
+		echo "<font face='Verdana,Arial,Sans,sans-serif' size=1>";
+		if ($articles == "oui") echo "> "._T('info_articles_2')." &nbsp;&nbsp;";
+		if ($breves == "oui") echo "> "._T('info_breves_02')." &nbsp;&nbsp;";
+		if ($rubriques == "oui") echo "> "._T('info_rubriques')." &nbsp;&nbsp;";
+		if ($syndic == "oui") echo "> "._T('icone_sites_references')." &nbsp;&nbsp;";
+
+		if ($unseul == "oui" OR $obligatoire == "oui") echo "<br>";
+		if ($unseul == "oui") echo "> "._T('info_un_mot')." &nbsp;&nbsp;";
+		if ($obligatoire == "oui") echo "> "._T('info_groupe_important')." &nbsp;&nbsp;";
+
+		echo "<br />";
+		if ($acces_minirezo == "oui") echo "> "._T('info_administrateurs')." &nbsp;&nbsp;";
+		if ($acces_comite == "oui") echo "> "._T('info_redacteurs')." &nbsp;&nbsp;";
+		if ($acces_forum == "oui") echo "> "._T('info_visiteurs_02')." &nbsp;&nbsp;";
+
 		echo "</font>";
-		echo "</div>";
-	}
+		if ($descriptif) {
+			echo "<div style='border: 1px dashed #aaaaaa;'>";
+			echo "<font size='2' face='Verdana,Arial,Sans,sans-serif'>";
+			echo "<b>",_T('info_descriptif'),"</b> ";
+			echo propre($descriptif);
+			echo "&nbsp; ";
+			echo "</font>";
+			echo "</div>";
+		}
 
-	if (strlen($texte)>0){
-		echo "<FONT FACE='Verdana,Arial,Sans,sans-serif'>";
-		echo propre($texte);
-		echo "</FONT>";
-	}
+		if (strlen($texte)>0){
+			echo "<font face='Verdana,Arial,Sans,sans-serif'>";
+			echo propre($texte);
+			echo "</font>";
+		}
 
-	//
-	// Afficher les mots-cles du groupe
-	//
+		//
+		// Afficher les mots-cles du groupe
+		//
 
-	$groupe = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_mots WHERE id_groupe=$id_groupe"));
-	$groupe = $groupe['n'];
+		$groupe = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_mots WHERE id_groupe=$id_groupe"));
+		$groupe = $groupe['n'];
 
-	echo "<div\nid='editer_mot-$id_groupe' style='position: relative;'>";
+		echo "<div\nid='editer_mot-$id_groupe' style='position: relative;'>";
 
-	// Preliminaire: confirmation de suppression d'un mot lie à qqch
-	// (cf fin de afficher_groupe_mots_boucle executee a l'appel precedent)
-	if ($conf_mot  AND $son_groupe==$id_groupe) {
-		include_spip('inc/grouper_mots');
-		echo confirmer_mot($conf_mot, $id_groupe, $groupe);
-	}
-	if ($groupe) {
-	  	$f = charger_fonction('grouper_mots', 'inc');
-		echo $f($id_groupe, $groupe);
-	}
+		// Preliminaire: confirmation de suppression d'un mot lie à qqch
+		// (cf fin de afficher_groupe_mots_boucle executee a l'appel precedent)
+		if ($conf_mot  AND $son_groupe==$id_groupe) {
+			include_spip('inc/grouper_mots');
+			echo confirmer_mot($conf_mot, $id_groupe, $groupe);
+		}
+		if ($groupe) {
+		  	$f = charger_fonction('grouper_mots', 'inc');
+			echo $f($id_groupe, $groupe);
+		}
 
-	echo "</div>";
-
-	if (acces_mots()){
-		echo "\n<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
-		echo "<tr>";
-		echo "<td>";
-		icone(_T('icone_modif_groupe_mots'), generer_url_ecrire("mots_type","id_groupe=$id_groupe"), "groupe-mot-24.gif", "edit.gif");
-		echo "</td>";
-		echo "\n<td id=editer_mot-$id_groupe-supprimer",
-		  (!$groupe ? '' : " style='visibility: hidden'"),
-		  ">";
-		icone(_T('icone_supprimer_groupe_mots'), generer_url_ecrire("mots_tous","supp_group=$id_groupe"), "groupe-mot-24.gif", "supprimer.gif");
-		echo "</td>";
-		echo "<td>";
-		echo "<div align='$spip_lang_right'>";
-		icone(_T('icone_creation_mots_cles'), generer_url_ecrire("mots_edit","new=oui&id_groupe=$id_groupe&redirect=" . generer_url_retour('mots_tous')), "mot-cle-24.gif", "creer.gif");
 		echo "</div>";
-		echo "</td></tr></table>";
-	}	
 
-	fin_cadre_enfonce();
-}
+		if (acces_mots()){
+			echo "\n<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
+			echo "<tr>";
+			echo "<td>";
+			icone(_T('icone_modif_groupe_mots'), generer_url_ecrire("mots_type","id_groupe=$id_groupe"), "groupe-mot-24.gif", "edit.gif");
+			echo "</td>";
+			echo "\n<td id='editer_mot-$id_groupe-supprimer'",
+			  (!$groupe ? '' : " style='visibility: hidden'"),
+			  ">";
+			icone(_T('icone_supprimer_groupe_mots'), redirige_action_auteur('instituer_groupe_mots', "-$id_groupe", "mots_tous"), "groupe-mot-24.gif", "supprimer.gif");
+			echo "</td>";
+			echo "<td>";
+			echo "<div align='$spip_lang_right'>";
+			icone(_T('icone_creation_mots_cles'), generer_url_ecrire("mots_edit","new=oui&id_groupe=$id_groupe&redirect=" . generer_url_retour('mots_tous')), "mot-cle-24.gif", "creer.gif");
+			echo "</div>";
+			echo "</td></tr></table>";
+		}	
+
+		fin_cadre_enfonce();
+	}
 
- if (acces_mots()  AND !$conf_mot){
-	echo "<p>&nbsp;</p><div align='right'>";
-	icone(_T('icone_creation_groupe_mots'), generer_url_ecrire("mots_type","new=oui"), "groupe-mot-24.gif", "creer.gif");
-	echo "</div>";
-}
+	if (acces_mots()  AND !$conf_mot){
+		echo "<p>&nbsp;</p><div align='right'>";
+		icone(_T('icone_creation_groupe_mots'), generer_url_ecrire("mots_type","new=oui"), "groupe-mot-24.gif", "creer.gif");
+		echo "</div>";
+	}
 
-echo fin_page();
+	echo fin_page();
 }
 
 // http://doc.spip.org/@confirmer_mot
diff --git a/ecrire/exec/mots_type.php b/ecrire/exec/mots_type.php
index 593b4fdafe..370ef608e4 100644
--- a/ecrire/exec/mots_type.php
+++ b/ecrire/exec/mots_type.php
@@ -17,213 +17,175 @@ include_spip('inc/presentation');
 // http://doc.spip.org/@exec_mots_type_dist
 function exec_mots_type_dist()
 {
-  global $connect_statut, $descriptif, $id_groupe, $new, $options, $texte, $titre;
-
-  $id_groupe= intval($id_groupe);
-
-if ($connect_statut == '0minirezo' AND $new == "oui") {
-	$id_groupe = '';
-	$type = filtrer_entites(_T('titre_nouveau_groupe'));
-	$onfocus = " onfocus=\"if(!antifocus){this.value='';antifocus=true;}\"";
-	$ancien_type = '';
-	$unseul = 'non';
-	$obligatoire = 'non';
-	$articles = 'oui';
-	$breves = 'oui';
-	$rubriques = 'non';
-	$syndic = 'oui';
-	$acces_minirezo = 'oui';
-	$acces_comite = 'oui';
-	$acces_forum = 'non';
-} else {
-	$result_groupes = spip_query("SELECT * FROM spip_groupes_mots WHERE id_groupe=$id_groupe");
-
-	while($row = spip_fetch_array($result_groupes)) {
-		$id_groupe = $row['id_groupe'];
-		$type = $row['titre'];
-		$titre = typo($type);
-		$descriptif = $row['descriptif'];
-		$texte = $row['texte'];
-		$unseul = $row['unseul'];
-		$obligatoire = $row['obligatoire'];
-		$articles = $row['articles'];
-		$breves = $row['breves'];
-		$rubriques = $row['rubriques'];
-		$syndic = $row['syndic'];
-		$acces_minirezo = $row['minirezo'];
-		$acces_comite = $row['comite'];
-		$acces_forum = $row['forum'];
-		$onfocus ="";
-		$new = '';
+	global $connect_statut, $descriptif, $id_groupe, $new, $options, $texte, $titre;
+
+	if ($new == "oui") {
+	  $id_groupe = 0;
+	  $type = filtrer_entites(_T('titre_nouveau_groupe'));
+	  $onfocus = " onfocus=\"if(!antifocus){this.value='';antifocus=true;}\"";
+	  $ancien_type = '';
+	  $unseul = 'non';
+	  $obligatoire = 'non';
+	  $articles = 'oui';
+	  $breves = 'oui';
+	  $rubriques = 'non';
+	  $syndic = 'oui';
+	  $acces_minirezo = 'oui';
+	  $acces_comite = 'oui';
+	  $acces_forum = 'non';
+	} else {
+		$id_groupe= intval($id_groupe);
+		$result_groupes = spip_query("SELECT * FROM spip_groupes_mots WHERE id_groupe=$id_groupe");
+
+		while($row = spip_fetch_array($result_groupes)) {
+			$id_groupe = $row['id_groupe'];
+			$type = $row['titre'];
+			$titre = typo($type);
+			$descriptif = $row['descriptif'];
+			$texte = $row['texte'];
+			$unseul = $row['unseul'];
+			$obligatoire = $row['obligatoire'];
+			$articles = $row['articles'];
+			$breves = $row['breves'];
+			$rubriques = $row['rubriques'];
+			$syndic = $row['syndic'];
+			$acces_minirezo = $row['minirezo'];
+			$acces_comite = $row['comite'];
+			$acces_forum = $row['forum'];
+			$onfocus ="";
+		}
 	}
-}
-
-pipeline('exec_init',array('args'=>array('exec'=>'mots_types','id_groupe'=>$id_groupe),'data'=>''));
-debut_page("&laquo; $titre &raquo;", "naviguer", "mots");
-
-debut_gauche();
-
 
+	pipeline('exec_init',array('args'=>array('exec'=>'mots_types','id_groupe'=>$id_groupe),'data'=>''));
+	debut_page("&laquo; $titre &raquo;", "naviguer", "mots");
+	debut_gauche();
 
-echo pipeline('affiche_gauche',array('args'=>array('exec'=>'mots_types','id_groupe'=>$id_groupe),'data'=>''));
-creer_colonne_droite();
-echo pipeline('affiche_droite',array('args'=>array('exec'=>'mots_types','id_groupe'=>$id_groupe),'data'=>''));
-debut_droite();
+	echo pipeline('affiche_gauche',array('args'=>array('exec'=>'mots_types','id_groupe'=>$id_groupe),'data'=>''));
+	creer_colonne_droite();
+	echo pipeline('affiche_droite',array('args'=>array('exec'=>'mots_types','id_groupe'=>$id_groupe),'data'=>''));
+	debut_droite();
 
-debut_cadre_relief("groupe-mot-24.gif");
-
-
-
-echo "\n<table cellpadding=0 cellspacing=0 border=0 width='100%'>";
-echo "<tr width='100%'>";
-
-	echo "<td  align='right' valign='top'>";
-	icone(_T('icone_retour'), generer_url_ecrire("mots_tous",""), "mot-cle-24.gif", "rien.gif");
-	echo "</td>";
-	echo "<td>". http_img_pack('rien.gif', " ", "width='5'") . "</td>\n";
-
-echo "<td width='100%' valign='top'>";
-echo "<font face='Verdana,Arial,Sans,sans-serif' size=1><b>"._T('titre_groupe_mots')."</b><br></font>";
-gros_titre($titre);
-echo aide("motsgroupes");
+	if ($connect_statut != "0minirezo") {
+		echo "<h3>"._T('avis_non_acces_page')."</h3>";
+		exit;
+	}
 
-if ($connect_statut =="0minirezo"){
-	$type=entites_html(rawurldecode($type));
-	echo "<p><font face='Verdana,Arial,Sans,sans-serif'>";
-	echo generer_url_post_ecrire("mots_tous", "id_groupe=$id_groupe");
-	echo "<input type='hidden' name='modifier_groupe' value='oui' />\n";
-	echo "<input type='hidden' name='new' value='$new' />\n";
-	debut_cadre_formulaire();
-	echo "<b>"._T('info_changer_nom_groupe')."</b><br />\n";
-	echo "<INPUT TYPE='Text' SIZE=40 CLASS='formo' NAME='change_type' VALUE=\"$type\" $onfocus />\n";
 
+	$type = entites_html(rawurldecode($type));
+
+	$res = debut_cadre_relief("groupe-mot-24.gif", true)
+	. "\n<table cellpadding='0' cellspacing='0' border='0' width='100%'>"
+	. "<tr width='100%'>"
+	. "<td  align='right' valign='top'>"
+	. icone(_T('icone_retour'), generer_url_ecrire("mots_tous",""), "mot-cle-24.gif", "rien.gif",'', false)
+	. "</td>"
+	. "<td>". http_img_pack('rien.gif', " ", "width='5'") . "</td>\n"
+	. "<td width='100%' valign='top'>"
+	. "<font face='Verdana,Arial,Sans,sans-serif' size='1'><b>"
+	. _T('titre_groupe_mots')
+	. "</b></font><br />"
+	  . gros_titre($titre,'',false)
+	. aide("motsgroupes")
+	. "<div style='font-family: Verdana,Arial,Sans,sans-serif;'>"
+	. debut_cadre_formulaire('',true)
+	. "<b>"._T('info_changer_nom_groupe')."</b><br />\n"
+	. "<input type='text' size='40' class='formo' name='change_type' value=\"$type\" $onfocus />\n";
+		
 	if ($options == 'avancees' OR $descriptif) {
-		echo "<B>"._T('texte_descriptif_rapide')."</B><BR>";
-		echo "<TEXTAREA NAME='descriptif' CLASS='forml' ROWS='4' COLS='40' wrap=soft>";
-		echo entites_html($descriptif);
-		echo "</TEXTAREA><P>\n";
-	}
-	else
-		echo "<INPUT TYPE='hidden' NAME='descriptif' VALUE=\"$descriptif\">";
+			$res .= "<br /><b>"._T('texte_descriptif_rapide')
+			. "</b><br />"
+			. "<textarea name='descriptif' class='forml' rows='4' cols='40'>"
+			. entites_html($descriptif)
+			. "</textarea>\n";
+	} else
+			$res .= "<input type='hidden' name='descriptif' value=\"$descriptif\" />";
 
 	if ($options == 'avancees' OR $texte) {
-		echo "<B>"._T('info_texte_explicatif')."</B><BR>";
-		echo "<TEXTAREA NAME='texte' ROWS='8' CLASS='forml' COLS='40' wrap=soft>";
-		echo entites_html($texte);
-		echo "</TEXTAREA><P>\n";
-	}
-	else
-		echo "<INPUT TYPE='hidden' NAME='texte' VALUE=\"$texte\">";
-
-
-	echo "<p><div align='right'><INPUT TYPE='submit' CLASS='fondo' NAME='Valider' VALUE='"._T('bouton_valider')."'></div>";
-	fin_cadre_formulaire();
-}
-
-
-echo "</td></tr></table>";
-
-
-
-fin_cadre_relief();
-
-if ($connect_statut =="0minirezo"){
-	echo "<p>";
-	debut_cadre_formulaire();
-	echo "<div style='padding: 5px; border: 1px dashed #aaaaaa; background-color: #dddddd;'>";
-		echo "<b>"._T('info_mots_cles_association')."</b>";
-		echo "<ul>";
-		
-		if ($articles == "oui") $checked = "checked";
-		else $checked = "";
-		echo "<input type='checkbox' name='articles' value='oui' $checked id='articles'> <label for='articles'>"._T('item_mots_cles_association_articles')."</label><br>";
-		$activer_breves = $GLOBALS['meta']["activer_breves"];
-		if ($activer_breves != "non"){
-			if ($breves == "oui") $checked = "checked";
-			else $checked = "";
-			echo "<input type='checkbox' name='breves' value='oui' $checked id='breves'> <label for='breves'>"._T('item_mots_cles_association_breves')."</label><br>";
-		} else {
-			echo "<input type='hidden' name='breves' value='non'>";
-		}
-		if ($rubriques == "oui") $checked = "checked";
-		else $checked = "";
-		echo "<input type='checkbox' name='rubriques' value='oui' $checked id='rubriques'> <label for='rubriques'>"._T('item_mots_cles_association_rubriques')."</label><br>";
-		if ($syndic == "oui") $checked = "checked";
-		else $checked = "";
-		echo "<input type='checkbox' name='syndic' value='oui' $checked id='syndic'> <label for='syndic'>"._T('item_mots_cles_association_sites')."</label>";
+			$res .= "<br /><b>"._T('info_texte_explicatif')."</b><br />";
+			$res .= "<textarea name='texte' rows='8' class='forml' cols='40'>";
+			$res .= entites_html($texte);
+			$res .= "</textarea>\n";
+	} else
+		  $res .= "<input type='hidden' name='texte' value=\"$texte\" />";
+
+	$res .= "<div align='right'><input type='submit' class='fondo' value='"
+	. _T('bouton_valider')
+	. "' /></div>"
+	. fin_cadre_formulaire(true)
+	. "</div>"
+	. "</td></tr></table>"
+	. fin_cadre_relief(true)
+	. "<br />\n<div style='font-family: Verdana,Arial,Sans,sans-serif;'>"
+	. debut_cadre_formulaire('',true)
+	. "<div style='padding: 5px; border: 1px dashed #aaaaaa; background-color: #dddddd;'>"
+	. "<b>"._T('info_mots_cles_association')."</b>"
+	. "<br />";
 		
-		echo "</ul>";
-	echo "</div>";
+	$checked =  ($articles == "oui") ? "checked='checked'" : ''; 
+	$res .= "<input type='checkbox' name='articles' value='oui' $checked id='articles' /> <label for='articles'>"._T('item_mots_cles_association_articles')."</label><br />";
+	$activer_breves = $GLOBALS['meta']["activer_breves"];
+
+	if ($activer_breves != "non"){
+		$checked =  ($breves == "oui") ? "checked='checked'" : '';
+			
+		$res .= "<input type='checkbox' name='breves' value='oui' $checked id='breves' /> <label for='breves'>"._T('item_mots_cles_association_breves')."</label><br />";
+	} else {
+		$res .= "<input type='hidden' name='breves' value='non' />";
+	}
+	$checked = ($rubriques == "oui") ? "checked='checked'" : '';	
 
+	$res .= "<input type='checkbox' name='rubriques' value='oui' $checked id='rubriques' /> <label for='rubriques'>"._T('item_mots_cles_association_rubriques')."</label><br />";
 
-	$config_precise_groupes = $GLOBALS['meta']["config_precise_groupes"];
-	if ($config_precise_groupes == "oui" OR $unseul == "oui" OR $obligatoire == "oui"){
-		echo "<p><div style='padding: 5px; border: 1px dashed #aaaaaa; background-color: #dddddd;'>";
+	$checked = ($syndic == "oui") ? "checked='checked'" : ''; 
+	$res .= "<input type='checkbox' name='syndic' value='oui' $checked id='syndic' /> <label for='syndic'>"._T('item_mots_cles_association_sites')."</label>"
+	.  "</div>";
 
-		if ($unseul == "oui")
-			$checked = "checked";
-		else
-			$checked = "";
-		echo "<input type='checkbox' name='unseul' value='oui' $checked id='unseul'> <label for='unseul'>"._T('info_selection_un_seul_mot_cle')."</label>";
-		echo "<br>";
+	if ($GLOBALS['meta']["config_precise_groupes"] == "oui" OR $unseul == "oui" OR $obligatoire == "oui"){
+		$res .= "<div style='padding: 5px; border: 1px dashed #aaaaaa; background-color: #dddddd;'>";
 
-		if ($obligatoire == "oui")
-			$checked = "checked";
-		else $checked = "";
-		echo "<input type='checkbox' name='obligatoire' value='oui' $checked id='obligatoire'> <label for='obligatoire'>"._T('avis_conseil_selection_mot_cle')."</label>";
+		$checked =  ($unseul == "oui") ? "checked='checked'" : ''; 
+		$res .= "<input type='checkbox' name='unseul' value='oui' $checked id='unseul' /> <label for='unseul'>"._T('info_selection_un_seul_mot_cle')."</label>";
+		$res .= "<br />";
 
-		echo "</div>";
+		$checked = ($obligatoire == "oui") ? "checked='checked'" : '';
+		$res .= "<input type='checkbox' name='obligatoire' value='oui' $checked id='obligatoire' /> <label for='obligatoire'>"._T('avis_conseil_selection_mot_cle')."</label>";
+		$res .= "</div>";
 	} else {
-		echo "<input type='hidden' name='unseul' value='non'>";
-		echo "<input type='hidden' name='obligatoire' value='non'>";
+		  $res .= "<input type='hidden' name='unseul' value='non' />";
+		  $res .= "<input type='hidden' name='obligatoire' value='non' />";
 	}
 
-
-	
-	echo "<p>";
-	echo "<div style='padding: 5px; border: 1px dashed #aaaaaa; background-color: #dddddd;'>";
-		echo "<b>"._T('info_qui_attribue_mot_cle')."</b>";
-		echo "<ul>";
+	$res .= "<div style='padding: 5px; border: 1px dashed #aaaaaa; background-color: #dddddd;'>"
+	.  "<b>"._T('info_qui_attribue_mot_cle')."</b>"
+	.  "<br />";
 		
-		if ($acces_minirezo == "oui") $checked = "checked";
-		else $checked = "";
-		echo "<input type='checkbox' name='acces_minirezo' value='oui' $checked id='administrateurs'> <label for='administrateurs'>"._T('bouton_checkbox_qui_attribue_mot_cle_administrateurs')."</label><br>";
-		if ($acces_comite == "oui") $checked = "checked";
-		else $checked = "";
-		echo "<input type='checkbox' name='acces_comite' value='oui' $checked id='comite'> <label for='comite'>"._T('bouton_checkbox_qui_attribue_mot_cle_redacteurs')."</label><br>";
+	$checked = ($acces_minirezo == "oui") ? "checked='checked'" : ''; 
+	$res .= "<input type='checkbox' name='acces_minirezo' value='oui' $checked id='administrateurs' /> <label for='administrateurs'>"
+	 . _T('bouton_checkbox_qui_attribue_mot_cle_administrateurs')
+	. "</label><br />";
+
+	$checked =  ($acces_comite == "oui") ? "checked='checked'" : ''; 
+	$res .= "<input type='checkbox' name='acces_comite' value='oui' $checked id='comite' /> <label for='comite'>"._T('bouton_checkbox_qui_attribue_mot_cle_redacteurs')."</label><br />";
 	
-		$mots_cles_forums = $GLOBALS['meta']["mots_cles_forums"];
-		$forums_publics=$GLOBALS['meta']["forums_publics"];
+	$mots_cles_forums = $GLOBALS['meta']["mots_cles_forums"];
+	$forums_publics=$GLOBALS['meta']["forums_publics"];
 		
-		if (($mots_cles_forums == "oui" OR $acces_forum == "oui") AND $forums_publics != "non"){
-			if ($acces_forum == "oui") $checked = "checked";
-			else $checked = "";
-			echo "<input type='checkbox' name='acces_forum' value='oui' $checked id='forum'> <label for='forum'>"._T('bouton_checkbox_qui_attribue_mot_cle_visiteurs')."</label>";
-		} 
-		else {
-			echo "<input type='hidden' name='acces_forum' value='non'>";
-		}
+	if (($mots_cles_forums == "oui" OR $acces_forum == "oui") AND $forums_publics != "non"){
+		$checked = ($acces_forum == "oui") ? "checked='checked'" : ''; 
+		$res .= "<input type='checkbox' name='acces_forum' value='oui' $checked id='forum' /> <label for='forum'>"._T('bouton_checkbox_qui_attribue_mot_cle_visiteurs')."</label>";
+	} 
+	else {
+		$res .= "<input type='hidden' name='acces_forum' value='non' />";
+	}
 			
-		echo "</ul>";
-	echo "</div>";
-	
-	
-	
-
-	echo "<p><div align='right'><INPUT TYPE='submit' CLASS='fondo' NAME='Valider' VALUE='"._T('bouton_valider')."'></div>";
-	echo "</FORM><P>";
-	fin_cadre_formulaire();	
-	echo "</font>";
-
-
-}else{
-
-	echo "<H3>"._T('avis_non_acces_page')."</H3>";
-
-}
-
-
-echo fin_page();
+	$res .= "<br /></div><div align='right'><input type='submit' class='fondo' value='"
+	. _T('bouton_valider')
+	. "' /></div>"
+	.  fin_cadre_formulaire(true)
+	. "</div>";
+
+	echo redirige_action_auteur('instituer_groupe_mots', $id_groupe, "mots_tous", "id_groupe=$id_groupe", $res),
+		fin_page();
 }
 
 ?>
-- 
GitLab