diff --git a/ecrire/config-contenu.php3 b/ecrire/config-contenu.php3
index 7b04919a0a70db95af134025444d5f62f3fc5233..63665cdabaec3502bd0bcda6cfffa01e4b50ecbe 100644
--- a/ecrire/config-contenu.php3
+++ b/ecrire/config-contenu.php3
@@ -68,8 +68,8 @@ if ($changer_config == 'oui') {
 		'activer_syndic',
 		'visiter_sites'
 	);
-	while (list(,$meta) = each($liste_meta))
-		if ($$meta) ecrire_meta($meta, $$meta);
+	while (list(,$i) = each($liste_meta))
+		if ($$i) ecrire_meta($i, $$i);
 	ecrire_metas();	
 
 	if ($purger_skel) {
diff --git a/ecrire/inc_index.php3 b/ecrire/inc_index.php3
index fc70a33c838e63e3b72262b85b02e8e027cbc0b8..f6c055305ae49b49362afc4ff17acf7ce7d057f0 100644
--- a/ecrire/inc_index.php3
+++ b/ecrire/inc_index.php3
@@ -256,4 +256,45 @@ function creer_liste_indexation() {
 	}
 }
 
+// cree la requete pour une recherche en txt integral
+function requete_txt_integral($objet, $hash_recherche) {
+	if ($objet == 'syndic') {
+		$table = "spip_".$objet;
+		$index_table = "spip_index_".$objet;
+	} else {
+		$table = "spip_".$objet."s";
+		$index_table = "spip_index_".$objet."s";
+	}
+	$id_objet = "id_".$objet;
+	return "SELECT objet.*, SUM(idx.points) AS points
+		FROM $table AS objet, $index_table AS idx
+		WHERE objet.$id_objet = idx.$id_objet
+		AND idx.hash IN ($hash_recherche)
+		GROUP BY objet.$id_objet
+		ORDER BY points DESC
+		LIMIT 0,10";
+}
+
+// decode la chaine recherchee et la traduit en hash
+function requete_hash ($rech) {
+	$s = nettoyer_chaine_indexation(urldecode($rech)); 
+	$regs = separateurs_indexation()." "; 
+	$s = split("[$regs]+", $s); 
+	while (list(, $val) = each($s))
+		if (strlen($val) > 3)
+			$dico[] = "dico LIKE \"$val%\""; 
+	if ($dico) {
+		$query2 = "SELECT HEX(hash) AS hx FROM spip_index_dico WHERE ".join(" OR ", $dico);
+		$result2 = spip_query($query2);
+		while ($row2 = mysql_fetch_array($result2)) 
+			$h[] = "0x".$row2["hx"];
+	}
+	if ($h)
+		$hash_recherche = join(",", $h);
+	else
+		$hash_recherche = "0";
+
+	return $hash_recherche;
+}
+
 ?>
\ No newline at end of file
diff --git a/ecrire/recherche.php3 b/ecrire/recherche.php3
index 1aee983a33a4f4a45d873513928f18ca7463e797..5a6199535ca0de0a7ea624b78c452033b45f2e21 100644
--- a/ecrire/recherche.php3
+++ b/ecrire/recherche.php3
@@ -11,9 +11,14 @@ debut_gauche();
 
 debut_droite();
 
+if ($rech) $recherche = '';
+
 echo "<FONT FACE='Verdana,Arial,Helvetica,sans-serif'><B>R&eacute;sultats de la recherche :</B><BR>";
-echo "<FONT SIZE=5 COLOR='$couleur_foncee'><B>".typo($recherche)."</B></FONT><BR>";
-echo "<FONT SIZE=2>(recherche sur les titres des articles et br&egrave;ves, ou sur leur num&eacute;ro)</FONT></FONT><P>";
+echo "<FONT SIZE=5 COLOR='$couleur_foncee'><B>".typo($recherche.$rech)."</B></FONT><BR>";
+if ($recherche)
+	echo "<FONT SIZE=2>(recherche sur les titres des articles et br&egrave;ves, ou sur leur num&eacute;ro)</FONT></FONT><P>";
+else
+	echo "<FONT SIZE=2>(recherche en texte int&eacute;gral)</FONT></FONT><P>";
 
 $query_articles = "SELECT spip_articles.id_article, surtitre, titre, soustitre, descriptif, chapo, date, visites, id_rubrique, statut FROM spip_articles WHERE";
 $query_breves = "SELECT * FROM spip_breves WHERE ";
@@ -23,24 +28,51 @@ if (ereg("^[0-9]+$", $recherche)) {
 	$query_breves .= " (id_breve = $recherche) OR ";
 }
 
-$recherche = split("[[:space:]]+", addslashes($recherche));
-if ($recherche) {
-	$where = " (titre LIKE '%".join("%' AND titre LIKE '%", $recherche)."%') ";
-}
-else {
+$rech2 = split("[[:space:]]+", addslashes($recherche));
+if ($rech2)
+	$where = " (titre LIKE '%".join("%' AND titre LIKE '%", $rech2)."%') ";
+else
 	$where = " 1=2";
-}
 
 $query_articles .= " $where ORDER BY maj DESC";
 $query_breves .= " $where ORDER BY maj DESC LIMIT 0,10";
 
-$nb_articles = afficher_articles("Articles trouv&eacute;s", $query_articles);
-$nb_breves = afficher_breves("Br&egrave;ves trouv&eacute;es", $query_breves);
 
-if (!$nb_articles AND !$nb_breves) {
+if ($rech) // texte integral
+{
+	include_ecrire ('inc_index.php3');
+	$hash_recherche = requete_hash ($rech);
+	$query_articles = requete_txt_integral('article', $hash_recherche);
+	$query_breves = requete_txt_integral('breve', $hash_recherche);
+	$query_rubriques = requete_txt_integral('rubrique', $hash_recherche);
+//	$query_auteurs = requete_txt_integral('auteur', $hash_recherche);
+	$query_sites = requete_txt_integral('syndic', $hash_recherche);
+}
+
+if ($query_articles)
+	$nba = afficher_articles ("Articles trouv&eacute;s", $query_articles);
+if ($query_breves)
+	$nbb = afficher_breves ("Br&egrave;ves trouv&eacute;es", $query_breves);
+if ($query_rubriques)
+	$nbr = afficher_rubriques ("Rubriques trouv&eacute;es", $query_rubriques);
+// if ($query_sites)
+//	$nbt = afficher_auteurs ("Auteurs trouv&eacute;s", $query_auteurs);
+if ($query_sites)
+	$nbs = afficher_sites ("Sites trouv&eacute;s", $query_sites);
+
+if (!$nba AND !$nbb AND !$nbr AND !$nbt AND !$nbs) {
 	echo "<FONT FACE='Verdana,Arial,Helvetica,sans-serif'>Aucun r&eacute;sultat.</FONT><P>";
 }
 
+if (lire_meta('activer_moteur') == 'oui') {
+	debut_cadre_relief();
+	echo "<form action='recherche.php3' method='get'>";
+	echo "<p>Recherche en texte int&eacute;gral :<br>";
+	echo "<input type='text' name='rech' value='$recherche$rech'>";
+	echo "</form>";
+	fin_cadre_relief();
+}
+
 echo "<p>";
 
 fin_page();