From 0da285b0c760fe4706f09696746679d70ddbaf34 Mon Sep 17 00:00:00 2001
From: Fil <fil@rezo.net>
Date: Sat, 10 Aug 2002 17:12:21 +0000
Subject: [PATCH] Attention, lourd !
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

On remplace tous les htmlspecialchars() par entites_html(), qui conserve la compatibilité de spip avec unicode. Il y aura peut-être encore qqs petites modifs à venir, mais l'essentiel y est...
---
 ecrire/auteur_infos.php3     | 10 +++++-----
 ecrire/breves_edit.php3      |  4 ++--
 ecrire/config-fonctions.php3 |  4 ++--
 ecrire/configuration.php3    |  6 +++---
 ecrire/forum_envoi.php3      |  4 ++--
 ecrire/inc_documents.php3    | 12 ++++++------
 ecrire/inc_filtres.php3      |  3 ++-
 ecrire/inc_mots.php3         | 11 +++++------
 ecrire/inc_presentation.php3 |  2 +-
 ecrire/inc_texte.php3        |  4 ++--
 ecrire/inc_version.php3      | 10 +++++-----
 ecrire/message_edit.php3     |  4 ++--
 ecrire/mots_edit.php3        |  8 ++++----
 ecrire/mots_type.php3        |  6 +++---
 ecrire/rubriques_edit.php3   |  2 +-
 ecrire/sites_edit.php3       |  6 +++---
 inc-calcul-squel.php3        |  2 +-
 inc-debug.php3               |  8 ++++----
 inc-formulaires.php3         |  8 ++++----
 inc-forum.php3               |  8 ++++----
 20 files changed, 61 insertions(+), 61 deletions(-)

diff --git a/ecrire/auteur_infos.php3 b/ecrire/auteur_infos.php3
index c8eec3a6fb..022be3ec50 100644
--- a/ecrire/auteur_infos.php3
+++ b/ecrire/auteur_infos.php3
@@ -231,7 +231,7 @@ debut_cadre_relief("fiche-perso-24.gif");
 
 echo "<B>Signature</B> [Obligatoire]<BR>";
 echo "(Votre nom ou votre pseudo)<BR>";
-echo "<INPUT TYPE='text' NAME='nom' CLASS='formo' VALUE=\"".htmlspecialchars($auteur['nom'])."\" SIZE='40'><P>";
+echo "<INPUT TYPE='text' NAME='nom' CLASS='formo' VALUE=\"".entites_html($auteur['nom'])."\" SIZE='40'><P>";
 
 echo "<B>Qui &ecirc;tes-vous ?</B><BR>";
 echo "(Courte biographie en quelques mots.)<BR>";
@@ -245,7 +245,7 @@ debut_cadre_relief();
 echo "<B>Votre adresse email</B> <BR>";
 
 if ($connect_statut == "0minirezo") {
-	echo "<INPUT TYPE='text' NAME='email' CLASS='forml' VALUE=\"".htmlspecialchars($auteur['email'])."\" SIZE='40'><P>\n";
+	echo "<INPUT TYPE='text' NAME='email' CLASS='forml' VALUE=\"".entites_html($auteur['email'])."\" SIZE='40'><P>\n";
 } else {
 	echo "<B>".$auteur['email']."</B><P>";
 }
@@ -259,10 +259,10 @@ fin_cadre_relief();
 debut_cadre_relief("site-24.gif");
 
 echo "<B>Le nom de votre site</B><BR>";
-echo "<INPUT TYPE='text' NAME='nom_site_auteur' CLASS='forml' VALUE=\"".htmlspecialchars($auteur['nom_site'])."\" SIZE='40'><P>\n";
+echo "<INPUT TYPE='text' NAME='nom_site_auteur' CLASS='forml' VALUE=\"".entites_html($auteur['nom_site'])."\" SIZE='40'><P>\n";
 
 echo "<B>L'adresse (URL) de votre site</B><BR>";
-echo "<INPUT TYPE='text' NAME='url_site' CLASS='forml' VALUE=\"".htmlspecialchars($auteur['url_site'])."\" SIZE='40'>\n";
+echo "<INPUT TYPE='text' NAME='url_site' CLASS='forml' VALUE=\"".entites_html($auteur['url_site'])."\" SIZE='40'>\n";
 fin_cadre_relief();
 
 
@@ -283,7 +283,7 @@ if (($connect_statut == "0minirezo" AND $connect_toutes_rubriques) OR $connect_i
 
 	echo "<B>Login</B> ";
 	echo "<font color='red'>(plus de 3 caract&egrave;res)</font> :<BR>";
-	echo "<INPUT TYPE='text' NAME='login' CLASS='formo' VALUE=\"".htmlspecialchars($auteur['login'])."\" SIZE='40'><P>\n";
+	echo "<INPUT TYPE='text' NAME='login' CLASS='formo' VALUE=\"".entites_html($auteur['login'])."\" SIZE='40'><P>\n";
 	echo "<B>Nouveau mot de passe</B> ";
 	echo "<font color='red'>(plus de 5 caract&egrave;res)</font> :<BR>";
 	echo "<INPUT TYPE='password' NAME='new_pass' CLASS='formo' VALUE=\"\" SIZE='40'><BR>\n";
diff --git a/ecrire/breves_edit.php3 b/ecrire/breves_edit.php3
index c916046f9d..241331f234 100644
--- a/ecrire/breves_edit.php3
+++ b/ecrire/breves_edit.php3
@@ -115,8 +115,8 @@ if ($connect_statut=="0minirezo" OR $statut=="prop" OR $new == "oui") {
 	echo "<INPUT TYPE='Hidden' NAME='statut_old' VALUE=\"$statut\">";
 	if ($new == "oui") echo "<INPUT TYPE='Hidden' NAME='new' VALUE=\"oui\">";
 
-	$titre = htmlspecialchars($titre);
-	$lien_titre = htmlspecialchars($lien_titre);
+	$titre = entites_html($titre);
+	$lien_titre = entites_html($lien_titre);
 
 	echo "<B>Titre</B> [Obligatoire]<BR>";
 	echo "<INPUT TYPE='text' CLASS='formo' NAME='titre' VALUE=\"$titre\" SIZE='40'><P>";
diff --git a/ecrire/config-fonctions.php3 b/ecrire/config-fonctions.php3
index 0b17431078..b360d5542a 100644
--- a/ecrire/config-fonctions.php3
+++ b/ecrire/config-fonctions.php3
@@ -26,7 +26,7 @@ if ($changer_config == 'oui') {
 			include_ecrire("inc_sites.php3");
 			$page = recuperer_page($test_proxy);
 			if ($page)
-				echo "<pre>".htmlspecialchars($page)."</pre>";
+				echo "<pre>".entites_html($page)."</pre>";
 			else
 				echo propre("{{Erreur !}} Impossible de lire la page <tt><html>$test_proxy</html></tt> &agrave; travers le proxy <tt><html>$http_proxy</html></tt>.") . aide('confhttpproxy');
 			exit;
@@ -451,7 +451,7 @@ fin_cadre_relief();
 //// Utilisation d'un proxy pour aller lire les sites syndiques
 debut_cadre_relief();
 
-	$http_proxy=htmlspecialchars(lire_meta("http_proxy"));
+	$http_proxy=entites_html(lire_meta("http_proxy"));
 
 	echo "<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=3 WIDTH=\"100%\">";
 	echo "<TR><TD BGCOLOR='$couleur_foncee' BACKGROUND='img_pack/rien.gif'><B><FONT FACE='Verdana,Arial,Helvetica,sans-serif' SIZE=3 COLOR='#FFFFFF'>Utiliser un proxy</FONT></B> ".aide ("confhttpproxy")."</TD></TR>";
diff --git a/ecrire/configuration.php3 b/ecrire/configuration.php3
index 8253fd26d9..27388d771b 100644
--- a/ecrire/configuration.php3
+++ b/ecrire/configuration.php3
@@ -83,9 +83,9 @@ echo "<form action='configuration.php3' method='post'>";
 echo "<input type='hidden' name='changer_config' value='oui'>";
 debut_cadre_relief("racine-24.gif");
 
-	$nom_site = htmlspecialchars(lire_meta("nom_site"));
-	$adresse_site = htmlspecialchars(lire_meta("adresse_site"));
-	$email_webmaster = htmlspecialchars(lire_meta("email_webmaster"));
+	$nom_site = entites_html(lire_meta("nom_site"));
+	$adresse_site = entites_html(lire_meta("adresse_site"));
+	$email_webmaster = entites_html(lire_meta("email_webmaster"));
 
 	echo "<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=3 WIDTH=\"100%\">";
 	echo "<TR><TD BGCOLOR='$couleur_foncee' BACKGROUND='img_pack/rien.gif'><B><FONT FACE='Verdana,Arial,Helvetica,sans-serif' SIZE=3 COLOR='#FFFFFF'>Nom de votre site</FONT></B> ".aide ("confnom")."</TD></TR>";
diff --git a/ecrire/forum_envoi.php3 b/ecrire/forum_envoi.php3
index bb3dc891b8..89ef2069ef 100644
--- a/ecrire/forum_envoi.php3
+++ b/ecrire/forum_envoi.php3
@@ -4,7 +4,7 @@ include ("inc.php3");
 
 
 $titre_message = ereg_replace("^([^>])", "> \\1", $titre_message);
-$nom = htmlspecialchars(corriger_caracteres($connect_nom));
+$nom = entites_html(corriger_caracteres($connect_nom));
 $adresse_retour = rawurldecode($adresse_retour);
 
 if ($valider_forum) {
@@ -67,7 +67,7 @@ echo "<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 BACKGROUND='' WIDTH=\"100%\"><
 echo "<TD><TD><IMG SRC='img_pack/rien.gif' WIDTH=10 BORDER=0>";
 echo "</TD><TD WIDTH=\"100%\">";
 echo "<B>Titre :</B><BR>";
-$titre_message = htmlspecialchars($titre_message);
+$titre_message = entites_html($titre_message);
 echo "<INPUT TYPE='text' CLASS='formo' NAME='titre_message' VALUE=\"$titre_message\" SIZE='40'><P>\n";
 echo "</TD></TR></TABLE>";
 
diff --git a/ecrire/inc_documents.php3 b/ecrire/inc_documents.php3
index bb06813b8b..413ce17855 100644
--- a/ecrire/inc_documents.php3
+++ b/ecrire/inc_documents.php3
@@ -426,7 +426,7 @@ function afficher_horizontal_document($id_document, $image_link, $redirect_url =
 		echo $link->getForm('POST');
 
 		echo "<b>Titre du document&nbsp;:</b><br>\n";
-		echo "<input type='text' name='titre_document' class='formo' style='font-size:9px;' value=\"".htmlspecialchars($titre)."\" size='40'><br>";
+		echo "<input type='text' name='titre_document' class='formo' style='font-size:9px;' value=\"".entites_html($titre)."\" size='40'><br>";
 
 		if ($GLOBALS['coll'] > 0){
 			if (ereg("([0-9]{4})-([0-9]{2})-([0-9]{2})", $date, $regs)) {
@@ -448,7 +448,7 @@ function afficher_horizontal_document($id_document, $image_link, $redirect_url =
 		
 		echo "<b>Description&nbsp;:</b><br>\n";
 		echo "<textarea name='descriptif_document' rows='4' class='formo' style='font-size:9px;' cols='*' wrap='soft'>";
-		echo htmlspecialchars($descriptif);
+		echo entites_html($descriptif);
 		echo "</textarea>\n";
 
 		if ($type_inclus == "embed" OR $type_inclus == "image") {
@@ -788,11 +788,11 @@ function afficher_case_document($id_document, $image_link, $redirect_url = "", $
 			echo $link->getForm('POST');
 		
 			echo "<b>Titre du document&nbsp;:</b><br>\n";
-			echo "<input type='text' name='titre_document' class='formo' style='font-size:9px;' value=\"".htmlspecialchars($titre)."\" size='40'><br>";
+			echo "<input type='text' name='titre_document' class='formo' style='font-size:9px;' value=\"".entites_html($titre)."\" size='40'><br>";
 		
 			echo "<b>Description&nbsp;:</b><br>\n";
 			echo "<textarea name='descriptif_document' rows='4' class='formo' style='font-size:9px;' cols='*' wrap='soft'>";
-			echo htmlspecialchars($descriptif);
+			echo entites_html($descriptif);
 			echo "</textarea>\n";
 			
 			if ($type_inclus == "embed" OR $type_inclus == "image") {
@@ -893,11 +893,11 @@ function afficher_case_document($id_document, $image_link, $redirect_url = "", $
 		
 			echo "<p></p><div class='iconeoff'>";	
 			echo "<b>Titre de l'image&nbsp;:</b><br>\n";
-			echo "<input type='text' name='titre_document' class='formo' style='font-size:9px;' value=\"".htmlspecialchars($titre)."\" size='40'><br>";
+			echo "<input type='text' name='titre_document' class='formo' style='font-size:9px;' value=\"".entites_html($titre)."\" size='40'><br>";
 		
 			echo "<b>Description&nbsp;:</b><br>\n";
 			echo "<textarea name='descriptif_document' rows='4' class='formo' cols='*' style='font-size:9px;' wrap='soft'>";
-			echo htmlspecialchars($descriptif);
+			echo entites_html($descriptif);
 			echo "</textarea>\n";
 		
 			echo "<div align='right'>";
diff --git a/ecrire/inc_filtres.php3 b/ecrire/inc_filtres.php3
index f7d204c37f..db2830d2c5 100644
--- a/ecrire/inc_filtres.php3
+++ b/ecrire/inc_filtres.php3
@@ -11,7 +11,8 @@ define("_ECRIRE_INC_FILTRES", "1");
 
 
 // Echappement des entites HTML avec correction des entites "brutes"
-// (generees par les butineurs lorsqu'on rentre des caracteres non-latins)
+// (generees par les butineurs lorsqu'on rentre des caracteres n'appartenant
+// pas au charset de la page [iso-8859-1 par defaut])
 function corriger_entites_html($texte) {
 	return ereg_replace('&amp;(#[0-9]+;)', '&\1', $texte);
 }
diff --git a/ecrire/inc_mots.php3 b/ecrire/inc_mots.php3
index 8cca6361e9..fea6f9661f 100644
--- a/ecrire/inc_mots.php3
+++ b/ecrire/inc_mots.php3
@@ -251,7 +251,7 @@ function formulaire_mots($table, $id_objet, $nouv_mot, $supp_mot, $cherche_mot,
 			$result_groupe = spip_query($query_groupe);
 			while($row_groupe = mysql_fetch_array($result_groupe)) {
 				$id_groupe = $row_groupe['id_groupe'];
-				$titre_groupe = htmlspecialchars($row_groupe['titre']);
+				$titre_groupe = entites_html($row_groupe['titre']);
 				$unseul = $row_groupe['unseul'];
 				$obligatoire = $row_groupe['obligatoire'];
 				$acces_admin =  $row_groupe['0minirezo'];
@@ -369,7 +369,7 @@ function formulaire_mots($table, $id_objet, $nouv_mot, $supp_mot, $cherche_mot,
 
 		while($row_groupes = mysql_fetch_array($result_groupes)) {
 			$id_groupe = $row_groupes['id_groupe'];
-			$titre_groupe = htmlspecialchars($row_groupes['titre']);
+			$titre_groupe = entites_html($row_groupes['titre']);
 			$unseul = $row_groupes['unseul'];
 			$obligatoire = $row_groupes['obligatoire'];
 			$articles = $row_groupes['articles'];
@@ -402,7 +402,6 @@ function formulaire_mots($table, $id_objet, $nouv_mot, $supp_mot, $cherche_mot,
 
 							echo " <INPUT TYPE='submit' NAME='Chercher' VALUE='Chercher' CLASS='fondo' STYLE='font-size:10px'>";
 							echo "</FORM>";
-							//$case_recherche = true; // on n'en veut pas d'autre
 						}
 					}
 					else {
@@ -418,13 +417,13 @@ function formulaire_mots($table, $id_objet, $nouv_mot, $supp_mot, $cherche_mot,
 						else
 							echo "<SELECT NAME='nouv_mot' SIZE='1' STYLE='width:150px; font-size:10px' CLASS='fondl'>";
 							
-						$ifond == 0;	
-						$label = htmlspecialchars(strtoupper($titre_groupe));
+						$ifond == 0;
+						$label = majuscules($titre_groupe);
 						echo "<OPTION VALUE='x'>$label";
 						while($row = mysql_fetch_array($result)) {
 							$id_mot = $row['id_mot'];
 							$titre_mot = $row['titre'];		
-							$texte_option = htmlspecialchars(couper($titre_mot, 50));
+							$texte_option = entites_html(couper($titre_mot, 50));
 							echo "\n<OPTION VALUE=\"$id_mot\">";
 							echo "&nbsp;&nbsp;&nbsp;";
 							echo $texte_option;
diff --git a/ecrire/inc_presentation.php3 b/ecrire/inc_presentation.php3
index bcfeec0610..e66e1aa751 100644
--- a/ecrire/inc_presentation.php3
+++ b/ecrire/inc_presentation.php3
@@ -890,7 +890,7 @@ function debut_html($titre = "") {
 	global $couleur_foncee, $couleur_claire, $couleur_lien, $couleur_lien_off;
 	global $flag_ecrire;
 
-	$nom_site_spip = htmlspecialchars(lire_meta("nom_site"));
+	$nom_site_spip = entites_html(lire_meta("nom_site"));
 	$titre = textebrut(typo($titre));
 
 	if (!$nom_site_spip) $nom_site_spip="SPIP";
diff --git a/ecrire/inc_texte.php3 b/ecrire/inc_texte.php3
index 02f4311f11..37fe8df6b5 100644
--- a/ecrire/inc_texte.php3
+++ b/ecrire/inc_texte.php3
@@ -141,7 +141,7 @@ function echappe_html($letexte,$source) {
 	$regexp_echap = "<code>(([^<]|<[^/]|</[^c]|</c[^o]|</co[^d]|</cod[^e]|<\/code[^>])*)<\/code>";
 	while (eregi($regexp_echap, $letexte, $regs)) {
 		$num_echap++;
-		$lecode = htmlspecialchars($regs[1]);
+		$lecode = entites_html($regs[1]);
 
 		// ne pas mettre le <div...> s'il n'y a qu'une ligne
 		if (is_int(strpos($lecode,"\n")))
@@ -161,7 +161,7 @@ function echappe_html($letexte,$source) {
 	$regexp_echap = "<cadre>(([^<]|<[^/]|</[^c]|</c[^a]|</ca[^d]|</cad[^r]|</cadr[^e]|<\/cadre[^>])*)<\/cadre>";
 	while (eregi($regexp_echap, $letexte, $regs)) {
 		$num_echap++;
-		$lecode = trim(htmlspecialchars($regs[1]));
+		$lecode = trim(entites_html($regs[1]));
 		$total_lignes = count(explode("\n", $lecode)) + 1;
 
 		$les_echap[$num_echap] = "<form><textarea cols='40' rows='$total_lignes' wrap='no' class='spip_cadre'>".$lecode."</textarea></form>";
diff --git a/ecrire/inc_version.php3 b/ecrire/inc_version.php3
index 2e357f488d..2528a8332c 100644
--- a/ecrire/inc_version.php3
+++ b/ecrire/inc_version.php3
@@ -48,7 +48,7 @@ function spip_query_profile($query) {
 	list($usec2, $sec2) = explode(" ", $m2);
 	$dt = $sec2 + $usec2 - $sec - $usec;
 	$tt += $dt;
-	echo "<small>".htmlspecialchars($query);
+	echo "<small>".entites_html($query);
 	echo " -> <font color='blue'>".sprintf("%3f", $dt)."</font> ($tt)</small><p>\n";
 	return $result;
 }
@@ -62,8 +62,8 @@ function spip_query_debug($query) {
 	$query = ereg_replace('([[:space:],])spip_', '\1'.$GLOBALS['table_prefix'].'_', $query) . $suite;
 	$r = mysql_query($query);
 	if ($GLOBALS['connect_statut'] == '0minirezo' AND $s = mysql_error()) {
-		echo "Erreur dans la requ&ecirc;te : ".htmlspecialchars($query)."<br>";
-		echo "&laquo; ".htmlspecialchars($s)." &raquo;<p>";
+		echo "Erreur dans la requ&ecirc;te : ".entites_html($query)."<br>";
+		echo "&laquo; ".entites_html($s)." &raquo;<p>";
 	}
 	return $r;
 }
@@ -553,7 +553,7 @@ class Link {
 		if (is_array($vars)) {
 			reset($vars);
 			while (list($name, $value) = each($vars)) {
-				$form .= "<input type=\"hidden\" name=\"$name\" value=\"".htmlspecialchars($value)."\">\n";
+				$form .= "<input type=\"hidden\" name=\"$name\" value=\"".entites_html($value)."\">\n";
 			}
 		}
 		if (is_array($this->arrays)) {
@@ -561,7 +561,7 @@ class Link {
 			while (list($name, $table) = each($this->vars)) {
 				reset($table);
 				while (list(, $value) = each($table)) {
-					$form .= "<input type=\"hidden\" name=\"".$name."[]\" value=\"".htmlspecialchars($value)."\">\n";
+					$form .= "<input type=\"hidden\" name=\"".$name."[]\" value=\"".entites_html($value)."\">\n";
 				}
 			}
 		}
diff --git a/ecrire/message_edit.php3 b/ecrire/message_edit.php3
index c7ccfca128..e313766f03 100644
--- a/ecrire/message_edit.php3
+++ b/ecrire/message_edit.php3
@@ -40,8 +40,8 @@ $result = spip_query($query);
 if ($row = mysql_fetch_array($result)) {
 	$id_message = $row['id_message'];
 	$date_heure = $row["date_heure"];
-	$titre = htmlspecialchars($row["titre"]);
-	$texte = htmlspecialchars($row["texte"]);
+	$titre = entites_html($row["titre"]);
+	$texte = entites_html($row["texte"]);
 	$type = $row["type"];
 	$statut = $row["statut"];
 	$page = $row["page"];
diff --git a/ecrire/mots_edit.php3 b/ecrire/mots_edit.php3
index 41d0f66f61..33f3abbf95 100644
--- a/ecrire/mots_edit.php3
+++ b/ecrire/mots_edit.php3
@@ -211,9 +211,9 @@ if ($connect_statut =="0minirezo"){
 	echo "<INPUT TYPE='Hidden' NAME='redirect' VALUE=\"$redirect\">";
 	echo "<INPUT TYPE='Hidden' NAME='redirect_ok' VALUE='oui'>";
 
-	$titre = htmlspecialchars($titre);
-	$descriptif = htmlspecialchars($descriptif);
-	$texte = htmlspecialchars($texte);
+	$titre = entites_html($titre);
+	$descriptif = entites_html($descriptif);
+	$texte = entites_html($texte);
 
 	echo "<B>Nom ou titre du mot-cl&eacute;</B> [Obligatoire]";
 	echo aide ("mots");
@@ -230,7 +230,7 @@ if ($connect_statut =="0minirezo"){
 		echo  " &nbsp; <SELECT NAME='id_groupe' class='fondl'>\n";
 		while ($row_groupes = mysql_fetch_array($result)){
 			$groupe = $row_groupes['id_groupe'];
-			$titre_groupe = htmlspecialchars($row_groupes['titre']);
+			$titre_groupe = entites_html($row_groupes['titre']);
 			echo  "<OPTION".mySel($groupe, $id_groupe).">$titre_groupe</OPTION>\n";
 		}			
 		echo  "</SELECT>";
diff --git a/ecrire/mots_type.php3 b/ecrire/mots_type.php3
index 5deeb6ef61..cf543e04e9 100644
--- a/ecrire/mots_type.php3
+++ b/ecrire/mots_type.php3
@@ -5,7 +5,7 @@ include ("inc.php3");
 
 if ($connect_statut == '0minirezo' AND $new == "oui") {
 	$id_groupe = '';
-	$type = htmlspecialchars("Nouveau groupe");
+	$type = entites_html("Nouveau groupe");
 	$ancien_type = '';
 	$unseul = 'non';
 	$obligatoire = 'non';
@@ -21,7 +21,7 @@ if ($connect_statut == '0minirezo' AND $new == "oui") {
 	$result_groupes = spip_query($query_groupes);
 	while($row = mysql_fetch_array($result_groupes)) {
 		$id_groupe = $row['id_groupe'];
-		$type = htmlspecialchars($row['titre']);
+		$type = entites_html($row['titre']);
 		$ancien_type = $type;
 		$unseul = $row['unseul'];
 		$obligatoire = $row['obligatoire'];
@@ -62,7 +62,7 @@ gros_titre($type);
 echo aide("motsgroupes");
 
 if ($connect_statut =="0minirezo"){
-	$type=htmlspecialchars(urldecode($type));
+	$type=entites_html(urldecode($type));
 	echo "<p><font face='Verdana,Arial,Helvetica,sans-serif'>";
 	echo "<FORM ACTION='mots_tous.php3' METHOD='post'>\n";
 	echo "<INPUT TYPE='Hidden' NAME='modifier_groupe' VALUE=\"oui\">\n";
diff --git a/ecrire/rubriques_edit.php3 b/ecrire/rubriques_edit.php3
index afecfa552b..96a4357448 100644
--- a/ecrire/rubriques_edit.php3
+++ b/ecrire/rubriques_edit.php3
@@ -132,7 +132,7 @@ echo "<FORM ACTION='naviguer.php3' METHOD='post'>";
 echo "<INPUT TYPE='Hidden' NAME='coll' VALUE=\"$id_rubrique\">";
 if ($new == "oui") echo "<INPUT TYPE='Hidden' NAME='new' VALUE=\"oui\">";
 
-$titre = htmlspecialchars($titre);
+$titre = entites_html($titre);
 
 echo "<B>Titre</B> [Obligatoire]<BR>";
 echo "<INPUT TYPE='text' CLASS='formo' NAME='titre' VALUE=\"$titre\" SIZE='40'><P>";
diff --git a/ecrire/sites_edit.php3 b/ecrire/sites_edit.php3
index 15e5658a6a..22d3dcb203 100644
--- a/ecrire/sites_edit.php3
+++ b/ecrire/sites_edit.php3
@@ -168,9 +168,9 @@ $link->addVar('modifier_site', 'oui');
 $link->addVar('syndication_old', $syndication);
 echo $link->getForm('POST');
 
-$nom_site = htmlspecialchars($nom_site);
-$url_site = htmlspecialchars($url_site);
-$url_syndic = htmlspecialchars($url_syndic);
+$nom_site = entites_html($nom_site);
+$url_site = entites_html($url_site);
+$url_syndic = entites_html($url_syndic);
 
 echo "<b>Nom du site</b> [Obligatoire]<br>";
 echo "<input type='text' class='formo' name='nom_site' value=\"$nom_site\" size='40'><p>";
diff --git a/inc-calcul-squel.php3 b/inc-calcul-squel.php3
index 557e72ddc6..a69e4eb17a 100644
--- a/inc-calcul-squel.php3
+++ b/inc-calcul-squel.php3
@@ -62,7 +62,7 @@ function parser_boucle($texte, $id_parent) {
 	if (!ereg("^(<BOUCLE([0-9]+|[-_][-_.a-zA-Z0-9]*)[[:space:]]*(\([^)]*\)([[:space:]]*\{[^}]*\})*)[[:space:]]*>)", $milieu, $match)) {
 		include_local ("ecrire/inc_presentation.php3");
 		install_debut_html("Syntaxe boucle incorrecte");
-		echo '<p>La boucle ' . htmlspecialchars($milieu) . ' est incorrecte.';
+		echo '<p>La boucle ' . entites_html($milieu) . ' est incorrecte.';
 		install_fin_html();
 		exit;
 	}
diff --git a/inc-debug.php3 b/inc-debug.php3
index de0004c521..ba5d346727 100644
--- a/inc-debug.php3
+++ b/inc-debug.php3
@@ -11,7 +11,7 @@ define("_INC_DEBUG", "1");
 
 function affval($val) {
 
-	echo htmlspecialchars($val);
+	echo entites_html($val);
 
 }
 
@@ -24,11 +24,11 @@ function afftable($table) {
 		echo "<LI>";
 		switch ($val->type) {
 		case 'boucle':
-			echo "<font color='red'><b>Boucle".$val->id_boucle."</b>: ".htmlspecialchars($val->commande);
-			echo "<br><i><small>".htmlspecialchars($val->requete)."</small></i></font>";
+			echo "<font color='red'><b>Boucle".$val->id_boucle."</b>: ".entites_html($val->commande);
+			echo "<br><i><small>".entites_html($val->requete)."</small></i></font>";
 			break;
 		case 'texte':
-			echo htmlspecialchars($val->texte);
+			echo entites_html($val->texte);
 			break;
 		case 'champ':
 			echo "<font color='blue'><i>#".$val->nom_champ;
diff --git a/inc-formulaires.php3 b/inc-formulaires.php3
index 380b391a38..082a922397 100644
--- a/inc-formulaires.php3
+++ b/inc-formulaires.php3
@@ -435,7 +435,7 @@ function ecrire_auteur($id_auteur,$email_auteur) {
 			echo "<p><div class='spip_encadrer'>Sujet : <b>$GLOBALS[sujet_message_auteur]</b></div>";
 			if ($flag_wordwrap)
 				$GLOBALS[texte_message_auteur] = wordwrap($GLOBALS[texte_message_auteur]);
-			echo "<pre>".htmlspecialchars($GLOBALS[texte_message_auteur])."</pre>";
+			echo "<pre>".entites_html($GLOBALS[texte_message_auteur])."</pre>";
 			$affiche_formulaire = false;
 			$link = new Link();
 			echo $link->getForm('POST');
@@ -453,10 +453,10 @@ function ecrire_auteur($id_auteur,$email_auteur) {
 		$link = new Link();
 		echo $link->getForm('POST');
 		echo "<div class='spip_encadrer'><P><B>Votre adresse email</B><BR>";
-		echo  "<INPUT TYPE=\"text\" CLASS=\"forml\" NAME=\"email_message_auteur\" VALUE=\"".htmlspecialchars($GLOBALS[email_message_auteur])."\" SIZE=\"30\">\n";
+		echo  "<INPUT TYPE=\"text\" CLASS=\"forml\" NAME=\"email_message_auteur\" VALUE=\"".entites_html($GLOBALS[email_message_auteur])."\" SIZE=\"30\">\n";
 		echo  "<P><B>Sujet</B><BR>";
-		echo  "<INPUT TYPE=\"text\" CLASS=\"forml\" NAME=\"sujet_message_auteur\" VALUE=\"".htmlspecialchars($GLOBALS[sujet_message_auteur])."\" SIZE=\"30\">\n";
-		echo  "<P><TEXTAREA NAME='texte_message_auteur' ROWS='10' CLASS='forml' COLS='40' wrap=soft>".htmlspecialchars($GLOBALS[texte_message_auteur])."</textarea></div>\n";
+		echo  "<INPUT TYPE=\"text\" CLASS=\"forml\" NAME=\"sujet_message_auteur\" VALUE=\"".entites_html($GLOBALS[sujet_message_auteur])."\" SIZE=\"30\">\n";
+		echo  "<P><TEXTAREA NAME='texte_message_auteur' ROWS='10' CLASS='forml' COLS='40' wrap=soft>".entites_html($GLOBALS[texte_message_auteur])."</textarea></div>\n";
 		echo  "<DIV ALIGN=\"right\"><INPUT TYPE=\"submit\" NAME=\"Valider\" CLASS=\"spip_bouton\" VALUE=\"Envoyer un message\">";
 		echo  "</FORM>";
 	}
diff --git a/inc-forum.php3 b/inc-forum.php3
index 8296c9d199..7e426540e0 100644
--- a/inc-forum.php3
+++ b/inc-forum.php3
@@ -238,8 +238,8 @@ function retour_forum($id_rubrique, $id_parent, $id_article, $id_breve, $id_synd
 	$id_syndic = (int) $id_syndic;
 	$hash = calculer_action_auteur("ajout_forum $id_rubrique $id_parent $id_article $id_breve $id_syndic $alea");
 
-	$titre = htmlspecialchars($titre);
-	$texte = htmlspecialchars($texte);
+	$titre = entites_html($titre);
+	$texte = entites_html($texte);
 	
 	if ($afficher_texte == "non"){
 		$ret .= "\n<INPUT TYPE='hidden' NAME='titre' VALUE=\"$titre\">";
@@ -350,7 +350,7 @@ function retour_forum($id_rubrique, $id_parent, $id_article, $id_breve, $id_synd
 		$ret .= "\n<p><div class='spip_encadrer'><B>Lien hypertexte</B> (optionnel)<BR>";
 		$ret .= "\n(Si votre message se r&eacute;f&egrave;re &agrave; un article publi&eacute; sur le Web, ou &agrave; une page fournissant plus d'informations, veuillez indiquer ci-apr&egrave;s le titre de la page et son adresse URL.)<BR>";
 		$ret .= "\nTitre :<BR>";
-		$ret .= "\n<INPUT TYPE='text' CLASS='forml' NAME='nom_site_forum' VALUE=\"".htmlspecialchars($nom_site_forum)."\" SIZE='40'><BR>";
+		$ret .= "\n<INPUT TYPE='text' CLASS='forml' NAME='nom_site_forum' VALUE=\"".entites_html($nom_site_forum)."\" SIZE='40'><BR>";
 
 		if (!$url_site) $url_site = "http://";
 		$ret .= "\nURL :<BR>";
@@ -365,7 +365,7 @@ function retour_forum($id_rubrique, $id_parent, $id_article, $id_breve, $id_synd
 		if (!$email_auteur) $email_auteur = $nom_email;
 
 		$ret .= "\nVotre nom (ou pseudonyme) :<BR>";
-		$ret .= "\n<INPUT TYPE='text' CLASS='forml' NAME='auteur' VALUE=\"".htmlspecialchars($auteur)."\" SIZE='40'><BR>";
+		$ret .= "\n<INPUT TYPE='text' CLASS='forml' NAME='auteur' VALUE=\"".entites_html($auteur)."\" SIZE='40'><BR>";
 
 		$ret .= "\nVotre adresse email :<BR>";
 		$ret .= "\n<INPUT TYPE='text' CLASS='forml' NAME='email_auteur' VALUE=\"$email_auteur\" SIZE='40'></div>";
-- 
GitLab