From 6ee4c8d1b45abffd8363571809a67f64a5dfad74 Mon Sep 17 00:00:00 2001
From: Fil <fil@rezo.net>
Date: Sun, 1 May 2005 18:49:42 +0000
Subject: [PATCH] =?UTF-8?q?meilleure=20analyse=20des=20arguments=20:=20-?=
 =?UTF-8?q?=20{'#ID=5FARTICLE'}=20donne=20la=20chaine=20'#ID=5FARTICLE',?=
 =?UTF-8?q?=20tandis=20que=20{#ID=5FARTICLE}=20donne=20la=20valeur=20compi?=
 =?UTF-8?q?l=C3=A9e=20de=20la=20balise=20#ID=5FARTICLE=20-=20debug=20de=20?=
 =?UTF-8?q?l'erreur=20commit=C3=A9e=20au=20pr=C3=A9c=C3=A9dent=20envoi=20:?=
 =?UTF-8?q?=20{'=20'}=20qui=20donnait=20la=20m=C3=AAme=20chose=20que=20{''?=
 =?UTF-8?q?}=20et=20plantait=20le=20login=20(Paolo,=20Peggy)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 inc-compilo-index.php3 | 49 ++++++++++++++++++++++++++----------------
 1 file changed, 30 insertions(+), 19 deletions(-)

diff --git a/inc-compilo-index.php3 b/inc-compilo-index.php3
index 3b4f1a11d3..151af19d23 100644
--- a/inc-compilo-index.php3
+++ b/inc-compilo-index.php3
@@ -288,31 +288,42 @@ function applique_filtres($p) {
 
 function filtres_arglist($args, $p, $sep) {
 	$arglist ='';
+
 	while (strlen($args = trim($args))) {
-		if ($args[0] =='"')
-			ereg ('^"([^"]*)",?(.*)$', $args, $regs);
-		else if ($args[0] =="'")
-			ereg ("^'([^']*)',?(.*)$", $args, $regs);
+		if ($args[0] == '"')
+			ereg ('^[[:space:]]*(")([^"]*)"[[:space:]]*,?(.*)$', $args, $regs);
+		else if ($args[0] == "'")
+			ereg ("^[[:space:]]*(')([^']*)'[[:space:]]*,?(.*)$", $args, $regs);
 		else
-			ereg('^([^,]*),?(.*)$', $args, $regs);
-
-		$arg = trim($regs[1]);
-		$args = $regs[2];
-
-		if ($arg[0] =='$')
-			$arg = '$Pile[0][\'' . substr($arg,1) . "']";
-		else if ($arg[0] =='<')
-			$arg = calculer_texte($arg, $p->id_boucle, $p->boucles);
-		else if (ereg("^" . NOM_DE_CHAMP ."(.*)$", $arg, $r2)) {
-			$p->nom_boucle = $r2[2];
-			$p->nom_champ = $r2[3];
-			# faudrait verifier !trim(r2[5])
-			$arg = calculer_champ($p);
-		} else if (!is_numeric($arg))
+			ereg('^([[:space:]]*)([^,]*),?(.*)$', $args, $regs);
+
+		// $quote differencie {#ID_ARTICLE} et {'#ID_ARTICLE'}
+		$quote = trim($regs[1]);	// valeur = ", ', ou vide
+		$arg = $regs[2];			// le premier argument
+		$args = $regs[3];			// ceux qui restent
+
+		if ($quote)
 			$arg = "'" . texte_script($arg) . "'";
+		else {
+			$arg = trim($arg);
+			if ($arg[0] =='$')
+				$arg = '$Pile[0][\'' . substr($arg,1) . "']";
+			else if ($arg[0] =='<')
+				$arg = calculer_texte($arg, $p->id_boucle, $p->boucles);
+			else if (ereg("^" . NOM_DE_CHAMP ."(.*)$", $arg, $r2)) {
+				$p->nom_boucle = $r2[2];
+				$p->nom_champ = $r2[3];
+				# faudrait verifier !trim(r2[5])
+				$arg = calculer_champ($p);
+			} else if (is_numeric($arg))
+				$arg = $arg;
+			else
+				$arg = "'" . texte_script($arg) . "'";
+		}
 
 		$arglist .= $sep . $arg;
 	}
+
 	return $arglist;
 }
 
-- 
GitLab