From 23df52d56e4bda1ad7a9f5a7e38b03c7caa01d49 Mon Sep 17 00:00:00 2001
From: "Committo,Ergo:sum" <esj@rezo.net>
Date: Thu, 4 Oct 2007 08:25:12 +0000
Subject: [PATCH] Abstraction manuelle de WHERE

---
 ecrire/exec/memoriser.php | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/ecrire/exec/memoriser.php b/ecrire/exec/memoriser.php
index d3cd32dbe0..282e9e9633 100644
--- a/ecrire/exec/memoriser.php
+++ b/ecrire/exec/memoriser.php
@@ -20,14 +20,13 @@ function exec_memoriser_dist()
 	$hash = _request('hash');
 	lire_fichier(_DIR_SESSIONS.'ajax_fonctions.txt', $ajax_fonctions);
 	$ajax_fonctions = @unserialize($ajax_fonctions);
+
 	if ($res = $ajax_fonctions[$hash]) {
 		list(,$t,$r,$p,$f) = $res;
-
-		$cpt = sql_fetch(spip_query("SELECT COUNT(*) AS n FROM " . $r['FROM'] . ($r['WHERE'] ? (' WHERE ' . $r['WHERE']) : '') . ($r['GROUP BY'] ? (' GROUP BY ' . $r['GROUP BY']) : '')));
-
+		$cpt = sql_countsel($r['FROM'], $r['WHERE'], $r['GROUP BY']);
 		include_spip('inc/presentation');
 		include_spip('inc/afficher_objets');
-		ajax_retour(afficher_articles_trad($t, $r, $f, $p, $hash, $cpt['n'], _request('trad')));
+		ajax_retour(afficher_articles_trad($t, $r, $f, $p, $hash, $cpt, _request('trad')));
 
 	} else
 		spip_log("memoriser $q vide");
-- 
GitLab