Completed
Push — master ( 7b1735...6daadc )
by cam
01:04
created
ecrire/public/references.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	$select = true
125 125
 ) {
126 126
 	if (!is_string($defaut)) {
127
-		$defaut = '($Pile[0][\'' . strtolower($nom_champ) . '\'] ?? null)';
127
+		$defaut = '($Pile[0][\''.strtolower($nom_champ).'\'] ?? null)';
128 128
 	}
129 129
 
130 130
 	$idb_origine = $idb;
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 			}
158 158
 			// renseigner la boucle source de ce champ pour les traitements
159 159
 			$boucles[$idb_origine]->index_champ[$nom_champ_origine] = $idb;
160
-			$champ = '$Pile[$SP' . ($i ? "-$i" : '') . '][\'' . $c . '\']';
160
+			$champ = '$Pile[$SP'.($i ? "-$i" : '').'][\''.$c.'\']';
161 161
 			if (!$joker) {
162 162
 				return index_compose($conditionnel, $champ);
163 163
 			}
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 function index_compose($conditionnel, $defaut) {
199 199
 	while ($c = array_pop($conditionnel)) {
200 200
 		// si on passe defaut = '', ne pas générer d'erreur de compilation.
201
-		$defaut = "($c:(" . ($defaut ?: "''") . '))';
201
+		$defaut = "($c:(".($defaut ?: "''").'))';
202 202
 	}
203 203
 
204 204
 	return $defaut;
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	if (!$r) {
246 246
 		$joker = false; // indiquer a l'appelant
247 247
 		# continuer pour chercher l'erreur suivante
248
-		return ["'#" . $r . ':' . $nom_champ . "'", ''];
248
+		return ["'#".$r.':'.$nom_champ."'", ''];
249 249
 	}
250 250
 
251 251
 	$desc = $boucles[$idb]->show;
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 	if (preg_match('/^(.*)\.(.*)$/', $nom_champ, $r)) {
288 288
 		[, $_table, $_nom_champ] = $r;
289 289
 		if ($cle = trouver_jointure_champ($_nom_champ, $boucles[$idb], [$_table])) {
290
-			$_alias = $cle . '_' . $_nom_champ;
290
+			$_alias = $cle.'_'.$_nom_champ;
291 291
 			return index_exception(
292 292
 				$boucles[$idb],
293 293
 				$desc,
@@ -367,8 +367,8 @@  discard block
 block discarded – undo
367 367
 			$t = $index_exception_derogatoire($boucle, $desc, $nom_champ, $excep);
368 368
 		}
369 369
 		if ($t == null) {
370
-			[$e, $x] = $excep;  #PHP4 affecte de gauche a droite
371
-			$excep = $x;    #PHP5 de droite a gauche !
370
+			[$e, $x] = $excep; #PHP4 affecte de gauche a droite
371
+			$excep = $x; #PHP5 de droite a gauche !
372 372
 			$j = $trouver_table($e, $boucle->sql_serveur);
373 373
 			if (!$j) {
374 374
 				return ['', ''];
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 					$l = (preg_split('/\s*,\s*/', $k));
381 381
 					$k = $desc['key']['PRIMARY KEY'];
382 382
 					if (!in_array($k, $l)) {
383
-						spip_log("jointure impossible $e " . join(',', $l));
383
+						spip_log("jointure impossible $e ".join(',', $l));
384 384
 
385 385
 						return ['', ''];
386 386
 					}
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 	// demander a SQL de gerer le synonyme
397 397
 	// ca permet que excep soit dynamique (Cedric, 2/3/06)
398 398
 	if ($excep != $nom_champ) {
399
-		$excep .= ' AS ' . $nom_champ;
399
+		$excep .= ' AS '.$nom_champ;
400 400
 	}
401 401
 
402 402
 	return ["$t.$excep", $nom_champ];
@@ -630,7 +630,7 @@  discard block
 block discarded – undo
630 630
 		join(',', $collecte),
631 631
 		($collecte ? $param : substr($param, 1)), # virer la virgule
632 632
 		memoriser_contexte_compil($p),
633
-		(!$supp ? '' : (', ' . join(',', $supp)))
633
+		(!$supp ? '' : (', '.join(',', $supp)))
634 634
 	);
635 635
 
636 636
 	$p->interdire_scripts = false;
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 	$nom = $p->id_boucle;
733 733
 
734 734
 	if ($nom and trouver_nom_serveur_distant($p)) {
735
-		spip_log($nom . ':' . $p->nom_champ . ' ' . _T('zbug_distant_interdit'));
735
+		spip_log($nom.':'.$p->nom_champ.' '._T('zbug_distant_interdit'));
736 736
 
737 737
 		return false;
738 738
 	}
@@ -817,7 +817,7 @@  discard block
 block discarded – undo
817 817
 			(strpos($ps, 'typo') !== false)
818 818
 		)
819 819
 	) {
820
-		$ps = 'traiter_doublons_documents($doublons, ' . $ps . ')';
820
+		$ps = 'traiter_doublons_documents($doublons, '.$ps.')';
821 821
 	}
822 822
 
823 823
 	// La protection des champs par |safehtml est assuree par les extensions
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
 function compose_filtres_args($p, $args, $sep) {
936 936
 	$arglist = '';
937 937
 	foreach ($args as $arg) {
938
-		$arglist .= $sep .
938
+		$arglist .= $sep.
939 939
 			calculer_liste($arg, $p->descr, $p->boucles, $p->id_boucle);
940 940
 	}
941 941
 
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
 	while ($b != '') {
986 986
 		foreach ($p->boucles[$b]->criteres as $critere) {
987 987
 			if ($critere->op == $motif) {
988
-				$p->code = '$Pile[$SP' . (($n == 0) ? '' : "-$n") .
988
+				$p->code = '$Pile[$SP'.(($n == 0) ? '' : "-$n").
989 989
 					"]['$champ']";
990 990
 				$b = '';
991 991
 				break 2;
@@ -1013,6 +1013,6 @@  discard block
 block discarded – undo
1013 1013
  */
1014 1014
 function zbug_presenter_champ($p, $champ = '') {
1015 1015
 	$balise = $champ ?: $p->nom_champ;
1016
-	$explicite = $p->nom_boucle ? $p->nom_boucle . ':' : '';
1016
+	$explicite = $p->nom_boucle ? $p->nom_boucle.':' : '';
1017 1017
 	return "#{$explicite}{$balise}";
1018 1018
 }
Please login to merge, or discard this patch.
Indentation   +561 added lines, -561 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @package SPIP\Core\Compilateur\References
17 17
  **/
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 /**
@@ -41,14 +41,14 @@  discard block
 block discarded – undo
41 41
  *     - '' si une référence explicite incorrecte est envoyée
42 42
  */
43 43
 function index_boucle($p) {
44
-	if (strlen($p->nom_boucle)) {
45
-		// retourne l’index explicite demandé s’il existe
46
-		if (!empty($p->boucles[$p->nom_boucle])) {
47
-			return $p->nom_boucle;
48
-		}
49
-		return '';
50
-	}
51
-	return $p->id_boucle;
44
+    if (strlen($p->nom_boucle)) {
45
+        // retourne l’index explicite demandé s’il existe
46
+        if (!empty($p->boucles[$p->nom_boucle])) {
47
+            return $p->nom_boucle;
48
+        }
49
+        return '';
50
+    }
51
+    return $p->id_boucle;
52 52
 }
53 53
 
54 54
 
@@ -71,17 +71,17 @@  discard block
 block discarded – undo
71 71
  *     - '' si une référence explicite incorrecte est envoyée
72 72
  */
73 73
 function index_boucle_mere($p) {
74
-	if (strlen($p->nom_boucle)) {
75
-		// retourne l’index explicite demandé s’il existe
76
-		if (!empty($p->boucles[$p->nom_boucle])) {
77
-			return $p->nom_boucle;
78
-		}
79
-		return '';
80
-	}
81
-	if (!empty($p->descr['id_mere'])) {
82
-		return $p->descr['id_mere'];
83
-	}
84
-	return '';
74
+    if (strlen($p->nom_boucle)) {
75
+        // retourne l’index explicite demandé s’il existe
76
+        if (!empty($p->boucles[$p->nom_boucle])) {
77
+            return $p->nom_boucle;
78
+        }
79
+        return '';
80
+    }
81
+    if (!empty($p->descr['id_mere'])) {
82
+        return $p->descr['id_mere'];
83
+    }
84
+    return '';
85 85
 }
86 86
 
87 87
 /**
@@ -115,74 +115,74 @@  discard block
 block discarded – undo
115 115
  *     Code PHP pour obtenir le champ SQL
116 116
  */
117 117
 function index_pile(
118
-	$idb,
119
-	$nom_champ,
120
-	&$boucles,
121
-	$explicite = '',
122
-	$defaut = null,
123
-	$remonte_pile = true,
124
-	$select = true
118
+    $idb,
119
+    $nom_champ,
120
+    &$boucles,
121
+    $explicite = '',
122
+    $defaut = null,
123
+    $remonte_pile = true,
124
+    $select = true
125 125
 ) {
126
-	if (!is_string($defaut)) {
127
-		$defaut = '($Pile[0][\'' . strtolower($nom_champ) . '\'] ?? null)';
128
-	}
129
-
130
-	$idb_origine = $idb;
131
-	$nom_champ_origine = $nom_champ;
132
-
133
-	$i = 0;
134
-	if (strlen($explicite)) {
135
-		// Recherche d'un champ dans un etage superieur
136
-		while (($idb !== $explicite) && ($idb !== '')) {
137
-			#	spip_log("Cherchexpl: $nom_champ '$explicite' '$idb' '$i'");
138
-			$i++;
139
-			$idb = $boucles[$idb]->id_parent;
140
-		}
141
-	}
142
-
143
-	#	spip_log("Cherche: $nom_champ a partir de '$idb'");
144
-	$nom_champ = strtolower($nom_champ);
145
-	$conditionnel = [];
146
-	// attention: entre la boucle nommee 0, "" et le tableau vide,
147
-	// il y a incoherences qu'il vaut mieux eviter
148
-	while (isset($boucles[$idb])) {
149
-		$joker = true;
150
-		// modifie $joker si tous les champs sont autorisés.
151
-		// $t = le select pour le champ, si on l'a trouvé (ou si joker)
152
-		// $c = le nom du champ demandé
153
-		[$t, $c] = index_tables_en_pile($idb, $nom_champ, $boucles, $joker);
154
-		if ($t) {
155
-			if ($select and !in_array($t, $boucles[$idb]->select)) {
156
-				$boucles[$idb]->select[] = $t;
157
-			}
158
-			// renseigner la boucle source de ce champ pour les traitements
159
-			$boucles[$idb_origine]->index_champ[$nom_champ_origine] = $idb;
160
-			$champ = '$Pile[$SP' . ($i ? "-$i" : '') . '][\'' . $c . '\']';
161
-			if (!$joker) {
162
-				return index_compose($conditionnel, $champ);
163
-			}
164
-
165
-			// tant que l'on trouve des tables avec joker, on continue
166
-			// avec la boucle parente et on conditionne à l'exécution
167
-			// la présence du champ. Si le champ existe à l'exécution
168
-			// dans une boucle, il est pris, sinon on le cherche dans le parent...
169
-			$conditionnel[] = "isset($champ)?$champ";
170
-		}
171
-
172
-		if ($remonte_pile) {
173
-			#	spip_log("On remonte vers $i");
174
-			// Sinon on remonte d'un cran
175
-			$idb = $boucles[$idb]->id_parent;
176
-			$i++;
177
-		} else {
178
-			$idb = null;
179
-		}
180
-	}
181
-
182
-	#	spip_log("Pas vu $nom_champ");
183
-	// esperons qu'il y sera
184
-	// ou qu'on a fourni une valeur par "defaut" plus pertinent
185
-	return index_compose($conditionnel, $defaut);
126
+    if (!is_string($defaut)) {
127
+        $defaut = '($Pile[0][\'' . strtolower($nom_champ) . '\'] ?? null)';
128
+    }
129
+
130
+    $idb_origine = $idb;
131
+    $nom_champ_origine = $nom_champ;
132
+
133
+    $i = 0;
134
+    if (strlen($explicite)) {
135
+        // Recherche d'un champ dans un etage superieur
136
+        while (($idb !== $explicite) && ($idb !== '')) {
137
+            #	spip_log("Cherchexpl: $nom_champ '$explicite' '$idb' '$i'");
138
+            $i++;
139
+            $idb = $boucles[$idb]->id_parent;
140
+        }
141
+    }
142
+
143
+    #	spip_log("Cherche: $nom_champ a partir de '$idb'");
144
+    $nom_champ = strtolower($nom_champ);
145
+    $conditionnel = [];
146
+    // attention: entre la boucle nommee 0, "" et le tableau vide,
147
+    // il y a incoherences qu'il vaut mieux eviter
148
+    while (isset($boucles[$idb])) {
149
+        $joker = true;
150
+        // modifie $joker si tous les champs sont autorisés.
151
+        // $t = le select pour le champ, si on l'a trouvé (ou si joker)
152
+        // $c = le nom du champ demandé
153
+        [$t, $c] = index_tables_en_pile($idb, $nom_champ, $boucles, $joker);
154
+        if ($t) {
155
+            if ($select and !in_array($t, $boucles[$idb]->select)) {
156
+                $boucles[$idb]->select[] = $t;
157
+            }
158
+            // renseigner la boucle source de ce champ pour les traitements
159
+            $boucles[$idb_origine]->index_champ[$nom_champ_origine] = $idb;
160
+            $champ = '$Pile[$SP' . ($i ? "-$i" : '') . '][\'' . $c . '\']';
161
+            if (!$joker) {
162
+                return index_compose($conditionnel, $champ);
163
+            }
164
+
165
+            // tant que l'on trouve des tables avec joker, on continue
166
+            // avec la boucle parente et on conditionne à l'exécution
167
+            // la présence du champ. Si le champ existe à l'exécution
168
+            // dans une boucle, il est pris, sinon on le cherche dans le parent...
169
+            $conditionnel[] = "isset($champ)?$champ";
170
+        }
171
+
172
+        if ($remonte_pile) {
173
+            #	spip_log("On remonte vers $i");
174
+            // Sinon on remonte d'un cran
175
+            $idb = $boucles[$idb]->id_parent;
176
+            $i++;
177
+        } else {
178
+            $idb = null;
179
+        }
180
+    }
181
+
182
+    #	spip_log("Pas vu $nom_champ");
183
+    // esperons qu'il y sera
184
+    // ou qu'on a fourni une valeur par "defaut" plus pertinent
185
+    return index_compose($conditionnel, $defaut);
186 186
 }
187 187
 
188 188
 /**
@@ -196,12 +196,12 @@  discard block
 block discarded – undo
196 196
  * @return string              Code PHP complet de recherche d'un champ
197 197
  */
198 198
 function index_compose($conditionnel, $defaut) {
199
-	while ($c = array_pop($conditionnel)) {
200
-		// si on passe defaut = '', ne pas générer d'erreur de compilation.
201
-		$defaut = "($c:(" . ($defaut ?: "''") . '))';
202
-	}
199
+    while ($c = array_pop($conditionnel)) {
200
+        // si on passe defaut = '', ne pas générer d'erreur de compilation.
201
+        $defaut = "($c:(" . ($defaut ?: "''") . '))';
202
+    }
203 203
 
204
-	return $defaut;
204
+    return $defaut;
205 205
 }
206 206
 
207 207
 /**
@@ -237,97 +237,97 @@  discard block
 block discarded – undo
237 237
  **/
238 238
 function index_tables_en_pile($idb, $nom_champ, &$boucles, &$joker) {
239 239
 
240
-	$r = $boucles[$idb]->type_requete;
241
-	// boucle recursive, c'est foutu...
242
-	if ($r == TYPE_RECURSIF) {
243
-		return [];
244
-	}
245
-	if (!$r) {
246
-		$joker = false; // indiquer a l'appelant
247
-		# continuer pour chercher l'erreur suivante
248
-		return ["'#" . $r . ':' . $nom_champ . "'", ''];
249
-	}
250
-
251
-	$desc = $boucles[$idb]->show;
252
-	// le nom du champ est il une exception de la table ? un alias ?
253
-	$excep = $GLOBALS['exceptions_des_tables'][$r] ?? '';
254
-	if ($excep) {
255
-		$excep = $excep[$nom_champ] ?? '';
256
-	}
257
-
258
-	// il y a un alias connu pour ce champ
259
-	if ($excep) {
260
-		$joker = false; // indiquer a l'appelant
261
-		return index_exception($boucles[$idb], $desc, $nom_champ, $excep);
262
-	}
263
-
264
-	// le champ existe dans la table, on le prend.
265
-	if (isset($desc['field'][$nom_champ])) {
266
-		$t = $boucles[$idb]->id_table ?? '';
267
-		$joker = false; // indiquer a l'appelant
268
-		// note: dans certains cas ('valeur' d’une boucle DATA, sans id_table), retourne ['.valeur', 'valeur'] …
269
-		return ["$t.$nom_champ", $nom_champ];
270
-	}
271
-
272
-	// Tous les champs sont-ils acceptés ?
273
-	// Si oui, on retourne le champ, et on lève le flag joker
274
-	// C'est le cas des itérateurs DATA qui acceptent tout
275
-	// et testent la présence du champ à l'exécution et non à la compilation
276
-	// car ils ne connaissent pas ici leurs contenus.
277
-	if (
278
-		/*$joker AND */
279
-		isset($desc['field']['*'])
280
-	) {
281
-		$joker = true; // indiquer a l'appelant
282
-		return [$nom_champ, $nom_champ];
283
-	}
284
-
285
-	$joker = false; // indiquer a l'appelant
286
-
287
-	// la table de jointure est explicitement indiquée (rubrique.titre)
288
-	if (preg_match('/^(.*)\.(.*)$/', $nom_champ, $r)) {
289
-		[, $_table, $_nom_champ] = $r;
290
-		if ($cle = trouver_jointure_champ($_nom_champ, $boucles[$idb], [$_table])) {
291
-			$_alias = $cle . '_' . $_nom_champ;
292
-			return index_exception(
293
-				$boucles[$idb],
294
-				$desc,
295
-				$_alias,
296
-				[$_table, $_nom_champ]
297
-			);
298
-		}
299
-		return ['', ''];
300
-	}
301
-
302
-	// pas d'alias, pas de champ, pas de joker...
303
-	// tenter via une jointure...
304
-
305
-	// regarder si le champ est deja dans une jointure existante
306
-	// sinon, si il y a des joitures explicites, la construire
307
-	if (!$t = trouver_champ_exterieur($nom_champ, $boucles[$idb]->from, $boucles[$idb])) {
308
-		if ($boucles[$idb]->jointures_explicites) {
309
-			// [todo] Ne pas lancer que lorsque il y a des jointures explicites !!!!
310
-			// fonctionnel, il suffit d'utiliser $boucles[$idb]->jointures au lieu de jointures_explicites
311
-			// mais est-ce ce qu'on veut ?
312
-			$jointures = preg_split('/\s+/', $boucles[$idb]->jointures_explicites);
313
-			if ($cle = trouver_jointure_champ($nom_champ, $boucles[$idb], $jointures)) {
314
-				$t = trouver_champ_exterieur($nom_champ, $boucles[$idb]->from, $boucles[$idb]);
315
-			}
316
-		}
317
-	}
318
-
319
-	if ($t) {
320
-		// si on a trouvé une jointure possible, on fait comme
321
-		// si c'était une exception pour le champ demandé
322
-		return index_exception(
323
-			$boucles[$idb],
324
-			$desc,
325
-			$nom_champ,
326
-			[$t[1]['id_table'], reset($t[2])]
327
-		);
328
-	}
329
-
330
-	return ['', ''];
240
+    $r = $boucles[$idb]->type_requete;
241
+    // boucle recursive, c'est foutu...
242
+    if ($r == TYPE_RECURSIF) {
243
+        return [];
244
+    }
245
+    if (!$r) {
246
+        $joker = false; // indiquer a l'appelant
247
+        # continuer pour chercher l'erreur suivante
248
+        return ["'#" . $r . ':' . $nom_champ . "'", ''];
249
+    }
250
+
251
+    $desc = $boucles[$idb]->show;
252
+    // le nom du champ est il une exception de la table ? un alias ?
253
+    $excep = $GLOBALS['exceptions_des_tables'][$r] ?? '';
254
+    if ($excep) {
255
+        $excep = $excep[$nom_champ] ?? '';
256
+    }
257
+
258
+    // il y a un alias connu pour ce champ
259
+    if ($excep) {
260
+        $joker = false; // indiquer a l'appelant
261
+        return index_exception($boucles[$idb], $desc, $nom_champ, $excep);
262
+    }
263
+
264
+    // le champ existe dans la table, on le prend.
265
+    if (isset($desc['field'][$nom_champ])) {
266
+        $t = $boucles[$idb]->id_table ?? '';
267
+        $joker = false; // indiquer a l'appelant
268
+        // note: dans certains cas ('valeur' d’une boucle DATA, sans id_table), retourne ['.valeur', 'valeur'] …
269
+        return ["$t.$nom_champ", $nom_champ];
270
+    }
271
+
272
+    // Tous les champs sont-ils acceptés ?
273
+    // Si oui, on retourne le champ, et on lève le flag joker
274
+    // C'est le cas des itérateurs DATA qui acceptent tout
275
+    // et testent la présence du champ à l'exécution et non à la compilation
276
+    // car ils ne connaissent pas ici leurs contenus.
277
+    if (
278
+        /*$joker AND */
279
+        isset($desc['field']['*'])
280
+    ) {
281
+        $joker = true; // indiquer a l'appelant
282
+        return [$nom_champ, $nom_champ];
283
+    }
284
+
285
+    $joker = false; // indiquer a l'appelant
286
+
287
+    // la table de jointure est explicitement indiquée (rubrique.titre)
288
+    if (preg_match('/^(.*)\.(.*)$/', $nom_champ, $r)) {
289
+        [, $_table, $_nom_champ] = $r;
290
+        if ($cle = trouver_jointure_champ($_nom_champ, $boucles[$idb], [$_table])) {
291
+            $_alias = $cle . '_' . $_nom_champ;
292
+            return index_exception(
293
+                $boucles[$idb],
294
+                $desc,
295
+                $_alias,
296
+                [$_table, $_nom_champ]
297
+            );
298
+        }
299
+        return ['', ''];
300
+    }
301
+
302
+    // pas d'alias, pas de champ, pas de joker...
303
+    // tenter via une jointure...
304
+
305
+    // regarder si le champ est deja dans une jointure existante
306
+    // sinon, si il y a des joitures explicites, la construire
307
+    if (!$t = trouver_champ_exterieur($nom_champ, $boucles[$idb]->from, $boucles[$idb])) {
308
+        if ($boucles[$idb]->jointures_explicites) {
309
+            // [todo] Ne pas lancer que lorsque il y a des jointures explicites !!!!
310
+            // fonctionnel, il suffit d'utiliser $boucles[$idb]->jointures au lieu de jointures_explicites
311
+            // mais est-ce ce qu'on veut ?
312
+            $jointures = preg_split('/\s+/', $boucles[$idb]->jointures_explicites);
313
+            if ($cle = trouver_jointure_champ($nom_champ, $boucles[$idb], $jointures)) {
314
+                $t = trouver_champ_exterieur($nom_champ, $boucles[$idb]->from, $boucles[$idb]);
315
+            }
316
+        }
317
+    }
318
+
319
+    if ($t) {
320
+        // si on a trouvé une jointure possible, on fait comme
321
+        // si c'était une exception pour le champ demandé
322
+        return index_exception(
323
+            $boucles[$idb],
324
+            $desc,
325
+            $nom_champ,
326
+            [$t[1]['id_table'], reset($t[2])]
327
+        );
328
+    }
329
+
330
+    return ['', ''];
331 331
 }
332 332
 
333 333
 
@@ -355,52 +355,52 @@  discard block
 block discarded – undo
355 355
  *     est une expression pour le SELECT de la boucle du style "mots.titre AS titre_mot"
356 356
  **/
357 357
 function index_exception(&$boucle, $desc, $nom_champ, $excep) {
358
-	static $trouver_table;
359
-	if (!$trouver_table) {
360
-		$trouver_table = charger_fonction('trouver_table', 'base');
361
-	}
362
-
363
-	if (is_array($excep)) {
364
-		// permettre aux plugins de gerer eux meme des jointures derogatoire ingerables
365
-		$t = null;
366
-		if (count($excep) == 3) {
367
-			$index_exception_derogatoire = array_pop($excep);
368
-			$t = $index_exception_derogatoire($boucle, $desc, $nom_champ, $excep);
369
-		}
370
-		if ($t == null) {
371
-			[$e, $x] = $excep;  #PHP4 affecte de gauche a droite
372
-			$excep = $x;    #PHP5 de droite a gauche !
373
-			$j = $trouver_table($e, $boucle->sql_serveur);
374
-			if (!$j) {
375
-				return ['', ''];
376
-			}
377
-			$e = $j['table'];
378
-			if (!$t = array_search($e, $boucle->from)) {
379
-				$k = $j['key']['PRIMARY KEY'];
380
-				if (strpos($k, ',')) {
381
-					$l = (preg_split('/\s*,\s*/', $k));
382
-					$k = $desc['key']['PRIMARY KEY'];
383
-					if (!in_array($k, $l)) {
384
-						spip_log("jointure impossible $e " . join(',', $l));
385
-
386
-						return ['', ''];
387
-					}
388
-				}
389
-				$k = [$boucle->id_table, [$e], $k];
390
-				fabrique_jointures($boucle, [$k]);
391
-				$t = array_search($e, $boucle->from);
392
-			}
393
-		}
394
-	} else {
395
-		$t = $boucle->id_table;
396
-	}
397
-	// demander a SQL de gerer le synonyme
398
-	// ca permet que excep soit dynamique (Cedric, 2/3/06)
399
-	if ($excep != $nom_champ) {
400
-		$excep .= ' AS ' . $nom_champ;
401
-	}
402
-
403
-	return ["$t.$excep", $nom_champ];
358
+    static $trouver_table;
359
+    if (!$trouver_table) {
360
+        $trouver_table = charger_fonction('trouver_table', 'base');
361
+    }
362
+
363
+    if (is_array($excep)) {
364
+        // permettre aux plugins de gerer eux meme des jointures derogatoire ingerables
365
+        $t = null;
366
+        if (count($excep) == 3) {
367
+            $index_exception_derogatoire = array_pop($excep);
368
+            $t = $index_exception_derogatoire($boucle, $desc, $nom_champ, $excep);
369
+        }
370
+        if ($t == null) {
371
+            [$e, $x] = $excep;  #PHP4 affecte de gauche a droite
372
+            $excep = $x;    #PHP5 de droite a gauche !
373
+            $j = $trouver_table($e, $boucle->sql_serveur);
374
+            if (!$j) {
375
+                return ['', ''];
376
+            }
377
+            $e = $j['table'];
378
+            if (!$t = array_search($e, $boucle->from)) {
379
+                $k = $j['key']['PRIMARY KEY'];
380
+                if (strpos($k, ',')) {
381
+                    $l = (preg_split('/\s*,\s*/', $k));
382
+                    $k = $desc['key']['PRIMARY KEY'];
383
+                    if (!in_array($k, $l)) {
384
+                        spip_log("jointure impossible $e " . join(',', $l));
385
+
386
+                        return ['', ''];
387
+                    }
388
+                }
389
+                $k = [$boucle->id_table, [$e], $k];
390
+                fabrique_jointures($boucle, [$k]);
391
+                $t = array_search($e, $boucle->from);
392
+            }
393
+        }
394
+    } else {
395
+        $t = $boucle->id_table;
396
+    }
397
+    // demander a SQL de gerer le synonyme
398
+    // ca permet que excep soit dynamique (Cedric, 2/3/06)
399
+    if ($excep != $nom_champ) {
400
+        $excep .= ' AS ' . $nom_champ;
401
+    }
402
+
403
+    return ["$t.$excep", $nom_champ];
404 404
 }
405 405
 
406 406
 /**
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
  *     Code PHP pour retrouver le champ
426 426
  */
427 427
 function champ_sql($champ, $p, $defaut = null, $remonte_pile = true) {
428
-	return index_pile($p->id_boucle, $champ, $p->boucles, $p->nom_boucle, $defaut, $remonte_pile);
428
+    return index_pile($p->id_boucle, $champ, $p->boucles, $p->nom_boucle, $defaut, $remonte_pile);
429 429
 }
430 430
 
431 431
 
@@ -445,9 +445,9 @@  discard block
 block discarded – undo
445 445
  *     Code PHP pour d'exécution de la balise et de ses filtres
446 446
  **/
447 447
 function calculer_champ($p) {
448
-	$p = calculer_balise($p->nom_champ, $p);
448
+    $p = calculer_balise($p->nom_champ, $p);
449 449
 
450
-	return applique_filtres($p);
450
+    return applique_filtres($p);
451 451
 }
452 452
 
453 453
 
@@ -484,26 +484,26 @@  discard block
 block discarded – undo
484 484
  **/
485 485
 function calculer_balise(string $nom, \Champ $p): \Champ {
486 486
 
487
-	// S'agit-t-il d'une balise_XXXX[_dist]() ?
488
-	if ($f = charger_fonction($nom, 'balise', true)) {
489
-		$p->balise_calculee = true;
490
-		$res = $f($p);
491
-		if ($res !== null and is_object($res)) {
492
-			return $res;
493
-		}
494
-	}
495
-
496
-	// Certaines des balises comportant un _ sont generiques
497
-	if ($balise_generique = chercher_balise_generique($nom)) {
498
-		$res = $balise_generique['fonction_generique']($p);
499
-		if ($res !== null and is_object($res)) {
500
-			return $res;
501
-		}
502
-	}
503
-
504
-	$f = charger_fonction('DEFAUT', 'calculer_balise');
505
-
506
-	return $f($nom, $p);
487
+    // S'agit-t-il d'une balise_XXXX[_dist]() ?
488
+    if ($f = charger_fonction($nom, 'balise', true)) {
489
+        $p->balise_calculee = true;
490
+        $res = $f($p);
491
+        if ($res !== null and is_object($res)) {
492
+            return $res;
493
+        }
494
+    }
495
+
496
+    // Certaines des balises comportant un _ sont generiques
497
+    if ($balise_generique = chercher_balise_generique($nom)) {
498
+        $res = $balise_generique['fonction_generique']($p);
499
+        if ($res !== null and is_object($res)) {
500
+            return $res;
501
+        }
502
+    }
503
+
504
+    $f = charger_fonction('DEFAUT', 'calculer_balise');
505
+
506
+    return $f($nom, $p);
507 507
 }
508 508
 
509 509
 
@@ -531,37 +531,37 @@  discard block
 block discarded – undo
531 531
  **/
532 532
 function calculer_balise_DEFAUT_dist($nom, $p) {
533 533
 
534
-	// ca pourrait etre un champ SQL homonyme,
535
-	$p->code = index_pile($p->id_boucle, $nom, $p->boucles, $p->nom_boucle);
536
-
537
-	// compatibilite: depuis qu'on accepte #BALISE{ses_args} sans [(...)] autour
538
-	// il faut recracher {...} quand ce n'est finalement pas des args
539
-	if ($p->fonctions and (!$p->fonctions[0][0]) and $p->fonctions[0][1]) {
540
-		$code = addslashes($p->fonctions[0][1]);
541
-		$p->code .= " . '$code'";
542
-	}
543
-
544
-	// ne pas passer le filtre securite sur les id_xxx
545
-	if (strpos($nom, 'ID_') === 0) {
546
-		$p->interdire_scripts = false;
547
-	}
548
-
549
-	// Compatibilite ascendante avec les couleurs html (#FEFEFE) :
550
-	// SI le champ SQL n'est pas trouve
551
-	// ET si la balise a une forme de couleur
552
-	// ET s'il n'y a ni filtre ni etoile
553
-	// ALORS retourner la couleur.
554
-	// Ca permet si l'on veut vraiment de recuperer [(#ACCEDE*)]
555
-	if (
556
-		preg_match('/^[A-F]{1,6}$/i', $nom)
557
-		and !$p->etoile
558
-		and !$p->fonctions
559
-	) {
560
-		$p->code = "'#$nom'";
561
-		$p->interdire_scripts = false;
562
-	}
563
-
564
-	return $p;
534
+    // ca pourrait etre un champ SQL homonyme,
535
+    $p->code = index_pile($p->id_boucle, $nom, $p->boucles, $p->nom_boucle);
536
+
537
+    // compatibilite: depuis qu'on accepte #BALISE{ses_args} sans [(...)] autour
538
+    // il faut recracher {...} quand ce n'est finalement pas des args
539
+    if ($p->fonctions and (!$p->fonctions[0][0]) and $p->fonctions[0][1]) {
540
+        $code = addslashes($p->fonctions[0][1]);
541
+        $p->code .= " . '$code'";
542
+    }
543
+
544
+    // ne pas passer le filtre securite sur les id_xxx
545
+    if (strpos($nom, 'ID_') === 0) {
546
+        $p->interdire_scripts = false;
547
+    }
548
+
549
+    // Compatibilite ascendante avec les couleurs html (#FEFEFE) :
550
+    // SI le champ SQL n'est pas trouve
551
+    // ET si la balise a une forme de couleur
552
+    // ET s'il n'y a ni filtre ni etoile
553
+    // ALORS retourner la couleur.
554
+    // Ca permet si l'on veut vraiment de recuperer [(#ACCEDE*)]
555
+    if (
556
+        preg_match('/^[A-F]{1,6}$/i', $nom)
557
+        and !$p->etoile
558
+        and !$p->fonctions
559
+    ) {
560
+        $p->code = "'#$nom'";
561
+        $p->interdire_scripts = false;
562
+    }
563
+
564
+    return $p;
565 565
 }
566 566
 
567 567
 
@@ -609,53 +609,53 @@  discard block
 block discarded – undo
609 609
  **/
610 610
 function calculer_balise_dynamique($p, $nom, $l, $supp = []) {
611 611
 
612
-	if (!balise_distante_interdite($p)) {
613
-		$p->code = "''";
614
-
615
-		return $p;
616
-	}
617
-	// compatibilite: depuis qu'on accepte #BALISE{ses_args} sans [(...)] autour
618
-	// il faut recracher {...} quand ce n'est finalement pas des args
619
-	if ($p->fonctions and (!$p->fonctions[0][0]) and $p->fonctions[0][1]) {
620
-		$p->fonctions = [];
621
-	}
622
-
623
-	if ($p->param and ($c = $p->param[0])) {
624
-		// liste d'arguments commence toujours par la chaine vide
625
-		array_shift($c);
626
-		// construire la liste d'arguments comme pour un filtre
627
-		$param = compose_filtres_args($p, $c, ',');
628
-	} else {
629
-		$param = '';
630
-	}
631
-	$collecte = collecter_balise_dynamique($l, $p, $nom);
632
-
633
-	$dans_un_modele = false;
634
-	if (!empty($p->descr['sourcefile'])
635
-	  and $f = $p->descr['sourcefile']
636
-	  and basename(dirname($f)) === 'modeles'
637
-	) {
638
-		$dans_un_modele = true;
639
-	}
640
-
641
-	// un modele est toujours inséré en texte dans son contenant
642
-	// donc si on est dans le public avec un cache on va perdre le dynamisme
643
-	// et on risque de mettre en cache les valeurs pre-remplies du formulaire
644
-	// on passe donc par une fonction proxy qui si besoin va collecter les arguments
645
-	// et injecter le PHP qui va appeler la fonction pour generer le formulaire au lieu de directement la fonction
646
-	// (dans l'espace prive on a pas de cache, donc pas de soucis (et un leak serait moins grave))
647
-	$p->code = sprintf(
648
-		$dans_un_modele ? CODE_EXECUTER_BALISE_MODELE : CODE_EXECUTER_BALISE,
649
-		$nom,
650
-		join(',', $collecte),
651
-		($collecte ? $param : substr($param, 1)), # virer la virgule
652
-		memoriser_contexte_compil($p),
653
-		(!$supp ? '' : (', ' . join(',', $supp)))
654
-	);
655
-
656
-	$p->interdire_scripts = false;
657
-
658
-	return $p;
612
+    if (!balise_distante_interdite($p)) {
613
+        $p->code = "''";
614
+
615
+        return $p;
616
+    }
617
+    // compatibilite: depuis qu'on accepte #BALISE{ses_args} sans [(...)] autour
618
+    // il faut recracher {...} quand ce n'est finalement pas des args
619
+    if ($p->fonctions and (!$p->fonctions[0][0]) and $p->fonctions[0][1]) {
620
+        $p->fonctions = [];
621
+    }
622
+
623
+    if ($p->param and ($c = $p->param[0])) {
624
+        // liste d'arguments commence toujours par la chaine vide
625
+        array_shift($c);
626
+        // construire la liste d'arguments comme pour un filtre
627
+        $param = compose_filtres_args($p, $c, ',');
628
+    } else {
629
+        $param = '';
630
+    }
631
+    $collecte = collecter_balise_dynamique($l, $p, $nom);
632
+
633
+    $dans_un_modele = false;
634
+    if (!empty($p->descr['sourcefile'])
635
+      and $f = $p->descr['sourcefile']
636
+      and basename(dirname($f)) === 'modeles'
637
+    ) {
638
+        $dans_un_modele = true;
639
+    }
640
+
641
+    // un modele est toujours inséré en texte dans son contenant
642
+    // donc si on est dans le public avec un cache on va perdre le dynamisme
643
+    // et on risque de mettre en cache les valeurs pre-remplies du formulaire
644
+    // on passe donc par une fonction proxy qui si besoin va collecter les arguments
645
+    // et injecter le PHP qui va appeler la fonction pour generer le formulaire au lieu de directement la fonction
646
+    // (dans l'espace prive on a pas de cache, donc pas de soucis (et un leak serait moins grave))
647
+    $p->code = sprintf(
648
+        $dans_un_modele ? CODE_EXECUTER_BALISE_MODELE : CODE_EXECUTER_BALISE,
649
+        $nom,
650
+        join(',', $collecte),
651
+        ($collecte ? $param : substr($param, 1)), # virer la virgule
652
+        memoriser_contexte_compil($p),
653
+        (!$supp ? '' : (', ' . join(',', $supp)))
654
+    );
655
+
656
+    $p->interdire_scripts = false;
657
+
658
+    return $p;
659 659
 }
660 660
 
661 661
 
@@ -685,17 +685,17 @@  discard block
 block discarded – undo
685 685
  *     Liste des codes PHP d'éxecution des balises collectées
686 686
  **/
687 687
 function collecter_balise_dynamique(array $l, \Champ &$p, string $nom): array {
688
-	$args = [];
689
-	foreach ($l as $c) {
690
-		if ($c === null) {
691
-			$args[] = 'null';
692
-		} else {
693
-			$x = calculer_balise($c, $p);
694
-			$args[] = $x->code;
695
-		}
696
-	}
697
-
698
-	return $args;
688
+    $args = [];
689
+    foreach ($l as $c) {
690
+        if ($c === null) {
691
+            $args[] = 'null';
692
+        } else {
693
+            $x = calculer_balise($c, $p);
694
+            $args[] = $x->code;
695
+        }
696
+    }
697
+
698
+    return $args;
699 699
 }
700 700
 
701 701
 
@@ -710,22 +710,22 @@  discard block
 block discarded – undo
710 710
  *     Nom de la connexion
711 711
  **/
712 712
 function trouver_nom_serveur_distant($p) {
713
-	$nom = $p->id_boucle;
714
-	if (
715
-		$nom
716
-		and isset($p->boucles[$nom])
717
-	) {
718
-		$s = $p->boucles[$nom]->sql_serveur;
719
-		if (
720
-			strlen($s)
721
-			and strlen($serveur = strtolower($s))
722
-			and !in_array($serveur, $GLOBALS['exception_des_connect'])
723
-		) {
724
-			return $serveur;
725
-		}
726
-	}
727
-
728
-	return '';
713
+    $nom = $p->id_boucle;
714
+    if (
715
+        $nom
716
+        and isset($p->boucles[$nom])
717
+    ) {
718
+        $s = $p->boucles[$nom]->sql_serveur;
719
+        if (
720
+            strlen($s)
721
+            and strlen($serveur = strtolower($s))
722
+            and !in_array($serveur, $GLOBALS['exception_des_connect'])
723
+        ) {
724
+            return $serveur;
725
+        }
726
+    }
727
+
728
+    return '';
729 729
 }
730 730
 
731 731
 
@@ -749,15 +749,15 @@  discard block
 block discarded – undo
749 749
  *     - false : La balise est interdite car le serveur est distant
750 750
  **/
751 751
 function balise_distante_interdite($p) {
752
-	$nom = $p->id_boucle;
752
+    $nom = $p->id_boucle;
753 753
 
754
-	if ($nom and trouver_nom_serveur_distant($p)) {
755
-		spip_log($nom . ':' . $p->nom_champ . ' ' . _T('zbug_distant_interdit'));
754
+    if ($nom and trouver_nom_serveur_distant($p)) {
755
+        spip_log($nom . ':' . $p->nom_champ . ' ' . _T('zbug_distant_interdit'));
756 756
 
757
-		return false;
758
-	}
757
+        return false;
758
+    }
759 759
 
760
-	return true;
760
+    return true;
761 761
 }
762 762
 
763 763
 
@@ -767,84 +767,84 @@  discard block
 block discarded – undo
767 767
 //
768 768
 function champs_traitements($p) {
769 769
 
770
-	if (isset($GLOBALS['table_des_traitements'][$p->nom_champ])) {
771
-		$ps = $GLOBALS['table_des_traitements'][$p->nom_champ];
772
-	} else {
773
-		// quand on utilise un traitement catch-all *
774
-		// celui-ci ne s'applique pas sur les balises calculees qui peuvent gerer
775
-		// leur propre securite
776
-		if (!$p->balise_calculee) {
777
-			$ps = $GLOBALS['table_des_traitements']['*'];
778
-		} else {
779
-			$ps = false;
780
-		}
781
-	}
782
-
783
-	if (is_array($ps)) {
784
-		// Recuperer le type de boucle (articles, DATA) et la table SQL sur laquelle elle porte
785
-		$idb = index_boucle($p);
786
-		// si le champ a ete trouve dans une boucle parente sa source est renseignee ici
787
-		if (!empty($p->boucles[$idb]->index_champ[$p->nom_champ])) {
788
-			$idb = $p->boucles[$idb]->index_champ[$p->nom_champ];
789
-		}
790
-
791
-		// mais on peut aussi etre hors boucle. Se mefier.
792
-		$type_requete = $p->boucles[$idb]->type_requete ?? false;
793
-		$table_sql = $p->boucles[$idb]->show['table_sql'] ?? false;
794
-
795
-		// bien prendre en compte les alias de boucles (hierarchie => rubrique, syndication => syncdic, etc.)
796
-		if ($type_requete and isset($GLOBALS['table_des_tables'][$type_requete])) {
797
-			$type_alias = $type_requete;
798
-			$type_requete = $GLOBALS['table_des_tables'][$type_requete];
799
-		} else {
800
-			$type_alias = false;
801
-		}
802
-
803
-		// le traitement peut n'etre defini que pour une table en particulier "spip_articles"
804
-		if ($table_sql and isset($ps[$table_sql])) {
805
-			$ps = $ps[$table_sql];
806
-		} // ou pour une boucle en particulier "DATA","articles"
807
-		elseif ($type_requete and isset($ps[$type_requete])) {
808
-			$ps = $ps[$type_requete];
809
-		} // ou pour une boucle utilisant un alias ("hierarchie")
810
-		elseif ($type_alias and isset($ps[$type_alias])) {
811
-			$ps = $ps[$type_alias];
812
-		} // ou pour indifféremment quelle que soit la boucle
813
-		elseif (isset($ps[0])) {
814
-			$ps = $ps[0];
815
-		} else {
816
-			$ps = false;
817
-		}
818
-	}
819
-
820
-	if (!$ps) {
821
-		return $p->code;
822
-	}
823
-
824
-	// Si une boucle DOCUMENTS{doublons} est presente dans le squelette,
825
-	// ou si in INCLURE contient {doublons}
826
-	// on insere une fonction de remplissage du tableau des doublons
827
-	// dans les filtres propre() ou typo()
828
-	// (qui traitent les raccourcis <docXX> referencant les docs)
829
-
830
-	if (
831
-		isset($p->descr['documents'])
832
-		and
833
-		$p->descr['documents']
834
-		and (
835
-			(strpos($ps, 'propre') !== false)
836
-			or
837
-			(strpos($ps, 'typo') !== false)
838
-		)
839
-	) {
840
-		$ps = 'traiter_doublons_documents($doublons, ' . $ps . ')';
841
-	}
842
-
843
-	// La protection des champs par |safehtml est assuree par les extensions
844
-	// dans la declaration des traitements des champs sensibles
845
-
846
-	// Remplacer enfin le placeholder %s par le vrai code de la balise
847
-	return str_replace('%s', $p->code, $ps);
770
+    if (isset($GLOBALS['table_des_traitements'][$p->nom_champ])) {
771
+        $ps = $GLOBALS['table_des_traitements'][$p->nom_champ];
772
+    } else {
773
+        // quand on utilise un traitement catch-all *
774
+        // celui-ci ne s'applique pas sur les balises calculees qui peuvent gerer
775
+        // leur propre securite
776
+        if (!$p->balise_calculee) {
777
+            $ps = $GLOBALS['table_des_traitements']['*'];
778
+        } else {
779
+            $ps = false;
780
+        }
781
+    }
782
+
783
+    if (is_array($ps)) {
784
+        // Recuperer le type de boucle (articles, DATA) et la table SQL sur laquelle elle porte
785
+        $idb = index_boucle($p);
786
+        // si le champ a ete trouve dans une boucle parente sa source est renseignee ici
787
+        if (!empty($p->boucles[$idb]->index_champ[$p->nom_champ])) {
788
+            $idb = $p->boucles[$idb]->index_champ[$p->nom_champ];
789
+        }
790
+
791
+        // mais on peut aussi etre hors boucle. Se mefier.
792
+        $type_requete = $p->boucles[$idb]->type_requete ?? false;
793
+        $table_sql = $p->boucles[$idb]->show['table_sql'] ?? false;
794
+
795
+        // bien prendre en compte les alias de boucles (hierarchie => rubrique, syndication => syncdic, etc.)
796
+        if ($type_requete and isset($GLOBALS['table_des_tables'][$type_requete])) {
797
+            $type_alias = $type_requete;
798
+            $type_requete = $GLOBALS['table_des_tables'][$type_requete];
799
+        } else {
800
+            $type_alias = false;
801
+        }
802
+
803
+        // le traitement peut n'etre defini que pour une table en particulier "spip_articles"
804
+        if ($table_sql and isset($ps[$table_sql])) {
805
+            $ps = $ps[$table_sql];
806
+        } // ou pour une boucle en particulier "DATA","articles"
807
+        elseif ($type_requete and isset($ps[$type_requete])) {
808
+            $ps = $ps[$type_requete];
809
+        } // ou pour une boucle utilisant un alias ("hierarchie")
810
+        elseif ($type_alias and isset($ps[$type_alias])) {
811
+            $ps = $ps[$type_alias];
812
+        } // ou pour indifféremment quelle que soit la boucle
813
+        elseif (isset($ps[0])) {
814
+            $ps = $ps[0];
815
+        } else {
816
+            $ps = false;
817
+        }
818
+    }
819
+
820
+    if (!$ps) {
821
+        return $p->code;
822
+    }
823
+
824
+    // Si une boucle DOCUMENTS{doublons} est presente dans le squelette,
825
+    // ou si in INCLURE contient {doublons}
826
+    // on insere une fonction de remplissage du tableau des doublons
827
+    // dans les filtres propre() ou typo()
828
+    // (qui traitent les raccourcis <docXX> referencant les docs)
829
+
830
+    if (
831
+        isset($p->descr['documents'])
832
+        and
833
+        $p->descr['documents']
834
+        and (
835
+            (strpos($ps, 'propre') !== false)
836
+            or
837
+            (strpos($ps, 'typo') !== false)
838
+        )
839
+    ) {
840
+        $ps = 'traiter_doublons_documents($doublons, ' . $ps . ')';
841
+    }
842
+
843
+    // La protection des champs par |safehtml est assuree par les extensions
844
+    // dans la declaration des traitements des champs sensibles
845
+
846
+    // Remplacer enfin le placeholder %s par le vrai code de la balise
847
+    return str_replace('%s', $p->code, $ps);
848 848
 }
849 849
 
850 850
 
@@ -856,110 +856,110 @@  discard block
 block discarded – undo
856 856
 //
857 857
 function applique_filtres($p) {
858 858
 
859
-	// Traitements standards (cf. supra)
860
-	if ($p->etoile == '') {
861
-		$code = champs_traitements($p);
862
-	} else {
863
-		$code = $p->code;
864
-	}
859
+    // Traitements standards (cf. supra)
860
+    if ($p->etoile == '') {
861
+        $code = champs_traitements($p);
862
+    } else {
863
+        $code = $p->code;
864
+    }
865 865
 
866
-	// Appliquer les filtres perso
867
-	if ($p->param) {
868
-		$code = compose_filtres($p, $code);
869
-	}
866
+    // Appliquer les filtres perso
867
+    if ($p->param) {
868
+        $code = compose_filtres($p, $code);
869
+    }
870 870
 
871
-	// S'il y a un lien avec la session, ajouter un code qui levera
872
-	// un drapeau dans la structure d'invalidation $Cache
873
-	if (isset($p->descr['session'])) {
874
-		$code = "invalideur_session(\$Cache, $code)";
875
-	}
871
+    // S'il y a un lien avec la session, ajouter un code qui levera
872
+    // un drapeau dans la structure d'invalidation $Cache
873
+    if (isset($p->descr['session'])) {
874
+        $code = "invalideur_session(\$Cache, $code)";
875
+    }
876 876
 
877
-	$code = sandbox_composer_interdire_scripts($code, $p);
877
+    $code = sandbox_composer_interdire_scripts($code, $p);
878 878
 
879
-	return $code;
879
+    return $code;
880 880
 }
881 881
 
882 882
 // Cf. function pipeline dans ecrire/inc_utils.php
883 883
 function compose_filtres(&$p, $code) {
884 884
 
885
-	$image_miette = false;
886
-	foreach ($p->param as $filtre) {
887
-		$fonc = array_shift($filtre);
888
-		if (!$fonc) {
889
-			continue;
890
-		} // normalement qu'au premier tour.
891
-		$is_filtre_image = ((substr($fonc, 0, 6) == 'image_') and $fonc != 'image_graver');
892
-		if ($image_miette and !$is_filtre_image) {
893
-			// il faut graver maintenant car apres le filtre en cours
894
-			// on est pas sur d'avoir encore le nom du fichier dans le pipe
895
-			$code = "filtrer('image_graver', $code)";
896
-			$image_miette = false;
897
-		}
898
-
899
-		// recuperer les arguments du filtre,
900
-		// a separer par "," ou ":" dans le cas du filtre "?{a,b}"
901
-		$countfiltre = is_countable($filtre) ? count($filtre) : 0;
902
-		if ($fonc !== '?') {
903
-			$sep = ',';
904
-		} else {
905
-			$sep = ':';
906
-			// |?{a,b} *doit* avoir exactement 2 arguments ; on les force
907
-			if ($countfiltre != 2) {
908
-				$filtre = [$filtre[0] ?? '', $filtre[1] ?? ''];
909
-				$countfiltre = 2;
910
-			}
911
-		}
912
-		$arglist = compose_filtres_args($p, $filtre, $sep);
913
-		$logique = filtre_logique($fonc, $code, substr($arglist, 1));
914
-		if ($logique) {
915
-			$code = $logique;
916
-		} else {
917
-			$code = sandbox_composer_filtre($fonc, $code, $arglist, $p, $countfiltre);
918
-			if ($is_filtre_image) {
919
-				$image_miette = true;
920
-			}
921
-		}
922
-	}
923
-	// ramasser les images intermediaires inutiles et graver l'image finale
924
-	if ($image_miette) {
925
-		$code = "filtrer('image_graver',$code)";
926
-	}
927
-
928
-	return $code;
885
+    $image_miette = false;
886
+    foreach ($p->param as $filtre) {
887
+        $fonc = array_shift($filtre);
888
+        if (!$fonc) {
889
+            continue;
890
+        } // normalement qu'au premier tour.
891
+        $is_filtre_image = ((substr($fonc, 0, 6) == 'image_') and $fonc != 'image_graver');
892
+        if ($image_miette and !$is_filtre_image) {
893
+            // il faut graver maintenant car apres le filtre en cours
894
+            // on est pas sur d'avoir encore le nom du fichier dans le pipe
895
+            $code = "filtrer('image_graver', $code)";
896
+            $image_miette = false;
897
+        }
898
+
899
+        // recuperer les arguments du filtre,
900
+        // a separer par "," ou ":" dans le cas du filtre "?{a,b}"
901
+        $countfiltre = is_countable($filtre) ? count($filtre) : 0;
902
+        if ($fonc !== '?') {
903
+            $sep = ',';
904
+        } else {
905
+            $sep = ':';
906
+            // |?{a,b} *doit* avoir exactement 2 arguments ; on les force
907
+            if ($countfiltre != 2) {
908
+                $filtre = [$filtre[0] ?? '', $filtre[1] ?? ''];
909
+                $countfiltre = 2;
910
+            }
911
+        }
912
+        $arglist = compose_filtres_args($p, $filtre, $sep);
913
+        $logique = filtre_logique($fonc, $code, substr($arglist, 1));
914
+        if ($logique) {
915
+            $code = $logique;
916
+        } else {
917
+            $code = sandbox_composer_filtre($fonc, $code, $arglist, $p, $countfiltre);
918
+            if ($is_filtre_image) {
919
+                $image_miette = true;
920
+            }
921
+        }
922
+    }
923
+    // ramasser les images intermediaires inutiles et graver l'image finale
924
+    if ($image_miette) {
925
+        $code = "filtrer('image_graver',$code)";
926
+    }
927
+
928
+    return $code;
929 929
 }
930 930
 
931 931
 // Filtres et,ou,oui,non,sinon,xou,xor,and,or,not,yes
932 932
 // et comparateurs
933 933
 function filtre_logique($fonc, $code, $arg) {
934 934
 
935
-	switch (true) {
936
-		case in_array($fonc, $GLOBALS['table_criteres_infixes']):
937
-			return "($code $fonc $arg)";
938
-		case ($fonc == 'and') or ($fonc == 'et'):
939
-			return "((($code) AND ($arg)) ?' ' :'')";
940
-		case ($fonc == 'or') or ($fonc == 'ou'):
941
-			return "((($code) OR ($arg)) ?' ' :'')";
942
-		case ($fonc == 'xor') or ($fonc == 'xou'):
943
-			return "((($code) XOR ($arg)) ?' ' :'')";
944
-		case ($fonc == 'sinon'):
945
-			return "(((\$a = $code) OR (is_string(\$a) AND strlen(\$a))) ? \$a : $arg)";
946
-		case ($fonc == 'not') or ($fonc == 'non'):
947
-			return "(($code) ?'' :' ')";
948
-		case ($fonc == 'yes') or ($fonc == 'oui'):
949
-			return "(($code) ?' ' :'')";
950
-	}
951
-
952
-	return '';
935
+    switch (true) {
936
+        case in_array($fonc, $GLOBALS['table_criteres_infixes']):
937
+            return "($code $fonc $arg)";
938
+        case ($fonc == 'and') or ($fonc == 'et'):
939
+            return "((($code) AND ($arg)) ?' ' :'')";
940
+        case ($fonc == 'or') or ($fonc == 'ou'):
941
+            return "((($code) OR ($arg)) ?' ' :'')";
942
+        case ($fonc == 'xor') or ($fonc == 'xou'):
943
+            return "((($code) XOR ($arg)) ?' ' :'')";
944
+        case ($fonc == 'sinon'):
945
+            return "(((\$a = $code) OR (is_string(\$a) AND strlen(\$a))) ? \$a : $arg)";
946
+        case ($fonc == 'not') or ($fonc == 'non'):
947
+            return "(($code) ?'' :' ')";
948
+        case ($fonc == 'yes') or ($fonc == 'oui'):
949
+            return "(($code) ?' ' :'')";
950
+    }
951
+
952
+    return '';
953 953
 }
954 954
 
955 955
 function compose_filtres_args($p, $args, $sep) {
956
-	$arglist = '';
957
-	foreach ($args as $arg) {
958
-		$arglist .= $sep .
959
-			calculer_liste($arg, $p->descr, $p->boucles, $p->id_boucle);
960
-	}
956
+    $arglist = '';
957
+    foreach ($args as $arg) {
958
+        $arglist .= $sep .
959
+            calculer_liste($arg, $p->descr, $p->boucles, $p->id_boucle);
960
+    }
961 961
 
962
-	return $arglist;
962
+    return $arglist;
963 963
 }
964 964
 
965 965
 
@@ -977,15 +977,15 @@  discard block
 block discarded – undo
977 977
  **/
978 978
 function calculer_argument_precedent($idb, $nom_champ, &$boucles, $defaut = null) {
979 979
 
980
-	// si recursif, forcer l'extraction du champ SQL mais ignorer le code
981
-	if ($boucles[$idb]->externe) {
982
-		index_pile($idb, $nom_champ, $boucles, '', $defaut);
983
-		// retourner $Pile[$SP] et pas $Pile[0] si recursion en 1ere boucle
984
-		// on ignore le defaut fourni dans ce cas
985
-		$defaut = "(\$Pile[\$SP]['$nom_champ'] ?? null)";
986
-	}
980
+    // si recursif, forcer l'extraction du champ SQL mais ignorer le code
981
+    if ($boucles[$idb]->externe) {
982
+        index_pile($idb, $nom_champ, $boucles, '', $defaut);
983
+        // retourner $Pile[$SP] et pas $Pile[0] si recursion en 1ere boucle
984
+        // on ignore le defaut fourni dans ce cas
985
+        $defaut = "(\$Pile[\$SP]['$nom_champ'] ?? null)";
986
+    }
987 987
 
988
-	return index_pile($boucles[$idb]->id_parent, $nom_champ, $boucles, '', $defaut);
988
+    return index_pile($boucles[$idb]->id_parent, $nom_champ, $boucles, '', $defaut);
989 989
 }
990 990
 
991 991
 //
@@ -999,30 +999,30 @@  discard block
 block discarded – undo
999 999
 //
1000 1000
 
1001 1001
 function rindex_pile($p, $champ, $motif) {
1002
-	$n = 0;
1003
-	$b = $p->id_boucle;
1004
-	$p->code = '';
1005
-	while ($b != '') {
1006
-		foreach ($p->boucles[$b]->criteres as $critere) {
1007
-			if ($critere->op == $motif) {
1008
-				$p->code = '$Pile[$SP' . (($n == 0) ? '' : "-$n") .
1009
-					"]['$champ']";
1010
-				$b = '';
1011
-				break 2;
1012
-			}
1013
-		}
1014
-		$n++;
1015
-		$b = $p->boucles[$b]->id_parent;
1016
-	}
1017
-
1018
-	// si on est hors d'une boucle de {recherche}, cette balise est vide
1019
-	if (!$p->code) {
1020
-		$p->code = "''";
1021
-	}
1022
-
1023
-	$p->interdire_scripts = false;
1024
-
1025
-	return $p;
1002
+    $n = 0;
1003
+    $b = $p->id_boucle;
1004
+    $p->code = '';
1005
+    while ($b != '') {
1006
+        foreach ($p->boucles[$b]->criteres as $critere) {
1007
+            if ($critere->op == $motif) {
1008
+                $p->code = '$Pile[$SP' . (($n == 0) ? '' : "-$n") .
1009
+                    "]['$champ']";
1010
+                $b = '';
1011
+                break 2;
1012
+            }
1013
+        }
1014
+        $n++;
1015
+        $b = $p->boucles[$b]->id_parent;
1016
+    }
1017
+
1018
+    // si on est hors d'une boucle de {recherche}, cette balise est vide
1019
+    if (!$p->code) {
1020
+        $p->code = "''";
1021
+    }
1022
+
1023
+    $p->interdire_scripts = false;
1024
+
1025
+    return $p;
1026 1026
 }
1027 1027
 
1028 1028
 /**
@@ -1032,7 +1032,7 @@  discard block
 block discarded – undo
1032 1032
  * @return string Nom de la balise, avec indication de boucle explicite si présent.
1033 1033
  */
1034 1034
 function zbug_presenter_champ($p, $champ = '') {
1035
-	$balise = $champ ?: $p->nom_champ;
1036
-	$explicite = $p->nom_boucle ? $p->nom_boucle . ':' : '';
1037
-	return "#{$explicite}{$balise}";
1035
+    $balise = $champ ?: $p->nom_champ;
1036
+    $explicite = $p->nom_boucle ? $p->nom_boucle . ':' : '';
1037
+    return "#{$explicite}{$balise}";
1038 1038
 }
Please login to merge, or discard this patch.
ecrire/src/Chiffrer/Chiffrement.php 2 patches
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -19,78 +19,78 @@
 block discarded – undo
19 19
  * @link https://www.php.net/manual/fr/book.sodium.php
20 20
  */
21 21
 class Chiffrement {
22
-	/** Chiffre un message en utilisant une clé ou un mot de passe */
23
-	public static function chiffrer(
24
-		string $message,
25
-		#[\SensitiveParameter]
26
-		string $key
27
-	): ?string {
28
-		// create a random salt for key derivation
29
-		$salt = random_bytes(SODIUM_CRYPTO_PWHASH_SALTBYTES);
30
-		$key = self::deriveKeyFromPassword($key, $salt);
31
-		$nonce = random_bytes(\SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);
32
-		$padded_message = sodium_pad($message, 16);
33
-		$encrypted = sodium_crypto_secretbox($padded_message, $nonce, $key);
34
-		$encoded = base64_encode($salt . $nonce . $encrypted);
35
-		sodium_memzero($key);
36
-		sodium_memzero($nonce);
37
-		sodium_memzero($salt);
38
-		#spip_log("chiffrer($message)=$encoded", 'chiffrer' . _LOG_DEBUG);
39
-		return $encoded;
40
-	}
22
+    /** Chiffre un message en utilisant une clé ou un mot de passe */
23
+    public static function chiffrer(
24
+        string $message,
25
+        #[\SensitiveParameter]
26
+        string $key
27
+    ): ?string {
28
+        // create a random salt for key derivation
29
+        $salt = random_bytes(SODIUM_CRYPTO_PWHASH_SALTBYTES);
30
+        $key = self::deriveKeyFromPassword($key, $salt);
31
+        $nonce = random_bytes(\SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);
32
+        $padded_message = sodium_pad($message, 16);
33
+        $encrypted = sodium_crypto_secretbox($padded_message, $nonce, $key);
34
+        $encoded = base64_encode($salt . $nonce . $encrypted);
35
+        sodium_memzero($key);
36
+        sodium_memzero($nonce);
37
+        sodium_memzero($salt);
38
+        #spip_log("chiffrer($message)=$encoded", 'chiffrer' . _LOG_DEBUG);
39
+        return $encoded;
40
+    }
41 41
 
42
-	/** Déchiffre un message en utilisant une clé ou un mot de passe */
43
-	public static function dechiffrer(
44
-		string $encoded,
45
-		#[\SensitiveParameter]
46
-		string $key
47
-	): ?string {
48
-		$decoded = base64_decode($encoded);
49
-		$salt = substr($decoded, 0, \SODIUM_CRYPTO_PWHASH_SALTBYTES);
50
-		$nonce = substr($decoded, \SODIUM_CRYPTO_PWHASH_SALTBYTES, \SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);
51
-		$encrypted = substr($decoded, \SODIUM_CRYPTO_PWHASH_SALTBYTES + \SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);
52
-		$key = self::deriveKeyFromPassword($key, $salt);
53
-		$padded_message = sodium_crypto_secretbox_open($encrypted, $nonce, $key);
54
-		sodium_memzero($key);
55
-		sodium_memzero($nonce);
56
-		sodium_memzero($salt);
57
-		if ($padded_message === false) {
58
-			spip_log("dechiffrer() chiffre corrompu `$encoded`", 'chiffrer' . _LOG_DEBUG);
59
-			return null;
60
-		}
61
-		$message = sodium_unpad($padded_message, 16);
62
-		#spip_log("dechiffrer($encoded)=$message", 'chiffrer' . _LOG_DEBUG);
63
-		return $message;
64
-	}
42
+    /** Déchiffre un message en utilisant une clé ou un mot de passe */
43
+    public static function dechiffrer(
44
+        string $encoded,
45
+        #[\SensitiveParameter]
46
+        string $key
47
+    ): ?string {
48
+        $decoded = base64_decode($encoded);
49
+        $salt = substr($decoded, 0, \SODIUM_CRYPTO_PWHASH_SALTBYTES);
50
+        $nonce = substr($decoded, \SODIUM_CRYPTO_PWHASH_SALTBYTES, \SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);
51
+        $encrypted = substr($decoded, \SODIUM_CRYPTO_PWHASH_SALTBYTES + \SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);
52
+        $key = self::deriveKeyFromPassword($key, $salt);
53
+        $padded_message = sodium_crypto_secretbox_open($encrypted, $nonce, $key);
54
+        sodium_memzero($key);
55
+        sodium_memzero($nonce);
56
+        sodium_memzero($salt);
57
+        if ($padded_message === false) {
58
+            spip_log("dechiffrer() chiffre corrompu `$encoded`", 'chiffrer' . _LOG_DEBUG);
59
+            return null;
60
+        }
61
+        $message = sodium_unpad($padded_message, 16);
62
+        #spip_log("dechiffrer($encoded)=$message", 'chiffrer' . _LOG_DEBUG);
63
+        return $message;
64
+    }
65 65
 
66
-	/** Génère une clé de la taille attendue pour le chiffrement */
67
-	public static function keygen(): string {
68
-		return sodium_crypto_secretbox_keygen();
69
-	}
66
+    /** Génère une clé de la taille attendue pour le chiffrement */
67
+    public static function keygen(): string {
68
+        return sodium_crypto_secretbox_keygen();
69
+    }
70 70
 
71
-	/**
72
-	 * Retourne une clé de la taille attendue pour le chiffrement
73
-	 *
74
-	 * Notamment si on utilise un mot de passe comme clé, il faut le hacher
75
-	 * pour servir de clé à la taille correspondante.
76
-	 */
77
-	private static function deriveKeyFromPassword(
78
-		#[\SensitiveParameter]
79
-		string $password,
80
-		string $salt
81
-	): string {
82
-		if (strlen($password) === \SODIUM_CRYPTO_SECRETBOX_KEYBYTES) {
83
-			return $password;
84
-		}
85
-		$key = sodium_crypto_pwhash(
86
-			\SODIUM_CRYPTO_SECRETBOX_KEYBYTES,
87
-			$password,
88
-			$salt,
89
-			\SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE,
90
-			\SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE
91
-		);
92
-		sodium_memzero($password);
71
+    /**
72
+     * Retourne une clé de la taille attendue pour le chiffrement
73
+     *
74
+     * Notamment si on utilise un mot de passe comme clé, il faut le hacher
75
+     * pour servir de clé à la taille correspondante.
76
+     */
77
+    private static function deriveKeyFromPassword(
78
+        #[\SensitiveParameter]
79
+        string $password,
80
+        string $salt
81
+    ): string {
82
+        if (strlen($password) === \SODIUM_CRYPTO_SECRETBOX_KEYBYTES) {
83
+            return $password;
84
+        }
85
+        $key = sodium_crypto_pwhash(
86
+            \SODIUM_CRYPTO_SECRETBOX_KEYBYTES,
87
+            $password,
88
+            $salt,
89
+            \SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE,
90
+            \SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE
91
+        );
92
+        sodium_memzero($password);
93 93
 
94
-		return $key;
95
-	}
94
+        return $key;
95
+    }
96 96
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 		$nonce = random_bytes(\SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);
32 32
 		$padded_message = sodium_pad($message, 16);
33 33
 		$encrypted = sodium_crypto_secretbox($padded_message, $nonce, $key);
34
-		$encoded = base64_encode($salt . $nonce . $encrypted);
34
+		$encoded = base64_encode($salt.$nonce.$encrypted);
35 35
 		sodium_memzero($key);
36 36
 		sodium_memzero($nonce);
37 37
 		sodium_memzero($salt);
@@ -48,14 +48,14 @@  discard block
 block discarded – undo
48 48
 		$decoded = base64_decode($encoded);
49 49
 		$salt = substr($decoded, 0, \SODIUM_CRYPTO_PWHASH_SALTBYTES);
50 50
 		$nonce = substr($decoded, \SODIUM_CRYPTO_PWHASH_SALTBYTES, \SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);
51
-		$encrypted = substr($decoded, \SODIUM_CRYPTO_PWHASH_SALTBYTES + \SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);
51
+		$encrypted = substr($decoded, \SODIUM_CRYPTO_PWHASH_SALTBYTES +\SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);
52 52
 		$key = self::deriveKeyFromPassword($key, $salt);
53 53
 		$padded_message = sodium_crypto_secretbox_open($encrypted, $nonce, $key);
54 54
 		sodium_memzero($key);
55 55
 		sodium_memzero($nonce);
56 56
 		sodium_memzero($salt);
57 57
 		if ($padded_message === false) {
58
-			spip_log("dechiffrer() chiffre corrompu `$encoded`", 'chiffrer' . _LOG_DEBUG);
58
+			spip_log("dechiffrer() chiffre corrompu `$encoded`", 'chiffrer'._LOG_DEBUG);
59 59
 			return null;
60 60
 		}
61 61
 		$message = sodium_unpad($padded_message, 16);
Please login to merge, or discard this patch.
ecrire/lang/spip_it.php 1 patch
Indentation   +669 added lines, -669 removed lines patch added patch discarded remove patch
@@ -4,248 +4,248 @@  discard block
 block discarded – undo
4 4
 // ** ne pas modifier le fichier **
5 5
 
6 6
 if (!defined('_ECRIRE_INC_VERSION')) {
7
-	return;
7
+    return;
8 8
 }
9 9
 
10 10
 $GLOBALS[$GLOBALS['idx_lang']] = array(
11 11
 
12
-	// A
13
-	'access_interface_graphique' => 'Ritorna all’interfaccia grafica completa',
14
-	'access_mode_texte' => 'Visualizza l’interfaccia testuale semplificata',
15
-	'admin_debug' => 'debug',
16
-	'admin_modifier_article' => 'Modifica l’articolo',
17
-	'admin_modifier_auteur' => 'Modifica l’autore',
18
-	'admin_modifier_breve' => 'Modifica la breve',
19
-	'admin_modifier_mot' => 'Modifica la parola chiave',
20
-	'admin_modifier_rubrique' => 'Modifica la rubrica',
21
-	'admin_recalculer' => 'Rigenera la pagina',
22
-	'afficher_calendrier' => 'Mostra il calendario',
23
-	'afficher_trad' => 'visualizzare le traduzioni',
24
-	'alerte_maj_impossible' => '<b>Attenzione!</b> L’aggiornamento del database SQL alla versione @version@ è impossibile, forse a causa di un problema con i diritti di modifica nel database. Contattare il proprio fornitore di hosting.',
25
-	'alerte_modif_info_concourante' => 'ATTENZIONE: Questa informazione è stata modificata altrove. Il valore attuale è:',
26
-	'analyse_xml' => 'Analisi XML',
27
-	'annuler' => 'Annulla',
28
-	'antispam_champ_vide' => 'Si prega di lasciare vuoto questo campo:',
29
-	'articles_recents' => 'Articoli più recenti',
30
-	'attention_champ_mini_nb_caractères' => 'Attenzione! Minimo @nb@ caratteri',
31
-	'avis_1_erreur_saisie' => 'C’è un errore nell’input, verificare le informazioni.',
32
-	'avis_archive_incorrect' => 'il file archivio non è un file SPIP',
33
-	'avis_archive_invalide' => 'il file archivio non è valido',
34
-	'avis_attention' => 'ATTENZIONE!',
35
-	'avis_champ_incorrect_type_objet' => 'Nome di campo errato @name@ per oggetto di tipo @type@',
36
-	'avis_colonne_inexistante' => 'La colonna @col@ non esiste',
37
-	'avis_erreur' => 'Errore: vedi sopra',
38
-	'avis_erreur_connexion' => 'Errore di connessione',
39
-	'avis_erreur_cookie' => 'problema di cookie',
40
-	'avis_erreur_fonction_contexte' => 'Errore di programmazione. Questa funzione non deve essere chiamata in questo contesto.',
41
-	'avis_erreur_mysql' => 'Errore SQL ',
42
-	'avis_erreur_sauvegarde' => 'Errore nel salvataggio (@type@ @id_objet@)! ',
43
-	'avis_erreur_visiteur' => 'Problema di accesso all’area riservata',
44
-	'avis_nb_erreurs_saisie' => 'Ci sono @nb@ errori nell’input, verificare le informazioni.',
12
+    // A
13
+    'access_interface_graphique' => 'Ritorna all’interfaccia grafica completa',
14
+    'access_mode_texte' => 'Visualizza l’interfaccia testuale semplificata',
15
+    'admin_debug' => 'debug',
16
+    'admin_modifier_article' => 'Modifica l’articolo',
17
+    'admin_modifier_auteur' => 'Modifica l’autore',
18
+    'admin_modifier_breve' => 'Modifica la breve',
19
+    'admin_modifier_mot' => 'Modifica la parola chiave',
20
+    'admin_modifier_rubrique' => 'Modifica la rubrica',
21
+    'admin_recalculer' => 'Rigenera la pagina',
22
+    'afficher_calendrier' => 'Mostra il calendario',
23
+    'afficher_trad' => 'visualizzare le traduzioni',
24
+    'alerte_maj_impossible' => '<b>Attenzione!</b> L’aggiornamento del database SQL alla versione @version@ è impossibile, forse a causa di un problema con i diritti di modifica nel database. Contattare il proprio fornitore di hosting.',
25
+    'alerte_modif_info_concourante' => 'ATTENZIONE: Questa informazione è stata modificata altrove. Il valore attuale è:',
26
+    'analyse_xml' => 'Analisi XML',
27
+    'annuler' => 'Annulla',
28
+    'antispam_champ_vide' => 'Si prega di lasciare vuoto questo campo:',
29
+    'articles_recents' => 'Articoli più recenti',
30
+    'attention_champ_mini_nb_caractères' => 'Attenzione! Minimo @nb@ caratteri',
31
+    'avis_1_erreur_saisie' => 'C’è un errore nell’input, verificare le informazioni.',
32
+    'avis_archive_incorrect' => 'il file archivio non è un file SPIP',
33
+    'avis_archive_invalide' => 'il file archivio non è valido',
34
+    'avis_attention' => 'ATTENZIONE!',
35
+    'avis_champ_incorrect_type_objet' => 'Nome di campo errato @name@ per oggetto di tipo @type@',
36
+    'avis_colonne_inexistante' => 'La colonna @col@ non esiste',
37
+    'avis_erreur' => 'Errore: vedi sopra',
38
+    'avis_erreur_connexion' => 'Errore di connessione',
39
+    'avis_erreur_cookie' => 'problema di cookie',
40
+    'avis_erreur_fonction_contexte' => 'Errore di programmazione. Questa funzione non deve essere chiamata in questo contesto.',
41
+    'avis_erreur_mysql' => 'Errore SQL ',
42
+    'avis_erreur_sauvegarde' => 'Errore nel salvataggio (@type@ @id_objet@)! ',
43
+    'avis_erreur_visiteur' => 'Problema di accesso all’area riservata',
44
+    'avis_nb_erreurs_saisie' => 'Ci sono @nb@ errori nell’input, verificare le informazioni.',
45 45
 
46
-	// B
47
-	'barre_a_accent_grave' => 'Inserire una A maiscola con accento grave',
48
-	'barre_aide' => 'Utilizzare le scorciatoie tipografiche di SPIP per migliorare l\\’impaginazione del testo',
49
-	'barre_e_accent_aigu' => 'Inserire una E maiscola con accento acuto',
50
-	'barre_eo' => 'Inserire una E nell’O',
51
-	'barre_eo_maj' => 'Inserire una E nell’O maiuscola',
52
-	'barre_euro' => 'Inserire il simbolo €',
53
-	'barre_gras' => 'Formattare in {{grassetto}}',
54
-	'barre_guillemets' => 'Porre il testo fra « virgolette basse francesi »',
55
-	'barre_guillemets_simples' => 'Porre il testo fra „virgolette“',
56
-	'barre_intertitre' => 'Trasformare in {{{titolo di paragrafo}}}',
57
-	'barre_italic' => 'Formattare in {corsivo}',
58
-	'barre_lien' => 'Trasformare in un [link ipertestuale->http://...]',
59
-	'barre_lien_input' => 'Indicare l’indirizzo del link (è possibile indicare l’indirizzo Web come http://www.ilmiosito.com o semplicemente indicare il numero di un singolo articolo).',
60
-	'barre_note' => 'Trasformare in [[Nota a fondo pagina]]',
61
-	'barre_paragraphe' => 'Crea un paragrafo',
62
-	'barre_quote' => '<quote>Citare un messaggio</quote>',
63
-	'bouton_changer' => 'Cambia',
64
-	'bouton_chercher' => 'Cerca',
65
-	'bouton_choisir' => 'Scegli',
66
-	'bouton_deplacer' => 'Sposta',
67
-	'bouton_download' => 'Download',
68
-	'bouton_enregistrer' => 'Salva',
69
-	'bouton_radio_desactiver_messagerie_interne' => 'Disattiva la messaggistica interna',
70
-	'bouton_radio_envoi_annonces' => 'Invia gli annunci editoriali',
71
-	'bouton_radio_non_envoi_annonces' => 'Non inviare annunci',
72
-	'bouton_radio_non_envoi_liste_nouveautes' => 'Non inviare l’elenco delle novità',
73
-	'bouton_recharger_page' => 'ricaricare questa pagina',
74
-	'bouton_telecharger' => 'Upload',
75
-	'bouton_upload' => 'Upload',
76
-	'bouton_valider' => 'Invia',
46
+    // B
47
+    'barre_a_accent_grave' => 'Inserire una A maiscola con accento grave',
48
+    'barre_aide' => 'Utilizzare le scorciatoie tipografiche di SPIP per migliorare l\\’impaginazione del testo',
49
+    'barre_e_accent_aigu' => 'Inserire una E maiscola con accento acuto',
50
+    'barre_eo' => 'Inserire una E nell’O',
51
+    'barre_eo_maj' => 'Inserire una E nell’O maiuscola',
52
+    'barre_euro' => 'Inserire il simbolo €',
53
+    'barre_gras' => 'Formattare in {{grassetto}}',
54
+    'barre_guillemets' => 'Porre il testo fra « virgolette basse francesi »',
55
+    'barre_guillemets_simples' => 'Porre il testo fra „virgolette“',
56
+    'barre_intertitre' => 'Trasformare in {{{titolo di paragrafo}}}',
57
+    'barre_italic' => 'Formattare in {corsivo}',
58
+    'barre_lien' => 'Trasformare in un [link ipertestuale->http://...]',
59
+    'barre_lien_input' => 'Indicare l’indirizzo del link (è possibile indicare l’indirizzo Web come http://www.ilmiosito.com o semplicemente indicare il numero di un singolo articolo).',
60
+    'barre_note' => 'Trasformare in [[Nota a fondo pagina]]',
61
+    'barre_paragraphe' => 'Crea un paragrafo',
62
+    'barre_quote' => '<quote>Citare un messaggio</quote>',
63
+    'bouton_changer' => 'Cambia',
64
+    'bouton_chercher' => 'Cerca',
65
+    'bouton_choisir' => 'Scegli',
66
+    'bouton_deplacer' => 'Sposta',
67
+    'bouton_download' => 'Download',
68
+    'bouton_enregistrer' => 'Salva',
69
+    'bouton_radio_desactiver_messagerie_interne' => 'Disattiva la messaggistica interna',
70
+    'bouton_radio_envoi_annonces' => 'Invia gli annunci editoriali',
71
+    'bouton_radio_non_envoi_annonces' => 'Non inviare annunci',
72
+    'bouton_radio_non_envoi_liste_nouveautes' => 'Non inviare l’elenco delle novità',
73
+    'bouton_recharger_page' => 'ricaricare questa pagina',
74
+    'bouton_telecharger' => 'Upload',
75
+    'bouton_upload' => 'Upload',
76
+    'bouton_valider' => 'Invia',
77 77
 
78
-	// C
79
-	'cal_apresmidi' => 'pomeriggio',
80
-	'cal_jour_entier' => 'giorno intero',
81
-	'cal_matin' => 'mattina',
82
-	'cal_par_jour' => 'calendario giornaliero',
83
-	'cal_par_mois' => 'calendario mensile',
84
-	'cal_par_semaine' => 'calendario settimanale',
85
-	'choix_couleur_interface' => 'colore',
86
-	'choix_interface' => 'scelta dell’interfaccia',
87
-	'colonne' => 'Colonna',
88
-	'confirm_changer_statut' => 'Attenzione, è stato chiesto di modificare lo status di questo elemento. Continuare?',
89
-	'correcte' => 'corretto',
78
+    // C
79
+    'cal_apresmidi' => 'pomeriggio',
80
+    'cal_jour_entier' => 'giorno intero',
81
+    'cal_matin' => 'mattina',
82
+    'cal_par_jour' => 'calendario giornaliero',
83
+    'cal_par_mois' => 'calendario mensile',
84
+    'cal_par_semaine' => 'calendario settimanale',
85
+    'choix_couleur_interface' => 'colore',
86
+    'choix_interface' => 'scelta dell’interfaccia',
87
+    'colonne' => 'Colonna',
88
+    'confirm_changer_statut' => 'Attenzione, è stato chiesto di modificare lo status di questo elemento. Continuare?',
89
+    'correcte' => 'corretto',
90 90
 
91
-	// D
92
-	'date_aujourdhui' => 'oggi',
93
-	'date_avant_jc' => 'a.C.',
94
-	'date_dans' => 'tra @delai@',
95
-	'date_de_mois_1' => '@j@ gennaio',
96
-	'date_de_mois_10' => '@j@ ottobre',
97
-	'date_de_mois_11' => '@j@ novembre',
98
-	'date_de_mois_12' => '@j@ dicembre',
99
-	'date_de_mois_2' => '@j@ febbraio',
100
-	'date_de_mois_3' => '@j@ marzo',
101
-	'date_de_mois_4' => '@j@ aprile',
102
-	'date_de_mois_5' => '@j@ maggio',
103
-	'date_de_mois_6' => '@j@ giugno',
104
-	'date_de_mois_7' => '@j@ luglio',
105
-	'date_de_mois_8' => '@j@ agosto',
106
-	'date_de_mois_9' => '@j@ settembre',
107
-	'date_demain' => 'domani',
108
-	'date_fmt_heures_minutes' => '@h@:@m@',
109
-	'date_fmt_heures_minutes_court' => '@h@h@m@',
110
-	'date_fmt_jour' => '@nomjour@ @jour@',
111
-	'date_fmt_jour_heure' => '@jour@ ore @heure@',
112
-	'date_fmt_jour_heure_debut_fin' => 'Il @jour@ dalle @heure_debut@ alle @heure_fin@',
113
-	'date_fmt_jour_heure_debut_fin_abbr' => 'Il @dtstart@@jour@ dalle @heure_debut@@dtabbr@ alle @dtstart@@heure_fin@@dtend@',
114
-	'date_fmt_jour_mois' => '@jourmois@',
115
-	'date_fmt_jour_mois_annee' => '@jourmois@ @annee@',
116
-	'date_fmt_mois_annee' => '@nommois@ @annee@',
117
-	'date_fmt_nomjour' => '@nomjour@ @date@',
118
-	'date_fmt_nomjour_date' => 'il @nomjour@ @date@',
119
-	'date_fmt_periode' => 'Dal @date_debut@ al @date_fin@',
120
-	'date_fmt_periode_abbr' => 'Dal @dtart@@date_debut@@dtabbr@ al @dtend@@date_fin@@dtabbr@',
121
-	'date_fmt_periode_from' => 'Dal',
122
-	'date_fmt_periode_to' => 'a',
123
-	'date_fmt_saison_annee' => '@saison@ @annee@',
124
-	'date_heures' => 'ore',
125
-	'date_hier' => 'ieri',
126
-	'date_il_y_a' => '@delai@ fa',
127
-	'date_jnum1' => '1',
128
-	'date_jnum10' => '10',
129
-	'date_jnum11' => '11',
130
-	'date_jnum12' => '12',
131
-	'date_jnum13' => '13',
132
-	'date_jnum14' => '14',
133
-	'date_jnum15' => '15',
134
-	'date_jnum16' => '16',
135
-	'date_jnum17' => '17',
136
-	'date_jnum18' => '18',
137
-	'date_jnum19' => '19',
138
-	'date_jnum2' => '2',
139
-	'date_jnum20' => '20',
140
-	'date_jnum21' => '21',
141
-	'date_jnum22' => '22',
142
-	'date_jnum23' => '23',
143
-	'date_jnum24' => '24',
144
-	'date_jnum25' => '25',
145
-	'date_jnum26' => '26',
146
-	'date_jnum27' => '27',
147
-	'date_jnum28' => '28',
148
-	'date_jnum29' => '29',
149
-	'date_jnum3' => '3',
150
-	'date_jnum30' => '30',
151
-	'date_jnum31' => '31',
152
-	'date_jnum4' => '4',
153
-	'date_jnum5' => '5',
154
-	'date_jnum6' => '6',
155
-	'date_jnum7' => '7',
156
-	'date_jnum8' => '8',
157
-	'date_jnum9' => '9',
158
-	'date_jour_1' => 'domenica',
159
-	'date_jour_1_abbr' => 'dom',
160
-	'date_jour_1_initiale' => 'd',
161
-	'date_jour_2' => 'lunedì',
162
-	'date_jour_2_abbr' => 'lun',
163
-	'date_jour_2_initiale' => 'l',
164
-	'date_jour_3' => 'martedì',
165
-	'date_jour_3_abbr' => 'mar',
166
-	'date_jour_3_initiale' => 'm',
167
-	'date_jour_4' => 'mercoledì',
168
-	'date_jour_4_abbr' => 'mer',
169
-	'date_jour_4_initiale' => 'm',
170
-	'date_jour_5' => 'giovedì',
171
-	'date_jour_5_abbr' => 'giov',
172
-	'date_jour_5_initiale' => 'g',
173
-	'date_jour_6' => 'venerdì',
174
-	'date_jour_6_abbr' => 'ven',
175
-	'date_jour_6_initiale' => 'v',
176
-	'date_jour_7' => 'sabato',
177
-	'date_jour_7_abbr' => 'sab',
178
-	'date_jour_7_initiale' => 's',
179
-	'date_jours' => 'giorni',
180
-	'date_minutes' => 'minuti',
181
-	'date_mois' => 'mesi',
182
-	'date_mois_1' => 'Gennaio',
183
-	'date_mois_10' => 'Ottobre',
184
-	'date_mois_10_abbr' => 'ott',
185
-	'date_mois_11' => 'Novembre',
186
-	'date_mois_11_abbr' => 'nov',
187
-	'date_mois_12' => 'Dicembre',
188
-	'date_mois_12_abbr' => 'dic',
189
-	'date_mois_1_abbr' => 'gen',
190
-	'date_mois_2' => 'Febbraio',
191
-	'date_mois_2_abbr' => 'feb',
192
-	'date_mois_3' => 'Marzo',
193
-	'date_mois_3_abbr' => 'mar',
194
-	'date_mois_4' => 'Aprile',
195
-	'date_mois_4_abbr' => 'apr',
196
-	'date_mois_5' => 'Maggio',
197
-	'date_mois_5_abbr' => 'mag',
198
-	'date_mois_6' => 'Giugno',
199
-	'date_mois_6_abbr' => 'giu',
200
-	'date_mois_7' => 'Luglio',
201
-	'date_mois_7_abbr' => 'lug',
202
-	'date_mois_8' => 'Agosto',
203
-	'date_mois_8_abbr' => 'ago',
204
-	'date_mois_9' => 'Settembre',
205
-	'date_mois_9_abbr' => 'set',
206
-	'date_saison_1' => 'inverno',
207
-	'date_saison_2' => 'primavera',
208
-	'date_saison_3' => 'estate',
209
-	'date_saison_4' => 'autunno',
210
-	'date_secondes' => 'secondi',
211
-	'date_semaines' => 'settimane',
212
-	'date_un_mois' => 'mese',
213
-	'date_une_heure' => 'ora',
214
-	'date_une_minute' => 'minuto',
215
-	'date_une_seconde' => 'secondo',
216
-	'date_une_semaine' => 'settimana',
217
-	'dirs_commencer' => ' per iniziare realmente l’installazione',
218
-	'dirs_preliminaire' => 'Prima di iniziare: <b>impostare i diritti di accesso</b>',
219
-	'dirs_probleme_droits' => 'Problema nei diritti di accesso',
220
-	'dirs_repertoires_absents' => '<p><b>Le seguenti cartelle non sono state trovate: </b></p><ul>@bad_dirs@.</ul>
91
+    // D
92
+    'date_aujourdhui' => 'oggi',
93
+    'date_avant_jc' => 'a.C.',
94
+    'date_dans' => 'tra @delai@',
95
+    'date_de_mois_1' => '@j@ gennaio',
96
+    'date_de_mois_10' => '@j@ ottobre',
97
+    'date_de_mois_11' => '@j@ novembre',
98
+    'date_de_mois_12' => '@j@ dicembre',
99
+    'date_de_mois_2' => '@j@ febbraio',
100
+    'date_de_mois_3' => '@j@ marzo',
101
+    'date_de_mois_4' => '@j@ aprile',
102
+    'date_de_mois_5' => '@j@ maggio',
103
+    'date_de_mois_6' => '@j@ giugno',
104
+    'date_de_mois_7' => '@j@ luglio',
105
+    'date_de_mois_8' => '@j@ agosto',
106
+    'date_de_mois_9' => '@j@ settembre',
107
+    'date_demain' => 'domani',
108
+    'date_fmt_heures_minutes' => '@h@:@m@',
109
+    'date_fmt_heures_minutes_court' => '@h@h@m@',
110
+    'date_fmt_jour' => '@nomjour@ @jour@',
111
+    'date_fmt_jour_heure' => '@jour@ ore @heure@',
112
+    'date_fmt_jour_heure_debut_fin' => 'Il @jour@ dalle @heure_debut@ alle @heure_fin@',
113
+    'date_fmt_jour_heure_debut_fin_abbr' => 'Il @dtstart@@jour@ dalle @heure_debut@@dtabbr@ alle @dtstart@@heure_fin@@dtend@',
114
+    'date_fmt_jour_mois' => '@jourmois@',
115
+    'date_fmt_jour_mois_annee' => '@jourmois@ @annee@',
116
+    'date_fmt_mois_annee' => '@nommois@ @annee@',
117
+    'date_fmt_nomjour' => '@nomjour@ @date@',
118
+    'date_fmt_nomjour_date' => 'il @nomjour@ @date@',
119
+    'date_fmt_periode' => 'Dal @date_debut@ al @date_fin@',
120
+    'date_fmt_periode_abbr' => 'Dal @dtart@@date_debut@@dtabbr@ al @dtend@@date_fin@@dtabbr@',
121
+    'date_fmt_periode_from' => 'Dal',
122
+    'date_fmt_periode_to' => 'a',
123
+    'date_fmt_saison_annee' => '@saison@ @annee@',
124
+    'date_heures' => 'ore',
125
+    'date_hier' => 'ieri',
126
+    'date_il_y_a' => '@delai@ fa',
127
+    'date_jnum1' => '1',
128
+    'date_jnum10' => '10',
129
+    'date_jnum11' => '11',
130
+    'date_jnum12' => '12',
131
+    'date_jnum13' => '13',
132
+    'date_jnum14' => '14',
133
+    'date_jnum15' => '15',
134
+    'date_jnum16' => '16',
135
+    'date_jnum17' => '17',
136
+    'date_jnum18' => '18',
137
+    'date_jnum19' => '19',
138
+    'date_jnum2' => '2',
139
+    'date_jnum20' => '20',
140
+    'date_jnum21' => '21',
141
+    'date_jnum22' => '22',
142
+    'date_jnum23' => '23',
143
+    'date_jnum24' => '24',
144
+    'date_jnum25' => '25',
145
+    'date_jnum26' => '26',
146
+    'date_jnum27' => '27',
147
+    'date_jnum28' => '28',
148
+    'date_jnum29' => '29',
149
+    'date_jnum3' => '3',
150
+    'date_jnum30' => '30',
151
+    'date_jnum31' => '31',
152
+    'date_jnum4' => '4',
153
+    'date_jnum5' => '5',
154
+    'date_jnum6' => '6',
155
+    'date_jnum7' => '7',
156
+    'date_jnum8' => '8',
157
+    'date_jnum9' => '9',
158
+    'date_jour_1' => 'domenica',
159
+    'date_jour_1_abbr' => 'dom',
160
+    'date_jour_1_initiale' => 'd',
161
+    'date_jour_2' => 'lunedì',
162
+    'date_jour_2_abbr' => 'lun',
163
+    'date_jour_2_initiale' => 'l',
164
+    'date_jour_3' => 'martedì',
165
+    'date_jour_3_abbr' => 'mar',
166
+    'date_jour_3_initiale' => 'm',
167
+    'date_jour_4' => 'mercoledì',
168
+    'date_jour_4_abbr' => 'mer',
169
+    'date_jour_4_initiale' => 'm',
170
+    'date_jour_5' => 'giovedì',
171
+    'date_jour_5_abbr' => 'giov',
172
+    'date_jour_5_initiale' => 'g',
173
+    'date_jour_6' => 'venerdì',
174
+    'date_jour_6_abbr' => 'ven',
175
+    'date_jour_6_initiale' => 'v',
176
+    'date_jour_7' => 'sabato',
177
+    'date_jour_7_abbr' => 'sab',
178
+    'date_jour_7_initiale' => 's',
179
+    'date_jours' => 'giorni',
180
+    'date_minutes' => 'minuti',
181
+    'date_mois' => 'mesi',
182
+    'date_mois_1' => 'Gennaio',
183
+    'date_mois_10' => 'Ottobre',
184
+    'date_mois_10_abbr' => 'ott',
185
+    'date_mois_11' => 'Novembre',
186
+    'date_mois_11_abbr' => 'nov',
187
+    'date_mois_12' => 'Dicembre',
188
+    'date_mois_12_abbr' => 'dic',
189
+    'date_mois_1_abbr' => 'gen',
190
+    'date_mois_2' => 'Febbraio',
191
+    'date_mois_2_abbr' => 'feb',
192
+    'date_mois_3' => 'Marzo',
193
+    'date_mois_3_abbr' => 'mar',
194
+    'date_mois_4' => 'Aprile',
195
+    'date_mois_4_abbr' => 'apr',
196
+    'date_mois_5' => 'Maggio',
197
+    'date_mois_5_abbr' => 'mag',
198
+    'date_mois_6' => 'Giugno',
199
+    'date_mois_6_abbr' => 'giu',
200
+    'date_mois_7' => 'Luglio',
201
+    'date_mois_7_abbr' => 'lug',
202
+    'date_mois_8' => 'Agosto',
203
+    'date_mois_8_abbr' => 'ago',
204
+    'date_mois_9' => 'Settembre',
205
+    'date_mois_9_abbr' => 'set',
206
+    'date_saison_1' => 'inverno',
207
+    'date_saison_2' => 'primavera',
208
+    'date_saison_3' => 'estate',
209
+    'date_saison_4' => 'autunno',
210
+    'date_secondes' => 'secondi',
211
+    'date_semaines' => 'settimane',
212
+    'date_un_mois' => 'mese',
213
+    'date_une_heure' => 'ora',
214
+    'date_une_minute' => 'minuto',
215
+    'date_une_seconde' => 'secondo',
216
+    'date_une_semaine' => 'settimana',
217
+    'dirs_commencer' => ' per iniziare realmente l’installazione',
218
+    'dirs_preliminaire' => 'Prima di iniziare: <b>impostare i diritti di accesso</b>',
219
+    'dirs_probleme_droits' => 'Problema nei diritti di accesso',
220
+    'dirs_repertoires_absents' => '<p><b>Le seguenti cartelle non sono state trovate: </b></p><ul>@bad_dirs@.</ul>
221 221
   <p>Probabilmente ciò è dovuto a un’errata formattazione delle lettere maiuscole o minuscole.
222 222
   Verificare che le maiuscole e le minuscole delle cartelle coincidano con quelle visualizzate
223 223
   qui sopra; se non è così, rinominare le cartelle utilizzando il software FTP.</p>
224 224
   <p>Una volta effettuata questa correzione, si potrà',
225
-	'dirs_repertoires_suivants' => '<p><b>Le seguenti cartelle non sono accessibili in scrittura:</b></p> <ul>@bad_dirs@</ul>
225
+    'dirs_repertoires_suivants' => '<p><b>Le seguenti cartelle non sono accessibili in scrittura:</b></p> <ul>@bad_dirs@</ul>
226 226
 <p>Per risolvere il problema, utilizzare un client FTP per impostare i diritti di accesso
227 227
 di ciascuna di queste cartelle. La procedura è spiegata in dettaglio nella guida d’installazione.</p>
228 228
 <p>Una volta attribuiti i permessi, si potrà ',
229
-	'double_occurrence' => 'Doppia occorrenza',
229
+    'double_occurrence' => 'Doppia occorrenza',
230 230
 
231
-	// E
232
-	'en_cours' => 'in corso',
233
-	'envoi_via_le_site' => 'Invio tramite il sito',
234
-	'erreur' => 'Errore',
235
-	'erreur_balise_non_fermee' => 'ultimo tag non chiuso:',
236
-	'erreur_technique_ajaxform' => 'Ops. Un’errore inaspettato non ti consente di inviare il form. Puoi provare di nuovo.',
237
-	'erreur_technique_enregistrement_champs' => 'Un errore tecnico ha impedito la corretta registrazione del campo @champs@.',
238
-	'erreur_technique_enregistrement_impossible' => 'Un errore tecnico ha impedito la registrazione.',
239
-	'erreur_texte' => 'errore/i',
240
-	'etape' => 'Fase',
231
+    // E
232
+    'en_cours' => 'in corso',
233
+    'envoi_via_le_site' => 'Invio tramite il sito',
234
+    'erreur' => 'Errore',
235
+    'erreur_balise_non_fermee' => 'ultimo tag non chiuso:',
236
+    'erreur_technique_ajaxform' => 'Ops. Un’errore inaspettato non ti consente di inviare il form. Puoi provare di nuovo.',
237
+    'erreur_technique_enregistrement_champs' => 'Un errore tecnico ha impedito la corretta registrazione del campo @champs@.',
238
+    'erreur_technique_enregistrement_impossible' => 'Un errore tecnico ha impedito la registrazione.',
239
+    'erreur_texte' => 'errore/i',
240
+    'etape' => 'Fase',
241 241
 
242
-	// F
243
-	'fichier_introuvable' => 'File @fichier@ non trovato',
244
-	'fonction_introuvable' => 'Funzione @fonction@() non trovata',
245
-	'form_auteur_confirmation' => 'Per cortesia conferma il tuo indirizzo email',
246
-	'form_auteur_email_modifie' => 'Il tuo indirizzo email è stato modificato',
247
-	'form_auteur_envoi_mail_confirmation' => 'Una email di conferma è stata inviata a  @email@. È necessario visitare l’URL indicata nel messaggio per convalidare il tuo indirizzo email.',
248
-	'form_auteur_mail_confirmation' => 'Ciao,
242
+    // F
243
+    'fichier_introuvable' => 'File @fichier@ non trovato',
244
+    'fonction_introuvable' => 'Funzione @fonction@() non trovata',
245
+    'form_auteur_confirmation' => 'Per cortesia conferma il tuo indirizzo email',
246
+    'form_auteur_email_modifie' => 'Il tuo indirizzo email è stato modificato',
247
+    'form_auteur_envoi_mail_confirmation' => 'Una email di conferma è stata inviata a  @email@. È necessario visitare l’URL indicata nel messaggio per convalidare il tuo indirizzo email.',
248
+    'form_auteur_mail_confirmation' => 'Ciao,
249 249
 
250 250
 Hai chiesto di modificare l’indirizzo email.
251 251
 Per confermare la tua nuova email, devi connetterti all’
@@ -253,346 +253,346 @@  discard block
 block discarded – undo
253 253
 
254 254
     @url@
255 255
 ',
256
-	'form_deja_inscrit' => 'Sei già iscritto.',
257
-	'form_email_non_valide' => 'L’indirizzo email non è valido.',
258
-	'form_forum_access_refuse' => 'Non hai più accesso a questo sito.',
259
-	'form_forum_bonjour' => 'Buongiorno @nom@,',
260
-	'form_forum_confirmer_email' => 'Puoi confermare il tuo indirizzo email,vai a questo indirizzo: @url_confirm@',
261
-	'form_forum_email_deja_enregistre' => 'Questo indirizzo email è già registrato, puoi dunque utilizzare la tua password abituale.',
262
-	'form_forum_identifiant_mail' => 'Il nuovo codice identificativo (ID) ti è stato appena inviato tramite email.',
263
-	'form_forum_identifiants' => 'Dati personali',
264
-	'form_forum_indiquer_nom_email' => 'Indica qui nome e indirizzo email.  L’ID personale ti verrà recapitato tramite email a breve.',
265
-	'form_forum_login' => 'login:',
266
-	'form_forum_message_auto' => '(questo è un messaggio generato automaticamente)',
267
-	'form_forum_pass' => 'password:',
268
-	'form_forum_probleme_mail' => 'Problema di posta: l’ID non può essere inviato.',
269
-	'form_forum_voici1' => 'Ecco i dati per poter partecipare ai forum
256
+    'form_deja_inscrit' => 'Sei già iscritto.',
257
+    'form_email_non_valide' => 'L’indirizzo email non è valido.',
258
+    'form_forum_access_refuse' => 'Non hai più accesso a questo sito.',
259
+    'form_forum_bonjour' => 'Buongiorno @nom@,',
260
+    'form_forum_confirmer_email' => 'Puoi confermare il tuo indirizzo email,vai a questo indirizzo: @url_confirm@',
261
+    'form_forum_email_deja_enregistre' => 'Questo indirizzo email è già registrato, puoi dunque utilizzare la tua password abituale.',
262
+    'form_forum_identifiant_mail' => 'Il nuovo codice identificativo (ID) ti è stato appena inviato tramite email.',
263
+    'form_forum_identifiants' => 'Dati personali',
264
+    'form_forum_indiquer_nom_email' => 'Indica qui nome e indirizzo email.  L’ID personale ti verrà recapitato tramite email a breve.',
265
+    'form_forum_login' => 'login:',
266
+    'form_forum_message_auto' => '(questo è un messaggio generato automaticamente)',
267
+    'form_forum_pass' => 'password:',
268
+    'form_forum_probleme_mail' => 'Problema di posta: l’ID non può essere inviato.',
269
+    'form_forum_voici1' => 'Ecco i dati per poter partecipare ai forum
270 270
  del sito"@nom_site_spip@" (@adresse_site@):',
271
-	'form_forum_voici2' => 'Ecco i dati per poter proporre degli articoli sul sito
271
+    'form_forum_voici2' => 'Ecco i dati per poter proporre degli articoli sul sito
272 272
 "@nom_site_spip@" (@adresse_login@):',
273
-	'form_indiquer_email' => 'Indica il tuo indirizzo email.',
274
-	'form_indiquer_nom' => 'Indica il tuo nome.',
275
-	'form_indiquer_nom_site' => 'Indica il nome del tuo sito.',
276
-	'form_pet_deja_enregistre' => 'Questo sito è già registrato',
277
-	'form_pet_signature_pasprise' => 'La tua adesione non è stata presa in considerazione.',
278
-	'form_prop_confirmer_envoi' => 'Conferma l’invio',
279
-	'form_prop_description' => 'Descrizione/commento',
280
-	'form_prop_enregistre' => 'La tua proposta è stata registrata ed apparirà on line dopo l’approvazione del responsabile del sito.',
281
-	'form_prop_envoyer' => 'Invia un messaggio',
282
-	'form_prop_indiquer_email' => 'Indica un indirizzo email valido',
283
-	'form_prop_indiquer_nom_site' => 'Indica il nome del sito.',
284
-	'form_prop_indiquer_sujet' => 'Indica un argomento',
285
-	'form_prop_message_envoye' => 'Messaggio inviato',
286
-	'form_prop_non_enregistre' => 'La tua proposta non è stata registrata.',
287
-	'form_prop_sujet' => 'Argomento',
288
-	'form_prop_url_site' => 'Indirizzo (URL) del sito',
289
-	'format_date_attendu' => 'Inserire una data nel formato gg/mm/aaaa.',
290
-	'format_date_incorrecte' => 'La data (o il suo formato) non è corretta',
291
-	'format_heure_attendu' => 'Inserire un’ora nel formato hh:mm.',
292
-	'format_heure_incorrecte' => 'L’ora (o il suo formato) non è corretta',
293
-	'forum_non_inscrit' => 'Non sei iscritto, oppure l’indirizzo o la password inseriti non sono corretti.',
294
-	'forum_par_auteur' => 'di @auteur@',
295
-	'forum_titre_erreur' => 'Errore...',
273
+    'form_indiquer_email' => 'Indica il tuo indirizzo email.',
274
+    'form_indiquer_nom' => 'Indica il tuo nome.',
275
+    'form_indiquer_nom_site' => 'Indica il nome del tuo sito.',
276
+    'form_pet_deja_enregistre' => 'Questo sito è già registrato',
277
+    'form_pet_signature_pasprise' => 'La tua adesione non è stata presa in considerazione.',
278
+    'form_prop_confirmer_envoi' => 'Conferma l’invio',
279
+    'form_prop_description' => 'Descrizione/commento',
280
+    'form_prop_enregistre' => 'La tua proposta è stata registrata ed apparirà on line dopo l’approvazione del responsabile del sito.',
281
+    'form_prop_envoyer' => 'Invia un messaggio',
282
+    'form_prop_indiquer_email' => 'Indica un indirizzo email valido',
283
+    'form_prop_indiquer_nom_site' => 'Indica il nome del sito.',
284
+    'form_prop_indiquer_sujet' => 'Indica un argomento',
285
+    'form_prop_message_envoye' => 'Messaggio inviato',
286
+    'form_prop_non_enregistre' => 'La tua proposta non è stata registrata.',
287
+    'form_prop_sujet' => 'Argomento',
288
+    'form_prop_url_site' => 'Indirizzo (URL) del sito',
289
+    'format_date_attendu' => 'Inserire una data nel formato gg/mm/aaaa.',
290
+    'format_date_incorrecte' => 'La data (o il suo formato) non è corretta',
291
+    'format_heure_attendu' => 'Inserire un’ora nel formato hh:mm.',
292
+    'format_heure_incorrecte' => 'L’ora (o il suo formato) non è corretta',
293
+    'forum_non_inscrit' => 'Non sei iscritto, oppure l’indirizzo o la password inseriti non sono corretti.',
294
+    'forum_par_auteur' => 'di @auteur@',
295
+    'forum_titre_erreur' => 'Errore...',
296 296
 
297
-	// I
298
-	'ical_texte_rss_articles' => 'Il file di "backend" degli articoli di questo sito si trova al seguente indirizzo:',
299
-	'ical_texte_rss_articles2' => 'È anche possibile ottenere un file di "backend" per gli articoli di una singola rubrica:',
300
-	'ical_texte_rss_breves' => 'Inoltre esiste un file per l’insieme delle brevi del sito. Precisando un numero di rubrica ci si può limitare alle brevi in essa contenute.',
301
-	'icone_a_suivre' => 'Pannello di controllo',
302
-	'icone_admin_site' => 'Amministrazione del sito',
303
-	'icone_agenda' => 'Agenda',
304
-	'icone_aide_ligne' => 'Guida in linea',
305
-	'icone_articles' => 'Articoli',
306
-	'icone_auteurs' => 'Autori',
307
-	'icone_brouteur' => 'Navigazione rapida',
308
-	'icone_configuration_site' => 'Configurazione del sito',
309
-	'icone_configurer_site' => 'Configura il sito',
310
-	'icone_creer_nouvel_auteur' => 'Crea un nuovo autore',
311
-	'icone_creer_rubrique' => 'Crea una rubrica',
312
-	'icone_creer_sous_rubrique' => 'Crea una sottorubrica',
313
-	'icone_deconnecter' => 'Esci',
314
-	'icone_discussions' => 'Discussioni',
315
-	'icone_doc_rubrique' => 'Documenti delle rubriche',
316
-	'icone_ecrire_article' => 'Scrivi un articolo',
317
-	'icone_edition_site' => 'Redazione del sito',
318
-	'icone_gestion_langues' => 'Gestione delle lingue',
319
-	'icone_informations_personnelles' => 'Dati personali',
320
-	'icone_interface_complet' => 'Interfaccia completa',
321
-	'icone_interface_simple' => 'Interfaccia semplificata',
322
-	'icone_maintenance_site' => 'Manutenzione tecnica',
323
-	'icone_messagerie_personnelle' => 'Messaggi personali',
324
-	'icone_repartition_debut' => 'Mostra la ripartizione dall’inizio',
325
-	'icone_rubriques' => 'Rubriche',
326
-	'icone_sauver_site' => 'Backup del sito',
327
-	'icone_site_entier' => 'Tutto il sito',
328
-	'icone_sites_references' => 'Siti repertoriati',
329
-	'icone_statistiques' => 'Statistiche del sito',
330
-	'icone_suivi_activite' => 'Monitorare l’attività del sito',
331
-	'icone_suivi_actualite' => 'Evoluzione del sito',
332
-	'icone_suivi_pettions' => 'Gestione delle petizioni',
333
-	'icone_suivi_revisions' => 'Modifiche agli articoli',
334
-	'icone_supprimer_document' => 'Elimina il documento',
335
-	'icone_supprimer_image' => 'Elimina l’immagine',
336
-	'icone_tous_articles' => 'Tutti i tuoi articoli',
337
-	'icone_tous_auteur' => 'Tutti gli autori',
338
-	'icone_tous_visiteur' => 'Tutti i visitatori',
339
-	'icone_visiter_site' => 'Visita il sito',
340
-	'icone_voir_en_ligne' => 'Vedi on line',
341
-	'img_indisponible' => 'immagine non disponibile',
342
-	'impossible' => 'impossibile',
343
-	'info_a_suivre' => 'PANNELLO DI CONTROLLO »',
344
-	'info_acces_interdit' => 'Accesso vietato',
345
-	'info_acces_refuse' => 'Accesso rifiutato',
346
-	'info_action' => 'Azione: @action@',
347
-	'info_administrer_rubriques' => 'Puoi amministrare questa rubrica e le relative sottorubriche',
348
-	'info_adresse_non_indiquee' => 'Non hai indicato l’indirizzo da testare!',
349
-	'info_aide' => 'AIUTO:',
350
-	'info_ajouter_mot' => 'Aggiungi questa parola',
351
-	'info_annonce' => 'ANNUNCIO',
352
-	'info_annonces_generales' => 'Annunci generali:',
353
-	'info_article_propose' => 'Articolo proposto',
354
-	'info_article_publie' => 'Articolo pubblicato',
355
-	'info_article_redaction' => 'Articolo in corso di redazione',
356
-	'info_article_refuse' => 'Articolo rifiutato',
357
-	'info_article_supprime' => 'Articolo eliminato',
358
-	'info_articles' => 'Articoli',
359
-	'info_articles_a_valider' => 'Articoli da convalidare',
360
-	'info_articles_nb' => '@nb@ articoli',
361
-	'info_articles_proposes' => 'Articoli proposti',
362
-	'info_articles_un' => '1 articolo',
363
-	'info_auteurs_nombre' => 'autore(i):',
364
-	'info_authentification_ftp' => 'Autenticazione (via FTP).',
365
-	'info_breves_2' => 'brevi',
366
-	'info_breves_nb' => '@nb@ notizie',
367
-	'info_breves_un' => '1 notizia',
368
-	'info_connexion_refusee' => 'Connessione rifiutata',
369
-	'info_contact_developpeur' => 'Contatta un programmatore.',
370
-	'info_contenance' => 'Questo sito contiene:',
371
-	'info_contribution' => 'contributi dei forum',
372
-	'info_copyright' => '@spip@ è un software libero distribuito @lien_gpl@.',
373
-	'info_copyright_doc' => 'Per maggiori informazioni, vedi il sito <a href="@spipnet@">@spipnet_affiche@</a>.',
374
-	'info_copyright_gpl' => 'sotto licenza GPL',
375
-	'info_cours_edition' => 'Articoli in fase di redazione',
376
-	'info_creer_repertoire' => 'Creare un file o una cartella chiamata:',
377
-	'info_creer_repertoire_2' => 'all’interno della sottocartella <b>@repertoire@</b>, poi:',
378
-	'info_creer_vignette' => 'creazione automatica dell’anteprima',
379
-	'info_creerdansrubrique_non_autorise' => 'Non si dispone di diritti sufficienti per creare contenuti in questa rubrica',
380
-	'info_deplier' => 'Espandi',
381
-	'info_descriptif_nombre' => 'descrizione(i):',
382
-	'info_description' => 'Descrizione:',
383
-	'info_description_2' => 'Descrizione:',
384
-	'info_dimension' => 'Dimensioni:',
385
-	'info_documents_nb' => '@nb@ documenti',
386
-	'info_documents_un' => '1 documento',
387
-	'info_ecire_message_prive' => 'Scrivi un messaggio privato',
388
-	'info_email_invalide' => 'Indirizzo email non valido.',
389
-	'info_en_cours_validation' => 'I tuoi articoli in corso di redazione',
390
-	'info_en_ligne' => 'Attualmente on line:',
391
-	'info_envoyer_message_prive' => 'Invia un messaggio privato a questo autore',
392
-	'info_erreur_requete' => 'Errore nella richiesta: ',
393
-	'info_erreur_squelette2' => 'Nessun modello di layout <b>@fichier@</b> trovato...',
394
-	'info_erreur_systeme' => 'Errore di sistema (errno @errsys@)',
395
-	'info_erreur_systeme2' => 'Il disco rigido potrebbe essere pieno o la base dati danneggiata.<br />
297
+    // I
298
+    'ical_texte_rss_articles' => 'Il file di "backend" degli articoli di questo sito si trova al seguente indirizzo:',
299
+    'ical_texte_rss_articles2' => 'È anche possibile ottenere un file di "backend" per gli articoli di una singola rubrica:',
300
+    'ical_texte_rss_breves' => 'Inoltre esiste un file per l’insieme delle brevi del sito. Precisando un numero di rubrica ci si può limitare alle brevi in essa contenute.',
301
+    'icone_a_suivre' => 'Pannello di controllo',
302
+    'icone_admin_site' => 'Amministrazione del sito',
303
+    'icone_agenda' => 'Agenda',
304
+    'icone_aide_ligne' => 'Guida in linea',
305
+    'icone_articles' => 'Articoli',
306
+    'icone_auteurs' => 'Autori',
307
+    'icone_brouteur' => 'Navigazione rapida',
308
+    'icone_configuration_site' => 'Configurazione del sito',
309
+    'icone_configurer_site' => 'Configura il sito',
310
+    'icone_creer_nouvel_auteur' => 'Crea un nuovo autore',
311
+    'icone_creer_rubrique' => 'Crea una rubrica',
312
+    'icone_creer_sous_rubrique' => 'Crea una sottorubrica',
313
+    'icone_deconnecter' => 'Esci',
314
+    'icone_discussions' => 'Discussioni',
315
+    'icone_doc_rubrique' => 'Documenti delle rubriche',
316
+    'icone_ecrire_article' => 'Scrivi un articolo',
317
+    'icone_edition_site' => 'Redazione del sito',
318
+    'icone_gestion_langues' => 'Gestione delle lingue',
319
+    'icone_informations_personnelles' => 'Dati personali',
320
+    'icone_interface_complet' => 'Interfaccia completa',
321
+    'icone_interface_simple' => 'Interfaccia semplificata',
322
+    'icone_maintenance_site' => 'Manutenzione tecnica',
323
+    'icone_messagerie_personnelle' => 'Messaggi personali',
324
+    'icone_repartition_debut' => 'Mostra la ripartizione dall’inizio',
325
+    'icone_rubriques' => 'Rubriche',
326
+    'icone_sauver_site' => 'Backup del sito',
327
+    'icone_site_entier' => 'Tutto il sito',
328
+    'icone_sites_references' => 'Siti repertoriati',
329
+    'icone_statistiques' => 'Statistiche del sito',
330
+    'icone_suivi_activite' => 'Monitorare l’attività del sito',
331
+    'icone_suivi_actualite' => 'Evoluzione del sito',
332
+    'icone_suivi_pettions' => 'Gestione delle petizioni',
333
+    'icone_suivi_revisions' => 'Modifiche agli articoli',
334
+    'icone_supprimer_document' => 'Elimina il documento',
335
+    'icone_supprimer_image' => 'Elimina l’immagine',
336
+    'icone_tous_articles' => 'Tutti i tuoi articoli',
337
+    'icone_tous_auteur' => 'Tutti gli autori',
338
+    'icone_tous_visiteur' => 'Tutti i visitatori',
339
+    'icone_visiter_site' => 'Visita il sito',
340
+    'icone_voir_en_ligne' => 'Vedi on line',
341
+    'img_indisponible' => 'immagine non disponibile',
342
+    'impossible' => 'impossibile',
343
+    'info_a_suivre' => 'PANNELLO DI CONTROLLO »',
344
+    'info_acces_interdit' => 'Accesso vietato',
345
+    'info_acces_refuse' => 'Accesso rifiutato',
346
+    'info_action' => 'Azione: @action@',
347
+    'info_administrer_rubriques' => 'Puoi amministrare questa rubrica e le relative sottorubriche',
348
+    'info_adresse_non_indiquee' => 'Non hai indicato l’indirizzo da testare!',
349
+    'info_aide' => 'AIUTO:',
350
+    'info_ajouter_mot' => 'Aggiungi questa parola',
351
+    'info_annonce' => 'ANNUNCIO',
352
+    'info_annonces_generales' => 'Annunci generali:',
353
+    'info_article_propose' => 'Articolo proposto',
354
+    'info_article_publie' => 'Articolo pubblicato',
355
+    'info_article_redaction' => 'Articolo in corso di redazione',
356
+    'info_article_refuse' => 'Articolo rifiutato',
357
+    'info_article_supprime' => 'Articolo eliminato',
358
+    'info_articles' => 'Articoli',
359
+    'info_articles_a_valider' => 'Articoli da convalidare',
360
+    'info_articles_nb' => '@nb@ articoli',
361
+    'info_articles_proposes' => 'Articoli proposti',
362
+    'info_articles_un' => '1 articolo',
363
+    'info_auteurs_nombre' => 'autore(i):',
364
+    'info_authentification_ftp' => 'Autenticazione (via FTP).',
365
+    'info_breves_2' => 'brevi',
366
+    'info_breves_nb' => '@nb@ notizie',
367
+    'info_breves_un' => '1 notizia',
368
+    'info_connexion_refusee' => 'Connessione rifiutata',
369
+    'info_contact_developpeur' => 'Contatta un programmatore.',
370
+    'info_contenance' => 'Questo sito contiene:',
371
+    'info_contribution' => 'contributi dei forum',
372
+    'info_copyright' => '@spip@ è un software libero distribuito @lien_gpl@.',
373
+    'info_copyright_doc' => 'Per maggiori informazioni, vedi il sito <a href="@spipnet@">@spipnet_affiche@</a>.',
374
+    'info_copyright_gpl' => 'sotto licenza GPL',
375
+    'info_cours_edition' => 'Articoli in fase di redazione',
376
+    'info_creer_repertoire' => 'Creare un file o una cartella chiamata:',
377
+    'info_creer_repertoire_2' => 'all’interno della sottocartella <b>@repertoire@</b>, poi:',
378
+    'info_creer_vignette' => 'creazione automatica dell’anteprima',
379
+    'info_creerdansrubrique_non_autorise' => 'Non si dispone di diritti sufficienti per creare contenuti in questa rubrica',
380
+    'info_deplier' => 'Espandi',
381
+    'info_descriptif_nombre' => 'descrizione(i):',
382
+    'info_description' => 'Descrizione:',
383
+    'info_description_2' => 'Descrizione:',
384
+    'info_dimension' => 'Dimensioni:',
385
+    'info_documents_nb' => '@nb@ documenti',
386
+    'info_documents_un' => '1 documento',
387
+    'info_ecire_message_prive' => 'Scrivi un messaggio privato',
388
+    'info_email_invalide' => 'Indirizzo email non valido.',
389
+    'info_en_cours_validation' => 'I tuoi articoli in corso di redazione',
390
+    'info_en_ligne' => 'Attualmente on line:',
391
+    'info_envoyer_message_prive' => 'Invia un messaggio privato a questo autore',
392
+    'info_erreur_requete' => 'Errore nella richiesta: ',
393
+    'info_erreur_squelette2' => 'Nessun modello di layout <b>@fichier@</b> trovato...',
394
+    'info_erreur_systeme' => 'Errore di sistema (errno @errsys@)',
395
+    'info_erreur_systeme2' => 'Il disco rigido potrebbe essere pieno o la base dati danneggiata.<br />
396 396
 <span style="color:red;">Tenta di <a href=\'@script@\'>ripristinare la base dati</a>, o contatta il tuo hoster.</span>',
397
-	'info_fini' => 'Finito!',
398
-	'info_format_image' => 'Formati di file immagine utilizzabili per la creazione delle etichette: @gd_formats@.',
399
-	'info_format_non_defini' => 'formato non definito',
400
-	'info_grand_ecran' => 'Layout per monitor grandi',
401
-	'info_image_aide' => 'AIUTO',
402
-	'info_image_process_titre' => 'Metodo per generare thumbnail',
403
-	'info_impossible_lire_page' => '<b>Errore!</b> Impossibile  leggere la pagina <tt><html>@test_proxy@</html></tt> attraverso il proxy ',
404
-	'info_installation_systeme_publication' => 'Installazione del sistema di pubblicazione...',
405
-	'info_installer_documents' => 'È possibile installare automaticamente tutti i documenti contenuti nella cartella @upload@.',
406
-	'info_installer_ftp' => 'In qualità di amministratore, puoi installare file (via FTP) nella cartella @upload@ per poi selezionarli direttamente.',
407
-	'info_installer_images' => 'È possibile installare delle immagini in formato JPEG, GIF e PNG.',
408
-	'info_installer_images_dossier' => 'Installare delle immagini nella cartella @upload@ per poterle selezionare direttamente.',
409
-	'info_interface_complete' => 'Interfaccia completa',
410
-	'info_interface_simple' => 'Interfaccia semplificata',
411
-	'info_joindre_document_article' => 'Puoi allegare a questo articolo dei documenti del tipo',
412
-	'info_joindre_document_rubrique' => 'Puoi aggiungere a questa rubrica documenti del tipo',
413
-	'info_joindre_documents_article' => 'Puoi allegare all’articolo documenti del tipo: ',
414
-	'info_l_article' => 'l’articolo',
415
-	'info_la_breve' => 'la breve',
416
-	'info_la_rubrique' => 'la sezione',
417
-	'info_langue_principale' => 'Lingua predefinita del sito',
418
-	'info_largeur_vignette' => '@largeur_vignette@ x @hauteur_vignette@ pixel',
419
-	'info_les_auteurs_1' => 'di @les_auteurs@ ',
420
-	'info_logo_format_interdit' => 'Solo i logo in formato @formats@ sono permessi.',
421
-	'info_logo_max_poids' => 'I logo devono obbligatoriamente avere una dimensione inferiore a @maxi@ (questo file è di @actuel@).',
422
-	'info_mail_fournisseur' => '[email protected]',
423
-	'info_message_2' => 'MESSAGGIO',
424
-	'info_message_supprime' => 'MESSAGGIO ELIMINATO',
425
-	'info_messages_nb' => '@nb@ messaggi',
426
-	'info_messages_un' => '1 messaggio',
427
-	'info_mise_en_ligne' => 'Data di pubblicazione on line:',
428
-	'info_modification_parametres_securite' => 'modifiche dei parametri di sicurezza',
429
-	'info_mois_courant' => 'Durante il mese:',
430
-	'info_mot_cle_ajoute' => 'La seguente parola chiave è stata aggiunta a',
431
-	'info_multi_herit' => 'Lingua predefinita',
432
-	'info_multi_langues_soulignees' => 'Le <u>lingue sottolineate</u> hanno la traduzione parziale o totale per tutti i testi dell’interfaccia. Se si seleziona una di queste lingue, molti elementi del sito pubblico (date, form) verranno tradotti automaticamente. Per le lingue che non sono sottolineate, invece, tali elementi rimarranno nella lingua principale del sito.',
433
-	'info_multilinguisme' => 'Multilinguismo',
434
-	'info_nom_non_utilisateurs_connectes' => 'Il tuo nome non appare nella lista degli utenti collegati.',
435
-	'info_nom_utilisateurs_connectes' => 'Il tuo nome è visibile nella lista degli utenti collegati.',
436
-	'info_nombre_en_ligne' => 'Attualmente on line:',
437
-	'info_non_resultat' => 'Nessun risultato per "@cherche_mot@"',
438
-	'info_non_utilisation_messagerie' => 'Il sistema di messaggistica interna di questo sito non viene utilizzato.',
439
-	'info_nouveau_message' => 'HAI UN NUOVO MESSAGGIO',
440
-	'info_nouveaux_messages' => 'HAI @total_messages@ NUOVI MESSAGGI',
441
-	'info_numero_abbreviation' => 'N. ',
442
-	'info_obligatoire' => 'Questa informazione è obbligatoria',
443
-	'info_page_actuelle' => 'Pagina corrente',
444
-	'info_pense_bete' => 'MEMO',
445
-	'info_petit_ecran' => 'Layout per monitor piccoli',
446
-	'info_petition_close' => 'Petizione chiusa',
447
-	'info_pixels' => 'pixels',
448
-	'info_plusieurs_mots_trouves' => 'Numerose parole chiave trovate per "@cherche_mot@":',
449
-	'info_portfolio_automatique' => 'Portfolio automatico:',
450
-	'info_premier_resultat' => '[@debut_limit@ primi risultati su @total@]',
451
-	'info_premier_resultat_sur' => '[@debut_limit@ primi risultati su @total@]',
452
-	'info_propose_1' => '[@nom_site_spip@] Propone: @titre@',
453
-	'info_propose_2' => 'Articolo proposto
397
+    'info_fini' => 'Finito!',
398
+    'info_format_image' => 'Formati di file immagine utilizzabili per la creazione delle etichette: @gd_formats@.',
399
+    'info_format_non_defini' => 'formato non definito',
400
+    'info_grand_ecran' => 'Layout per monitor grandi',
401
+    'info_image_aide' => 'AIUTO',
402
+    'info_image_process_titre' => 'Metodo per generare thumbnail',
403
+    'info_impossible_lire_page' => '<b>Errore!</b> Impossibile  leggere la pagina <tt><html>@test_proxy@</html></tt> attraverso il proxy ',
404
+    'info_installation_systeme_publication' => 'Installazione del sistema di pubblicazione...',
405
+    'info_installer_documents' => 'È possibile installare automaticamente tutti i documenti contenuti nella cartella @upload@.',
406
+    'info_installer_ftp' => 'In qualità di amministratore, puoi installare file (via FTP) nella cartella @upload@ per poi selezionarli direttamente.',
407
+    'info_installer_images' => 'È possibile installare delle immagini in formato JPEG, GIF e PNG.',
408
+    'info_installer_images_dossier' => 'Installare delle immagini nella cartella @upload@ per poterle selezionare direttamente.',
409
+    'info_interface_complete' => 'Interfaccia completa',
410
+    'info_interface_simple' => 'Interfaccia semplificata',
411
+    'info_joindre_document_article' => 'Puoi allegare a questo articolo dei documenti del tipo',
412
+    'info_joindre_document_rubrique' => 'Puoi aggiungere a questa rubrica documenti del tipo',
413
+    'info_joindre_documents_article' => 'Puoi allegare all’articolo documenti del tipo: ',
414
+    'info_l_article' => 'l’articolo',
415
+    'info_la_breve' => 'la breve',
416
+    'info_la_rubrique' => 'la sezione',
417
+    'info_langue_principale' => 'Lingua predefinita del sito',
418
+    'info_largeur_vignette' => '@largeur_vignette@ x @hauteur_vignette@ pixel',
419
+    'info_les_auteurs_1' => 'di @les_auteurs@ ',
420
+    'info_logo_format_interdit' => 'Solo i logo in formato @formats@ sono permessi.',
421
+    'info_logo_max_poids' => 'I logo devono obbligatoriamente avere una dimensione inferiore a @maxi@ (questo file è di @actuel@).',
422
+    'info_mail_fournisseur' => '[email protected]',
423
+    'info_message_2' => 'MESSAGGIO',
424
+    'info_message_supprime' => 'MESSAGGIO ELIMINATO',
425
+    'info_messages_nb' => '@nb@ messaggi',
426
+    'info_messages_un' => '1 messaggio',
427
+    'info_mise_en_ligne' => 'Data di pubblicazione on line:',
428
+    'info_modification_parametres_securite' => 'modifiche dei parametri di sicurezza',
429
+    'info_mois_courant' => 'Durante il mese:',
430
+    'info_mot_cle_ajoute' => 'La seguente parola chiave è stata aggiunta a',
431
+    'info_multi_herit' => 'Lingua predefinita',
432
+    'info_multi_langues_soulignees' => 'Le <u>lingue sottolineate</u> hanno la traduzione parziale o totale per tutti i testi dell’interfaccia. Se si seleziona una di queste lingue, molti elementi del sito pubblico (date, form) verranno tradotti automaticamente. Per le lingue che non sono sottolineate, invece, tali elementi rimarranno nella lingua principale del sito.',
433
+    'info_multilinguisme' => 'Multilinguismo',
434
+    'info_nom_non_utilisateurs_connectes' => 'Il tuo nome non appare nella lista degli utenti collegati.',
435
+    'info_nom_utilisateurs_connectes' => 'Il tuo nome è visibile nella lista degli utenti collegati.',
436
+    'info_nombre_en_ligne' => 'Attualmente on line:',
437
+    'info_non_resultat' => 'Nessun risultato per "@cherche_mot@"',
438
+    'info_non_utilisation_messagerie' => 'Il sistema di messaggistica interna di questo sito non viene utilizzato.',
439
+    'info_nouveau_message' => 'HAI UN NUOVO MESSAGGIO',
440
+    'info_nouveaux_messages' => 'HAI @total_messages@ NUOVI MESSAGGI',
441
+    'info_numero_abbreviation' => 'N. ',
442
+    'info_obligatoire' => 'Questa informazione è obbligatoria',
443
+    'info_page_actuelle' => 'Pagina corrente',
444
+    'info_pense_bete' => 'MEMO',
445
+    'info_petit_ecran' => 'Layout per monitor piccoli',
446
+    'info_petition_close' => 'Petizione chiusa',
447
+    'info_pixels' => 'pixels',
448
+    'info_plusieurs_mots_trouves' => 'Numerose parole chiave trovate per "@cherche_mot@":',
449
+    'info_portfolio_automatique' => 'Portfolio automatico:',
450
+    'info_premier_resultat' => '[@debut_limit@ primi risultati su @total@]',
451
+    'info_premier_resultat_sur' => '[@debut_limit@ primi risultati su @total@]',
452
+    'info_propose_1' => '[@nom_site_spip@] Propone: @titre@',
453
+    'info_propose_2' => 'Articolo proposto
454 454
 ---------------',
455
-	'info_propose_3' => 'L’articolo "@titre@" è proposto per la pubblicazione',
456
-	'info_propose_4' => 'Sei invitato a consultare e a dare la tua opinione ',
457
-	'info_propose_5' => 'nel forum annesso.
455
+    'info_propose_3' => 'L’articolo "@titre@" è proposto per la pubblicazione',
456
+    'info_propose_4' => 'Sei invitato a consultare e a dare la tua opinione ',
457
+    'info_propose_5' => 'nel forum annesso.
458 458
 
459 459
 È disponibile all’indirizzo:',
460
-	'info_publie_01' => 'L’articolo "@titre@" è stato convalidato da @connect_nom@.',
461
-	'info_publie_1' => '[@nom_site_spip@] PUBBLICA: @titre@',
462
-	'info_publie_2' => 'Articolo pubblicato
460
+    'info_publie_01' => 'L’articolo "@titre@" è stato convalidato da @connect_nom@.',
461
+    'info_publie_1' => '[@nom_site_spip@] PUBBLICA: @titre@',
462
+    'info_publie_2' => 'Articolo pubblicato
463 463
 --------------',
464
-	'info_rechercher' => 'Ricerca',
465
-	'info_rechercher_02' => 'Cerca:',
466
-	'info_remplacer_vignette' => 'Sostituire l’icona predefinita con una personalizzata:',
467
-	'info_rubriques_nb' => '@nb@ sezioni',
468
-	'info_rubriques_un' => '1 sezione',
469
-	'info_sans_titre_2' => 'senza titolo',
470
-	'info_selectionner_fichier' => 'Puoi selezionare un file della cartella @upload@',
471
-	'info_selectionner_fichier_2' => 'Seleziona un file:',
472
-	'info_sites_nb' => '@nb@ siti',
473
-	'info_sites_un' => '1 sito',
474
-	'info_supprimer_vignette' => 'Cancella l’immagine',
475
-	'info_symbole_bleu' => 'Il simbolo <b>blu</b> indica un <b>memo</b>: cioè un messaggio ad uso personale.',
476
-	'info_symbole_jaune' => 'Il simbolo <b>giallo</b> indica un <b>annuncio a tutti i redattori</b>: modificabile da tutti gli amministratori e visibile da tutti i redattori.',
477
-	'info_symbole_vert' => 'Il simbolo <b>verde</b> indica i <b>messaggi scambiati con altri utenti  </b> del sito.',
478
-	'info_telecharger_nouveau_logo' => 'Upload di un nuovo logo:',
479
-	'info_telecharger_ordinateur' => 'Upload dal tuo computer:',
480
-	'info_tous_resultats_enregistres' => '[tutti i risultati sono salvati]',
481
-	'info_tout_afficher' => 'Visualizza tutto',
482
-	'info_travaux_texte' => 'Questo sito non è stato ancora configurato. Torna più tardi...',
483
-	'info_travaux_titre' => 'Lavori in corso',
484
-	'info_trop_resultat' => 'Troppi risultati per "@cherche_mot@" ; restringi la ricerca.',
485
-	'info_utilisation_messagerie_interne' => 'Stai utilizzando il sistema di messaggistica interna al sito.',
486
-	'info_valider_lien' => 'convalidare questo link',
487
-	'info_verifier_image' => ', verifica che le immagini siano state trasferite correttamente.',
488
-	'info_vignette_defaut' => 'Loghi predefiniti',
489
-	'info_vignette_personnalisee' => 'Loghi personalizzati',
490
-	'info_visite' => 'visita:',
491
-	'info_vos_rendez_vous' => 'I tuoi prossimi appuntamenti',
492
-	'infos_vos_pense_bete' => 'I tuoi memo',
464
+    'info_rechercher' => 'Ricerca',
465
+    'info_rechercher_02' => 'Cerca:',
466
+    'info_remplacer_vignette' => 'Sostituire l’icona predefinita con una personalizzata:',
467
+    'info_rubriques_nb' => '@nb@ sezioni',
468
+    'info_rubriques_un' => '1 sezione',
469
+    'info_sans_titre_2' => 'senza titolo',
470
+    'info_selectionner_fichier' => 'Puoi selezionare un file della cartella @upload@',
471
+    'info_selectionner_fichier_2' => 'Seleziona un file:',
472
+    'info_sites_nb' => '@nb@ siti',
473
+    'info_sites_un' => '1 sito',
474
+    'info_supprimer_vignette' => 'Cancella l’immagine',
475
+    'info_symbole_bleu' => 'Il simbolo <b>blu</b> indica un <b>memo</b>: cioè un messaggio ad uso personale.',
476
+    'info_symbole_jaune' => 'Il simbolo <b>giallo</b> indica un <b>annuncio a tutti i redattori</b>: modificabile da tutti gli amministratori e visibile da tutti i redattori.',
477
+    'info_symbole_vert' => 'Il simbolo <b>verde</b> indica i <b>messaggi scambiati con altri utenti  </b> del sito.',
478
+    'info_telecharger_nouveau_logo' => 'Upload di un nuovo logo:',
479
+    'info_telecharger_ordinateur' => 'Upload dal tuo computer:',
480
+    'info_tous_resultats_enregistres' => '[tutti i risultati sono salvati]',
481
+    'info_tout_afficher' => 'Visualizza tutto',
482
+    'info_travaux_texte' => 'Questo sito non è stato ancora configurato. Torna più tardi...',
483
+    'info_travaux_titre' => 'Lavori in corso',
484
+    'info_trop_resultat' => 'Troppi risultati per "@cherche_mot@" ; restringi la ricerca.',
485
+    'info_utilisation_messagerie_interne' => 'Stai utilizzando il sistema di messaggistica interna al sito.',
486
+    'info_valider_lien' => 'convalidare questo link',
487
+    'info_verifier_image' => ', verifica che le immagini siano state trasferite correttamente.',
488
+    'info_vignette_defaut' => 'Loghi predefiniti',
489
+    'info_vignette_personnalisee' => 'Loghi personalizzati',
490
+    'info_visite' => 'visita:',
491
+    'info_vos_rendez_vous' => 'I tuoi prossimi appuntamenti',
492
+    'infos_vos_pense_bete' => 'I tuoi memo',
493 493
 
494
-	// L
495
-	'label_ajout_id_rapide' => 'Inserimento rapido',
496
-	'label_poids_fichier' => 'Dimensione',
497
-	'label_ponctuer' => '@label@:',
498
-	'lien_afficher_icones_seuls' => 'Mostra solo le icone',
499
-	'lien_afficher_texte_icones' => 'Mostra le icone e il testo',
500
-	'lien_afficher_texte_seul' => 'Mostra solo il testo',
501
-	'lien_aller_a_la_derniere_page' => 'Vai all’ultima pagina',
502
-	'lien_aller_a_la_page_nb' => 'Vai alla pagina @nb@',
503
-	'lien_aller_a_la_page_precedente' => 'Vai alla pagina precedente',
504
-	'lien_aller_a_la_page_suivante' => 'Vai alla pagina successiva',
505
-	'lien_aller_a_la_premiere_page' => 'Vai alla prima pagina',
506
-	'lien_liberer' => 'libera',
507
-	'lien_liberer_tous' => 'liberare questi articoli',
508
-	'lien_nouvea_pense_bete' => 'NUOVO MEMO',
509
-	'lien_nouveau_message' => 'NUOVO MESSAGGIO',
510
-	'lien_nouvelle_annonce' => 'NUOVO ANNUNCIO',
511
-	'lien_petitions' => 'PETIZIONE',
512
-	'lien_popularite' => 'popolarità: @popularite@%',
513
-	'lien_racine_site' => 'ROOT DEL SITO',
514
-	'lien_reessayer' => 'Prova di nuovo',
515
-	'lien_repondre_message' => 'Rispondi',
516
-	'lien_supprimer' => 'cancella',
517
-	'lien_tout_afficher' => 'Visualizza tutto ',
518
-	'lien_visite_site' => 'visita il sito',
519
-	'lien_visites' => '@visites@ visite',
520
-	'lien_voir_auteur' => 'Vedi questo autore',
521
-	'ligne' => 'Linea',
522
-	'login' => 'Collegamento',
523
-	'login_acces_prive' => 'accesso all’area riservata',
524
-	'login_autre_identifiant' => 'connettiti con un altro ID',
525
-	'login_cookie_accepte' => 'Imposta il tuo browser affinché li accetti (almeno per questo sito).',
526
-	'login_cookie_oblige' => 'Per identificarsi in modo sicuro su questo sito è necessario accettare i cookie.',
527
-	'login_deconnexion_ok' => 'Disconnessione effettuata.',
528
-	'login_erreur_pass' => 'Errore nella password.',
529
-	'login_espace_prive' => 'area riservata',
530
-	'login_identifiant_inconnu' => 'L’ID « @login@ » risulta inesistente.',
531
-	'login_login' => 'Login:',
532
-	'login_login2' => 'Login o indirizzo email:',
533
-	'login_login_pass_incorrect' => '(Login o password errati.)',
534
-	'login_motpasseoublie' => 'password dimenticata?',
535
-	'login_non_securise' => 'Attenzione, questo modulo non è sicuro.
494
+    // L
495
+    'label_ajout_id_rapide' => 'Inserimento rapido',
496
+    'label_poids_fichier' => 'Dimensione',
497
+    'label_ponctuer' => '@label@:',
498
+    'lien_afficher_icones_seuls' => 'Mostra solo le icone',
499
+    'lien_afficher_texte_icones' => 'Mostra le icone e il testo',
500
+    'lien_afficher_texte_seul' => 'Mostra solo il testo',
501
+    'lien_aller_a_la_derniere_page' => 'Vai all’ultima pagina',
502
+    'lien_aller_a_la_page_nb' => 'Vai alla pagina @nb@',
503
+    'lien_aller_a_la_page_precedente' => 'Vai alla pagina precedente',
504
+    'lien_aller_a_la_page_suivante' => 'Vai alla pagina successiva',
505
+    'lien_aller_a_la_premiere_page' => 'Vai alla prima pagina',
506
+    'lien_liberer' => 'libera',
507
+    'lien_liberer_tous' => 'liberare questi articoli',
508
+    'lien_nouvea_pense_bete' => 'NUOVO MEMO',
509
+    'lien_nouveau_message' => 'NUOVO MESSAGGIO',
510
+    'lien_nouvelle_annonce' => 'NUOVO ANNUNCIO',
511
+    'lien_petitions' => 'PETIZIONE',
512
+    'lien_popularite' => 'popolarità: @popularite@%',
513
+    'lien_racine_site' => 'ROOT DEL SITO',
514
+    'lien_reessayer' => 'Prova di nuovo',
515
+    'lien_repondre_message' => 'Rispondi',
516
+    'lien_supprimer' => 'cancella',
517
+    'lien_tout_afficher' => 'Visualizza tutto ',
518
+    'lien_visite_site' => 'visita il sito',
519
+    'lien_visites' => '@visites@ visite',
520
+    'lien_voir_auteur' => 'Vedi questo autore',
521
+    'ligne' => 'Linea',
522
+    'login' => 'Collegamento',
523
+    'login_acces_prive' => 'accesso all’area riservata',
524
+    'login_autre_identifiant' => 'connettiti con un altro ID',
525
+    'login_cookie_accepte' => 'Imposta il tuo browser affinché li accetti (almeno per questo sito).',
526
+    'login_cookie_oblige' => 'Per identificarsi in modo sicuro su questo sito è necessario accettare i cookie.',
527
+    'login_deconnexion_ok' => 'Disconnessione effettuata.',
528
+    'login_erreur_pass' => 'Errore nella password.',
529
+    'login_espace_prive' => 'area riservata',
530
+    'login_identifiant_inconnu' => 'L’ID « @login@ » risulta inesistente.',
531
+    'login_login' => 'Login:',
532
+    'login_login2' => 'Login o indirizzo email:',
533
+    'login_login_pass_incorrect' => '(Login o password errati.)',
534
+    'login_motpasseoublie' => 'password dimenticata?',
535
+    'login_non_securise' => 'Attenzione, questo modulo non è sicuro.
536 536
 Se non vuoi che la tua password possa essere intercettata sulla rete,
537 537
 devi attivare Javascript nel tuo browser e',
538
-	'login_nouvelle_tentative' => 'Nuovo tentativo',
539
-	'login_par_ici' => 'Sei registrato... per di qua...',
540
-	'login_pass2' => 'Password:',
541
-	'login_preferez_refuser' => '<b>Se preferisci non accettare i cookie</b> c’è un altro metodo (meno sicuro) per connettersi:',
542
-	'login_recharger' => 'aggiorna questa pagina',
543
-	'login_rester_identifie' => 'Conservare l’identificazione per alcuni giorni',
544
-	'login_retour_public' => 'Ritorna al sito pubblico',
545
-	'login_retour_site' => 'Ritorna al sito pubblico',
546
-	'login_retoursitepublic' => 'ritorna al sito pubblico',
547
-	'login_sans_cookie' => 'Identificazione senza cookie',
548
-	'login_securise' => 'Accesso protetto',
549
-	'login_sinscrire' => 'registrati',
550
-	'login_test_navigateur' => 'test browser/riconnessione',
551
-	'login_verifiez_navigateur' => '(Verifica comunque se il tuo browser ha memorizzato la password...)',
538
+    'login_nouvelle_tentative' => 'Nuovo tentativo',
539
+    'login_par_ici' => 'Sei registrato... per di qua...',
540
+    'login_pass2' => 'Password:',
541
+    'login_preferez_refuser' => '<b>Se preferisci non accettare i cookie</b> c’è un altro metodo (meno sicuro) per connettersi:',
542
+    'login_recharger' => 'aggiorna questa pagina',
543
+    'login_rester_identifie' => 'Conservare l’identificazione per alcuni giorni',
544
+    'login_retour_public' => 'Ritorna al sito pubblico',
545
+    'login_retour_site' => 'Ritorna al sito pubblico',
546
+    'login_retoursitepublic' => 'ritorna al sito pubblico',
547
+    'login_sans_cookie' => 'Identificazione senza cookie',
548
+    'login_securise' => 'Accesso protetto',
549
+    'login_sinscrire' => 'registrati',
550
+    'login_test_navigateur' => 'test browser/riconnessione',
551
+    'login_verifiez_navigateur' => '(Verifica comunque se il tuo browser ha memorizzato la password...)',
552 552
 
553
-	// M
554
-	'masquer_colonne' => 'Nascondi questa colonna',
555
-	'masquer_trad' => 'nascondere le traduzioni',
556
-	'message_nouveaux_identifiants_echec' => 'Impossibile generare nuovi identificativi',
557
-	'message_nouveaux_identifiants_echec_envoi' => 'Le nuove credenziali di accesso non possono essere inviate.',
558
-	'message_nouveaux_identifiants_ok' => 'Le nuove credenziali di accsso sono state inviate a @email@.',
559
-	'module_fichiers_langues' => 'File lingua',
553
+    // M
554
+    'masquer_colonne' => 'Nascondi questa colonna',
555
+    'masquer_trad' => 'nascondere le traduzioni',
556
+    'message_nouveaux_identifiants_echec' => 'Impossibile generare nuovi identificativi',
557
+    'message_nouveaux_identifiants_echec_envoi' => 'Le nuove credenziali di accesso non possono essere inviate.',
558
+    'message_nouveaux_identifiants_ok' => 'Le nuove credenziali di accsso sono state inviate a @email@.',
559
+    'module_fichiers_langues' => 'File lingua',
560 560
 
561
-	// N
562
-	'navigateur_pas_redirige' => 'Se la pagina non cambia automaticamente, cliccare qui per continuare.',
563
-	'numero' => 'Numero',
561
+    // N
562
+    'navigateur_pas_redirige' => 'Se la pagina non cambia automaticamente, cliccare qui per continuare.',
563
+    'numero' => 'Numero',
564 564
 
565
-	// O
566
-	'occurence' => 'Occorrenza',
567
-	'onglet_affacer_base' => 'Svuota il database',
568
-	'onglet_auteur' => 'L’autore',
569
-	'onglet_contenu_site' => 'Contenuto del sito',
570
-	'onglet_evolution_visite_mod' => 'Evoluzione',
571
-	'onglet_fonctions_avances' => 'Funzioni avanzate',
572
-	'onglet_informations_personnelles' => 'Dati personali',
573
-	'onglet_interactivite' => 'Interattività',
574
-	'onglet_messagerie' => 'Messaggi',
575
-	'onglet_repartition_rubrique' => 'Ripartizione per rubriche',
576
-	'onglet_save_restaur_base' => 'Salva/ripristina il database',
577
-	'onglet_vider_cache' => 'Svuota la cache',
565
+    // O
566
+    'occurence' => 'Occorrenza',
567
+    'onglet_affacer_base' => 'Svuota il database',
568
+    'onglet_auteur' => 'L’autore',
569
+    'onglet_contenu_site' => 'Contenuto del sito',
570
+    'onglet_evolution_visite_mod' => 'Evoluzione',
571
+    'onglet_fonctions_avances' => 'Funzioni avanzate',
572
+    'onglet_informations_personnelles' => 'Dati personali',
573
+    'onglet_interactivite' => 'Interattività',
574
+    'onglet_messagerie' => 'Messaggi',
575
+    'onglet_repartition_rubrique' => 'Ripartizione per rubriche',
576
+    'onglet_save_restaur_base' => 'Salva/ripristina il database',
577
+    'onglet_vider_cache' => 'Svuota la cache',
578 578
 
579
-	// P
580
-	'pass_choix_pass' => 'Inserisci una nuova password:',
581
-	'pass_erreur' => 'Errore',
582
-	'pass_erreur_acces_refuse' => '<b>Errore:</b> non hai più accesso a questo sito.',
583
-	'pass_erreur_code_inconnu' => '<b>Errore:</b> il codice inserito non corriponde a nessuno degli utenti che hanno accesso a questo sito.',
584
-	'pass_erreur_non_enregistre' => '<b>Errore:</b> l’indirizzo <tt>@email_oubli@</tt> non è registrato su questo sito.',
585
-	'pass_erreur_non_valide' => '<b>Errore:</b> questo indirizzo <tt>@email_oubli@</tt> non è valido!',
586
-	'pass_erreur_probleme_technique' => '<b>Errore:</b> l’email non può essere inviato a causa di un problema tecnico.',
587
-	'pass_espace_prive_bla' => 'L’area riservata di questo sito è accessibile
579
+    // P
580
+    'pass_choix_pass' => 'Inserisci una nuova password:',
581
+    'pass_erreur' => 'Errore',
582
+    'pass_erreur_acces_refuse' => '<b>Errore:</b> non hai più accesso a questo sito.',
583
+    'pass_erreur_code_inconnu' => '<b>Errore:</b> il codice inserito non corriponde a nessuno degli utenti che hanno accesso a questo sito.',
584
+    'pass_erreur_non_enregistre' => '<b>Errore:</b> l’indirizzo <tt>@email_oubli@</tt> non è registrato su questo sito.',
585
+    'pass_erreur_non_valide' => '<b>Errore:</b> questo indirizzo <tt>@email_oubli@</tt> non è valido!',
586
+    'pass_erreur_probleme_technique' => '<b>Errore:</b> l’email non può essere inviato a causa di un problema tecnico.',
587
+    'pass_espace_prive_bla' => 'L’area riservata di questo sito è accessibile
588 588
 unicamente agli utenti registrati.
589 589
 Una volta iscritto, potrai consultare gli articoli in corso di redazione,
590 590
 proporre nuovi articoli e partecipare a tutti i forum.',
591
-	'pass_forum_bla' => 'Hai chiesto di intervenire su un forum
591
+    'pass_forum_bla' => 'Hai chiesto di intervenire su un forum
592 592
 riservato agli utenti registrati.',
593
-	'pass_indiquez_cidessous' => 'Indica qui sotto l’indirizzo email con il quale ti sei registrato precedentemente.
593
+    'pass_indiquez_cidessous' => 'Indica qui sotto l’indirizzo email con il quale ti sei registrato precedentemente.
594 594
 Riceverai un email con le istruzioni per recuperare i dati di accesso al sito.',
595
-	'pass_mail_passcookie' => '(questo è un messaggio generato automaticamente)
595
+    'pass_mail_passcookie' => '(questo è un messaggio generato automaticamente)
596 596
 Per recuperare i dati di accesso al sito
597 597
 @nom_site_spip@ (@adresse_site@)
598 598
 
@@ -603,143 +603,143 @@  discard block
 block discarded – undo
603 603
 e riconnetterti all’area riservata.
604 604
 
605 605
 ',
606
-	'pass_mot_oublie' => 'Password dimenticata',
607
-	'pass_nouveau_enregistre' => 'La nuova password è stata salvata.',
608
-	'pass_nouveau_pass' => 'Nuova password',
609
-	'pass_ok' => 'OK',
610
-	'pass_oubli_mot' => 'Password dimenticata',
611
-	'pass_procedure_changer' => 'Per modificare la tua password, dobbiamo prima verificare la tua identità. Inserisci l’indirizzo email associato al tuo account.',
612
-	'pass_quitter_fenetre' => 'Chiudi la finestra',
613
-	'pass_rappel_login' => 'Ricorda: il tuo ID (login) è « @login@ ».',
614
-	'pass_recevoir_mail' => 'Riceverai un email contenente le istruzioni per recuperare i dati di accesso al sito.',
615
-	'pass_retour_public' => 'Torna al sito pubblico',
616
-	'pass_rien_a_faire_ici' => 'Vicolo cieco...',
617
-	'pass_vousinscrire' => 'Registrati al sito',
618
-	'precedent' => 'precedente',
619
-	'previsualisation' => 'Anteprima',
620
-	'previsualiser' => 'Visualizzare l’anteprima',
606
+    'pass_mot_oublie' => 'Password dimenticata',
607
+    'pass_nouveau_enregistre' => 'La nuova password è stata salvata.',
608
+    'pass_nouveau_pass' => 'Nuova password',
609
+    'pass_ok' => 'OK',
610
+    'pass_oubli_mot' => 'Password dimenticata',
611
+    'pass_procedure_changer' => 'Per modificare la tua password, dobbiamo prima verificare la tua identità. Inserisci l’indirizzo email associato al tuo account.',
612
+    'pass_quitter_fenetre' => 'Chiudi la finestra',
613
+    'pass_rappel_login' => 'Ricorda: il tuo ID (login) è « @login@ ».',
614
+    'pass_recevoir_mail' => 'Riceverai un email contenente le istruzioni per recuperare i dati di accesso al sito.',
615
+    'pass_retour_public' => 'Torna al sito pubblico',
616
+    'pass_rien_a_faire_ici' => 'Vicolo cieco...',
617
+    'pass_vousinscrire' => 'Registrati al sito',
618
+    'precedent' => 'precedente',
619
+    'previsualisation' => 'Anteprima',
620
+    'previsualiser' => 'Visualizzare l’anteprima',
621 621
 
622
-	// R
623
-	'retour' => 'Indietro',
622
+    // R
623
+    'retour' => 'Indietro',
624 624
 
625
-	// S
626
-	'spip_conforme_dtd' => 'SPIP ritiene che questo documento è conforme al proprio DOCTYPE:',
627
-	'squelette' => 'modello di layout',
628
-	'squelette_inclus_ligne' => 'modello incluso, linea',
629
-	'squelette_ligne' => 'modello, linea',
630
-	'stats_visites_et_popularite' => '@visites@ visite; popolarità: @popularite@',
631
-	'suivant' => 'successivo',
625
+    // S
626
+    'spip_conforme_dtd' => 'SPIP ritiene che questo documento è conforme al proprio DOCTYPE:',
627
+    'squelette' => 'modello di layout',
628
+    'squelette_inclus_ligne' => 'modello incluso, linea',
629
+    'squelette_ligne' => 'modello, linea',
630
+    'stats_visites_et_popularite' => '@visites@ visite; popolarità: @popularite@',
631
+    'suivant' => 'successivo',
632 632
 
633
-	// T
634
-	'taille_go' => '@taille@ Gb',
635
-	'taille_ko' => '@taille@ Kb',
636
-	'taille_mo' => '@taille@ Mb',
637
-	'taille_octets' => '@taille@ byte',
638
-	'texte_actualite_site_1' => 'Quando avrai maggiore familiarità con l’interfaccia, clicca su «',
639
-	'texte_actualite_site_2' => 'interfaccia completa',
640
-	'texte_actualite_site_3' => '» per avere accesso a nuove opzioni.',
641
-	'texte_creation_automatique_vignette' => 'La creazione automatica di thumbnail di anteprima è attivata. Se inserisci in questo campo delle immagini in formato @gd_formats@, esse saranno accompagnate da thumbnail con una dimensione massima di @taille_preview@ pixels. ',
642
-	'texte_documents_associes' => 'I seguenti documenti sono associati all’articolo,
633
+    // T
634
+    'taille_go' => '@taille@ Gb',
635
+    'taille_ko' => '@taille@ Kb',
636
+    'taille_mo' => '@taille@ Mb',
637
+    'taille_octets' => '@taille@ byte',
638
+    'texte_actualite_site_1' => 'Quando avrai maggiore familiarità con l’interfaccia, clicca su «',
639
+    'texte_actualite_site_2' => 'interfaccia completa',
640
+    'texte_actualite_site_3' => '» per avere accesso a nuove opzioni.',
641
+    'texte_creation_automatique_vignette' => 'La creazione automatica di thumbnail di anteprima è attivata. Se inserisci in questo campo delle immagini in formato @gd_formats@, esse saranno accompagnate da thumbnail con una dimensione massima di @taille_preview@ pixels. ',
642
+    'texte_documents_associes' => 'I seguenti documenti sono associati all’articolo,
643 643
 ma non vi sono stati inseriti direttamente.
644 644
 A seconda delle impostazioni di pubblicazione del sito,
645 645
 potranno essere disponibili sotto forma di documenti allegati.',
646
-	'texte_erreur_mise_niveau_base' => 'Errore nel database durante l’aggiornamento.
646
+    'texte_erreur_mise_niveau_base' => 'Errore nel database durante l’aggiornamento.
647 647
 L’immagine <b>@fichier@</b> non è passata (articolo @id_article@).
648 648
 Prendi nota di questo riferimento, ritenta l’aggiornamento,
649 649
 e verifica che le immagini si vedano ancora
650 650
 negli articoli.',
651
-	'texte_erreur_visiteur' => 'Si è tentato di entrare nell’area riservata con un login non valido.',
652
-	'texte_inc_auth_1' => 'Sei identificato con il
651
+    'texte_erreur_visiteur' => 'Si è tentato di entrare nell’area riservata con un login non valido.',
652
+    'texte_inc_auth_1' => 'Sei identificato con il
653 653
 login <b>@auth_login@</b>, ma nel database non esiste. 
654 654
 Prova a ',
655
-	'texte_inc_auth_2' => 'collegarti nuovamente',
656
-	'texte_inc_auth_3' => ', dopo aver eventualmente effettuato un logout e 
655
+    'texte_inc_auth_2' => 'collegarti nuovamente',
656
+    'texte_inc_auth_3' => ', dopo aver eventualmente effettuato un logout e 
657 657
 riavviato il tuo browser.',
658
-	'texte_inc_config' => 'Le modifiche effettuate in queste pagine influenzano notevolmente il
658
+    'texte_inc_config' => 'Le modifiche effettuate in queste pagine influenzano notevolmente il
659 659
 funzionamento del sito. Non intervenire finché non conosci bene i meccanismi del sistema SPIP. <br /><br /><b>In generale, si consiglia di lasciare sempre al webmaster la configurazione delle opzioni qui presenti.</b>',
660
-	'texte_inc_meta_1' => 'La scrittura del file <code>@fichier@</code> ha causato un errore di sistema. L’amministratore del sito, ',
661
-	'texte_inc_meta_2' => 'verifichi i diritti di scrittura',
662
-	'texte_inc_meta_3' => 'nella cartella <code>@repertoire@</code>.',
663
-	'texte_statut_en_cours_redaction' => 'in corso di redazione',
664
-	'texte_statut_poubelle' => 'nel cestino',
665
-	'texte_statut_propose_evaluation' => 'proposto per una valutazione',
666
-	'texte_statut_publie' => 'pubblicato on line',
667
-	'texte_statut_refuse' => 'rifiutato',
668
-	'titre_ajouter_mot_cle' => 'AGGIUNGI UNA PAROLA CHIAVE:',
669
-	'titre_cadre_raccourcis' => 'SCELTA RAPIDA:',
670
-	'titre_changer_couleur_interface' => 'Cambia il colore dell’interfaccia',
671
-	'titre_image_admin_article' => 'Puoi amministrare questo articolo',
672
-	'titre_image_administrateur' => 'Amministratore',
673
-	'titre_image_aide' => 'Aiuto su questo elemento',
674
-	'titre_image_auteur_supprime' => 'Autore eliminato',
675
-	'titre_image_redacteur' => 'Redattore senza accesso',
676
-	'titre_image_redacteur_02' => 'Redattore',
677
-	'titre_image_selecteur' => 'Mostra la lista',
678
-	'titre_image_visiteur' => 'Visitatore',
679
-	'titre_joindre_document' => 'ALLEGA UN DOCUMENTO',
680
-	'titre_mots_cles' => 'PAROLE CHIAVE',
681
-	'titre_probleme_technique' => 'Attenzione: un problema tecnico (server SQL) impedisce l’accesso a questa parte del sito. Grazie per la comprensione.',
682
-	'titre_publier_document' => 'ALLEGA UN DOCUMENTO A QUESTA RUBRICA',
683
-	'titre_signatures_attente' => 'Firme in corso di convalida',
684
-	'titre_signatures_confirmees' => 'Firme confermate',
685
-	'titre_statistiques' => 'Statistiche del sito',
686
-	'titre_titre_document' => 'Titolo del documento:',
687
-	'todo' => 'prossimo',
688
-	'trad_definir_reference' => 'Scegliere "@titre@" come riferimento per le traduzioni',
689
-	'trad_reference' => '(articolo di riferimento)',
660
+    'texte_inc_meta_1' => 'La scrittura del file <code>@fichier@</code> ha causato un errore di sistema. L’amministratore del sito, ',
661
+    'texte_inc_meta_2' => 'verifichi i diritti di scrittura',
662
+    'texte_inc_meta_3' => 'nella cartella <code>@repertoire@</code>.',
663
+    'texte_statut_en_cours_redaction' => 'in corso di redazione',
664
+    'texte_statut_poubelle' => 'nel cestino',
665
+    'texte_statut_propose_evaluation' => 'proposto per una valutazione',
666
+    'texte_statut_publie' => 'pubblicato on line',
667
+    'texte_statut_refuse' => 'rifiutato',
668
+    'titre_ajouter_mot_cle' => 'AGGIUNGI UNA PAROLA CHIAVE:',
669
+    'titre_cadre_raccourcis' => 'SCELTA RAPIDA:',
670
+    'titre_changer_couleur_interface' => 'Cambia il colore dell’interfaccia',
671
+    'titre_image_admin_article' => 'Puoi amministrare questo articolo',
672
+    'titre_image_administrateur' => 'Amministratore',
673
+    'titre_image_aide' => 'Aiuto su questo elemento',
674
+    'titre_image_auteur_supprime' => 'Autore eliminato',
675
+    'titre_image_redacteur' => 'Redattore senza accesso',
676
+    'titre_image_redacteur_02' => 'Redattore',
677
+    'titre_image_selecteur' => 'Mostra la lista',
678
+    'titre_image_visiteur' => 'Visitatore',
679
+    'titre_joindre_document' => 'ALLEGA UN DOCUMENTO',
680
+    'titre_mots_cles' => 'PAROLE CHIAVE',
681
+    'titre_probleme_technique' => 'Attenzione: un problema tecnico (server SQL) impedisce l’accesso a questa parte del sito. Grazie per la comprensione.',
682
+    'titre_publier_document' => 'ALLEGA UN DOCUMENTO A QUESTA RUBRICA',
683
+    'titre_signatures_attente' => 'Firme in corso di convalida',
684
+    'titre_signatures_confirmees' => 'Firme confermate',
685
+    'titre_statistiques' => 'Statistiche del sito',
686
+    'titre_titre_document' => 'Titolo del documento:',
687
+    'todo' => 'prossimo',
688
+    'trad_definir_reference' => 'Scegliere "@titre@" come riferimento per le traduzioni',
689
+    'trad_reference' => '(articolo di riferimento)',
690 690
 
691
-	// U
692
-	'upload_limit' => 'Questo file è trppo grande per il server; la dimensione massima consentita in <i>upload</i> è di @max@.',
691
+    // U
692
+    'upload_limit' => 'Questo file è trppo grande per il server; la dimensione massima consentita in <i>upload</i> è di @max@.',
693 693
 
694
-	// Z
695
-	'zbug_balise_b_aval' => ': ciclo B deve precedere ciclo BOUCLE',
696
-	'zbug_balise_inexistante' => 'errore @from@: il tag #@balise@ non esiste ',
697
-	'zbug_balise_sans_argument' => 'Argomento mancante nel tag @balise@',
698
-	'zbug_boucle' => 'ciclo',
699
-	'zbug_boucle_recursive_undef' => 'ciclo ricorsivo non definito',
700
-	'zbug_calcul' => 'calcolo',
701
-	'zbug_champ_hors_boucle' => 'Campo @champ@ fuori dal ciclo',
702
-	'zbug_champ_hors_critere' => 'Il campo @champ@ non rispetta il criterio @critere@',
703
-	'zbug_champ_hors_motif' => 'Campo @champ@ fuori da un contesto @motif@',
704
-	'zbug_code' => 'codice',
705
-	'zbug_critere_inconnu' => 'criterio sconosciuto @critere@',
706
-	'zbug_critere_sur_table_sans_cle_primaire' => '{@critere@} su una tabella senza una chiave primaria atomica',
707
-	'zbug_distant_interdit' => 'esterno non accessibile',
708
-	'zbug_doublon_table_sans_cle_primaire' => 'doppioni su una tabella senza chiave primaria atomica',
709
-	'zbug_doublon_table_sans_index' => 'doppioni su una tabella senza indice',
710
-	'zbug_erreur_boucle_double' => 'BOUCLE@id@: doppia definizione',
711
-	'zbug_erreur_boucle_fermant' => 'BOUCLE@id@: chiusura tag mancante',
712
-	'zbug_erreur_boucle_syntaxe' => 'Sintassi del ciclo errata',
713
-	'zbug_erreur_compilation' => 'Errore di compilazione',
714
-	'zbug_erreur_execution_page' => 'errore di esecuzione della pagina',
715
-	'zbug_erreur_filtre' => 'Errore : filtro <b>« @filtre@ »</b> non esistente',
716
-	'zbug_erreur_filtre_nbarg_min' => 'Filtro@filtre@: argomento(i) @nb@ mancante(i)',
717
-	'zbug_erreur_meme_parent' => 'il criterio {meme_parent} si applica unicamente ai cicli (FORUMS) o (RUBRIQUES)',
718
-	'zbug_erreur_squelette' => 'Errore/i nel modello di layout',
719
-	'zbug_hors_compilation' => 'Fuori Compilazione',
720
-	'zbug_info_erreur_squelette' => 'Errore sul sito',
721
-	'zbug_inversion_ordre_inexistant' => 'inversione di un ordine non esistente',
722
-	'zbug_pagination_sans_critere' => '#PAGINATION senza criterio {pagination} oppure usato in un ciclo ricorsivo',
723
-	'zbug_parametres_inclus_incorrects' => 'Parametri di inclusione non corretti',
724
-	'zbug_profile' => 'Tempo di elaborazione: @time@',
725
-	'zbug_resultat' => 'risultato',
726
-	'zbug_serveur_indefini' => 'server SQL non definito',
727
-	'zbug_statistiques' => 'Statistiche delle query SQL in ordine di durata',
728
-	'zbug_table_inconnue' => 'Tabella SQL « @table@ » sconosciuta',
729
-	'zxml_connus_attributs' => 'attributi conosciuti',
730
-	'zxml_de' => 'di',
731
-	'zxml_inconnu_attribut' => 'attributo sconosciuto',
732
-	'zxml_inconnu_balise' => 'segnaposto sconosciuto',
733
-	'zxml_inconnu_entite' => 'entità sconosciuta',
734
-	'zxml_inconnu_id' => 'ID sconosciuto',
735
-	'zxml_mais_de' => 'ma di',
736
-	'zxml_non_conforme' => 'non è conforme al motivo',
737
-	'zxml_non_fils' => 'non è un figlio di',
738
-	'zxml_nonvide_balise' => 'segnaposto non vuoto',
739
-	'zxml_obligatoire_attribut' => 'attributo obbligatorio ma assente in',
740
-	'zxml_succession_fils_incorrecte' => 'successione dei figli non corretta',
741
-	'zxml_survoler' => 'passarci sopra col mouse per vedere i corretti',
742
-	'zxml_valeur_attribut' => 'valore dell’attributo',
743
-	'zxml_vide_balise' => 'tag vuoto',
744
-	'zxml_vu' => 'visto in precedenza'
694
+    // Z
695
+    'zbug_balise_b_aval' => ': ciclo B deve precedere ciclo BOUCLE',
696
+    'zbug_balise_inexistante' => 'errore @from@: il tag #@balise@ non esiste ',
697
+    'zbug_balise_sans_argument' => 'Argomento mancante nel tag @balise@',
698
+    'zbug_boucle' => 'ciclo',
699
+    'zbug_boucle_recursive_undef' => 'ciclo ricorsivo non definito',
700
+    'zbug_calcul' => 'calcolo',
701
+    'zbug_champ_hors_boucle' => 'Campo @champ@ fuori dal ciclo',
702
+    'zbug_champ_hors_critere' => 'Il campo @champ@ non rispetta il criterio @critere@',
703
+    'zbug_champ_hors_motif' => 'Campo @champ@ fuori da un contesto @motif@',
704
+    'zbug_code' => 'codice',
705
+    'zbug_critere_inconnu' => 'criterio sconosciuto @critere@',
706
+    'zbug_critere_sur_table_sans_cle_primaire' => '{@critere@} su una tabella senza una chiave primaria atomica',
707
+    'zbug_distant_interdit' => 'esterno non accessibile',
708
+    'zbug_doublon_table_sans_cle_primaire' => 'doppioni su una tabella senza chiave primaria atomica',
709
+    'zbug_doublon_table_sans_index' => 'doppioni su una tabella senza indice',
710
+    'zbug_erreur_boucle_double' => 'BOUCLE@id@: doppia definizione',
711
+    'zbug_erreur_boucle_fermant' => 'BOUCLE@id@: chiusura tag mancante',
712
+    'zbug_erreur_boucle_syntaxe' => 'Sintassi del ciclo errata',
713
+    'zbug_erreur_compilation' => 'Errore di compilazione',
714
+    'zbug_erreur_execution_page' => 'errore di esecuzione della pagina',
715
+    'zbug_erreur_filtre' => 'Errore : filtro <b>« @filtre@ »</b> non esistente',
716
+    'zbug_erreur_filtre_nbarg_min' => 'Filtro@filtre@: argomento(i) @nb@ mancante(i)',
717
+    'zbug_erreur_meme_parent' => 'il criterio {meme_parent} si applica unicamente ai cicli (FORUMS) o (RUBRIQUES)',
718
+    'zbug_erreur_squelette' => 'Errore/i nel modello di layout',
719
+    'zbug_hors_compilation' => 'Fuori Compilazione',
720
+    'zbug_info_erreur_squelette' => 'Errore sul sito',
721
+    'zbug_inversion_ordre_inexistant' => 'inversione di un ordine non esistente',
722
+    'zbug_pagination_sans_critere' => '#PAGINATION senza criterio {pagination} oppure usato in un ciclo ricorsivo',
723
+    'zbug_parametres_inclus_incorrects' => 'Parametri di inclusione non corretti',
724
+    'zbug_profile' => 'Tempo di elaborazione: @time@',
725
+    'zbug_resultat' => 'risultato',
726
+    'zbug_serveur_indefini' => 'server SQL non definito',
727
+    'zbug_statistiques' => 'Statistiche delle query SQL in ordine di durata',
728
+    'zbug_table_inconnue' => 'Tabella SQL « @table@ » sconosciuta',
729
+    'zxml_connus_attributs' => 'attributi conosciuti',
730
+    'zxml_de' => 'di',
731
+    'zxml_inconnu_attribut' => 'attributo sconosciuto',
732
+    'zxml_inconnu_balise' => 'segnaposto sconosciuto',
733
+    'zxml_inconnu_entite' => 'entità sconosciuta',
734
+    'zxml_inconnu_id' => 'ID sconosciuto',
735
+    'zxml_mais_de' => 'ma di',
736
+    'zxml_non_conforme' => 'non è conforme al motivo',
737
+    'zxml_non_fils' => 'non è un figlio di',
738
+    'zxml_nonvide_balise' => 'segnaposto non vuoto',
739
+    'zxml_obligatoire_attribut' => 'attributo obbligatorio ma assente in',
740
+    'zxml_succession_fils_incorrecte' => 'successione dei figli non corretta',
741
+    'zxml_survoler' => 'passarci sopra col mouse per vedere i corretti',
742
+    'zxml_valeur_attribut' => 'valore dell’attributo',
743
+    'zxml_vide_balise' => 'tag vuoto',
744
+    'zxml_vu' => 'visto in precedenza'
745 745
 );
Please login to merge, or discard this patch.
ecrire/inc/drapeau_edition.php 1 patch
Indentation   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
  * @package SPIP\Core\Drapeaux\Edition
31 31
  **/
32 32
 if (!defined('_ECRIRE_INC_VERSION')) {
33
-	return;
33
+    return;
34 34
 }
35 35
 
36 36
 
@@ -45,46 +45,46 @@  discard block
 block discarded – undo
45 45
  *     `[ type d'objet ][id_objet][id_auteur][nom de l'auteur] = time()`
46 46
  **/
47 47
 function lire_tableau_edition() {
48
-	$edition = @unserialize($GLOBALS['meta']['drapeau_edition']);
49
-	if (!$edition) {
50
-		return [];
51
-	}
52
-	$changed = false;
48
+    $edition = @unserialize($GLOBALS['meta']['drapeau_edition']);
49
+    if (!$edition) {
50
+        return [];
51
+    }
52
+    $changed = false;
53 53
 
54
-	$bon_pour_le_service = time() - 3600;
55
-	// parcourir le tableau et virer les vieux
56
-	foreach ($edition as $objet => $data) {
57
-		if (!is_array($data)) {
58
-			unset($edition[$objet]);
59
-		} // vieille version
60
-		else {
61
-			foreach ($data as $id => $tab) {
62
-				if (!is_array($tab)) {
63
-					unset($edition[$objet][$tab]);
64
-				} // vieille version
65
-				else {
66
-					foreach ($tab as $n => $duo) {
67
-						if (current($duo) < $bon_pour_le_service) {
68
-							unset($edition[$objet][$id][$n]);
69
-							$changed = true;
70
-						}
71
-					}
72
-				}
73
-				if (!$edition[$objet][$id]) {
74
-					unset($edition[$objet][$id]);
75
-				}
76
-			}
77
-		}
78
-		if (!$edition[$objet]) {
79
-			unset($edition[$objet]);
80
-		}
81
-	}
54
+    $bon_pour_le_service = time() - 3600;
55
+    // parcourir le tableau et virer les vieux
56
+    foreach ($edition as $objet => $data) {
57
+        if (!is_array($data)) {
58
+            unset($edition[$objet]);
59
+        } // vieille version
60
+        else {
61
+            foreach ($data as $id => $tab) {
62
+                if (!is_array($tab)) {
63
+                    unset($edition[$objet][$tab]);
64
+                } // vieille version
65
+                else {
66
+                    foreach ($tab as $n => $duo) {
67
+                        if (current($duo) < $bon_pour_le_service) {
68
+                            unset($edition[$objet][$id][$n]);
69
+                            $changed = true;
70
+                        }
71
+                    }
72
+                }
73
+                if (!$edition[$objet][$id]) {
74
+                    unset($edition[$objet][$id]);
75
+                }
76
+            }
77
+        }
78
+        if (!$edition[$objet]) {
79
+            unset($edition[$objet]);
80
+        }
81
+    }
82 82
 
83
-	if ($changed) {
84
-		ecrire_tableau_edition($edition);
85
-	}
83
+    if ($changed) {
84
+        ecrire_tableau_edition($edition);
85
+    }
86 86
 
87
-	return $edition;
87
+    return $edition;
88 88
 }
89 89
 
90 90
 /**
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
  *     `[ type d'objet ][id_objet][id_auteur][nom de l'auteur] = time()`
98 98
  **/
99 99
 function ecrire_tableau_edition($edition) {
100
-	ecrire_meta('drapeau_edition', serialize($edition));
100
+    ecrire_meta('drapeau_edition', serialize($edition));
101 101
 }
102 102
 
103 103
 /**
@@ -117,22 +117,22 @@  discard block
 block discarded – undo
117 117
  *     Type d'objet édité
118 118
  */
119 119
 function signale_edition($id, $auteur, $type = 'article') {
120
-	include_spip('base/objets');
121
-	include_spip('inc/filtres');
122
-	if (objet_info($type, 'editable') !== 'oui') {
123
-		return;
124
-	}
120
+    include_spip('base/objets');
121
+    include_spip('inc/filtres');
122
+    if (objet_info($type, 'editable') !== 'oui') {
123
+        return;
124
+    }
125 125
 
126
-	$edition = lire_tableau_edition();
126
+    $edition = lire_tableau_edition();
127 127
 	
128
-	$nom = $auteur['nom'] ?? $GLOBALS['ip'];
129
-	$id_a = $auteur['id_auteur'] ?? $GLOBALS['ip'];
128
+    $nom = $auteur['nom'] ?? $GLOBALS['ip'];
129
+    $id_a = $auteur['id_auteur'] ?? $GLOBALS['ip'];
130 130
 
131
-	if (!isset($edition[$type][$id]) or !is_array($edition[$type][$id])) {
132
-		$edition[$type][$id] = [];
133
-	}
134
-	$edition[$type][$id][$id_a][$nom] = time();
135
-	ecrire_tableau_edition($edition);
131
+    if (!isset($edition[$type][$id]) or !is_array($edition[$type][$id])) {
132
+        $edition[$type][$id] = [];
133
+    }
134
+    $edition[$type][$id][$id_a][$nom] = time();
135
+    ecrire_tableau_edition($edition);
136 136
 }
137 137
 
138 138
 /**
@@ -149,9 +149,9 @@  discard block
 block discarded – undo
149 149
  */
150 150
 function qui_edite($id, $type = 'article') {
151 151
 
152
-	$edition = lire_tableau_edition();
152
+    $edition = lire_tableau_edition();
153 153
 
154
-	return empty($edition[$type][$id]) ? [] : $edition[$type][$id];
154
+    return empty($edition[$type][$id]) ? [] : $edition[$type][$id];
155 155
 }
156 156
 
157 157
 /**
@@ -165,23 +165,23 @@  discard block
 block discarded – undo
165 165
  *     Liste de tableaux `['nom_auteur_modif' => x|y|z, 'date_diff' => n]`
166 166
  */
167 167
 function mention_qui_edite($id, $type = 'article'): array {
168
-	$modif = qui_edite($id, $type);
169
-	unset($modif[$GLOBALS['visiteur_session']['id_auteur']]);
168
+    $modif = qui_edite($id, $type);
169
+    unset($modif[$GLOBALS['visiteur_session']['id_auteur']]);
170 170
 
171
-	if ($modif) {
172
-		$quand = 0;
173
-		foreach ($modif as $duo) {
174
-			$auteurs[] = typo(key($duo));
175
-			$quand = max($quand, current($duo));
176
-		}
171
+    if ($modif) {
172
+        $quand = 0;
173
+        foreach ($modif as $duo) {
174
+            $auteurs[] = typo(key($duo));
175
+            $quand = max($quand, current($duo));
176
+        }
177 177
 
178
-		// format lie a la chaine de langue 'avis_article_modifie'
179
-		return [
180
-			'nom_auteur_modif' => join(' | ', $auteurs),
181
-			'date_diff' => ceil((time() - $quand) / 60)
182
-		];
183
-	}
184
-	return [];
178
+        // format lie a la chaine de langue 'avis_article_modifie'
179
+        return [
180
+            'nom_auteur_modif' => join(' | ', $auteurs),
181
+            'date_diff' => ceil((time() - $quand) / 60)
182
+        ];
183
+    }
184
+    return [];
185 185
 }
186 186
 
187 187
 /**
@@ -195,25 +195,25 @@  discard block
 block discarded – undo
195 195
  *     Liste de tableaux `['objet' => x, 'id_objet' => n]`
196 196
  */
197 197
 function liste_drapeau_edition($id_auteur) {
198
-	$edition = lire_tableau_edition();
199
-	$objets_ouverts = [];
198
+    $edition = lire_tableau_edition();
199
+    $objets_ouverts = [];
200 200
 
201
-	foreach ($edition as $objet => $data) {
202
-		foreach ($data as $id => $auteurs) {
203
-			if (
204
-				isset($auteurs[$id_auteur])
205
-				and is_array($auteurs[$id_auteur]) // precaution
206
-				and (array_pop($auteurs[$id_auteur]) > time() - 3600)
207
-			) {
208
-				$objets_ouverts[] = [
209
-					'objet' => $objet,
210
-					'id_objet' => $id,
211
-				];
212
-			}
213
-		}
214
-	}
201
+    foreach ($edition as $objet => $data) {
202
+        foreach ($data as $id => $auteurs) {
203
+            if (
204
+                isset($auteurs[$id_auteur])
205
+                and is_array($auteurs[$id_auteur]) // precaution
206
+                and (array_pop($auteurs[$id_auteur]) > time() - 3600)
207
+            ) {
208
+                $objets_ouverts[] = [
209
+                    'objet' => $objet,
210
+                    'id_objet' => $id,
211
+                ];
212
+            }
213
+        }
214
+    }
215 215
 
216
-	return $objets_ouverts;
216
+    return $objets_ouverts;
217 217
 }
218 218
 
219 219
 /**
@@ -226,15 +226,15 @@  discard block
 block discarded – undo
226 226
  * @return void
227 227
  */
228 228
 function debloquer_tous($id_auteur) {
229
-	$edition = lire_tableau_edition();
230
-	foreach ($edition as $objet => $data) {
231
-		foreach ($data as $id => $auteurs) {
232
-			if (isset($auteurs[$id_auteur])) {
233
-				unset($edition[$objet][$id][$id_auteur]);
234
-				ecrire_tableau_edition($edition);
235
-			}
236
-		}
237
-	}
229
+    $edition = lire_tableau_edition();
230
+    foreach ($edition as $objet => $data) {
231
+        foreach ($data as $id => $auteurs) {
232
+            if (isset($auteurs[$id_auteur])) {
233
+                unset($edition[$objet][$id][$id_auteur]);
234
+                ecrire_tableau_edition($edition);
235
+            }
236
+        }
237
+    }
238 238
 }
239 239
 
240 240
 /**
@@ -252,19 +252,19 @@  discard block
 block discarded – undo
252 252
  * @return void
253 253
  */
254 254
 function debloquer_edition($id_auteur, $id_objet, $type = 'article') {
255
-	$edition = lire_tableau_edition();
255
+    $edition = lire_tableau_edition();
256 256
 
257
-	foreach ($edition as $objet => $data) {
258
-		if ($objet == $type) {
259
-			foreach ($data as $id => $auteurs) {
260
-				if (
261
-					$id == $id_objet
262
-					and isset($auteurs[$id_auteur])
263
-				) {
264
-					unset($edition[$objet][$id][$id_auteur]);
265
-					ecrire_tableau_edition($edition);
266
-				}
267
-			}
268
-		}
269
-	}
257
+    foreach ($edition as $objet => $data) {
258
+        if ($objet == $type) {
259
+            foreach ($data as $id => $auteurs) {
260
+                if (
261
+                    $id == $id_objet
262
+                    and isset($auteurs[$id_auteur])
263
+                ) {
264
+                    unset($edition[$objet][$id][$id_auteur]);
265
+                    ecrire_tableau_edition($edition);
266
+                }
267
+            }
268
+        }
269
+    }
270 270
 }
Please login to merge, or discard this patch.
prive/formulaires/editer_liens.php 2 patches
Indentation   +352 added lines, -352 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @package SPIP\Core\Formulaires
17 17
  **/
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 
@@ -36,25 +36,25 @@  discard block
 block discarded – undo
36 36
  *   ($table_source,$objet,$id_objet,$objet_lien)
37 37
  */
38 38
 function determine_source_lien_objet($a, $b, $c) {
39
-	$table_source = $objet_lien = $objet = $id_objet = null;
40
-	// auteurs, article, 23 :
41
-	// associer des auteurs à l'article 23, sur la table pivot spip_auteurs_liens
42
-	if (is_numeric($c) and !is_numeric($b)) {
43
-		$table_source = table_objet($a);
44
-		$objet_lien = objet_type($a);
45
-		$objet = objet_type($b);
46
-		$id_objet = $c;
47
-	}
48
-	// article, 23, auteurs
49
-	// associer des auteurs à l'article 23, sur la table pivot spip_articles_liens
50
-	if (is_numeric($b) and !is_numeric($c)) {
51
-		$table_source = table_objet($c);
52
-		$objet_lien = objet_type($a);
53
-		$objet = objet_type($a);
54
-		$id_objet = $b;
55
-	}
56
-
57
-	return [$table_source, $objet, $id_objet, $objet_lien];
39
+    $table_source = $objet_lien = $objet = $id_objet = null;
40
+    // auteurs, article, 23 :
41
+    // associer des auteurs à l'article 23, sur la table pivot spip_auteurs_liens
42
+    if (is_numeric($c) and !is_numeric($b)) {
43
+        $table_source = table_objet($a);
44
+        $objet_lien = objet_type($a);
45
+        $objet = objet_type($b);
46
+        $id_objet = $c;
47
+    }
48
+    // article, 23, auteurs
49
+    // associer des auteurs à l'article 23, sur la table pivot spip_articles_liens
50
+    if (is_numeric($b) and !is_numeric($c)) {
51
+        $table_source = table_objet($c);
52
+        $objet_lien = objet_type($a);
53
+        $objet = objet_type($a);
54
+        $id_objet = $b;
55
+    }
56
+
57
+    return [$table_source, $objet, $id_objet, $objet_lien];
58 58
 }
59 59
 
60 60
 /**
@@ -80,93 +80,93 @@  discard block
 block discarded – undo
80 80
  */
81 81
 function formulaires_editer_liens_charger_dist($a, $b, $c, $options = []) {
82 82
 
83
-	// compat avec ancienne signature ou le 4eme argument est $editable
84
-	if (!is_array($options)) {
85
-		$options = ['editable' => $options];
86
-	} elseif (!isset($options['editable'])) {
87
-		$options['editable'] = true;
88
-	}
89
-
90
-	$editable = $options['editable'];
91
-
92
-	[$table_source, $objet, $id_objet, $objet_lien] = determine_source_lien_objet($a, $b, $c);
93
-	if (!$table_source or !$objet or !$objet_lien or !$id_objet) {
94
-		return false;
95
-	}
96
-
97
-	$objet_source = objet_type($table_source);
98
-	$table_sql_source = table_objet_sql($objet_source);
99
-
100
-	// verifier existence de la table xxx_liens
101
-	include_spip('action/editer_liens');
102
-	if (!objet_associable($objet_lien)) {
103
-		return false;
104
-	}
105
-
106
-	// L'éditabilité :) est définie par un test permanent (par exemple "associermots") ET le 4ème argument
107
-	include_spip('inc/autoriser');
108
-	$editable = ($editable and autoriser('associer' . $table_source, $objet, $id_objet)
109
-		and autoriser('modifier', $objet, $id_objet));
110
-
111
-	if (
112
-		!$editable and !count(objet_trouver_liens(
113
-			[$objet_lien => '*'],
114
-			[($objet_lien == $objet_source ? $objet : $objet_source) => $id_objet]
115
-		))
116
-	) {
117
-		return false;
118
-	}
119
-
120
-	// squelettes de vue et de d'association
121
-	// ils sont différents si des rôles sont définis.
122
-	$skel_vue = $table_source . '_lies';
123
-	$skel_ajout = $table_source . '_associer';
124
-
125
-	// description des roles
126
-	include_spip('inc/roles');
127
-	if ($roles = roles_presents($objet_source, $objet)) {
128
-		// on demande de nouveaux squelettes en conséquence
129
-		$skel_vue = $table_source . '_roles_lies';
130
-		$skel_ajout = $table_source . '_roles_associer';
131
-	}
132
-
133
-	$oups = '';
134
-	if ($editable) {
135
-		$oups = _request('_oups') ?? '';
136
-		if ($oups) {
137
-			if (json_decode(base64_decode($oups, true))) {
138
-				// on est bon, rien a faire
139
-			} else {
140
-				$oups = '';
141
-			}
142
-		}
143
-	}
144
-	$valeurs = [
145
-		'id' => "$table_source-$objet-$id_objet-$objet_lien", // identifiant unique pour les id du form
146
-		'_vue_liee' => $skel_vue,
147
-		'_vue_ajout' => $skel_ajout,
148
-		'_objet_lien' => $objet_lien,
149
-		'id_lien_ajoute' => _request('id_lien_ajoute'),
150
-		'objet' => $objet,
151
-		'id_objet' => $id_objet,
152
-		'objet_source' => $objet_source,
153
-		'table_source' => $table_source,
154
-		'recherche' => '',
155
-		'visible' => 0,
156
-		'ajouter_lien' => '',
157
-		'supprimer_lien' => '',
158
-		'qualifier_lien' => '',
159
-		'ordonner_lien' => '',
160
-		'desordonner_liens' => '',
161
-		'_roles' => $roles, # description des roles
162
-		'_oups' => entites_html($oups),
163
-		'editable' => $editable,
164
-	];
165
-
166
-	// les options non definies dans $valeurs sont passees telles quelles au formulaire html
167
-	$valeurs = array_merge($options, $valeurs);
168
-
169
-	return $valeurs;
83
+    // compat avec ancienne signature ou le 4eme argument est $editable
84
+    if (!is_array($options)) {
85
+        $options = ['editable' => $options];
86
+    } elseif (!isset($options['editable'])) {
87
+        $options['editable'] = true;
88
+    }
89
+
90
+    $editable = $options['editable'];
91
+
92
+    [$table_source, $objet, $id_objet, $objet_lien] = determine_source_lien_objet($a, $b, $c);
93
+    if (!$table_source or !$objet or !$objet_lien or !$id_objet) {
94
+        return false;
95
+    }
96
+
97
+    $objet_source = objet_type($table_source);
98
+    $table_sql_source = table_objet_sql($objet_source);
99
+
100
+    // verifier existence de la table xxx_liens
101
+    include_spip('action/editer_liens');
102
+    if (!objet_associable($objet_lien)) {
103
+        return false;
104
+    }
105
+
106
+    // L'éditabilité :) est définie par un test permanent (par exemple "associermots") ET le 4ème argument
107
+    include_spip('inc/autoriser');
108
+    $editable = ($editable and autoriser('associer' . $table_source, $objet, $id_objet)
109
+        and autoriser('modifier', $objet, $id_objet));
110
+
111
+    if (
112
+        !$editable and !count(objet_trouver_liens(
113
+            [$objet_lien => '*'],
114
+            [($objet_lien == $objet_source ? $objet : $objet_source) => $id_objet]
115
+        ))
116
+    ) {
117
+        return false;
118
+    }
119
+
120
+    // squelettes de vue et de d'association
121
+    // ils sont différents si des rôles sont définis.
122
+    $skel_vue = $table_source . '_lies';
123
+    $skel_ajout = $table_source . '_associer';
124
+
125
+    // description des roles
126
+    include_spip('inc/roles');
127
+    if ($roles = roles_presents($objet_source, $objet)) {
128
+        // on demande de nouveaux squelettes en conséquence
129
+        $skel_vue = $table_source . '_roles_lies';
130
+        $skel_ajout = $table_source . '_roles_associer';
131
+    }
132
+
133
+    $oups = '';
134
+    if ($editable) {
135
+        $oups = _request('_oups') ?? '';
136
+        if ($oups) {
137
+            if (json_decode(base64_decode($oups, true))) {
138
+                // on est bon, rien a faire
139
+            } else {
140
+                $oups = '';
141
+            }
142
+        }
143
+    }
144
+    $valeurs = [
145
+        'id' => "$table_source-$objet-$id_objet-$objet_lien", // identifiant unique pour les id du form
146
+        '_vue_liee' => $skel_vue,
147
+        '_vue_ajout' => $skel_ajout,
148
+        '_objet_lien' => $objet_lien,
149
+        'id_lien_ajoute' => _request('id_lien_ajoute'),
150
+        'objet' => $objet,
151
+        'id_objet' => $id_objet,
152
+        'objet_source' => $objet_source,
153
+        'table_source' => $table_source,
154
+        'recherche' => '',
155
+        'visible' => 0,
156
+        'ajouter_lien' => '',
157
+        'supprimer_lien' => '',
158
+        'qualifier_lien' => '',
159
+        'ordonner_lien' => '',
160
+        'desordonner_liens' => '',
161
+        '_roles' => $roles, # description des roles
162
+        '_oups' => entites_html($oups),
163
+        'editable' => $editable,
164
+    ];
165
+
166
+    // les options non definies dans $valeurs sont passees telles quelles au formulaire html
167
+    $valeurs = array_merge($options, $valeurs);
168
+
169
+    return $valeurs;
170 170
 }
171 171
 
172 172
 /**
@@ -210,165 +210,165 @@  discard block
 block discarded – undo
210 210
  * @return array
211 211
  */
212 212
 function formulaires_editer_liens_traiter_dist($a, $b, $c, $options = []) {
213
-	// compat avec ancienne signature ou le 4eme argument est $editable
214
-	if (!is_array($options)) {
215
-		$options = ['editable' => $options];
216
-	} elseif (!isset($options['editable'])) {
217
-		$options['editable'] = true;
218
-	}
219
-
220
-	$editable = $options['editable'];
221
-
222
-	$res = ['editable' => $editable ? true : false];
223
-	[$table_source, $objet, $id_objet, $objet_lien] = determine_source_lien_objet($a, $b, $c);
224
-	if (!$table_source or !$objet or !$objet_lien) {
225
-		return $res;
226
-	}
227
-
228
-
229
-	if (_request('tout_voir')) {
230
-		set_request('recherche', '');
231
-	}
232
-
233
-	include_spip('inc/autoriser');
234
-	if (autoriser('modifier', $objet, $id_objet)) {
235
-		// annuler les suppressions du coup d'avant !
236
-		if (
237
-			_request('annuler_oups')
238
-			and $oups = _request('_oups')
239
-			and $oups = base64_decode($oups, true)
240
-			and $oups = json_decode($oups, true)
241
-		) {
242
-			if ($oups_objets = charger_fonction("editer_liens_oups_{$table_source}_{$objet}_{$objet_lien}", 'action', true)) {
243
-				$oups_objets($oups);
244
-			} else {
245
-				$objet_source = objet_type($table_source);
246
-				include_spip('action/editer_liens');
247
-				foreach ($oups as $oup) {
248
-					if ($objet_lien == $objet_source) {
249
-						objet_associer([$objet_source => $oup[$objet_source]], [$objet => $oup[$objet]], $oup);
250
-					} else {
251
-						objet_associer([$objet => $oup[$objet]], [$objet_source => $oup[$objet_source]], $oup);
252
-					}
253
-				}
254
-			}
255
-			# oups ne persiste que pour la derniere action, si suppression
256
-			set_request('_oups');
257
-		}
258
-
259
-		$supprimer = _request('supprimer_lien');
260
-		$ajouter = _request('ajouter_lien');
261
-		$ordonner = _request('ordonner_lien');
262
-
263
-		if (_request('desordonner_liens')) {
264
-			include_spip('action/editer_liens');
265
-			objet_qualifier_liens([$objet_lien => '*'], [$objet => $id_objet], ['rang_lien' => 0]);
266
-		}
267
-
268
-		// il est possible de preciser dans une seule variable un remplacement :
269
-		// remplacer_lien[old][new]
270
-		if ($remplacer = _request('remplacer_lien')) {
271
-			foreach ($remplacer as $k => $v) {
272
-				if ($old = lien_verifier_action($k, '')) {
273
-					foreach (is_array($v) ? $v : [$v] as $kn => $vn) {
274
-						if ($new = lien_verifier_action($kn, $vn)) {
275
-							$supprimer[$old] = 'x';
276
-							$ajouter[$new] = '+';
277
-						}
278
-					}
279
-				}
280
-			}
281
-		}
282
-
283
-		if ($supprimer) {
284
-			if (
285
-				$supprimer_objets = charger_fonction(
286
-					"editer_liens_supprimer_{$table_source}_{$objet}_{$objet_lien}",
287
-					'action',
288
-					true
289
-				)
290
-			) {
291
-				$oups = $supprimer_objets($supprimer);
292
-			} else {
293
-				include_spip('action/editer_liens');
294
-				$oups = [];
295
-
296
-				foreach ($supprimer as $k => $v) {
297
-					if ($lien = lien_verifier_action($k, $v)) {
298
-						$lien = explode('-', $lien);
299
-						[$objet_source, $ids, $objet_lie, $idl, $role] = array_pad($lien, 5, null);
300
-						// appliquer une condition sur le rôle si défini ('*' pour tous les roles)
301
-						$cond = (!is_null($role) ? ['role' => $role] : []);
302
-						if ($objet_lien == $objet_source) {
303
-							$oups = array_merge(
304
-								$oups,
305
-								objet_trouver_liens([$objet_source => $ids], [$objet_lie => $idl], $cond)
306
-							);
307
-							objet_dissocier([$objet_source => $ids], [$objet_lie => $idl], $cond);
308
-						} else {
309
-							$oups = array_merge(
310
-								$oups,
311
-								objet_trouver_liens([$objet_lie => $idl], [$objet_source => $ids], $cond)
312
-							);
313
-							objet_dissocier([$objet_lie => $idl], [$objet_source => $ids], $cond);
314
-						}
315
-					}
316
-				}
317
-			}
318
-			set_request('_oups', $oups ? base64_encode(json_encode($oups)) : null);
319
-		}
320
-
321
-		if ($ajouter) {
322
-			if (
323
-				$ajouter_objets = charger_fonction("editer_liens_ajouter_{$table_source}_{$objet}_{$objet_lien}", 'action', true)
324
-			) {
325
-				$ajout_ok = $ajouter_objets($ajouter);
326
-			} else {
327
-				$ajout_ok = false;
328
-				include_spip('action/editer_liens');
329
-				foreach ($ajouter as $k => $v) {
330
-					if ($lien = lien_verifier_action($k, $v)) {
331
-						$ajout_ok = true;
332
-						[$objet1, $ids, $objet2, $idl] = explode('-', $lien);
333
-						$qualifs = lien_retrouver_qualif($objet_lien, $lien);
334
-						if ($objet_lien == $objet1) {
335
-							lien_ajouter_liaisons($objet1, $ids, $objet2, $idl, $qualifs);
336
-						} else {
337
-							lien_ajouter_liaisons($objet2, $idl, $objet1, $ids, $qualifs);
338
-						}
339
-						set_request('id_lien_ajoute', $ids);
340
-					}
341
-				}
342
-			}
343
-			# oups ne persiste que pour la derniere action, si suppression
344
-			# une suppression suivie d'un ajout dans le meme hit est un remplacement
345
-			# non annulable !
346
-			if ($ajout_ok) {
347
-				set_request('_oups');
348
-			}
349
-		}
350
-
351
-		if ($ordonner) {
352
-			include_spip('action/editer_liens');
353
-			foreach ($ordonner as $k => $rang_lien) {
354
-				if ($lien = lien_verifier_action($k, '')) {
355
-					[$objet1, $ids, $objet2, $idl] = explode('-', $lien);
356
-					$qualif = ['rang_lien' => $rang_lien];
357
-
358
-					if ($objet_lien == $objet1) {
359
-						objet_qualifier_liens([$objet1 => $ids], [$objet2 => $idl], $qualif);
360
-					} else {
361
-						objet_qualifier_liens([$objet2 => $idl], [$objet1 => $ids], $qualif);
362
-					}
363
-					set_request('id_lien_ajoute', $ids);
364
-					set_request('_oups');
365
-				}
366
-			}
367
-		}
368
-	}
369
-
370
-
371
-	return $res;
213
+    // compat avec ancienne signature ou le 4eme argument est $editable
214
+    if (!is_array($options)) {
215
+        $options = ['editable' => $options];
216
+    } elseif (!isset($options['editable'])) {
217
+        $options['editable'] = true;
218
+    }
219
+
220
+    $editable = $options['editable'];
221
+
222
+    $res = ['editable' => $editable ? true : false];
223
+    [$table_source, $objet, $id_objet, $objet_lien] = determine_source_lien_objet($a, $b, $c);
224
+    if (!$table_source or !$objet or !$objet_lien) {
225
+        return $res;
226
+    }
227
+
228
+
229
+    if (_request('tout_voir')) {
230
+        set_request('recherche', '');
231
+    }
232
+
233
+    include_spip('inc/autoriser');
234
+    if (autoriser('modifier', $objet, $id_objet)) {
235
+        // annuler les suppressions du coup d'avant !
236
+        if (
237
+            _request('annuler_oups')
238
+            and $oups = _request('_oups')
239
+            and $oups = base64_decode($oups, true)
240
+            and $oups = json_decode($oups, true)
241
+        ) {
242
+            if ($oups_objets = charger_fonction("editer_liens_oups_{$table_source}_{$objet}_{$objet_lien}", 'action', true)) {
243
+                $oups_objets($oups);
244
+            } else {
245
+                $objet_source = objet_type($table_source);
246
+                include_spip('action/editer_liens');
247
+                foreach ($oups as $oup) {
248
+                    if ($objet_lien == $objet_source) {
249
+                        objet_associer([$objet_source => $oup[$objet_source]], [$objet => $oup[$objet]], $oup);
250
+                    } else {
251
+                        objet_associer([$objet => $oup[$objet]], [$objet_source => $oup[$objet_source]], $oup);
252
+                    }
253
+                }
254
+            }
255
+            # oups ne persiste que pour la derniere action, si suppression
256
+            set_request('_oups');
257
+        }
258
+
259
+        $supprimer = _request('supprimer_lien');
260
+        $ajouter = _request('ajouter_lien');
261
+        $ordonner = _request('ordonner_lien');
262
+
263
+        if (_request('desordonner_liens')) {
264
+            include_spip('action/editer_liens');
265
+            objet_qualifier_liens([$objet_lien => '*'], [$objet => $id_objet], ['rang_lien' => 0]);
266
+        }
267
+
268
+        // il est possible de preciser dans une seule variable un remplacement :
269
+        // remplacer_lien[old][new]
270
+        if ($remplacer = _request('remplacer_lien')) {
271
+            foreach ($remplacer as $k => $v) {
272
+                if ($old = lien_verifier_action($k, '')) {
273
+                    foreach (is_array($v) ? $v : [$v] as $kn => $vn) {
274
+                        if ($new = lien_verifier_action($kn, $vn)) {
275
+                            $supprimer[$old] = 'x';
276
+                            $ajouter[$new] = '+';
277
+                        }
278
+                    }
279
+                }
280
+            }
281
+        }
282
+
283
+        if ($supprimer) {
284
+            if (
285
+                $supprimer_objets = charger_fonction(
286
+                    "editer_liens_supprimer_{$table_source}_{$objet}_{$objet_lien}",
287
+                    'action',
288
+                    true
289
+                )
290
+            ) {
291
+                $oups = $supprimer_objets($supprimer);
292
+            } else {
293
+                include_spip('action/editer_liens');
294
+                $oups = [];
295
+
296
+                foreach ($supprimer as $k => $v) {
297
+                    if ($lien = lien_verifier_action($k, $v)) {
298
+                        $lien = explode('-', $lien);
299
+                        [$objet_source, $ids, $objet_lie, $idl, $role] = array_pad($lien, 5, null);
300
+                        // appliquer une condition sur le rôle si défini ('*' pour tous les roles)
301
+                        $cond = (!is_null($role) ? ['role' => $role] : []);
302
+                        if ($objet_lien == $objet_source) {
303
+                            $oups = array_merge(
304
+                                $oups,
305
+                                objet_trouver_liens([$objet_source => $ids], [$objet_lie => $idl], $cond)
306
+                            );
307
+                            objet_dissocier([$objet_source => $ids], [$objet_lie => $idl], $cond);
308
+                        } else {
309
+                            $oups = array_merge(
310
+                                $oups,
311
+                                objet_trouver_liens([$objet_lie => $idl], [$objet_source => $ids], $cond)
312
+                            );
313
+                            objet_dissocier([$objet_lie => $idl], [$objet_source => $ids], $cond);
314
+                        }
315
+                    }
316
+                }
317
+            }
318
+            set_request('_oups', $oups ? base64_encode(json_encode($oups)) : null);
319
+        }
320
+
321
+        if ($ajouter) {
322
+            if (
323
+                $ajouter_objets = charger_fonction("editer_liens_ajouter_{$table_source}_{$objet}_{$objet_lien}", 'action', true)
324
+            ) {
325
+                $ajout_ok = $ajouter_objets($ajouter);
326
+            } else {
327
+                $ajout_ok = false;
328
+                include_spip('action/editer_liens');
329
+                foreach ($ajouter as $k => $v) {
330
+                    if ($lien = lien_verifier_action($k, $v)) {
331
+                        $ajout_ok = true;
332
+                        [$objet1, $ids, $objet2, $idl] = explode('-', $lien);
333
+                        $qualifs = lien_retrouver_qualif($objet_lien, $lien);
334
+                        if ($objet_lien == $objet1) {
335
+                            lien_ajouter_liaisons($objet1, $ids, $objet2, $idl, $qualifs);
336
+                        } else {
337
+                            lien_ajouter_liaisons($objet2, $idl, $objet1, $ids, $qualifs);
338
+                        }
339
+                        set_request('id_lien_ajoute', $ids);
340
+                    }
341
+                }
342
+            }
343
+            # oups ne persiste que pour la derniere action, si suppression
344
+            # une suppression suivie d'un ajout dans le meme hit est un remplacement
345
+            # non annulable !
346
+            if ($ajout_ok) {
347
+                set_request('_oups');
348
+            }
349
+        }
350
+
351
+        if ($ordonner) {
352
+            include_spip('action/editer_liens');
353
+            foreach ($ordonner as $k => $rang_lien) {
354
+                if ($lien = lien_verifier_action($k, '')) {
355
+                    [$objet1, $ids, $objet2, $idl] = explode('-', $lien);
356
+                    $qualif = ['rang_lien' => $rang_lien];
357
+
358
+                    if ($objet_lien == $objet1) {
359
+                        objet_qualifier_liens([$objet1 => $ids], [$objet2 => $idl], $qualif);
360
+                    } else {
361
+                        objet_qualifier_liens([$objet2 => $idl], [$objet1 => $ids], $qualif);
362
+                    }
363
+                    set_request('id_lien_ajoute', $ids);
364
+                    set_request('_oups');
365
+                }
366
+            }
367
+        }
368
+    }
369
+
370
+
371
+    return $res;
372 372
 }
373 373
 
374 374
 
@@ -391,24 +391,24 @@  discard block
 block discarded – undo
391 391
  * @return string Action demandée si trouvée, sinon ''
392 392
  */
393 393
 function lien_verifier_action($k, $v) {
394
-	$action = '';
395
-	if (preg_match(',^\w+-[\w*]+-[\w*]+-[\w*]+(-[\w*])?,', $k)) {
396
-		$action = $k;
397
-	}
398
-	if (preg_match(',^\w+-[\w*]+-[\w*]+-[\w*]+(-[\w*])?,', $v)) {
399
-		if (is_numeric($k)) {
400
-			$action = $v;
401
-		}
402
-		if (_request($k)) {
403
-			$action = $v;
404
-		}
405
-	}
406
-	// ajout un role null fictif (plus pratique) si pas défini
407
-	if ($action and count(explode('-', $action)) == 4) {
408
-		$action .= '-';
409
-	}
410
-
411
-	return $action;
394
+    $action = '';
395
+    if (preg_match(',^\w+-[\w*]+-[\w*]+-[\w*]+(-[\w*])?,', $k)) {
396
+        $action = $k;
397
+    }
398
+    if (preg_match(',^\w+-[\w*]+-[\w*]+-[\w*]+(-[\w*])?,', $v)) {
399
+        if (is_numeric($k)) {
400
+            $action = $v;
401
+        }
402
+        if (_request($k)) {
403
+            $action = $v;
404
+        }
405
+    }
406
+    // ajout un role null fictif (plus pratique) si pas défini
407
+    if ($action and count(explode('-', $action)) == 4) {
408
+        $action .= '-';
409
+    }
410
+
411
+    return $action;
412 412
 }
413 413
 
414 414
 
@@ -424,66 +424,66 @@  discard block
 block discarded – undo
424 424
  *   Liste des qualifs pour chaque lien. Tableau vide s'il n'y en a pas.
425 425
  **/
426 426
 function lien_retrouver_qualif($objet_lien, $lien) {
427
-	// un role est défini dans la liaison
428
-	$defs = explode('-', $lien);
429
-	[$objet1, , $objet2, , $role] = array_pad($defs, 5, null);
430
-	if ($objet_lien == $objet1) {
431
-		$colonne_role = roles_colonne($objet1, $objet2);
432
-	} else {
433
-		$colonne_role = roles_colonne($objet2, $objet1);
434
-	}
435
-
436
-	// cas ou le role est defini en 5e argument de l'action sur le lien (suppression, ajout rapide sans autre attribut)
437
-	if ($role) {
438
-		return [
439
-			// un seul lien avec ce role
440
-			[$colonne_role => $role]
441
-		];
442
-	}
443
-
444
-	// retrouver les rôles postés pour cette liaison, s'il y en a.
445
-	$qualifier_lien = _request('qualifier_lien');
446
-	if (!$qualifier_lien or !is_array($qualifier_lien)) {
447
-		return [];
448
-	}
449
-
450
-	// pas avec l'action complete (incluant le role)
451
-	$qualif = [];
452
-	if (
453
-		(!isset($qualifier_lien[$lien]) or !$qualif = $qualifier_lien[$lien])
454
-		and count($defs) == 5
455
-	) {
456
-		// on tente avec l'action sans le role
457
-		array_pop($defs);
458
-		$lien = implode('-', $defs);
459
-		if (!isset($qualifier_lien[$lien]) or !$qualif = $qualifier_lien[$lien]) {
460
-			$qualif = [];
461
-		}
462
-	}
463
-
464
-	// $qualif de la forme array(role=>array(...),valeur=>array(...),....)
465
-	// on le reforme en array(array(role=>..,valeur=>..,..),array(role=>..,valeur=>..,..),...)
466
-	$qualifs = [];
467
-	while (is_countable($qualif) ? count($qualif) : 0) {
468
-		$q = [];
469
-		foreach ($qualif as $att => $values) {
470
-			if (is_array($values)) {
471
-				$q[$att] = array_shift($qualif[$att]);
472
-				if (!(is_countable($qualif[$att]) ? count($qualif[$att]) : 0)) {
473
-					unset($qualif[$att]);
474
-				}
475
-			} else {
476
-				$q[$att] = $values;
477
-				unset($qualif[$att]);
478
-			}
479
-		}
480
-		// pas de rôle vide
481
-		if (!$colonne_role or !isset($q[$colonne_role]) or $q[$colonne_role]) {
482
-			$qualifs[] = $q;
483
-		}
484
-	}
485
-
486
-	return $qualifs;
427
+    // un role est défini dans la liaison
428
+    $defs = explode('-', $lien);
429
+    [$objet1, , $objet2, , $role] = array_pad($defs, 5, null);
430
+    if ($objet_lien == $objet1) {
431
+        $colonne_role = roles_colonne($objet1, $objet2);
432
+    } else {
433
+        $colonne_role = roles_colonne($objet2, $objet1);
434
+    }
435
+
436
+    // cas ou le role est defini en 5e argument de l'action sur le lien (suppression, ajout rapide sans autre attribut)
437
+    if ($role) {
438
+        return [
439
+            // un seul lien avec ce role
440
+            [$colonne_role => $role]
441
+        ];
442
+    }
443
+
444
+    // retrouver les rôles postés pour cette liaison, s'il y en a.
445
+    $qualifier_lien = _request('qualifier_lien');
446
+    if (!$qualifier_lien or !is_array($qualifier_lien)) {
447
+        return [];
448
+    }
449
+
450
+    // pas avec l'action complete (incluant le role)
451
+    $qualif = [];
452
+    if (
453
+        (!isset($qualifier_lien[$lien]) or !$qualif = $qualifier_lien[$lien])
454
+        and count($defs) == 5
455
+    ) {
456
+        // on tente avec l'action sans le role
457
+        array_pop($defs);
458
+        $lien = implode('-', $defs);
459
+        if (!isset($qualifier_lien[$lien]) or !$qualif = $qualifier_lien[$lien]) {
460
+            $qualif = [];
461
+        }
462
+    }
463
+
464
+    // $qualif de la forme array(role=>array(...),valeur=>array(...),....)
465
+    // on le reforme en array(array(role=>..,valeur=>..,..),array(role=>..,valeur=>..,..),...)
466
+    $qualifs = [];
467
+    while (is_countable($qualif) ? count($qualif) : 0) {
468
+        $q = [];
469
+        foreach ($qualif as $att => $values) {
470
+            if (is_array($values)) {
471
+                $q[$att] = array_shift($qualif[$att]);
472
+                if (!(is_countable($qualif[$att]) ? count($qualif[$att]) : 0)) {
473
+                    unset($qualif[$att]);
474
+                }
475
+            } else {
476
+                $q[$att] = $values;
477
+                unset($qualif[$att]);
478
+            }
479
+        }
480
+        // pas de rôle vide
481
+        if (!$colonne_role or !isset($q[$colonne_role]) or $q[$colonne_role]) {
482
+            $qualifs[] = $q;
483
+        }
484
+    }
485
+
486
+    return $qualifs;
487 487
 }
488 488
 
489 489
 /**
@@ -502,12 +502,12 @@  discard block
 block discarded – undo
502 502
  **/
503 503
 function lien_ajouter_liaisons($objet_source, $ids, $objet_lien, $idl, $qualifs) {
504 504
 
505
-	// retrouver la colonne de roles s'il y en a a lier
506
-	if (is_array($qualifs) and count($qualifs)) {
507
-		foreach ($qualifs as $qualif) {
508
-			objet_associer([$objet_source => $ids], [$objet_lien => $idl], $qualif);
509
-		}
510
-	} else {
511
-		objet_associer([$objet_source => $ids], [$objet_lien => $idl]);
512
-	}
505
+    // retrouver la colonne de roles s'il y en a a lier
506
+    if (is_array($qualifs) and count($qualifs)) {
507
+        foreach ($qualifs as $qualif) {
508
+            objet_associer([$objet_source => $ids], [$objet_lien => $idl], $qualif);
509
+        }
510
+    } else {
511
+        objet_associer([$objet_source => $ids], [$objet_lien => $idl]);
512
+    }
513 513
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 
106 106
 	// L'éditabilité :) est définie par un test permanent (par exemple "associermots") ET le 4ème argument
107 107
 	include_spip('inc/autoriser');
108
-	$editable = ($editable and autoriser('associer' . $table_source, $objet, $id_objet)
108
+	$editable = ($editable and autoriser('associer'.$table_source, $objet, $id_objet)
109 109
 		and autoriser('modifier', $objet, $id_objet));
110 110
 
111 111
 	if (
@@ -119,15 +119,15 @@  discard block
 block discarded – undo
119 119
 
120 120
 	// squelettes de vue et de d'association
121 121
 	// ils sont différents si des rôles sont définis.
122
-	$skel_vue = $table_source . '_lies';
123
-	$skel_ajout = $table_source . '_associer';
122
+	$skel_vue = $table_source.'_lies';
123
+	$skel_ajout = $table_source.'_associer';
124 124
 
125 125
 	// description des roles
126 126
 	include_spip('inc/roles');
127 127
 	if ($roles = roles_presents($objet_source, $objet)) {
128 128
 		// on demande de nouveaux squelettes en conséquence
129
-		$skel_vue = $table_source . '_roles_lies';
130
-		$skel_ajout = $table_source . '_roles_associer';
129
+		$skel_vue = $table_source.'_roles_lies';
130
+		$skel_ajout = $table_source.'_roles_associer';
131 131
 	}
132 132
 
133 133
 	$oups = '';
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 function lien_retrouver_qualif($objet_lien, $lien) {
427 427
 	// un role est défini dans la liaison
428 428
 	$defs = explode('-', $lien);
429
-	[$objet1, , $objet2, , $role] = array_pad($defs, 5, null);
429
+	[$objet1,, $objet2,, $role] = array_pad($defs, 5, null);
430 430
 	if ($objet_lien == $objet1) {
431 431
 		$colonne_role = roles_colonne($objet1, $objet2);
432 432
 	} else {
Please login to merge, or discard this patch.
ecrire/inc/filtres.php 3 patches
Spacing   +129 added lines, -130 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	}
97 97
 
98 98
 	include_fichiers_fonctions();
99
-	foreach (['filtre_' . $fonc, 'filtre_' . $fonc . '_dist', $fonc] as $f) {
99
+	foreach (['filtre_'.$fonc, 'filtre_'.$fonc.'_dist', $fonc] as $f) {
100 100
 		trouver_filtre_matrice($f); // charge des fichiers spécifiques éventuels
101 101
 		if (is_callable($f)) {
102 102
 			return $f;
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	// affichage "GIT [master: abcdef]"
235 235
 	$commit = $desc['commit_short'] ?? $desc['commit'];
236 236
 	if ($desc['branch']) {
237
-		$commit = $desc['branch'] . ': ' . $commit;
237
+		$commit = $desc['branch'].': '.$commit;
238 238
 	}
239 239
 	return "{$desc['vcs']} [$commit]";
240 240
 }
@@ -253,9 +253,9 @@  discard block
 block discarded – undo
253 253
 	}
254 254
 
255 255
 	// version installee par GIT
256
-	if (lire_fichier($dir . '/.git/HEAD', $c)) {
256
+	if (lire_fichier($dir.'/.git/HEAD', $c)) {
257 257
 		$currentHead = trim(substr($c, 4));
258
-		if (lire_fichier($dir . '/.git/' . $currentHead, $hash)) {
258
+		if (lire_fichier($dir.'/.git/'.$currentHead, $hash)) {
259 259
 			return [
260 260
 				'vcs' => 'GIT',
261 261
 				'branch' => basename($currentHead),
@@ -282,8 +282,8 @@  discard block
 block discarded – undo
282 282
 		$dir = '.';
283 283
 	}
284 284
 	// version installee par SVN
285
-	if (file_exists($dir . '/.svn/wc.db') && class_exists(\SQLite3::class)) {
286
-		$db = new SQLite3($dir . '/.svn/wc.db');
285
+	if (file_exists($dir.'/.svn/wc.db') && class_exists(\SQLite3::class)) {
286
+		$db = new SQLite3($dir.'/.svn/wc.db');
287 287
 		$result = $db->query('SELECT changed_revision FROM nodes WHERE local_relpath = "" LIMIT 1');
288 288
 		if ($result) {
289 289
 			$row = $result->fetchArray();
@@ -301,12 +301,12 @@  discard block
 block discarded – undo
301 301
 
302 302
 // La matrice est necessaire pour ne filtrer _que_ des fonctions definies dans filtres_images
303 303
 // et laisser passer les fonctions personnelles baptisees image_...
304
-$GLOBALS['spip_matrice']['image_graver'] = true;//'inc/filtres_images_mini.php';
305
-$GLOBALS['spip_matrice']['image_select'] = true;//'inc/filtres_images_mini.php';
306
-$GLOBALS['spip_matrice']['image_reduire'] = true;//'inc/filtres_images_mini.php';
307
-$GLOBALS['spip_matrice']['image_reduire_par'] = true;//'inc/filtres_images_mini.php';
308
-$GLOBALS['spip_matrice']['image_passe_partout'] = true;//'inc/filtres_images_mini.php';
309
-$GLOBALS['spip_matrice']['image_recadre_avec_fallback'] = true;//'inc/filtres_images_mini.php';
304
+$GLOBALS['spip_matrice']['image_graver'] = true; //'inc/filtres_images_mini.php';
305
+$GLOBALS['spip_matrice']['image_select'] = true; //'inc/filtres_images_mini.php';
306
+$GLOBALS['spip_matrice']['image_reduire'] = true; //'inc/filtres_images_mini.php';
307
+$GLOBALS['spip_matrice']['image_reduire_par'] = true; //'inc/filtres_images_mini.php';
308
+$GLOBALS['spip_matrice']['image_passe_partout'] = true; //'inc/filtres_images_mini.php';
309
+$GLOBALS['spip_matrice']['image_recadre_avec_fallback'] = true; //'inc/filtres_images_mini.php';
310 310
 
311 311
 $GLOBALS['spip_matrice']['couleur_html_to_hex'] = 'inc/filtres_images_mini.php';
312 312
 $GLOBALS['spip_matrice']['couleur_hex_to_hsl'] = 'inc/filtres_images_mini.php';
@@ -465,8 +465,8 @@  discard block
 block discarded – undo
465 465
  */
466 466
 function filtre_debug($val, $key = null) {
467 467
 	$debug = (
468
-		is_null($key) ? '' : (var_export($key, true) . ' = ')
469
-		) . var_export($val, true);
468
+		is_null($key) ? '' : (var_export($key, true).' = ')
469
+		).var_export($val, true);
470 470
 
471 471
 	include_spip('inc/autoriser');
472 472
 	if (autoriser('webmestre')) {
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 		$is_file = false;
523 523
 	}
524 524
 	if ($is_file) {
525
-		$is_local_file = function ($path) {
525
+		$is_local_file = function($path) {
526 526
 			if (strpos($path, '?') !== false) {
527 527
 				$path = supprimer_timestamp($path);
528 528
 				// remove ?24px added by find_in_theme on .svg files
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
 					if ($mouseover = extraire_attribut($reduit, 'onmouseover')) {
572 572
 						if (preg_match(",this[.]src=['\"]([^'\"]+)['\"],ims", $mouseover, $match)) {
573 573
 							$srcover = $match[1];
574
-							$srcover_filter = $filtre("<img src='" . $match[1] . "' />", ...$args);
574
+							$srcover_filter = $filtre("<img src='".$match[1]."' />", ...$args);
575 575
 							$srcover_filter = extraire_attribut($srcover_filter, 'src');
576 576
 							$reduit = str_replace($srcover, $srcover_filter, $reduit);
577 577
 						}
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
 	// " -> &quot; et tout ce genre de choses
973 973
 	$u = $GLOBALS['meta']['pcre_u'];
974 974
 	$texte = str_replace('&nbsp;', ' ', $texte);
975
-	$texte = preg_replace('/\s{2,}/S' . $u, ' ', $texte);
975
+	$texte = preg_replace('/\s{2,}/S'.$u, ' ', $texte);
976 976
 	// ne pas echapper les sinqle quotes car certains outils de syndication gerent mal
977 977
 	$texte = entites_html($texte, false, false);
978 978
 	// mais bien echapper les double quotes !
@@ -1032,7 +1032,7 @@  discard block
 block discarded – undo
1032 1032
  **/
1033 1033
 function supprimer_numero($texte) {
1034 1034
 	return preg_replace(
1035
-		',^[[:space:]]*([0-9]+)([.)]|' . chr(194) . '?' . chr(176) . ')[[:space:]]+,S',
1035
+		',^[[:space:]]*([0-9]+)([.)]|'.chr(194).'?'.chr(176).')[[:space:]]+,S',
1036 1036
 		'',
1037 1037
 		$texte
1038 1038
 	);
@@ -1060,7 +1060,7 @@  discard block
 block discarded – undo
1060 1060
 function recuperer_numero($texte) {
1061 1061
 	if (
1062 1062
 		preg_match(
1063
-			',^[[:space:]]*([0-9]+)([.)]|' . chr(194) . '?' . chr(176) . ')[[:space:]]+,S',
1063
+			',^[[:space:]]*([0-9]+)([.)]|'.chr(194).'?'.chr(176).')[[:space:]]+,S',
1064 1064
 			$texte,
1065 1065
 			$regs
1066 1066
 		)
@@ -1151,8 +1151,8 @@  discard block
 block discarded – undo
1151 1151
  **/
1152 1152
 function textebrut($texte) {
1153 1153
 	$u = $GLOBALS['meta']['pcre_u'];
1154
-	$texte = preg_replace('/\s+/S' . $u, ' ', $texte);
1155
-	$texte = preg_replace('/<(p|br)( [^>]*)?' . '>/iS', "\n\n", $texte);
1154
+	$texte = preg_replace('/\s+/S'.$u, ' ', $texte);
1155
+	$texte = preg_replace('/<(p|br)( [^>]*)?'.'>/iS', "\n\n", $texte);
1156 1156
 	$texte = preg_replace("/^\n+/", '', $texte);
1157 1157
 	$texte = preg_replace("/\n+$/", '', $texte);
1158 1158
 	$texte = preg_replace("/\n +/", "\n", $texte);
@@ -1186,7 +1186,7 @@  discard block
 block discarded – undo
1186 1186
 		)
1187 1187
 	) {
1188 1188
 		foreach ($liens[0] as $a) {
1189
-			$rel = 'noopener noreferrer ' . extraire_attribut($a, 'rel');
1189
+			$rel = 'noopener noreferrer '.extraire_attribut($a, 'rel');
1190 1190
 			$ablank = inserer_attribut($a, 'rel', $rel);
1191 1191
 			$ablank = inserer_attribut($ablank, 'target', '_blank');
1192 1192
 			$texte = str_replace($a, $ablank, $texte);
@@ -1211,7 +1211,7 @@  discard block
 block discarded – undo
1211 1211
 		foreach ($regs[0] as $a) {
1212 1212
 			$rel = extraire_attribut($a, 'rel') ?? '';
1213 1213
 			if (strpos($rel, 'nofollow') === false) {
1214
-				$rel = 'nofollow' . ($rel ? " $rel" : '');
1214
+				$rel = 'nofollow'.($rel ? " $rel" : '');
1215 1215
 				$anofollow = inserer_attribut($a, 'rel', $rel);
1216 1216
 				$texte = str_replace($a, $anofollow, $texte);
1217 1217
 			}
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
 	$u = $GLOBALS['meta']['pcre_u'];
1241 1241
 	$texte = preg_replace('@</p>@iS', "\n", $texte);
1242 1242
 	$texte = preg_replace("@<p\b.*>@UiS", '<br />', $texte);
1243
-	$texte = preg_replace('@^\s*<br />@S' . $u, '', $texte);
1243
+	$texte = preg_replace('@^\s*<br />@S'.$u, '', $texte);
1244 1244
 
1245 1245
 	return $texte;
1246 1246
 }
@@ -1271,7 +1271,7 @@  discard block
 block discarded – undo
1271 1271
 		return $texte;
1272 1272
 	}
1273 1273
 	include_spip('inc/texte');
1274
-	$tag = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $texte) ?
1274
+	$tag = preg_match(',</?('._BALISES_BLOCS.')[>[:space:]],iS', $texte) ?
1275 1275
 		'div' : 'span';
1276 1276
 
1277 1277
 	return "<$tag style='word-wrap:break-word;'>$texte</$tag>";
@@ -1383,7 +1383,7 @@  discard block
 block discarded – undo
1383 1383
 	}
1384 1384
 	$u = $GLOBALS['meta']['pcre_u'];
1385 1385
 	if ($textebrut) {
1386
-		$texte = preg_replace([",\n,", ',\s(?=\s),msS' . $u], [' ', ''], textebrut($texte));
1386
+		$texte = preg_replace([",\n,", ',\s(?=\s),msS'.$u], [' ', ''], textebrut($texte));
1387 1387
 	}
1388 1388
 	$texte = texte_backend($texte);
1389 1389
 	$texte = str_replace(["'", '"'], ['&#039;', '&#034;'], $texte);
@@ -1418,7 +1418,7 @@  discard block
 block discarded – undo
1418 1418
 	# un message pour abs_url
1419 1419
 	$GLOBALS['mode_abs_url'] = 'url';
1420 1420
 	$url = trim($url);
1421
-	$r = ',^(?:' . _PROTOCOLES_STD . '):?/?/?$,iS';
1421
+	$r = ',^(?:'._PROTOCOLES_STD.'):?/?/?$,iS';
1422 1422
 
1423 1423
 	return preg_match($r, $url) ? '' : ($entites ? entites_html($url) : $url);
1424 1424
 }
@@ -1618,14 +1618,14 @@  discard block
 block discarded – undo
1618 1618
 	if (strpos($texte, '<') !== false) {
1619 1619
 		include_spip('inc/lien');
1620 1620
 		if (defined('_PREG_MODELE')) {
1621
-			$preg_modeles = '@' . _PREG_MODELE . '@imsS';
1621
+			$preg_modeles = '@'._PREG_MODELE.'@imsS';
1622 1622
 			$texte = echappe_html($texte, '', true, $preg_modeles);
1623 1623
 		}
1624 1624
 	}
1625 1625
 
1626 1626
 	$debut = '';
1627 1627
 	$suite = $texte;
1628
-	while ($t = strpos('-' . $suite, "\n", 1)) {
1628
+	while ($t = strpos('-'.$suite, "\n", 1)) {
1629 1629
 		$debut .= substr($suite, 0, $t - 1);
1630 1630
 		$suite = substr($suite, $t);
1631 1631
 		$car = substr($suite, 0, 1);
@@ -1643,11 +1643,11 @@  discard block
 block discarded – undo
1643 1643
 			$suite = substr($suite, strlen($regs[0]));
1644 1644
 		}
1645 1645
 	}
1646
-	$texte = $debut . $suite;
1646
+	$texte = $debut.$suite;
1647 1647
 
1648 1648
 	$texte = echappe_retour($texte);
1649 1649
 
1650
-	return $texte . $fin;
1650
+	return $texte.$fin;
1651 1651
 }
1652 1652
 
1653 1653
 
@@ -1709,7 +1709,7 @@  discard block
 block discarded – undo
1709 1709
 		}
1710 1710
 
1711 1711
 		foreach ($regs as $reg) {
1712
-			$cle = ($reg[1] ? $reg[1] . ':' : '') . $reg[2];
1712
+			$cle = ($reg[1] ? $reg[1].':' : '').$reg[2];
1713 1713
 			$desc = $traduire($cle, $lang, true);
1714 1714
 			$l = $desc->langue;
1715 1715
 			// si pas de traduction, on laissera l'écriture de l'idiome entier dans le texte.
@@ -1823,9 +1823,9 @@  discard block
 block discarded – undo
1823 1823
 					// il ne faut pas echapper en div si propre produit un seul paragraphe
1824 1824
 					include_spip('inc/texte');
1825 1825
 					$trad_propre = preg_replace(',(^<p[^>]*>|</p>$),Uims', '', propre($trad));
1826
-					$mode = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $trad_propre) ? 'div' : 'span';
1826
+					$mode = preg_match(',</?('._BALISES_BLOCS.')[>[:space:]],iS', $trad_propre) ? 'div' : 'span';
1827 1827
 					if ($mode === 'div') {
1828
-						$trad = rtrim($trad) . "\n\n";
1828
+						$trad = rtrim($trad)."\n\n";
1829 1829
 					}
1830 1830
 					$trad = code_echappement($trad, 'multi', false, $mode);
1831 1831
 					$trad = str_replace("'", '"', inserer_attribut($trad, 'lang', $l));
@@ -2025,7 +2025,7 @@  discard block
 block discarded – undo
2025 2025
 	if (is_array($balise)) {
2026 2026
 		array_walk(
2027 2027
 			$balise,
2028
-			function (&$a, $key, $t) {
2028
+			function(&$a, $key, $t) {
2029 2029
 				$a = extraire_attribut($a, $t);
2030 2030
 			},
2031 2031
 			$attribut
@@ -2122,14 +2122,14 @@  discard block
 block discarded – undo
2122 2122
 
2123 2123
 	if ($old !== null) {
2124 2124
 		// Remplacer l'ancien attribut du meme nom
2125
-		$balise = $r[1] . $insert . $r[5];
2125
+		$balise = $r[1].$insert.$r[5];
2126 2126
 	} else {
2127 2127
 		// preferer une balise " />" (comme <img />)
2128 2128
 		if (preg_match(',/>,', $balise)) {
2129
-			$balise = preg_replace(',\s?/>,S', $insert . ' />', $balise, 1);
2129
+			$balise = preg_replace(',\s?/>,S', $insert.' />', $balise, 1);
2130 2130
 		} // sinon une balise <a ...> ... </a>
2131 2131
 		else {
2132
-			$balise = preg_replace(',\s?>,S', $insert . '>', $balise, 1);
2132
+			$balise = preg_replace(',\s?>,S', $insert.'>', $balise, 1);
2133 2133
 		}
2134 2134
 	}
2135 2135
 
@@ -2184,7 +2184,7 @@  discard block
 block discarded – undo
2184 2184
 		if (
2185 2185
 			$class_courante
2186 2186
 			and strpos($class_courante, (string) $c) !== false
2187
-			and preg_match('/(^|\s)' . preg_quote($c) . '($|\s)/', $class_courante)
2187
+			and preg_match('/(^|\s)'.preg_quote($c).'($|\s)/', $class_courante)
2188 2188
 		) {
2189 2189
 			$is_class_presente = true;
2190 2190
 		}
@@ -2192,12 +2192,12 @@  discard block
 block discarded – undo
2192 2192
 			in_array($operation, ['ajouter', 'commuter'])
2193 2193
 			and !$is_class_presente
2194 2194
 		) {
2195
-			$class_new = ltrim(rtrim($class_new ?? '') . ' ' . $c);
2195
+			$class_new = ltrim(rtrim($class_new ?? '').' '.$c);
2196 2196
 		} elseif (
2197 2197
 			in_array($operation, ['supprimer', 'commuter'])
2198 2198
 			and $is_class_presente
2199 2199
 		) {
2200
-			$class_new = trim(preg_replace('/(^|\s)' . preg_quote($c) . '($|\s)/', "\\1", $class_new));
2200
+			$class_new = trim(preg_replace('/(^|\s)'.preg_quote($c).'($|\s)/', "\\1", $class_new));
2201 2201
 		}
2202 2202
 	}
2203 2203
 
@@ -2260,7 +2260,7 @@  discard block
 block discarded – undo
2260 2260
 // Quelques fonctions de calcul arithmetique
2261 2261
 //
2262 2262
 function floatstr($a) {
2263
- return str_replace(',', '.', (string)floatval($a));
2263
+ return str_replace(',', '.', (string) floatval($a));
2264 2264
 }
2265 2265
 function strize($f, $a, $b) {
2266 2266
  return floatstr($f(floatstr($a), floatstr($b)));
@@ -2396,13 +2396,13 @@  discard block
 block discarded – undo
2396 2396
 	if (!defined('_TAGS_NOM_AUTEUR')) {
2397 2397
 		define('_TAGS_NOM_AUTEUR', '');
2398 2398
 	}
2399
-	$tags_acceptes = array_unique(explode(',', 'multi,' . _TAGS_NOM_AUTEUR));
2399
+	$tags_acceptes = array_unique(explode(',', 'multi,'._TAGS_NOM_AUTEUR));
2400 2400
 	foreach ($tags_acceptes as $tag) {
2401 2401
 		if (strlen($tag)) {
2402
-			$remp1[] = '<' . trim($tag) . '>';
2403
-			$remp1[] = '</' . trim($tag) . '>';
2404
-			$remp2[] = '\x60' . trim($tag) . '\x61';
2405
-			$remp2[] = '\x60/' . trim($tag) . '\x61';
2402
+			$remp1[] = '<'.trim($tag).'>';
2403
+			$remp1[] = '</'.trim($tag).'>';
2404
+			$remp2[] = '\x60'.trim($tag).'\x61';
2405
+			$remp2[] = '\x60/'.trim($tag).'\x61';
2406 2406
 		}
2407 2407
 	}
2408 2408
 	$v_nom = str_replace($remp2, $remp1, supprimer_tags(str_replace($remp1, $remp2, $nom)));
@@ -2522,10 +2522,10 @@  discard block
 block discarded – undo
2522 2522
 	$fichier = basename($url);
2523 2523
 
2524 2524
 	return '<a rel="enclosure"'
2525
-	. ($url ? ' href="' . spip_htmlspecialchars($url) . '"' : '')
2526
-	. ($type ? ' type="' . spip_htmlspecialchars($type) . '"' : '')
2527
-	. ($length ? ' title="' . spip_htmlspecialchars($length) . '"' : '')
2528
-	. '>' . $fichier . '</a>';
2525
+	. ($url ? ' href="'.spip_htmlspecialchars($url).'"' : '')
2526
+	. ($type ? ' type="'.spip_htmlspecialchars($type).'"' : '')
2527
+	. ($length ? ' title="'.spip_htmlspecialchars($length).'"' : '')
2528
+	. '>'.$fichier.'</a>';
2529 2529
 }
2530 2530
 
2531 2531
 /**
@@ -2553,9 +2553,9 @@  discard block
 block discarded – undo
2553 2553
 			} # vieux data
2554 2554
 			$fichier = basename($url);
2555 2555
 			$enclosures[] = '<enclosure'
2556
-				. ($url ? ' url="' . spip_htmlspecialchars($url) . '"' : '')
2557
-				. ($type ? ' type="' . spip_htmlspecialchars($type) . '"' : '')
2558
-				. ($length ? ' length="' . $length . '"' : '')
2556
+				. ($url ? ' url="'.spip_htmlspecialchars($url).'"' : '')
2557
+				. ($type ? ' type="'.spip_htmlspecialchars($type).'"' : '')
2558
+				. ($length ? ' length="'.$length.'"' : '')
2559 2559
 				. ' />';
2560 2560
 		}
2561 2561
 	}
@@ -2581,7 +2581,7 @@  discard block
 block discarded – undo
2581 2581
 		if (extraire_attribut($e, 'rel') == 'tag') {
2582 2582
 			$subjects .= '<dc:subject>'
2583 2583
 				. texte_backend(textebrut($e))
2584
-				. '</dc:subject>' . "\n";
2584
+				. '</dc:subject>'."\n";
2585 2585
 		}
2586 2586
 	}
2587 2587
 
@@ -2617,7 +2617,7 @@  discard block
 block discarded – undo
2617 2617
 	if (is_array($texte)) {
2618 2618
 		array_walk(
2619 2619
 			$texte,
2620
-			function (&$a, $key, $t) {
2620
+			function(&$a, $key, $t) {
2621 2621
 				$a = extraire_balise($a, $t);
2622 2622
 			},
2623 2623
 			$tag
@@ -2665,7 +2665,7 @@  discard block
 block discarded – undo
2665 2665
 	if (is_array($texte)) {
2666 2666
 		array_walk(
2667 2667
 			$texte,
2668
-			function (&$a, $key, $t) {
2668
+			function(&$a, $key, $t) {
2669 2669
 				$a = extraire_balises($a, $t);
2670 2670
 			},
2671 2671
 			$tag
@@ -2798,7 +2798,7 @@  discard block
 block discarded – undo
2798 2798
 		if ($fond != '404') {
2799 2799
 			$contexte = array_shift($p);
2800 2800
 			$contexte['page'] = $fond;
2801
-			$action = preg_replace('/([?]' . preg_quote($fond) . '[^&=]*[0-9]+)(&|$)/', '?&', $action);
2801
+			$action = preg_replace('/([?]'.preg_quote($fond).'[^&=]*[0-9]+)(&|$)/', '?&', $action);
2802 2802
 		}
2803 2803
 	}
2804 2804
 	// defaire ce qu'a injecte urls_decoder_url : a revoir en modifiant la signature de urls_decoder_url
@@ -2853,9 +2853,9 @@  discard block
 block discarded – undo
2853 2853
 			. '"'
2854 2854
 			. (is_null($val)
2855 2855
 				? ''
2856
-				: ' value="' . entites_html($val) . '"'
2856
+				: ' value="'.entites_html($val).'"'
2857 2857
 			)
2858
-			. ' type="hidden"' . "\n/>";
2858
+			. ' type="hidden"'."\n/>";
2859 2859
 	}
2860 2860
 
2861 2861
 	return join('', $hidden);
@@ -2965,7 +2965,7 @@  discard block
 block discarded – undo
2965 2965
 
2966 2966
 	return preg_replace_callback(
2967 2967
 		",url\s*\(\s*['\"]?([^'\"/#\s][^:]*)['\"]?\s*\),Uims",
2968
-		fn($x) => "url('" . suivre_lien($path, $x[1]) . "')",
2968
+		fn($x) => "url('".suivre_lien($path, $x[1])."')",
2969 2969
 		$contenu
2970 2970
 	);
2971 2971
 }
@@ -3026,14 +3026,14 @@  discard block
 block discarded – undo
3026 3026
 	) {
3027 3027
 		$distant = true;
3028 3028
 		$cssf = parse_url($css);
3029
-		$cssf = $cssf['path'] . ($cssf['query'] ? '?' . $cssf['query'] : '');
3029
+		$cssf = $cssf['path'].($cssf['query'] ? '?'.$cssf['query'] : '');
3030 3030
 		$cssf = preg_replace(',[?:&=],', '_', $cssf);
3031 3031
 	} else {
3032 3032
 		$distant = false;
3033 3033
 		$cssf = $css;
3034 3034
 		// 1. regarder d'abord si un fichier avec la bonne direction n'est pas aussi
3035 3035
 		//propose (rien a faire dans ce cas)
3036
-		$f = preg_replace(',(_rtl)?\.css$,i', '_' . $ndir . '.css', $css);
3036
+		$f = preg_replace(',(_rtl)?\.css$,i', '_'.$ndir.'.css', $css);
3037 3037
 		if (@file_exists($f)) {
3038 3038
 			return $f;
3039 3039
 		}
@@ -3043,7 +3043,7 @@  discard block
 block discarded – undo
3043 3043
 	$dir_var = sous_repertoire(_DIR_VAR, 'cache-css');
3044 3044
 	$f = $dir_var
3045 3045
 		. preg_replace(',.*/(.*?)(_rtl)?\.css,', '\1', $cssf)
3046
-		. '.' . substr(md5($cssf), 0, 4) . '_' . $ndir . '.css';
3046
+		. '.'.substr(md5($cssf), 0, 4).'_'.$ndir.'.css';
3047 3047
 
3048 3048
 	// la css peut etre distante (url absolue !)
3049 3049
 	if ($distant) {
@@ -3089,8 +3089,8 @@  discard block
 block discarded – undo
3089 3089
 		} // si la css_direction commence par $dir_var on la fait passer pour une absolue
3090 3090
 		elseif (substr($css_direction, 0, strlen($dir_var)) == $dir_var) {
3091 3091
 			$css_direction = substr($css_direction, strlen($dir_var));
3092
-			$src_faux_abs['/@@@@@@/' . $css_direction] = $css_direction;
3093
-			$css_direction = '/@@@@@@/' . $css_direction;
3092
+			$src_faux_abs['/@@@@@@/'.$css_direction] = $css_direction;
3093
+			$css_direction = '/@@@@@@/'.$css_direction;
3094 3094
 		}
3095 3095
 		$src[] = $regs[0][$k];
3096 3096
 		$src_direction_css[] = str_replace($import_css, $css_direction, $regs[0][$k]);
@@ -3139,7 +3139,7 @@  discard block
 block discarded – undo
3139 3139
 
3140 3140
 	$f = basename($css, '.css');
3141 3141
 	$f = sous_repertoire(_DIR_VAR, 'cache-css')
3142
-		. preg_replace(',(.*?)(_rtl|_ltr)?$,', "\\1-urlabs-" . substr(md5("$css-urlabs"), 0, 4) . "\\2", $f)
3142
+		. preg_replace(',(.*?)(_rtl|_ltr)?$,', "\\1-urlabs-".substr(md5("$css-urlabs"), 0, 4)."\\2", $f)
3143 3143
 		. '.css';
3144 3144
 
3145 3145
 	if ((@filemtime($f) > @filemtime($css)) and (_VAR_MODE != 'recalcul')) {
@@ -3149,7 +3149,7 @@  discard block
 block discarded – undo
3149 3149
 	if ($url_absolue_css == $css) {
3150 3150
 		if (
3151 3151
 			strncmp($GLOBALS['meta']['adresse_site'], $css, $l = strlen($GLOBALS['meta']['adresse_site'])) != 0
3152
-			or !lire_fichier(_DIR_RACINE . substr($css, $l), $contenu)
3152
+			or !lire_fichier(_DIR_RACINE.substr($css, $l), $contenu)
3153 3153
 		) {
3154 3154
 			include_spip('inc/distant');
3155 3155
 			$contenu = recuperer_url($css);
@@ -3261,7 +3261,7 @@  discard block
 block discarded – undo
3261 3261
 	$expression = str_replace('\/', '/', $expression);
3262 3262
 	$expression = str_replace('/', '\/', $expression);
3263 3263
 
3264
-	if (preg_match('/' . $expression . '/' . $modif, $texte ?? '', $r)) {
3264
+	if (preg_match('/'.$expression.'/'.$modif, $texte ?? '', $r)) {
3265 3265
 		if (isset($r[$capte])) {
3266 3266
 			return $r[$capte];
3267 3267
 		} else {
@@ -3299,7 +3299,7 @@  discard block
 block discarded – undo
3299 3299
 	$expression = str_replace('\/', '/', $expression);
3300 3300
 	$expression = str_replace('/', '\/', $expression);
3301 3301
 
3302
-	return preg_replace('/' . $expression . '/' . $modif, $replace, $texte);
3302
+	return preg_replace('/'.$expression.'/'.$modif, $replace, $texte);
3303 3303
 }
3304 3304
 
3305 3305
 
@@ -3318,7 +3318,7 @@  discard block
 block discarded – undo
3318 3318
 function traiter_doublons_documents(&$doublons, $letexte) {
3319 3319
 
3320 3320
 	// Verifier dans le texte & les notes (pas beau, helas)
3321
-	$t = $letexte . $GLOBALS['les_notes'];
3321
+	$t = $letexte.$GLOBALS['les_notes'];
3322 3322
 
3323 3323
 	if (
3324 3324
 		strstr($t, 'spip_document_') // evite le preg_match_all si inutile
@@ -3332,7 +3332,7 @@  discard block
 block discarded – undo
3332 3332
 		if (!isset($doublons['documents'])) {
3333 3333
 			$doublons['documents'] = '';
3334 3334
 		}
3335
-		$doublons['documents'] .= ',' . join(',', $matches[1]);
3335
+		$doublons['documents'] .= ','.join(',', $matches[1]);
3336 3336
 	}
3337 3337
 
3338 3338
 	return $letexte;
@@ -3389,7 +3389,7 @@  discard block
 block discarded – undo
3389 3389
 	if ($env) {
3390 3390
 		foreach ($env as $i => $j) {
3391 3391
 			if (is_string($j) and !in_array($i, $ignore_params)) {
3392
-				$texte .= "<param name='" . attribut_html($i) . "'\n\tvalue='" . attribut_html($j) . "' />";
3392
+				$texte .= "<param name='".attribut_html($i)."'\n\tvalue='".attribut_html($j)."' />";
3393 3393
 			}
3394 3394
 		}
3395 3395
 	}
@@ -3428,7 +3428,7 @@  discard block
 block discarded – undo
3428 3428
 	if ($env) {
3429 3429
 		foreach ($env as $i => $j) {
3430 3430
 			if (is_string($j) and !in_array($i, $ignore_params)) {
3431
-				$texte .= attribut_html($i) . "='" . attribut_html($j) . "' ";
3431
+				$texte .= attribut_html($i)."='".attribut_html($j)."' ";
3432 3432
 			}
3433 3433
 		}
3434 3434
 	}
@@ -3502,10 +3502,10 @@  discard block
 block discarded – undo
3502 3502
 	// si il y a un .svg a la bonne taille (-16.svg) a cote, on l'utilise en remplacement du -16.png
3503 3503
 	if (
3504 3504
 		preg_match(',-(\d+)[.](png|gif|svg)$,', $img_file, $m)
3505
-		and $variante_svg_generique = substr($img_file, 0, -strlen($m[0])) . '-xx.svg'
3505
+		and $variante_svg_generique = substr($img_file, 0, -strlen($m[0])).'-xx.svg'
3506 3506
 		and file_exists($variante_svg_generique)
3507 3507
 	) {
3508
-		if ($variante_svg_size = substr($variante_svg_generique, 0, -6) . $m[1] . '.svg' and file_exists($variante_svg_size)) {
3508
+		if ($variante_svg_size = substr($variante_svg_generique, 0, -6).$m[1].'.svg' and file_exists($variante_svg_size)) {
3509 3509
 			$img_file = $variante_svg_size;
3510 3510
 		}
3511 3511
 		else {
@@ -3563,7 +3563,7 @@  discard block
 block discarded – undo
3563 3563
 				return '';
3564 3564
 			}
3565 3565
 		}
3566
-		$atts .= " width='" . $largeur . "' height='" . $hauteur . "'";
3566
+		$atts .= " width='".$largeur."' height='".$hauteur."'";
3567 3567
 	}
3568 3568
 
3569 3569
 	if (file_exists($img_file)) {
@@ -3573,14 +3573,14 @@  discard block
 block discarded – undo
3573 3573
 		$alt = '';
3574 3574
 	}
3575 3575
 	elseif ($alt or $alt === '') {
3576
-		$alt = " alt='" . attribut_html($alt) . "'";
3576
+		$alt = " alt='".attribut_html($alt)."'";
3577 3577
 	}
3578 3578
 	else {
3579
-		$alt = " alt='" . attribut_html($title) . "'";
3579
+		$alt = " alt='".attribut_html($title)."'";
3580 3580
 	}
3581
-	return "<img src='" . attribut_html($img_file) . "'$alt"
3582
-	. ($title ? ' title="' . attribut_html($title) . '"' : '')
3583
-	. ' ' . ltrim($atts)
3581
+	return "<img src='".attribut_html($img_file)."'$alt"
3582
+	. ($title ? ' title="'.attribut_html($title).'"' : '')
3583
+	. ' '.ltrim($atts)
3584 3584
 	. ' />';
3585 3585
 }
3586 3586
 
@@ -3594,10 +3594,10 @@  discard block
 block discarded – undo
3594 3594
  */
3595 3595
 function http_style_background($img, $att = '', $size = null) {
3596 3596
 	if ($size and is_numeric($size)) {
3597
-		$size = trim($size) . 'px';
3597
+		$size = trim($size).'px';
3598 3598
 	}
3599
-	return " style='background" .
3600
-		($att ? '' : '-image') . ': url("' . chemin_image($img) . '")' . ($att ? (' ' . $att) : '') . ';'
3599
+	return " style='background".
3600
+		($att ? '' : '-image').': url("'.chemin_image($img).'")'.($att ? (' '.$att) : '').';'
3601 3601
 		. ($size ? "background-size:{$size};" : '')
3602 3602
 		. "'";
3603 3603
 }
@@ -3712,7 +3712,7 @@  discard block
 block discarded – undo
3712 3712
 		$img = http_img_pack(
3713 3713
 			$img,
3714 3714
 			$alt,
3715
-			$class ? " class='" . attribut_html($class) . "'" : '',
3715
+			$class ? " class='".attribut_html($class)."'" : '',
3716 3716
 			'',
3717 3717
 			['chemin_image' => false, 'utiliser_suffixe_size' => false]
3718 3718
 		);
@@ -3797,7 +3797,7 @@  discard block
 block discarded – undo
3797 3797
 	$balise_svg_source = $balise_svg;
3798 3798
 
3799 3799
 	// entete XML à supprimer
3800
-	$svg = preg_replace(',^\s*<\?xml[^>]*\?' . '>,', '', $svg);
3800
+	$svg = preg_replace(',^\s*<\?xml[^>]*\?'.'>,', '', $svg);
3801 3801
 
3802 3802
 	// IE est toujours mon ami
3803 3803
 	$balise_svg = inserer_attribut($balise_svg, 'focusable', 'false');
@@ -3815,9 +3815,9 @@  discard block
 block discarded – undo
3815 3815
 	// regler le alt
3816 3816
 	if ($alt) {
3817 3817
 		$balise_svg = inserer_attribut($balise_svg, 'role', 'img');
3818
-		$id = 'img-svg-title-' . substr(md5("$img_file:$svg:$alt"), 0, 4);
3818
+		$id = 'img-svg-title-'.substr(md5("$img_file:$svg:$alt"), 0, 4);
3819 3819
 		$balise_svg = inserer_attribut($balise_svg, 'aria-labelledby', $id);
3820
-		$title = "<title id=\"$id\">" . entites_html($alt) . "</title>\n";
3820
+		$title = "<title id=\"$id\">".entites_html($alt)."</title>\n";
3821 3821
 		$balise_svg .= $title;
3822 3822
 	}
3823 3823
 	else {
@@ -3865,7 +3865,7 @@  discard block
 block discarded – undo
3865 3865
 	if (is_array($tableau)) {
3866 3866
 		foreach ($tableau as $k => $v) {
3867 3867
 			$res = recuperer_fond(
3868
-				'modeles/' . $modele,
3868
+				'modeles/'.$modele,
3869 3869
 				array_merge(['cle' => $k], (is_array($v) ? $v : ['valeur' => $v]))
3870 3870
 			);
3871 3871
 			$texte .= $res;
@@ -4050,7 +4050,7 @@  discard block
 block discarded – undo
4050 4050
 	}
4051 4051
 
4052 4052
 	$c = serialize($c);
4053
-	$cle = calculer_cle_action($form . $c);
4053
+	$cle = calculer_cle_action($form.$c);
4054 4054
 	$c = "$cle:$c";
4055 4055
 
4056 4056
 	// on ne stocke pas les contextes dans des fichiers en cache
@@ -4108,15 +4108,15 @@  discard block
 block discarded – undo
4108 4108
 	}
4109 4109
 	// toujours encoder l'url source dans le bloc ajax
4110 4110
 	$r = self();
4111
-	$r = ' data-origin="' . $r . '"';
4111
+	$r = ' data-origin="'.$r.'"';
4112 4112
 	$class = 'ajaxbloc';
4113 4113
 	if ($ajaxid and is_string($ajaxid)) {
4114 4114
 		// ajaxid est normalement conforme a un nom de classe css
4115 4115
 		// on ne verifie pas la conformite, mais on passe entites_html par dessus par precaution
4116
-		$class .= ' ajax-id-' . entites_html($ajaxid);
4116
+		$class .= ' ajax-id-'.entites_html($ajaxid);
4117 4117
 	}
4118 4118
 
4119
-	return "<div class='$class' " . "data-ajax-env='$env'$r>\n$emboite</div><!--ajaxbloc-->\n";
4119
+	return "<div class='$class' "."data-ajax-env='$env'$r>\n$emboite</div><!--ajaxbloc-->\n";
4120 4120
 }
4121 4121
 
4122 4122
 /**
@@ -4160,7 +4160,7 @@  discard block
 block discarded – undo
4160 4160
 		$cle = substr($c, 0, $p);
4161 4161
 		$c = substr($c, $p + 1);
4162 4162
 
4163
-		if ($cle == calculer_cle_action($form . $c)) {
4163
+		if ($cle == calculer_cle_action($form.$c)) {
4164 4164
 			$env = @unserialize($c);
4165 4165
 			return $env;
4166 4166
 		}
@@ -4281,13 +4281,13 @@  discard block
 block discarded – undo
4281 4281
 				}
4282 4282
 			}
4283 4283
 		}
4284
-		$att .= 'class="' . ($class ? attribut_html($class) . ' ' : '') . (defined('_LIEN_OU_EXPOSE_CLASS_ON') ? _LIEN_OU_EXPOSE_CLASS_ON : 'on') . '"';
4284
+		$att .= 'class="'.($class ? attribut_html($class).' ' : '').(defined('_LIEN_OU_EXPOSE_CLASS_ON') ? _LIEN_OU_EXPOSE_CLASS_ON : 'on').'"';
4285 4285
 	} else {
4286 4286
 		$bal = 'a';
4287 4287
 		$att = "href='$url'"
4288
-			. ($title ? " title='" . attribut_html($title) . "'" : '')
4289
-			. ($class ? " class='" . attribut_html($class) . "'" : '')
4290
-			. ($rel ? " rel='" . attribut_html($rel) . "'" : '')
4288
+			. ($title ? " title='".attribut_html($title)."'" : '')
4289
+			. ($class ? " class='".attribut_html($class)."'" : '')
4290
+			. ($rel ? " rel='".attribut_html($rel)."'" : '')
4291 4291
 			. $evt;
4292 4292
 	}
4293 4293
 	if ($libelle === null) {
@@ -4426,7 +4426,7 @@  discard block
 block discarded – undo
4426 4426
 
4427 4427
 	// Icône
4428 4428
 	$icone = http_img_pack($fond, $alt, "width='$size' height='$size'");
4429
-	$icone = '<span class="icone-image' . ($fonction ? " icone-fonction icone-fonction-$fonction" : '') . "\">$icone</span>";
4429
+	$icone = '<span class="icone-image'.($fonction ? " icone-fonction icone-fonction-$fonction" : '')."\">$icone</span>";
4430 4430
 
4431 4431
 	// Markup final
4432 4432
 	if ($type == 'lien') {
@@ -4701,20 +4701,20 @@  discard block
 block discarded – undo
4701 4701
 		$class_form = 'ajax';
4702 4702
 		$class = str_replace('ajax', '', $class);
4703 4703
 	}
4704
-	$class_btn = 'submit ' . trim($class);
4704
+	$class_btn = 'submit '.trim($class);
4705 4705
 
4706 4706
 	if ($confirm) {
4707
-		$confirm = 'confirm("' . attribut_html($confirm) . '")';
4707
+		$confirm = 'confirm("'.attribut_html($confirm).'")';
4708 4708
 		if ($callback) {
4709 4709
 			$callback = "$confirm?($callback):false";
4710 4710
 		} else {
4711 4711
 			$callback = $confirm;
4712 4712
 		}
4713 4713
 	}
4714
-	$onclick = $callback ? " onclick='return " . addcslashes($callback, "'") . "'" : '';
4714
+	$onclick = $callback ? " onclick='return ".addcslashes($callback, "'")."'" : '';
4715 4715
 	$title = $title ? " title='$title'" : '';
4716 4716
 
4717
-	return "<form class='bouton_action_post $class_form' method='post' action='$url'><div>" . form_hidden($url)
4717
+	return "<form class='bouton_action_post $class_form' method='post' action='$url'><div>".form_hidden($url)
4718 4718
 	. "<button type='submit' class='$class_btn'$title$onclick>$libelle</button></div></form>";
4719 4719
 }
4720 4720
 
@@ -4779,14 +4779,14 @@  discard block
 block discarded – undo
4779 4779
 		$champ_titre = '';
4780 4780
 		if ($demande_titre) {
4781 4781
 			// si pas de titre declare mais champ titre, il sera peuple par le select *
4782
-			$champ_titre = (!empty($desc['titre'])) ? ', ' . $desc['titre'] : '';
4782
+			$champ_titre = (!empty($desc['titre'])) ? ', '.$desc['titre'] : '';
4783 4783
 		}
4784 4784
 		include_spip('base/abstract_sql');
4785 4785
 		include_spip('base/connect_sql');
4786 4786
 		$objets[$type_objet][$id_objet] = sql_fetsel(
4787
-			'*' . $champ_titre,
4787
+			'*'.$champ_titre,
4788 4788
 			$desc['table_sql'],
4789
-			id_table_objet($type_objet) . ' = ' . intval($id_objet)
4789
+			id_table_objet($type_objet).' = '.intval($id_objet)
4790 4790
 		);
4791 4791
 
4792 4792
 		// Toujours noter la longueur d'introduction, même si pas demandé cette fois-ci
@@ -4879,8 +4879,7 @@  discard block
 block discarded – undo
4879 4879
 	if (isset($ligne_sql['chapo'])) {
4880 4880
 		$chapo = $ligne_sql['chapo'];
4881 4881
 		$texte = strlen($descriptif) ?
4882
-			'' :
4883
-			"$chapo \n\n $texte";
4882
+			'' : "$chapo \n\n $texte";
4884 4883
 	}
4885 4884
 
4886 4885
 	// Longueur en paramètre, sinon celle renseignée dans la description de l'objet, sinon valeur en dur
@@ -4955,7 +4954,7 @@  discard block
 block discarded – undo
4955 4954
 		return $texte;
4956 4955
 	}
4957 4956
 
4958
-	$traitement = str_replace('%s', "'" . texte_script($texte) . "'", $traitement);
4957
+	$traitement = str_replace('%s', "'".texte_script($texte)."'", $traitement);
4959 4958
 
4960 4959
 	// signaler qu'on est dans l'espace prive pour les filtres qui se servent de ce flag
4961 4960
 	if (test_espace_prive()) {
@@ -4994,7 +4993,7 @@  discard block
 block discarded – undo
4994 4993
 	}
4995 4994
 	$url = generer_objet_url($id_objet, $objet, '', '', null, '', $connect);
4996 4995
 
4997
-	return "<a href='$url' class='$objet'>" . couper($titre, $longueur) . '</a>';
4996
+	return "<a href='$url' class='$objet'>".couper($titre, $longueur).'</a>';
4998 4997
 }
4999 4998
 
5000 4999
 /**
@@ -5020,10 +5019,10 @@  discard block
 block discarded – undo
5020 5019
 function wrap($texte, $wrap) {
5021 5020
 	$balises = extraire_balises($wrap);
5022 5021
 	if (preg_match_all(",<([a-z]\w*)\b[^>]*>,UimsS", $wrap, $regs, PREG_PATTERN_ORDER)) {
5023
-		$texte = $wrap . $texte;
5022
+		$texte = $wrap.$texte;
5024 5023
 		$regs = array_reverse($regs[1]);
5025
-		$wrap = '</' . implode('></', $regs) . '>';
5026
-		$texte = $texte . $wrap;
5024
+		$wrap = '</'.implode('></', $regs).'>';
5025
+		$texte = $texte.$wrap;
5027 5026
 	}
5028 5027
 
5029 5028
 	return $texte;
@@ -5054,7 +5053,7 @@  discard block
 block discarded – undo
5054 5053
 
5055 5054
 	// caster $u en array si besoin
5056 5055
 	if (is_object($u)) {
5057
-		$u = (array)$u;
5056
+		$u = (array) $u;
5058 5057
 	}
5059 5058
 
5060 5059
 	if (is_array($u)) {
@@ -5076,7 +5075,7 @@  discard block
 block discarded – undo
5076 5075
 		// sinon on passe a la ligne et on indente
5077 5076
 		$i_str = str_pad('', $indent, ' ');
5078 5077
 		foreach ($u as $k => $v) {
5079
-			$out .= $join . $i_str . "$k: " . filtre_print_dist($v, $join, $indent + 2);
5078
+			$out .= $join.$i_str."$k: ".filtre_print_dist($v, $join, $indent + 2);
5080 5079
 		}
5081 5080
 
5082 5081
 		return $out;
@@ -5130,7 +5129,7 @@  discard block
 block discarded – undo
5130 5129
  * @return string
5131 5130
  */
5132 5131
 function objet_icone($objet, $taille = 24, $class = '') {
5133
-	$icone = objet_info($objet, 'icone_objet') . '-' . $taille . '.png';
5132
+	$icone = objet_info($objet, 'icone_objet').'-'.$taille.'.png';
5134 5133
 	$icone = chemin_image($icone);
5135 5134
 	$balise_img = charger_filtre('balise_img');
5136 5135
 
@@ -5156,7 +5155,7 @@  discard block
 block discarded – undo
5156 5155
  */
5157 5156
 function objet_T($objet, $chaine, $args = [], $options = []) {
5158 5157
 	$chaine = explode(':', $chaine);
5159
-	if ($t = _T($objet . ':' . end($chaine), $args, array_merge($options, ['force' => false]))) {
5158
+	if ($t = _T($objet.':'.end($chaine), $args, array_merge($options, ['force' => false]))) {
5160 5159
 		return $t;
5161 5160
 	}
5162 5161
 	$chaine = implode(':', $chaine);
@@ -5222,7 +5221,7 @@  discard block
 block discarded – undo
5222 5221
 	$cache = recuperer_fond($fond, $contexte, $options, $connect);
5223 5222
 
5224 5223
 	// calculer le nom de la css
5225
-	$dir_var = sous_repertoire(_DIR_VAR, 'cache-' . $extension);
5224
+	$dir_var = sous_repertoire(_DIR_VAR, 'cache-'.$extension);
5226 5225
 	$nom_safe = preg_replace(',\W,', '_', str_replace('.', '_', $fond));
5227 5226
 	$contexte_implicite = calculer_contexte_implicite();
5228 5227
 
@@ -5230,14 +5229,14 @@  discard block
 block discarded – undo
5230 5229
 	// mais on peut hasher selon le contenu a la demande, si plusieurs contextes produisent un meme contenu
5231 5230
 	// reduit la variabilite du nom et donc le nombre de css concatenees possibles in fine
5232 5231
 	if (isset($options['hash_on_content']) and $options['hash_on_content']) {
5233
-		$hash = md5($contexte_implicite['host'] . '::' . $cache);
5232
+		$hash = md5($contexte_implicite['host'].'::'.$cache);
5234 5233
 	}
5235 5234
 	else {
5236 5235
 		unset($contexte_implicite['notes']); // pas pertinent pour signaler un changeemnt de contenu pour des css/js
5237 5236
 		ksort($contexte);
5238
-		$hash = md5($fond . json_encode($contexte_implicite, JSON_THROW_ON_ERROR) . json_encode($contexte, JSON_THROW_ON_ERROR) . $connect);
5237
+		$hash = md5($fond.json_encode($contexte_implicite, JSON_THROW_ON_ERROR).json_encode($contexte, JSON_THROW_ON_ERROR).$connect);
5239 5238
 	}
5240
-	$filename = $dir_var . $extension . "dyn-$nom_safe-" . substr($hash, 0, 8) . ".$extension";
5239
+	$filename = $dir_var.$extension."dyn-$nom_safe-".substr($hash, 0, 8).".$extension";
5241 5240
 
5242 5241
 	// mettre a jour le fichier si il n'existe pas
5243 5242
 	// ou trop ancien
@@ -5245,8 +5244,8 @@  discard block
 block discarded – undo
5245 5244
 	// et recopie sur le fichier cible uniquement si il change
5246 5245
 	if (
5247 5246
 		!file_exists($filename)
5248
-		or !file_exists($filename . '.last')
5249
-		or (isset($cache['lastmodified']) and $cache['lastmodified'] and filemtime($filename . '.last') < $cache['lastmodified'])
5247
+		or !file_exists($filename.'.last')
5248
+		or (isset($cache['lastmodified']) and $cache['lastmodified'] and filemtime($filename.'.last') < $cache['lastmodified'])
5250 5249
 		or (defined('_VAR_MODE') and _VAR_MODE == 'recalcul')
5251 5250
 	) {
5252 5251
 		$contenu = $cache['texte'];
@@ -5270,10 +5269,10 @@  discard block
 block discarded – undo
5270 5269
 			}
5271 5270
 			// pas de date dans le commentaire car sinon ca invalide le md5 et force la maj
5272 5271
 			// mais on peut mettre un md5 du contenu, ce qui donne un aperu rapide si la feuille a change ou non
5273
-			$comment .= "}\n   md5:" . md5($contenu) . " */\n";
5272
+			$comment .= "}\n   md5:".md5($contenu)." */\n";
5274 5273
 		}
5275 5274
 		// et ecrire le fichier si il change
5276
-		ecrire_fichier_calcule_si_modifie($filename, $comment . $contenu, false, true);
5275
+		ecrire_fichier_calcule_si_modifie($filename, $comment.$contenu, false, true);
5277 5276
 	}
5278 5277
 
5279 5278
 	return timestamp($filename);
@@ -5506,7 +5505,7 @@  discard block
 block discarded – undo
5506 5505
 	if ($e > 0 and strlen($mid) > 8) {
5507 5506
 		$mid = '***...***';
5508 5507
 	}
5509
-	return substr($passe, 0, $e) . $mid . ($e > 0 ? substr($passe, -$e) : '');
5508
+	return substr($passe, 0, $e).$mid.($e > 0 ? substr($passe, -$e) : '');
5510 5509
 }
5511 5510
 
5512 5511
 
@@ -5568,7 +5567,7 @@  discard block
 block discarded – undo
5568 5567
 		case 'id':
5569 5568
 		case 'anchor':
5570 5569
 			if (preg_match(',^\d,', $texte)) {
5571
-				$texte = substr($type, 0, 1) . $texte;
5570
+				$texte = substr($type, 0, 1).$texte;
5572 5571
 			}
5573 5572
 	}
5574 5573
 
@@ -5578,9 +5577,9 @@  discard block
 block discarded – undo
5578 5577
 
5579 5578
 	if (strlen($texte) < $longueur_mini and $longueur_mini < $longueur_maxi) {
5580 5579
 		if (preg_match(',^\d,', $texte)) {
5581
-			$texte = ($type ? substr($type, 0, 1) : 's') . $texte;
5580
+			$texte = ($type ? substr($type, 0, 1) : 's').$texte;
5582 5581
 		}
5583
-		$texte .= $separateur . md5($original);
5582
+		$texte .= $separateur.md5($original);
5584 5583
 		$texte = substr($texte, 0, $longueur_mini);
5585 5584
 	}
5586 5585
 
Please login to merge, or discard this patch.
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -648,8 +648,7 @@  discard block
 block discarded – undo
648 648
 			if (!$srcSize) {
649 649
 				$poids_img[$src] = filesize($src);
650 650
 			}
651
-		}
652
-		elseif (strpos($src, '<svg') !== false) {
651
+		} elseif (strpos($src, '<svg') !== false) {
653 652
 			include_spip('inc/svg');
654 653
 			if ($attrs = svg_lire_attributs($src)) {
655 654
 				[$width, $height, $viewbox] = svg_getimagesize_from_attr($attrs);
@@ -3507,8 +3506,7 @@  discard block
 block discarded – undo
3507 3506
 	) {
3508 3507
 		if ($variante_svg_size = substr($variante_svg_generique, 0, -6) . $m[1] . '.svg' and file_exists($variante_svg_size)) {
3509 3508
 			$img_file = $variante_svg_size;
3510
-		}
3511
-		else {
3509
+		} else {
3512 3510
 			$img_file = $variante_svg_generique;
3513 3511
 		}
3514 3512
 	}
@@ -3540,8 +3538,7 @@  discard block
 block discarded – undo
3540 3538
 	}
3541 3539
 	if (!isset($options['chemin_image']) or $options['chemin_image'] == true) {
3542 3540
 		$img_file = chemin_image($img);
3543
-	}
3544
-	else {
3541
+	} else {
3545 3542
 		if (!isset($options['variante_svg_si_possible']) or $options['variante_svg_si_possible'] == true) {
3546 3543
 			$img_file = http_img_variante_svg_si_possible($img_file);
3547 3544
 		}
@@ -3571,11 +3568,9 @@  discard block
 block discarded – undo
3571 3568
 	}
3572 3569
 	if ($alt === false) {
3573 3570
 		$alt = '';
3574
-	}
3575
-	elseif ($alt or $alt === '') {
3571
+	} elseif ($alt or $alt === '') {
3576 3572
 		$alt = " alt='" . attribut_html($alt) . "'";
3577
-	}
3578
-	else {
3573
+	} else {
3579 3574
 		$alt = " alt='" . attribut_html($title) . "'";
3580 3575
 	}
3581 3576
 	return "<img src='" . attribut_html($img_file) . "'$alt"
@@ -3702,13 +3697,11 @@  discard block
 block discarded – undo
3702 3697
 		if (!is_null($class)) {
3703 3698
 			if (strlen($class)) {
3704 3699
 				$img = inserer_attribut($img, 'class', $class);
3705
-			}
3706
-			else {
3700
+			} else {
3707 3701
 				$img = vider_attribut($img, 'class');
3708 3702
 			}
3709 3703
 		}
3710
-	}
3711
-	else {
3704
+	} else {
3712 3705
 		$img = http_img_pack(
3713 3706
 			$img,
3714 3707
 			$alt,
@@ -3806,8 +3799,7 @@  discard block
 block discarded – undo
3806 3799
 	if (!is_null($class)) {
3807 3800
 		if (strlen($class)) {
3808 3801
 			$balise_svg = inserer_attribut($balise_svg, 'class', $class);
3809
-		}
3810
-		else {
3802
+		} else {
3811 3803
 			$balise_svg = vider_attribut($balise_svg, 'class');
3812 3804
 		}
3813 3805
 	}
@@ -3819,8 +3811,7 @@  discard block
 block discarded – undo
3819 3811
 		$balise_svg = inserer_attribut($balise_svg, 'aria-labelledby', $id);
3820 3812
 		$title = "<title id=\"$id\">" . entites_html($alt) . "</title>\n";
3821 3813
 		$balise_svg .= $title;
3822
-	}
3823
-	else {
3814
+	} else {
3824 3815
 		$balise_svg = inserer_attribut($balise_svg, 'aria-hidden', 'true');
3825 3816
 	}
3826 3817
 
@@ -5231,8 +5222,7 @@  discard block
 block discarded – undo
5231 5222
 	// reduit la variabilite du nom et donc le nombre de css concatenees possibles in fine
5232 5223
 	if (isset($options['hash_on_content']) and $options['hash_on_content']) {
5233 5224
 		$hash = md5($contexte_implicite['host'] . '::' . $cache);
5234
-	}
5235
-	else {
5225
+	} else {
5236 5226
 		unset($contexte_implicite['notes']); // pas pertinent pour signaler un changeemnt de contenu pour des css/js
5237 5227
 		ksort($contexte);
5238 5228
 		$hash = md5($fond . json_encode($contexte_implicite, JSON_THROW_ON_ERROR) . json_encode($contexte, JSON_THROW_ON_ERROR) . $connect);
Please login to merge, or discard this patch.
Indentation   +2476 added lines, -2476 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @package SPIP\Core\Filtres
17 17
  **/
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 include_spip('inc/charsets');
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
  * @return string Fonction PHP correspondante du filtre
43 43
  */
44 44
 function charger_filtre($fonc, $default = 'filtre_identite_dist') {
45
-	include_fichiers_fonctions(); // inclure les fichiers fonctions
46
-	return chercher_filtre($fonc, $default);
45
+    include_fichiers_fonctions(); // inclure les fichiers fonctions
46
+    return chercher_filtre($fonc, $default);
47 47
 }
48 48
 
49 49
 /**
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
  * @return string Texte
54 54
  **/
55 55
 function filtre_identite_dist($texte) {
56
- return $texte;
56
+    return $texte;
57 57
 }
58 58
 
59 59
 /**
@@ -77,33 +77,33 @@  discard block
 block discarded – undo
77 77
  *     Fonction PHP correspondante du filtre demandé
78 78
  */
79 79
 function chercher_filtre($fonc, $default = null) {
80
-	if (!$fonc) {
81
-		return $default;
82
-	}
83
-	// Cas des types mime, sans confondre avec les appels de fonction de classe
84
-	// Foo::Bar
85
-	// qui peuvent etre avec un namespace : space\Foo::Bar
86
-	if (preg_match(',^[\w]+/,', $fonc)) {
87
-		$nom = preg_replace(',\W,', '_', $fonc);
88
-		$f = chercher_filtre($nom);
89
-		// cas du sous-type MIME sans filtre associe, passer au type:
90
-		// si filtre_text_plain pas defini, passe a filtre_text
91
-		if (!$f and $nom !== $fonc) {
92
-			$f = chercher_filtre(preg_replace(',\W.*$,', '', $fonc));
93
-		}
94
-
95
-		return $f;
96
-	}
97
-
98
-	include_fichiers_fonctions();
99
-	foreach (['filtre_' . $fonc, 'filtre_' . $fonc . '_dist', $fonc] as $f) {
100
-		trouver_filtre_matrice($f); // charge des fichiers spécifiques éventuels
101
-		if (is_callable($f)) {
102
-			return $f;
103
-		}
104
-	}
105
-
106
-	return $default;
80
+    if (!$fonc) {
81
+        return $default;
82
+    }
83
+    // Cas des types mime, sans confondre avec les appels de fonction de classe
84
+    // Foo::Bar
85
+    // qui peuvent etre avec un namespace : space\Foo::Bar
86
+    if (preg_match(',^[\w]+/,', $fonc)) {
87
+        $nom = preg_replace(',\W,', '_', $fonc);
88
+        $f = chercher_filtre($nom);
89
+        // cas du sous-type MIME sans filtre associe, passer au type:
90
+        // si filtre_text_plain pas defini, passe a filtre_text
91
+        if (!$f and $nom !== $fonc) {
92
+            $f = chercher_filtre(preg_replace(',\W.*$,', '', $fonc));
93
+        }
94
+
95
+        return $f;
96
+    }
97
+
98
+    include_fichiers_fonctions();
99
+    foreach (['filtre_' . $fonc, 'filtre_' . $fonc . '_dist', $fonc] as $f) {
100
+        trouver_filtre_matrice($f); // charge des fichiers spécifiques éventuels
101
+        if (is_callable($f)) {
102
+            return $f;
103
+        }
104
+    }
105
+
106
+    return $default;
107 107
 }
108 108
 
109 109
 /**
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
  *     Chaîne vide sinon.
148 148
  **/
149 149
 function appliquer_filtre($arg, $filtre) {
150
-	$args = func_get_args();
151
-	return appliquer_filtre_sinon($arg, $filtre, $args, '');
150
+    $args = func_get_args();
151
+    return appliquer_filtre_sinon($arg, $filtre, $args, '');
152 152
 }
153 153
 
154 154
 /**
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
  *     Texte d'origine sinon
174 174
  **/
175 175
 function appliquer_si_filtre($arg, $filtre) {
176
-	$args = func_get_args();
177
-	return appliquer_filtre_sinon($arg, $filtre, $args, $arg);
176
+    $args = func_get_args();
177
+    return appliquer_filtre_sinon($arg, $filtre, $args, $arg);
178 178
 }
179 179
 
180 180
 /**
@@ -190,12 +190,12 @@  discard block
 block discarded – undo
190 190
  *     Version de SPIP
191 191
  **/
192 192
 function spip_version() {
193
-	$version = $GLOBALS['spip_version_affichee'];
194
-	if ($vcs_version = version_vcs_courante(_DIR_RACINE)) {
195
-		$version .= " $vcs_version";
196
-	}
193
+    $version = $GLOBALS['spip_version_affichee'];
194
+    if ($vcs_version = version_vcs_courante(_DIR_RACINE)) {
195
+        $version .= " $vcs_version";
196
+    }
197 197
 
198
-	return $version;
198
+    return $version;
199 199
 }
200 200
 
201 201
 /**
@@ -207,11 +207,11 @@  discard block
 block discarded – undo
207 207
  * @return string
208 208
  */
209 209
 function header_silencieux($version): string {
210
-	if (isset($GLOBALS['spip_header_silencieux']) && (bool) $GLOBALS['spip_header_silencieux']) {
211
-		$version = '';
212
-	}
210
+    if (isset($GLOBALS['spip_header_silencieux']) && (bool) $GLOBALS['spip_header_silencieux']) {
211
+        $version = '';
212
+    }
213 213
 
214
-	return (string) $version;
214
+    return (string) $version;
215 215
 }
216 216
 
217 217
 /**
@@ -224,19 +224,19 @@  discard block
 block discarded – undo
224 224
  *    - string|null si $raw = false
225 225
  */
226 226
 function version_vcs_courante($dir, $raw = false) {
227
-	$desc = decrire_version_git($dir);
228
-	if ($desc === null) {
229
-		$desc = decrire_version_svn($dir);
230
-	}
231
-	if ($desc === null or $raw) {
232
-		return $desc;
233
-	}
234
-	// affichage "GIT [master: abcdef]"
235
-	$commit = $desc['commit_short'] ?? $desc['commit'];
236
-	if ($desc['branch']) {
237
-		$commit = $desc['branch'] . ': ' . $commit;
238
-	}
239
-	return "{$desc['vcs']} [$commit]";
227
+    $desc = decrire_version_git($dir);
228
+    if ($desc === null) {
229
+        $desc = decrire_version_svn($dir);
230
+    }
231
+    if ($desc === null or $raw) {
232
+        return $desc;
233
+    }
234
+    // affichage "GIT [master: abcdef]"
235
+    $commit = $desc['commit_short'] ?? $desc['commit'];
236
+    if ($desc['branch']) {
237
+        $commit = $desc['branch'] . ': ' . $commit;
238
+    }
239
+    return "{$desc['vcs']} [$commit]";
240 240
 }
241 241
 
242 242
 /**
@@ -248,24 +248,24 @@  discard block
 block discarded – undo
248 248
  *      array ['branch' => xx, 'commit' => yy] sinon.
249 249
  **/
250 250
 function decrire_version_git($dir) {
251
-	if (!$dir) {
252
-		$dir = '.';
253
-	}
251
+    if (!$dir) {
252
+        $dir = '.';
253
+    }
254 254
 
255
-	// version installee par GIT
256
-	if (lire_fichier($dir . '/.git/HEAD', $c)) {
257
-		$currentHead = trim(substr($c, 4));
258
-		if (lire_fichier($dir . '/.git/' . $currentHead, $hash)) {
259
-			return [
260
-				'vcs' => 'GIT',
261
-				'branch' => basename($currentHead),
262
-				'commit' => trim($hash),
263
-				'commit_short' => substr(trim($hash), 0, 8),
264
-			];
265
-		}
266
-	}
255
+    // version installee par GIT
256
+    if (lire_fichier($dir . '/.git/HEAD', $c)) {
257
+        $currentHead = trim(substr($c, 4));
258
+        if (lire_fichier($dir . '/.git/' . $currentHead, $hash)) {
259
+            return [
260
+                'vcs' => 'GIT',
261
+                'branch' => basename($currentHead),
262
+                'commit' => trim($hash),
263
+                'commit_short' => substr(trim($hash), 0, 8),
264
+            ];
265
+        }
266
+    }
267 267
 
268
-	return null;
268
+    return null;
269 269
 }
270 270
 
271 271
 
@@ -278,25 +278,25 @@  discard block
 block discarded – undo
278 278
  *      array ['commit' => yy, 'date' => xx, 'author' => xx] sinon.
279 279
  **/
280 280
 function decrire_version_svn($dir) {
281
-	if (!$dir) {
282
-		$dir = '.';
283
-	}
284
-	// version installee par SVN
285
-	if (file_exists($dir . '/.svn/wc.db') && class_exists(\SQLite3::class)) {
286
-		$db = new SQLite3($dir . '/.svn/wc.db');
287
-		$result = $db->query('SELECT changed_revision FROM nodes WHERE local_relpath = "" LIMIT 1');
288
-		if ($result) {
289
-			$row = $result->fetchArray();
290
-			if ($row['changed_revision'] != '') {
291
-				return [
292
-					'vcs' => 'SVN',
293
-					'branch' => '',
294
-					'commit' => $row['changed_revision'],
295
-				];
296
-			}
297
-		}
298
-	}
299
-	return null;
281
+    if (!$dir) {
282
+        $dir = '.';
283
+    }
284
+    // version installee par SVN
285
+    if (file_exists($dir . '/.svn/wc.db') && class_exists(\SQLite3::class)) {
286
+        $db = new SQLite3($dir . '/.svn/wc.db');
287
+        $result = $db->query('SELECT changed_revision FROM nodes WHERE local_relpath = "" LIMIT 1');
288
+        if ($result) {
289
+            $row = $result->fetchArray();
290
+            if ($row['changed_revision'] != '') {
291
+                return [
292
+                    'vcs' => 'SVN',
293
+                    'branch' => '',
294
+                    'commit' => $row['changed_revision'],
295
+                ];
296
+            }
297
+        }
298
+    }
299
+    return null;
300 300
 }
301 301
 
302 302
 // La matrice est necessaire pour ne filtrer _que_ des fonctions definies dans filtres_images
@@ -343,18 +343,18 @@  discard block
 block discarded – undo
343 343
  *     Code HTML retourné par le filtre
344 344
  **/
345 345
 function filtrer($filtre) {
346
-	$tous = func_get_args();
347
-	if (trouver_filtre_matrice($filtre) and substr($filtre, 0, 6) == 'image_') {
348
-		return image_filtrer($tous);
349
-	} elseif ($f = chercher_filtre($filtre)) {
350
-		array_shift($tous);
351
-		return $f(...$tous);
352
-	} else {
353
-		// le filtre n'existe pas, on provoque une erreur
354
-		$msg = ['zbug_erreur_filtre', ['filtre' => texte_script($filtre)]];
355
-		erreur_squelette($msg);
356
-		return '';
357
-	}
346
+    $tous = func_get_args();
347
+    if (trouver_filtre_matrice($filtre) and substr($filtre, 0, 6) == 'image_') {
348
+        return image_filtrer($tous);
349
+    } elseif ($f = chercher_filtre($filtre)) {
350
+        array_shift($tous);
351
+        return $f(...$tous);
352
+    } else {
353
+        // le filtre n'existe pas, on provoque une erreur
354
+        $msg = ['zbug_erreur_filtre', ['filtre' => texte_script($filtre)]];
355
+        erreur_squelette($msg);
356
+        return '';
357
+    }
358 358
 }
359 359
 
360 360
 /**
@@ -371,11 +371,11 @@  discard block
 block discarded – undo
371 371
  * @return bool true si on trouve le filtre dans la matrice, false sinon.
372 372
  */
373 373
 function trouver_filtre_matrice($filtre) {
374
-	if (isset($GLOBALS['spip_matrice'][$filtre]) and is_string($f = $GLOBALS['spip_matrice'][$filtre])) {
375
-		find_in_path($f, '', true);
376
-		$GLOBALS['spip_matrice'][$filtre] = true;
377
-	}
378
-	return !empty($GLOBALS['spip_matrice'][$filtre]);
374
+    if (isset($GLOBALS['spip_matrice'][$filtre]) and is_string($f = $GLOBALS['spip_matrice'][$filtre])) {
375
+        find_in_path($f, '', true);
376
+        $GLOBALS['spip_matrice'][$filtre] = true;
377
+    }
378
+    return !empty($GLOBALS['spip_matrice'][$filtre]);
379 379
 }
380 380
 
381 381
 
@@ -403,8 +403,8 @@  discard block
 block discarded – undo
403 403
  * @return mixed
404 404
  */
405 405
 function filtre_set(&$Pile, $val, $key, $continue = null) {
406
-	$Pile['vars'][$key] = $val;
407
-	return $continue ? $val : '';
406
+    $Pile['vars'][$key] = $val;
407
+    return $continue ? $val : '';
408 408
 }
409 409
 
410 410
 /**
@@ -430,8 +430,8 @@  discard block
 block discarded – undo
430 430
  * @return string|mixed Retourne `$val` si `$continue` présent, sinon ''.
431 431
  */
432 432
 function filtre_setenv(&$Pile, $val, $key, $continue = null) {
433
-	$Pile[0][$key] = $val;
434
-	return $continue ? $val : '';
433
+    $Pile[0][$key] = $val;
434
+    return $continue ? $val : '';
435 435
 }
436 436
 
437 437
 /**
@@ -440,8 +440,8 @@  discard block
 block discarded – undo
440 440
  * @return string
441 441
  */
442 442
 function filtre_sanitize_env(&$Pile, $keys) {
443
-	$Pile[0] = spip_sanitize_from_request($Pile[0], $keys);
444
-	return '';
443
+    $Pile[0] = spip_sanitize_from_request($Pile[0], $keys);
444
+    return '';
445 445
 }
446 446
 
447 447
 
@@ -464,18 +464,18 @@  discard block
 block discarded – undo
464 464
  * @return mixed Retourne la valeur (sans la modifier).
465 465
  */
466 466
 function filtre_debug($val, $key = null) {
467
-	$debug = (
468
-		is_null($key) ? '' : (var_export($key, true) . ' = ')
469
-		) . var_export($val, true);
467
+    $debug = (
468
+        is_null($key) ? '' : (var_export($key, true) . ' = ')
469
+        ) . var_export($val, true);
470 470
 
471
-	include_spip('inc/autoriser');
472
-	if (autoriser('webmestre')) {
473
-		echo "<div class='spip_debug'>\n", $debug, "</div>\n";
474
-	}
471
+    include_spip('inc/autoriser');
472
+    if (autoriser('webmestre')) {
473
+        echo "<div class='spip_debug'>\n", $debug, "</div>\n";
474
+    }
475 475
 
476
-	spip_log($debug, 'debug');
476
+    spip_log($debug, 'debug');
477 477
 
478
-	return $val;
478
+    return $val;
479 479
 }
480 480
 
481 481
 
@@ -505,84 +505,84 @@  discard block
 block discarded – undo
505 505
  *     Texte qui a reçu les filtres
506 506
  **/
507 507
 function image_filtrer($args) {
508
-	$filtre = array_shift($args); # enlever $filtre
509
-	$texte = array_shift($args);
510
-	if ($texte === null || !strlen($texte)) {
511
-		return '';
512
-	}
513
-	find_in_path('filtres_images_mini.php', 'inc/', true);
514
-	statut_effacer_images_temporaires(true); // activer la suppression des images temporaires car le compilo finit la chaine par un image_graver
515
-	// Cas du nom de fichier local
516
-	$is_file = trim($texte);
517
-	if (
518
-		strpos(substr($is_file, strlen(_DIR_RACINE)), '..') !== false
519
-		  or strpbrk($is_file, "<>\n\r\t") !== false
520
-		  or strpos($is_file, '/') === 0
521
-	) {
522
-		$is_file = false;
523
-	}
524
-	if ($is_file) {
525
-		$is_local_file = function ($path) {
526
-			if (strpos($path, '?') !== false) {
527
-				$path = supprimer_timestamp($path);
528
-				// remove ?24px added by find_in_theme on .svg files
529
-				$path = preg_replace(',\?[[:digit:]]+(px)$,', '', $path);
530
-			}
531
-			return file_exists($path);
532
-		};
533
-		if ($is_local_file($is_file) or tester_url_absolue($is_file)) {
534
-			$res = $filtre("<img src='$is_file' />", ...$args);
535
-			statut_effacer_images_temporaires(false); // desactiver pour les appels hors compilo
536
-			return $res;
537
-		}
538
-	}
539
-
540
-	// Cas general : trier toutes les images, avec eventuellement leur <span>
541
-	if (
542
-		preg_match_all(
543
-			',(<([a-z]+) [^<>]*spip_documents[^<>]*>)?\s*(<img\s.*>),UimsS',
544
-			$texte,
545
-			$tags,
546
-			PREG_SET_ORDER
547
-		)
548
-	) {
549
-		foreach ($tags as $tag) {
550
-			$class = extraire_attribut($tag[3], 'class');
551
-			if (
552
-				!$class or
553
-				(strpos($class, 'filtre_inactif') === false
554
-					// compat historique a virer en 3.2
555
-					and strpos($class, 'no_image_filtrer') === false)
556
-			) {
557
-				if ($reduit = $filtre($tag[3], ...$args)) {
558
-					// En cas de span spip_documents, modifier le style=...width:
559
-					if ($tag[1]) {
560
-						$w = extraire_attribut($reduit, 'width');
561
-						if (!$w and preg_match(',width:\s*(\d+)px,S', extraire_attribut($reduit, 'style'), $regs)) {
562
-							$w = $regs[1];
563
-						}
564
-						if ($w and ($style = extraire_attribut($tag[1], 'style'))) {
565
-							$style = preg_replace(',width:\s*\d+px,S', "width:{$w}px", $style);
566
-							$replace = inserer_attribut($tag[1], 'style', $style);
567
-							$texte = str_replace($tag[1], $replace, $texte);
568
-						}
569
-					}
570
-					// traiter aussi un eventuel mouseover
571
-					if ($mouseover = extraire_attribut($reduit, 'onmouseover')) {
572
-						if (preg_match(",this[.]src=['\"]([^'\"]+)['\"],ims", $mouseover, $match)) {
573
-							$srcover = $match[1];
574
-							$srcover_filter = $filtre("<img src='" . $match[1] . "' />", ...$args);
575
-							$srcover_filter = extraire_attribut($srcover_filter, 'src');
576
-							$reduit = str_replace($srcover, $srcover_filter, $reduit);
577
-						}
578
-					}
579
-					$texte = str_replace($tag[3], $reduit, $texte);
580
-				}
581
-			}
582
-		}
583
-	}
584
-	statut_effacer_images_temporaires(false); // desactiver pour les appels hors compilo
585
-	return $texte;
508
+    $filtre = array_shift($args); # enlever $filtre
509
+    $texte = array_shift($args);
510
+    if ($texte === null || !strlen($texte)) {
511
+        return '';
512
+    }
513
+    find_in_path('filtres_images_mini.php', 'inc/', true);
514
+    statut_effacer_images_temporaires(true); // activer la suppression des images temporaires car le compilo finit la chaine par un image_graver
515
+    // Cas du nom de fichier local
516
+    $is_file = trim($texte);
517
+    if (
518
+        strpos(substr($is_file, strlen(_DIR_RACINE)), '..') !== false
519
+          or strpbrk($is_file, "<>\n\r\t") !== false
520
+          or strpos($is_file, '/') === 0
521
+    ) {
522
+        $is_file = false;
523
+    }
524
+    if ($is_file) {
525
+        $is_local_file = function ($path) {
526
+            if (strpos($path, '?') !== false) {
527
+                $path = supprimer_timestamp($path);
528
+                // remove ?24px added by find_in_theme on .svg files
529
+                $path = preg_replace(',\?[[:digit:]]+(px)$,', '', $path);
530
+            }
531
+            return file_exists($path);
532
+        };
533
+        if ($is_local_file($is_file) or tester_url_absolue($is_file)) {
534
+            $res = $filtre("<img src='$is_file' />", ...$args);
535
+            statut_effacer_images_temporaires(false); // desactiver pour les appels hors compilo
536
+            return $res;
537
+        }
538
+    }
539
+
540
+    // Cas general : trier toutes les images, avec eventuellement leur <span>
541
+    if (
542
+        preg_match_all(
543
+            ',(<([a-z]+) [^<>]*spip_documents[^<>]*>)?\s*(<img\s.*>),UimsS',
544
+            $texte,
545
+            $tags,
546
+            PREG_SET_ORDER
547
+        )
548
+    ) {
549
+        foreach ($tags as $tag) {
550
+            $class = extraire_attribut($tag[3], 'class');
551
+            if (
552
+                !$class or
553
+                (strpos($class, 'filtre_inactif') === false
554
+                    // compat historique a virer en 3.2
555
+                    and strpos($class, 'no_image_filtrer') === false)
556
+            ) {
557
+                if ($reduit = $filtre($tag[3], ...$args)) {
558
+                    // En cas de span spip_documents, modifier le style=...width:
559
+                    if ($tag[1]) {
560
+                        $w = extraire_attribut($reduit, 'width');
561
+                        if (!$w and preg_match(',width:\s*(\d+)px,S', extraire_attribut($reduit, 'style'), $regs)) {
562
+                            $w = $regs[1];
563
+                        }
564
+                        if ($w and ($style = extraire_attribut($tag[1], 'style'))) {
565
+                            $style = preg_replace(',width:\s*\d+px,S', "width:{$w}px", $style);
566
+                            $replace = inserer_attribut($tag[1], 'style', $style);
567
+                            $texte = str_replace($tag[1], $replace, $texte);
568
+                        }
569
+                    }
570
+                    // traiter aussi un eventuel mouseover
571
+                    if ($mouseover = extraire_attribut($reduit, 'onmouseover')) {
572
+                        if (preg_match(",this[.]src=['\"]([^'\"]+)['\"],ims", $mouseover, $match)) {
573
+                            $srcover = $match[1];
574
+                            $srcover_filter = $filtre("<img src='" . $match[1] . "' />", ...$args);
575
+                            $srcover_filter = extraire_attribut($srcover_filter, 'src');
576
+                            $reduit = str_replace($srcover, $srcover_filter, $reduit);
577
+                        }
578
+                    }
579
+                    $texte = str_replace($tag[3], $reduit, $texte);
580
+                }
581
+            }
582
+        }
583
+    }
584
+    statut_effacer_images_temporaires(false); // desactiver pour les appels hors compilo
585
+    return $texte;
586 586
 }
587 587
 
588 588
 /**
@@ -599,91 +599,91 @@  discard block
 block discarded – undo
599 599
  **/
600 600
 function infos_image($img, $force_refresh = false) {
601 601
 
602
-	static $largeur_img = [], $hauteur_img = [], $poids_img = [];
603
-	$srcWidth = 0;
604
-	$srcHeight = 0;
605
-	$srcSize = null;
606
-
607
-	$src = extraire_attribut($img, 'src');
608
-
609
-	if (!$src) {
610
-		$src = $img;
611
-	} else {
612
-		$srcWidth = extraire_attribut($img, 'width');
613
-		$srcHeight = extraire_attribut($img, 'height');
614
-	}
615
-
616
-	// ne jamais operer directement sur une image distante pour des raisons de perfo
617
-	// la copie locale a toutes les chances d'etre la ou de resservir
618
-	if (tester_url_absolue($src)) {
619
-		include_spip('inc/distant');
620
-		$fichier = copie_locale($src);
621
-		$src = $fichier ? _DIR_RACINE . $fichier : $src;
622
-	}
623
-	if (($p = strpos($src, '?')) !== false) {
624
-		$src = substr($src, 0, $p);
625
-	}
626
-
627
-	$imagesize = false;
628
-	if (isset($largeur_img[$src]) and !$force_refresh) {
629
-		$srcWidth = $largeur_img[$src];
630
-	}
631
-	if (isset($hauteur_img[$src]) and !$force_refresh) {
632
-		$srcHeight = $hauteur_img[$src];
633
-	}
634
-	if (isset($poids_img[$src]) and !$force_refresh) {
635
-		$srcSize = $poids_img[$src];
636
-	}
637
-	if (!$srcWidth or !$srcHeight or is_null($srcSize)) {
638
-		if (
639
-			file_exists($src)
640
-			and $imagesize = spip_getimagesize($src)
641
-		) {
642
-			if (!$srcWidth) {
643
-				$largeur_img[$src] = $srcWidth = $imagesize[0];
644
-			}
645
-			if (!$srcHeight) {
646
-				$hauteur_img[$src] = $srcHeight = $imagesize[1];
647
-			}
648
-			if (!$srcSize) {
649
-				$poids_img[$src] = filesize($src);
650
-			}
651
-		}
652
-		elseif (strpos($src, '<svg') !== false) {
653
-			include_spip('inc/svg');
654
-			if ($attrs = svg_lire_attributs($src)) {
655
-				[$width, $height, $viewbox] = svg_getimagesize_from_attr($attrs);
656
-				if (!$srcWidth) {
657
-					$largeur_img[$src] = $srcWidth = $width;
658
-				}
659
-				if (!$srcHeight) {
660
-					$hauteur_img[$src] = $srcHeight = $height;
661
-				}
662
-				if (!$srcSize) {
663
-					$poids_img[$src] = $srcSize = strlen($src);
664
-				}
665
-			}
666
-		}
667
-		// $src peut etre une reference a une image temporaire dont a n'a que le log .src
668
-		// on s'y refere, l'image sera reconstruite en temps utile si necessaire
669
-		elseif (
670
-			@file_exists($f = "$src.src")
671
-			and lire_fichier($f, $valeurs)
672
-			and $valeurs = unserialize($valeurs)
673
-		) {
674
-			if (!$srcWidth) {
675
-				$largeur_img[$src] = $srcWidth = $valeurs['largeur_dest'];
676
-			}
677
-			if (!$srcHeight) {
678
-				$hauteur_img[$src] = $srcHeight = $valeurs['hauteur_dest'];
679
-			}
680
-			if (!$srcSize) {
681
-				$poids_img[$src] = $srcSize = 0;
682
-			}
683
-		}
684
-	}
685
-
686
-	return ['hauteur' => $srcHeight, 'largeur' => $srcWidth, 'poids' => $srcSize];
602
+    static $largeur_img = [], $hauteur_img = [], $poids_img = [];
603
+    $srcWidth = 0;
604
+    $srcHeight = 0;
605
+    $srcSize = null;
606
+
607
+    $src = extraire_attribut($img, 'src');
608
+
609
+    if (!$src) {
610
+        $src = $img;
611
+    } else {
612
+        $srcWidth = extraire_attribut($img, 'width');
613
+        $srcHeight = extraire_attribut($img, 'height');
614
+    }
615
+
616
+    // ne jamais operer directement sur une image distante pour des raisons de perfo
617
+    // la copie locale a toutes les chances d'etre la ou de resservir
618
+    if (tester_url_absolue($src)) {
619
+        include_spip('inc/distant');
620
+        $fichier = copie_locale($src);
621
+        $src = $fichier ? _DIR_RACINE . $fichier : $src;
622
+    }
623
+    if (($p = strpos($src, '?')) !== false) {
624
+        $src = substr($src, 0, $p);
625
+    }
626
+
627
+    $imagesize = false;
628
+    if (isset($largeur_img[$src]) and !$force_refresh) {
629
+        $srcWidth = $largeur_img[$src];
630
+    }
631
+    if (isset($hauteur_img[$src]) and !$force_refresh) {
632
+        $srcHeight = $hauteur_img[$src];
633
+    }
634
+    if (isset($poids_img[$src]) and !$force_refresh) {
635
+        $srcSize = $poids_img[$src];
636
+    }
637
+    if (!$srcWidth or !$srcHeight or is_null($srcSize)) {
638
+        if (
639
+            file_exists($src)
640
+            and $imagesize = spip_getimagesize($src)
641
+        ) {
642
+            if (!$srcWidth) {
643
+                $largeur_img[$src] = $srcWidth = $imagesize[0];
644
+            }
645
+            if (!$srcHeight) {
646
+                $hauteur_img[$src] = $srcHeight = $imagesize[1];
647
+            }
648
+            if (!$srcSize) {
649
+                $poids_img[$src] = filesize($src);
650
+            }
651
+        }
652
+        elseif (strpos($src, '<svg') !== false) {
653
+            include_spip('inc/svg');
654
+            if ($attrs = svg_lire_attributs($src)) {
655
+                [$width, $height, $viewbox] = svg_getimagesize_from_attr($attrs);
656
+                if (!$srcWidth) {
657
+                    $largeur_img[$src] = $srcWidth = $width;
658
+                }
659
+                if (!$srcHeight) {
660
+                    $hauteur_img[$src] = $srcHeight = $height;
661
+                }
662
+                if (!$srcSize) {
663
+                    $poids_img[$src] = $srcSize = strlen($src);
664
+                }
665
+            }
666
+        }
667
+        // $src peut etre une reference a une image temporaire dont a n'a que le log .src
668
+        // on s'y refere, l'image sera reconstruite en temps utile si necessaire
669
+        elseif (
670
+            @file_exists($f = "$src.src")
671
+            and lire_fichier($f, $valeurs)
672
+            and $valeurs = unserialize($valeurs)
673
+        ) {
674
+            if (!$srcWidth) {
675
+                $largeur_img[$src] = $srcWidth = $valeurs['largeur_dest'];
676
+            }
677
+            if (!$srcHeight) {
678
+                $hauteur_img[$src] = $srcHeight = $valeurs['hauteur_dest'];
679
+            }
680
+            if (!$srcSize) {
681
+                $poids_img[$src] = $srcSize = 0;
682
+            }
683
+        }
684
+    }
685
+
686
+    return ['hauteur' => $srcHeight, 'largeur' => $srcWidth, 'poids' => $srcSize];
687 687
 }
688 688
 
689 689
 /**
@@ -699,13 +699,13 @@  discard block
 block discarded – undo
699 699
  *     poids
700 700
  **/
701 701
 function poids_image($img, $force_refresh = false) {
702
-	$infos = infos_image($img, $force_refresh);
703
-	return $infos['poids'];
702
+    $infos = infos_image($img, $force_refresh);
703
+    return $infos['poids'];
704 704
 }
705 705
 
706 706
 function taille_image($img, $force_refresh = false) {
707
-	$infos = infos_image($img, $force_refresh);
708
-	return [$infos['hauteur'], $infos['largeur']];
707
+    $infos = infos_image($img, $force_refresh);
708
+    return [$infos['hauteur'], $infos['largeur']];
709 709
 }
710 710
 
711 711
 /**
@@ -722,12 +722,12 @@  discard block
 block discarded – undo
722 722
  *     Largeur en pixels, NULL ou 0 si aucune image.
723 723
  **/
724 724
 function largeur($img) {
725
-	if (!$img) {
726
-		return;
727
-	}
728
-	[$h, $l] = taille_image($img);
725
+    if (!$img) {
726
+        return;
727
+    }
728
+    [$h, $l] = taille_image($img);
729 729
 
730
-	return $l;
730
+    return $l;
731 731
 }
732 732
 
733 733
 /**
@@ -744,12 +744,12 @@  discard block
 block discarded – undo
744 744
  *     Hauteur en pixels, NULL ou 0 si aucune image.
745 745
  **/
746 746
 function hauteur($img) {
747
-	if (!$img) {
748
-		return;
749
-	}
750
-	[$h, $l] = taille_image($img);
747
+    if (!$img) {
748
+        return;
749
+    }
750
+    [$h, $l] = taille_image($img);
751 751
 
752
-	return $h;
752
+    return $h;
753 753
 }
754 754
 
755 755
 
@@ -769,11 +769,11 @@  discard block
 block discarded – undo
769 769
  * @return string
770 770
  **/
771 771
 function corriger_entites_html($texte) {
772
-	if (strpos($texte, '&amp;') === false) {
773
-		return $texte;
774
-	}
772
+    if (strpos($texte, '&amp;') === false) {
773
+        return $texte;
774
+    }
775 775
 
776
-	return preg_replace(',&amp;(#[0-9][0-9][0-9]+;|amp;),iS', '&\1', $texte);
776
+    return preg_replace(',&amp;(#[0-9][0-9][0-9]+;|amp;),iS', '&\1', $texte);
777 777
 }
778 778
 
779 779
 /**
@@ -788,11 +788,11 @@  discard block
 block discarded – undo
788 788
  * @return string
789 789
  **/
790 790
 function corriger_toutes_entites_html($texte) {
791
-	if (strpos($texte, '&amp;') === false) {
792
-		return $texte;
793
-	}
791
+    if (strpos($texte, '&amp;') === false) {
792
+        return $texte;
793
+    }
794 794
 
795
-	return preg_replace(',&amp;(#?[a-z0-9]+;),iS', '&\1', $texte);
795
+    return preg_replace(',&amp;(#?[a-z0-9]+;),iS', '&\1', $texte);
796 796
 }
797 797
 
798 798
 /**
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
  * @return string
803 803
  **/
804 804
 function proteger_amp($texte) {
805
-	return str_replace('&', '&amp;', $texte);
805
+    return str_replace('&', '&amp;', $texte);
806 806
 }
807 807
 
808 808
 
@@ -833,21 +833,21 @@  discard block
 block discarded – undo
833 833
  * @return mixed|string
834 834
  */
835 835
 function entites_html($texte, $tout = false, $quote = true) {
836
-	if (
837
-		!is_string($texte) or !$texte
838
-		or strpbrk($texte, "&\"'<>") == false
839
-	) {
840
-		return $texte;
841
-	}
842
-	include_spip('inc/texte');
843
-	$flags = ($quote ? ENT_QUOTES : ENT_NOQUOTES);
844
-	$flags |= ENT_HTML401;
845
-	$texte = spip_htmlspecialchars(echappe_retour(echappe_html($texte, '', true), '', 'proteger_amp'), $flags);
846
-	if ($tout) {
847
-		return corriger_toutes_entites_html($texte);
848
-	} else {
849
-		return corriger_entites_html($texte);
850
-	}
836
+    if (
837
+        !is_string($texte) or !$texte
838
+        or strpbrk($texte, "&\"'<>") == false
839
+    ) {
840
+        return $texte;
841
+    }
842
+    include_spip('inc/texte');
843
+    $flags = ($quote ? ENT_QUOTES : ENT_NOQUOTES);
844
+    $flags |= ENT_HTML401;
845
+    $texte = spip_htmlspecialchars(echappe_retour(echappe_html($texte, '', true), '', 'proteger_amp'), $flags);
846
+    if ($tout) {
847
+        return corriger_toutes_entites_html($texte);
848
+    } else {
849
+        return corriger_entites_html($texte);
850
+    }
851 851
 }
852 852
 
853 853
 /**
@@ -866,37 +866,37 @@  discard block
 block discarded – undo
866 866
  *     Texte converti
867 867
  **/
868 868
 function filtrer_entites($texte) {
869
-	if (strpos($texte, '&') === false) {
870
-		return $texte;
871
-	}
872
-	// filtrer
873
-	$texte = html2unicode($texte);
874
-	// remettre le tout dans le charset cible
875
-	$texte = unicode2charset($texte);
876
-	// cas particulier des " et ' qu'il faut filtrer aussi
877
-	// (on le faisait deja avec un &quot;)
878
-	if (strpos($texte, '&#') !== false) {
879
-		$texte = str_replace(['&#039;', '&#39;', '&#034;', '&#34;'], ["'", "'", '"', '"'], $texte);
880
-	}
869
+    if (strpos($texte, '&') === false) {
870
+        return $texte;
871
+    }
872
+    // filtrer
873
+    $texte = html2unicode($texte);
874
+    // remettre le tout dans le charset cible
875
+    $texte = unicode2charset($texte);
876
+    // cas particulier des " et ' qu'il faut filtrer aussi
877
+    // (on le faisait deja avec un &quot;)
878
+    if (strpos($texte, '&#') !== false) {
879
+        $texte = str_replace(['&#039;', '&#39;', '&#034;', '&#34;'], ["'", "'", '"', '"'], $texte);
880
+    }
881 881
 
882
-	return $texte;
882
+    return $texte;
883 883
 }
884 884
 
885 885
 
886 886
 if (!function_exists('filtre_filtrer_entites_dist')) {
887
-	/**
888
-	 * Version sécurisée de filtrer_entites
889
-	 *
890
-	 * @uses interdire_scripts()
891
-	 * @uses filtrer_entites()
892
-	 *
893
-	 * @param string $t
894
-	 * @return string
895
-	 */
896
-	function filtre_filtrer_entites_dist($t) {
897
-		include_spip('inc/texte');
898
-		return interdire_scripts(filtrer_entites($t));
899
-	}
887
+    /**
888
+     * Version sécurisée de filtrer_entites
889
+     *
890
+     * @uses interdire_scripts()
891
+     * @uses filtrer_entites()
892
+     *
893
+     * @param string $t
894
+     * @return string
895
+     */
896
+    function filtre_filtrer_entites_dist($t) {
897
+        include_spip('inc/texte');
898
+        return interdire_scripts(filtrer_entites($t));
899
+    }
900 900
 }
901 901
 
902 902
 
@@ -911,18 +911,18 @@  discard block
 block discarded – undo
911 911
  * @return string|array
912 912
  **/
913 913
 function supprimer_caracteres_illegaux($texte) {
914
-	static $from = "\x0\x1\x2\x3\x4\x5\x6\x7\x8\xB\xC\xE\xF\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F";
915
-	static $to = null;
914
+    static $from = "\x0\x1\x2\x3\x4\x5\x6\x7\x8\xB\xC\xE\xF\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F";
915
+    static $to = null;
916 916
 
917
-	if (is_array($texte)) {
918
-		return array_map('supprimer_caracteres_illegaux', $texte);
919
-	}
917
+    if (is_array($texte)) {
918
+        return array_map('supprimer_caracteres_illegaux', $texte);
919
+    }
920 920
 
921
-	if (!$to) {
922
-		$to = str_repeat('-', strlen($from));
923
-	}
921
+    if (!$to) {
922
+        $to = str_repeat('-', strlen($from));
923
+    }
924 924
 
925
-	return strtr($texte, $from, $to);
925
+    return strtr($texte, $from, $to);
926 926
 }
927 927
 
928 928
 /**
@@ -934,10 +934,10 @@  discard block
 block discarded – undo
934 934
  * @return string|array
935 935
  **/
936 936
 function corriger_caracteres($texte) {
937
-	$texte = corriger_caracteres_windows($texte);
938
-	$texte = supprimer_caracteres_illegaux($texte);
937
+    $texte = corriger_caracteres_windows($texte);
938
+    $texte = supprimer_caracteres_illegaux($texte);
939 939
 
940
-	return $texte;
940
+    return $texte;
941 941
 }
942 942
 
943 943
 /**
@@ -954,44 +954,44 @@  discard block
 block discarded – undo
954 954
  *     Texte encodé pour XML
955 955
  */
956 956
 function texte_backend(string $texte): string {
957
-	if ($texte === '') {
958
-		return '';
959
-	}
957
+    if ($texte === '') {
958
+        return '';
959
+    }
960 960
 
961
-	static $apostrophe = ['&#8217;', "'"]; # n'allouer qu'une fois
961
+    static $apostrophe = ['&#8217;', "'"]; # n'allouer qu'une fois
962 962
 
963
-	// si on a des liens ou des images, les passer en absolu
964
-	$texte = liens_absolus($texte);
963
+    // si on a des liens ou des images, les passer en absolu
964
+    $texte = liens_absolus($texte);
965 965
 
966
-	// echapper les tags &gt; &lt;
967
-	$texte = preg_replace(',&(gt|lt);,S', '&amp;\1;', $texte);
966
+    // echapper les tags &gt; &lt;
967
+    $texte = preg_replace(',&(gt|lt);,S', '&amp;\1;', $texte);
968 968
 
969
-	// importer les &eacute;
970
-	$texte = filtrer_entites($texte);
969
+    // importer les &eacute;
970
+    $texte = filtrer_entites($texte);
971 971
 
972
-	// " -> &quot; et tout ce genre de choses
973
-	$u = $GLOBALS['meta']['pcre_u'];
974
-	$texte = str_replace('&nbsp;', ' ', $texte);
975
-	$texte = preg_replace('/\s{2,}/S' . $u, ' ', $texte);
976
-	// ne pas echapper les sinqle quotes car certains outils de syndication gerent mal
977
-	$texte = entites_html($texte, false, false);
978
-	// mais bien echapper les double quotes !
979
-	$texte = str_replace('"', '&#034;', $texte);
972
+    // " -> &quot; et tout ce genre de choses
973
+    $u = $GLOBALS['meta']['pcre_u'];
974
+    $texte = str_replace('&nbsp;', ' ', $texte);
975
+    $texte = preg_replace('/\s{2,}/S' . $u, ' ', $texte);
976
+    // ne pas echapper les sinqle quotes car certains outils de syndication gerent mal
977
+    $texte = entites_html($texte, false, false);
978
+    // mais bien echapper les double quotes !
979
+    $texte = str_replace('"', '&#034;', $texte);
980 980
 
981
-	// verifier le charset
982
-	$texte = charset2unicode($texte);
981
+    // verifier le charset
982
+    $texte = charset2unicode($texte);
983 983
 
984
-	// Caracteres problematiques en iso-latin 1
985
-	if (isset($GLOBALS['meta']['charset']) and $GLOBALS['meta']['charset'] == 'iso-8859-1') {
986
-		$texte = str_replace(chr(156), '&#156;', $texte);
987
-		$texte = str_replace(chr(140), '&#140;', $texte);
988
-		$texte = str_replace(chr(159), '&#159;', $texte);
989
-	}
984
+    // Caracteres problematiques en iso-latin 1
985
+    if (isset($GLOBALS['meta']['charset']) and $GLOBALS['meta']['charset'] == 'iso-8859-1') {
986
+        $texte = str_replace(chr(156), '&#156;', $texte);
987
+        $texte = str_replace(chr(140), '&#140;', $texte);
988
+        $texte = str_replace(chr(159), '&#159;', $texte);
989
+    }
990 990
 
991
-	// l'apostrophe curly pose probleme a certains lecteure de RSS
992
-	// et le caractere apostrophe alourdit les squelettes avec PHP
993
-	// ==> on les remplace par l'entite HTML
994
-	return str_replace($apostrophe, "'", $texte);
991
+    // l'apostrophe curly pose probleme a certains lecteure de RSS
992
+    // et le caractere apostrophe alourdit les squelettes avec PHP
993
+    // ==> on les remplace par l'entite HTML
994
+    return str_replace($apostrophe, "'", $texte);
995 995
 }
996 996
 
997 997
 /**
@@ -1008,7 +1008,7 @@  discard block
 block discarded – undo
1008 1008
  *     Texte encodé et quote pour XML
1009 1009
  */
1010 1010
 function texte_backendq(string $texte): string {
1011
-	return addslashes(texte_backend($texte));
1011
+    return addslashes(texte_backend($texte));
1012 1012
 }
1013 1013
 
1014 1014
 
@@ -1031,11 +1031,11 @@  discard block
 block discarded – undo
1031 1031
  *     Numéro de titre, sinon chaîne vide
1032 1032
  **/
1033 1033
 function supprimer_numero($texte) {
1034
-	return preg_replace(
1035
-		',^[[:space:]]*([0-9]+)([.)]|' . chr(194) . '?' . chr(176) . ')[[:space:]]+,S',
1036
-		'',
1037
-		$texte
1038
-	);
1034
+    return preg_replace(
1035
+        ',^[[:space:]]*([0-9]+)([.)]|' . chr(194) . '?' . chr(176) . ')[[:space:]]+,S',
1036
+        '',
1037
+        $texte
1038
+    );
1039 1039
 }
1040 1040
 
1041 1041
 /**
@@ -1058,17 +1058,17 @@  discard block
 block discarded – undo
1058 1058
  *     Numéro de titre, sinon chaîne vide
1059 1059
  **/
1060 1060
 function recuperer_numero($texte) {
1061
-	if (
1062
-		preg_match(
1063
-			',^[[:space:]]*([0-9]+)([.)]|' . chr(194) . '?' . chr(176) . ')[[:space:]]+,S',
1064
-			$texte,
1065
-			$regs
1066
-		)
1067
-	) {
1068
-		return strval($regs[1]);
1069
-	} else {
1070
-		return '';
1071
-	}
1061
+    if (
1062
+        preg_match(
1063
+            ',^[[:space:]]*([0-9]+)([.)]|' . chr(194) . '?' . chr(176) . ')[[:space:]]+,S',
1064
+            $texte,
1065
+            $regs
1066
+        )
1067
+    ) {
1068
+        return strval($regs[1]);
1069
+    } else {
1070
+        return '';
1071
+    }
1072 1072
 }
1073 1073
 
1074 1074
 /**
@@ -1095,16 +1095,16 @@  discard block
 block discarded – undo
1095 1095
  *     Texte ou tableau de textes converti
1096 1096
  **/
1097 1097
 function supprimer_tags($texte, $rempl = '') {
1098
-	if ($texte === null) {
1099
-		return '';
1100
-	}
1101
-	$texte = preg_replace(',<(!--|\w|/|!\[endif|!\[if)[^>]*>,US', $rempl, $texte);
1102
-	// ne pas oublier un < final non ferme car coupe
1103
-	$texte = preg_replace(',<(!--|\w|/).*$,US', $rempl, $texte);
1104
-	// mais qui peut aussi etre un simple signe plus petit que
1105
-	$texte = str_replace('<', '&lt;', $texte);
1098
+    if ($texte === null) {
1099
+        return '';
1100
+    }
1101
+    $texte = preg_replace(',<(!--|\w|/|!\[endif|!\[if)[^>]*>,US', $rempl, $texte);
1102
+    // ne pas oublier un < final non ferme car coupe
1103
+    $texte = preg_replace(',<(!--|\w|/).*$,US', $rempl, $texte);
1104
+    // mais qui peut aussi etre un simple signe plus petit que
1105
+    $texte = str_replace('<', '&lt;', $texte);
1106 1106
 
1107
-	return $texte;
1107
+    return $texte;
1108 1108
 }
1109 1109
 
1110 1110
 /**
@@ -1127,9 +1127,9 @@  discard block
 block discarded – undo
1127 1127
  *     Texte converti
1128 1128
  **/
1129 1129
 function echapper_tags($texte, $rempl = '') {
1130
-	$texte = preg_replace('/<([^>]*)>/', "&lt;\\1&gt;", $texte);
1130
+    $texte = preg_replace('/<([^>]*)>/', "&lt;\\1&gt;", $texte);
1131 1131
 
1132
-	return $texte;
1132
+    return $texte;
1133 1133
 }
1134 1134
 
1135 1135
 /**
@@ -1150,18 +1150,18 @@  discard block
 block discarded – undo
1150 1150
  *     Texte converti
1151 1151
  **/
1152 1152
 function textebrut($texte) {
1153
-	$u = $GLOBALS['meta']['pcre_u'];
1154
-	$texte = preg_replace('/\s+/S' . $u, ' ', $texte);
1155
-	$texte = preg_replace('/<(p|br)( [^>]*)?' . '>/iS', "\n\n", $texte);
1156
-	$texte = preg_replace("/^\n+/", '', $texte);
1157
-	$texte = preg_replace("/\n+$/", '', $texte);
1158
-	$texte = preg_replace("/\n +/", "\n", $texte);
1159
-	$texte = supprimer_tags($texte);
1160
-	$texte = preg_replace('/(&nbsp;| )+/S', ' ', $texte);
1161
-	// nettoyer l'apostrophe curly qui pose probleme a certains rss-readers, lecteurs de mail...
1162
-	$texte = str_replace('&#8217;', "'", $texte);
1153
+    $u = $GLOBALS['meta']['pcre_u'];
1154
+    $texte = preg_replace('/\s+/S' . $u, ' ', $texte);
1155
+    $texte = preg_replace('/<(p|br)( [^>]*)?' . '>/iS', "\n\n", $texte);
1156
+    $texte = preg_replace("/^\n+/", '', $texte);
1157
+    $texte = preg_replace("/\n+$/", '', $texte);
1158
+    $texte = preg_replace("/\n +/", "\n", $texte);
1159
+    $texte = supprimer_tags($texte);
1160
+    $texte = preg_replace('/(&nbsp;| )+/S', ' ', $texte);
1161
+    // nettoyer l'apostrophe curly qui pose probleme a certains rss-readers, lecteurs de mail...
1162
+    $texte = str_replace('&#8217;', "'", $texte);
1163 1163
 
1164
-	return $texte;
1164
+    return $texte;
1165 1165
 }
1166 1166
 
1167 1167
 
@@ -1177,23 +1177,23 @@  discard block
 block discarded – undo
1177 1177
  *     Texte avec liens ouvrants
1178 1178
  **/
1179 1179
 function liens_ouvrants($texte) {
1180
-	if (
1181
-		preg_match_all(
1182
-			",(<a\s+[^>]*https?://[^>]*class=[\"']spip_(out|url)\b[^>]+>),imsS",
1183
-			$texte,
1184
-			$liens,
1185
-			PREG_PATTERN_ORDER
1186
-		)
1187
-	) {
1188
-		foreach ($liens[0] as $a) {
1189
-			$rel = 'noopener noreferrer ' . extraire_attribut($a, 'rel');
1190
-			$ablank = inserer_attribut($a, 'rel', $rel);
1191
-			$ablank = inserer_attribut($ablank, 'target', '_blank');
1192
-			$texte = str_replace($a, $ablank, $texte);
1193
-		}
1194
-	}
1195
-
1196
-	return $texte;
1180
+    if (
1181
+        preg_match_all(
1182
+            ",(<a\s+[^>]*https?://[^>]*class=[\"']spip_(out|url)\b[^>]+>),imsS",
1183
+            $texte,
1184
+            $liens,
1185
+            PREG_PATTERN_ORDER
1186
+        )
1187
+    ) {
1188
+        foreach ($liens[0] as $a) {
1189
+            $rel = 'noopener noreferrer ' . extraire_attribut($a, 'rel');
1190
+            $ablank = inserer_attribut($a, 'rel', $rel);
1191
+            $ablank = inserer_attribut($ablank, 'target', '_blank');
1192
+            $texte = str_replace($a, $ablank, $texte);
1193
+        }
1194
+    }
1195
+
1196
+    return $texte;
1197 1197
 }
1198 1198
 
1199 1199
 /**
@@ -1203,22 +1203,22 @@  discard block
 block discarded – undo
1203 1203
  * @return string
1204 1204
  */
1205 1205
 function liens_nofollow($texte) {
1206
-	if (stripos($texte, '<a') === false) {
1207
-		return $texte;
1208
-	}
1206
+    if (stripos($texte, '<a') === false) {
1207
+        return $texte;
1208
+    }
1209 1209
 
1210
-	if (preg_match_all(",<a\b[^>]*>,UimsS", $texte, $regs, PREG_PATTERN_ORDER)) {
1211
-		foreach ($regs[0] as $a) {
1212
-			$rel = extraire_attribut($a, 'rel') ?? '';
1213
-			if (strpos($rel, 'nofollow') === false) {
1214
-				$rel = 'nofollow' . ($rel ? " $rel" : '');
1215
-				$anofollow = inserer_attribut($a, 'rel', $rel);
1216
-				$texte = str_replace($a, $anofollow, $texte);
1217
-			}
1218
-		}
1219
-	}
1210
+    if (preg_match_all(",<a\b[^>]*>,UimsS", $texte, $regs, PREG_PATTERN_ORDER)) {
1211
+        foreach ($regs[0] as $a) {
1212
+            $rel = extraire_attribut($a, 'rel') ?? '';
1213
+            if (strpos($rel, 'nofollow') === false) {
1214
+                $rel = 'nofollow' . ($rel ? " $rel" : '');
1215
+                $anofollow = inserer_attribut($a, 'rel', $rel);
1216
+                $texte = str_replace($a, $anofollow, $texte);
1217
+            }
1218
+        }
1219
+    }
1220 1220
 
1221
-	return $texte;
1221
+    return $texte;
1222 1222
 }
1223 1223
 
1224 1224
 /**
@@ -1237,12 +1237,12 @@  discard block
 block discarded – undo
1237 1237
  *     Texte sans paraghaphes
1238 1238
  **/
1239 1239
 function PtoBR($texte) {
1240
-	$u = $GLOBALS['meta']['pcre_u'];
1241
-	$texte = preg_replace('@</p>@iS', "\n", $texte);
1242
-	$texte = preg_replace("@<p\b.*>@UiS", '<br />', $texte);
1243
-	$texte = preg_replace('@^\s*<br />@S' . $u, '', $texte);
1240
+    $u = $GLOBALS['meta']['pcre_u'];
1241
+    $texte = preg_replace('@</p>@iS', "\n", $texte);
1242
+    $texte = preg_replace("@<p\b.*>@UiS", '<br />', $texte);
1243
+    $texte = preg_replace('@^\s*<br />@S' . $u, '', $texte);
1244 1244
 
1245
-	return $texte;
1245
+    return $texte;
1246 1246
 }
1247 1247
 
1248 1248
 
@@ -1267,14 +1267,14 @@  discard block
 block discarded – undo
1267 1267
  * @return string Texte encadré du style CSS
1268 1268
  */
1269 1269
 function lignes_longues($texte) {
1270
-	if (!strlen(trim($texte))) {
1271
-		return $texte;
1272
-	}
1273
-	include_spip('inc/texte');
1274
-	$tag = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $texte) ?
1275
-		'div' : 'span';
1270
+    if (!strlen(trim($texte))) {
1271
+        return $texte;
1272
+    }
1273
+    include_spip('inc/texte');
1274
+    $tag = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $texte) ?
1275
+        'div' : 'span';
1276 1276
 
1277
-	return "<$tag style='word-wrap:break-word;'>$texte</$tag>";
1277
+    return "<$tag style='word-wrap:break-word;'>$texte</$tag>";
1278 1278
 }
1279 1279
 
1280 1280
 /**
@@ -1293,30 +1293,30 @@  discard block
 block discarded – undo
1293 1293
  * @return string Texte en majuscule
1294 1294
  */
1295 1295
 function majuscules($texte) {
1296
-	if (!strlen($texte)) {
1297
-		return '';
1298
-	}
1296
+    if (!strlen($texte)) {
1297
+        return '';
1298
+    }
1299 1299
 
1300
-	// Cas du turc
1301
-	if ($GLOBALS['spip_lang'] == 'tr') {
1302
-		# remplacer hors des tags et des entites
1303
-		if (preg_match_all(',<[^<>]+>|&[^;]+;,S', $texte, $regs, PREG_SET_ORDER)) {
1304
-			foreach ($regs as $n => $match) {
1305
-				$texte = str_replace($match[0], "@@SPIP_TURC$n@@", $texte);
1306
-			}
1307
-		}
1300
+    // Cas du turc
1301
+    if ($GLOBALS['spip_lang'] == 'tr') {
1302
+        # remplacer hors des tags et des entites
1303
+        if (preg_match_all(',<[^<>]+>|&[^;]+;,S', $texte, $regs, PREG_SET_ORDER)) {
1304
+            foreach ($regs as $n => $match) {
1305
+                $texte = str_replace($match[0], "@@SPIP_TURC$n@@", $texte);
1306
+            }
1307
+        }
1308 1308
 
1309
-		$texte = str_replace('i', '&#304;', $texte);
1309
+        $texte = str_replace('i', '&#304;', $texte);
1310 1310
 
1311
-		if ($regs) {
1312
-			foreach ($regs as $n => $match) {
1313
-				$texte = str_replace("@@SPIP_TURC$n@@", $match[0], $texte);
1314
-			}
1315
-		}
1316
-	}
1311
+        if ($regs) {
1312
+            foreach ($regs as $n => $match) {
1313
+                $texte = str_replace("@@SPIP_TURC$n@@", $match[0], $texte);
1314
+            }
1315
+        }
1316
+    }
1317 1317
 
1318
-	// Cas general
1319
-	return "<span style='text-transform: uppercase;'>$texte</span>";
1318
+    // Cas general
1319
+    return "<span style='text-transform: uppercase;'>$texte</span>";
1320 1320
 }
1321 1321
 
1322 1322
 /**
@@ -1334,29 +1334,29 @@  discard block
 block discarded – undo
1334 1334
  * @return string
1335 1335
  **/
1336 1336
 function taille_en_octets($taille) {
1337
-	if (!defined('_KILOBYTE')) {
1338
-		/**
1339
-		 * Définit le nombre d'octets dans un Kilobyte
1340
-		 *
1341
-		 * @var int
1342
-		 **/
1343
-		define('_KILOBYTE', 1024);
1344
-	}
1337
+    if (!defined('_KILOBYTE')) {
1338
+        /**
1339
+         * Définit le nombre d'octets dans un Kilobyte
1340
+         *
1341
+         * @var int
1342
+         **/
1343
+        define('_KILOBYTE', 1024);
1344
+    }
1345 1345
 
1346
-	if ($taille < 1) {
1347
-		return '';
1348
-	}
1349
-	if ($taille < _KILOBYTE) {
1350
-		$taille = _T('taille_octets', ['taille' => $taille]);
1351
-	} elseif ($taille < _KILOBYTE * _KILOBYTE) {
1352
-		$taille = _T('taille_ko', ['taille' => round($taille / _KILOBYTE, 1)]);
1353
-	} elseif ($taille < _KILOBYTE * _KILOBYTE * _KILOBYTE) {
1354
-		$taille = _T('taille_mo', ['taille' => round($taille / _KILOBYTE / _KILOBYTE, 1)]);
1355
-	} else {
1356
-		$taille = _T('taille_go', ['taille' => round($taille / _KILOBYTE / _KILOBYTE / _KILOBYTE, 2)]);
1357
-	}
1346
+    if ($taille < 1) {
1347
+        return '';
1348
+    }
1349
+    if ($taille < _KILOBYTE) {
1350
+        $taille = _T('taille_octets', ['taille' => $taille]);
1351
+    } elseif ($taille < _KILOBYTE * _KILOBYTE) {
1352
+        $taille = _T('taille_ko', ['taille' => round($taille / _KILOBYTE, 1)]);
1353
+    } elseif ($taille < _KILOBYTE * _KILOBYTE * _KILOBYTE) {
1354
+        $taille = _T('taille_mo', ['taille' => round($taille / _KILOBYTE / _KILOBYTE, 1)]);
1355
+    } else {
1356
+        $taille = _T('taille_go', ['taille' => round($taille / _KILOBYTE / _KILOBYTE / _KILOBYTE, 2)]);
1357
+    }
1358 1358
 
1359
-	return $taille;
1359
+    return $taille;
1360 1360
 }
1361 1361
 
1362 1362
 
@@ -1378,21 +1378,21 @@  discard block
 block discarded – undo
1378 1378
  *     Texte prêt pour être utilisé en attribut HTML
1379 1379
  **/
1380 1380
 function attribut_html(?string $texte, $textebrut = true): string {
1381
-	if ($texte === null) {
1382
-		return '';
1383
-	}
1384
-	$u = $GLOBALS['meta']['pcre_u'];
1385
-	if ($textebrut) {
1386
-		$texte = preg_replace([",\n,", ',\s(?=\s),msS' . $u], [' ', ''], textebrut($texte));
1387
-	}
1388
-	$texte = texte_backend($texte);
1389
-	$texte = str_replace(["'", '"'], ['&#039;', '&#034;'], $texte);
1381
+    if ($texte === null) {
1382
+        return '';
1383
+    }
1384
+    $u = $GLOBALS['meta']['pcre_u'];
1385
+    if ($textebrut) {
1386
+        $texte = preg_replace([",\n,", ',\s(?=\s),msS' . $u], [' ', ''], textebrut($texte));
1387
+    }
1388
+    $texte = texte_backend($texte);
1389
+    $texte = str_replace(["'", '"'], ['&#039;', '&#034;'], $texte);
1390 1390
 
1391
-	return preg_replace(
1392
-		['/&(amp;|#38;)/', '/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,5};)/'],
1393
-		['&', '&#38;'],
1394
-		$texte
1395
-	);
1391
+    return preg_replace(
1392
+        ['/&(amp;|#38;)/', '/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,5};)/'],
1393
+        ['&', '&#38;'],
1394
+        $texte
1395
+    );
1396 1396
 }
1397 1397
 
1398 1398
 
@@ -1412,15 +1412,15 @@  discard block
 block discarded – undo
1412 1412
  *     URL ou chaîne vide
1413 1413
  **/
1414 1414
 function vider_url(?string $url, $entites = true): string {
1415
-	if ($url === null) {
1416
-		return '';
1417
-	}
1418
-	# un message pour abs_url
1419
-	$GLOBALS['mode_abs_url'] = 'url';
1420
-	$url = trim($url);
1421
-	$r = ',^(?:' . _PROTOCOLES_STD . '):?/?/?$,iS';
1415
+    if ($url === null) {
1416
+        return '';
1417
+    }
1418
+    # un message pour abs_url
1419
+    $GLOBALS['mode_abs_url'] = 'url';
1420
+    $url = trim($url);
1421
+    $r = ',^(?:' . _PROTOCOLES_STD . '):?/?/?$,iS';
1422 1422
 
1423
-	return preg_match($r, $url) ? '' : ($entites ? entites_html($url) : $url);
1423
+    return preg_match($r, $url) ? '' : ($entites ? entites_html($url) : $url);
1424 1424
 }
1425 1425
 
1426 1426
 
@@ -1435,10 +1435,10 @@  discard block
 block discarded – undo
1435 1435
  * @return string Adresse email maquillée
1436 1436
  **/
1437 1437
 function antispam($texte) {
1438
-	include_spip('inc/acces');
1439
-	$masque = creer_pass_aleatoire(3);
1438
+    include_spip('inc/acces');
1439
+    $masque = creer_pass_aleatoire(3);
1440 1440
 
1441
-	return preg_replace('/@/', " $masque ", $texte);
1441
+    return preg_replace('/@/', " $masque ", $texte);
1442 1442
 }
1443 1443
 
1444 1444
 /**
@@ -1470,8 +1470,8 @@  discard block
 block discarded – undo
1470 1470
  *     True si on a le droit d'accès, false sinon.
1471 1471
  **/
1472 1472
 function filtre_securiser_acces_dist($id_auteur, $cle, $dir, $op = '', $args = '') {
1473
-	include_spip('inc/acces');
1474
-	return securiser_acces_low_sec($id_auteur, $cle, $op ? "$dir $op $args" : $dir);
1473
+    include_spip('inc/acces');
1474
+    return securiser_acces_low_sec($id_auteur, $cle, $op ? "$dir $op $args" : $dir);
1475 1475
 }
1476 1476
 
1477 1477
 /**
@@ -1496,13 +1496,13 @@  discard block
 block discarded – undo
1496 1496
  *     Retourne $texte, sinon $sinon.
1497 1497
  **/
1498 1498
 function sinon($texte, $sinon = '') {
1499
-	if ($texte) {
1500
-		return $texte;
1501
-	} elseif (is_scalar($texte) and strlen($texte)) {
1502
-		return $texte;
1503
-	} else {
1504
-		return $sinon;
1505
-	}
1499
+    if ($texte) {
1500
+        return $texte;
1501
+    } elseif (is_scalar($texte) and strlen($texte)) {
1502
+        return $texte;
1503
+    } else {
1504
+        return $sinon;
1505
+    }
1506 1506
 }
1507 1507
 
1508 1508
 /**
@@ -1526,7 +1526,7 @@  discard block
 block discarded – undo
1526 1526
  * @return mixed
1527 1527
  **/
1528 1528
 function choixsivide($a, $vide, $pasvide) {
1529
-	return $a ? $pasvide : $vide;
1529
+    return $a ? $pasvide : $vide;
1530 1530
 }
1531 1531
 
1532 1532
 /**
@@ -1550,7 +1550,7 @@  discard block
 block discarded – undo
1550 1550
  * @return mixed
1551 1551
  **/
1552 1552
 function choixsiegal($a1, $a2, $v, $f) {
1553
-	return ($a1 == $a2) ? $v : $f;
1553
+    return ($a1 == $a2) ? $v : $f;
1554 1554
 }
1555 1555
 
1556 1556
 //
@@ -1569,13 +1569,13 @@  discard block
 block discarded – undo
1569 1569
  * @return string
1570 1570
  **/
1571 1571
 function filtrer_ical($texte) {
1572
-	#include_spip('inc/charsets');
1573
-	$texte = html2unicode($texte);
1574
-	$texte = unicode2charset(charset2unicode($texte, $GLOBALS['meta']['charset']), 'utf-8');
1575
-	$texte = preg_replace("/\n/", ' ', $texte);
1576
-	$texte = preg_replace('/,/', '\,', $texte);
1572
+    #include_spip('inc/charsets');
1573
+    $texte = html2unicode($texte);
1574
+    $texte = unicode2charset(charset2unicode($texte, $GLOBALS['meta']['charset']), 'utf-8');
1575
+    $texte = preg_replace("/\n/", ' ', $texte);
1576
+    $texte = preg_replace('/,/', '\,', $texte);
1577 1577
 
1578
-	return $texte;
1578
+    return $texte;
1579 1579
 }
1580 1580
 
1581 1581
 
@@ -1600,54 +1600,54 @@  discard block
 block discarded – undo
1600 1600
  * @return string
1601 1601
  **/
1602 1602
 function post_autobr($texte, $delim = "\n_ ") {
1603
-	if (!function_exists('echappe_html')) {
1604
-		include_spip('inc/texte_mini');
1605
-	}
1606
-	$texte = str_replace("\r\n", "\r", $texte);
1607
-	$texte = str_replace("\r", "\n", $texte);
1608
-
1609
-	if (preg_match(",\n+$,", $texte, $fin)) {
1610
-		$texte = substr($texte, 0, -strlen($fin = $fin[0]));
1611
-	} else {
1612
-		$fin = '';
1613
-	}
1614
-
1615
-	$texte = echappe_html($texte, '', true);
1616
-
1617
-	// echapper les modeles
1618
-	if (strpos($texte, '<') !== false) {
1619
-		include_spip('inc/lien');
1620
-		if (defined('_PREG_MODELE')) {
1621
-			$preg_modeles = '@' . _PREG_MODELE . '@imsS';
1622
-			$texte = echappe_html($texte, '', true, $preg_modeles);
1623
-		}
1624
-	}
1625
-
1626
-	$debut = '';
1627
-	$suite = $texte;
1628
-	while ($t = strpos('-' . $suite, "\n", 1)) {
1629
-		$debut .= substr($suite, 0, $t - 1);
1630
-		$suite = substr($suite, $t);
1631
-		$car = substr($suite, 0, 1);
1632
-		if (
1633
-			($car <> '-') and ($car <> '_') and ($car <> "\n") and ($car <> '|') and ($car <> '}')
1634
-			and !preg_match(',^\s*(\n|</?(quote|div|dl|dt|dd)|$),S', ($suite))
1635
-			and !preg_match(',</?(quote|div|dl|dt|dd)> *$,iS', $debut)
1636
-		) {
1637
-			$debut .= $delim;
1638
-		} else {
1639
-			$debut .= "\n";
1640
-		}
1641
-		if (preg_match(",^\n+,", $suite, $regs)) {
1642
-			$debut .= $regs[0];
1643
-			$suite = substr($suite, strlen($regs[0]));
1644
-		}
1645
-	}
1646
-	$texte = $debut . $suite;
1647
-
1648
-	$texte = echappe_retour($texte);
1649
-
1650
-	return $texte . $fin;
1603
+    if (!function_exists('echappe_html')) {
1604
+        include_spip('inc/texte_mini');
1605
+    }
1606
+    $texte = str_replace("\r\n", "\r", $texte);
1607
+    $texte = str_replace("\r", "\n", $texte);
1608
+
1609
+    if (preg_match(",\n+$,", $texte, $fin)) {
1610
+        $texte = substr($texte, 0, -strlen($fin = $fin[0]));
1611
+    } else {
1612
+        $fin = '';
1613
+    }
1614
+
1615
+    $texte = echappe_html($texte, '', true);
1616
+
1617
+    // echapper les modeles
1618
+    if (strpos($texte, '<') !== false) {
1619
+        include_spip('inc/lien');
1620
+        if (defined('_PREG_MODELE')) {
1621
+            $preg_modeles = '@' . _PREG_MODELE . '@imsS';
1622
+            $texte = echappe_html($texte, '', true, $preg_modeles);
1623
+        }
1624
+    }
1625
+
1626
+    $debut = '';
1627
+    $suite = $texte;
1628
+    while ($t = strpos('-' . $suite, "\n", 1)) {
1629
+        $debut .= substr($suite, 0, $t - 1);
1630
+        $suite = substr($suite, $t);
1631
+        $car = substr($suite, 0, 1);
1632
+        if (
1633
+            ($car <> '-') and ($car <> '_') and ($car <> "\n") and ($car <> '|') and ($car <> '}')
1634
+            and !preg_match(',^\s*(\n|</?(quote|div|dl|dt|dd)|$),S', ($suite))
1635
+            and !preg_match(',</?(quote|div|dl|dt|dd)> *$,iS', $debut)
1636
+        ) {
1637
+            $debut .= $delim;
1638
+        } else {
1639
+            $debut .= "\n";
1640
+        }
1641
+        if (preg_match(",^\n+,", $suite, $regs)) {
1642
+            $debut .= $regs[0];
1643
+            $suite = substr($suite, strlen($regs[0]));
1644
+        }
1645
+    }
1646
+    $texte = $debut . $suite;
1647
+
1648
+    $texte = echappe_retour($texte);
1649
+
1650
+    return $texte . $fin;
1651 1651
 }
1652 1652
 
1653 1653
 
@@ -1688,47 +1688,47 @@  discard block
 block discarded – undo
1688 1688
  * @return string
1689 1689
  **/
1690 1690
 function extraire_idiome($letexte, $lang = null, $options = []) {
1691
-	static $traduire = false;
1692
-	if (
1693
-		$letexte
1694
-		and preg_match_all(_EXTRAIRE_IDIOME, $letexte, $regs, PREG_SET_ORDER)
1695
-	) {
1696
-		if (!$traduire) {
1697
-			$traduire = charger_fonction('traduire', 'inc');
1698
-			include_spip('inc/lang');
1699
-		}
1700
-		if (!$lang) {
1701
-			$lang = $GLOBALS['spip_lang'];
1702
-		}
1703
-		// Compatibilité avec le prototype de fonction précédente qui utilisait un boolean
1704
-		if (is_bool($options)) {
1705
-			$options = ['echappe_span' => $options];
1706
-		}
1707
-		if (!isset($options['echappe_span'])) {
1708
-			$options = array_merge($options, ['echappe_span' => false]);
1709
-		}
1710
-
1711
-		foreach ($regs as $reg) {
1712
-			$cle = ($reg[1] ? $reg[1] . ':' : '') . $reg[2];
1713
-			$desc = $traduire($cle, $lang, true);
1714
-			$l = $desc->langue;
1715
-			// si pas de traduction, on laissera l'écriture de l'idiome entier dans le texte.
1716
-			if (strlen($desc->texte ?? '')) {
1717
-				$trad = code_echappement($desc->texte, 'idiome', false);
1718
-				if ($l !== $lang) {
1719
-					$trad = str_replace("'", '"', inserer_attribut($trad, 'lang', $l));
1720
-				}
1721
-				if (lang_dir($l) !== lang_dir($lang)) {
1722
-					$trad = str_replace("'", '"', inserer_attribut($trad, 'dir', lang_dir($l)));
1723
-				}
1724
-				if (!$options['echappe_span']) {
1725
-					$trad = echappe_retour($trad, 'idiome');
1726
-				}
1727
-				$letexte = str_replace($reg[0], $trad, $letexte);
1728
-			}
1729
-		}
1730
-	}
1731
-	return $letexte;
1691
+    static $traduire = false;
1692
+    if (
1693
+        $letexte
1694
+        and preg_match_all(_EXTRAIRE_IDIOME, $letexte, $regs, PREG_SET_ORDER)
1695
+    ) {
1696
+        if (!$traduire) {
1697
+            $traduire = charger_fonction('traduire', 'inc');
1698
+            include_spip('inc/lang');
1699
+        }
1700
+        if (!$lang) {
1701
+            $lang = $GLOBALS['spip_lang'];
1702
+        }
1703
+        // Compatibilité avec le prototype de fonction précédente qui utilisait un boolean
1704
+        if (is_bool($options)) {
1705
+            $options = ['echappe_span' => $options];
1706
+        }
1707
+        if (!isset($options['echappe_span'])) {
1708
+            $options = array_merge($options, ['echappe_span' => false]);
1709
+        }
1710
+
1711
+        foreach ($regs as $reg) {
1712
+            $cle = ($reg[1] ? $reg[1] . ':' : '') . $reg[2];
1713
+            $desc = $traduire($cle, $lang, true);
1714
+            $l = $desc->langue;
1715
+            // si pas de traduction, on laissera l'écriture de l'idiome entier dans le texte.
1716
+            if (strlen($desc->texte ?? '')) {
1717
+                $trad = code_echappement($desc->texte, 'idiome', false);
1718
+                if ($l !== $lang) {
1719
+                    $trad = str_replace("'", '"', inserer_attribut($trad, 'lang', $l));
1720
+                }
1721
+                if (lang_dir($l) !== lang_dir($lang)) {
1722
+                    $trad = str_replace("'", '"', inserer_attribut($trad, 'dir', lang_dir($l)));
1723
+                }
1724
+                if (!$options['echappe_span']) {
1725
+                    $trad = echappe_retour($trad, 'idiome');
1726
+                }
1727
+                $letexte = str_replace($reg[0], $trad, $letexte);
1728
+            }
1729
+        }
1730
+    }
1731
+    return $letexte;
1732 1732
 }
1733 1733
 
1734 1734
 /**
@@ -1780,68 +1780,68 @@  discard block
 block discarded – undo
1780 1780
  **/
1781 1781
 function extraire_multi($letexte, $lang = null, $options = []) {
1782 1782
 
1783
-	if (
1784
-		$letexte
1785
-		and preg_match_all(_EXTRAIRE_MULTI, $letexte, $regs, PREG_SET_ORDER)
1786
-	) {
1787
-		if (!$lang) {
1788
-			$lang = $GLOBALS['spip_lang'];
1789
-		}
1790
-
1791
-		// Compatibilité avec le prototype de fonction précédente qui utilisait un boolean
1792
-		if (is_bool($options)) {
1793
-			$options = ['echappe_span' => $options, 'lang_defaut' => _LANGUE_PAR_DEFAUT];
1794
-		}
1795
-		if (!isset($options['echappe_span'])) {
1796
-			$options = array_merge($options, ['echappe_span' => false]);
1797
-		}
1798
-		if (!isset($options['lang_defaut'])) {
1799
-			$options = array_merge($options, ['lang_defaut' => _LANGUE_PAR_DEFAUT]);
1800
-		}
1801
-
1802
-		include_spip('inc/lang');
1803
-		foreach ($regs as $reg) {
1804
-			// chercher la version de la langue courante
1805
-			$trads = extraire_trads($reg[1]);
1806
-			if ($l = approcher_langue($trads, $lang)) {
1807
-				$trad = $trads[$l];
1808
-			} else {
1809
-				if ($options['lang_defaut'] == 'aucune') {
1810
-					$trad = '';
1811
-				} else {
1812
-					// langue absente, prendre le fr ou une langue précisée (meme comportement que inc/traduire.php)
1813
-					// ou la premiere dispo
1814
-					// mais typographier le texte selon les regles de celle-ci
1815
-					// Attention aux blocs multi sur plusieurs lignes
1816
-					if (!$l = approcher_langue($trads, $options['lang_defaut'])) {
1817
-						$l = key($trads);
1818
-					}
1819
-					$trad = $trads[$l];
1820
-					$typographie = charger_fonction(lang_typo($l), 'typographie');
1821
-					$trad = $typographie($trad);
1822
-					// Tester si on echappe en span ou en div
1823
-					// il ne faut pas echapper en div si propre produit un seul paragraphe
1824
-					include_spip('inc/texte');
1825
-					$trad_propre = preg_replace(',(^<p[^>]*>|</p>$),Uims', '', propre($trad));
1826
-					$mode = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $trad_propre) ? 'div' : 'span';
1827
-					if ($mode === 'div') {
1828
-						$trad = rtrim($trad) . "\n\n";
1829
-					}
1830
-					$trad = code_echappement($trad, 'multi', false, $mode);
1831
-					$trad = str_replace("'", '"', inserer_attribut($trad, 'lang', $l));
1832
-					if (lang_dir($l) !== lang_dir($lang)) {
1833
-						$trad = str_replace("'", '"', inserer_attribut($trad, 'dir', lang_dir($l)));
1834
-					}
1835
-					if (!$options['echappe_span']) {
1836
-						$trad = echappe_retour($trad, 'multi');
1837
-					}
1838
-				}
1839
-			}
1840
-			$letexte = str_replace($reg[0], $trad, $letexte);
1841
-		}
1842
-	}
1843
-
1844
-	return $letexte;
1783
+    if (
1784
+        $letexte
1785
+        and preg_match_all(_EXTRAIRE_MULTI, $letexte, $regs, PREG_SET_ORDER)
1786
+    ) {
1787
+        if (!$lang) {
1788
+            $lang = $GLOBALS['spip_lang'];
1789
+        }
1790
+
1791
+        // Compatibilité avec le prototype de fonction précédente qui utilisait un boolean
1792
+        if (is_bool($options)) {
1793
+            $options = ['echappe_span' => $options, 'lang_defaut' => _LANGUE_PAR_DEFAUT];
1794
+        }
1795
+        if (!isset($options['echappe_span'])) {
1796
+            $options = array_merge($options, ['echappe_span' => false]);
1797
+        }
1798
+        if (!isset($options['lang_defaut'])) {
1799
+            $options = array_merge($options, ['lang_defaut' => _LANGUE_PAR_DEFAUT]);
1800
+        }
1801
+
1802
+        include_spip('inc/lang');
1803
+        foreach ($regs as $reg) {
1804
+            // chercher la version de la langue courante
1805
+            $trads = extraire_trads($reg[1]);
1806
+            if ($l = approcher_langue($trads, $lang)) {
1807
+                $trad = $trads[$l];
1808
+            } else {
1809
+                if ($options['lang_defaut'] == 'aucune') {
1810
+                    $trad = '';
1811
+                } else {
1812
+                    // langue absente, prendre le fr ou une langue précisée (meme comportement que inc/traduire.php)
1813
+                    // ou la premiere dispo
1814
+                    // mais typographier le texte selon les regles de celle-ci
1815
+                    // Attention aux blocs multi sur plusieurs lignes
1816
+                    if (!$l = approcher_langue($trads, $options['lang_defaut'])) {
1817
+                        $l = key($trads);
1818
+                    }
1819
+                    $trad = $trads[$l];
1820
+                    $typographie = charger_fonction(lang_typo($l), 'typographie');
1821
+                    $trad = $typographie($trad);
1822
+                    // Tester si on echappe en span ou en div
1823
+                    // il ne faut pas echapper en div si propre produit un seul paragraphe
1824
+                    include_spip('inc/texte');
1825
+                    $trad_propre = preg_replace(',(^<p[^>]*>|</p>$),Uims', '', propre($trad));
1826
+                    $mode = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $trad_propre) ? 'div' : 'span';
1827
+                    if ($mode === 'div') {
1828
+                        $trad = rtrim($trad) . "\n\n";
1829
+                    }
1830
+                    $trad = code_echappement($trad, 'multi', false, $mode);
1831
+                    $trad = str_replace("'", '"', inserer_attribut($trad, 'lang', $l));
1832
+                    if (lang_dir($l) !== lang_dir($lang)) {
1833
+                        $trad = str_replace("'", '"', inserer_attribut($trad, 'dir', lang_dir($l)));
1834
+                    }
1835
+                    if (!$options['echappe_span']) {
1836
+                        $trad = echappe_retour($trad, 'multi');
1837
+                    }
1838
+                }
1839
+            }
1840
+            $letexte = str_replace($reg[0], $trad, $letexte);
1841
+        }
1842
+    }
1843
+
1844
+    return $letexte;
1845 1845
 }
1846 1846
 
1847 1847
 /**
@@ -1857,21 +1857,21 @@  discard block
 block discarded – undo
1857 1857
  *     Peut retourner un code de langue vide, lorsqu'un texte par défaut est indiqué.
1858 1858
  **/
1859 1859
 function extraire_trads($bloc) {
1860
-	$trads = [];
1861
-	$lang = '';
1860
+    $trads = [];
1861
+    $lang = '';
1862 1862
 // ce reg fait planter l'analyse multi s'il y a de l'{italique} dans le champ
1863 1863
 //	while (preg_match("/^(.*?)[{\[]([a-z_]+)[}\]]/siS", $bloc, $regs)) {
1864
-	while (preg_match('/^(.*?)[\[]([a-z_]+)[\]]/siS', $bloc, $regs)) {
1865
-		$texte = trim($regs[1]);
1866
-		if ($texte or $lang) {
1867
-			$trads[$lang] = $texte;
1868
-		}
1869
-		$bloc = substr($bloc, strlen($regs[0]));
1870
-		$lang = $regs[2];
1871
-	}
1872
-	$trads[$lang] = $bloc;
1864
+    while (preg_match('/^(.*?)[\[]([a-z_]+)[\]]/siS', $bloc, $regs)) {
1865
+        $texte = trim($regs[1]);
1866
+        if ($texte or $lang) {
1867
+            $trads[$lang] = $texte;
1868
+        }
1869
+        $bloc = substr($bloc, strlen($regs[0]));
1870
+        $lang = $regs[2];
1871
+    }
1872
+    $trads[$lang] = $bloc;
1873 1873
 
1874
-	return $trads;
1874
+    return $trads;
1875 1875
 }
1876 1876
 
1877 1877
 
@@ -1882,7 +1882,7 @@  discard block
 block discarded – undo
1882 1882
  * @return string L'initiale en majuscule
1883 1883
  */
1884 1884
 function filtre_initiale($nom) {
1885
-	return spip_substr(trim(strtoupper(extraire_multi($nom))), 0, 1);
1885
+    return spip_substr(trim(strtoupper(extraire_multi($nom))), 0, 1);
1886 1886
 }
1887 1887
 
1888 1888
 
@@ -1927,33 +1927,33 @@  discard block
 block discarded – undo
1927 1927
  *      - null (interne) : si on empile
1928 1928
  **/
1929 1929
 function unique($donnee, $famille = '', $cpt = false) {
1930
-	static $mem = [];
1931
-	// permettre de vider la pile et de la restaurer
1932
-	// pour le calcul de introduction...
1933
-	if ($famille == '_spip_raz_') {
1934
-		$tmp = $mem;
1935
-		$mem = [];
1936
-
1937
-		return $tmp;
1938
-	} elseif ($famille == '_spip_set_') {
1939
-		$mem = $donnee;
1940
-
1941
-		return;
1942
-	}
1943
-	// eviter une notice
1944
-	if (!isset($mem[$famille])) {
1945
-		$mem[$famille] = [];
1946
-	}
1947
-	if ($cpt) {
1948
-		return is_countable($mem[$famille]) ? count($mem[$famille]) : 0;
1949
-	}
1950
-	// eviter une notice
1951
-	if (!isset($mem[$famille][$donnee])) {
1952
-		$mem[$famille][$donnee] = 0;
1953
-	}
1954
-	if (!($mem[$famille][$donnee]++)) {
1955
-		return $donnee;
1956
-	}
1930
+    static $mem = [];
1931
+    // permettre de vider la pile et de la restaurer
1932
+    // pour le calcul de introduction...
1933
+    if ($famille == '_spip_raz_') {
1934
+        $tmp = $mem;
1935
+        $mem = [];
1936
+
1937
+        return $tmp;
1938
+    } elseif ($famille == '_spip_set_') {
1939
+        $mem = $donnee;
1940
+
1941
+        return;
1942
+    }
1943
+    // eviter une notice
1944
+    if (!isset($mem[$famille])) {
1945
+        $mem[$famille] = [];
1946
+    }
1947
+    if ($cpt) {
1948
+        return is_countable($mem[$famille]) ? count($mem[$famille]) : 0;
1949
+    }
1950
+    // eviter une notice
1951
+    if (!isset($mem[$famille][$donnee])) {
1952
+        $mem[$famille][$donnee] = 0;
1953
+    }
1954
+    if (!($mem[$famille][$donnee]++)) {
1955
+        return $donnee;
1956
+    }
1957 1957
 }
1958 1958
 
1959 1959
 
@@ -1983,20 +1983,20 @@  discard block
 block discarded – undo
1983 1983
  *     Une des valeurs en fonction du compteur.
1984 1984
  **/
1985 1985
 function alterner($i, ...$args) {
1986
-	// recuperer les arguments (attention fonctions un peu space)
1987
-	$num = count($args);
1986
+    // recuperer les arguments (attention fonctions un peu space)
1987
+    $num = count($args);
1988 1988
 
1989
-	if ($num === 1 && is_array($args[0])) {
1990
-		// un tableau de valeur dont les cles sont numerotees de 0 a num
1991
-		$args = array_values($args[0]);
1992
-		$num = count($args);
1993
-	}
1989
+    if ($num === 1 && is_array($args[0])) {
1990
+        // un tableau de valeur dont les cles sont numerotees de 0 a num
1991
+        $args = array_values($args[0]);
1992
+        $num = count($args);
1993
+    }
1994 1994
 
1995
-	// un index compris entre 0 et num exclus
1996
-	$i = ((intval($i) - 1) % $num); // dans ]-$num;$num[
1997
-	$i = ($i + $num) % $num; // dans [0;$num[
1998
-	// renvoyer le i-ieme argument, modulo le nombre d'arguments
1999
-	return $args[$i];
1995
+    // un index compris entre 0 et num exclus
1996
+    $i = ((intval($i) - 1) % $num); // dans ]-$num;$num[
1997
+    $i = ($i + $num) % $num; // dans [0;$num[
1998
+    // renvoyer le i-ieme argument, modulo le nombre d'arguments
1999
+    return $args[$i];
2000 2000
 }
2001 2001
 
2002 2002
 
@@ -2022,51 +2022,51 @@  discard block
 block discarded – undo
2022 2022
  *     - null lorsque l’attribut n’existe pas.
2023 2023
  **/
2024 2024
 function extraire_attribut($balise, $attribut, $complet = false) {
2025
-	if (is_array($balise)) {
2026
-		array_walk(
2027
-			$balise,
2028
-			function (&$a, $key, $t) {
2029
-				$a = extraire_attribut($a, $t);
2030
-			},
2031
-			$attribut
2032
-		);
2033
-
2034
-		return $balise;
2035
-	}
2036
-	if (
2037
-		$balise
2038
-		&& preg_match(
2039
-			',(^.*?<(?:(?>\s*)(?>[\w:.-]+)(?>(?:=(?:"[^"]*"|\'[^\']*\'|[^\'"]\S*))?))*?)(\s+'
2040
-			. $attribut
2041
-			. '(?:=\s*("[^"]*"|\'[^\']*\'|[^\'"]\S*))?)()((?:[\s/][^>]*)?>.*),isS',
2042
-			$balise,
2043
-			$r
2044
-		)
2045
-	) {
2046
-		if (isset($r[3][0]) and ($r[3][0] == '"' || $r[3][0] == "'")) {
2047
-			$r[4] = substr($r[3], 1, -1);
2048
-			$r[3] = $r[3][0];
2049
-		} elseif ($r[3] !== '') {
2050
-			$r[4] = $r[3];
2051
-			$r[3] = '';
2052
-		} else {
2053
-			$r[4] = trim($r[2]);
2054
-		}
2055
-		$att = $r[4];
2056
-		if (strpos($att, '&#') !== false) {
2057
-			$att = str_replace(['&#039;', '&#39;', '&#034;', '&#34;'], ["'", "'", '"', '"'], $att);
2058
-		}
2059
-		$att = filtrer_entites($att);
2060
-	} else {
2061
-		$att = null;
2062
-		$r = [];
2063
-	}
2064
-
2065
-	if ($complet) {
2066
-		return [$att, $r];
2067
-	} else {
2068
-		return $att;
2069
-	}
2025
+    if (is_array($balise)) {
2026
+        array_walk(
2027
+            $balise,
2028
+            function (&$a, $key, $t) {
2029
+                $a = extraire_attribut($a, $t);
2030
+            },
2031
+            $attribut
2032
+        );
2033
+
2034
+        return $balise;
2035
+    }
2036
+    if (
2037
+        $balise
2038
+        && preg_match(
2039
+            ',(^.*?<(?:(?>\s*)(?>[\w:.-]+)(?>(?:=(?:"[^"]*"|\'[^\']*\'|[^\'"]\S*))?))*?)(\s+'
2040
+            . $attribut
2041
+            . '(?:=\s*("[^"]*"|\'[^\']*\'|[^\'"]\S*))?)()((?:[\s/][^>]*)?>.*),isS',
2042
+            $balise,
2043
+            $r
2044
+        )
2045
+    ) {
2046
+        if (isset($r[3][0]) and ($r[3][0] == '"' || $r[3][0] == "'")) {
2047
+            $r[4] = substr($r[3], 1, -1);
2048
+            $r[3] = $r[3][0];
2049
+        } elseif ($r[3] !== '') {
2050
+            $r[4] = $r[3];
2051
+            $r[3] = '';
2052
+        } else {
2053
+            $r[4] = trim($r[2]);
2054
+        }
2055
+        $att = $r[4];
2056
+        if (strpos($att, '&#') !== false) {
2057
+            $att = str_replace(['&#039;', '&#39;', '&#034;', '&#34;'], ["'", "'", '"', '"'], $att);
2058
+        }
2059
+        $att = filtrer_entites($att);
2060
+    } else {
2061
+        $att = null;
2062
+        $r = [];
2063
+    }
2064
+
2065
+    if ($complet) {
2066
+        return [$att, $r];
2067
+    } else {
2068
+        return $att;
2069
+    }
2070 2070
 }
2071 2071
 
2072 2072
 /**
@@ -2099,41 +2099,41 @@  discard block
 block discarded – undo
2099 2099
  **/
2100 2100
 function inserer_attribut(?string $balise, string $attribut, string $val, bool $proteger = true, bool $vider = false): string {
2101 2101
 
2102
-	if ($balise === null or $balise === '') {
2103
-		return '';
2104
-	}
2102
+    if ($balise === null or $balise === '') {
2103
+        return '';
2104
+    }
2105 2105
 
2106
-	// preparer l'attribut
2107
-	// supprimer les &nbsp; etc mais pas les balises html
2108
-	// qui ont un sens dans un attribut value d'un input
2109
-	if ($proteger) {
2110
-		$val = attribut_html($val, false);
2111
-	}
2106
+    // preparer l'attribut
2107
+    // supprimer les &nbsp; etc mais pas les balises html
2108
+    // qui ont un sens dans un attribut value d'un input
2109
+    if ($proteger) {
2110
+        $val = attribut_html($val, false);
2111
+    }
2112 2112
 
2113
-	// echapper les ' pour eviter tout bug
2114
-	$val = str_replace("'", '&#039;', $val);
2115
-	if ($vider and strlen($val) === 0) {
2116
-		$insert = '';
2117
-	} else {
2118
-		$insert = " $attribut='$val'";
2119
-	}
2113
+    // echapper les ' pour eviter tout bug
2114
+    $val = str_replace("'", '&#039;', $val);
2115
+    if ($vider and strlen($val) === 0) {
2116
+        $insert = '';
2117
+    } else {
2118
+        $insert = " $attribut='$val'";
2119
+    }
2120 2120
 
2121
-	[$old, $r] = extraire_attribut($balise, $attribut, true);
2121
+    [$old, $r] = extraire_attribut($balise, $attribut, true);
2122 2122
 
2123
-	if ($old !== null) {
2124
-		// Remplacer l'ancien attribut du meme nom
2125
-		$balise = $r[1] . $insert . $r[5];
2126
-	} else {
2127
-		// preferer une balise " />" (comme <img />)
2128
-		if (preg_match(',/>,', $balise)) {
2129
-			$balise = preg_replace(',\s?/>,S', $insert . ' />', $balise, 1);
2130
-		} // sinon une balise <a ...> ... </a>
2131
-		else {
2132
-			$balise = preg_replace(',\s?>,S', $insert . '>', $balise, 1);
2133
-		}
2134
-	}
2123
+    if ($old !== null) {
2124
+        // Remplacer l'ancien attribut du meme nom
2125
+        $balise = $r[1] . $insert . $r[5];
2126
+    } else {
2127
+        // preferer une balise " />" (comme <img />)
2128
+        if (preg_match(',/>,', $balise)) {
2129
+            $balise = preg_replace(',\s?/>,S', $insert . ' />', $balise, 1);
2130
+        } // sinon une balise <a ...> ... </a>
2131
+        else {
2132
+            $balise = preg_replace(',\s?>,S', $insert . '>', $balise, 1);
2133
+        }
2134
+    }
2135 2135
 
2136
-	return $balise;
2136
+    return $balise;
2137 2137
 }
2138 2138
 
2139 2139
 /**
@@ -2151,7 +2151,7 @@  discard block
 block discarded – undo
2151 2151
  * @return string Code HTML sans l'attribut
2152 2152
  **/
2153 2153
 function vider_attribut(?string $balise, string $attribut): string {
2154
-	return inserer_attribut($balise, $attribut, '', false, true);
2154
+    return inserer_attribut($balise, $attribut, '', false, true);
2155 2155
 }
2156 2156
 
2157 2157
 /**
@@ -2163,53 +2163,53 @@  discard block
 block discarded – undo
2163 2163
  * @return string
2164 2164
  */
2165 2165
 function modifier_class($balise, $class, $operation = 'ajouter') {
2166
-	if (is_string($class)) {
2167
-		$class = explode(' ', trim($class));
2168
-	}
2169
-	$class = array_filter($class);
2170
-	$class = array_unique($class);
2171
-	if (!$class) {
2172
-		return $balise;
2173
-	}
2174
-
2175
-	// si la ou les classes ont des caracteres invalides on ne fait rien
2176
-	if (preg_match(',[^\w-],', implode('', $class))) {
2177
-		return $balise;
2178
-	}
2179
-
2180
-	$class_courante = extraire_attribut($balise, 'class');
2181
-	$class_new = $class_courante;
2182
-	foreach ($class as $c) {
2183
-		$is_class_presente = false;
2184
-		if (
2185
-			$class_courante
2186
-			and strpos($class_courante, (string) $c) !== false
2187
-			and preg_match('/(^|\s)' . preg_quote($c) . '($|\s)/', $class_courante)
2188
-		) {
2189
-			$is_class_presente = true;
2190
-		}
2191
-		if (
2192
-			in_array($operation, ['ajouter', 'commuter'])
2193
-			and !$is_class_presente
2194
-		) {
2195
-			$class_new = ltrim(rtrim($class_new ?? '') . ' ' . $c);
2196
-		} elseif (
2197
-			in_array($operation, ['supprimer', 'commuter'])
2198
-			and $is_class_presente
2199
-		) {
2200
-			$class_new = trim(preg_replace('/(^|\s)' . preg_quote($c) . '($|\s)/', "\\1", $class_new));
2201
-		}
2202
-	}
2203
-
2204
-	if ($class_new !== $class_courante) {
2205
-		if (strlen($class_new)) {
2206
-			$balise = inserer_attribut($balise, 'class', $class_new);
2207
-		} elseif ($class_courante) {
2208
-			$balise = vider_attribut($balise, 'class');
2209
-		}
2210
-	}
2211
-
2212
-	return $balise;
2166
+    if (is_string($class)) {
2167
+        $class = explode(' ', trim($class));
2168
+    }
2169
+    $class = array_filter($class);
2170
+    $class = array_unique($class);
2171
+    if (!$class) {
2172
+        return $balise;
2173
+    }
2174
+
2175
+    // si la ou les classes ont des caracteres invalides on ne fait rien
2176
+    if (preg_match(',[^\w-],', implode('', $class))) {
2177
+        return $balise;
2178
+    }
2179
+
2180
+    $class_courante = extraire_attribut($balise, 'class');
2181
+    $class_new = $class_courante;
2182
+    foreach ($class as $c) {
2183
+        $is_class_presente = false;
2184
+        if (
2185
+            $class_courante
2186
+            and strpos($class_courante, (string) $c) !== false
2187
+            and preg_match('/(^|\s)' . preg_quote($c) . '($|\s)/', $class_courante)
2188
+        ) {
2189
+            $is_class_presente = true;
2190
+        }
2191
+        if (
2192
+            in_array($operation, ['ajouter', 'commuter'])
2193
+            and !$is_class_presente
2194
+        ) {
2195
+            $class_new = ltrim(rtrim($class_new ?? '') . ' ' . $c);
2196
+        } elseif (
2197
+            in_array($operation, ['supprimer', 'commuter'])
2198
+            and $is_class_presente
2199
+        ) {
2200
+            $class_new = trim(preg_replace('/(^|\s)' . preg_quote($c) . '($|\s)/', "\\1", $class_new));
2201
+        }
2202
+    }
2203
+
2204
+    if ($class_new !== $class_courante) {
2205
+        if (strlen($class_new)) {
2206
+            $balise = inserer_attribut($balise, 'class', $class_new);
2207
+        } elseif ($class_courante) {
2208
+            $balise = vider_attribut($balise, 'class');
2209
+        }
2210
+    }
2211
+
2212
+    return $balise;
2213 2213
 }
2214 2214
 
2215 2215
 /**
@@ -2219,7 +2219,7 @@  discard block
 block discarded – undo
2219 2219
  * @return string
2220 2220
  */
2221 2221
 function ajouter_class($balise, $class) {
2222
-	return modifier_class($balise, $class, 'ajouter');
2222
+    return modifier_class($balise, $class, 'ajouter');
2223 2223
 }
2224 2224
 
2225 2225
 /**
@@ -2229,7 +2229,7 @@  discard block
 block discarded – undo
2229 2229
  * @return string
2230 2230
  */
2231 2231
 function supprimer_class($balise, $class) {
2232
-	return modifier_class($balise, $class, 'supprimer');
2232
+    return modifier_class($balise, $class, 'supprimer');
2233 2233
 }
2234 2234
 
2235 2235
 /**
@@ -2240,7 +2240,7 @@  discard block
 block discarded – undo
2240 2240
  * @return string
2241 2241
  */
2242 2242
 function commuter_class($balise, $class) {
2243
-	return modifier_class($balise, $class, 'commuter');
2243
+    return modifier_class($balise, $class, 'commuter');
2244 2244
 }
2245 2245
 
2246 2246
 /**
@@ -2251,19 +2251,19 @@  discard block
 block discarded – undo
2251 2251
  * @return string
2252 2252
  */
2253 2253
 function tester_config($id, $mode = '') {
2254
-	include_spip('action/inscrire_auteur');
2254
+    include_spip('action/inscrire_auteur');
2255 2255
 
2256
-	return tester_statut_inscription($mode, $id);
2256
+    return tester_statut_inscription($mode, $id);
2257 2257
 }
2258 2258
 
2259 2259
 //
2260 2260
 // Quelques fonctions de calcul arithmetique
2261 2261
 //
2262 2262
 function floatstr($a) {
2263
- return str_replace(',', '.', (string)floatval($a));
2263
+    return str_replace(',', '.', (string)floatval($a));
2264 2264
 }
2265 2265
 function strize($f, $a, $b) {
2266
- return floatstr($f(floatstr($a), floatstr($b)));
2266
+    return floatstr($f(floatstr($a), floatstr($b)));
2267 2267
 }
2268 2268
 
2269 2269
 /**
@@ -2282,7 +2282,7 @@  discard block
 block discarded – undo
2282 2282
  * @return int $a+$b
2283 2283
  **/
2284 2284
 function plus($a, $b) {
2285
-	return $a + $b;
2285
+    return $a + $b;
2286 2286
 }
2287 2287
 function strplus($a, $b) {
2288 2288
 return strize('plus', $a, $b);
@@ -2303,7 +2303,7 @@  discard block
 block discarded – undo
2303 2303
  * @return int $a-$b
2304 2304
  **/
2305 2305
 function moins($a, $b) {
2306
-	return $a - $b;
2306
+    return $a - $b;
2307 2307
 }
2308 2308
 function strmoins($a, $b) {
2309 2309
 return strize('moins', $a, $b);
@@ -2326,7 +2326,7 @@  discard block
 block discarded – undo
2326 2326
  * @return int $a*$b
2327 2327
  **/
2328 2328
 function mult($a, $b) {
2329
-	return $a * $b;
2329
+    return $a * $b;
2330 2330
 }
2331 2331
 function strmult($a, $b) {
2332 2332
 return strize('mult', $a, $b);
@@ -2349,7 +2349,7 @@  discard block
 block discarded – undo
2349 2349
  * @return int $a/$b (ou 0 si $b est nul)
2350 2350
  **/
2351 2351
 function div($a, $b) {
2352
-	return $b ? $a / $b : 0;
2352
+    return $b ? $a / $b : 0;
2353 2353
 }
2354 2354
 function strdiv($a, $b) {
2355 2355
 return strize('div', $a, $b);
@@ -2373,7 +2373,7 @@  discard block
 block discarded – undo
2373 2373
  * @return int ($nb % $mod) + $add
2374 2374
  **/
2375 2375
 function modulo($nb, $mod, $add = 0) {
2376
-	return ($mod ? $nb % $mod : 0) + $add;
2376
+    return ($mod ? $nb % $mod : 0) + $add;
2377 2377
 }
2378 2378
 
2379 2379
 
@@ -2388,26 +2388,26 @@  discard block
 block discarded – undo
2388 2388
  *      - true sinon
2389 2389
  **/
2390 2390
 function nom_acceptable($nom) {
2391
-	$remp2 = [];
2392
-	$remp1 = [];
2393
-	if (!is_string($nom)) {
2394
-		return false;
2395
-	}
2396
-	if (!defined('_TAGS_NOM_AUTEUR')) {
2397
-		define('_TAGS_NOM_AUTEUR', '');
2398
-	}
2399
-	$tags_acceptes = array_unique(explode(',', 'multi,' . _TAGS_NOM_AUTEUR));
2400
-	foreach ($tags_acceptes as $tag) {
2401
-		if (strlen($tag)) {
2402
-			$remp1[] = '<' . trim($tag) . '>';
2403
-			$remp1[] = '</' . trim($tag) . '>';
2404
-			$remp2[] = '\x60' . trim($tag) . '\x61';
2405
-			$remp2[] = '\x60/' . trim($tag) . '\x61';
2406
-		}
2407
-	}
2408
-	$v_nom = str_replace($remp2, $remp1, supprimer_tags(str_replace($remp1, $remp2, $nom)));
2409
-
2410
-	return str_replace('&lt;', '<', $v_nom) == $nom;
2391
+    $remp2 = [];
2392
+    $remp1 = [];
2393
+    if (!is_string($nom)) {
2394
+        return false;
2395
+    }
2396
+    if (!defined('_TAGS_NOM_AUTEUR')) {
2397
+        define('_TAGS_NOM_AUTEUR', '');
2398
+    }
2399
+    $tags_acceptes = array_unique(explode(',', 'multi,' . _TAGS_NOM_AUTEUR));
2400
+    foreach ($tags_acceptes as $tag) {
2401
+        if (strlen($tag)) {
2402
+            $remp1[] = '<' . trim($tag) . '>';
2403
+            $remp1[] = '</' . trim($tag) . '>';
2404
+            $remp2[] = '\x60' . trim($tag) . '\x61';
2405
+            $remp2[] = '\x60/' . trim($tag) . '\x61';
2406
+        }
2407
+    }
2408
+    $v_nom = str_replace($remp2, $remp1, supprimer_tags(str_replace($remp1, $remp2, $nom)));
2409
+
2410
+    return str_replace('&lt;', '<', $v_nom) == $nom;
2411 2411
 }
2412 2412
 
2413 2413
 
@@ -2423,14 +2423,14 @@  discard block
 block discarded – undo
2423 2423
  *      - renvoie un tableau si l'entree est un tableau
2424 2424
  **/
2425 2425
 function email_valide($adresses) {
2426
-	if (is_array($adresses)) {
2427
-		$adresses = array_map('email_valide', $adresses);
2428
-		$adresses = array_filter($adresses);
2429
-		return $adresses;
2430
-	}
2426
+    if (is_array($adresses)) {
2427
+        $adresses = array_map('email_valide', $adresses);
2428
+        $adresses = array_filter($adresses);
2429
+        return $adresses;
2430
+    }
2431 2431
 
2432
-	$email_valide = charger_fonction('email_valide', 'inc');
2433
-	return $email_valide($adresses);
2432
+    $email_valide = charger_fonction('email_valide', 'inc');
2433
+    return $email_valide($adresses);
2434 2434
 }
2435 2435
 
2436 2436
 /**
@@ -2444,29 +2444,29 @@  discard block
 block discarded – undo
2444 2444
  * @return string Texte
2445 2445
  **/
2446 2446
 function afficher_enclosures($tags) {
2447
-	$s = [];
2448
-	foreach (extraire_balises($tags, 'a') as $tag) {
2449
-		if (
2450
-			extraire_attribut($tag, 'rel') == 'enclosure'
2451
-			and $t = extraire_attribut($tag, 'href')
2452
-		) {
2453
-			$s[] = preg_replace(
2454
-				',>[^<]+</a>,S',
2455
-				'>'
2456
-				. http_img_pack(
2457
-					'attachment-16.png',
2458
-					$t,
2459
-					'',
2460
-					$t,
2461
-					['utiliser_suffixe_size' => true]
2462
-				)
2463
-				. '</a>',
2464
-				$tag
2465
-			);
2466
-		}
2467
-	}
2468
-
2469
-	return join('&nbsp;', $s);
2447
+    $s = [];
2448
+    foreach (extraire_balises($tags, 'a') as $tag) {
2449
+        if (
2450
+            extraire_attribut($tag, 'rel') == 'enclosure'
2451
+            and $t = extraire_attribut($tag, 'href')
2452
+        ) {
2453
+            $s[] = preg_replace(
2454
+                ',>[^<]+</a>,S',
2455
+                '>'
2456
+                . http_img_pack(
2457
+                    'attachment-16.png',
2458
+                    $t,
2459
+                    '',
2460
+                    $t,
2461
+                    ['utiliser_suffixe_size' => true]
2462
+                )
2463
+                . '</a>',
2464
+                $tag
2465
+            );
2466
+        }
2467
+    }
2468
+
2469
+    return join('&nbsp;', $s);
2470 2470
 }
2471 2471
 
2472 2472
 /**
@@ -2481,15 +2481,15 @@  discard block
 block discarded – undo
2481 2481
  * @return string Liens trouvés
2482 2482
  **/
2483 2483
 function afficher_tags($tags, $rels = 'tag,directory') {
2484
-	$s = [];
2485
-	foreach (extraire_balises($tags, 'a') as $tag) {
2486
-		$rel = extraire_attribut($tag, 'rel');
2487
-		if (strstr(",$rels,", (string) ",$rel,")) {
2488
-			$s[] = $tag;
2489
-		}
2490
-	}
2484
+    $s = [];
2485
+    foreach (extraire_balises($tags, 'a') as $tag) {
2486
+        $rel = extraire_attribut($tag, 'rel');
2487
+        if (strstr(",$rels,", (string) ",$rel,")) {
2488
+            $s[] = $tag;
2489
+        }
2490
+    }
2491 2491
 
2492
-	return join(', ', $s);
2492
+    return join(', ', $s);
2493 2493
 }
2494 2494
 
2495 2495
 
@@ -2511,21 +2511,21 @@  discard block
 block discarded – undo
2511 2511
  * @return string Tag HTML `<a>` avec microformat.
2512 2512
  **/
2513 2513
 function enclosure2microformat($e) {
2514
-	if (!$url = filtrer_entites(extraire_attribut($e, 'url'))) {
2515
-		$url = filtrer_entites(extraire_attribut($e, 'href'));
2516
-	}
2517
-	$type = extraire_attribut($e, 'type');
2518
-	if (!$length = extraire_attribut($e, 'length')) {
2519
-		# <media:content : longeur dans fileSize. On tente.
2520
-		$length = extraire_attribut($e, 'fileSize');
2521
-	}
2522
-	$fichier = basename($url);
2514
+    if (!$url = filtrer_entites(extraire_attribut($e, 'url'))) {
2515
+        $url = filtrer_entites(extraire_attribut($e, 'href'));
2516
+    }
2517
+    $type = extraire_attribut($e, 'type');
2518
+    if (!$length = extraire_attribut($e, 'length')) {
2519
+        # <media:content : longeur dans fileSize. On tente.
2520
+        $length = extraire_attribut($e, 'fileSize');
2521
+    }
2522
+    $fichier = basename($url);
2523 2523
 
2524
-	return '<a rel="enclosure"'
2525
-	. ($url ? ' href="' . spip_htmlspecialchars($url) . '"' : '')
2526
-	. ($type ? ' type="' . spip_htmlspecialchars($type) . '"' : '')
2527
-	. ($length ? ' title="' . spip_htmlspecialchars($length) . '"' : '')
2528
-	. '>' . $fichier . '</a>';
2524
+    return '<a rel="enclosure"'
2525
+    . ($url ? ' href="' . spip_htmlspecialchars($url) . '"' : '')
2526
+    . ($type ? ' type="' . spip_htmlspecialchars($type) . '"' : '')
2527
+    . ($length ? ' title="' . spip_htmlspecialchars($length) . '"' : '')
2528
+    . '>' . $fichier . '</a>';
2529 2529
 }
2530 2530
 
2531 2531
 /**
@@ -2543,24 +2543,24 @@  discard block
 block discarded – undo
2543 2543
  * @return string Tags RSS `<enclosure>`.
2544 2544
  **/
2545 2545
 function microformat2enclosure($tags) {
2546
-	$enclosures = [];
2547
-	foreach (extraire_balises($tags, 'a') as $e) {
2548
-		if (extraire_attribut($e, 'rel') == 'enclosure') {
2549
-			$url = filtrer_entites(extraire_attribut($e, 'href'));
2550
-			$type = extraire_attribut($e, 'type');
2551
-			if (!$length = intval(extraire_attribut($e, 'title'))) {
2552
-				$length = intval(extraire_attribut($e, 'length'));
2553
-			} # vieux data
2554
-			$fichier = basename($url);
2555
-			$enclosures[] = '<enclosure'
2556
-				. ($url ? ' url="' . spip_htmlspecialchars($url) . '"' : '')
2557
-				. ($type ? ' type="' . spip_htmlspecialchars($type) . '"' : '')
2558
-				. ($length ? ' length="' . $length . '"' : '')
2559
-				. ' />';
2560
-		}
2561
-	}
2546
+    $enclosures = [];
2547
+    foreach (extraire_balises($tags, 'a') as $e) {
2548
+        if (extraire_attribut($e, 'rel') == 'enclosure') {
2549
+            $url = filtrer_entites(extraire_attribut($e, 'href'));
2550
+            $type = extraire_attribut($e, 'type');
2551
+            if (!$length = intval(extraire_attribut($e, 'title'))) {
2552
+                $length = intval(extraire_attribut($e, 'length'));
2553
+            } # vieux data
2554
+            $fichier = basename($url);
2555
+            $enclosures[] = '<enclosure'
2556
+                . ($url ? ' url="' . spip_htmlspecialchars($url) . '"' : '')
2557
+                . ($type ? ' type="' . spip_htmlspecialchars($type) . '"' : '')
2558
+                . ($length ? ' length="' . $length . '"' : '')
2559
+                . ' />';
2560
+        }
2561
+    }
2562 2562
 
2563
-	return join("\n", $enclosures);
2563
+    return join("\n", $enclosures);
2564 2564
 }
2565 2565
 
2566 2566
 
@@ -2576,16 +2576,16 @@  discard block
 block discarded – undo
2576 2576
  * @return string Tags RSS Atom `<dc:subject>`.
2577 2577
  **/
2578 2578
 function tags2dcsubject($tags) {
2579
-	$subjects = '';
2580
-	foreach (extraire_balises($tags, 'a') as $e) {
2581
-		if (extraire_attribut($e, 'rel') == 'tag') {
2582
-			$subjects .= '<dc:subject>'
2583
-				. texte_backend(textebrut($e))
2584
-				. '</dc:subject>' . "\n";
2585
-		}
2586
-	}
2579
+    $subjects = '';
2580
+    foreach (extraire_balises($tags, 'a') as $e) {
2581
+        if (extraire_attribut($e, 'rel') == 'tag') {
2582
+            $subjects .= '<dc:subject>'
2583
+                . texte_backend(textebrut($e))
2584
+                . '</dc:subject>' . "\n";
2585
+        }
2586
+    }
2587 2587
 
2588
-	return $subjects;
2588
+    return $subjects;
2589 2589
 }
2590 2590
 
2591 2591
 /**
@@ -2614,27 +2614,27 @@  discard block
 block discarded – undo
2614 2614
  *     - Tableau de résultats, si tableau en entrée.
2615 2615
  **/
2616 2616
 function extraire_balise($texte, $tag = 'a') {
2617
-	if (is_array($texte)) {
2618
-		array_walk(
2619
-			$texte,
2620
-			function (&$a, $key, $t) {
2621
-				$a = extraire_balise($a, $t);
2622
-			},
2623
-			$tag
2624
-		);
2625
-
2626
-		return $texte;
2627
-	}
2628
-
2629
-	if (
2630
-		preg_match(
2631
-			",<$tag\b[^>]*(/>|>.*</$tag\b[^>]*>|>),UimsS",
2632
-			$texte,
2633
-			$regs
2634
-		)
2635
-	) {
2636
-		return $regs[0];
2637
-	}
2617
+    if (is_array($texte)) {
2618
+        array_walk(
2619
+            $texte,
2620
+            function (&$a, $key, $t) {
2621
+                $a = extraire_balise($a, $t);
2622
+            },
2623
+            $tag
2624
+        );
2625
+
2626
+        return $texte;
2627
+    }
2628
+
2629
+    if (
2630
+        preg_match(
2631
+            ",<$tag\b[^>]*(/>|>.*</$tag\b[^>]*>|>),UimsS",
2632
+            $texte,
2633
+            $regs
2634
+        )
2635
+    ) {
2636
+        return $regs[0];
2637
+    }
2638 2638
 }
2639 2639
 
2640 2640
 /**
@@ -2662,30 +2662,30 @@  discard block
 block discarded – undo
2662 2662
  *     - Tableau de résultats, si tableau en entrée.
2663 2663
  **/
2664 2664
 function extraire_balises($texte, $tag = 'a') {
2665
-	if (is_array($texte)) {
2666
-		array_walk(
2667
-			$texte,
2668
-			function (&$a, $key, $t) {
2669
-				$a = extraire_balises($a, $t);
2670
-			},
2671
-			$tag
2672
-		);
2673
-
2674
-		return $texte;
2675
-	}
2676
-
2677
-	if (
2678
-		preg_match_all(
2679
-			",<{$tag}\b[^>]*(/>|>.*</{$tag}\b[^>]*>|>),UimsS",
2680
-			$texte,
2681
-			$regs,
2682
-			PREG_PATTERN_ORDER
2683
-		)
2684
-	) {
2685
-		return $regs[0];
2686
-	} else {
2687
-		return [];
2688
-	}
2665
+    if (is_array($texte)) {
2666
+        array_walk(
2667
+            $texte,
2668
+            function (&$a, $key, $t) {
2669
+                $a = extraire_balises($a, $t);
2670
+            },
2671
+            $tag
2672
+        );
2673
+
2674
+        return $texte;
2675
+    }
2676
+
2677
+    if (
2678
+        preg_match_all(
2679
+            ",<{$tag}\b[^>]*(/>|>.*</{$tag}\b[^>]*>|>),UimsS",
2680
+            $texte,
2681
+            $regs,
2682
+            PREG_PATTERN_ORDER
2683
+        )
2684
+    ) {
2685
+        return $regs[0];
2686
+    } else {
2687
+        return [];
2688
+    }
2689 2689
 }
2690 2690
 
2691 2691
 /**
@@ -2714,11 +2714,11 @@  discard block
 block discarded – undo
2714 2714
  *     - `$def` si on n'a pas transmis de tableau
2715 2715
  **/
2716 2716
 function in_any($val, $vals, $def = '') {
2717
-	if (!is_array($vals) and $vals and $v = unserialize($vals)) {
2718
-		$vals = $v;
2719
-	}
2717
+    if (!is_array($vals) and $vals and $v = unserialize($vals)) {
2718
+        $vals = $v;
2719
+    }
2720 2720
 
2721
-	return (!is_array($vals) ? $def : (in_array($val, $vals) ? ' ' : ''));
2721
+    return (!is_array($vals) ? $def : (in_array($val, $vals) ? ' ' : ''));
2722 2722
 }
2723 2723
 
2724 2724
 
@@ -2739,12 +2739,12 @@  discard block
 block discarded – undo
2739 2739
  *     Résultat du calcul
2740 2740
  **/
2741 2741
 function valeur_numerique($expr) {
2742
-	$a = 0;
2743
-	if (preg_match(',^[0-9]+(\s*[+*-]\s*[0-9]+)*$,S', trim($expr))) {
2744
-		eval("\$a = $expr;");
2745
-	}
2742
+    $a = 0;
2743
+    if (preg_match(',^[0-9]+(\s*[+*-]\s*[0-9]+)*$,S', trim($expr))) {
2744
+        eval("\$a = $expr;");
2745
+    }
2746 2746
 
2747
-	return intval($a);
2747
+    return intval($a);
2748 2748
 }
2749 2749
 
2750 2750
 /**
@@ -2763,7 +2763,7 @@  discard block
 block discarded – undo
2763 2763
  *      Retourne `$a*$b/$c`
2764 2764
  **/
2765 2765
 function regledetrois($a, $b, $c) {
2766
-	return round($a * $b / $c);
2766
+    return round($a * $b / $c);
2767 2767
 }
2768 2768
 
2769 2769
 
@@ -2786,79 +2786,79 @@  discard block
 block discarded – undo
2786 2786
  * @return string Suite de champs input hidden
2787 2787
  **/
2788 2788
 function form_hidden(?string $action = ''): string {
2789
-	$action ??= '';
2790
-
2791
-	$contexte = [];
2792
-	include_spip('inc/urls');
2793
-	if (
2794
-		$p = urls_decoder_url($action, '')
2795
-		and reset($p)
2796
-	) {
2797
-		$fond = array_shift($p);
2798
-		if ($fond != '404') {
2799
-			$contexte = array_shift($p);
2800
-			$contexte['page'] = $fond;
2801
-			$action = preg_replace('/([?]' . preg_quote($fond) . '[^&=]*[0-9]+)(&|$)/', '?&', $action);
2802
-		}
2803
-	}
2804
-	// defaire ce qu'a injecte urls_decoder_url : a revoir en modifiant la signature de urls_decoder_url
2805
-	if (defined('_DEFINIR_CONTEXTE_TYPE') and _DEFINIR_CONTEXTE_TYPE) {
2806
-		unset($contexte['type']);
2807
-	}
2808
-	if (!defined('_DEFINIR_CONTEXTE_TYPE_PAGE') or _DEFINIR_CONTEXTE_TYPE_PAGE) {
2809
-		unset($contexte['type-page']);
2810
-	}
2811
-
2812
-	// on va remplir un tableau de valeurs en prenant bien soin de ne pas
2813
-	// ecraser les elements de la forme mots[]=1&mots[]=2
2814
-	$values = [];
2815
-
2816
-	// d'abord avec celles de l'url
2817
-	if (false !== ($p = strpos($action, '?'))) {
2818
-		foreach (preg_split('/&(amp;)?/S', substr($action, $p + 1)) as $c) {
2819
-			$c = explode('=', $c, 2);
2820
-			$var = array_shift($c);
2821
-			$val = array_shift($c) ?? '';
2822
-			if ($var) {
2823
-				$val = rawurldecode($val);
2824
-				$var = rawurldecode($var); // decoder les [] eventuels
2825
-				if (preg_match(',\[\]$,S', $var)) {
2826
-					$values[] = [$var, $val];
2827
-				} else {
2828
-					if (!isset($values[$var])) {
2829
-						$values[$var] = [$var, $val];
2830
-					}
2831
-				}
2832
-			}
2833
-		}
2834
-	}
2835
-
2836
-	// ensuite avec celles du contexte, sans doublonner !
2837
-	foreach ($contexte as $var => $val) {
2838
-		if (preg_match(',\[\]$,S', $var)) {
2839
-			$values[] = [$var, $val];
2840
-		} else {
2841
-			if (!isset($values[$var])) {
2842
-				$values[$var] = [$var, $val];
2843
-			}
2844
-		}
2845
-	}
2846
-
2847
-	// puis on rassemble le tout
2848
-	$hidden = [];
2849
-	foreach ($values as $value) {
2850
-		[$var, $val] = $value;
2851
-		$hidden[] = '<input name="'
2852
-			. entites_html($var)
2853
-			. '"'
2854
-			. (is_null($val)
2855
-				? ''
2856
-				: ' value="' . entites_html($val) . '"'
2857
-			)
2858
-			. ' type="hidden"' . "\n/>";
2859
-	}
2860
-
2861
-	return join('', $hidden);
2789
+    $action ??= '';
2790
+
2791
+    $contexte = [];
2792
+    include_spip('inc/urls');
2793
+    if (
2794
+        $p = urls_decoder_url($action, '')
2795
+        and reset($p)
2796
+    ) {
2797
+        $fond = array_shift($p);
2798
+        if ($fond != '404') {
2799
+            $contexte = array_shift($p);
2800
+            $contexte['page'] = $fond;
2801
+            $action = preg_replace('/([?]' . preg_quote($fond) . '[^&=]*[0-9]+)(&|$)/', '?&', $action);
2802
+        }
2803
+    }
2804
+    // defaire ce qu'a injecte urls_decoder_url : a revoir en modifiant la signature de urls_decoder_url
2805
+    if (defined('_DEFINIR_CONTEXTE_TYPE') and _DEFINIR_CONTEXTE_TYPE) {
2806
+        unset($contexte['type']);
2807
+    }
2808
+    if (!defined('_DEFINIR_CONTEXTE_TYPE_PAGE') or _DEFINIR_CONTEXTE_TYPE_PAGE) {
2809
+        unset($contexte['type-page']);
2810
+    }
2811
+
2812
+    // on va remplir un tableau de valeurs en prenant bien soin de ne pas
2813
+    // ecraser les elements de la forme mots[]=1&mots[]=2
2814
+    $values = [];
2815
+
2816
+    // d'abord avec celles de l'url
2817
+    if (false !== ($p = strpos($action, '?'))) {
2818
+        foreach (preg_split('/&(amp;)?/S', substr($action, $p + 1)) as $c) {
2819
+            $c = explode('=', $c, 2);
2820
+            $var = array_shift($c);
2821
+            $val = array_shift($c) ?? '';
2822
+            if ($var) {
2823
+                $val = rawurldecode($val);
2824
+                $var = rawurldecode($var); // decoder les [] eventuels
2825
+                if (preg_match(',\[\]$,S', $var)) {
2826
+                    $values[] = [$var, $val];
2827
+                } else {
2828
+                    if (!isset($values[$var])) {
2829
+                        $values[$var] = [$var, $val];
2830
+                    }
2831
+                }
2832
+            }
2833
+        }
2834
+    }
2835
+
2836
+    // ensuite avec celles du contexte, sans doublonner !
2837
+    foreach ($contexte as $var => $val) {
2838
+        if (preg_match(',\[\]$,S', $var)) {
2839
+            $values[] = [$var, $val];
2840
+        } else {
2841
+            if (!isset($values[$var])) {
2842
+                $values[$var] = [$var, $val];
2843
+            }
2844
+        }
2845
+    }
2846
+
2847
+    // puis on rassemble le tout
2848
+    $hidden = [];
2849
+    foreach ($values as $value) {
2850
+        [$var, $val] = $value;
2851
+        $hidden[] = '<input name="'
2852
+            . entites_html($var)
2853
+            . '"'
2854
+            . (is_null($val)
2855
+                ? ''
2856
+                : ' value="' . entites_html($val) . '"'
2857
+            )
2858
+            . ' type="hidden"' . "\n/>";
2859
+    }
2860
+
2861
+    return join('', $hidden);
2862 2862
 }
2863 2863
 
2864 2864
 
@@ -2880,7 +2880,7 @@  discard block
 block discarded – undo
2880 2880
  *    - la première valeur du tableau sinon.
2881 2881
  **/
2882 2882
 function filtre_reset($array) {
2883
-	return !is_array($array) ? null : reset($array);
2883
+    return !is_array($array) ? null : reset($array);
2884 2884
 }
2885 2885
 
2886 2886
 /**
@@ -2901,7 +2901,7 @@  discard block
 block discarded – undo
2901 2901
  *    - la dernière valeur du tableau sinon.
2902 2902
  **/
2903 2903
 function filtre_end($array) {
2904
-	return !is_array($array) ? null : end($array);
2904
+    return !is_array($array) ? null : end($array);
2905 2905
 }
2906 2906
 
2907 2907
 /**
@@ -2921,11 +2921,11 @@  discard block
 block discarded – undo
2921 2921
  *
2922 2922
  **/
2923 2923
 function filtre_push($array, $val) {
2924
-	if (!is_array($array) or !array_push($array, $val)) {
2925
-		return '';
2926
-	}
2924
+    if (!is_array($array) or !array_push($array, $val)) {
2925
+        return '';
2926
+    }
2927 2927
 
2928
-	return $array;
2928
+    return $array;
2929 2929
 }
2930 2930
 
2931 2931
 /**
@@ -2944,7 +2944,7 @@  discard block
 block discarded – undo
2944 2944
  *     - `true` si la valeur existe dans le tableau, `false` sinon.
2945 2945
  **/
2946 2946
 function filtre_find($array, $val) {
2947
-	return (is_array($array) and in_array($val, $array));
2947
+    return (is_array($array) and in_array($val, $array));
2948 2948
 }
2949 2949
 
2950 2950
 
@@ -2961,13 +2961,13 @@  discard block
 block discarded – undo
2961 2961
  *     Contenu avec urls en absolus
2962 2962
  **/
2963 2963
 function urls_absolues_css($contenu, $source) {
2964
-	$path = suivre_lien(url_absolue($source), './');
2964
+    $path = suivre_lien(url_absolue($source), './');
2965 2965
 
2966
-	return preg_replace_callback(
2967
-		",url\s*\(\s*['\"]?([^'\"/#\s][^:]*)['\"]?\s*\),Uims",
2968
-		fn($x) => "url('" . suivre_lien($path, $x[1]) . "')",
2969
-		$contenu
2970
-	);
2966
+    return preg_replace_callback(
2967
+        ",url\s*\(\s*['\"]?([^'\"/#\s][^:]*)['\"]?\s*\),Uims",
2968
+        fn($x) => "url('" . suivre_lien($path, $x[1]) . "')",
2969
+        $contenu
2970
+    );
2971 2971
 }
2972 2972
 
2973 2973
 
@@ -2996,119 +2996,119 @@  discard block
 block discarded – undo
2996 2996
  *     Chemin du fichier CSS inversé
2997 2997
  **/
2998 2998
 function direction_css($css, $voulue = '') {
2999
-	if (!preg_match(',(_rtl)?\.css$,i', $css, $r)) {
3000
-		return $css;
3001
-	}
3002
-	include_spip('inc/lang');
3003
-	// si on a precise le sens voulu en argument, le prendre en compte
3004
-	if ($voulue = strtolower($voulue)) {
3005
-		if ($voulue != 'rtl' and $voulue != 'ltr') {
3006
-			$voulue = lang_dir($voulue);
3007
-		}
3008
-	} else {
3009
-		$voulue = lang_dir();
3010
-	}
3011
-
3012
-	$r = count($r) > 1;
3013
-	$right = $r ? 'left' : 'right'; // 'right' de la css lue en entree
3014
-	$dir = $r ? 'rtl' : 'ltr';
3015
-	$ndir = $r ? 'ltr' : 'rtl';
3016
-
3017
-	if ($voulue == $dir) {
3018
-		return $css;
3019
-	}
3020
-
3021
-	if (
3022
-		// url absolue
3023
-		preg_match(',^https?:,i', $css)
3024
-		// ou qui contient un ?
3025
-		or (($p = strpos($css, '?')) !== false)
3026
-	) {
3027
-		$distant = true;
3028
-		$cssf = parse_url($css);
3029
-		$cssf = $cssf['path'] . ($cssf['query'] ? '?' . $cssf['query'] : '');
3030
-		$cssf = preg_replace(',[?:&=],', '_', $cssf);
3031
-	} else {
3032
-		$distant = false;
3033
-		$cssf = $css;
3034
-		// 1. regarder d'abord si un fichier avec la bonne direction n'est pas aussi
3035
-		//propose (rien a faire dans ce cas)
3036
-		$f = preg_replace(',(_rtl)?\.css$,i', '_' . $ndir . '.css', $css);
3037
-		if (@file_exists($f)) {
3038
-			return $f;
3039
-		}
3040
-	}
3041
-
3042
-	// 2.
3043
-	$dir_var = sous_repertoire(_DIR_VAR, 'cache-css');
3044
-	$f = $dir_var
3045
-		. preg_replace(',.*/(.*?)(_rtl)?\.css,', '\1', $cssf)
3046
-		. '.' . substr(md5($cssf), 0, 4) . '_' . $ndir . '.css';
3047
-
3048
-	// la css peut etre distante (url absolue !)
3049
-	if ($distant) {
3050
-		include_spip('inc/distant');
3051
-		$res = recuperer_url($css);
3052
-		if (!$res or !$contenu = $res['page']) {
3053
-			return $css;
3054
-		}
3055
-	} else {
3056
-		if (
3057
-			(@filemtime($f) > @filemtime($css))
3058
-			and (_VAR_MODE != 'recalcul')
3059
-		) {
3060
-			return $f;
3061
-		}
3062
-		if (!lire_fichier($css, $contenu)) {
3063
-			return $css;
3064
-		}
3065
-	}
3066
-
3067
-
3068
-	// Inverser la direction gauche-droite en utilisant CSSTidy qui gere aussi les shorthands
3069
-	include_spip('lib/csstidy/class.csstidy');
3070
-	$parser = new csstidy();
3071
-	$parser->set_cfg('optimise_shorthands', 0);
3072
-	$parser->set_cfg('reverse_left_and_right', true);
3073
-	$parser->parse($contenu);
3074
-
3075
-	$contenu = $parser->print->plain();
3076
-
3077
-
3078
-	// reperer les @import auxquels il faut propager le direction_css
3079
-	preg_match_all(",\@import\s*url\s*\(\s*['\"]?([^'\"/][^:]*)['\"]?\s*\),Uims", $contenu, $regs);
3080
-	$src = [];
3081
-	$src_direction_css = [];
3082
-	$src_faux_abs = [];
3083
-	$d = dirname($css);
3084
-	foreach ($regs[1] as $k => $import_css) {
3085
-		$css_direction = direction_css("$d/$import_css", $voulue);
3086
-		// si la css_direction est dans le meme path que la css d'origine, on tronque le path, elle sera passee en absolue
3087
-		if (substr($css_direction, 0, strlen($d) + 1) == "$d/") {
3088
-			$css_direction = substr($css_direction, strlen($d) + 1);
3089
-		} // si la css_direction commence par $dir_var on la fait passer pour une absolue
3090
-		elseif (substr($css_direction, 0, strlen($dir_var)) == $dir_var) {
3091
-			$css_direction = substr($css_direction, strlen($dir_var));
3092
-			$src_faux_abs['/@@@@@@/' . $css_direction] = $css_direction;
3093
-			$css_direction = '/@@@@@@/' . $css_direction;
3094
-		}
3095
-		$src[] = $regs[0][$k];
3096
-		$src_direction_css[] = str_replace($import_css, $css_direction, $regs[0][$k]);
3097
-	}
3098
-	$contenu = str_replace($src, $src_direction_css, $contenu);
3099
-
3100
-	$contenu = urls_absolues_css($contenu, $css);
3101
-
3102
-	// virer les fausses url absolues que l'on a mis dans les import
3103
-	if (count($src_faux_abs)) {
3104
-		$contenu = str_replace(array_keys($src_faux_abs), $src_faux_abs, $contenu);
3105
-	}
3106
-
3107
-	if (!ecrire_fichier($f, $contenu)) {
3108
-		return $css;
3109
-	}
3110
-
3111
-	return $f;
2999
+    if (!preg_match(',(_rtl)?\.css$,i', $css, $r)) {
3000
+        return $css;
3001
+    }
3002
+    include_spip('inc/lang');
3003
+    // si on a precise le sens voulu en argument, le prendre en compte
3004
+    if ($voulue = strtolower($voulue)) {
3005
+        if ($voulue != 'rtl' and $voulue != 'ltr') {
3006
+            $voulue = lang_dir($voulue);
3007
+        }
3008
+    } else {
3009
+        $voulue = lang_dir();
3010
+    }
3011
+
3012
+    $r = count($r) > 1;
3013
+    $right = $r ? 'left' : 'right'; // 'right' de la css lue en entree
3014
+    $dir = $r ? 'rtl' : 'ltr';
3015
+    $ndir = $r ? 'ltr' : 'rtl';
3016
+
3017
+    if ($voulue == $dir) {
3018
+        return $css;
3019
+    }
3020
+
3021
+    if (
3022
+        // url absolue
3023
+        preg_match(',^https?:,i', $css)
3024
+        // ou qui contient un ?
3025
+        or (($p = strpos($css, '?')) !== false)
3026
+    ) {
3027
+        $distant = true;
3028
+        $cssf = parse_url($css);
3029
+        $cssf = $cssf['path'] . ($cssf['query'] ? '?' . $cssf['query'] : '');
3030
+        $cssf = preg_replace(',[?:&=],', '_', $cssf);
3031
+    } else {
3032
+        $distant = false;
3033
+        $cssf = $css;
3034
+        // 1. regarder d'abord si un fichier avec la bonne direction n'est pas aussi
3035
+        //propose (rien a faire dans ce cas)
3036
+        $f = preg_replace(',(_rtl)?\.css$,i', '_' . $ndir . '.css', $css);
3037
+        if (@file_exists($f)) {
3038
+            return $f;
3039
+        }
3040
+    }
3041
+
3042
+    // 2.
3043
+    $dir_var = sous_repertoire(_DIR_VAR, 'cache-css');
3044
+    $f = $dir_var
3045
+        . preg_replace(',.*/(.*?)(_rtl)?\.css,', '\1', $cssf)
3046
+        . '.' . substr(md5($cssf), 0, 4) . '_' . $ndir . '.css';
3047
+
3048
+    // la css peut etre distante (url absolue !)
3049
+    if ($distant) {
3050
+        include_spip('inc/distant');
3051
+        $res = recuperer_url($css);
3052
+        if (!$res or !$contenu = $res['page']) {
3053
+            return $css;
3054
+        }
3055
+    } else {
3056
+        if (
3057
+            (@filemtime($f) > @filemtime($css))
3058
+            and (_VAR_MODE != 'recalcul')
3059
+        ) {
3060
+            return $f;
3061
+        }
3062
+        if (!lire_fichier($css, $contenu)) {
3063
+            return $css;
3064
+        }
3065
+    }
3066
+
3067
+
3068
+    // Inverser la direction gauche-droite en utilisant CSSTidy qui gere aussi les shorthands
3069
+    include_spip('lib/csstidy/class.csstidy');
3070
+    $parser = new csstidy();
3071
+    $parser->set_cfg('optimise_shorthands', 0);
3072
+    $parser->set_cfg('reverse_left_and_right', true);
3073
+    $parser->parse($contenu);
3074
+
3075
+    $contenu = $parser->print->plain();
3076
+
3077
+
3078
+    // reperer les @import auxquels il faut propager le direction_css
3079
+    preg_match_all(",\@import\s*url\s*\(\s*['\"]?([^'\"/][^:]*)['\"]?\s*\),Uims", $contenu, $regs);
3080
+    $src = [];
3081
+    $src_direction_css = [];
3082
+    $src_faux_abs = [];
3083
+    $d = dirname($css);
3084
+    foreach ($regs[1] as $k => $import_css) {
3085
+        $css_direction = direction_css("$d/$import_css", $voulue);
3086
+        // si la css_direction est dans le meme path que la css d'origine, on tronque le path, elle sera passee en absolue
3087
+        if (substr($css_direction, 0, strlen($d) + 1) == "$d/") {
3088
+            $css_direction = substr($css_direction, strlen($d) + 1);
3089
+        } // si la css_direction commence par $dir_var on la fait passer pour une absolue
3090
+        elseif (substr($css_direction, 0, strlen($dir_var)) == $dir_var) {
3091
+            $css_direction = substr($css_direction, strlen($dir_var));
3092
+            $src_faux_abs['/@@@@@@/' . $css_direction] = $css_direction;
3093
+            $css_direction = '/@@@@@@/' . $css_direction;
3094
+        }
3095
+        $src[] = $regs[0][$k];
3096
+        $src_direction_css[] = str_replace($import_css, $css_direction, $regs[0][$k]);
3097
+    }
3098
+    $contenu = str_replace($src, $src_direction_css, $contenu);
3099
+
3100
+    $contenu = urls_absolues_css($contenu, $css);
3101
+
3102
+    // virer les fausses url absolues que l'on a mis dans les import
3103
+    if (count($src_faux_abs)) {
3104
+        $contenu = str_replace(array_keys($src_faux_abs), $src_faux_abs, $contenu);
3105
+    }
3106
+
3107
+    if (!ecrire_fichier($f, $contenu)) {
3108
+        return $css;
3109
+    }
3110
+
3111
+    return $f;
3112 3112
 }
3113 3113
 
3114 3114
 
@@ -3131,46 +3131,46 @@  discard block
 block discarded – undo
3131 3131
  *     - Chemin ou URL du fichier CSS source sinon.
3132 3132
  **/
3133 3133
 function url_absolue_css($css) {
3134
-	if (!preg_match(',\.css$,i', $css, $r)) {
3135
-		return $css;
3136
-	}
3134
+    if (!preg_match(',\.css$,i', $css, $r)) {
3135
+        return $css;
3136
+    }
3137 3137
 
3138
-	$url_absolue_css = url_absolue($css);
3138
+    $url_absolue_css = url_absolue($css);
3139 3139
 
3140
-	$f = basename($css, '.css');
3141
-	$f = sous_repertoire(_DIR_VAR, 'cache-css')
3142
-		. preg_replace(',(.*?)(_rtl|_ltr)?$,', "\\1-urlabs-" . substr(md5("$css-urlabs"), 0, 4) . "\\2", $f)
3143
-		. '.css';
3140
+    $f = basename($css, '.css');
3141
+    $f = sous_repertoire(_DIR_VAR, 'cache-css')
3142
+        . preg_replace(',(.*?)(_rtl|_ltr)?$,', "\\1-urlabs-" . substr(md5("$css-urlabs"), 0, 4) . "\\2", $f)
3143
+        . '.css';
3144 3144
 
3145
-	if ((@filemtime($f) > @filemtime($css)) and (_VAR_MODE != 'recalcul')) {
3146
-		return $f;
3147
-	}
3145
+    if ((@filemtime($f) > @filemtime($css)) and (_VAR_MODE != 'recalcul')) {
3146
+        return $f;
3147
+    }
3148 3148
 
3149
-	if ($url_absolue_css == $css) {
3150
-		if (
3151
-			strncmp($GLOBALS['meta']['adresse_site'], $css, $l = strlen($GLOBALS['meta']['adresse_site'])) != 0
3152
-			or !lire_fichier(_DIR_RACINE . substr($css, $l), $contenu)
3153
-		) {
3154
-			include_spip('inc/distant');
3155
-			$contenu = recuperer_url($css);
3156
-			$contenu = $contenu['page'] ?? '';
3157
-			if (!$contenu) {
3158
-				return $css;
3159
-			}
3160
-		}
3161
-	} elseif (!lire_fichier($css, $contenu)) {
3162
-		return $css;
3163
-	}
3149
+    if ($url_absolue_css == $css) {
3150
+        if (
3151
+            strncmp($GLOBALS['meta']['adresse_site'], $css, $l = strlen($GLOBALS['meta']['adresse_site'])) != 0
3152
+            or !lire_fichier(_DIR_RACINE . substr($css, $l), $contenu)
3153
+        ) {
3154
+            include_spip('inc/distant');
3155
+            $contenu = recuperer_url($css);
3156
+            $contenu = $contenu['page'] ?? '';
3157
+            if (!$contenu) {
3158
+                return $css;
3159
+            }
3160
+        }
3161
+    } elseif (!lire_fichier($css, $contenu)) {
3162
+        return $css;
3163
+    }
3164 3164
 
3165
-	// passer les url relatives a la css d'origine en url absolues
3166
-	$contenu = urls_absolues_css($contenu, $css);
3165
+    // passer les url relatives a la css d'origine en url absolues
3166
+    $contenu = urls_absolues_css($contenu, $css);
3167 3167
 
3168
-	// ecrire la css
3169
-	if (!ecrire_fichier($f, $contenu)) {
3170
-		return $css;
3171
-	}
3168
+    // ecrire la css
3169
+    if (!ecrire_fichier($f, $contenu)) {
3170
+        return $css;
3171
+    }
3172 3172
 
3173
-	return $f;
3173
+    return $f;
3174 3174
 }
3175 3175
 
3176 3176
 
@@ -3204,24 +3204,24 @@  discard block
 block discarded – undo
3204 3204
  *     Valeur trouvée ou valeur par défaut.
3205 3205
  **/
3206 3206
 function table_valeur($table, $cle, $defaut = '', $conserver_null = false) {
3207
-	foreach (explode('/', $cle) as $k) {
3208
-		$table = (is_string($table) ? @unserialize($table) : $table);
3207
+    foreach (explode('/', $cle) as $k) {
3208
+        $table = (is_string($table) ? @unserialize($table) : $table);
3209 3209
 
3210
-		if (is_object($table)) {
3211
-			$table = (($k !== '') and isset($table->$k)) ? $table->$k : $defaut;
3212
-		} elseif (is_array($table)) {
3213
-			if ($conserver_null) {
3214
-				$table = array_key_exists($k, $table) ? $table[$k] : $defaut;
3215
-			} else {
3216
-				$table = ($table[$k] ?? $defaut);
3217
-			}
3218
-		} else {
3219
-			$table = $defaut;
3220
-			break;
3221
-		}
3222
-	}
3210
+        if (is_object($table)) {
3211
+            $table = (($k !== '') and isset($table->$k)) ? $table->$k : $defaut;
3212
+        } elseif (is_array($table)) {
3213
+            if ($conserver_null) {
3214
+                $table = array_key_exists($k, $table) ? $table[$k] : $defaut;
3215
+            } else {
3216
+                $table = ($table[$k] ?? $defaut);
3217
+            }
3218
+        } else {
3219
+            $table = $defaut;
3220
+            break;
3221
+        }
3222
+    }
3223 3223
 
3224
-	return $table;
3224
+    return $table;
3225 3225
 }
3226 3226
 
3227 3227
 /**
@@ -3254,22 +3254,22 @@  discard block
 block discarded – undo
3254 3254
  *     - string : expression trouvée.
3255 3255
  **/
3256 3256
 function filtre_match_dist(?string $texte, $expression, $modif = 'UuimsS', $capte = 0) {
3257
-	if (intval($modif) and $capte == 0) {
3258
-		$capte = $modif;
3259
-		$modif = 'UuimsS';
3260
-	}
3261
-	$expression = str_replace('\/', '/', $expression);
3262
-	$expression = str_replace('/', '\/', $expression);
3257
+    if (intval($modif) and $capte == 0) {
3258
+        $capte = $modif;
3259
+        $modif = 'UuimsS';
3260
+    }
3261
+    $expression = str_replace('\/', '/', $expression);
3262
+    $expression = str_replace('/', '\/', $expression);
3263 3263
 
3264
-	if (preg_match('/' . $expression . '/' . $modif, $texte ?? '', $r)) {
3265
-		if (isset($r[$capte])) {
3266
-			return $r[$capte];
3267
-		} else {
3268
-			return true;
3269
-		}
3270
-	}
3264
+    if (preg_match('/' . $expression . '/' . $modif, $texte ?? '', $r)) {
3265
+        if (isset($r[$capte])) {
3266
+            return $r[$capte];
3267
+        } else {
3268
+            return true;
3269
+        }
3270
+    }
3271 3271
 
3272
-	return false;
3272
+    return false;
3273 3273
 }
3274 3274
 
3275 3275
 
@@ -3296,10 +3296,10 @@  discard block
 block discarded – undo
3296 3296
  *     Texte
3297 3297
  **/
3298 3298
 function replace($texte, $expression, $replace = '', $modif = 'UimsS') {
3299
-	$expression = str_replace('\/', '/', $expression);
3300
-	$expression = str_replace('/', '\/', $expression);
3299
+    $expression = str_replace('\/', '/', $expression);
3300
+    $expression = str_replace('/', '\/', $expression);
3301 3301
 
3302
-	return preg_replace('/' . $expression . '/' . $modif, $replace, $texte);
3302
+    return preg_replace('/' . $expression . '/' . $modif, $replace, $texte);
3303 3303
 }
3304 3304
 
3305 3305
 
@@ -3317,25 +3317,25 @@  discard block
 block discarded – undo
3317 3317
  **/
3318 3318
 function traiter_doublons_documents(&$doublons, $letexte) {
3319 3319
 
3320
-	// Verifier dans le texte & les notes (pas beau, helas)
3321
-	$t = $letexte . $GLOBALS['les_notes'];
3320
+    // Verifier dans le texte & les notes (pas beau, helas)
3321
+    $t = $letexte . $GLOBALS['les_notes'];
3322 3322
 
3323
-	if (
3324
-		strstr($t, 'spip_document_') // evite le preg_match_all si inutile
3325
-		and preg_match_all(
3326
-			',<[^>]+\sclass=["\']spip_document_([0-9]+)[\s"\'],imsS',
3327
-			$t,
3328
-			$matches,
3329
-			PREG_PATTERN_ORDER
3330
-		)
3331
-	) {
3332
-		if (!isset($doublons['documents'])) {
3333
-			$doublons['documents'] = '';
3334
-		}
3335
-		$doublons['documents'] .= ',' . join(',', $matches[1]);
3336
-	}
3323
+    if (
3324
+        strstr($t, 'spip_document_') // evite le preg_match_all si inutile
3325
+        and preg_match_all(
3326
+            ',<[^>]+\sclass=["\']spip_document_([0-9]+)[\s"\'],imsS',
3327
+            $t,
3328
+            $matches,
3329
+            PREG_PATTERN_ORDER
3330
+        )
3331
+    ) {
3332
+        if (!isset($doublons['documents'])) {
3333
+            $doublons['documents'] = '';
3334
+        }
3335
+        $doublons['documents'] .= ',' . join(',', $matches[1]);
3336
+    }
3337 3337
 
3338
-	return $letexte;
3338
+    return $letexte;
3339 3339
 }
3340 3340
 
3341 3341
 /**
@@ -3349,7 +3349,7 @@  discard block
 block discarded – undo
3349 3349
  * @return string Chaîne vide
3350 3350
  **/
3351 3351
 function vide($texte) {
3352
-	return '';
3352
+    return '';
3353 3353
 }
3354 3354
 
3355 3355
 //
@@ -3378,23 +3378,23 @@  discard block
 block discarded – undo
3378 3378
  *      Code HTML résultant
3379 3379
  **/
3380 3380
 function env_to_params($env, $ignore_params = []) {
3381
-	$ignore_params = array_merge(
3382
-		['id', 'lang', 'id_document', 'date', 'date_redac', 'align', 'fond', '', 'recurs', 'emb', 'dir_racine'],
3383
-		$ignore_params
3384
-	);
3385
-	if (!is_array($env)) {
3386
-		$env = unserialize($env);
3387
-	}
3388
-	$texte = '';
3389
-	if ($env) {
3390
-		foreach ($env as $i => $j) {
3391
-			if (is_string($j) and !in_array($i, $ignore_params)) {
3392
-				$texte .= "<param name='" . attribut_html($i) . "'\n\tvalue='" . attribut_html($j) . "' />";
3393
-			}
3394
-		}
3395
-	}
3396
-
3397
-	return $texte;
3381
+    $ignore_params = array_merge(
3382
+        ['id', 'lang', 'id_document', 'date', 'date_redac', 'align', 'fond', '', 'recurs', 'emb', 'dir_racine'],
3383
+        $ignore_params
3384
+    );
3385
+    if (!is_array($env)) {
3386
+        $env = unserialize($env);
3387
+    }
3388
+    $texte = '';
3389
+    if ($env) {
3390
+        foreach ($env as $i => $j) {
3391
+            if (is_string($j) and !in_array($i, $ignore_params)) {
3392
+                $texte .= "<param name='" . attribut_html($i) . "'\n\tvalue='" . attribut_html($j) . "' />";
3393
+            }
3394
+        }
3395
+    }
3396
+
3397
+    return $texte;
3398 3398
 }
3399 3399
 
3400 3400
 /**
@@ -3417,23 +3417,23 @@  discard block
 block discarded – undo
3417 3417
  *      Code HTML résultant
3418 3418
  **/
3419 3419
 function env_to_attributs($env, $ignore_params = []) {
3420
-	$ignore_params = array_merge(
3421
-		['id', 'lang', 'id_document', 'date', 'date_redac', 'align', 'fond', '', 'recurs', 'emb', 'dir_racine'],
3422
-		$ignore_params
3423
-	);
3424
-	if (!is_array($env)) {
3425
-		$env = unserialize($env);
3426
-	}
3427
-	$texte = '';
3428
-	if ($env) {
3429
-		foreach ($env as $i => $j) {
3430
-			if (is_string($j) and !in_array($i, $ignore_params)) {
3431
-				$texte .= attribut_html($i) . "='" . attribut_html($j) . "' ";
3432
-			}
3433
-		}
3434
-	}
3420
+    $ignore_params = array_merge(
3421
+        ['id', 'lang', 'id_document', 'date', 'date_redac', 'align', 'fond', '', 'recurs', 'emb', 'dir_racine'],
3422
+        $ignore_params
3423
+    );
3424
+    if (!is_array($env)) {
3425
+        $env = unserialize($env);
3426
+    }
3427
+    $texte = '';
3428
+    if ($env) {
3429
+        foreach ($env as $i => $j) {
3430
+            if (is_string($j) and !in_array($i, $ignore_params)) {
3431
+                $texte .= attribut_html($i) . "='" . attribut_html($j) . "' ";
3432
+            }
3433
+        }
3434
+    }
3435 3435
 
3436
-	return $texte;
3436
+    return $texte;
3437 3437
 }
3438 3438
 
3439 3439
 
@@ -3451,7 +3451,7 @@  discard block
 block discarded – undo
3451 3451
  * @return string Chaînes concaténés
3452 3452
  **/
3453 3453
 function concat(...$args): string {
3454
-	return join('', $args);
3454
+    return join('', $args);
3455 3455
 }
3456 3456
 
3457 3457
 
@@ -3471,23 +3471,23 @@  discard block
 block discarded – undo
3471 3471
  *     Contenu du ou des fichiers, concaténé
3472 3472
  **/
3473 3473
 function charge_scripts($files, $script = true) {
3474
-	$flux = '';
3475
-	foreach (is_array($files) ? $files : explode('|', $files) as $file) {
3476
-		if (!is_string($file)) {
3477
-			continue;
3478
-		}
3479
-		if ($script) {
3480
-			$file = preg_match(',^\w+$,', $file) ? "javascript/$file.js" : '';
3481
-		}
3482
-		if ($file) {
3483
-			$path = find_in_path($file);
3484
-			if ($path) {
3485
-				$flux .= spip_file_get_contents($path);
3486
-			}
3487
-		}
3488
-	}
3489
-
3490
-	return $flux;
3474
+    $flux = '';
3475
+    foreach (is_array($files) ? $files : explode('|', $files) as $file) {
3476
+        if (!is_string($file)) {
3477
+            continue;
3478
+        }
3479
+        if ($script) {
3480
+            $file = preg_match(',^\w+$,', $file) ? "javascript/$file.js" : '';
3481
+        }
3482
+        if ($file) {
3483
+            $path = find_in_path($file);
3484
+            if ($path) {
3485
+                $flux .= spip_file_get_contents($path);
3486
+            }
3487
+        }
3488
+    }
3489
+
3490
+    return $flux;
3491 3491
 }
3492 3492
 
3493 3493
 /**
@@ -3498,22 +3498,22 @@  discard block
 block discarded – undo
3498 3498
  * @return string
3499 3499
  */
3500 3500
 function http_img_variante_svg_si_possible($img_file) {
3501
-	// on peut fournir une icone generique -xx.svg qui fera le job dans toutes les tailles, et qui est prioritaire sur le png
3502
-	// si il y a un .svg a la bonne taille (-16.svg) a cote, on l'utilise en remplacement du -16.png
3503
-	if (
3504
-		preg_match(',-(\d+)[.](png|gif|svg)$,', $img_file, $m)
3505
-		and $variante_svg_generique = substr($img_file, 0, -strlen($m[0])) . '-xx.svg'
3506
-		and file_exists($variante_svg_generique)
3507
-	) {
3508
-		if ($variante_svg_size = substr($variante_svg_generique, 0, -6) . $m[1] . '.svg' and file_exists($variante_svg_size)) {
3509
-			$img_file = $variante_svg_size;
3510
-		}
3511
-		else {
3512
-			$img_file = $variante_svg_generique;
3513
-		}
3514
-	}
3501
+    // on peut fournir une icone generique -xx.svg qui fera le job dans toutes les tailles, et qui est prioritaire sur le png
3502
+    // si il y a un .svg a la bonne taille (-16.svg) a cote, on l'utilise en remplacement du -16.png
3503
+    if (
3504
+        preg_match(',-(\d+)[.](png|gif|svg)$,', $img_file, $m)
3505
+        and $variante_svg_generique = substr($img_file, 0, -strlen($m[0])) . '-xx.svg'
3506
+        and file_exists($variante_svg_generique)
3507
+    ) {
3508
+        if ($variante_svg_size = substr($variante_svg_generique, 0, -6) . $m[1] . '.svg' and file_exists($variante_svg_size)) {
3509
+            $img_file = $variante_svg_size;
3510
+        }
3511
+        else {
3512
+            $img_file = $variante_svg_generique;
3513
+        }
3514
+    }
3515 3515
 
3516
-	return $img_file;
3516
+    return $img_file;
3517 3517
 }
3518 3518
 
3519 3519
 /**
@@ -3534,54 +3534,54 @@  discard block
 block discarded – undo
3534 3534
  */
3535 3535
 function http_img_pack($img, $alt, $atts = '', $title = '', $options = []) {
3536 3536
 
3537
-	$img_file = $img;
3538
-	if ($p = strpos($img_file, '?')) {
3539
-		$img_file = substr($img_file, 0, $p);
3540
-	}
3541
-	if (!isset($options['chemin_image']) or $options['chemin_image'] == true) {
3542
-		$img_file = chemin_image($img);
3543
-	}
3544
-	else {
3545
-		if (!isset($options['variante_svg_si_possible']) or $options['variante_svg_si_possible'] == true) {
3546
-			$img_file = http_img_variante_svg_si_possible($img_file);
3547
-		}
3548
-	}
3549
-	if (stripos($atts, 'width') === false) {
3550
-		// utiliser directement l'info de taille presente dans le nom
3551
-		if (
3552
-			(!isset($options['utiliser_suffixe_size'])
3553
-				or $options['utiliser_suffixe_size'] == true
3554
-			  or strpos($img_file, '-xx.svg') !== false)
3555
-			and (preg_match(',-([0-9]+)[.](png|gif|svg)$,', $img, $regs)
3556
-					 or preg_match(',\?([0-9]+)px$,', $img, $regs))
3557
-		) {
3558
-			$largeur = $hauteur = intval($regs[1]);
3559
-		} else {
3560
-			$taille = taille_image($img_file);
3561
-			[$hauteur, $largeur] = $taille;
3562
-			if (!$hauteur or !$largeur) {
3563
-				return '';
3564
-			}
3565
-		}
3566
-		$atts .= " width='" . $largeur . "' height='" . $hauteur . "'";
3567
-	}
3568
-
3569
-	if (file_exists($img_file)) {
3570
-		$img_file = timestamp($img_file);
3571
-	}
3572
-	if ($alt === false) {
3573
-		$alt = '';
3574
-	}
3575
-	elseif ($alt or $alt === '') {
3576
-		$alt = " alt='" . attribut_html($alt) . "'";
3577
-	}
3578
-	else {
3579
-		$alt = " alt='" . attribut_html($title) . "'";
3580
-	}
3581
-	return "<img src='" . attribut_html($img_file) . "'$alt"
3582
-	. ($title ? ' title="' . attribut_html($title) . '"' : '')
3583
-	. ' ' . ltrim($atts)
3584
-	. ' />';
3537
+    $img_file = $img;
3538
+    if ($p = strpos($img_file, '?')) {
3539
+        $img_file = substr($img_file, 0, $p);
3540
+    }
3541
+    if (!isset($options['chemin_image']) or $options['chemin_image'] == true) {
3542
+        $img_file = chemin_image($img);
3543
+    }
3544
+    else {
3545
+        if (!isset($options['variante_svg_si_possible']) or $options['variante_svg_si_possible'] == true) {
3546
+            $img_file = http_img_variante_svg_si_possible($img_file);
3547
+        }
3548
+    }
3549
+    if (stripos($atts, 'width') === false) {
3550
+        // utiliser directement l'info de taille presente dans le nom
3551
+        if (
3552
+            (!isset($options['utiliser_suffixe_size'])
3553
+                or $options['utiliser_suffixe_size'] == true
3554
+              or strpos($img_file, '-xx.svg') !== false)
3555
+            and (preg_match(',-([0-9]+)[.](png|gif|svg)$,', $img, $regs)
3556
+                     or preg_match(',\?([0-9]+)px$,', $img, $regs))
3557
+        ) {
3558
+            $largeur = $hauteur = intval($regs[1]);
3559
+        } else {
3560
+            $taille = taille_image($img_file);
3561
+            [$hauteur, $largeur] = $taille;
3562
+            if (!$hauteur or !$largeur) {
3563
+                return '';
3564
+            }
3565
+        }
3566
+        $atts .= " width='" . $largeur . "' height='" . $hauteur . "'";
3567
+    }
3568
+
3569
+    if (file_exists($img_file)) {
3570
+        $img_file = timestamp($img_file);
3571
+    }
3572
+    if ($alt === false) {
3573
+        $alt = '';
3574
+    }
3575
+    elseif ($alt or $alt === '') {
3576
+        $alt = " alt='" . attribut_html($alt) . "'";
3577
+    }
3578
+    else {
3579
+        $alt = " alt='" . attribut_html($title) . "'";
3580
+    }
3581
+    return "<img src='" . attribut_html($img_file) . "'$alt"
3582
+    . ($title ? ' title="' . attribut_html($title) . '"' : '')
3583
+    . ' ' . ltrim($atts)
3584
+    . ' />';
3585 3585
 }
3586 3586
 
3587 3587
 /**
@@ -3593,70 +3593,70 @@  discard block
 block discarded – undo
3593 3593
  * @return string
3594 3594
  */
3595 3595
 function http_style_background($img, $att = '', $size = null) {
3596
-	if ($size and is_numeric($size)) {
3597
-		$size = trim($size) . 'px';
3598
-	}
3599
-	return " style='background" .
3600
-		($att ? '' : '-image') . ': url("' . chemin_image($img) . '")' . ($att ? (' ' . $att) : '') . ';'
3601
-		. ($size ? "background-size:{$size};" : '')
3602
-		. "'";
3596
+    if ($size and is_numeric($size)) {
3597
+        $size = trim($size) . 'px';
3598
+    }
3599
+    return " style='background" .
3600
+        ($att ? '' : '-image') . ': url("' . chemin_image($img) . '")' . ($att ? (' ' . $att) : '') . ';'
3601
+        . ($size ? "background-size:{$size};" : '')
3602
+        . "'";
3603 3603
 }
3604 3604
 
3605 3605
 
3606 3606
 function helper_filtre_balise_img_svg_arguments($alt_or_size, $class_or_size, $size) {
3607
-	$args = [$alt_or_size, $class_or_size, $size];
3608
-	while (is_null(end($args)) and count($args)) {
3609
-		array_pop($args);
3610
-	}
3611
-	if (!count($args)) {
3612
-		return [null, null, null];
3613
-	}
3614
-	if (count($args) < 3) {
3615
-		$maybe_size = array_pop($args);
3616
-		// @2x
3617
-		// @1.5x
3618
-		// 512
3619
-		// 512x*
3620
-		// 512x300
3621
-		if (
3622
-			!strlen($maybe_size)
3623
-			or !preg_match(',^(@\d+(\.\d+)?x|\d+(x\*)?|\d+x\d+)$,', trim($maybe_size))
3624
-		) {
3625
-			$args[] = $maybe_size;
3626
-			$maybe_size = null;
3627
-		}
3628
-		while (count($args) < 2) {
3629
-			$args[] = null; // default alt or class
3630
-		}
3631
-		$args[] = $maybe_size;
3632
-	}
3633
-	return $args;
3607
+    $args = [$alt_or_size, $class_or_size, $size];
3608
+    while (is_null(end($args)) and count($args)) {
3609
+        array_pop($args);
3610
+    }
3611
+    if (!count($args)) {
3612
+        return [null, null, null];
3613
+    }
3614
+    if (count($args) < 3) {
3615
+        $maybe_size = array_pop($args);
3616
+        // @2x
3617
+        // @1.5x
3618
+        // 512
3619
+        // 512x*
3620
+        // 512x300
3621
+        if (
3622
+            !strlen($maybe_size)
3623
+            or !preg_match(',^(@\d+(\.\d+)?x|\d+(x\*)?|\d+x\d+)$,', trim($maybe_size))
3624
+        ) {
3625
+            $args[] = $maybe_size;
3626
+            $maybe_size = null;
3627
+        }
3628
+        while (count($args) < 2) {
3629
+            $args[] = null; // default alt or class
3630
+        }
3631
+        $args[] = $maybe_size;
3632
+    }
3633
+    return $args;
3634 3634
 }
3635 3635
 
3636 3636
 function helper_filtre_balise_img_svg_size($img, $size) {
3637
-	// si size est de la forme '@2x' c'est un coeff multiplicateur sur la densite
3638
-	if (strpos($size, '@') === 0 and substr($size, -1) === 'x') {
3639
-		$coef = floatval(substr($size, 1, -1));
3640
-		[$h, $w] = taille_image($img);
3641
-		$height = intval(round($h / $coef));
3642
-		$width = intval(round($w / $coef));
3643
-	}
3644
-	// sinon c'est une valeur seule si image caree ou largeurxhauteur
3645
-	else {
3646
-		$size = explode('x', $size, 2);
3647
-		$size = array_map('trim', $size);
3648
-		$height = $width = intval(array_shift($size));
3649
-
3650
-		if (count($size) and reset($size)) {
3651
-			$height = array_shift($size);
3652
-			if ($height === '*') {
3653
-				[$h, $w] = taille_image($img);
3654
-				$height = intval(round($h * $width / $w));
3655
-			}
3656
-		}
3657
-	}
3658
-
3659
-	return [$width, $height];
3637
+    // si size est de la forme '@2x' c'est un coeff multiplicateur sur la densite
3638
+    if (strpos($size, '@') === 0 and substr($size, -1) === 'x') {
3639
+        $coef = floatval(substr($size, 1, -1));
3640
+        [$h, $w] = taille_image($img);
3641
+        $height = intval(round($h / $coef));
3642
+        $width = intval(round($w / $coef));
3643
+    }
3644
+    // sinon c'est une valeur seule si image caree ou largeurxhauteur
3645
+    else {
3646
+        $size = explode('x', $size, 2);
3647
+        $size = array_map('trim', $size);
3648
+        $height = $width = intval(array_shift($size));
3649
+
3650
+        if (count($size) and reset($size)) {
3651
+            $height = array_shift($size);
3652
+            if ($height === '*') {
3653
+                [$h, $w] = taille_image($img);
3654
+                $height = intval(round($h * $width / $w));
3655
+            }
3656
+        }
3657
+    }
3658
+
3659
+    return [$width, $height];
3660 3660
 }
3661 3661
 
3662 3662
 /**
@@ -3692,43 +3692,43 @@  discard block
 block discarded – undo
3692 3692
  */
3693 3693
 function filtre_balise_img_dist($img, $alt = '', $class = null, $size = null) {
3694 3694
 
3695
-	[$alt, $class, $size] = helper_filtre_balise_img_svg_arguments($alt, $class, $size);
3696
-
3697
-	$img = trim((string) $img);
3698
-	if (strpos($img, '<img') === 0) {
3699
-		if (!is_null($alt)) {
3700
-			$img = inserer_attribut($img, 'alt', $alt);
3701
-		}
3702
-		if (!is_null($class)) {
3703
-			if (strlen($class)) {
3704
-				$img = inserer_attribut($img, 'class', $class);
3705
-			}
3706
-			else {
3707
-				$img = vider_attribut($img, 'class');
3708
-			}
3709
-		}
3710
-	}
3711
-	else {
3712
-		$img = http_img_pack(
3713
-			$img,
3714
-			$alt,
3715
-			$class ? " class='" . attribut_html($class) . "'" : '',
3716
-			'',
3717
-			['chemin_image' => false, 'utiliser_suffixe_size' => false]
3718
-		);
3719
-		if (is_null($alt)) {
3720
-			$img = vider_attribut($img, 'alt');
3721
-		}
3722
-	}
3723
-
3724
-	if ($img and !is_null($size) and strlen($size = trim($size))) {
3725
-		[$width, $height] = helper_filtre_balise_img_svg_size($img, $size);
3726
-
3727
-		$img = inserer_attribut($img, 'width', $width);
3728
-		$img = inserer_attribut($img, 'height', $height);
3729
-	}
3730
-
3731
-	return $img;
3695
+    [$alt, $class, $size] = helper_filtre_balise_img_svg_arguments($alt, $class, $size);
3696
+
3697
+    $img = trim((string) $img);
3698
+    if (strpos($img, '<img') === 0) {
3699
+        if (!is_null($alt)) {
3700
+            $img = inserer_attribut($img, 'alt', $alt);
3701
+        }
3702
+        if (!is_null($class)) {
3703
+            if (strlen($class)) {
3704
+                $img = inserer_attribut($img, 'class', $class);
3705
+            }
3706
+            else {
3707
+                $img = vider_attribut($img, 'class');
3708
+            }
3709
+        }
3710
+    }
3711
+    else {
3712
+        $img = http_img_pack(
3713
+            $img,
3714
+            $alt,
3715
+            $class ? " class='" . attribut_html($class) . "'" : '',
3716
+            '',
3717
+            ['chemin_image' => false, 'utiliser_suffixe_size' => false]
3718
+        );
3719
+        if (is_null($alt)) {
3720
+            $img = vider_attribut($img, 'alt');
3721
+        }
3722
+    }
3723
+
3724
+    if ($img and !is_null($size) and strlen($size = trim($size))) {
3725
+        [$width, $height] = helper_filtre_balise_img_svg_size($img, $size);
3726
+
3727
+        $img = inserer_attribut($img, 'width', $width);
3728
+        $img = inserer_attribut($img, 'height', $height);
3729
+    }
3730
+
3731
+    return $img;
3732 3732
 }
3733 3733
 
3734 3734
 
@@ -3762,80 +3762,80 @@  discard block
 block discarded – undo
3762 3762
  */
3763 3763
 function filtre_balise_svg_dist($img, $alt = '', $class = null, $size = null) {
3764 3764
 
3765
-	$svg = null;
3766
-	$img = trim($img);
3767
-	$img_file = $img;
3768
-	if (strpos($img, '<svg') === false) {
3769
-		if ($p = strpos($img_file, '?')) {
3770
-			$img_file = substr($img_file, 0, $p);
3771
-		}
3772
-
3773
-		// ne jamais operer directement sur une image distante pour des raisons de perfo
3774
-		// la copie locale a toutes les chances d'etre la ou de resservir
3775
-		if (tester_url_absolue($img_file)) {
3776
-			include_spip('inc/distant');
3777
-			$fichier = copie_locale($img_file);
3778
-			$img_file = ($fichier ? _DIR_RACINE . $fichier : $img_file);
3779
-		}
3780
-
3781
-		if (
3782
-			!$img_file
3783
-			or !file_exists($img_file)
3784
-			or !$svg = file_get_contents($img_file)
3785
-		) {
3786
-			return '';
3787
-		}
3788
-	}
3789
-
3790
-	if (!preg_match(",<svg\b[^>]*>,UimsS", $svg, $match)) {
3791
-		return '';
3792
-	}
3793
-
3794
-	[$alt, $class, $size] = helper_filtre_balise_img_svg_arguments($alt, $class, $size);
3795
-
3796
-	$balise_svg = $match[0];
3797
-	$balise_svg_source = $balise_svg;
3798
-
3799
-	// entete XML à supprimer
3800
-	$svg = preg_replace(',^\s*<\?xml[^>]*\?' . '>,', '', $svg);
3801
-
3802
-	// IE est toujours mon ami
3803
-	$balise_svg = inserer_attribut($balise_svg, 'focusable', 'false');
3804
-
3805
-	// regler la classe
3806
-	if (!is_null($class)) {
3807
-		if (strlen($class)) {
3808
-			$balise_svg = inserer_attribut($balise_svg, 'class', $class);
3809
-		}
3810
-		else {
3811
-			$balise_svg = vider_attribut($balise_svg, 'class');
3812
-		}
3813
-	}
3814
-
3815
-	// regler le alt
3816
-	if ($alt) {
3817
-		$balise_svg = inserer_attribut($balise_svg, 'role', 'img');
3818
-		$id = 'img-svg-title-' . substr(md5("$img_file:$svg:$alt"), 0, 4);
3819
-		$balise_svg = inserer_attribut($balise_svg, 'aria-labelledby', $id);
3820
-		$title = "<title id=\"$id\">" . entites_html($alt) . "</title>\n";
3821
-		$balise_svg .= $title;
3822
-	}
3823
-	else {
3824
-		$balise_svg = inserer_attribut($balise_svg, 'aria-hidden', 'true');
3825
-	}
3826
-
3827
-	$svg = str_replace($balise_svg_source, $balise_svg, $svg);
3828
-
3829
-	if (!is_null($size) and strlen($size = trim($size))) {
3830
-		[$width, $height] = helper_filtre_balise_img_svg_size($svg, $size);
3831
-
3832
-		if (!function_exists('svg_redimensionner')) {
3833
-			include_spip('inc/svg');
3834
-		}
3835
-		$svg = svg_redimensionner($svg, $width, $height);
3836
-	}
3837
-
3838
-	return $svg;
3765
+    $svg = null;
3766
+    $img = trim($img);
3767
+    $img_file = $img;
3768
+    if (strpos($img, '<svg') === false) {
3769
+        if ($p = strpos($img_file, '?')) {
3770
+            $img_file = substr($img_file, 0, $p);
3771
+        }
3772
+
3773
+        // ne jamais operer directement sur une image distante pour des raisons de perfo
3774
+        // la copie locale a toutes les chances d'etre la ou de resservir
3775
+        if (tester_url_absolue($img_file)) {
3776
+            include_spip('inc/distant');
3777
+            $fichier = copie_locale($img_file);
3778
+            $img_file = ($fichier ? _DIR_RACINE . $fichier : $img_file);
3779
+        }
3780
+
3781
+        if (
3782
+            !$img_file
3783
+            or !file_exists($img_file)
3784
+            or !$svg = file_get_contents($img_file)
3785
+        ) {
3786
+            return '';
3787
+        }
3788
+    }
3789
+
3790
+    if (!preg_match(",<svg\b[^>]*>,UimsS", $svg, $match)) {
3791
+        return '';
3792
+    }
3793
+
3794
+    [$alt, $class, $size] = helper_filtre_balise_img_svg_arguments($alt, $class, $size);
3795
+
3796
+    $balise_svg = $match[0];
3797
+    $balise_svg_source = $balise_svg;
3798
+
3799
+    // entete XML à supprimer
3800
+    $svg = preg_replace(',^\s*<\?xml[^>]*\?' . '>,', '', $svg);
3801
+
3802
+    // IE est toujours mon ami
3803
+    $balise_svg = inserer_attribut($balise_svg, 'focusable', 'false');
3804
+
3805
+    // regler la classe
3806
+    if (!is_null($class)) {
3807
+        if (strlen($class)) {
3808
+            $balise_svg = inserer_attribut($balise_svg, 'class', $class);
3809
+        }
3810
+        else {
3811
+            $balise_svg = vider_attribut($balise_svg, 'class');
3812
+        }
3813
+    }
3814
+
3815
+    // regler le alt
3816
+    if ($alt) {
3817
+        $balise_svg = inserer_attribut($balise_svg, 'role', 'img');
3818
+        $id = 'img-svg-title-' . substr(md5("$img_file:$svg:$alt"), 0, 4);
3819
+        $balise_svg = inserer_attribut($balise_svg, 'aria-labelledby', $id);
3820
+        $title = "<title id=\"$id\">" . entites_html($alt) . "</title>\n";
3821
+        $balise_svg .= $title;
3822
+    }
3823
+    else {
3824
+        $balise_svg = inserer_attribut($balise_svg, 'aria-hidden', 'true');
3825
+    }
3826
+
3827
+    $svg = str_replace($balise_svg_source, $balise_svg, $svg);
3828
+
3829
+    if (!is_null($size) and strlen($size = trim($size))) {
3830
+        [$width, $height] = helper_filtre_balise_img_svg_size($svg, $size);
3831
+
3832
+        if (!function_exists('svg_redimensionner')) {
3833
+            include_spip('inc/svg');
3834
+        }
3835
+        $svg = svg_redimensionner($svg, $width, $height);
3836
+    }
3837
+
3838
+    return $svg;
3839 3839
 }
3840 3840
 
3841 3841
 
@@ -3861,18 +3861,18 @@  discard block
 block discarded – undo
3861 3861
  *     Code HTML résultant
3862 3862
  **/
3863 3863
 function filtre_foreach_dist($tableau, $modele = 'foreach') {
3864
-	$texte = '';
3865
-	if (is_array($tableau)) {
3866
-		foreach ($tableau as $k => $v) {
3867
-			$res = recuperer_fond(
3868
-				'modeles/' . $modele,
3869
-				array_merge(['cle' => $k], (is_array($v) ? $v : ['valeur' => $v]))
3870
-			);
3871
-			$texte .= $res;
3872
-		}
3873
-	}
3864
+    $texte = '';
3865
+    if (is_array($tableau)) {
3866
+        foreach ($tableau as $k => $v) {
3867
+            $res = recuperer_fond(
3868
+                'modeles/' . $modele,
3869
+                array_merge(['cle' => $k], (is_array($v) ? $v : ['valeur' => $v]))
3870
+            );
3871
+            $texte .= $res;
3872
+        }
3873
+    }
3874 3874
 
3875
-	return $texte;
3875
+    return $texte;
3876 3876
 }
3877 3877
 
3878 3878
 
@@ -3897,37 +3897,37 @@  discard block
 block discarded – undo
3897 3897
  *         - tout : retourne toutes les informations du plugin actif
3898 3898
  **/
3899 3899
 function filtre_info_plugin_dist($plugin, $type_info, $reload = false) {
3900
-	include_spip('inc/plugin');
3901
-	$plugin = strtoupper($plugin);
3902
-	$plugins_actifs = liste_plugin_actifs();
3903
-
3904
-	if (!$plugin) {
3905
-		return serialize(array_keys($plugins_actifs));
3906
-	} elseif (empty($plugins_actifs[$plugin]) and !$reload) {
3907
-		return '';
3908
-	} elseif (($type_info == 'est_actif') and !$reload) {
3909
-		return $plugins_actifs[$plugin] ? 1 : 0;
3910
-	} elseif (isset($plugins_actifs[$plugin][$type_info]) and !$reload) {
3911
-		return $plugins_actifs[$plugin][$type_info];
3912
-	} else {
3913
-		$get_infos = charger_fonction('get_infos', 'plugins');
3914
-		// On prend en compte les extensions
3915
-		if (!is_dir($plugins_actifs[$plugin]['dir_type'])) {
3916
-			$dir_plugins = constant($plugins_actifs[$plugin]['dir_type']);
3917
-		} else {
3918
-			$dir_plugins = $plugins_actifs[$plugin]['dir_type'];
3919
-		}
3920
-		if (!$infos = $get_infos($plugins_actifs[$plugin]['dir'], $reload, $dir_plugins)) {
3921
-			return '';
3922
-		}
3923
-		if ($type_info == 'tout') {
3924
-			return $infos;
3925
-		} elseif ($type_info == 'est_actif') {
3926
-			return $infos ? 1 : 0;
3927
-		} else {
3928
-			return strval($infos[$type_info]);
3929
-		}
3930
-	}
3900
+    include_spip('inc/plugin');
3901
+    $plugin = strtoupper($plugin);
3902
+    $plugins_actifs = liste_plugin_actifs();
3903
+
3904
+    if (!$plugin) {
3905
+        return serialize(array_keys($plugins_actifs));
3906
+    } elseif (empty($plugins_actifs[$plugin]) and !$reload) {
3907
+        return '';
3908
+    } elseif (($type_info == 'est_actif') and !$reload) {
3909
+        return $plugins_actifs[$plugin] ? 1 : 0;
3910
+    } elseif (isset($plugins_actifs[$plugin][$type_info]) and !$reload) {
3911
+        return $plugins_actifs[$plugin][$type_info];
3912
+    } else {
3913
+        $get_infos = charger_fonction('get_infos', 'plugins');
3914
+        // On prend en compte les extensions
3915
+        if (!is_dir($plugins_actifs[$plugin]['dir_type'])) {
3916
+            $dir_plugins = constant($plugins_actifs[$plugin]['dir_type']);
3917
+        } else {
3918
+            $dir_plugins = $plugins_actifs[$plugin]['dir_type'];
3919
+        }
3920
+        if (!$infos = $get_infos($plugins_actifs[$plugin]['dir'], $reload, $dir_plugins)) {
3921
+            return '';
3922
+        }
3923
+        if ($type_info == 'tout') {
3924
+            return $infos;
3925
+        } elseif ($type_info == 'est_actif') {
3926
+            return $infos ? 1 : 0;
3927
+        } else {
3928
+            return strval($infos[$type_info]);
3929
+        }
3930
+    }
3931 3931
 }
3932 3932
 
3933 3933
 
@@ -3954,9 +3954,9 @@  discard block
 block discarded – undo
3954 3954
  *     Code HTML de l'image de puce de statut à insérer (et du menu de changement si présent)
3955 3955
  */
3956 3956
 function puce_changement_statut($id_objet, $statut, $id_rubrique, $type, $ajax = false) {
3957
-	$puce_statut = charger_fonction('puce_statut', 'inc');
3957
+    $puce_statut = charger_fonction('puce_statut', 'inc');
3958 3958
 
3959
-	return $puce_statut($id_objet, $statut, $id_rubrique, $type, $ajax);
3959
+    return $puce_statut($id_objet, $statut, $id_rubrique, $type, $ajax);
3960 3960
 }
3961 3961
 
3962 3962
 
@@ -3986,19 +3986,19 @@  discard block
 block discarded – undo
3986 3986
  *     Code HTML de l'image de puce de statut à insérer (et du menu de changement si présent)
3987 3987
  */
3988 3988
 function filtre_puce_statut_dist($statut, $objet, $id_objet = 0, $id_parent = 0) {
3989
-	static $puce_statut = null;
3990
-	if (!$puce_statut) {
3991
-		$puce_statut = charger_fonction('puce_statut', 'inc');
3992
-	}
3989
+    static $puce_statut = null;
3990
+    if (!$puce_statut) {
3991
+        $puce_statut = charger_fonction('puce_statut', 'inc');
3992
+    }
3993 3993
 
3994
-	return $puce_statut(
3995
-		$id_objet,
3996
-		$statut,
3997
-		$id_parent,
3998
-		$objet,
3999
-		false,
4000
-		objet_info($objet, 'editable') ? _ACTIVER_PUCE_RAPIDE : false
4001
-	);
3994
+    return $puce_statut(
3995
+        $id_objet,
3996
+        $statut,
3997
+        $id_parent,
3998
+        $objet,
3999
+        false,
4000
+        objet_info($objet, 'editable') ? _ACTIVER_PUCE_RAPIDE : false
4001
+    );
4002 4002
 }
4003 4003
 
4004 4004
 
@@ -4025,98 +4025,98 @@  discard block
 block discarded – undo
4025 4025
  *   hash du contexte
4026 4026
  */
4027 4027
 function encoder_contexte_ajax($c, $form = '', $emboite = null, $ajaxid = '') {
4028
-	$env = null;
4029
-	if (
4030
-		is_string($c)
4031
-		and @unserialize($c) !== false
4032
-	) {
4033
-		$c = unserialize($c);
4034
-	}
4035
-
4036
-	// supprimer les parametres debut_x
4037
-	// pour que la pagination ajax ne soit pas plantee
4038
-	// si on charge la page &debut_x=1 : car alors en cliquant sur l'item 0,
4039
-	// le debut_x=0 n'existe pas, et on resterait sur 1
4040
-	if (is_array($c)) {
4041
-		foreach ($c as $k => $v) {
4042
-			if (strpos($k, 'debut_') === 0) {
4043
-				unset($c[$k]);
4044
-			}
4045
-		}
4046
-	}
4047
-
4048
-	if (!function_exists('calculer_cle_action')) {
4049
-		include_spip('inc/securiser_action');
4050
-	}
4051
-
4052
-	$c = serialize($c);
4053
-	$cle = calculer_cle_action($form . $c);
4054
-	$c = "$cle:$c";
4055
-
4056
-	// on ne stocke pas les contextes dans des fichiers en cache
4057
-	// par defaut, sauf si cette configuration a été forcée
4058
-	// OU que la longueur de l’argument géneré est plus long
4059
-	// que ce qui est toléré.
4060
-	$cache_contextes_ajax = (defined('_CACHE_CONTEXTES_AJAX') and _CACHE_CONTEXTES_AJAX);
4061
-	if (!$cache_contextes_ajax) {
4062
-		$env = $c;
4063
-		if (function_exists('gzdeflate') && function_exists('gzinflate')) {
4064
-			$env = gzdeflate($env);
4065
-		}
4066
-		$env = _xor($env);
4067
-		$env = base64_encode($env);
4068
-		$len = strlen($env);
4069
-		// Si l’url est trop longue pour le navigateur
4070
-		$max_len = _CACHE_CONTEXTES_AJAX_SUR_LONGUEUR;
4071
-		if ($len > $max_len) {
4072
-			$cache_contextes_ajax = true;
4073
-			spip_log(
4074
-				'Contextes AJAX forces en fichiers !'
4075
-				. ' Cela arrive lorsque la valeur du contexte'
4076
-				. " depasse la longueur maximale autorisee ($max_len). Ici : $len.",
4077
-				_LOG_AVERTISSEMENT
4078
-			);
4079
-		}
4080
-		// Sinon si Suhosin est actif et a une la valeur maximale des variables en GET...
4081
-		elseif (
4082
-			$max_len = @ini_get('suhosin.get.max_value_length')
4083
-			and $max_len < $len
4084
-		) {
4085
-			$cache_contextes_ajax = true;
4086
-			spip_log('Contextes AJAX forces en fichiers !'
4087
-				. ' Cela arrive lorsque la valeur du contexte'
4088
-				. ' depasse la longueur maximale autorisee par Suhosin'
4089
-				. " ($max_len) dans 'suhosin.get.max_value_length'. Ici : $len."
4090
-				. ' Vous devriez modifier les parametres de Suhosin'
4091
-				. ' pour accepter au moins 1024 caracteres.', _LOG_AVERTISSEMENT);
4092
-		}
4093
-	}
4094
-
4095
-	if ($cache_contextes_ajax) {
4096
-		$dir = sous_repertoire(_DIR_CACHE, 'contextes');
4097
-		// stocker les contextes sur disque et ne passer qu'un hash dans l'url
4098
-		$md5 = md5($c);
4099
-		ecrire_fichier("$dir/c$md5", $c);
4100
-		$env = $md5;
4101
-	}
4102
-
4103
-	if ($emboite === null) {
4104
-		return $env;
4105
-	}
4106
-	if (!trim($emboite)) {
4107
-		return '';
4108
-	}
4109
-	// toujours encoder l'url source dans le bloc ajax
4110
-	$r = self();
4111
-	$r = ' data-origin="' . $r . '"';
4112
-	$class = 'ajaxbloc';
4113
-	if ($ajaxid and is_string($ajaxid)) {
4114
-		// ajaxid est normalement conforme a un nom de classe css
4115
-		// on ne verifie pas la conformite, mais on passe entites_html par dessus par precaution
4116
-		$class .= ' ajax-id-' . entites_html($ajaxid);
4117
-	}
4118
-
4119
-	return "<div class='$class' " . "data-ajax-env='$env'$r>\n$emboite</div><!--ajaxbloc-->\n";
4028
+    $env = null;
4029
+    if (
4030
+        is_string($c)
4031
+        and @unserialize($c) !== false
4032
+    ) {
4033
+        $c = unserialize($c);
4034
+    }
4035
+
4036
+    // supprimer les parametres debut_x
4037
+    // pour que la pagination ajax ne soit pas plantee
4038
+    // si on charge la page &debut_x=1 : car alors en cliquant sur l'item 0,
4039
+    // le debut_x=0 n'existe pas, et on resterait sur 1
4040
+    if (is_array($c)) {
4041
+        foreach ($c as $k => $v) {
4042
+            if (strpos($k, 'debut_') === 0) {
4043
+                unset($c[$k]);
4044
+            }
4045
+        }
4046
+    }
4047
+
4048
+    if (!function_exists('calculer_cle_action')) {
4049
+        include_spip('inc/securiser_action');
4050
+    }
4051
+
4052
+    $c = serialize($c);
4053
+    $cle = calculer_cle_action($form . $c);
4054
+    $c = "$cle:$c";
4055
+
4056
+    // on ne stocke pas les contextes dans des fichiers en cache
4057
+    // par defaut, sauf si cette configuration a été forcée
4058
+    // OU que la longueur de l’argument géneré est plus long
4059
+    // que ce qui est toléré.
4060
+    $cache_contextes_ajax = (defined('_CACHE_CONTEXTES_AJAX') and _CACHE_CONTEXTES_AJAX);
4061
+    if (!$cache_contextes_ajax) {
4062
+        $env = $c;
4063
+        if (function_exists('gzdeflate') && function_exists('gzinflate')) {
4064
+            $env = gzdeflate($env);
4065
+        }
4066
+        $env = _xor($env);
4067
+        $env = base64_encode($env);
4068
+        $len = strlen($env);
4069
+        // Si l’url est trop longue pour le navigateur
4070
+        $max_len = _CACHE_CONTEXTES_AJAX_SUR_LONGUEUR;
4071
+        if ($len > $max_len) {
4072
+            $cache_contextes_ajax = true;
4073
+            spip_log(
4074
+                'Contextes AJAX forces en fichiers !'
4075
+                . ' Cela arrive lorsque la valeur du contexte'
4076
+                . " depasse la longueur maximale autorisee ($max_len). Ici : $len.",
4077
+                _LOG_AVERTISSEMENT
4078
+            );
4079
+        }
4080
+        // Sinon si Suhosin est actif et a une la valeur maximale des variables en GET...
4081
+        elseif (
4082
+            $max_len = @ini_get('suhosin.get.max_value_length')
4083
+            and $max_len < $len
4084
+        ) {
4085
+            $cache_contextes_ajax = true;
4086
+            spip_log('Contextes AJAX forces en fichiers !'
4087
+                . ' Cela arrive lorsque la valeur du contexte'
4088
+                . ' depasse la longueur maximale autorisee par Suhosin'
4089
+                . " ($max_len) dans 'suhosin.get.max_value_length'. Ici : $len."
4090
+                . ' Vous devriez modifier les parametres de Suhosin'
4091
+                . ' pour accepter au moins 1024 caracteres.', _LOG_AVERTISSEMENT);
4092
+        }
4093
+    }
4094
+
4095
+    if ($cache_contextes_ajax) {
4096
+        $dir = sous_repertoire(_DIR_CACHE, 'contextes');
4097
+        // stocker les contextes sur disque et ne passer qu'un hash dans l'url
4098
+        $md5 = md5($c);
4099
+        ecrire_fichier("$dir/c$md5", $c);
4100
+        $env = $md5;
4101
+    }
4102
+
4103
+    if ($emboite === null) {
4104
+        return $env;
4105
+    }
4106
+    if (!trim($emboite)) {
4107
+        return '';
4108
+    }
4109
+    // toujours encoder l'url source dans le bloc ajax
4110
+    $r = self();
4111
+    $r = ' data-origin="' . $r . '"';
4112
+    $class = 'ajaxbloc';
4113
+    if ($ajaxid and is_string($ajaxid)) {
4114
+        // ajaxid est normalement conforme a un nom de classe css
4115
+        // on ne verifie pas la conformite, mais on passe entites_html par dessus par precaution
4116
+        $class .= ' ajax-id-' . entites_html($ajaxid);
4117
+    }
4118
+
4119
+    return "<div class='$class' " . "data-ajax-env='$env'$r>\n$emboite</div><!--ajaxbloc-->\n";
4120 4120
 }
4121 4121
 
4122 4122
 /**
@@ -4136,37 +4136,37 @@  discard block
 block discarded – undo
4136 4136
  *   - false : erreur de décodage
4137 4137
  */
4138 4138
 function decoder_contexte_ajax($c, $form = '') {
4139
-	if (!function_exists('calculer_cle_action')) {
4140
-		include_spip('inc/securiser_action');
4141
-	}
4142
-	if (
4143
-		((defined('_CACHE_CONTEXTES_AJAX') and _CACHE_CONTEXTES_AJAX) or strlen($c) == 32)
4144
-		and $dir = sous_repertoire(_DIR_CACHE, 'contextes')
4145
-		and lire_fichier("$dir/c$c", $contexte)
4146
-	) {
4147
-		$c = $contexte;
4148
-	} else {
4149
-		$c = @base64_decode($c);
4150
-		$c = _xor($c);
4151
-		if (function_exists('gzdeflate') && function_exists('gzinflate')) {
4152
-			$c = @gzinflate($c);
4153
-		}
4154
-	}
4155
-
4156
-	// extraire la signature en debut de contexte
4157
-	// et la verifier avant de deserializer
4158
-	// format : signature:donneesserializees
4159
-	if ($p = strpos($c, ':')) {
4160
-		$cle = substr($c, 0, $p);
4161
-		$c = substr($c, $p + 1);
4162
-
4163
-		if ($cle == calculer_cle_action($form . $c)) {
4164
-			$env = @unserialize($c);
4165
-			return $env;
4166
-		}
4167
-	}
4168
-
4169
-	return false;
4139
+    if (!function_exists('calculer_cle_action')) {
4140
+        include_spip('inc/securiser_action');
4141
+    }
4142
+    if (
4143
+        ((defined('_CACHE_CONTEXTES_AJAX') and _CACHE_CONTEXTES_AJAX) or strlen($c) == 32)
4144
+        and $dir = sous_repertoire(_DIR_CACHE, 'contextes')
4145
+        and lire_fichier("$dir/c$c", $contexte)
4146
+    ) {
4147
+        $c = $contexte;
4148
+    } else {
4149
+        $c = @base64_decode($c);
4150
+        $c = _xor($c);
4151
+        if (function_exists('gzdeflate') && function_exists('gzinflate')) {
4152
+            $c = @gzinflate($c);
4153
+        }
4154
+    }
4155
+
4156
+    // extraire la signature en debut de contexte
4157
+    // et la verifier avant de deserializer
4158
+    // format : signature:donneesserializees
4159
+    if ($p = strpos($c, ':')) {
4160
+        $cle = substr($c, 0, $p);
4161
+        $c = substr($c, $p + 1);
4162
+
4163
+        if ($cle == calculer_cle_action($form . $c)) {
4164
+            $env = @unserialize($c);
4165
+            return $env;
4166
+        }
4167
+    }
4168
+
4169
+    return false;
4170 4170
 }
4171 4171
 
4172 4172
 
@@ -4184,20 +4184,20 @@  discard block
 block discarded – undo
4184 4184
  *    Message décrypté ou encrypté
4185 4185
  **/
4186 4186
 function _xor($message, $key = null) {
4187
-	if (is_null($key)) {
4188
-		if (!function_exists('calculer_cle_action')) {
4189
-			include_spip('inc/securiser_action');
4190
-		}
4191
-		$key = pack('H*', calculer_cle_action('_xor'));
4192
-	}
4187
+    if (is_null($key)) {
4188
+        if (!function_exists('calculer_cle_action')) {
4189
+            include_spip('inc/securiser_action');
4190
+        }
4191
+        $key = pack('H*', calculer_cle_action('_xor'));
4192
+    }
4193 4193
 
4194
-	$keylen = strlen($key);
4195
-	$messagelen = strlen($message);
4196
-	for ($i = 0; $i < $messagelen; $i++) {
4197
-		$message[$i] = ~($message[$i] ^ $key[$i % $keylen]);
4198
-	}
4194
+    $keylen = strlen($key);
4195
+    $messagelen = strlen($message);
4196
+    for ($i = 0; $i < $messagelen; $i++) {
4197
+        $message[$i] = ~($message[$i] ^ $key[$i % $keylen]);
4198
+    }
4199 4199
 
4200
-	return $message;
4200
+    return $message;
4201 4201
 }
4202 4202
 
4203 4203
 /**
@@ -4211,7 +4211,7 @@  discard block
 block discarded – undo
4211 4211
  * @return string
4212 4212
  */
4213 4213
 function url_reponse_forum($texte) {
4214
- return $texte;
4214
+    return $texte;
4215 4215
 }
4216 4216
 
4217 4217
 /**
@@ -4225,7 +4225,7 @@  discard block
 block discarded – undo
4225 4225
  * @return string
4226 4226
  */
4227 4227
 function url_rss_forum($texte) {
4228
- return $texte;
4228
+    return $texte;
4229 4229
 }
4230 4230
 
4231 4231
 
@@ -4264,37 +4264,37 @@  discard block
 block discarded – undo
4264 4264
  *   Code HTML
4265 4265
  */
4266 4266
 function lien_ou_expose($url, $libelle = null, $on = false, $class = '', $title = '', $rel = '', $evt = '') {
4267
-	if ($on) {
4268
-		$bal = 'strong';
4269
-		$class = '';
4270
-		$att = '';
4271
-		// si $on passe la balise et optionnelement une ou ++classe
4272
-		// a.active span.selected.active etc....
4273
-		if (is_string($on) and (strncmp($on, 'a', 1) == 0 or strncmp($on, 'span', 4) == 0 or strncmp($on, 'strong', 6) == 0)) {
4274
-			$on = explode('.', $on);
4275
-			// on verifie que c'est exactement une des 3 balises a, span ou strong
4276
-			if (in_array(reset($on), ['a', 'span', 'strong'])) {
4277
-				$bal = array_shift($on);
4278
-				$class = implode(' ', $on);
4279
-				if ($bal == 'a') {
4280
-					$att = 'href="#" ';
4281
-				}
4282
-			}
4283
-		}
4284
-		$att .= 'class="' . ($class ? attribut_html($class) . ' ' : '') . (defined('_LIEN_OU_EXPOSE_CLASS_ON') ? _LIEN_OU_EXPOSE_CLASS_ON : 'on') . '"';
4285
-	} else {
4286
-		$bal = 'a';
4287
-		$att = "href='$url'"
4288
-			. ($title ? " title='" . attribut_html($title) . "'" : '')
4289
-			. ($class ? " class='" . attribut_html($class) . "'" : '')
4290
-			. ($rel ? " rel='" . attribut_html($rel) . "'" : '')
4291
-			. $evt;
4292
-	}
4293
-	if ($libelle === null) {
4294
-		$libelle = $url;
4295
-	}
4296
-
4297
-	return "<$bal $att>$libelle</$bal>";
4267
+    if ($on) {
4268
+        $bal = 'strong';
4269
+        $class = '';
4270
+        $att = '';
4271
+        // si $on passe la balise et optionnelement une ou ++classe
4272
+        // a.active span.selected.active etc....
4273
+        if (is_string($on) and (strncmp($on, 'a', 1) == 0 or strncmp($on, 'span', 4) == 0 or strncmp($on, 'strong', 6) == 0)) {
4274
+            $on = explode('.', $on);
4275
+            // on verifie que c'est exactement une des 3 balises a, span ou strong
4276
+            if (in_array(reset($on), ['a', 'span', 'strong'])) {
4277
+                $bal = array_shift($on);
4278
+                $class = implode(' ', $on);
4279
+                if ($bal == 'a') {
4280
+                    $att = 'href="#" ';
4281
+                }
4282
+            }
4283
+        }
4284
+        $att .= 'class="' . ($class ? attribut_html($class) . ' ' : '') . (defined('_LIEN_OU_EXPOSE_CLASS_ON') ? _LIEN_OU_EXPOSE_CLASS_ON : 'on') . '"';
4285
+    } else {
4286
+        $bal = 'a';
4287
+        $att = "href='$url'"
4288
+            . ($title ? " title='" . attribut_html($title) . "'" : '')
4289
+            . ($class ? " class='" . attribut_html($class) . "'" : '')
4290
+            . ($rel ? " rel='" . attribut_html($rel) . "'" : '')
4291
+            . $evt;
4292
+    }
4293
+    if ($libelle === null) {
4294
+        $libelle = $url;
4295
+    }
4296
+
4297
+    return "<$bal $att>$libelle</$bal>";
4298 4298
 }
4299 4299
 
4300 4300
 
@@ -4311,39 +4311,39 @@  discard block
 block discarded – undo
4311 4311
  * @return string : la chaine de langue finale en utilisant la fonction _T()
4312 4312
  */
4313 4313
 function singulier_ou_pluriel($nb, $chaine_un, $chaine_plusieurs, $var = 'nb', $vars = []) {
4314
-	static $local_singulier_ou_pluriel = [];
4315
-
4316
-	// si nb=0 ou pas de $vars valide on retourne une chaine vide, a traiter par un |sinon
4317
-	if (!is_numeric($nb) or $nb == 0) {
4318
-		return '';
4319
-	}
4320
-	if (!is_array($vars)) {
4321
-		return '';
4322
-	}
4323
-
4324
-	$langue = $GLOBALS['spip_lang'];
4325
-	if (!isset($local_singulier_ou_pluriel[$langue])) {
4326
-		$local_singulier_ou_pluriel[$langue] = false;
4327
-		if (
4328
-			$f = charger_fonction("singulier_ou_pluriel_{$langue}", 'inc', true)
4329
-			or $f = charger_fonction('singulier_ou_pluriel', 'inc', true)
4330
-		) {
4331
-			$local_singulier_ou_pluriel[$langue] = $f;
4332
-		}
4333
-	}
4334
-
4335
-	// si on a une surcharge on l'utilise
4336
-	if ($local_singulier_ou_pluriel[$langue]) {
4337
-		return ($local_singulier_ou_pluriel[$langue])($nb, $chaine_un, $chaine_plusieurs, $var, $vars);
4338
-	}
4339
-
4340
-	// sinon traitement par defaut
4341
-	$vars[$var] = $nb;
4342
-	if ($nb >= 2) {
4343
-		return _T($chaine_plusieurs, $vars);
4344
-	} else {
4345
-		return _T($chaine_un, $vars);
4346
-	}
4314
+    static $local_singulier_ou_pluriel = [];
4315
+
4316
+    // si nb=0 ou pas de $vars valide on retourne une chaine vide, a traiter par un |sinon
4317
+    if (!is_numeric($nb) or $nb == 0) {
4318
+        return '';
4319
+    }
4320
+    if (!is_array($vars)) {
4321
+        return '';
4322
+    }
4323
+
4324
+    $langue = $GLOBALS['spip_lang'];
4325
+    if (!isset($local_singulier_ou_pluriel[$langue])) {
4326
+        $local_singulier_ou_pluriel[$langue] = false;
4327
+        if (
4328
+            $f = charger_fonction("singulier_ou_pluriel_{$langue}", 'inc', true)
4329
+            or $f = charger_fonction('singulier_ou_pluriel', 'inc', true)
4330
+        ) {
4331
+            $local_singulier_ou_pluriel[$langue] = $f;
4332
+        }
4333
+    }
4334
+
4335
+    // si on a une surcharge on l'utilise
4336
+    if ($local_singulier_ou_pluriel[$langue]) {
4337
+        return ($local_singulier_ou_pluriel[$langue])($nb, $chaine_un, $chaine_plusieurs, $var, $vars);
4338
+    }
4339
+
4340
+    // sinon traitement par defaut
4341
+    $vars[$var] = $nb;
4342
+    if ($nb >= 2) {
4343
+        return _T($chaine_plusieurs, $vars);
4344
+    } else {
4345
+        return _T($chaine_un, $vars);
4346
+    }
4347 4347
 }
4348 4348
 
4349 4349
 
@@ -4371,73 +4371,73 @@  discard block
 block discarded – undo
4371 4371
  */
4372 4372
 function prepare_icone_base($type, $lien, $texte, $fond, $fonction = '', $class = '', $javascript = '') {
4373 4373
 
4374
-	$class_lien = $class_bouton = $class;
4375
-
4376
-	// Normaliser la fonction et compléter la classe en fonction
4377
-	if (in_array($fonction, ['del', 'supprimer.gif'])) {
4378
-		$class_lien .= ' danger';
4379
-		$class_bouton .= ' btn_danger';
4380
-	} elseif ($fonction == 'rien.gif') {
4381
-		$fonction = '';
4382
-	} elseif ($fonction == 'delsafe') {
4383
-		$fonction = 'del';
4384
-	}
4385
-
4386
-	$fond_origine = $fond;
4387
-	// Remappage des icone : article-24.png+new => article-new-24.png
4388
-	if ($icone_renommer = charger_fonction('icone_renommer', 'inc', true)) {
4389
-		[$fond, $fonction] = $icone_renommer($fond, $fonction);
4390
-	}
4391
-
4392
-	// Ajouter le type d'objet dans la classe
4393
-	$objet_type = substr(basename($fond), 0, -4);
4394
-	$class_lien .= " $objet_type";
4395
-	$class_bouton .= " $objet_type";
4396
-
4397
-	// Texte
4398
-	$alt = attribut_html($texte);
4399
-	$title = " title=\"$alt\""; // est-ce pertinent de doubler le alt par un title ?
4400
-
4401
-	// Liens : préparer les classes ajax
4402
-	$ajax = '';
4403
-	if ($type === 'lien') {
4404
-		if (strpos($class_lien, 'ajax') !== false) {
4405
-			$ajax = 'ajax';
4406
-			if (strpos($class_lien, 'preload') !== false) {
4407
-				$ajax .= ' preload';
4408
-			}
4409
-			if (strpos($class_lien, 'nocache') !== false) {
4410
-				$ajax .= ' nocache';
4411
-			}
4412
-			$ajax = " class='$ajax'";
4413
-		}
4414
-	}
4415
-
4416
-	// Repérer la taille et l'ajouter dans la classe
4417
-	$size = 24;
4418
-	if (
4419
-		preg_match('/-([0-9]{1,3})[.](gif|png|svg)$/i', $fond, $match)
4420
-		or preg_match('/-([0-9]{1,3})([.](gif|png|svg))?$/i', $fond_origine, $match)
4421
-	) {
4422
-		$size = $match[1];
4423
-	}
4424
-	$class_lien .= " s$size";
4425
-	$class_bouton .= " s$size";
4426
-
4427
-	// Icône
4428
-	$icone = http_img_pack($fond, $alt, "width='$size' height='$size'");
4429
-	$icone = '<span class="icone-image' . ($fonction ? " icone-fonction icone-fonction-$fonction" : '') . "\">$icone</span>";
4430
-
4431
-	// Markup final
4432
-	if ($type == 'lien') {
4433
-		return "<span class='icone $class_lien'>"
4434
-		. "<a href='$lien'$title$ajax$javascript>"
4435
-		. $icone
4436
-		. "<b>$texte</b>"
4437
-		. "</a></span>\n";
4438
-	} else {
4439
-		return bouton_action("$icone $texte", $lien, $class_bouton, $javascript, $alt);
4440
-	}
4374
+    $class_lien = $class_bouton = $class;
4375
+
4376
+    // Normaliser la fonction et compléter la classe en fonction
4377
+    if (in_array($fonction, ['del', 'supprimer.gif'])) {
4378
+        $class_lien .= ' danger';
4379
+        $class_bouton .= ' btn_danger';
4380
+    } elseif ($fonction == 'rien.gif') {
4381
+        $fonction = '';
4382
+    } elseif ($fonction == 'delsafe') {
4383
+        $fonction = 'del';
4384
+    }
4385
+
4386
+    $fond_origine = $fond;
4387
+    // Remappage des icone : article-24.png+new => article-new-24.png
4388
+    if ($icone_renommer = charger_fonction('icone_renommer', 'inc', true)) {
4389
+        [$fond, $fonction] = $icone_renommer($fond, $fonction);
4390
+    }
4391
+
4392
+    // Ajouter le type d'objet dans la classe
4393
+    $objet_type = substr(basename($fond), 0, -4);
4394
+    $class_lien .= " $objet_type";
4395
+    $class_bouton .= " $objet_type";
4396
+
4397
+    // Texte
4398
+    $alt = attribut_html($texte);
4399
+    $title = " title=\"$alt\""; // est-ce pertinent de doubler le alt par un title ?
4400
+
4401
+    // Liens : préparer les classes ajax
4402
+    $ajax = '';
4403
+    if ($type === 'lien') {
4404
+        if (strpos($class_lien, 'ajax') !== false) {
4405
+            $ajax = 'ajax';
4406
+            if (strpos($class_lien, 'preload') !== false) {
4407
+                $ajax .= ' preload';
4408
+            }
4409
+            if (strpos($class_lien, 'nocache') !== false) {
4410
+                $ajax .= ' nocache';
4411
+            }
4412
+            $ajax = " class='$ajax'";
4413
+        }
4414
+    }
4415
+
4416
+    // Repérer la taille et l'ajouter dans la classe
4417
+    $size = 24;
4418
+    if (
4419
+        preg_match('/-([0-9]{1,3})[.](gif|png|svg)$/i', $fond, $match)
4420
+        or preg_match('/-([0-9]{1,3})([.](gif|png|svg))?$/i', $fond_origine, $match)
4421
+    ) {
4422
+        $size = $match[1];
4423
+    }
4424
+    $class_lien .= " s$size";
4425
+    $class_bouton .= " s$size";
4426
+
4427
+    // Icône
4428
+    $icone = http_img_pack($fond, $alt, "width='$size' height='$size'");
4429
+    $icone = '<span class="icone-image' . ($fonction ? " icone-fonction icone-fonction-$fonction" : '') . "\">$icone</span>";
4430
+
4431
+    // Markup final
4432
+    if ($type == 'lien') {
4433
+        return "<span class='icone $class_lien'>"
4434
+        . "<a href='$lien'$title$ajax$javascript>"
4435
+        . $icone
4436
+        . "<b>$texte</b>"
4437
+        . "</a></span>\n";
4438
+    } else {
4439
+        return bouton_action("$icone $texte", $lien, $class_bouton, $javascript, $alt);
4440
+    }
4441 4441
 }
4442 4442
 
4443 4443
 /**
@@ -4461,7 +4461,7 @@  discard block
 block discarded – undo
4461 4461
  *     Code HTML du lien
4462 4462
  **/
4463 4463
 function icone_base($lien, $texte, $fond, $fonction = '', $class = '', $javascript = '') {
4464
-	return prepare_icone_base('lien', $lien, $texte, $fond, $fonction, $class, $javascript);
4464
+    return prepare_icone_base('lien', $lien, $texte, $fond, $fonction, $class, $javascript);
4465 4465
 }
4466 4466
 
4467 4467
 /**
@@ -4496,7 +4496,7 @@  discard block
 block discarded – undo
4496 4496
  *     Code HTML du lien
4497 4497
  **/
4498 4498
 function filtre_icone_verticale_dist($lien, $texte, $fond, $fonction = '', $class = '', $javascript = '') {
4499
-	return icone_base($lien, $texte, $fond, $fonction, "verticale $class", $javascript);
4499
+    return icone_base($lien, $texte, $fond, $fonction, "verticale $class", $javascript);
4500 4500
 }
4501 4501
 
4502 4502
 /**
@@ -4541,7 +4541,7 @@  discard block
 block discarded – undo
4541 4541
  *     Code HTML du lien
4542 4542
  **/
4543 4543
 function filtre_icone_horizontale_dist($lien, $texte, $fond, $fonction = '', $class = '', $javascript = '') {
4544
-	return icone_base($lien, $texte, $fond, $fonction, "horizontale $class", $javascript);
4544
+    return icone_base($lien, $texte, $fond, $fonction, "horizontale $class", $javascript);
4545 4545
 }
4546 4546
 
4547 4547
 /**
@@ -4572,7 +4572,7 @@  discard block
 block discarded – undo
4572 4572
  *     Code HTML du lien
4573 4573
  **/
4574 4574
 function filtre_bouton_action_horizontal_dist($lien, $texte, $fond, $fonction = '', $class = '', $confirm = '') {
4575
-	return prepare_icone_base('bouton', $lien, $texte, $fond, $fonction, $class, $confirm);
4575
+    return prepare_icone_base('bouton', $lien, $texte, $fond, $fonction, $class, $confirm);
4576 4576
 }
4577 4577
 
4578 4578
 /**
@@ -4603,7 +4603,7 @@  discard block
 block discarded – undo
4603 4603
  *     Code HTML du lien
4604 4604
  */
4605 4605
 function filtre_icone_dist($lien, $texte, $fond, $align = '', $fonction = '', $class = '', $javascript = '') {
4606
-	return icone_base($lien, $texte, $fond, $fonction, "verticale $align $class", $javascript);
4606
+    return icone_base($lien, $texte, $fond, $fonction, "verticale $align $class", $javascript);
4607 4607
 }
4608 4608
 
4609 4609
 
@@ -4625,7 +4625,7 @@  discard block
 block discarded – undo
4625 4625
  * @return array Liste des éléments
4626 4626
  */
4627 4627
 function filtre_explode_dist($a, $b) {
4628
-	return explode($b, (string) $a);
4628
+    return explode($b, (string) $a);
4629 4629
 }
4630 4630
 
4631 4631
 /**
@@ -4646,7 +4646,7 @@  discard block
 block discarded – undo
4646 4646
  * @return string Texte
4647 4647
  */
4648 4648
 function filtre_implode_dist($a, $b) {
4649
-	return is_array($a) ? implode($b, $a) : $a;
4649
+    return is_array($a) ? implode($b, $a) : $a;
4650 4650
 }
4651 4651
 
4652 4652
 /**
@@ -4655,22 +4655,22 @@  discard block
 block discarded – undo
4655 4655
  * @return string Code CSS
4656 4656
  */
4657 4657
 function bando_images_background() {
4658
-	include_spip('inc/bandeau');
4659
-	// recuperer tous les boutons et leurs images
4660
-	$boutons = definir_barre_boutons(definir_barre_contexte(), true, false);
4658
+    include_spip('inc/bandeau');
4659
+    // recuperer tous les boutons et leurs images
4660
+    $boutons = definir_barre_boutons(definir_barre_contexte(), true, false);
4661 4661
 
4662
-	$res = '';
4663
-	foreach ($boutons as $page => $detail) {
4664
-		$selecteur = (in_array($page, ['outils_rapides', 'outils_collaboratifs']) ? '' : '.navigation_avec_icones ');
4665
-		foreach ($detail->sousmenu as $souspage => $sousdetail) {
4666
-			if ($sousdetail->icone and strlen(trim($sousdetail->icone))) {
4667
-				$img = http_img_variante_svg_si_possible($sousdetail->icone);
4668
-				$res .= "\n$selecteur.bando2_$souspage {background-image:url($img);}";
4669
-			}
4670
-		}
4671
-	}
4662
+    $res = '';
4663
+    foreach ($boutons as $page => $detail) {
4664
+        $selecteur = (in_array($page, ['outils_rapides', 'outils_collaboratifs']) ? '' : '.navigation_avec_icones ');
4665
+        foreach ($detail->sousmenu as $souspage => $sousdetail) {
4666
+            if ($sousdetail->icone and strlen(trim($sousdetail->icone))) {
4667
+                $img = http_img_variante_svg_si_possible($sousdetail->icone);
4668
+                $res .= "\n$selecteur.bando2_$souspage {background-image:url($img);}";
4669
+            }
4670
+        }
4671
+    }
4672 4672
 
4673
-	return $res;
4673
+    return $res;
4674 4674
 }
4675 4675
 
4676 4676
 /**
@@ -4695,27 +4695,27 @@  discard block
 block discarded – undo
4695 4695
  */
4696 4696
 function bouton_action($libelle, $url, $class = '', $confirm = '', $title = '', $callback = '') {
4697 4697
 
4698
-	// Classes : dispatcher `ajax` sur le formulaire
4699
-	$class_form = '';
4700
-	if (strpos($class, 'ajax') !== false) {
4701
-		$class_form = 'ajax';
4702
-		$class = str_replace('ajax', '', $class);
4703
-	}
4704
-	$class_btn = 'submit ' . trim($class);
4698
+    // Classes : dispatcher `ajax` sur le formulaire
4699
+    $class_form = '';
4700
+    if (strpos($class, 'ajax') !== false) {
4701
+        $class_form = 'ajax';
4702
+        $class = str_replace('ajax', '', $class);
4703
+    }
4704
+    $class_btn = 'submit ' . trim($class);
4705 4705
 
4706
-	if ($confirm) {
4707
-		$confirm = 'confirm("' . attribut_html($confirm) . '")';
4708
-		if ($callback) {
4709
-			$callback = "$confirm?($callback):false";
4710
-		} else {
4711
-			$callback = $confirm;
4712
-		}
4713
-	}
4714
-	$onclick = $callback ? " onclick='return " . addcslashes($callback, "'") . "'" : '';
4715
-	$title = $title ? " title='$title'" : '';
4706
+    if ($confirm) {
4707
+        $confirm = 'confirm("' . attribut_html($confirm) . '")';
4708
+        if ($callback) {
4709
+            $callback = "$confirm?($callback):false";
4710
+        } else {
4711
+            $callback = $confirm;
4712
+        }
4713
+    }
4714
+    $onclick = $callback ? " onclick='return " . addcslashes($callback, "'") . "'" : '';
4715
+    $title = $title ? " title='$title'" : '';
4716 4716
 
4717
-	return "<form class='bouton_action_post $class_form' method='post' action='$url'><div>" . form_hidden($url)
4718
-	. "<button type='submit' class='$class_btn'$title$onclick>$libelle</button></div></form>";
4717
+    return "<form class='bouton_action_post $class_form' method='post' action='$url'><div>" . form_hidden($url)
4718
+    . "<button type='submit' class='$class_btn'$title$onclick>$libelle</button></div></form>";
4719 4719
 }
4720 4720
 
4721 4721
 /**
@@ -4738,101 +4738,101 @@  discard block
 block discarded – undo
4738 4738
  * @return string
4739 4739
  */
4740 4740
 function generer_objet_info($id_objet, string $type_objet, string $info, string $etoile = '', array $params = []): string {
4741
-	static $trouver_table = null;
4742
-	static $objets;
4743
-
4744
-	// On verifie qu'on a tout ce qu'il faut
4745
-	$id_objet = intval($id_objet);
4746
-	if (!($id_objet and $type_objet and $info)) {
4747
-		return '';
4748
-	}
4749
-
4750
-	// si on a deja note que l'objet n'existe pas, ne pas aller plus loin
4751
-	if (isset($objets[$type_objet]) and $objets[$type_objet] === false) {
4752
-		return '';
4753
-	}
4754
-
4755
-	// Si on demande l'url, on retourne direct la fonction
4756
-	if ($info == 'url') {
4757
-		return generer_objet_url($id_objet, $type_objet, ...$params);
4758
-	}
4759
-
4760
-	// Sinon on va tout chercher dans la table et on garde en memoire
4761
-	$demande_titre = ($info === 'titre');
4762
-	$demande_introduction = ($info === 'introduction');
4763
-
4764
-	// On ne fait la requete que si on a pas deja l'objet ou si on demande le titre mais qu'on ne l'a pas encore
4765
-	if (
4766
-		!isset($objets[$type_objet][$id_objet])
4767
-		or
4768
-		($demande_titre and !isset($objets[$type_objet][$id_objet]['titre']))
4769
-	) {
4770
-		if (!$trouver_table) {
4771
-			$trouver_table = charger_fonction('trouver_table', 'base');
4772
-		}
4773
-		$desc = $trouver_table(table_objet_sql($type_objet));
4774
-		if (!$desc) {
4775
-			return $objets[$type_objet] = false;
4776
-		}
4777
-
4778
-		// Si on demande le titre, on le gere en interne
4779
-		$champ_titre = '';
4780
-		if ($demande_titre) {
4781
-			// si pas de titre declare mais champ titre, il sera peuple par le select *
4782
-			$champ_titre = (!empty($desc['titre'])) ? ', ' . $desc['titre'] : '';
4783
-		}
4784
-		include_spip('base/abstract_sql');
4785
-		include_spip('base/connect_sql');
4786
-		$objets[$type_objet][$id_objet] = sql_fetsel(
4787
-			'*' . $champ_titre,
4788
-			$desc['table_sql'],
4789
-			id_table_objet($type_objet) . ' = ' . intval($id_objet)
4790
-		);
4791
-
4792
-		// Toujours noter la longueur d'introduction, même si pas demandé cette fois-ci
4793
-		$objets[$type_objet]['introduction_longueur'] = $desc['introduction_longueur'] ?? null;
4794
-	}
4795
-
4796
-	// Pour les fonction generer_xxx, si on demande l'introduction,
4797
-	// ajouter la longueur au début des params supplémentaires
4798
-	if ($demande_introduction) {
4799
-		$introduction_longueur = $objets[$type_objet]['introduction_longueur'];
4800
-		array_unshift($params, $introduction_longueur);
4801
-	}
4802
-
4803
-	// Si la fonction generer_TYPE_TRUC existe, on l'utilise pour formater $info_generee
4804
-	if (
4805
-		$generer = charger_fonction("generer_{$type_objet}_{$info}", '', true)
4806
-		// @deprecated 4.1 generer_TRUC_TYPE
4807
-		or $generer = charger_fonction("generer_{$info}_{$type_objet}", '', true)
4808
-	) {
4809
-		$info_generee = $generer($id_objet, $objets[$type_objet][$id_objet], ...$params);
4810
-	}
4811
-	// Si la fonction generer_objet_TRUC existe, on l'utilise pour formater $info_generee
4812
-	elseif (
4813
-		$generer = charger_fonction("generer_objet_{$info}", '', true)
4814
-		// @deprecated 4.1 generer_TRUC_entite
4815
-		or $generer = charger_fonction("generer_{$info}_entite", '', true)
4816
-	) {
4817
-		$info_generee = $generer($id_objet, $type_objet, $objets[$type_objet][$id_objet], ...$params);
4818
-	} // Sinon on prend directement le champ SQL tel quel
4819
-	else {
4820
-		$info_generee = ($objets[$type_objet][$id_objet][$info] ?? '');
4821
-	}
4822
-
4823
-	// On va ensuite appliquer les traitements automatiques si besoin
4824
-	if (!$etoile) {
4825
-		// FIXME: on fournit un ENV minimum avec id et type et connect=''
4826
-		// mais ce fonctionnement est a ameliorer !
4827
-		$info_generee = appliquer_traitement_champ(
4828
-			$info_generee,
4829
-			$info,
4830
-			table_objet($type_objet),
4831
-			['id_objet' => $id_objet, 'objet' => $type_objet, '']
4832
-		);
4833
-	}
4834
-
4835
-	return $info_generee;
4741
+    static $trouver_table = null;
4742
+    static $objets;
4743
+
4744
+    // On verifie qu'on a tout ce qu'il faut
4745
+    $id_objet = intval($id_objet);
4746
+    if (!($id_objet and $type_objet and $info)) {
4747
+        return '';
4748
+    }
4749
+
4750
+    // si on a deja note que l'objet n'existe pas, ne pas aller plus loin
4751
+    if (isset($objets[$type_objet]) and $objets[$type_objet] === false) {
4752
+        return '';
4753
+    }
4754
+
4755
+    // Si on demande l'url, on retourne direct la fonction
4756
+    if ($info == 'url') {
4757
+        return generer_objet_url($id_objet, $type_objet, ...$params);
4758
+    }
4759
+
4760
+    // Sinon on va tout chercher dans la table et on garde en memoire
4761
+    $demande_titre = ($info === 'titre');
4762
+    $demande_introduction = ($info === 'introduction');
4763
+
4764
+    // On ne fait la requete que si on a pas deja l'objet ou si on demande le titre mais qu'on ne l'a pas encore
4765
+    if (
4766
+        !isset($objets[$type_objet][$id_objet])
4767
+        or
4768
+        ($demande_titre and !isset($objets[$type_objet][$id_objet]['titre']))
4769
+    ) {
4770
+        if (!$trouver_table) {
4771
+            $trouver_table = charger_fonction('trouver_table', 'base');
4772
+        }
4773
+        $desc = $trouver_table(table_objet_sql($type_objet));
4774
+        if (!$desc) {
4775
+            return $objets[$type_objet] = false;
4776
+        }
4777
+
4778
+        // Si on demande le titre, on le gere en interne
4779
+        $champ_titre = '';
4780
+        if ($demande_titre) {
4781
+            // si pas de titre declare mais champ titre, il sera peuple par le select *
4782
+            $champ_titre = (!empty($desc['titre'])) ? ', ' . $desc['titre'] : '';
4783
+        }
4784
+        include_spip('base/abstract_sql');
4785
+        include_spip('base/connect_sql');
4786
+        $objets[$type_objet][$id_objet] = sql_fetsel(
4787
+            '*' . $champ_titre,
4788
+            $desc['table_sql'],
4789
+            id_table_objet($type_objet) . ' = ' . intval($id_objet)
4790
+        );
4791
+
4792
+        // Toujours noter la longueur d'introduction, même si pas demandé cette fois-ci
4793
+        $objets[$type_objet]['introduction_longueur'] = $desc['introduction_longueur'] ?? null;
4794
+    }
4795
+
4796
+    // Pour les fonction generer_xxx, si on demande l'introduction,
4797
+    // ajouter la longueur au début des params supplémentaires
4798
+    if ($demande_introduction) {
4799
+        $introduction_longueur = $objets[$type_objet]['introduction_longueur'];
4800
+        array_unshift($params, $introduction_longueur);
4801
+    }
4802
+
4803
+    // Si la fonction generer_TYPE_TRUC existe, on l'utilise pour formater $info_generee
4804
+    if (
4805
+        $generer = charger_fonction("generer_{$type_objet}_{$info}", '', true)
4806
+        // @deprecated 4.1 generer_TRUC_TYPE
4807
+        or $generer = charger_fonction("generer_{$info}_{$type_objet}", '', true)
4808
+    ) {
4809
+        $info_generee = $generer($id_objet, $objets[$type_objet][$id_objet], ...$params);
4810
+    }
4811
+    // Si la fonction generer_objet_TRUC existe, on l'utilise pour formater $info_generee
4812
+    elseif (
4813
+        $generer = charger_fonction("generer_objet_{$info}", '', true)
4814
+        // @deprecated 4.1 generer_TRUC_entite
4815
+        or $generer = charger_fonction("generer_{$info}_entite", '', true)
4816
+    ) {
4817
+        $info_generee = $generer($id_objet, $type_objet, $objets[$type_objet][$id_objet], ...$params);
4818
+    } // Sinon on prend directement le champ SQL tel quel
4819
+    else {
4820
+        $info_generee = ($objets[$type_objet][$id_objet][$info] ?? '');
4821
+    }
4822
+
4823
+    // On va ensuite appliquer les traitements automatiques si besoin
4824
+    if (!$etoile) {
4825
+        // FIXME: on fournit un ENV minimum avec id et type et connect=''
4826
+        // mais ce fonctionnement est a ameliorer !
4827
+        $info_generee = appliquer_traitement_champ(
4828
+            $info_generee,
4829
+            $info,
4830
+            table_objet($type_objet),
4831
+            ['id_objet' => $id_objet, 'objet' => $type_objet, '']
4832
+        );
4833
+    }
4834
+
4835
+    return $info_generee;
4836 4836
 }
4837 4837
 
4838 4838
 /**
@@ -4840,7 +4840,7 @@  discard block
 block discarded – undo
4840 4840
  * @see generer_objet_info
4841 4841
  */
4842 4842
 function generer_info_entite($id_objet, $type_objet, $info, $etoile = '', $params = []) {
4843
-	return generer_objet_info(intval($id_objet), $type_objet, $info, $etoile, $params);
4843
+    return generer_objet_info(intval($id_objet), $type_objet, $info, $etoile, $params);
4844 4844
 }
4845 4845
 
4846 4846
 /**
@@ -4873,36 +4873,36 @@  discard block
 block discarded – undo
4873 4873
  */
4874 4874
 function generer_objet_introduction(int $id_objet, string $type_objet, array $ligne_sql, ?int $introduction_longueur = null, $longueur_ou_suite = null, ?string $suite = null, string $connect = ''): string {
4875 4875
 
4876
-	$descriptif = $ligne_sql['descriptif'] ?? '';
4877
-	$texte = $ligne_sql['texte'] ?? '';
4878
-	// En absence de descriptif, on se rabat sur chapo + texte
4879
-	if (isset($ligne_sql['chapo'])) {
4880
-		$chapo = $ligne_sql['chapo'];
4881
-		$texte = strlen($descriptif) ?
4882
-			'' :
4883
-			"$chapo \n\n $texte";
4884
-	}
4876
+    $descriptif = $ligne_sql['descriptif'] ?? '';
4877
+    $texte = $ligne_sql['texte'] ?? '';
4878
+    // En absence de descriptif, on se rabat sur chapo + texte
4879
+    if (isset($ligne_sql['chapo'])) {
4880
+        $chapo = $ligne_sql['chapo'];
4881
+        $texte = strlen($descriptif) ?
4882
+            '' :
4883
+            "$chapo \n\n $texte";
4884
+    }
4885 4885
 
4886
-	// Longueur en paramètre, sinon celle renseignée dans la description de l'objet, sinon valeur en dur
4887
-	if (!intval($longueur_ou_suite)) {
4888
-		$longueur = intval($introduction_longueur ?: 600);
4889
-	} else {
4890
-		$longueur = intval($longueur_ou_suite);
4891
-	}
4886
+    // Longueur en paramètre, sinon celle renseignée dans la description de l'objet, sinon valeur en dur
4887
+    if (!intval($longueur_ou_suite)) {
4888
+        $longueur = intval($introduction_longueur ?: 600);
4889
+    } else {
4890
+        $longueur = intval($longueur_ou_suite);
4891
+    }
4892 4892
 
4893
-	// On peut optionnellement passer la suite en 1er paramètre de la balise
4894
-	// Ex : #INTRODUCTION{...}
4895
-	if (
4896
-		is_null($suite)
4897
-		and !intval($longueur_ou_suite)
4898
-	) {
4899
-		$suite = $longueur_ou_suite;
4900
-	}
4893
+    // On peut optionnellement passer la suite en 1er paramètre de la balise
4894
+    // Ex : #INTRODUCTION{...}
4895
+    if (
4896
+        is_null($suite)
4897
+        and !intval($longueur_ou_suite)
4898
+    ) {
4899
+        $suite = $longueur_ou_suite;
4900
+    }
4901 4901
 
4902
-	$f = chercher_filtre('introduction');
4903
-	$introduction = $f($descriptif, $texte, $longueur, $connect, $suite);
4902
+    $f = chercher_filtre('introduction');
4903
+    $introduction = $f($descriptif, $texte, $longueur, $connect, $suite);
4904 4904
 
4905
-	return $introduction;
4905
+    return $introduction;
4906 4906
 }
4907 4907
 
4908 4908
 /**
@@ -4910,7 +4910,7 @@  discard block
 block discarded – undo
4910 4910
  * @see generer_objet_introduction
4911 4911
  */
4912 4912
 function generer_introduction_entite($id_objet, $type_objet, $ligne_sql, $introduction_longueur = null, $longueur_ou_suite = null, $suite = null, string $connect = '') {
4913
-	return generer_objet_introduction(intval($id_objet), $type_objet, $ligne_sql, $introduction_longueur, $longueur_ou_suite, $suite, $connect);
4913
+    return generer_objet_introduction(intval($id_objet), $type_objet, $ligne_sql, $introduction_longueur, $longueur_ou_suite, $suite, $connect);
4914 4914
 }
4915 4915
 
4916 4916
 /**
@@ -4924,49 +4924,49 @@  discard block
 block discarded – undo
4924 4924
  * @return string
4925 4925
  */
4926 4926
 function appliquer_traitement_champ($texte, $champ, $table_objet = '', $env = [], string $connect = '') {
4927
-	if (!$champ) {
4928
-		return $texte;
4929
-	}
4927
+    if (!$champ) {
4928
+        return $texte;
4929
+    }
4930 4930
 
4931
-	// On charge les définitions des traitements (inc/texte et fichiers de fonctions)
4932
-	// car il ne faut pas partir du principe que c'est déjà chargé (form ajax, etc)
4933
-	include_fichiers_fonctions();
4931
+    // On charge les définitions des traitements (inc/texte et fichiers de fonctions)
4932
+    // car il ne faut pas partir du principe que c'est déjà chargé (form ajax, etc)
4933
+    include_fichiers_fonctions();
4934 4934
 
4935
-	$champ = strtoupper($champ);
4936
-	$traitements = $GLOBALS['table_des_traitements'][$champ] ?? false;
4937
-	if (!$traitements or !is_array($traitements)) {
4938
-		return $texte;
4939
-	}
4935
+    $champ = strtoupper($champ);
4936
+    $traitements = $GLOBALS['table_des_traitements'][$champ] ?? false;
4937
+    if (!$traitements or !is_array($traitements)) {
4938
+        return $texte;
4939
+    }
4940 4940
 
4941
-	$traitement = '';
4942
-	if ($table_objet and (!isset($traitements[0]) or count($traitements) > 1)) {
4943
-		// necessaire pour prendre en charge les vieux appels avec un table_objet_sql en 3e arg
4944
-		$table_objet = table_objet($table_objet);
4945
-		if (isset($traitements[$table_objet])) {
4946
-			$traitement = $traitements[$table_objet];
4947
-		}
4948
-	}
4949
-	if (!$traitement and isset($traitements[0])) {
4950
-		$traitement = $traitements[0];
4951
-	}
4952
-	// (sinon prendre le premier de la liste par defaut ?)
4941
+    $traitement = '';
4942
+    if ($table_objet and (!isset($traitements[0]) or count($traitements) > 1)) {
4943
+        // necessaire pour prendre en charge les vieux appels avec un table_objet_sql en 3e arg
4944
+        $table_objet = table_objet($table_objet);
4945
+        if (isset($traitements[$table_objet])) {
4946
+            $traitement = $traitements[$table_objet];
4947
+        }
4948
+    }
4949
+    if (!$traitement and isset($traitements[0])) {
4950
+        $traitement = $traitements[0];
4951
+    }
4952
+    // (sinon prendre le premier de la liste par defaut ?)
4953 4953
 
4954
-	if (!$traitement) {
4955
-		return $texte;
4956
-	}
4954
+    if (!$traitement) {
4955
+        return $texte;
4956
+    }
4957 4957
 
4958
-	$traitement = str_replace('%s', "'" . texte_script($texte) . "'", $traitement);
4958
+    $traitement = str_replace('%s', "'" . texte_script($texte) . "'", $traitement);
4959 4959
 
4960
-	// signaler qu'on est dans l'espace prive pour les filtres qui se servent de ce flag
4961
-	if (test_espace_prive()) {
4962
-		$env['espace_prive'] = 1;
4963
-	}
4960
+    // signaler qu'on est dans l'espace prive pour les filtres qui se servent de ce flag
4961
+    if (test_espace_prive()) {
4962
+        $env['espace_prive'] = 1;
4963
+    }
4964 4964
 
4965
-	// Fournir $connect et $Pile[0] au traitement si besoin
4966
-	$Pile = [0 => $env];
4967
-	eval("\$texte = $traitement;");
4965
+    // Fournir $connect et $Pile[0] au traitement si besoin
4966
+    $Pile = [0 => $env];
4967
+    eval("\$texte = $traitement;");
4968 4968
 
4969
-	return $texte;
4969
+    return $texte;
4970 4970
 }
4971 4971
 
4972 4972
 
@@ -4980,21 +4980,21 @@  discard block
 block discarded – undo
4980 4980
  * @return string
4981 4981
  */
4982 4982
 function generer_objet_lien(int $id_objet, string $objet, int $longueur = 80, string $connect = ''): string {
4983
-	include_spip('inc/liens');
4984
-	$titre = traiter_raccourci_titre($id_objet, $objet, $connect);
4985
-	// lorsque l'objet n'est plus declare (plugin desactive par exemple)
4986
-	// le raccourcis n'est plus valide
4987
-	$titre = typo($titre['titre'] ?? '');
4988
-	// on essaye avec generer_info_entite ?
4989
-	if (!strlen($titre) and !$connect) {
4990
-		$titre = generer_objet_info($id_objet, $objet, 'titre');
4991
-	}
4992
-	if (!strlen($titre)) {
4993
-		$titre = _T('info_sans_titre');
4994
-	}
4995
-	$url = generer_objet_url($id_objet, $objet, '', '', null, '', $connect);
4983
+    include_spip('inc/liens');
4984
+    $titre = traiter_raccourci_titre($id_objet, $objet, $connect);
4985
+    // lorsque l'objet n'est plus declare (plugin desactive par exemple)
4986
+    // le raccourcis n'est plus valide
4987
+    $titre = typo($titre['titre'] ?? '');
4988
+    // on essaye avec generer_info_entite ?
4989
+    if (!strlen($titre) and !$connect) {
4990
+        $titre = generer_objet_info($id_objet, $objet, 'titre');
4991
+    }
4992
+    if (!strlen($titre)) {
4993
+        $titre = _T('info_sans_titre');
4994
+    }
4995
+    $url = generer_objet_url($id_objet, $objet, '', '', null, '', $connect);
4996 4996
 
4997
-	return "<a href='$url' class='$objet'>" . couper($titre, $longueur) . '</a>';
4997
+    return "<a href='$url' class='$objet'>" . couper($titre, $longueur) . '</a>';
4998 4998
 }
4999 4999
 
5000 5000
 /**
@@ -5002,7 +5002,7 @@  discard block
 block discarded – undo
5002 5002
  * @see generer_objet_lien
5003 5003
  */
5004 5004
 function generer_lien_entite($id_objet, $objet, $longueur = 80, $connect = null) {
5005
-	return generer_objet_lien(intval($id_objet), $objet, $longueur, $connect ?? '');
5005
+    return generer_objet_lien(intval($id_objet), $objet, $longueur, $connect ?? '');
5006 5006
 }
5007 5007
 
5008 5008
 /**
@@ -5018,15 +5018,15 @@  discard block
 block discarded – undo
5018 5018
  * @return string
5019 5019
  */
5020 5020
 function wrap($texte, $wrap) {
5021
-	$balises = extraire_balises($wrap);
5022
-	if (preg_match_all(",<([a-z]\w*)\b[^>]*>,UimsS", $wrap, $regs, PREG_PATTERN_ORDER)) {
5023
-		$texte = $wrap . $texte;
5024
-		$regs = array_reverse($regs[1]);
5025
-		$wrap = '</' . implode('></', $regs) . '>';
5026
-		$texte = $texte . $wrap;
5027
-	}
5021
+    $balises = extraire_balises($wrap);
5022
+    if (preg_match_all(",<([a-z]\w*)\b[^>]*>,UimsS", $wrap, $regs, PREG_PATTERN_ORDER)) {
5023
+        $texte = $wrap . $texte;
5024
+        $regs = array_reverse($regs[1]);
5025
+        $wrap = '</' . implode('></', $regs) . '>';
5026
+        $texte = $texte . $wrap;
5027
+    }
5028 5028
 
5029
-	return $texte;
5029
+    return $texte;
5030 5030
 }
5031 5031
 
5032 5032
 
@@ -5046,44 +5046,44 @@  discard block
 block discarded – undo
5046 5046
  * @return array|mixed|string
5047 5047
  */
5048 5048
 function filtre_print_dist($u, $join = '<br />', $indent = 0) {
5049
-	if (is_string($u)) {
5050
-		$u = typo($u);
5049
+    if (is_string($u)) {
5050
+        $u = typo($u);
5051 5051
 
5052
-		return $u;
5053
-	}
5052
+        return $u;
5053
+    }
5054 5054
 
5055
-	// caster $u en array si besoin
5056
-	if (is_object($u)) {
5057
-		$u = (array)$u;
5058
-	}
5055
+    // caster $u en array si besoin
5056
+    if (is_object($u)) {
5057
+        $u = (array)$u;
5058
+    }
5059 5059
 
5060
-	if (is_array($u)) {
5061
-		$out = '';
5062
-		// toutes les cles sont numeriques ?
5063
-		// et aucun enfant n'est un tableau
5064
-		// liste simple separee par des virgules
5065
-		$numeric_keys = array_map('is_numeric', array_keys($u));
5066
-		$array_values = array_map('is_array', $u);
5067
-		$object_values = array_map('is_object', $u);
5068
-		if (
5069
-			array_sum($numeric_keys) == count($numeric_keys)
5070
-			and !array_sum($array_values)
5071
-			and !array_sum($object_values)
5072
-		) {
5073
-			return join(', ', array_map('filtre_print_dist', $u));
5074
-		}
5060
+    if (is_array($u)) {
5061
+        $out = '';
5062
+        // toutes les cles sont numeriques ?
5063
+        // et aucun enfant n'est un tableau
5064
+        // liste simple separee par des virgules
5065
+        $numeric_keys = array_map('is_numeric', array_keys($u));
5066
+        $array_values = array_map('is_array', $u);
5067
+        $object_values = array_map('is_object', $u);
5068
+        if (
5069
+            array_sum($numeric_keys) == count($numeric_keys)
5070
+            and !array_sum($array_values)
5071
+            and !array_sum($object_values)
5072
+        ) {
5073
+            return join(', ', array_map('filtre_print_dist', $u));
5074
+        }
5075 5075
 
5076
-		// sinon on passe a la ligne et on indente
5077
-		$i_str = str_pad('', $indent, ' ');
5078
-		foreach ($u as $k => $v) {
5079
-			$out .= $join . $i_str . "$k: " . filtre_print_dist($v, $join, $indent + 2);
5080
-		}
5076
+        // sinon on passe a la ligne et on indente
5077
+        $i_str = str_pad('', $indent, ' ');
5078
+        foreach ($u as $k => $v) {
5079
+            $out .= $join . $i_str . "$k: " . filtre_print_dist($v, $join, $indent + 2);
5080
+        }
5081 5081
 
5082
-		return $out;
5083
-	}
5082
+        return $out;
5083
+    }
5084 5084
 
5085
-	// on sait pas quoi faire...
5086
-	return $u;
5085
+    // on sait pas quoi faire...
5086
+    return $u;
5087 5087
 }
5088 5088
 
5089 5089
 
@@ -5096,10 +5096,10 @@  discard block
 block discarded – undo
5096 5096
  * @return string|array
5097 5097
  */
5098 5098
 function objet_info($objet, $info) {
5099
-	$table = table_objet_sql($objet);
5100
-	$infos = lister_tables_objets_sql($table);
5099
+    $table = table_objet_sql($objet);
5100
+    $infos = lister_tables_objets_sql($table);
5101 5101
 
5102
-	return ($infos[$info] ?? '');
5102
+    return ($infos[$info] ?? '');
5103 5103
 }
5104 5104
 
5105 5105
 /**
@@ -5114,11 +5114,11 @@  discard block
 block discarded – undo
5114 5114
  *     Texte traduit du comptage, tel que '3 articles'
5115 5115
  */
5116 5116
 function objet_afficher_nb($nb, $objet) {
5117
-	if (!$nb) {
5118
-		return _T(objet_info($objet, 'info_aucun_objet'));
5119
-	} else {
5120
-		return _T(objet_info($objet, $nb == 1 ? 'info_1_objet' : 'info_nb_objets'), ['nb' => $nb]);
5121
-	}
5117
+    if (!$nb) {
5118
+        return _T(objet_info($objet, 'info_aucun_objet'));
5119
+    } else {
5120
+        return _T(objet_info($objet, $nb == 1 ? 'info_1_objet' : 'info_nb_objets'), ['nb' => $nb]);
5121
+    }
5122 5122
 }
5123 5123
 
5124 5124
 /**
@@ -5130,11 +5130,11 @@  discard block
 block discarded – undo
5130 5130
  * @return string
5131 5131
  */
5132 5132
 function objet_icone($objet, $taille = 24, $class = '') {
5133
-	$icone = objet_info($objet, 'icone_objet') . '-' . $taille . '.png';
5134
-	$icone = chemin_image($icone);
5135
-	$balise_img = charger_filtre('balise_img');
5133
+    $icone = objet_info($objet, 'icone_objet') . '-' . $taille . '.png';
5134
+    $icone = chemin_image($icone);
5135
+    $balise_img = charger_filtre('balise_img');
5136 5136
 
5137
-	return $icone ? $balise_img($icone, _T(objet_info($objet, 'texte_objet')), $class, $taille) : '';
5137
+    return $icone ? $balise_img($icone, _T(objet_info($objet, 'texte_objet')), $class, $taille) : '';
5138 5138
 }
5139 5139
 
5140 5140
 /**
@@ -5155,12 +5155,12 @@  discard block
 block discarded – undo
5155 5155
  * @return string
5156 5156
  */
5157 5157
 function objet_T($objet, $chaine, $args = [], $options = []) {
5158
-	$chaine = explode(':', $chaine);
5159
-	if ($t = _T($objet . ':' . end($chaine), $args, array_merge($options, ['force' => false]))) {
5160
-		return $t;
5161
-	}
5162
-	$chaine = implode(':', $chaine);
5163
-	return _T($chaine, $args, $options);
5158
+    $chaine = explode(':', $chaine);
5159
+    if ($t = _T($objet . ':' . end($chaine), $args, array_merge($options, ['force' => false]))) {
5160
+        return $t;
5161
+    }
5162
+    $chaine = implode(':', $chaine);
5163
+    return _T($chaine, $args, $options);
5164 5164
 }
5165 5165
 
5166 5166
 /**
@@ -5174,18 +5174,18 @@  discard block
 block discarded – undo
5174 5174
  * @return string      Code HTML
5175 5175
  */
5176 5176
 function insert_head_css_conditionnel($flux) {
5177
-	if (
5178
-		strpos($flux, '<!-- insert_head_css -->') === false
5179
-		and $p = strpos($flux, '<!-- insert_head -->')
5180
-	) {
5181
-		// plutot avant le premier js externe (jquery) pour etre non bloquant
5182
-		if ($p1 = stripos($flux, '<script src=') and $p1 < $p) {
5183
-			$p = $p1;
5184
-		}
5185
-		$flux = substr_replace($flux, pipeline('insert_head_css', '<!-- insert_head_css -->'), $p, 0);
5186
-	}
5177
+    if (
5178
+        strpos($flux, '<!-- insert_head_css -->') === false
5179
+        and $p = strpos($flux, '<!-- insert_head -->')
5180
+    ) {
5181
+        // plutot avant le premier js externe (jquery) pour etre non bloquant
5182
+        if ($p1 = stripos($flux, '<script src=') and $p1 < $p) {
5183
+            $p = $p1;
5184
+        }
5185
+        $flux = substr_replace($flux, pipeline('insert_head_css', '<!-- insert_head_css -->'), $p, 0);
5186
+    }
5187 5187
 
5188
-	return $flux;
5188
+    return $flux;
5189 5189
 }
5190 5190
 
5191 5191
 /**
@@ -5208,75 +5208,75 @@  discard block
 block discarded – undo
5208 5208
  * @return string
5209 5209
  */
5210 5210
 function produire_fond_statique($fond, $contexte = [], $options = [], string $connect = '') {
5211
-	if (isset($contexte['format'])) {
5212
-		$extension = $contexte['format'];
5213
-		unset($contexte['format']);
5214
-	} else {
5215
-		$extension = 'html';
5216
-		if (preg_match(',[.](css|js|json|xml|svg)$,', $fond, $m)) {
5217
-			$extension = $m[1];
5218
-		}
5219
-	}
5220
-	// recuperer le contenu produit par le squelette
5221
-	$options['raw'] = true;
5222
-	$cache = recuperer_fond($fond, $contexte, $options, $connect);
5223
-
5224
-	// calculer le nom de la css
5225
-	$dir_var = sous_repertoire(_DIR_VAR, 'cache-' . $extension);
5226
-	$nom_safe = preg_replace(',\W,', '_', str_replace('.', '_', $fond));
5227
-	$contexte_implicite = calculer_contexte_implicite();
5228
-
5229
-	// par defaut on hash selon les contextes qui sont a priori moins variables
5230
-	// mais on peut hasher selon le contenu a la demande, si plusieurs contextes produisent un meme contenu
5231
-	// reduit la variabilite du nom et donc le nombre de css concatenees possibles in fine
5232
-	if (isset($options['hash_on_content']) and $options['hash_on_content']) {
5233
-		$hash = md5($contexte_implicite['host'] . '::' . $cache);
5234
-	}
5235
-	else {
5236
-		unset($contexte_implicite['notes']); // pas pertinent pour signaler un changeemnt de contenu pour des css/js
5237
-		ksort($contexte);
5238
-		$hash = md5($fond . json_encode($contexte_implicite, JSON_THROW_ON_ERROR) . json_encode($contexte, JSON_THROW_ON_ERROR) . $connect);
5239
-	}
5240
-	$filename = $dir_var . $extension . "dyn-$nom_safe-" . substr($hash, 0, 8) . ".$extension";
5241
-
5242
-	// mettre a jour le fichier si il n'existe pas
5243
-	// ou trop ancien
5244
-	// le dernier fichier produit est toujours suffixe par .last
5245
-	// et recopie sur le fichier cible uniquement si il change
5246
-	if (
5247
-		!file_exists($filename)
5248
-		or !file_exists($filename . '.last')
5249
-		or (isset($cache['lastmodified']) and $cache['lastmodified'] and filemtime($filename . '.last') < $cache['lastmodified'])
5250
-		or (defined('_VAR_MODE') and _VAR_MODE == 'recalcul')
5251
-	) {
5252
-		$contenu = $cache['texte'];
5253
-		// passer les urls en absolu si c'est une css
5254
-		if ($extension == 'css') {
5255
-			$contenu = urls_absolues_css(
5256
-				$contenu,
5257
-				test_espace_prive() ? generer_url_ecrire('accueil') : generer_url_public($fond)
5258
-			);
5259
-		}
5260
-
5261
-		$comment = '';
5262
-		// ne pas insérer de commentaire sur certains formats
5263
-		if (!in_array($extension, ['json', 'xml', 'svg'])) {
5264
-			$comment = "/* #PRODUIRE{fond=$fond";
5265
-			foreach ($contexte as $k => $v) {
5266
-				if (is_array($v)) {
5267
-					$v = var_export($v, true);
5268
-				}
5269
-				$comment .= ",$k=$v";
5270
-			}
5271
-			// pas de date dans le commentaire car sinon ca invalide le md5 et force la maj
5272
-			// mais on peut mettre un md5 du contenu, ce qui donne un aperu rapide si la feuille a change ou non
5273
-			$comment .= "}\n   md5:" . md5($contenu) . " */\n";
5274
-		}
5275
-		// et ecrire le fichier si il change
5276
-		ecrire_fichier_calcule_si_modifie($filename, $comment . $contenu, false, true);
5277
-	}
5278
-
5279
-	return timestamp($filename);
5211
+    if (isset($contexte['format'])) {
5212
+        $extension = $contexte['format'];
5213
+        unset($contexte['format']);
5214
+    } else {
5215
+        $extension = 'html';
5216
+        if (preg_match(',[.](css|js|json|xml|svg)$,', $fond, $m)) {
5217
+            $extension = $m[1];
5218
+        }
5219
+    }
5220
+    // recuperer le contenu produit par le squelette
5221
+    $options['raw'] = true;
5222
+    $cache = recuperer_fond($fond, $contexte, $options, $connect);
5223
+
5224
+    // calculer le nom de la css
5225
+    $dir_var = sous_repertoire(_DIR_VAR, 'cache-' . $extension);
5226
+    $nom_safe = preg_replace(',\W,', '_', str_replace('.', '_', $fond));
5227
+    $contexte_implicite = calculer_contexte_implicite();
5228
+
5229
+    // par defaut on hash selon les contextes qui sont a priori moins variables
5230
+    // mais on peut hasher selon le contenu a la demande, si plusieurs contextes produisent un meme contenu
5231
+    // reduit la variabilite du nom et donc le nombre de css concatenees possibles in fine
5232
+    if (isset($options['hash_on_content']) and $options['hash_on_content']) {
5233
+        $hash = md5($contexte_implicite['host'] . '::' . $cache);
5234
+    }
5235
+    else {
5236
+        unset($contexte_implicite['notes']); // pas pertinent pour signaler un changeemnt de contenu pour des css/js
5237
+        ksort($contexte);
5238
+        $hash = md5($fond . json_encode($contexte_implicite, JSON_THROW_ON_ERROR) . json_encode($contexte, JSON_THROW_ON_ERROR) . $connect);
5239
+    }
5240
+    $filename = $dir_var . $extension . "dyn-$nom_safe-" . substr($hash, 0, 8) . ".$extension";
5241
+
5242
+    // mettre a jour le fichier si il n'existe pas
5243
+    // ou trop ancien
5244
+    // le dernier fichier produit est toujours suffixe par .last
5245
+    // et recopie sur le fichier cible uniquement si il change
5246
+    if (
5247
+        !file_exists($filename)
5248
+        or !file_exists($filename . '.last')
5249
+        or (isset($cache['lastmodified']) and $cache['lastmodified'] and filemtime($filename . '.last') < $cache['lastmodified'])
5250
+        or (defined('_VAR_MODE') and _VAR_MODE == 'recalcul')
5251
+    ) {
5252
+        $contenu = $cache['texte'];
5253
+        // passer les urls en absolu si c'est une css
5254
+        if ($extension == 'css') {
5255
+            $contenu = urls_absolues_css(
5256
+                $contenu,
5257
+                test_espace_prive() ? generer_url_ecrire('accueil') : generer_url_public($fond)
5258
+            );
5259
+        }
5260
+
5261
+        $comment = '';
5262
+        // ne pas insérer de commentaire sur certains formats
5263
+        if (!in_array($extension, ['json', 'xml', 'svg'])) {
5264
+            $comment = "/* #PRODUIRE{fond=$fond";
5265
+            foreach ($contexte as $k => $v) {
5266
+                if (is_array($v)) {
5267
+                    $v = var_export($v, true);
5268
+                }
5269
+                $comment .= ",$k=$v";
5270
+            }
5271
+            // pas de date dans le commentaire car sinon ca invalide le md5 et force la maj
5272
+            // mais on peut mettre un md5 du contenu, ce qui donne un aperu rapide si la feuille a change ou non
5273
+            $comment .= "}\n   md5:" . md5($contenu) . " */\n";
5274
+        }
5275
+        // et ecrire le fichier si il change
5276
+        ecrire_fichier_calcule_si_modifie($filename, $comment . $contenu, false, true);
5277
+    }
5278
+
5279
+    return timestamp($filename);
5280 5280
 }
5281 5281
 
5282 5282
 /**
@@ -5289,15 +5289,15 @@  discard block
 block discarded – undo
5289 5289
  *    $fichier auquel on a ajouté le timestamp
5290 5290
  */
5291 5291
 function timestamp($fichier) {
5292
-	if (
5293
-		!$fichier
5294
-		or !file_exists($fichier)
5295
-		or !$m = filemtime($fichier)
5296
-	) {
5297
-		return $fichier;
5298
-	}
5292
+    if (
5293
+        !$fichier
5294
+        or !file_exists($fichier)
5295
+        or !$m = filemtime($fichier)
5296
+    ) {
5297
+        return $fichier;
5298
+    }
5299 5299
 
5300
-	return "$fichier?$m";
5300
+    return "$fichier?$m";
5301 5301
 }
5302 5302
 
5303 5303
 /**
@@ -5307,11 +5307,11 @@  discard block
 block discarded – undo
5307 5307
  * @return string
5308 5308
  */
5309 5309
 function supprimer_timestamp($url) {
5310
-	if (strpos($url, '?') === false) {
5311
-		return $url;
5312
-	}
5310
+    if (strpos($url, '?') === false) {
5311
+        return $url;
5312
+    }
5313 5313
 
5314
-	return preg_replace(',\?[[:digit:]]+$,', '', $url);
5314
+    return preg_replace(',\?[[:digit:]]+$,', '', $url);
5315 5315
 }
5316 5316
 
5317 5317
 /**
@@ -5326,15 +5326,15 @@  discard block
 block discarded – undo
5326 5326
  * @return string
5327 5327
  */
5328 5328
 function filtre_nettoyer_titre_email_dist($titre) {
5329
-	include_spip('inc/envoyer_mail');
5329
+    include_spip('inc/envoyer_mail');
5330 5330
 
5331
-	$titre = nettoyer_titre_email($titre);
5332
-	// on est dans un squelette : securiser le retour
5333
-	if (strpos($titre, '<') !== false) {
5334
-		$titre = interdire_scripts($titre);
5335
-	}
5331
+    $titre = nettoyer_titre_email($titre);
5332
+    // on est dans un squelette : securiser le retour
5333
+    if (strpos($titre, '<') !== false) {
5334
+        $titre = interdire_scripts($titre);
5335
+    }
5336 5336
 
5337
-	return $titre;
5337
+    return $titre;
5338 5338
 }
5339 5339
 
5340 5340
 /**
@@ -5356,27 +5356,27 @@  discard block
 block discarded – undo
5356 5356
  * @return string
5357 5357
  */
5358 5358
 function filtre_chercher_rubrique_dist(
5359
-	$titre,
5360
-	$id_objet,
5361
-	$id_parent,
5362
-	$objet,
5363
-	$id_secteur,
5364
-	$restreint,
5365
-	$actionable = false,
5366
-	$retour_sans_cadre = false
5359
+    $titre,
5360
+    $id_objet,
5361
+    $id_parent,
5362
+    $objet,
5363
+    $id_secteur,
5364
+    $restreint,
5365
+    $actionable = false,
5366
+    $retour_sans_cadre = false
5367 5367
 ) {
5368
-	include_spip('inc/filtres_ecrire');
5368
+    include_spip('inc/filtres_ecrire');
5369 5369
 
5370
-	return chercher_rubrique(
5371
-		$titre,
5372
-		$id_objet,
5373
-		$id_parent,
5374
-		$objet,
5375
-		$id_secteur,
5376
-		$restreint,
5377
-		$actionable,
5378
-		$retour_sans_cadre
5379
-	);
5370
+    return chercher_rubrique(
5371
+        $titre,
5372
+        $id_objet,
5373
+        $id_parent,
5374
+        $objet,
5375
+        $id_secteur,
5376
+        $restreint,
5377
+        $actionable,
5378
+        $retour_sans_cadre
5379
+    );
5380 5380
 }
5381 5381
 
5382 5382
 /**
@@ -5405,56 +5405,56 @@  discard block
 block discarded – undo
5405 5405
  *     Chaîne vide si l'accès est autorisé
5406 5406
  */
5407 5407
 function sinon_interdire_acces($ok = false, $url = '', $statut = 0, $message = null) {
5408
-	if ($ok) {
5409
-		return '';
5410
-	}
5411
-
5412
-	// Vider tous les tampons
5413
-	$level = @ob_get_level();
5414
-	while ($level--) {
5415
-		@ob_end_clean();
5416
-	}
5417
-
5418
-	include_spip('inc/headers');
5419
-
5420
-	// S'il y a une URL, on redirige (si pas de statut, la fonction mettra 302 par défaut)
5421
-	if ($url) {
5422
-		redirige_par_entete($url, '', $statut);
5423
-	}
5424
-
5425
-	// ecriture simplifiee avec message en 3eme argument (= statut 403)
5426
-	if (!is_numeric($statut) and is_null($message)) {
5427
-		$message = $statut;
5428
-		$statut = 0;
5429
-	}
5430
-	if (!$message) {
5431
-		$message = '';
5432
-	}
5433
-	$statut = intval($statut);
5434
-
5435
-	// Si on est dans l'espace privé, on génère du 403 Forbidden par defaut ou du 404
5436
-	if (test_espace_prive()) {
5437
-		if (!$statut or !in_array($statut, [404, 403])) {
5438
-			$statut = 403;
5439
-		}
5440
-		http_response_code(403);
5441
-		$echec = charger_fonction('403', 'exec');
5442
-		$echec($message);
5443
-	} else {
5444
-		// Sinon dans l'espace public on redirige vers une 404 par défaut, car elle toujours présente normalement
5445
-		if (!$statut) {
5446
-			$statut = 404;
5447
-		}
5448
-		// Dans tous les cas on modifie l'entité avec ce qui est demandé
5449
-		http_response_code($statut);
5450
-		// Si le statut est une erreur et qu'il n'y a pas de redirection on va chercher le squelette du même nom
5451
-		if ($statut >= 400) {
5452
-			echo recuperer_fond("$statut", ['erreur' => $message]);
5453
-		}
5454
-	}
5455
-
5456
-
5457
-	exit;
5408
+    if ($ok) {
5409
+        return '';
5410
+    }
5411
+
5412
+    // Vider tous les tampons
5413
+    $level = @ob_get_level();
5414
+    while ($level--) {
5415
+        @ob_end_clean();
5416
+    }
5417
+
5418
+    include_spip('inc/headers');
5419
+
5420
+    // S'il y a une URL, on redirige (si pas de statut, la fonction mettra 302 par défaut)
5421
+    if ($url) {
5422
+        redirige_par_entete($url, '', $statut);
5423
+    }
5424
+
5425
+    // ecriture simplifiee avec message en 3eme argument (= statut 403)
5426
+    if (!is_numeric($statut) and is_null($message)) {
5427
+        $message = $statut;
5428
+        $statut = 0;
5429
+    }
5430
+    if (!$message) {
5431
+        $message = '';
5432
+    }
5433
+    $statut = intval($statut);
5434
+
5435
+    // Si on est dans l'espace privé, on génère du 403 Forbidden par defaut ou du 404
5436
+    if (test_espace_prive()) {
5437
+        if (!$statut or !in_array($statut, [404, 403])) {
5438
+            $statut = 403;
5439
+        }
5440
+        http_response_code(403);
5441
+        $echec = charger_fonction('403', 'exec');
5442
+        $echec($message);
5443
+    } else {
5444
+        // Sinon dans l'espace public on redirige vers une 404 par défaut, car elle toujours présente normalement
5445
+        if (!$statut) {
5446
+            $statut = 404;
5447
+        }
5448
+        // Dans tous les cas on modifie l'entité avec ce qui est demandé
5449
+        http_response_code($statut);
5450
+        // Si le statut est une erreur et qu'il n'y a pas de redirection on va chercher le squelette du même nom
5451
+        if ($statut >= 400) {
5452
+            echo recuperer_fond("$statut", ['erreur' => $message]);
5453
+        }
5454
+    }
5455
+
5456
+
5457
+    exit;
5458 5458
 }
5459 5459
 
5460 5460
 /**
@@ -5465,11 +5465,11 @@  discard block
 block discarded – undo
5465 5465
  * @return string
5466 5466
  */
5467 5467
 function filtre_compacte_dist($source, $format = null) {
5468
-	if (function_exists('minifier')) {
5469
-		return minifier($source, $format);
5470
-	}
5468
+    if (function_exists('minifier')) {
5469
+        return minifier($source, $format);
5470
+    }
5471 5471
 
5472
-	return $source;
5472
+    return $source;
5473 5473
 }
5474 5474
 
5475 5475
 
@@ -5481,32 +5481,32 @@  discard block
 block discarded – undo
5481 5481
  * @return string
5482 5482
  */
5483 5483
 function spip_affiche_mot_de_passe_masque(?string $passe, bool $afficher_partiellement = false, ?int $portion_pourcent = null): string {
5484
-	$passe ??= '';
5485
-	$l = strlen($passe);
5486
-
5487
-	if ($l <= 8 or !$afficher_partiellement) {
5488
-		if (!$l) {
5489
-			return ''; // montrer qu'il y a pas de mot de passe si il y en a pas
5490
-		}
5491
-		return str_pad('', $afficher_partiellement ? $l : 16, '*');
5492
-	}
5493
-
5494
-	if (is_null($portion_pourcent)) {
5495
-		if (!defined('_SPIP_AFFICHE_MOT_DE_PASSE_MASQUE_PERCENT')) {
5496
-			define('_SPIP_AFFICHE_MOT_DE_PASSE_MASQUE_PERCENT', 20); // 20%
5497
-		}
5498
-		$portion_pourcent = _SPIP_AFFICHE_MOT_DE_PASSE_MASQUE_PERCENT;
5499
-	}
5500
-	if ($portion_pourcent >= 100) {
5501
-		return $passe;
5502
-	}
5503
-	$e = intval(ceil($l * $portion_pourcent / 100 / 2));
5504
-	$e = max($e, 0);
5505
-	$mid = str_pad('', $l - 2 * $e, '*');
5506
-	if ($e > 0 and strlen($mid) > 8) {
5507
-		$mid = '***...***';
5508
-	}
5509
-	return substr($passe, 0, $e) . $mid . ($e > 0 ? substr($passe, -$e) : '');
5484
+    $passe ??= '';
5485
+    $l = strlen($passe);
5486
+
5487
+    if ($l <= 8 or !$afficher_partiellement) {
5488
+        if (!$l) {
5489
+            return ''; // montrer qu'il y a pas de mot de passe si il y en a pas
5490
+        }
5491
+        return str_pad('', $afficher_partiellement ? $l : 16, '*');
5492
+    }
5493
+
5494
+    if (is_null($portion_pourcent)) {
5495
+        if (!defined('_SPIP_AFFICHE_MOT_DE_PASSE_MASQUE_PERCENT')) {
5496
+            define('_SPIP_AFFICHE_MOT_DE_PASSE_MASQUE_PERCENT', 20); // 20%
5497
+        }
5498
+        $portion_pourcent = _SPIP_AFFICHE_MOT_DE_PASSE_MASQUE_PERCENT;
5499
+    }
5500
+    if ($portion_pourcent >= 100) {
5501
+        return $passe;
5502
+    }
5503
+    $e = intval(ceil($l * $portion_pourcent / 100 / 2));
5504
+    $e = max($e, 0);
5505
+    $mid = str_pad('', $l - 2 * $e, '*');
5506
+    if ($e > 0 and strlen($mid) > 8) {
5507
+        $mid = '***...***';
5508
+    }
5509
+    return substr($passe, 0, $e) . $mid . ($e > 0 ? substr($passe, -$e) : '');
5510 5510
 }
5511 5511
 
5512 5512
 
@@ -5527,64 +5527,64 @@  discard block
 block discarded – undo
5527 5527
  */
5528 5528
 function identifiant_slug($texte, $type = '', $options = []) {
5529 5529
 
5530
-	$original = $texte;
5531
-	$separateur = ($options['separateur'] ?? '_');
5532
-	$longueur_maxi = ($options['longueur_maxi'] ?? 60);
5533
-	$longueur_mini = ($options['longueur_mini'] ?? 0);
5530
+    $original = $texte;
5531
+    $separateur = ($options['separateur'] ?? '_');
5532
+    $longueur_maxi = ($options['longueur_maxi'] ?? 60);
5533
+    $longueur_mini = ($options['longueur_mini'] ?? 0);
5534 5534
 
5535
-	if (!function_exists('translitteration')) {
5536
-		include_spip('inc/charsets');
5537
-	}
5535
+    if (!function_exists('translitteration')) {
5536
+        include_spip('inc/charsets');
5537
+    }
5538 5538
 
5539
-	// pas de balise html
5540
-	if (strpos($texte, '<') !== false) {
5541
-		$texte = strip_tags($texte);
5542
-	}
5543
-	if (strpos($texte, '&') !== false) {
5544
-		$texte = unicode2charset($texte);
5545
-	}
5546
-	// On enlève les espaces indésirables
5547
-	$texte = trim($texte);
5539
+    // pas de balise html
5540
+    if (strpos($texte, '<') !== false) {
5541
+        $texte = strip_tags($texte);
5542
+    }
5543
+    if (strpos($texte, '&') !== false) {
5544
+        $texte = unicode2charset($texte);
5545
+    }
5546
+    // On enlève les espaces indésirables
5547
+    $texte = trim($texte);
5548 5548
 
5549
-	// On enlève les accents et cie
5550
-	$texte = translitteration($texte);
5549
+    // On enlève les accents et cie
5550
+    $texte = translitteration($texte);
5551 5551
 
5552
-	// On remplace tout ce qui n'est pas un mot par un séparateur
5553
-	$texte = preg_replace(',[\W_]+,ms', $separateur, $texte);
5552
+    // On remplace tout ce qui n'est pas un mot par un séparateur
5553
+    $texte = preg_replace(',[\W_]+,ms', $separateur, $texte);
5554 5554
 
5555
-	// nettoyer les doubles occurences du separateur si besoin
5556
-	while (strpos($texte, (string) "$separateur$separateur") !== false) {
5557
-		$texte = str_replace("$separateur$separateur", $separateur, $texte);
5558
-	}
5555
+    // nettoyer les doubles occurences du separateur si besoin
5556
+    while (strpos($texte, (string) "$separateur$separateur") !== false) {
5557
+        $texte = str_replace("$separateur$separateur", $separateur, $texte);
5558
+    }
5559 5559
 
5560
-	// pas de separateur au debut ni a la fin
5561
-	$texte = trim($texte, $separateur);
5560
+    // pas de separateur au debut ni a la fin
5561
+    $texte = trim($texte, $separateur);
5562 5562
 
5563
-	// en minuscules
5564
-	$texte = strtolower($texte);
5563
+    // en minuscules
5564
+    $texte = strtolower($texte);
5565 5565
 
5566
-	switch ($type) {
5567
-		case 'class':
5568
-		case 'id':
5569
-		case 'anchor':
5570
-			if (preg_match(',^\d,', $texte)) {
5571
-				$texte = substr($type, 0, 1) . $texte;
5572
-			}
5573
-	}
5566
+    switch ($type) {
5567
+        case 'class':
5568
+        case 'id':
5569
+        case 'anchor':
5570
+            if (preg_match(',^\d,', $texte)) {
5571
+                $texte = substr($type, 0, 1) . $texte;
5572
+            }
5573
+    }
5574 5574
 
5575
-	if (strlen($texte) > $longueur_maxi) {
5576
-		$texte = substr($texte, 0, $longueur_maxi);
5577
-	}
5575
+    if (strlen($texte) > $longueur_maxi) {
5576
+        $texte = substr($texte, 0, $longueur_maxi);
5577
+    }
5578 5578
 
5579
-	if (strlen($texte) < $longueur_mini and $longueur_mini < $longueur_maxi) {
5580
-		if (preg_match(',^\d,', $texte)) {
5581
-			$texte = ($type ? substr($type, 0, 1) : 's') . $texte;
5582
-		}
5583
-		$texte .= $separateur . md5($original);
5584
-		$texte = substr($texte, 0, $longueur_mini);
5585
-	}
5579
+    if (strlen($texte) < $longueur_mini and $longueur_mini < $longueur_maxi) {
5580
+        if (preg_match(',^\d,', $texte)) {
5581
+            $texte = ($type ? substr($type, 0, 1) : 's') . $texte;
5582
+        }
5583
+        $texte .= $separateur . md5($original);
5584
+        $texte = substr($texte, 0, $longueur_mini);
5585
+    }
5586 5586
 
5587
-	return $texte;
5587
+    return $texte;
5588 5588
 }
5589 5589
 
5590 5590
 
@@ -5605,11 +5605,11 @@  discard block
 block discarded – undo
5605 5605
  * @exemple `<:info_maximum|label_nettoyer:>`
5606 5606
  */
5607 5607
 function label_nettoyer(string $text, bool $ucfirst = true): string {
5608
-	$label = preg_replace('#([\s:]|\&nbsp;)+$#u', '', $text);
5609
-	if ($ucfirst) {
5610
-		$label = spip_ucfirst($label);
5611
-	}
5612
-	return $label;
5608
+    $label = preg_replace('#([\s:]|\&nbsp;)+$#u', '', $text);
5609
+    if ($ucfirst) {
5610
+        $label = spip_ucfirst($label);
5611
+    }
5612
+    return $label;
5613 5613
 }
5614 5614
 
5615 5615
 /**
@@ -5622,8 +5622,8 @@  discard block
 block discarded – undo
5622 5622
  * @exemple `<:info_maximum|label_ponctuer:>`
5623 5623
  */
5624 5624
 function label_ponctuer(string $text, bool $ucfirst = true): string {
5625
-	$label = label_nettoyer($text, $ucfirst);
5626
-	return _T('label_ponctuer', ['label' => $label]);
5625
+    $label = label_nettoyer($text, $ucfirst);
5626
+    return _T('label_ponctuer', ['label' => $label]);
5627 5627
 }
5628 5628
 
5629 5629
 
@@ -5636,19 +5636,19 @@  discard block
 block discarded – undo
5636 5636
  * @return array
5637 5637
  */
5638 5638
 function helper_filtre_objet_lister_enfants_ou_parents($objet, $id_objet, $fonction) {
5639
-	if (!in_array($fonction, ['objet_lister_parents', 'objet_lister_enfants', 'objet_lister_parents_par_type', 'objet_lister_enfants_par_type'])) {
5640
-		return [];
5641
-	}
5639
+    if (!in_array($fonction, ['objet_lister_parents', 'objet_lister_enfants', 'objet_lister_parents_par_type', 'objet_lister_enfants_par_type'])) {
5640
+        return [];
5641
+    }
5642 5642
 
5643
-	// compatibilite signature inversee
5644
-	if (is_numeric($objet) and !is_numeric($id_objet)) {
5645
-		[$objet, $id_objet] = [$id_objet, $objet];
5646
-	}
5643
+    // compatibilite signature inversee
5644
+    if (is_numeric($objet) and !is_numeric($id_objet)) {
5645
+        [$objet, $id_objet] = [$id_objet, $objet];
5646
+    }
5647 5647
 
5648
-	if (!function_exists($fonction)) {
5649
-		include_spip('base/objets');
5650
-	}
5651
-	return $fonction($objet, $id_objet);
5648
+    if (!function_exists($fonction)) {
5649
+        include_spip('base/objets');
5650
+    }
5651
+    return $fonction($objet, $id_objet);
5652 5652
 }
5653 5653
 
5654 5654
 
@@ -5663,7 +5663,7 @@  discard block
 block discarded – undo
5663 5663
  * @return array
5664 5664
  */
5665 5665
 function filtre_objet_lister_parents_dist($objet, $id_objet) {
5666
-	return helper_filtre_objet_lister_enfants_ou_parents($objet, $id_objet, 'objet_lister_parents');
5666
+    return helper_filtre_objet_lister_enfants_ou_parents($objet, $id_objet, 'objet_lister_parents');
5667 5667
 }
5668 5668
 
5669 5669
 /**
@@ -5677,7 +5677,7 @@  discard block
 block discarded – undo
5677 5677
  * @return array
5678 5678
  */
5679 5679
 function filtre_objet_lister_parents_par_type_dist($objet, $id_objet) {
5680
-	return helper_filtre_objet_lister_enfants_ou_parents($objet, $id_objet, 'objet_lister_parents_par_type');
5680
+    return helper_filtre_objet_lister_enfants_ou_parents($objet, $id_objet, 'objet_lister_parents_par_type');
5681 5681
 }
5682 5682
 
5683 5683
 /**
@@ -5691,7 +5691,7 @@  discard block
 block discarded – undo
5691 5691
  * @return array
5692 5692
  */
5693 5693
 function filtre_objet_lister_enfants_dist($objet, $id_objet) {
5694
-	return helper_filtre_objet_lister_enfants_ou_parents($objet, $id_objet, 'objet_lister_enfants');
5694
+    return helper_filtre_objet_lister_enfants_ou_parents($objet, $id_objet, 'objet_lister_enfants');
5695 5695
 }
5696 5696
 
5697 5697
 /**
@@ -5705,5 +5705,5 @@  discard block
 block discarded – undo
5705 5705
  * @return array
5706 5706
  */
5707 5707
 function filtre_objet_lister_enfants_par_type_dist($objet, $id_objet) {
5708
-	return helper_filtre_objet_lister_enfants_ou_parents($objet, $id_objet, 'objet_lister_enfants_par_type');
5708
+    return helper_filtre_objet_lister_enfants_ou_parents($objet, $id_objet, 'objet_lister_enfants_par_type');
5709 5709
 }
Please login to merge, or discard this patch.
ecrire/src/Chiffrer/SpipCles.php 2 patches
Indentation   +167 added lines, -167 removed lines patch added patch discarded remove patch
@@ -14,171 +14,171 @@
 block discarded – undo
14 14
 
15 15
 /** Gestion des clés d’authentification / chiffrement de SPIP */
16 16
 final class SpipCles {
17
-	private static array $instances = [];
18
-
19
-	private string $file = _DIR_ETC . 'cles.php';
20
-	private Cles $cles;
21
-
22
-	public static function instance(string $file = ''): self {
23
-		if (empty(self::$instances[$file])) {
24
-			self::$instances[$file] = new self($file);
25
-		}
26
-		return self::$instances[$file];
27
-	}
28
-
29
-	/**
30
-	 * Retourne le secret du site (shorthand)
31
-	 * @uses self::getSecretSite()
32
-	 */
33
-	public static function secret_du_site(): ?string {
34
-		return (self::instance())->getSecretSite();
35
-	}
36
-
37
-	private function __construct(string $file = '') {
38
-		if ($file) {
39
-			$this->file = $file;
40
-		}
41
-		$this->cles = new Cles($this->read());
42
-	}
43
-
44
-	/**
45
-	 * Renvoyer le secret du site
46
-	 *
47
-	 * Le secret du site doit rester aussi secret que possible, et est eternel
48
-	 * On ne doit pas l'exporter
49
-	 *
50
-	 * Le secret est partagé entre une clé disque et une clé bdd
51
-	 *
52
-	 * @return string
53
-	 */
54
-	public function getSecretSite(bool $autoInit = true): ?string {
55
-		$key = $this->getKey('secret_du_site', $autoInit);
56
-		$meta = $this->getMetaKey('secret_du_site', $autoInit);
57
-		// conserve la même longeur.
58
-		return $key ^ $meta;
59
-	}
60
-
61
-	/** Renvoyer le secret des authentifications */
62
-	public function getSecretAuth(bool $autoInit = false): ?string {
63
-		return $this->getKey('secret_des_auth', $autoInit);
64
-	}
65
-	public function save(): bool {
66
-		return ecrire_fichier_securise($this->file, $this->cles->toJson());
67
-	}
68
-
69
-	/**
70
-	 * Fournir une sauvegarde chiffree des cles (a l'aide d'une autre clé, comme le pass d'un auteur)
71
-	 *
72
-	 * @param string $withKey Clé de chiffrage de la sauvegarde
73
-	 * @return string Contenu de la sauvegarde chiffrée générée
74
-	 */
75
-	public function backup(
76
-		#[\SensitiveParameter]
77
-		string $withKey
78
-	): string {
79
-		if (count($this->cles)) {
80
-			return Chiffrement::chiffrer($this->cles->toJson(), $withKey);
81
-		}
82
-		return '';
83
-	}
84
-
85
-	/**
86
-	 * Restaurer les cles manquantes depuis une sauvegarde chiffree des cles
87
-	 * (si la sauvegarde est bien valide)
88
-	 *
89
-	 * @param string $backup Sauvegarde chiffrée (générée par backup())
90
-	 * @param int $id_auteur
91
-	 * @param string $pass
92
-	 * @return void
93
-	 */
94
-	public function restore(
95
-		string $backup,
96
-		#[\SensitiveParameter]
97
-		string $password_clair,
98
-		#[\SensitiveParameter]
99
-		string $password_hash,
100
-		int $id_auteur
101
-	): bool {
102
-		if (empty($backup)) {
103
-			return false;
104
-		}
105
-
106
-		$sauvegarde = Chiffrement::dechiffrer($backup, $password_clair);
107
-		$json = json_decode($sauvegarde, true);
108
-		if (!$json) {
109
-			return false;
110
-		}
111
-
112
-		// cela semble une sauvegarde valide
113
-		$cles_potentielles = array_map('base64_decode', $json);
114
-
115
-		// il faut faire une double verif sur secret_des_auth
116
-		// pour s'assurer qu'elle permet bien de decrypter le pass de l'auteur qui fournit la sauvegarde
117
-		// et par extension tous les passwords
118
-		if (!empty($cles_potentielles['secret_des_auth'])) {
119
-			if (!Password::verifier($password_clair, $password_hash, $cles_potentielles['secret_des_auth'])) {
120
-				spip_log("Restauration de la cle `secret_des_auth` par id_auteur $id_auteur erronnee, on ignore", 'chiffrer' . _LOG_INFO_IMPORTANTE);
121
-				unset($cles_potentielles['secret_des_auth']);
122
-			}
123
-		}
124
-
125
-		// on merge les cles pour recuperer les cles manquantes
126
-		$restauration = false;
127
-		foreach ($cles_potentielles as $name => $key) {
128
-			if (!$this->cles->has($name)) {
129
-				$this->cles->set($name, $key);
130
-				spip_log("Restauration de la cle $name par id_auteur $id_auteur", 'chiffrer' . _LOG_INFO_IMPORTANTE);
131
-				$restauration = true;
132
-			}
133
-		}
134
-		return $restauration;
135
-	}
136
-
137
-	private function getKey(string $name, bool $autoInit): ?string {
138
-		if ($this->cles->has($name)) {
139
-			return $this->cles->get($name);
140
-		}
141
-		if ($autoInit) {
142
-			$this->cles->generate($name);
143
-			// si l'ecriture de fichier a bien marche on peut utiliser la cle
144
-			if ($this->save()) {
145
-				return $this->cles->get($name);
146
-			}
147
-			// sinon loger et annule la cle generee car il ne faut pas l'utiliser
148
-			spip_log('Echec ecriture du fichier cle ' . $this->file . " ; impossible de generer une cle $name", 'chiffrer' . _LOG_ERREUR);
149
-			$this->cles->delete($name);
150
-		}
151
-		return null;
152
-	}
153
-
154
-	private function getMetaKey(string $name, bool $autoInit = true): ?string {
155
-		if (!isset($GLOBALS['meta'][$name])) {
156
-			include_spip('base/abstract_sql');
157
-			$GLOBALS['meta'][$name] = sql_getfetsel('valeur', 'spip_meta', 'nom = ' . sql_quote($name, '', 'string'));
158
-		}
159
-		$key = base64_decode($GLOBALS['meta'][$name] ?? '');
160
-		if (strlen($key) === \SODIUM_CRYPTO_SECRETBOX_KEYBYTES) {
161
-			return $key;
162
-		}
163
-		if (!$autoInit) {
164
-			return null;
165
-		}
166
-		$key = Chiffrement::keygen();
167
-		ecrire_meta($name, base64_encode($key), 'non');
168
-		lire_metas(); // au cas ou ecrire_meta() ne fonctionne pas
169
-
170
-		return $key;
171
-	}
172
-
173
-	private function read(): array {
174
-		lire_fichier_securise($this->file, $json);
175
-		if (
176
-			$json
177
-			and $json = \json_decode($json, true)
178
-			and is_array($json)
179
-		) {
180
-			return array_map('base64_decode', $json);
181
-		}
182
-		return [];
183
-	}
17
+    private static array $instances = [];
18
+
19
+    private string $file = _DIR_ETC . 'cles.php';
20
+    private Cles $cles;
21
+
22
+    public static function instance(string $file = ''): self {
23
+        if (empty(self::$instances[$file])) {
24
+            self::$instances[$file] = new self($file);
25
+        }
26
+        return self::$instances[$file];
27
+    }
28
+
29
+    /**
30
+     * Retourne le secret du site (shorthand)
31
+     * @uses self::getSecretSite()
32
+     */
33
+    public static function secret_du_site(): ?string {
34
+        return (self::instance())->getSecretSite();
35
+    }
36
+
37
+    private function __construct(string $file = '') {
38
+        if ($file) {
39
+            $this->file = $file;
40
+        }
41
+        $this->cles = new Cles($this->read());
42
+    }
43
+
44
+    /**
45
+     * Renvoyer le secret du site
46
+     *
47
+     * Le secret du site doit rester aussi secret que possible, et est eternel
48
+     * On ne doit pas l'exporter
49
+     *
50
+     * Le secret est partagé entre une clé disque et une clé bdd
51
+     *
52
+     * @return string
53
+     */
54
+    public function getSecretSite(bool $autoInit = true): ?string {
55
+        $key = $this->getKey('secret_du_site', $autoInit);
56
+        $meta = $this->getMetaKey('secret_du_site', $autoInit);
57
+        // conserve la même longeur.
58
+        return $key ^ $meta;
59
+    }
60
+
61
+    /** Renvoyer le secret des authentifications */
62
+    public function getSecretAuth(bool $autoInit = false): ?string {
63
+        return $this->getKey('secret_des_auth', $autoInit);
64
+    }
65
+    public function save(): bool {
66
+        return ecrire_fichier_securise($this->file, $this->cles->toJson());
67
+    }
68
+
69
+    /**
70
+     * Fournir une sauvegarde chiffree des cles (a l'aide d'une autre clé, comme le pass d'un auteur)
71
+     *
72
+     * @param string $withKey Clé de chiffrage de la sauvegarde
73
+     * @return string Contenu de la sauvegarde chiffrée générée
74
+     */
75
+    public function backup(
76
+        #[\SensitiveParameter]
77
+        string $withKey
78
+    ): string {
79
+        if (count($this->cles)) {
80
+            return Chiffrement::chiffrer($this->cles->toJson(), $withKey);
81
+        }
82
+        return '';
83
+    }
84
+
85
+    /**
86
+     * Restaurer les cles manquantes depuis une sauvegarde chiffree des cles
87
+     * (si la sauvegarde est bien valide)
88
+     *
89
+     * @param string $backup Sauvegarde chiffrée (générée par backup())
90
+     * @param int $id_auteur
91
+     * @param string $pass
92
+     * @return void
93
+     */
94
+    public function restore(
95
+        string $backup,
96
+        #[\SensitiveParameter]
97
+        string $password_clair,
98
+        #[\SensitiveParameter]
99
+        string $password_hash,
100
+        int $id_auteur
101
+    ): bool {
102
+        if (empty($backup)) {
103
+            return false;
104
+        }
105
+
106
+        $sauvegarde = Chiffrement::dechiffrer($backup, $password_clair);
107
+        $json = json_decode($sauvegarde, true);
108
+        if (!$json) {
109
+            return false;
110
+        }
111
+
112
+        // cela semble une sauvegarde valide
113
+        $cles_potentielles = array_map('base64_decode', $json);
114
+
115
+        // il faut faire une double verif sur secret_des_auth
116
+        // pour s'assurer qu'elle permet bien de decrypter le pass de l'auteur qui fournit la sauvegarde
117
+        // et par extension tous les passwords
118
+        if (!empty($cles_potentielles['secret_des_auth'])) {
119
+            if (!Password::verifier($password_clair, $password_hash, $cles_potentielles['secret_des_auth'])) {
120
+                spip_log("Restauration de la cle `secret_des_auth` par id_auteur $id_auteur erronnee, on ignore", 'chiffrer' . _LOG_INFO_IMPORTANTE);
121
+                unset($cles_potentielles['secret_des_auth']);
122
+            }
123
+        }
124
+
125
+        // on merge les cles pour recuperer les cles manquantes
126
+        $restauration = false;
127
+        foreach ($cles_potentielles as $name => $key) {
128
+            if (!$this->cles->has($name)) {
129
+                $this->cles->set($name, $key);
130
+                spip_log("Restauration de la cle $name par id_auteur $id_auteur", 'chiffrer' . _LOG_INFO_IMPORTANTE);
131
+                $restauration = true;
132
+            }
133
+        }
134
+        return $restauration;
135
+    }
136
+
137
+    private function getKey(string $name, bool $autoInit): ?string {
138
+        if ($this->cles->has($name)) {
139
+            return $this->cles->get($name);
140
+        }
141
+        if ($autoInit) {
142
+            $this->cles->generate($name);
143
+            // si l'ecriture de fichier a bien marche on peut utiliser la cle
144
+            if ($this->save()) {
145
+                return $this->cles->get($name);
146
+            }
147
+            // sinon loger et annule la cle generee car il ne faut pas l'utiliser
148
+            spip_log('Echec ecriture du fichier cle ' . $this->file . " ; impossible de generer une cle $name", 'chiffrer' . _LOG_ERREUR);
149
+            $this->cles->delete($name);
150
+        }
151
+        return null;
152
+    }
153
+
154
+    private function getMetaKey(string $name, bool $autoInit = true): ?string {
155
+        if (!isset($GLOBALS['meta'][$name])) {
156
+            include_spip('base/abstract_sql');
157
+            $GLOBALS['meta'][$name] = sql_getfetsel('valeur', 'spip_meta', 'nom = ' . sql_quote($name, '', 'string'));
158
+        }
159
+        $key = base64_decode($GLOBALS['meta'][$name] ?? '');
160
+        if (strlen($key) === \SODIUM_CRYPTO_SECRETBOX_KEYBYTES) {
161
+            return $key;
162
+        }
163
+        if (!$autoInit) {
164
+            return null;
165
+        }
166
+        $key = Chiffrement::keygen();
167
+        ecrire_meta($name, base64_encode($key), 'non');
168
+        lire_metas(); // au cas ou ecrire_meta() ne fonctionne pas
169
+
170
+        return $key;
171
+    }
172
+
173
+    private function read(): array {
174
+        lire_fichier_securise($this->file, $json);
175
+        if (
176
+            $json
177
+            and $json = \json_decode($json, true)
178
+            and is_array($json)
179
+        ) {
180
+            return array_map('base64_decode', $json);
181
+        }
182
+        return [];
183
+    }
184 184
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 final class SpipCles {
17 17
 	private static array $instances = [];
18 18
 
19
-	private string $file = _DIR_ETC . 'cles.php';
19
+	private string $file = _DIR_ETC.'cles.php';
20 20
 	private Cles $cles;
21 21
 
22 22
 	public static function instance(string $file = ''): self {
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 		// et par extension tous les passwords
118 118
 		if (!empty($cles_potentielles['secret_des_auth'])) {
119 119
 			if (!Password::verifier($password_clair, $password_hash, $cles_potentielles['secret_des_auth'])) {
120
-				spip_log("Restauration de la cle `secret_des_auth` par id_auteur $id_auteur erronnee, on ignore", 'chiffrer' . _LOG_INFO_IMPORTANTE);
120
+				spip_log("Restauration de la cle `secret_des_auth` par id_auteur $id_auteur erronnee, on ignore", 'chiffrer'._LOG_INFO_IMPORTANTE);
121 121
 				unset($cles_potentielles['secret_des_auth']);
122 122
 			}
123 123
 		}
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 		foreach ($cles_potentielles as $name => $key) {
128 128
 			if (!$this->cles->has($name)) {
129 129
 				$this->cles->set($name, $key);
130
-				spip_log("Restauration de la cle $name par id_auteur $id_auteur", 'chiffrer' . _LOG_INFO_IMPORTANTE);
130
+				spip_log("Restauration de la cle $name par id_auteur $id_auteur", 'chiffrer'._LOG_INFO_IMPORTANTE);
131 131
 				$restauration = true;
132 132
 			}
133 133
 		}
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 				return $this->cles->get($name);
146 146
 			}
147 147
 			// sinon loger et annule la cle generee car il ne faut pas l'utiliser
148
-			spip_log('Echec ecriture du fichier cle ' . $this->file . " ; impossible de generer une cle $name", 'chiffrer' . _LOG_ERREUR);
148
+			spip_log('Echec ecriture du fichier cle '.$this->file." ; impossible de generer une cle $name", 'chiffrer'._LOG_ERREUR);
149 149
 			$this->cles->delete($name);
150 150
 		}
151 151
 		return null;
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	private function getMetaKey(string $name, bool $autoInit = true): ?string {
155 155
 		if (!isset($GLOBALS['meta'][$name])) {
156 156
 			include_spip('base/abstract_sql');
157
-			$GLOBALS['meta'][$name] = sql_getfetsel('valeur', 'spip_meta', 'nom = ' . sql_quote($name, '', 'string'));
157
+			$GLOBALS['meta'][$name] = sql_getfetsel('valeur', 'spip_meta', 'nom = '.sql_quote($name, '', 'string'));
158 158
 		}
159 159
 		$key = base64_decode($GLOBALS['meta'][$name] ?? '');
160 160
 		if (strlen($key) === \SODIUM_CRYPTO_SECRETBOX_KEYBYTES) {
Please login to merge, or discard this patch.
ecrire/inc/modifier.php 2 patches
Indentation   +261 added lines, -261 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  **/
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 
23 23
 /**
@@ -39,28 +39,28 @@  discard block
 block discarded – undo
39 39
  *     Tableau des champs et valeurs collectées
40 40
  */
41 41
 function collecter_requests($include_list, $exclude_list = [], $set = null, $tous = false) {
42
-	$c = $set;
43
-	if (!$c) {
44
-		$c = [];
45
-		foreach ($include_list as $champ) {
46
-			// on ne collecte que les champs reellement envoyes par defaut.
47
-			// le cas d'un envoi de valeur NULL peut du coup poser probleme.
48
-			$val = _request($champ);
49
-			if ($tous or $val !== null) {
50
-				$c[$champ] = $val;
51
-			}
52
-		}
53
-		// on ajoute toujours la lang en saisie possible
54
-		// meme si pas prevu au depart pour l'objet concerne
55
-		if ($l = _request('changer_lang')) {
56
-			$c['lang'] = $l;
57
-		}
58
-	}
59
-	foreach ($exclude_list as $champ) {
60
-		unset($c[$champ]);
61
-	}
62
-
63
-	return $c;
42
+    $c = $set;
43
+    if (!$c) {
44
+        $c = [];
45
+        foreach ($include_list as $champ) {
46
+            // on ne collecte que les champs reellement envoyes par defaut.
47
+            // le cas d'un envoi de valeur NULL peut du coup poser probleme.
48
+            $val = _request($champ);
49
+            if ($tous or $val !== null) {
50
+                $c[$champ] = $val;
51
+            }
52
+        }
53
+        // on ajoute toujours la lang en saisie possible
54
+        // meme si pas prevu au depart pour l'objet concerne
55
+        if ($l = _request('changer_lang')) {
56
+            $c['lang'] = $l;
57
+        }
58
+    }
59
+    foreach ($exclude_list as $champ) {
60
+        unset($c[$champ]);
61
+    }
62
+
63
+    return $c;
64 64
 }
65 65
 
66 66
 /**
@@ -97,242 +97,242 @@  discard block
 block discarded – undo
97 97
  *     - chaîne : Texte d'un message d'erreur
98 98
  */
99 99
 function objet_modifier_champs($objet, $id_objet, $options, $c = null, $serveur = '') {
100
-	if (!$id_objet = intval($id_objet)) {
101
-		spip_log('Erreur $id_objet non defini', 'warn');
102
-
103
-		return _T('erreur_technique_enregistrement_impossible');
104
-	}
105
-
106
-	include_spip('inc/filtres');
107
-
108
-	$table_objet = table_objet($objet, $serveur);
109
-	$spip_table_objet = table_objet_sql($objet, $serveur);
110
-	$id_table_objet = id_table_objet($objet, $serveur);
111
-	$trouver_table = charger_fonction('trouver_table', 'base');
112
-	$desc = $trouver_table($spip_table_objet, $serveur);
113
-
114
-	// Appels incomplets (sans $c)
115
-	if (!is_array($c)) {
116
-		spip_log('erreur appel objet_modifier_champs(' . $objet . '), manque $c');
117
-
118
-		return _T('erreur_technique_enregistrement_impossible');
119
-	}
120
-
121
-	// Securite : certaines variables ne sont jamais acceptees ici
122
-	// car elles ne relevent pas de autoriser(xxx, modifier) ;
123
-	// il faut passer par instituer_XX()
124
-	// TODO: faut-il passer ces variables interdites
125
-	// dans un fichier de description separe ?
126
-	unset($c['statut']);
127
-	unset($c['id_parent']);
128
-	unset($c['id_rubrique']);
129
-	unset($c['id_secteur']);
130
-
131
-	// Gerer les champs non vides
132
-	if (isset($options['nonvide']) and is_array($options['nonvide'])) {
133
-		foreach ($options['nonvide'] as $champ => $sinon) {
134
-			if (isset($c[$champ]) and $c[$champ] === '') {
135
-				$c[$champ] = $sinon;
136
-			}
137
-		}
138
-	}
139
-
140
-	// N'accepter que les champs qui existent dans la table
141
-	$champs = array_intersect_key($c, $desc['field']);
142
-	// et dont la valeur n'est pas null
143
-	$champs = array_filter($champs, static function ($var) {
144
-		return $var !== null;
145
-	});
146
-	// TODO: ici aussi on peut valider les contenus
147
-	// en fonction du type
148
-
149
-	// Nettoyer les valeurs
150
-	$champs = array_map('corriger_caracteres', $champs);
151
-
152
-	// On récupère l'état avant toute modification
153
-	$row = sql_fetsel('*', $spip_table_objet, $id_table_objet . '=' . $id_objet);
154
-
155
-	// Envoyer aux plugins
156
-	$champs = pipeline(
157
-		'pre_edition',
158
-		[
159
-			'args' => [
160
-				'table' => $spip_table_objet, // compatibilite
161
-				'table_objet' => $table_objet,
162
-				'spip_table_objet' => $spip_table_objet,
163
-				'desc' => $desc,
164
-				'type' => $objet,
165
-				'id_objet' => $id_objet,
166
-				'data' => $options['data'] ?? null,
167
-				'champs' => $options['champs'] ?? [], // [doc] c'est quoi ?
168
-				'champs_anciens' => $row, // état du contenu avant modif
169
-				'serveur' => $serveur,
170
-				'action' => $options['action'] ?? 'modifier'
171
-			],
172
-			'data' => $champs
173
-		]
174
-	);
175
-
176
-	if (!$champs) {
177
-		return false;
178
-	}
179
-
180
-
181
-	// marquer le fait que l'objet est travaille par toto a telle date
182
-	include_spip('inc/config');
183
-	if (lire_config('articles_modif', 'non') !== 'non') {
184
-		include_spip('inc/drapeau_edition');
185
-		signale_edition($id_objet, $GLOBALS['visiteur_session'], $objet);
186
-	}
187
-
188
-	// Verifier si les mises a jour sont pertinentes, datees, en conflit etc
189
-	include_spip('inc/editer');
190
-	if (!isset($options['data']) or is_null($options['data'])) {
191
-		$options['data'] = &$_POST;
192
-	}
193
-	$conflits = controler_md5($champs, $options['data'], $objet, $id_objet, $serveur);
194
-	// cas hypothetique : normalement inc/editer verifie en amont le conflit edition
195
-	// et gere l'interface
196
-	// ici on ne renvoie donc qu'un messsage d'erreur, au cas ou on y arrive quand meme
197
-	if ($conflits) {
198
-		return _T('titre_conflit_edition');
199
-	}
200
-
201
-	if ($champs) {
202
-		// cas particulier de la langue : passer par instituer_langue_objet
203
-		if (isset($champs['lang'])) {
204
-			if ($changer_lang = $champs['lang']) {
205
-				$id_rubrique = 0;
206
-				if (isset($desc['field']['id_rubrique'])) {
207
-					$parent = ($objet == 'rubrique') ? 'id_parent' : 'id_rubrique';
208
-					$id_rubrique = sql_getfetsel($parent, $spip_table_objet, "$id_table_objet=" . intval($id_objet));
209
-				}
210
-				$instituer_langue_objet = charger_fonction('instituer_langue_objet', 'action');
211
-				$champs['lang'] = $instituer_langue_objet($objet, $id_objet, $id_rubrique, $changer_lang, $serveur);
212
-			}
213
-			// on laisse 'lang' dans $champs,
214
-			// ca permet de passer dans le pipeline post_edition et de journaliser
215
-			// et ca ne gene pas qu'on refasse un sql_updateq dessus apres l'avoir
216
-			// deja pris en compte
217
-		}
218
-
219
-		// la modif peut avoir lieu
220
-
221
-		// faut-il ajouter date_modif ?
222
-		if (
223
-			!empty($options['date_modif'])
224
-			and !isset($champs[$options['date_modif']])
225
-		) {
226
-			$champs[$options['date_modif']] = date('Y-m-d H:i:s');
227
-		}
228
-
229
-		// allez on commit la modif
230
-		sql_updateq($spip_table_objet, $champs, "$id_table_objet=" . intval($id_objet), [], $serveur);
231
-
232
-		// on verifie si elle est bien passee
233
-		$moof = sql_fetsel(
234
-			array_keys($champs),
235
-			$spip_table_objet,
236
-			"$id_table_objet=" . intval($id_objet),
237
-			[],
238
-			[],
239
-			'',
240
-			[],
241
-			$serveur
242
-		);
243
-		// si difference entre les champs, reperer les champs mal enregistres
244
-		if ($moof != $champs) {
245
-			$liste = [];
246
-			foreach ($moof as $k => $v) {
247
-				if (
248
-					$v !== $champs[$k]
249
-					// ne pas alerter si le champ est numerique est que les valeurs sont equivalentes
250
-					and (!is_numeric($v) or intval($v) !== intval($champs[$k]))
251
-					// ne pas alerter si le champ est date, qu'on a envoye une valeur vide et qu'on recupere une date nulle
252
-					and (strlen($champs[$k]) or !in_array($v, ['0000-00-00 00:00:00', '0000-00-00']))
253
-				) {
254
-					$liste[] = $k;
255
-					$conflits[$k]['post'] = $champs[$k];
256
-					$conflits[$k]['save'] = $v;
257
-
258
-					// cas specifique MySQL+emoji : si l'un est la
259
-					// conversion utf8_noplanes de l'autre alors c'est OK
260
-					if (defined('_MYSQL_NOPLANES') && _MYSQL_NOPLANES) {
261
-						include_spip('inc/charsets');
262
-						if ($v == utf8_noplanes($champs[$k])) {
263
-							array_pop($liste);
264
-						}
265
-					}
266
-				}
267
-			}
268
-			// si un champ n'a pas ete correctement enregistre, loger et retourner une erreur
269
-			// c'est un cas exceptionnel
270
-			if (count($liste)) {
271
-				spip_log(
272
-					"Erreur enregistrement en base $objet/$id_objet champs :" . var_export($conflits, true),
273
-					'modifier.' . _LOG_CRITIQUE
274
-				);
275
-
276
-				return _T(
277
-					'erreur_technique_enregistrement_champs',
278
-					['champs' => "<i>'" . implode("'</i>,<i>'", $liste) . "'</i>"]
279
-				);
280
-			}
281
-		}
282
-
283
-		// Invalider les caches
284
-		if (isset($options['invalideur']) and $options['invalideur']) {
285
-			include_spip('inc/invalideur');
286
-			if (is_array($options['invalideur'])) {
287
-				array_map('suivre_invalideur', $options['invalideur']);
288
-			} else {
289
-				suivre_invalideur($options['invalideur']);
290
-			}
291
-		}
292
-
293
-		// Notifications, gestion des revisions...
294
-		// en standard, appelle |nouvelle_revision ci-dessous
295
-		pipeline(
296
-			'post_edition',
297
-			[
298
-				'args' => [
299
-					'table' => $spip_table_objet,
300
-					'table_objet' => $table_objet,
301
-					'spip_table_objet' => $spip_table_objet,
302
-					'desc' => $desc,
303
-					'type' => $objet,
304
-					'id_objet' => $id_objet,
305
-					'champs' => $options['champs'] ?? [], // [doc] kesako ?
306
-					'champs_anciens' => $row, // état du contenu avant modif
307
-					'serveur' => $serveur,
308
-					'action' => $options['action'] ?? 'modifier'
309
-				],
310
-				'data' => $champs
311
-			]
312
-		);
313
-	}
314
-
315
-	// journaliser l'affaire
316
-	// message a affiner :-)
317
-	include_spip('inc/filtres_mini');
318
-	$qui = '';
319
-	if (!empty($GLOBALS['visiteur_session']['id_auteur'])) {
320
-		$qui .= ' #id_auteur:' . $GLOBALS['visiteur_session']['id_auteur'] . '#';
321
-	}
322
-	if (!empty($GLOBALS['visiteur_session']['nom'])) {
323
-		$qui .= ' #nom:' . $GLOBALS['visiteur_session']['nom'] . '#';
324
-	}
325
-	if ($qui == '') {
326
-		$qui = '#ip:' . $GLOBALS['ip'] . '#';
327
-	}
328
-	journal(_L($qui . ' a édité ' . $objet . ' ' . $id_objet . ' (' . join(
329
-		'+',
330
-		array_diff(array_keys($champs), ['date_modif'])
331
-	) . ')'), [
332
-		'faire' => 'modifier',
333
-		'quoi' => $objet,
334
-		'id' => $id_objet
335
-	]);
336
-
337
-	return '';
100
+    if (!$id_objet = intval($id_objet)) {
101
+        spip_log('Erreur $id_objet non defini', 'warn');
102
+
103
+        return _T('erreur_technique_enregistrement_impossible');
104
+    }
105
+
106
+    include_spip('inc/filtres');
107
+
108
+    $table_objet = table_objet($objet, $serveur);
109
+    $spip_table_objet = table_objet_sql($objet, $serveur);
110
+    $id_table_objet = id_table_objet($objet, $serveur);
111
+    $trouver_table = charger_fonction('trouver_table', 'base');
112
+    $desc = $trouver_table($spip_table_objet, $serveur);
113
+
114
+    // Appels incomplets (sans $c)
115
+    if (!is_array($c)) {
116
+        spip_log('erreur appel objet_modifier_champs(' . $objet . '), manque $c');
117
+
118
+        return _T('erreur_technique_enregistrement_impossible');
119
+    }
120
+
121
+    // Securite : certaines variables ne sont jamais acceptees ici
122
+    // car elles ne relevent pas de autoriser(xxx, modifier) ;
123
+    // il faut passer par instituer_XX()
124
+    // TODO: faut-il passer ces variables interdites
125
+    // dans un fichier de description separe ?
126
+    unset($c['statut']);
127
+    unset($c['id_parent']);
128
+    unset($c['id_rubrique']);
129
+    unset($c['id_secteur']);
130
+
131
+    // Gerer les champs non vides
132
+    if (isset($options['nonvide']) and is_array($options['nonvide'])) {
133
+        foreach ($options['nonvide'] as $champ => $sinon) {
134
+            if (isset($c[$champ]) and $c[$champ] === '') {
135
+                $c[$champ] = $sinon;
136
+            }
137
+        }
138
+    }
139
+
140
+    // N'accepter que les champs qui existent dans la table
141
+    $champs = array_intersect_key($c, $desc['field']);
142
+    // et dont la valeur n'est pas null
143
+    $champs = array_filter($champs, static function ($var) {
144
+        return $var !== null;
145
+    });
146
+    // TODO: ici aussi on peut valider les contenus
147
+    // en fonction du type
148
+
149
+    // Nettoyer les valeurs
150
+    $champs = array_map('corriger_caracteres', $champs);
151
+
152
+    // On récupère l'état avant toute modification
153
+    $row = sql_fetsel('*', $spip_table_objet, $id_table_objet . '=' . $id_objet);
154
+
155
+    // Envoyer aux plugins
156
+    $champs = pipeline(
157
+        'pre_edition',
158
+        [
159
+            'args' => [
160
+                'table' => $spip_table_objet, // compatibilite
161
+                'table_objet' => $table_objet,
162
+                'spip_table_objet' => $spip_table_objet,
163
+                'desc' => $desc,
164
+                'type' => $objet,
165
+                'id_objet' => $id_objet,
166
+                'data' => $options['data'] ?? null,
167
+                'champs' => $options['champs'] ?? [], // [doc] c'est quoi ?
168
+                'champs_anciens' => $row, // état du contenu avant modif
169
+                'serveur' => $serveur,
170
+                'action' => $options['action'] ?? 'modifier'
171
+            ],
172
+            'data' => $champs
173
+        ]
174
+    );
175
+
176
+    if (!$champs) {
177
+        return false;
178
+    }
179
+
180
+
181
+    // marquer le fait que l'objet est travaille par toto a telle date
182
+    include_spip('inc/config');
183
+    if (lire_config('articles_modif', 'non') !== 'non') {
184
+        include_spip('inc/drapeau_edition');
185
+        signale_edition($id_objet, $GLOBALS['visiteur_session'], $objet);
186
+    }
187
+
188
+    // Verifier si les mises a jour sont pertinentes, datees, en conflit etc
189
+    include_spip('inc/editer');
190
+    if (!isset($options['data']) or is_null($options['data'])) {
191
+        $options['data'] = &$_POST;
192
+    }
193
+    $conflits = controler_md5($champs, $options['data'], $objet, $id_objet, $serveur);
194
+    // cas hypothetique : normalement inc/editer verifie en amont le conflit edition
195
+    // et gere l'interface
196
+    // ici on ne renvoie donc qu'un messsage d'erreur, au cas ou on y arrive quand meme
197
+    if ($conflits) {
198
+        return _T('titre_conflit_edition');
199
+    }
200
+
201
+    if ($champs) {
202
+        // cas particulier de la langue : passer par instituer_langue_objet
203
+        if (isset($champs['lang'])) {
204
+            if ($changer_lang = $champs['lang']) {
205
+                $id_rubrique = 0;
206
+                if (isset($desc['field']['id_rubrique'])) {
207
+                    $parent = ($objet == 'rubrique') ? 'id_parent' : 'id_rubrique';
208
+                    $id_rubrique = sql_getfetsel($parent, $spip_table_objet, "$id_table_objet=" . intval($id_objet));
209
+                }
210
+                $instituer_langue_objet = charger_fonction('instituer_langue_objet', 'action');
211
+                $champs['lang'] = $instituer_langue_objet($objet, $id_objet, $id_rubrique, $changer_lang, $serveur);
212
+            }
213
+            // on laisse 'lang' dans $champs,
214
+            // ca permet de passer dans le pipeline post_edition et de journaliser
215
+            // et ca ne gene pas qu'on refasse un sql_updateq dessus apres l'avoir
216
+            // deja pris en compte
217
+        }
218
+
219
+        // la modif peut avoir lieu
220
+
221
+        // faut-il ajouter date_modif ?
222
+        if (
223
+            !empty($options['date_modif'])
224
+            and !isset($champs[$options['date_modif']])
225
+        ) {
226
+            $champs[$options['date_modif']] = date('Y-m-d H:i:s');
227
+        }
228
+
229
+        // allez on commit la modif
230
+        sql_updateq($spip_table_objet, $champs, "$id_table_objet=" . intval($id_objet), [], $serveur);
231
+
232
+        // on verifie si elle est bien passee
233
+        $moof = sql_fetsel(
234
+            array_keys($champs),
235
+            $spip_table_objet,
236
+            "$id_table_objet=" . intval($id_objet),
237
+            [],
238
+            [],
239
+            '',
240
+            [],
241
+            $serveur
242
+        );
243
+        // si difference entre les champs, reperer les champs mal enregistres
244
+        if ($moof != $champs) {
245
+            $liste = [];
246
+            foreach ($moof as $k => $v) {
247
+                if (
248
+                    $v !== $champs[$k]
249
+                    // ne pas alerter si le champ est numerique est que les valeurs sont equivalentes
250
+                    and (!is_numeric($v) or intval($v) !== intval($champs[$k]))
251
+                    // ne pas alerter si le champ est date, qu'on a envoye une valeur vide et qu'on recupere une date nulle
252
+                    and (strlen($champs[$k]) or !in_array($v, ['0000-00-00 00:00:00', '0000-00-00']))
253
+                ) {
254
+                    $liste[] = $k;
255
+                    $conflits[$k]['post'] = $champs[$k];
256
+                    $conflits[$k]['save'] = $v;
257
+
258
+                    // cas specifique MySQL+emoji : si l'un est la
259
+                    // conversion utf8_noplanes de l'autre alors c'est OK
260
+                    if (defined('_MYSQL_NOPLANES') && _MYSQL_NOPLANES) {
261
+                        include_spip('inc/charsets');
262
+                        if ($v == utf8_noplanes($champs[$k])) {
263
+                            array_pop($liste);
264
+                        }
265
+                    }
266
+                }
267
+            }
268
+            // si un champ n'a pas ete correctement enregistre, loger et retourner une erreur
269
+            // c'est un cas exceptionnel
270
+            if (count($liste)) {
271
+                spip_log(
272
+                    "Erreur enregistrement en base $objet/$id_objet champs :" . var_export($conflits, true),
273
+                    'modifier.' . _LOG_CRITIQUE
274
+                );
275
+
276
+                return _T(
277
+                    'erreur_technique_enregistrement_champs',
278
+                    ['champs' => "<i>'" . implode("'</i>,<i>'", $liste) . "'</i>"]
279
+                );
280
+            }
281
+        }
282
+
283
+        // Invalider les caches
284
+        if (isset($options['invalideur']) and $options['invalideur']) {
285
+            include_spip('inc/invalideur');
286
+            if (is_array($options['invalideur'])) {
287
+                array_map('suivre_invalideur', $options['invalideur']);
288
+            } else {
289
+                suivre_invalideur($options['invalideur']);
290
+            }
291
+        }
292
+
293
+        // Notifications, gestion des revisions...
294
+        // en standard, appelle |nouvelle_revision ci-dessous
295
+        pipeline(
296
+            'post_edition',
297
+            [
298
+                'args' => [
299
+                    'table' => $spip_table_objet,
300
+                    'table_objet' => $table_objet,
301
+                    'spip_table_objet' => $spip_table_objet,
302
+                    'desc' => $desc,
303
+                    'type' => $objet,
304
+                    'id_objet' => $id_objet,
305
+                    'champs' => $options['champs'] ?? [], // [doc] kesako ?
306
+                    'champs_anciens' => $row, // état du contenu avant modif
307
+                    'serveur' => $serveur,
308
+                    'action' => $options['action'] ?? 'modifier'
309
+                ],
310
+                'data' => $champs
311
+            ]
312
+        );
313
+    }
314
+
315
+    // journaliser l'affaire
316
+    // message a affiner :-)
317
+    include_spip('inc/filtres_mini');
318
+    $qui = '';
319
+    if (!empty($GLOBALS['visiteur_session']['id_auteur'])) {
320
+        $qui .= ' #id_auteur:' . $GLOBALS['visiteur_session']['id_auteur'] . '#';
321
+    }
322
+    if (!empty($GLOBALS['visiteur_session']['nom'])) {
323
+        $qui .= ' #nom:' . $GLOBALS['visiteur_session']['nom'] . '#';
324
+    }
325
+    if ($qui == '') {
326
+        $qui = '#ip:' . $GLOBALS['ip'] . '#';
327
+    }
328
+    journal(_L($qui . ' a édité ' . $objet . ' ' . $id_objet . ' (' . join(
329
+        '+',
330
+        array_diff(array_keys($champs), ['date_modif'])
331
+    ) . ')'), [
332
+        'faire' => 'modifier',
333
+        'quoi' => $objet,
334
+        'id' => $id_objet
335
+    ]);
336
+
337
+    return '';
338 338
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
 	// Appels incomplets (sans $c)
115 115
 	if (!is_array($c)) {
116
-		spip_log('erreur appel objet_modifier_champs(' . $objet . '), manque $c');
116
+		spip_log('erreur appel objet_modifier_champs('.$objet.'), manque $c');
117 117
 
118 118
 		return _T('erreur_technique_enregistrement_impossible');
119 119
 	}
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 	// N'accepter que les champs qui existent dans la table
141 141
 	$champs = array_intersect_key($c, $desc['field']);
142 142
 	// et dont la valeur n'est pas null
143
-	$champs = array_filter($champs, static function ($var) {
143
+	$champs = array_filter($champs, static function($var) {
144 144
 		return $var !== null;
145 145
 	});
146 146
 	// TODO: ici aussi on peut valider les contenus
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	$champs = array_map('corriger_caracteres', $champs);
151 151
 
152 152
 	// On récupère l'état avant toute modification
153
-	$row = sql_fetsel('*', $spip_table_objet, $id_table_objet . '=' . $id_objet);
153
+	$row = sql_fetsel('*', $spip_table_objet, $id_table_objet.'='.$id_objet);
154 154
 
155 155
 	// Envoyer aux plugins
156 156
 	$champs = pipeline(
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 				$id_rubrique = 0;
206 206
 				if (isset($desc['field']['id_rubrique'])) {
207 207
 					$parent = ($objet == 'rubrique') ? 'id_parent' : 'id_rubrique';
208
-					$id_rubrique = sql_getfetsel($parent, $spip_table_objet, "$id_table_objet=" . intval($id_objet));
208
+					$id_rubrique = sql_getfetsel($parent, $spip_table_objet, "$id_table_objet=".intval($id_objet));
209 209
 				}
210 210
 				$instituer_langue_objet = charger_fonction('instituer_langue_objet', 'action');
211 211
 				$champs['lang'] = $instituer_langue_objet($objet, $id_objet, $id_rubrique, $changer_lang, $serveur);
@@ -227,13 +227,13 @@  discard block
 block discarded – undo
227 227
 		}
228 228
 
229 229
 		// allez on commit la modif
230
-		sql_updateq($spip_table_objet, $champs, "$id_table_objet=" . intval($id_objet), [], $serveur);
230
+		sql_updateq($spip_table_objet, $champs, "$id_table_objet=".intval($id_objet), [], $serveur);
231 231
 
232 232
 		// on verifie si elle est bien passee
233 233
 		$moof = sql_fetsel(
234 234
 			array_keys($champs),
235 235
 			$spip_table_objet,
236
-			"$id_table_objet=" . intval($id_objet),
236
+			"$id_table_objet=".intval($id_objet),
237 237
 			[],
238 238
 			[],
239 239
 			'',
@@ -269,13 +269,13 @@  discard block
 block discarded – undo
269 269
 			// c'est un cas exceptionnel
270 270
 			if (count($liste)) {
271 271
 				spip_log(
272
-					"Erreur enregistrement en base $objet/$id_objet champs :" . var_export($conflits, true),
273
-					'modifier.' . _LOG_CRITIQUE
272
+					"Erreur enregistrement en base $objet/$id_objet champs :".var_export($conflits, true),
273
+					'modifier.'._LOG_CRITIQUE
274 274
 				);
275 275
 
276 276
 				return _T(
277 277
 					'erreur_technique_enregistrement_champs',
278
-					['champs' => "<i>'" . implode("'</i>,<i>'", $liste) . "'</i>"]
278
+					['champs' => "<i>'".implode("'</i>,<i>'", $liste)."'</i>"]
279 279
 				);
280 280
 			}
281 281
 		}
@@ -317,18 +317,18 @@  discard block
 block discarded – undo
317 317
 	include_spip('inc/filtres_mini');
318 318
 	$qui = '';
319 319
 	if (!empty($GLOBALS['visiteur_session']['id_auteur'])) {
320
-		$qui .= ' #id_auteur:' . $GLOBALS['visiteur_session']['id_auteur'] . '#';
320
+		$qui .= ' #id_auteur:'.$GLOBALS['visiteur_session']['id_auteur'].'#';
321 321
 	}
322 322
 	if (!empty($GLOBALS['visiteur_session']['nom'])) {
323
-		$qui .= ' #nom:' . $GLOBALS['visiteur_session']['nom'] . '#';
323
+		$qui .= ' #nom:'.$GLOBALS['visiteur_session']['nom'].'#';
324 324
 	}
325 325
 	if ($qui == '') {
326
-		$qui = '#ip:' . $GLOBALS['ip'] . '#';
326
+		$qui = '#ip:'.$GLOBALS['ip'].'#';
327 327
 	}
328
-	journal(_L($qui . ' a édité ' . $objet . ' ' . $id_objet . ' (' . join(
328
+	journal(_L($qui.' a édité '.$objet.' '.$id_objet.' ('.join(
329 329
 		'+',
330 330
 		array_diff(array_keys($champs), ['date_modif'])
331
-	) . ')'), [
331
+	).')'), [
332 332
 		'faire' => 'modifier',
333 333
 		'quoi' => $objet,
334 334
 		'id' => $id_objet
Please login to merge, or discard this patch.
ecrire/auth/spip.php 3 patches
Indentation   +412 added lines, -412 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 use Spip\Chiffrer\SpipCles;
20 20
 
21 21
 if (!defined('_ECRIRE_INC_VERSION')) {
22
-	return;
22
+    return;
23 23
 }
24 24
 
25 25
 /**
@@ -34,170 +34,170 @@  discard block
 block discarded – undo
34 34
  */
35 35
 function auth_spip_dist($login, $pass, $serveur = '', $phpauth = false) {
36 36
 
37
-	// retrouver le login
38
-	$login = auth_spip_retrouver_login($login);
39
-	// login inconnu, n'allons pas plus loin
40
-	if (!$login) {
41
-		return [];
42
-	}
43
-
44
-	$md5pass = '';
45
-	$shapass = $shanext = '';
46
-	$auteur_peut_sauver_cles = false;
47
-
48
-	if ($pass) {
49
-		$row = sql_fetsel(
50
-			'*',
51
-			'spip_auteurs',
52
-			'login=' . sql_quote($login, $serveur, 'text') . " AND statut<>'5poubelle'",
53
-			'',
54
-			'',
55
-			'',
56
-			'',
57
-			$serveur
58
-		);
59
-
60
-		// lever un flag si cet auteur peut sauver les cles
61
-		if ($row['statut'] === '0minirezo' and $row['webmestre'] === 'oui' and isset($row['backup_cles'])) {
62
-			$auteur_peut_sauver_cles = true;
63
-		}
64
-	}
65
-
66
-	// login inexistant ou mot de passe vide
67
-	if (!$pass or !$row) {
68
-		return [];
69
-	}
70
-
71
-	include_spip('inc/chiffrer');
72
-	$cles = SpipCles::instance();
73
-	$secret = $cles->getSecretAuth();
74
-
75
-	$hash = null;
76
-	switch (strlen($row['pass'])) {
77
-		// legacy = md5 ou sha256
78
-		case 32:
79
-			// tres anciens mots de passe encodes en md5(alea.pass)
80
-			$hash = md5($row['alea_actuel'] . $pass);
81
-			$methode = 'md5';
82
-		case 64:
83
-			if (empty($hash)) {
84
-				// anciens mots de passe encodes en sha256(alea.pass)
85
-				include_spip('auth/sha256.inc');
86
-				$hash = spip_sha256($row['alea_actuel'] . $pass);
87
-				$methode = 'sha256';
88
-			}
89
-			if ($row['pass'] === $hash) {
90
-				spip_log("validation du mot de passe pour l'auteur #" . $row['id_auteur'] . " $login via $methode", 'auth' . _LOG_DEBUG);
91
-				// ce n'est pas cense arriver, mais si jamais c'est un backup inutilisable, il faut le nettoyer pour ne pas bloquer la creation d'une nouvelle cle d'auth
92
-				if (!empty($row['backup_cles'])) {
93
-					sql_updateq('spip_auteurs', ['backup_cles' => ''], 'id_auteur=' . intval($row['id_auteur']));
94
-				}
95
-				break;
96
-			}
97
-
98
-		// on teste la methode par defaut, au cas ou ce serait un pass moderne qui a la malchance d'etre en 64char de long
99
-
100
-		case 60:
101
-		case 98:
102
-		default:
103
-			// doit-on restaurer un backup des cles ?
104
-			// si on a le bon pass on peut decoder le backup, retrouver la cle, et du coup valider le pass
105
-			if (
106
-				!$secret
107
-				and $auteur_peut_sauver_cles
108
-				and !empty($row['backup_cles'])
109
-			) {
110
-				if ($cles->restore($row['backup_cles'], $pass, $row['pass'], $row['id_auteur'])) {
111
-					spip_log('Les cles secretes ont ete restaurées avec le backup du webmestre #' . $row['id_auteur'], 'auth' . _LOG_INFO_IMPORTANTE);
112
-					if ($cles->save()) {
113
-						$secret = $cles->getSecretAuth();
114
-					}
115
-					else {
116
-						spip_log("Echec restauration des cles : verifier les droits d'ecriture ?", 'auth' . _LOG_ERREUR);
117
-						// et on echoue car on ne veut pas que la situation reste telle quelle
118
-						raler_fichier(_DIR_ETC . 'cles.php');
119
-					}
120
-				}
121
-				else {
122
-					spip_log('Pas de cle secrete disponible (fichier config/cle.php absent ?) mais le backup du webmestre #' . $row['id_auteur'] . " n'est pas valide", 'auth' . _LOG_ERREUR);
123
-					sql_updateq('spip_auteurs', ['backup_cles' => ''], 'id_auteur=' . intval($row['id_auteur']));
124
-				}
125
-			}
126
-
127
-			if (!$secret or !Password::verifier($pass, $row['pass'], $secret)) {
128
-				unset($row);
129
-			}
130
-			else {
131
-				spip_log("validation du mot de passe pour l'auteur #" . $row['id_auteur'] . " $login via Password::verifier", 'auth' . _LOG_DEBUG);
132
-			}
133
-			break;
134
-	}
135
-
136
-	// Migration depuis ancienne version : si on a pas encore de cle
137
-	// ET si c'est le login d'un auteur qui peut sauver la cle
138
-	// créer la clé (en s'assurant bien que personne n'a de backup d'un precedent fichier cle.php)
139
-	// si c'est un auteur normal, on ne fait rien, il garde son ancien pass hashé en sha256 en attendant le login d'un webmestre
140
-	if (!$secret and $auteur_peut_sauver_cles) {
141
-		if (auth_spip_initialiser_secret()) {
142
-			$secret = $cles->getSecretAuth();
143
-		}
144
-	}
145
-
146
-	// login/mot de passe incorrect
147
-	if (empty($row)) {
148
-		return [];
149
-	}
150
-
151
-	// fait tourner le codage du pass dans la base
152
-	// sauf si phpauth : cela reviendrait a changer l'alea a chaque hit, et aucune action verifiable par securiser_action()
153
-	if (!$phpauth and $secret) {
154
-		include_spip('inc/acces'); // pour creer_uniqid et verifier_htaccess
155
-		$pass_hash_next = Password::hacher($pass, $secret);
156
-		if ($pass_hash_next) {
157
-			$set = [
158
-				'alea_actuel' => 'alea_futur', // @deprecated 4.1
159
-				'alea_futur' => sql_quote(creer_uniqid(), $serveur, 'text'), // @deprecated 4.1
160
-				'pass' => sql_quote($pass_hash_next, $serveur, 'text'),
161
-			];
162
-
163
-			// regenerer un htpass si on a active/desactive le plugin htpasswd
164
-			// et/ou que l'algo a change - pour etre certain de toujours utiliser le bon algo
165
-			$htpass = generer_htpass($pass);
166
-			if (strlen($htpass) !== strlen($row['htpass'])) {
167
-				$set['htpass'] = sql_quote($htpass, $serveur, 'text');
168
-			}
169
-
170
-			// a chaque login de webmestre : sauvegarde chiffree des clés du site (avec les pass du webmestre)
171
-			if ($auteur_peut_sauver_cles) {
172
-				$set['backup_cles'] = sql_quote($cles->backup($pass), $serveur, 'text');
173
-			}
174
-
175
-			@sql_update(
176
-				'spip_auteurs',
177
-				$set,
178
-				'id_auteur=' . intval($row['id_auteur']) . ' AND pass=' . sql_quote(
179
-					$row['pass'],
180
-					$serveur,
181
-					'text'
182
-				),
183
-				[],
184
-				$serveur
185
-			);
186
-
187
-			// si on a change le htpass car changement d'algo, regenerer les fichiers htpasswd
188
-			if (isset($set['htpass'])) {
189
-				ecrire_acces();
190
-			}
191
-		}
192
-
193
-		// En profiter pour verifier la securite de tmp/
194
-		// Si elle ne fonctionne pas a l'installation, prevenir
195
-		if (!verifier_htaccess(_DIR_TMP) and defined('_ECRIRE_INSTALL')) {
196
-			return false;
197
-		}
198
-	}
199
-
200
-	return $row;
37
+    // retrouver le login
38
+    $login = auth_spip_retrouver_login($login);
39
+    // login inconnu, n'allons pas plus loin
40
+    if (!$login) {
41
+        return [];
42
+    }
43
+
44
+    $md5pass = '';
45
+    $shapass = $shanext = '';
46
+    $auteur_peut_sauver_cles = false;
47
+
48
+    if ($pass) {
49
+        $row = sql_fetsel(
50
+            '*',
51
+            'spip_auteurs',
52
+            'login=' . sql_quote($login, $serveur, 'text') . " AND statut<>'5poubelle'",
53
+            '',
54
+            '',
55
+            '',
56
+            '',
57
+            $serveur
58
+        );
59
+
60
+        // lever un flag si cet auteur peut sauver les cles
61
+        if ($row['statut'] === '0minirezo' and $row['webmestre'] === 'oui' and isset($row['backup_cles'])) {
62
+            $auteur_peut_sauver_cles = true;
63
+        }
64
+    }
65
+
66
+    // login inexistant ou mot de passe vide
67
+    if (!$pass or !$row) {
68
+        return [];
69
+    }
70
+
71
+    include_spip('inc/chiffrer');
72
+    $cles = SpipCles::instance();
73
+    $secret = $cles->getSecretAuth();
74
+
75
+    $hash = null;
76
+    switch (strlen($row['pass'])) {
77
+        // legacy = md5 ou sha256
78
+        case 32:
79
+            // tres anciens mots de passe encodes en md5(alea.pass)
80
+            $hash = md5($row['alea_actuel'] . $pass);
81
+            $methode = 'md5';
82
+        case 64:
83
+            if (empty($hash)) {
84
+                // anciens mots de passe encodes en sha256(alea.pass)
85
+                include_spip('auth/sha256.inc');
86
+                $hash = spip_sha256($row['alea_actuel'] . $pass);
87
+                $methode = 'sha256';
88
+            }
89
+            if ($row['pass'] === $hash) {
90
+                spip_log("validation du mot de passe pour l'auteur #" . $row['id_auteur'] . " $login via $methode", 'auth' . _LOG_DEBUG);
91
+                // ce n'est pas cense arriver, mais si jamais c'est un backup inutilisable, il faut le nettoyer pour ne pas bloquer la creation d'une nouvelle cle d'auth
92
+                if (!empty($row['backup_cles'])) {
93
+                    sql_updateq('spip_auteurs', ['backup_cles' => ''], 'id_auteur=' . intval($row['id_auteur']));
94
+                }
95
+                break;
96
+            }
97
+
98
+        // on teste la methode par defaut, au cas ou ce serait un pass moderne qui a la malchance d'etre en 64char de long
99
+
100
+        case 60:
101
+        case 98:
102
+        default:
103
+            // doit-on restaurer un backup des cles ?
104
+            // si on a le bon pass on peut decoder le backup, retrouver la cle, et du coup valider le pass
105
+            if (
106
+                !$secret
107
+                and $auteur_peut_sauver_cles
108
+                and !empty($row['backup_cles'])
109
+            ) {
110
+                if ($cles->restore($row['backup_cles'], $pass, $row['pass'], $row['id_auteur'])) {
111
+                    spip_log('Les cles secretes ont ete restaurées avec le backup du webmestre #' . $row['id_auteur'], 'auth' . _LOG_INFO_IMPORTANTE);
112
+                    if ($cles->save()) {
113
+                        $secret = $cles->getSecretAuth();
114
+                    }
115
+                    else {
116
+                        spip_log("Echec restauration des cles : verifier les droits d'ecriture ?", 'auth' . _LOG_ERREUR);
117
+                        // et on echoue car on ne veut pas que la situation reste telle quelle
118
+                        raler_fichier(_DIR_ETC . 'cles.php');
119
+                    }
120
+                }
121
+                else {
122
+                    spip_log('Pas de cle secrete disponible (fichier config/cle.php absent ?) mais le backup du webmestre #' . $row['id_auteur'] . " n'est pas valide", 'auth' . _LOG_ERREUR);
123
+                    sql_updateq('spip_auteurs', ['backup_cles' => ''], 'id_auteur=' . intval($row['id_auteur']));
124
+                }
125
+            }
126
+
127
+            if (!$secret or !Password::verifier($pass, $row['pass'], $secret)) {
128
+                unset($row);
129
+            }
130
+            else {
131
+                spip_log("validation du mot de passe pour l'auteur #" . $row['id_auteur'] . " $login via Password::verifier", 'auth' . _LOG_DEBUG);
132
+            }
133
+            break;
134
+    }
135
+
136
+    // Migration depuis ancienne version : si on a pas encore de cle
137
+    // ET si c'est le login d'un auteur qui peut sauver la cle
138
+    // créer la clé (en s'assurant bien que personne n'a de backup d'un precedent fichier cle.php)
139
+    // si c'est un auteur normal, on ne fait rien, il garde son ancien pass hashé en sha256 en attendant le login d'un webmestre
140
+    if (!$secret and $auteur_peut_sauver_cles) {
141
+        if (auth_spip_initialiser_secret()) {
142
+            $secret = $cles->getSecretAuth();
143
+        }
144
+    }
145
+
146
+    // login/mot de passe incorrect
147
+    if (empty($row)) {
148
+        return [];
149
+    }
150
+
151
+    // fait tourner le codage du pass dans la base
152
+    // sauf si phpauth : cela reviendrait a changer l'alea a chaque hit, et aucune action verifiable par securiser_action()
153
+    if (!$phpauth and $secret) {
154
+        include_spip('inc/acces'); // pour creer_uniqid et verifier_htaccess
155
+        $pass_hash_next = Password::hacher($pass, $secret);
156
+        if ($pass_hash_next) {
157
+            $set = [
158
+                'alea_actuel' => 'alea_futur', // @deprecated 4.1
159
+                'alea_futur' => sql_quote(creer_uniqid(), $serveur, 'text'), // @deprecated 4.1
160
+                'pass' => sql_quote($pass_hash_next, $serveur, 'text'),
161
+            ];
162
+
163
+            // regenerer un htpass si on a active/desactive le plugin htpasswd
164
+            // et/ou que l'algo a change - pour etre certain de toujours utiliser le bon algo
165
+            $htpass = generer_htpass($pass);
166
+            if (strlen($htpass) !== strlen($row['htpass'])) {
167
+                $set['htpass'] = sql_quote($htpass, $serveur, 'text');
168
+            }
169
+
170
+            // a chaque login de webmestre : sauvegarde chiffree des clés du site (avec les pass du webmestre)
171
+            if ($auteur_peut_sauver_cles) {
172
+                $set['backup_cles'] = sql_quote($cles->backup($pass), $serveur, 'text');
173
+            }
174
+
175
+            @sql_update(
176
+                'spip_auteurs',
177
+                $set,
178
+                'id_auteur=' . intval($row['id_auteur']) . ' AND pass=' . sql_quote(
179
+                    $row['pass'],
180
+                    $serveur,
181
+                    'text'
182
+                ),
183
+                [],
184
+                $serveur
185
+            );
186
+
187
+            // si on a change le htpass car changement d'algo, regenerer les fichiers htpasswd
188
+            if (isset($set['htpass'])) {
189
+                ecrire_acces();
190
+            }
191
+        }
192
+
193
+        // En profiter pour verifier la securite de tmp/
194
+        // Si elle ne fonctionne pas a l'installation, prevenir
195
+        if (!verifier_htaccess(_DIR_TMP) and defined('_ECRIRE_INSTALL')) {
196
+            return false;
197
+        }
198
+    }
199
+
200
+    return $row;
201 201
 }
202 202
 
203 203
 /**
@@ -212,37 +212,37 @@  discard block
 block discarded – undo
212 212
  * @return bool
213 213
  */
214 214
 function auth_spip_initialiser_secret(bool $force = false): bool {
215
-	include_spip('inc/chiffrer');
216
-	$cles = SpipCles::instance();
217
-	$secret = $cles->getSecretAuth();
218
-
219
-	// on ne fait rien si on a un secret dispo
220
-	if ($secret) {
221
-		return false;
222
-	}
223
-
224
-	// si force, on ne verifie pas la presence d'un backup chez un webmestre
225
-	if ($force) {
226
-		spip_log('Pas de cle secrete disponible, on regenere une nouvelle cle forcee - tous les mots de passe sont invalides', 'auth' . _LOG_INFO_IMPORTANTE);
227
-		$secret = $cles->getSecretAuth(true);
228
-		return true;
229
-	}
230
-
231
-	$has_backup = sql_allfetsel('id_auteur', 'spip_auteurs', 'statut=' . sql_quote('0minirezo') . ' AND webmestre=' . sql_quote('oui') . " AND backup_cles!=''");
232
-	$has_backup = array_column($has_backup, 'id_auteur');
233
-	if (empty($has_backup)) {
234
-		spip_log("Pas de cle secrete disponible, et aucun webmestre n'a de backup, on regenere une nouvelle cle - tous les mots de passe sont invalides", 'auth' . _LOG_INFO_IMPORTANTE);
235
-		if ($secret = $cles->getSecretAuth(true)) {
236
-			return true;
237
-		}
238
-		spip_log("Echec generation d'une nouvelle cle : verifier les droits d'ecriture ?", 'auth' . _LOG_ERREUR);
239
-		// et on echoue car on ne veut pas que la situation reste telle quelle
240
-		raler_fichier(_DIR_ETC . 'cles.php');
241
-	}
242
-	else {
243
-		spip_log('Pas de cle secrete disponible (fichier config/cle.php absent ?) un des webmestres #' . implode(', #', $has_backup) . ' doit se connecter pour restaurer son backup des cles', 'auth' . _LOG_ERREUR);
244
-	}
245
-	return false;
215
+    include_spip('inc/chiffrer');
216
+    $cles = SpipCles::instance();
217
+    $secret = $cles->getSecretAuth();
218
+
219
+    // on ne fait rien si on a un secret dispo
220
+    if ($secret) {
221
+        return false;
222
+    }
223
+
224
+    // si force, on ne verifie pas la presence d'un backup chez un webmestre
225
+    if ($force) {
226
+        spip_log('Pas de cle secrete disponible, on regenere une nouvelle cle forcee - tous les mots de passe sont invalides', 'auth' . _LOG_INFO_IMPORTANTE);
227
+        $secret = $cles->getSecretAuth(true);
228
+        return true;
229
+    }
230
+
231
+    $has_backup = sql_allfetsel('id_auteur', 'spip_auteurs', 'statut=' . sql_quote('0minirezo') . ' AND webmestre=' . sql_quote('oui') . " AND backup_cles!=''");
232
+    $has_backup = array_column($has_backup, 'id_auteur');
233
+    if (empty($has_backup)) {
234
+        spip_log("Pas de cle secrete disponible, et aucun webmestre n'a de backup, on regenere une nouvelle cle - tous les mots de passe sont invalides", 'auth' . _LOG_INFO_IMPORTANTE);
235
+        if ($secret = $cles->getSecretAuth(true)) {
236
+            return true;
237
+        }
238
+        spip_log("Echec generation d'une nouvelle cle : verifier les droits d'ecriture ?", 'auth' . _LOG_ERREUR);
239
+        // et on echoue car on ne veut pas que la situation reste telle quelle
240
+        raler_fichier(_DIR_ETC . 'cles.php');
241
+    }
242
+    else {
243
+        spip_log('Pas de cle secrete disponible (fichier config/cle.php absent ?) un des webmestres #' . implode(', #', $has_backup) . ' doit se connecter pour restaurer son backup des cles', 'auth' . _LOG_ERREUR);
244
+    }
245
+    return false;
246 246
 }
247 247
 
248 248
 /**
@@ -252,19 +252,19 @@  discard block
 block discarded – undo
252 252
  * @return array
253 253
  */
254 254
 function auth_spip_formulaire_login($flux) {
255
-	// javascript qui gere la securite du login en evitant de faire circuler le pass en clair
256
-	$js = file_get_contents(find_in_path('prive/javascript/login.js'));
257
-	$flux['data'] .=
258
-		  '<script type="text/javascript">/*<![CDATA[*/'
259
-		. "$js\n"
260
-		. "var login_info={'login':'" . $flux['args']['contexte']['var_login'] . "',"
261
-		. "'page_auteur': '" . generer_url_public('informer_auteur') . "',"
262
-		. "'informe_auteur_en_cours':false,"
263
-		. "'attente_informe':0};"
264
-		. "jQuery(function(){jQuery('#var_login').change(actualise_auteur);});"
265
-		. '/*]]>*/</script>';
266
-
267
-	return $flux;
255
+    // javascript qui gere la securite du login en evitant de faire circuler le pass en clair
256
+    $js = file_get_contents(find_in_path('prive/javascript/login.js'));
257
+    $flux['data'] .=
258
+            '<script type="text/javascript">/*<![CDATA[*/'
259
+        . "$js\n"
260
+        . "var login_info={'login':'" . $flux['args']['contexte']['var_login'] . "',"
261
+        . "'page_auteur': '" . generer_url_public('informer_auteur') . "',"
262
+        . "'informe_auteur_en_cours':false,"
263
+        . "'attente_informe':0};"
264
+        . "jQuery(function(){jQuery('#var_login').change(actualise_auteur);});"
265
+        . '/*]]>*/</script>';
266
+
267
+    return $flux;
268 268
 }
269 269
 
270 270
 
@@ -276,11 +276,11 @@  discard block
 block discarded – undo
276 276
  *   toujours true pour un auteur cree dans SPIP
277 277
  */
278 278
 function auth_spip_autoriser_modifier_login(string $serveur = ''): bool {
279
-	// les fonctions d'ecriture sur base distante sont encore incompletes
280
-	if (strlen($serveur)) {
281
-		return false;
282
-	}
283
-	return true;
279
+    // les fonctions d'ecriture sur base distante sont encore incompletes
280
+    if (strlen($serveur)) {
281
+        return false;
282
+    }
283
+    return true;
284 284
 }
285 285
 
286 286
 /**
@@ -294,25 +294,25 @@  discard block
 block discarded – undo
294 294
  *  message d'erreur si login non valide, chaine vide sinon
295 295
  */
296 296
 function auth_spip_verifier_login($new_login, $id_auteur = 0, $serveur = '') {
297
-	// login et mot de passe
298
-	if (strlen($new_login)) {
299
-		if (strlen($new_login) < _LOGIN_TROP_COURT) {
300
-			return _T('info_login_trop_court_car_pluriel', ['nb' => _LOGIN_TROP_COURT]);
301
-		} else {
302
-			$n = sql_countsel(
303
-				'spip_auteurs',
304
-				'login=' . sql_quote($new_login) . ' AND id_auteur!=' . intval($id_auteur) . " AND statut!='5poubelle'",
305
-				'',
306
-				'',
307
-				$serveur
308
-			);
309
-			if ($n) {
310
-				return _T('info_login_existant');
311
-			}
312
-		}
313
-	}
314
-
315
-	return '';
297
+    // login et mot de passe
298
+    if (strlen($new_login)) {
299
+        if (strlen($new_login) < _LOGIN_TROP_COURT) {
300
+            return _T('info_login_trop_court_car_pluriel', ['nb' => _LOGIN_TROP_COURT]);
301
+        } else {
302
+            $n = sql_countsel(
303
+                'spip_auteurs',
304
+                'login=' . sql_quote($new_login) . ' AND id_auteur!=' . intval($id_auteur) . " AND statut!='5poubelle'",
305
+                '',
306
+                '',
307
+                $serveur
308
+            );
309
+            if ($n) {
310
+                return _T('info_login_existant');
311
+            }
312
+        }
313
+    }
314
+
315
+    return '';
316 316
 }
317 317
 
318 318
 /**
@@ -324,41 +324,41 @@  discard block
 block discarded – undo
324 324
  * @return bool
325 325
  */
326 326
 function auth_spip_modifier_login($new_login, $id_auteur, $serveur = '') {
327
-	if (is_null($new_login) or auth_spip_verifier_login($new_login, $id_auteur, $serveur) != '') {
328
-		return false;
329
-	}
330
-	if (
331
-		!$id_auteur = intval($id_auteur)
332
-		or !$auteur = sql_fetsel('login', 'spip_auteurs', 'id_auteur=' . intval($id_auteur), '', '', '', '', $serveur)
333
-	) {
334
-		return false;
335
-	}
336
-	if ($new_login == $auteur['login']) {
337
-		return true;
338
-	} // on a rien fait mais c'est bon !
339
-
340
-	include_spip('action/editer_auteur');
341
-
342
-	// vider le login des auteurs a la poubelle qui avaient ce meme login
343
-	if (strlen($new_login)) {
344
-		$anciens = sql_allfetsel(
345
-			'id_auteur',
346
-			'spip_auteurs',
347
-			'login=' . sql_quote($new_login, $serveur, 'text') . " AND statut='5poubelle'",
348
-			'',
349
-			'',
350
-			'',
351
-			'',
352
-			$serveur
353
-		);
354
-		while ($row = array_pop($anciens)) {
355
-			auteur_modifier($row['id_auteur'], ['login' => ''], true); // manque la gestion de $serveur
356
-		}
357
-	}
358
-
359
-	auteur_modifier($id_auteur, ['login' => $new_login], true); // manque la gestion de $serveur
360
-
361
-	return true;
327
+    if (is_null($new_login) or auth_spip_verifier_login($new_login, $id_auteur, $serveur) != '') {
328
+        return false;
329
+    }
330
+    if (
331
+        !$id_auteur = intval($id_auteur)
332
+        or !$auteur = sql_fetsel('login', 'spip_auteurs', 'id_auteur=' . intval($id_auteur), '', '', '', '', $serveur)
333
+    ) {
334
+        return false;
335
+    }
336
+    if ($new_login == $auteur['login']) {
337
+        return true;
338
+    } // on a rien fait mais c'est bon !
339
+
340
+    include_spip('action/editer_auteur');
341
+
342
+    // vider le login des auteurs a la poubelle qui avaient ce meme login
343
+    if (strlen($new_login)) {
344
+        $anciens = sql_allfetsel(
345
+            'id_auteur',
346
+            'spip_auteurs',
347
+            'login=' . sql_quote($new_login, $serveur, 'text') . " AND statut='5poubelle'",
348
+            '',
349
+            '',
350
+            '',
351
+            '',
352
+            $serveur
353
+        );
354
+        while ($row = array_pop($anciens)) {
355
+            auteur_modifier($row['id_auteur'], ['login' => ''], true); // manque la gestion de $serveur
356
+        }
357
+    }
358
+
359
+    auteur_modifier($id_auteur, ['login' => $new_login], true); // manque la gestion de $serveur
360
+
361
+    return true;
362 362
 }
363 363
 
364 364
 /**
@@ -370,44 +370,44 @@  discard block
 block discarded – undo
370 370
  * @return string
371 371
  */
372 372
 function auth_spip_retrouver_login($login, $serveur = '') {
373
-	if (!strlen($login)) {
374
-		return null;
375
-	} // pas la peine de requeter
376
-	$l = sql_quote($login, $serveur, 'text');
377
-	if (
378
-		$r = sql_getfetsel(
379
-			'login',
380
-			'spip_auteurs',
381
-			"statut<>'5poubelle'" .
382
-			' AND (length(pass)>0)' .
383
-			" AND (login=$l)",
384
-			'',
385
-			'',
386
-			'',
387
-			'',
388
-			$serveur
389
-		)
390
-	) {
391
-		return $r;
392
-	}
393
-	// Si pas d'auteur avec ce login
394
-	// regarder s'il a saisi son nom ou son mail.
395
-	// Ne pas fusionner avec la requete precedente
396
-	// car un nom peut etre homonyme d'un autre login
397
-	else {
398
-		return sql_getfetsel(
399
-			'login',
400
-			'spip_auteurs',
401
-			"statut<>'5poubelle'" .
402
-			' AND (length(pass)>0)' .
403
-			" AND (login<>'' AND (nom=$l OR email=$l))",
404
-			'',
405
-			'',
406
-			'',
407
-			'',
408
-			$serveur
409
-		);
410
-	}
373
+    if (!strlen($login)) {
374
+        return null;
375
+    } // pas la peine de requeter
376
+    $l = sql_quote($login, $serveur, 'text');
377
+    if (
378
+        $r = sql_getfetsel(
379
+            'login',
380
+            'spip_auteurs',
381
+            "statut<>'5poubelle'" .
382
+            ' AND (length(pass)>0)' .
383
+            " AND (login=$l)",
384
+            '',
385
+            '',
386
+            '',
387
+            '',
388
+            $serveur
389
+        )
390
+    ) {
391
+        return $r;
392
+    }
393
+    // Si pas d'auteur avec ce login
394
+    // regarder s'il a saisi son nom ou son mail.
395
+    // Ne pas fusionner avec la requete precedente
396
+    // car un nom peut etre homonyme d'un autre login
397
+    else {
398
+        return sql_getfetsel(
399
+            'login',
400
+            'spip_auteurs',
401
+            "statut<>'5poubelle'" .
402
+            ' AND (length(pass)>0)' .
403
+            " AND (login<>'' AND (nom=$l OR email=$l))",
404
+            '',
405
+            '',
406
+            '',
407
+            '',
408
+            $serveur
409
+        );
410
+    }
411 411
 }
412 412
 
413 413
 /**
@@ -418,11 +418,11 @@  discard block
 block discarded – undo
418 418
  *  toujours true pour un auteur cree dans SPIP
419 419
  */
420 420
 function auth_spip_autoriser_modifier_pass(string $serveur = ''): bool {
421
-	// les fonctions d'ecriture sur base distante sont encore incompletes
422
-	if (strlen($serveur)) {
423
-		return false;
424
-	}
425
-	return true;
421
+    // les fonctions d'ecriture sur base distante sont encore incompletes
422
+    if (strlen($serveur)) {
423
+        return false;
424
+    }
425
+    return true;
426 426
 }
427 427
 
428 428
 
@@ -443,12 +443,12 @@  discard block
 block discarded – undo
443 443
  *  message d'erreur si login non valide, chaine vide sinon
444 444
  */
445 445
 function auth_spip_verifier_pass($login, $new_pass, $id_auteur = 0, $serveur = '') {
446
-	// login et mot de passe
447
-	if (strlen($new_pass) < _PASS_LONGUEUR_MINI) {
448
-		return _T('info_passe_trop_court_car_pluriel', ['nb' => _PASS_LONGUEUR_MINI]);
449
-	}
446
+    // login et mot de passe
447
+    if (strlen($new_pass) < _PASS_LONGUEUR_MINI) {
448
+        return _T('info_passe_trop_court_car_pluriel', ['nb' => _PASS_LONGUEUR_MINI]);
449
+    }
450 450
 
451
-	return '';
451
+    return '';
452 452
 }
453 453
 
454 454
 /**
@@ -462,48 +462,48 @@  discard block
 block discarded – undo
462 462
  * @return bool
463 463
  */
464 464
 function auth_spip_modifier_pass($login, $new_pass, $id_auteur, $serveur = '') {
465
-	if (is_null($new_pass) or auth_spip_verifier_pass($login, $new_pass, $id_auteur, $serveur) != '') {
466
-		return false;
467
-	}
468
-
469
-	if (
470
-		!$id_auteur = intval($id_auteur)
471
-		or !$auteur = sql_fetsel('login, statut, webmestre', 'spip_auteurs', 'id_auteur=' . intval($id_auteur), '', '', '', '', $serveur)
472
-	) {
473
-		return false;
474
-	}
475
-
476
-	include_spip('inc/chiffrer');
477
-	$cles = SpipCles::instance();
478
-	$secret = $cles->getSecretAuth();
479
-	if (!$secret) {
480
-		if (auth_spip_initialiser_secret()) {
481
-			$secret = $cles->getSecretAuth();
482
-		}
483
-		else {
484
-			return false;
485
-		}
486
-	}
487
-
488
-
489
-	include_spip('inc/acces');
490
-	$set = [
491
-		'pass' => Password::hacher($new_pass, $secret),
492
-		'htpass' => generer_htpass($new_pass),
493
-		'alea_actuel' => creer_uniqid(), // @deprecated 4.1
494
-		'alea_futur' => creer_uniqid(), // @deprecated 4.1
495
-		'low_sec' => '',
496
-	];
497
-
498
-	// si c'est un webmestre, on met a jour son backup des cles
499
-	if ($auteur['statut'] === '0minirezo' and $auteur['webmestre'] === 'oui') {
500
-		$set['backup_cles'] = $cles->backup($new_pass);
501
-	}
502
-
503
-	include_spip('action/editer_auteur');
504
-	auteur_modifier($id_auteur, $set, true); // manque la gestion de $serveur
505
-
506
-	return true; // on a bien modifie le pass
465
+    if (is_null($new_pass) or auth_spip_verifier_pass($login, $new_pass, $id_auteur, $serveur) != '') {
466
+        return false;
467
+    }
468
+
469
+    if (
470
+        !$id_auteur = intval($id_auteur)
471
+        or !$auteur = sql_fetsel('login, statut, webmestre', 'spip_auteurs', 'id_auteur=' . intval($id_auteur), '', '', '', '', $serveur)
472
+    ) {
473
+        return false;
474
+    }
475
+
476
+    include_spip('inc/chiffrer');
477
+    $cles = SpipCles::instance();
478
+    $secret = $cles->getSecretAuth();
479
+    if (!$secret) {
480
+        if (auth_spip_initialiser_secret()) {
481
+            $secret = $cles->getSecretAuth();
482
+        }
483
+        else {
484
+            return false;
485
+        }
486
+    }
487
+
488
+
489
+    include_spip('inc/acces');
490
+    $set = [
491
+        'pass' => Password::hacher($new_pass, $secret),
492
+        'htpass' => generer_htpass($new_pass),
493
+        'alea_actuel' => creer_uniqid(), // @deprecated 4.1
494
+        'alea_futur' => creer_uniqid(), // @deprecated 4.1
495
+        'low_sec' => '',
496
+    ];
497
+
498
+    // si c'est un webmestre, on met a jour son backup des cles
499
+    if ($auteur['statut'] === '0minirezo' and $auteur['webmestre'] === 'oui') {
500
+        $set['backup_cles'] = $cles->backup($new_pass);
501
+    }
502
+
503
+    include_spip('action/editer_auteur');
504
+    auteur_modifier($id_auteur, $set, true); // manque la gestion de $serveur
505
+
506
+    return true; // on a bien modifie le pass
507 507
 }
508 508
 
509 509
 /**
@@ -517,58 +517,58 @@  discard block
 block discarded – undo
517 517
  * @return void
518 518
  */
519 519
 function auth_spip_synchroniser_distant($id_auteur, $champs, $options = [], string $serveur = ''): void {
520
-	// ne rien faire pour une base distante : on ne sait pas regenerer les htaccess
521
-	if (strlen($serveur)) {
522
-		return;
523
-	}
524
-	// si un login, pass ou statut a ete modifie
525
-	// regenerer les fichier htpass
526
-	if (
527
-		isset($champs['login'])
528
-		or isset($champs['pass'])
529
-		or isset($champs['statut'])
530
-		or (isset($options['all']) and $options['all'])
531
-	) {
532
-		$htaccess = _DIR_RESTREINT . _ACCESS_FILE_NAME;
533
-		$htpasswd = _DIR_TMP . _AUTH_USER_FILE;
534
-
535
-		// Cette variable de configuration peut etre posee par un plugin
536
-		// par exemple acces_restreint ;
537
-		// si .htaccess existe, outrepasser spip_meta
538
-		if (
539
-			(!isset($GLOBALS['meta']['creer_htpasswd']) or ($GLOBALS['meta']['creer_htpasswd'] != 'oui'))
540
-			and !@file_exists($htaccess)
541
-		) {
542
-			spip_unlink($htpasswd);
543
-			spip_unlink($htpasswd . '-admin');
544
-
545
-			return;
546
-		}
547
-
548
-		# remarque : ici on laisse passer les "nouveau" de maniere a leur permettre
549
-		# de devenir redacteur le cas echeant (auth http)... a nettoyer
550
-		// attention, il faut au prealable se connecter a la base (necessaire car utilise par install)
551
-
552
-		$p1 = ''; // login:htpass pour tous
553
-		$p2 = ''; // login:htpass pour les admins
554
-		$s = sql_select(
555
-			'login, htpass, statut',
556
-			'spip_auteurs',
557
-			sql_in('statut', ['1comite', '0minirezo', 'nouveau'])
558
-		);
559
-		while ($t = sql_fetch($s)) {
560
-			if (strlen($t['login']) and strlen($t['htpass'])) {
561
-				$p1 .= $t['login'] . ':' . $t['htpass'] . "\n";
562
-				if ($t['statut'] == '0minirezo') {
563
-					$p2 .= $t['login'] . ':' . $t['htpass'] . "\n";
564
-				}
565
-			}
566
-		}
567
-		sql_free($s);
568
-		if ($p1) {
569
-			ecrire_fichier($htpasswd, $p1);
570
-			ecrire_fichier($htpasswd . '-admin', $p2);
571
-			spip_log("Ecriture de $htpasswd et $htpasswd-admin");
572
-		}
573
-	}
520
+    // ne rien faire pour une base distante : on ne sait pas regenerer les htaccess
521
+    if (strlen($serveur)) {
522
+        return;
523
+    }
524
+    // si un login, pass ou statut a ete modifie
525
+    // regenerer les fichier htpass
526
+    if (
527
+        isset($champs['login'])
528
+        or isset($champs['pass'])
529
+        or isset($champs['statut'])
530
+        or (isset($options['all']) and $options['all'])
531
+    ) {
532
+        $htaccess = _DIR_RESTREINT . _ACCESS_FILE_NAME;
533
+        $htpasswd = _DIR_TMP . _AUTH_USER_FILE;
534
+
535
+        // Cette variable de configuration peut etre posee par un plugin
536
+        // par exemple acces_restreint ;
537
+        // si .htaccess existe, outrepasser spip_meta
538
+        if (
539
+            (!isset($GLOBALS['meta']['creer_htpasswd']) or ($GLOBALS['meta']['creer_htpasswd'] != 'oui'))
540
+            and !@file_exists($htaccess)
541
+        ) {
542
+            spip_unlink($htpasswd);
543
+            spip_unlink($htpasswd . '-admin');
544
+
545
+            return;
546
+        }
547
+
548
+        # remarque : ici on laisse passer les "nouveau" de maniere a leur permettre
549
+        # de devenir redacteur le cas echeant (auth http)... a nettoyer
550
+        // attention, il faut au prealable se connecter a la base (necessaire car utilise par install)
551
+
552
+        $p1 = ''; // login:htpass pour tous
553
+        $p2 = ''; // login:htpass pour les admins
554
+        $s = sql_select(
555
+            'login, htpass, statut',
556
+            'spip_auteurs',
557
+            sql_in('statut', ['1comite', '0minirezo', 'nouveau'])
558
+        );
559
+        while ($t = sql_fetch($s)) {
560
+            if (strlen($t['login']) and strlen($t['htpass'])) {
561
+                $p1 .= $t['login'] . ':' . $t['htpass'] . "\n";
562
+                if ($t['statut'] == '0minirezo') {
563
+                    $p2 .= $t['login'] . ':' . $t['htpass'] . "\n";
564
+                }
565
+            }
566
+        }
567
+        sql_free($s);
568
+        if ($p1) {
569
+            ecrire_fichier($htpasswd, $p1);
570
+            ecrire_fichier($htpasswd . '-admin', $p2);
571
+            spip_log("Ecriture de $htpasswd et $htpasswd-admin");
572
+        }
573
+    }
574 574
 }
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 		$row = sql_fetsel(
50 50
 			'*',
51 51
 			'spip_auteurs',
52
-			'login=' . sql_quote($login, $serveur, 'text') . " AND statut<>'5poubelle'",
52
+			'login='.sql_quote($login, $serveur, 'text')." AND statut<>'5poubelle'",
53 53
 			'',
54 54
 			'',
55 55
 			'',
@@ -77,20 +77,20 @@  discard block
 block discarded – undo
77 77
 		// legacy = md5 ou sha256
78 78
 		case 32:
79 79
 			// tres anciens mots de passe encodes en md5(alea.pass)
80
-			$hash = md5($row['alea_actuel'] . $pass);
80
+			$hash = md5($row['alea_actuel'].$pass);
81 81
 			$methode = 'md5';
82 82
 		case 64:
83 83
 			if (empty($hash)) {
84 84
 				// anciens mots de passe encodes en sha256(alea.pass)
85 85
 				include_spip('auth/sha256.inc');
86
-				$hash = spip_sha256($row['alea_actuel'] . $pass);
86
+				$hash = spip_sha256($row['alea_actuel'].$pass);
87 87
 				$methode = 'sha256';
88 88
 			}
89 89
 			if ($row['pass'] === $hash) {
90
-				spip_log("validation du mot de passe pour l'auteur #" . $row['id_auteur'] . " $login via $methode", 'auth' . _LOG_DEBUG);
90
+				spip_log("validation du mot de passe pour l'auteur #".$row['id_auteur']." $login via $methode", 'auth'._LOG_DEBUG);
91 91
 				// ce n'est pas cense arriver, mais si jamais c'est un backup inutilisable, il faut le nettoyer pour ne pas bloquer la creation d'une nouvelle cle d'auth
92 92
 				if (!empty($row['backup_cles'])) {
93
-					sql_updateq('spip_auteurs', ['backup_cles' => ''], 'id_auteur=' . intval($row['id_auteur']));
93
+					sql_updateq('spip_auteurs', ['backup_cles' => ''], 'id_auteur='.intval($row['id_auteur']));
94 94
 				}
95 95
 				break;
96 96
 			}
@@ -108,19 +108,19 @@  discard block
 block discarded – undo
108 108
 				and !empty($row['backup_cles'])
109 109
 			) {
110 110
 				if ($cles->restore($row['backup_cles'], $pass, $row['pass'], $row['id_auteur'])) {
111
-					spip_log('Les cles secretes ont ete restaurées avec le backup du webmestre #' . $row['id_auteur'], 'auth' . _LOG_INFO_IMPORTANTE);
111
+					spip_log('Les cles secretes ont ete restaurées avec le backup du webmestre #'.$row['id_auteur'], 'auth'._LOG_INFO_IMPORTANTE);
112 112
 					if ($cles->save()) {
113 113
 						$secret = $cles->getSecretAuth();
114 114
 					}
115 115
 					else {
116
-						spip_log("Echec restauration des cles : verifier les droits d'ecriture ?", 'auth' . _LOG_ERREUR);
116
+						spip_log("Echec restauration des cles : verifier les droits d'ecriture ?", 'auth'._LOG_ERREUR);
117 117
 						// et on echoue car on ne veut pas que la situation reste telle quelle
118
-						raler_fichier(_DIR_ETC . 'cles.php');
118
+						raler_fichier(_DIR_ETC.'cles.php');
119 119
 					}
120 120
 				}
121 121
 				else {
122
-					spip_log('Pas de cle secrete disponible (fichier config/cle.php absent ?) mais le backup du webmestre #' . $row['id_auteur'] . " n'est pas valide", 'auth' . _LOG_ERREUR);
123
-					sql_updateq('spip_auteurs', ['backup_cles' => ''], 'id_auteur=' . intval($row['id_auteur']));
122
+					spip_log('Pas de cle secrete disponible (fichier config/cle.php absent ?) mais le backup du webmestre #'.$row['id_auteur']." n'est pas valide", 'auth'._LOG_ERREUR);
123
+					sql_updateq('spip_auteurs', ['backup_cles' => ''], 'id_auteur='.intval($row['id_auteur']));
124 124
 				}
125 125
 			}
126 126
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 				unset($row);
129 129
 			}
130 130
 			else {
131
-				spip_log("validation du mot de passe pour l'auteur #" . $row['id_auteur'] . " $login via Password::verifier", 'auth' . _LOG_DEBUG);
131
+				spip_log("validation du mot de passe pour l'auteur #".$row['id_auteur']." $login via Password::verifier", 'auth'._LOG_DEBUG);
132 132
 			}
133 133
 			break;
134 134
 	}
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 			@sql_update(
176 176
 				'spip_auteurs',
177 177
 				$set,
178
-				'id_auteur=' . intval($row['id_auteur']) . ' AND pass=' . sql_quote(
178
+				'id_auteur='.intval($row['id_auteur']).' AND pass='.sql_quote(
179 179
 					$row['pass'],
180 180
 					$serveur,
181 181
 					'text'
@@ -223,24 +223,24 @@  discard block
 block discarded – undo
223 223
 
224 224
 	// si force, on ne verifie pas la presence d'un backup chez un webmestre
225 225
 	if ($force) {
226
-		spip_log('Pas de cle secrete disponible, on regenere une nouvelle cle forcee - tous les mots de passe sont invalides', 'auth' . _LOG_INFO_IMPORTANTE);
226
+		spip_log('Pas de cle secrete disponible, on regenere une nouvelle cle forcee - tous les mots de passe sont invalides', 'auth'._LOG_INFO_IMPORTANTE);
227 227
 		$secret = $cles->getSecretAuth(true);
228 228
 		return true;
229 229
 	}
230 230
 
231
-	$has_backup = sql_allfetsel('id_auteur', 'spip_auteurs', 'statut=' . sql_quote('0minirezo') . ' AND webmestre=' . sql_quote('oui') . " AND backup_cles!=''");
231
+	$has_backup = sql_allfetsel('id_auteur', 'spip_auteurs', 'statut='.sql_quote('0minirezo').' AND webmestre='.sql_quote('oui')." AND backup_cles!=''");
232 232
 	$has_backup = array_column($has_backup, 'id_auteur');
233 233
 	if (empty($has_backup)) {
234
-		spip_log("Pas de cle secrete disponible, et aucun webmestre n'a de backup, on regenere une nouvelle cle - tous les mots de passe sont invalides", 'auth' . _LOG_INFO_IMPORTANTE);
234
+		spip_log("Pas de cle secrete disponible, et aucun webmestre n'a de backup, on regenere une nouvelle cle - tous les mots de passe sont invalides", 'auth'._LOG_INFO_IMPORTANTE);
235 235
 		if ($secret = $cles->getSecretAuth(true)) {
236 236
 			return true;
237 237
 		}
238
-		spip_log("Echec generation d'une nouvelle cle : verifier les droits d'ecriture ?", 'auth' . _LOG_ERREUR);
238
+		spip_log("Echec generation d'une nouvelle cle : verifier les droits d'ecriture ?", 'auth'._LOG_ERREUR);
239 239
 		// et on echoue car on ne veut pas que la situation reste telle quelle
240
-		raler_fichier(_DIR_ETC . 'cles.php');
240
+		raler_fichier(_DIR_ETC.'cles.php');
241 241
 	}
242 242
 	else {
243
-		spip_log('Pas de cle secrete disponible (fichier config/cle.php absent ?) un des webmestres #' . implode(', #', $has_backup) . ' doit se connecter pour restaurer son backup des cles', 'auth' . _LOG_ERREUR);
243
+		spip_log('Pas de cle secrete disponible (fichier config/cle.php absent ?) un des webmestres #'.implode(', #', $has_backup).' doit se connecter pour restaurer son backup des cles', 'auth'._LOG_ERREUR);
244 244
 	}
245 245
 	return false;
246 246
 }
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
 	$flux['data'] .=
258 258
 		  '<script type="text/javascript">/*<![CDATA[*/'
259 259
 		. "$js\n"
260
-		. "var login_info={'login':'" . $flux['args']['contexte']['var_login'] . "',"
261
-		. "'page_auteur': '" . generer_url_public('informer_auteur') . "',"
260
+		. "var login_info={'login':'".$flux['args']['contexte']['var_login']."',"
261
+		. "'page_auteur': '".generer_url_public('informer_auteur')."',"
262 262
 		. "'informe_auteur_en_cours':false,"
263 263
 		. "'attente_informe':0};"
264 264
 		. "jQuery(function(){jQuery('#var_login').change(actualise_auteur);});"
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 		} else {
302 302
 			$n = sql_countsel(
303 303
 				'spip_auteurs',
304
-				'login=' . sql_quote($new_login) . ' AND id_auteur!=' . intval($id_auteur) . " AND statut!='5poubelle'",
304
+				'login='.sql_quote($new_login).' AND id_auteur!='.intval($id_auteur)." AND statut!='5poubelle'",
305 305
 				'',
306 306
 				'',
307 307
 				$serveur
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 	}
330 330
 	if (
331 331
 		!$id_auteur = intval($id_auteur)
332
-		or !$auteur = sql_fetsel('login', 'spip_auteurs', 'id_auteur=' . intval($id_auteur), '', '', '', '', $serveur)
332
+		or !$auteur = sql_fetsel('login', 'spip_auteurs', 'id_auteur='.intval($id_auteur), '', '', '', '', $serveur)
333 333
 	) {
334 334
 		return false;
335 335
 	}
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 		$anciens = sql_allfetsel(
345 345
 			'id_auteur',
346 346
 			'spip_auteurs',
347
-			'login=' . sql_quote($new_login, $serveur, 'text') . " AND statut='5poubelle'",
347
+			'login='.sql_quote($new_login, $serveur, 'text')." AND statut='5poubelle'",
348 348
 			'',
349 349
 			'',
350 350
 			'',
@@ -378,8 +378,8 @@  discard block
 block discarded – undo
378 378
 		$r = sql_getfetsel(
379 379
 			'login',
380 380
 			'spip_auteurs',
381
-			"statut<>'5poubelle'" .
382
-			' AND (length(pass)>0)' .
381
+			"statut<>'5poubelle'".
382
+			' AND (length(pass)>0)'.
383 383
 			" AND (login=$l)",
384 384
 			'',
385 385
 			'',
@@ -398,8 +398,8 @@  discard block
 block discarded – undo
398 398
 		return sql_getfetsel(
399 399
 			'login',
400 400
 			'spip_auteurs',
401
-			"statut<>'5poubelle'" .
402
-			' AND (length(pass)>0)' .
401
+			"statut<>'5poubelle'".
402
+			' AND (length(pass)>0)'.
403 403
 			" AND (login<>'' AND (nom=$l OR email=$l))",
404 404
 			'',
405 405
 			'',
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 
469 469
 	if (
470 470
 		!$id_auteur = intval($id_auteur)
471
-		or !$auteur = sql_fetsel('login, statut, webmestre', 'spip_auteurs', 'id_auteur=' . intval($id_auteur), '', '', '', '', $serveur)
471
+		or !$auteur = sql_fetsel('login, statut, webmestre', 'spip_auteurs', 'id_auteur='.intval($id_auteur), '', '', '', '', $serveur)
472 472
 	) {
473 473
 		return false;
474 474
 	}
@@ -529,8 +529,8 @@  discard block
 block discarded – undo
529 529
 		or isset($champs['statut'])
530 530
 		or (isset($options['all']) and $options['all'])
531 531
 	) {
532
-		$htaccess = _DIR_RESTREINT . _ACCESS_FILE_NAME;
533
-		$htpasswd = _DIR_TMP . _AUTH_USER_FILE;
532
+		$htaccess = _DIR_RESTREINT._ACCESS_FILE_NAME;
533
+		$htpasswd = _DIR_TMP._AUTH_USER_FILE;
534 534
 
535 535
 		// Cette variable de configuration peut etre posee par un plugin
536 536
 		// par exemple acces_restreint ;
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 			and !@file_exists($htaccess)
541 541
 		) {
542 542
 			spip_unlink($htpasswd);
543
-			spip_unlink($htpasswd . '-admin');
543
+			spip_unlink($htpasswd.'-admin');
544 544
 
545 545
 			return;
546 546
 		}
@@ -558,16 +558,16 @@  discard block
 block discarded – undo
558 558
 		);
559 559
 		while ($t = sql_fetch($s)) {
560 560
 			if (strlen($t['login']) and strlen($t['htpass'])) {
561
-				$p1 .= $t['login'] . ':' . $t['htpass'] . "\n";
561
+				$p1 .= $t['login'].':'.$t['htpass']."\n";
562 562
 				if ($t['statut'] == '0minirezo') {
563
-					$p2 .= $t['login'] . ':' . $t['htpass'] . "\n";
563
+					$p2 .= $t['login'].':'.$t['htpass']."\n";
564 564
 				}
565 565
 			}
566 566
 		}
567 567
 		sql_free($s);
568 568
 		if ($p1) {
569 569
 			ecrire_fichier($htpasswd, $p1);
570
-			ecrire_fichier($htpasswd . '-admin', $p2);
570
+			ecrire_fichier($htpasswd.'-admin', $p2);
571 571
 			spip_log("Ecriture de $htpasswd et $htpasswd-admin");
572 572
 		}
573 573
 	}
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -111,14 +111,12 @@  discard block
 block discarded – undo
111 111
 					spip_log('Les cles secretes ont ete restaurées avec le backup du webmestre #' . $row['id_auteur'], 'auth' . _LOG_INFO_IMPORTANTE);
112 112
 					if ($cles->save()) {
113 113
 						$secret = $cles->getSecretAuth();
114
-					}
115
-					else {
114
+					} else {
116 115
 						spip_log("Echec restauration des cles : verifier les droits d'ecriture ?", 'auth' . _LOG_ERREUR);
117 116
 						// et on echoue car on ne veut pas que la situation reste telle quelle
118 117
 						raler_fichier(_DIR_ETC . 'cles.php');
119 118
 					}
120
-				}
121
-				else {
119
+				} else {
122 120
 					spip_log('Pas de cle secrete disponible (fichier config/cle.php absent ?) mais le backup du webmestre #' . $row['id_auteur'] . " n'est pas valide", 'auth' . _LOG_ERREUR);
123 121
 					sql_updateq('spip_auteurs', ['backup_cles' => ''], 'id_auteur=' . intval($row['id_auteur']));
124 122
 				}
@@ -126,8 +124,7 @@  discard block
 block discarded – undo
126 124
 
127 125
 			if (!$secret or !Password::verifier($pass, $row['pass'], $secret)) {
128 126
 				unset($row);
129
-			}
130
-			else {
127
+			} else {
131 128
 				spip_log("validation du mot de passe pour l'auteur #" . $row['id_auteur'] . " $login via Password::verifier", 'auth' . _LOG_DEBUG);
132 129
 			}
133 130
 			break;
@@ -238,8 +235,7 @@  discard block
 block discarded – undo
238 235
 		spip_log("Echec generation d'une nouvelle cle : verifier les droits d'ecriture ?", 'auth' . _LOG_ERREUR);
239 236
 		// et on echoue car on ne veut pas que la situation reste telle quelle
240 237
 		raler_fichier(_DIR_ETC . 'cles.php');
241
-	}
242
-	else {
238
+	} else {
243 239
 		spip_log('Pas de cle secrete disponible (fichier config/cle.php absent ?) un des webmestres #' . implode(', #', $has_backup) . ' doit se connecter pour restaurer son backup des cles', 'auth' . _LOG_ERREUR);
244 240
 	}
245 241
 	return false;
@@ -479,8 +475,7 @@  discard block
 block discarded – undo
479 475
 	if (!$secret) {
480 476
 		if (auth_spip_initialiser_secret()) {
481 477
 			$secret = $cles->getSecretAuth();
482
-		}
483
-		else {
478
+		} else {
484 479
 			return false;
485 480
 		}
486 481
 	}
Please login to merge, or discard this patch.