From 603b2be39b37fbd81bbeb9d03db45b893f0ce39a Mon Sep 17 00:00:00 2001
From: "Committo,Ergo:sum" <esj@rezo.net>
Date: Tue, 18 Sep 2007 21:01:06 +0000
Subject: [PATCH] =?UTF-8?q?Code=20mort=20autour=20de=20la=20globale=20{{{?=
 =?UTF-8?q?=C2=A0table=5Fdes=5Ftables=20}}}=20plus=20un=20cas=20qui=20aura?=
 =?UTF-8?q?it=20d=C3=BB=20=C3=AAtre=20trait=C3=A9=20par=20[10329].?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 ecrire/inc/prepare_recherche.php | 2 +-
 ecrire/inc/utils.php             | 4 ++--
 ecrire/public/criteres.php       | 9 +++------
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/ecrire/inc/prepare_recherche.php b/ecrire/inc/prepare_recherche.php
index 1746a7789e..2a44141851 100644
--- a/ecrire/inc/prepare_recherche.php
+++ b/ecrire/inc/prepare_recherche.php
@@ -18,7 +18,7 @@ include_spip('inc/rechercher');
 // Preparer les listes id_article IN (...) pour les parties WHERE
 // et points =  des requetes du moteur de recherche
 // http://doc.spip.org/@inc_prepare_recherche_dist
-function inc_prepare_recherche_dist($recherche, $primary = 'id_article', $id_table='articles',$nom_table='spip_articles', $cond=false) {
+function inc_prepare_recherche_dist($recherche, $primary = 'id_article', $id_table='articles',$unused='', $cond=false) {
 	static $cache = array();
 	static $fcache = array();
 
diff --git a/ecrire/inc/utils.php b/ecrire/inc/utils.php
index 43000ce685..8c96685455 100644
--- a/ecrire/inc/utils.php
+++ b/ecrire/inc/utils.php
@@ -589,8 +589,8 @@ function id_table_objet($type) {
 // http://doc.spip.org/@table_jointure
 function table_jointure($x, $y) {
 	include_spip('public/interfaces');
-	if ($table = $GLOBALS['tables_jointures']['spip_' . table_objet($y)][id_table_objet($x)]
-	OR $table = $GLOBALS['tables_jointures']['spip_' . table_objet($x)][id_table_objet($y)])
+	if ($table = $GLOBALS['tables_jointures'][table_objet_sql($y)][id_table_objet($x)]
+	OR $table = $GLOBALS['tables_jointures'][table_objet_sql($x)][id_table_objet($y)])
 		return $table;
 }
 
diff --git a/ecrire/public/criteres.php b/ecrire/public/criteres.php
index 8a0eb9daac..1d95516b7f 100644
--- a/ecrire/public/criteres.php
+++ b/ecrire/public/criteres.php
@@ -137,11 +137,8 @@ function critere_fragment_dist($idb, &$boucles, $crit) {
 // http://www.spip.net/@recherche
 // http://doc.spip.org/@critere_recherche_dist
 function critere_recherche_dist($idb, &$boucles, $crit) {
-	global $table_des_tables;
+
 	$boucle = &$boucles[$idb];
-	$t = $boucle->id_table;
-	if (in_array($t,$table_des_tables))
-		$t = "spip_$t";
 
 	if (isset($crit->param[0]))
 		$quoi = calculer_liste($crit->param[0], array(), $boucles, $boucles[$idb]->id_parent);
@@ -152,7 +149,7 @@ function critere_recherche_dist($idb, &$boucles, $crit) {
 	$boucle->hash = '
 	// RECHERCHE
 	$prepare_recherche = charger_fonction(\'prepare_recherche\', \'inc\');
-	list($rech_select, $rech_where) = $prepare_recherche('.$quoi.', "'.$boucle->primary.'", "'.$boucle->id_table.'", "'.$t.'", "'.$crit->cond.'");
+	list($rech_select, $rech_where) = $prepare_recherche('.$quoi.', "'.$boucle->primary.'", "'.$boucle->id_table.'", "", "'.$crit->cond.'");
 	';
 
 	// Sauf si le critere est conditionnel {recherche ?}
@@ -236,7 +233,7 @@ function critere_meme_parent_dist($idb, &$boucles, $crit) {
 // http://www.spip.net/@branche
 // http://doc.spip.org/@critere_branche_dist
 function critere_branche_dist($idb, &$boucles, $crit) {
-	global $table_des_tables;
+
 	$not = $crit->not;
 	$boucle = &$boucles[$idb];
 
-- 
GitLab