Completed
Push — master ( 762316...b41555 )
by cam
01:50
created
ecrire/public/balises.php 3 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2868,8 +2868,7 @@
 block discarded – undo
2868 2868
 	$_const = interprete_argument_balise(1, $p);
2869 2869
 	if (!strlen($_const ?? '')) {
2870 2870
 		$p->code = "''";
2871
-	}
2872
-	else {
2871
+	} else {
2873 2872
 		$p->code = "(defined($_const)?constant($_const):'')";
2874 2873
 	}
2875 2874
 	$p->interdire_scripts = false;
Please login to merge, or discard this patch.
Indentation   +943 added lines, -943 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
  **/
28 28
 
29 29
 if (!defined('_ECRIRE_INC_VERSION')) {
30
-	return;
30
+    return;
31 31
 }
32 32
 
33 33
 /**
@@ -47,16 +47,16 @@  discard block
 block discarded – undo
47 47
  *     Code PHP si cet argument est présent, sinon null
48 48
  **/
49 49
 function interprete_argument_balise(int $n, Champ $p): ?string {
50
-	if (($p->param) && (!$p->param[0][0]) && ((is_countable($p->param[0]) ? count($p->param[0]) : 0) > $n)) {
51
-		return calculer_liste(
52
-			$p->param[0][$n],
53
-			$p->descr,
54
-			$p->boucles,
55
-			$p->id_boucle
56
-		);
57
-	}
50
+    if (($p->param) && (!$p->param[0][0]) && ((is_countable($p->param[0]) ? count($p->param[0]) : 0) > $n)) {
51
+        return calculer_liste(
52
+            $p->param[0][$n],
53
+            $p->descr,
54
+            $p->boucles,
55
+            $p->id_boucle
56
+        );
57
+    }
58 58
 
59
-	return null;
59
+    return null;
60 60
 }
61 61
 
62 62
 
@@ -76,10 +76,10 @@  discard block
 block discarded – undo
76 76
  *     Pile complétée par le code à générer
77 77
  **/
78 78
 function balise_NOM_SITE_SPIP_dist($p) {
79
-	$p->code = "\$GLOBALS['meta']['nom_site']";
79
+    $p->code = "\$GLOBALS['meta']['nom_site']";
80 80
 
81
-	#$p->interdire_scripts = true;
82
-	return $p;
81
+    #$p->interdire_scripts = true;
82
+    return $p;
83 83
 }
84 84
 
85 85
 /**
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
  *     Pile complétée par le code à générer
96 96
  **/
97 97
 function balise_EMAIL_WEBMASTER_dist($p) {
98
-	$p->code = "\$GLOBALS['meta']['email_webmaster']";
98
+    $p->code = "\$GLOBALS['meta']['email_webmaster']";
99 99
 
100
-	#$p->interdire_scripts = true;
101
-	return $p;
100
+    #$p->interdire_scripts = true;
101
+    return $p;
102 102
 }
103 103
 
104 104
 /**
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
  *     Pile complétée par le code à générer
115 115
  **/
116 116
 function balise_DESCRIPTIF_SITE_SPIP_dist($p) {
117
-	$p->code = "\$GLOBALS['meta']['descriptif_site']";
117
+    $p->code = "\$GLOBALS['meta']['descriptif_site']";
118 118
 
119
-	#$p->interdire_scripts = true;
120
-	return $p;
119
+    #$p->interdire_scripts = true;
120
+    return $p;
121 121
 }
122 122
 
123 123
 
@@ -138,10 +138,10 @@  discard block
 block discarded – undo
138 138
  *     Pile complétée par le code à générer
139 139
  **/
140 140
 function balise_CHARSET_dist($p) {
141
-	$p->code = "\$GLOBALS['meta']['charset']";
141
+    $p->code = "\$GLOBALS['meta']['charset']";
142 142
 
143
-	#$p->interdire_scripts = true;
144
-	return $p;
143
+    #$p->interdire_scripts = true;
144
+    return $p;
145 145
 }
146 146
 
147 147
 /**
@@ -166,11 +166,11 @@  discard block
 block discarded – undo
166 166
  *     Pile complétée par le code à générer
167 167
  **/
168 168
 function balise_LANG_LEFT_dist($p) {
169
-	$_lang = champ_sql('lang', $p);
170
-	$p->code = "lang_dir($_lang, 'left','right')";
171
-	$p->interdire_scripts = false;
169
+    $_lang = champ_sql('lang', $p);
170
+    $p->code = "lang_dir($_lang, 'left','right')";
171
+    $p->interdire_scripts = false;
172 172
 
173
-	return $p;
173
+    return $p;
174 174
 }
175 175
 
176 176
 /**
@@ -190,11 +190,11 @@  discard block
 block discarded – undo
190 190
  *     Pile complétée par le code à générer
191 191
  **/
192 192
 function balise_LANG_RIGHT_dist($p) {
193
-	$_lang = champ_sql('lang', $p);
194
-	$p->code = "lang_dir($_lang, 'right','left')";
195
-	$p->interdire_scripts = false;
193
+    $_lang = champ_sql('lang', $p);
194
+    $p->code = "lang_dir($_lang, 'right','left')";
195
+    $p->interdire_scripts = false;
196 196
 
197
-	return $p;
197
+    return $p;
198 198
 }
199 199
 
200 200
 /**
@@ -219,11 +219,11 @@  discard block
 block discarded – undo
219 219
  *     Pile complétée par le code à générer
220 220
  **/
221 221
 function balise_LANG_DIR_dist($p) {
222
-	$_lang = champ_sql('lang', $p);
223
-	$p->code = "lang_dir($_lang, 'ltr','rtl')";
224
-	$p->interdire_scripts = false;
222
+    $_lang = champ_sql('lang', $p);
223
+    $p->code = "lang_dir($_lang, 'ltr','rtl')";
224
+    $p->interdire_scripts = false;
225 225
 
226
-	return $p;
226
+    return $p;
227 227
 }
228 228
 
229 229
 
@@ -240,10 +240,10 @@  discard block
 block discarded – undo
240 240
  *     Pile complétée par le code à générer
241 241
  **/
242 242
 function balise_PUCE_dist($p) {
243
-	$p->code = 'definir_puce()';
244
-	$p->interdire_scripts = false;
243
+    $p->code = 'definir_puce()';
244
+    $p->interdire_scripts = false;
245 245
 
246
-	return $p;
246
+    return $p;
247 247
 }
248 248
 
249 249
 
@@ -267,9 +267,9 @@  discard block
 block discarded – undo
267 267
  *     Pile completée du code PHP d'exécution de la balise
268 268
  */
269 269
 function balise_DATE_dist($p) {
270
-	$p->code = champ_sql('date', $p);
270
+    $p->code = champ_sql('date', $p);
271 271
 
272
-	return $p;
272
+    return $p;
273 273
 }
274 274
 
275 275
 
@@ -289,10 +289,10 @@  discard block
 block discarded – undo
289 289
  *     Pile completée du code PHP d'exécution de la balise
290 290
  */
291 291
 function balise_DATE_REDAC_dist($p) {
292
-	$p->code = champ_sql('date_redac', $p);
293
-	$p->interdire_scripts = false;
292
+    $p->code = champ_sql('date_redac', $p);
293
+    $p->interdire_scripts = false;
294 294
 
295
-	return $p;
295
+    return $p;
296 296
 }
297 297
 
298 298
 /**
@@ -311,10 +311,10 @@  discard block
 block discarded – undo
311 311
  *     Pile completée du code PHP d'exécution de la balise
312 312
  */
313 313
 function balise_DATE_MODIF_dist($p) {
314
-	$p->code = champ_sql('date_modif', $p);
315
-	$p->interdire_scripts = false;
314
+    $p->code = champ_sql('date_modif', $p);
315
+    $p->interdire_scripts = false;
316 316
 
317
-	return $p;
317
+    return $p;
318 318
 }
319 319
 
320 320
 /**
@@ -332,13 +332,13 @@  discard block
 block discarded – undo
332 332
  *     Pile completée du code PHP d'exécution de la balise
333 333
  */
334 334
 function balise_DATE_NOUVEAUTES_dist($p) {
335
-	$p->code = "((\$GLOBALS['meta']['quoi_de_neuf'] == 'oui'
335
+    $p->code = "((\$GLOBALS['meta']['quoi_de_neuf'] == 'oui'
336 336
 	AND isset(\$GLOBALS['meta']['dernier_envoi_neuf'])) ?
337 337
 	\$GLOBALS['meta']['dernier_envoi_neuf'] :
338 338
 	\"'0000-00-00'\")";
339
-	$p->interdire_scripts = false;
339
+    $p->interdire_scripts = false;
340 340
 
341
-	return $p;
341
+    return $p;
342 342
 }
343 343
 
344 344
 
@@ -356,11 +356,11 @@  discard block
 block discarded – undo
356 356
  *     Pile completée du code PHP d'exécution de la balise
357 357
  */
358 358
 function balise_DOSSIER_SQUELETTE_dist($p) {
359
-	$code = substr(addslashes(dirname($p->descr['sourcefile'])), strlen(_DIR_RACINE));
360
-	$p->code = "_DIR_RACINE . '$code'" .
361
-		$p->interdire_scripts = false;
359
+    $code = substr(addslashes(dirname($p->descr['sourcefile'])), strlen(_DIR_RACINE));
360
+    $p->code = "_DIR_RACINE . '$code'" .
361
+        $p->interdire_scripts = false;
362 362
 
363
-	return $p;
363
+    return $p;
364 364
 }
365 365
 
366 366
 /**
@@ -375,11 +375,11 @@  discard block
 block discarded – undo
375 375
  *     Pile completée du code PHP d'exécution de la balise
376 376
  */
377 377
 function balise_SQUELETTE_dist($p) {
378
-	$code = addslashes($p->descr['sourcefile']);
379
-	$p->code = "'$code'" .
380
-		$p->interdire_scripts = false;
378
+    $code = addslashes($p->descr['sourcefile']);
379
+    $p->code = "'$code'" .
380
+        $p->interdire_scripts = false;
381 381
 
382
-	return $p;
382
+    return $p;
383 383
 }
384 384
 
385 385
 /**
@@ -398,10 +398,10 @@  discard block
 block discarded – undo
398 398
  *     Pile completée du code PHP d'exécution de la balise
399 399
  */
400 400
 function balise_SPIP_VERSION_dist($p) {
401
-	$p->code = 'spip_version()';
402
-	$p->interdire_scripts = false;
401
+    $p->code = 'spip_version()';
402
+    $p->interdire_scripts = false;
403 403
 
404
-	return $p;
404
+    return $p;
405 405
 }
406 406
 
407 407
 
@@ -427,18 +427,18 @@  discard block
 block discarded – undo
427 427
  *     Pile complétée par le code à générer
428 428
  **/
429 429
 function balise_NOM_SITE_dist($p) {
430
-	if (!$p->etoile) {
431
-		$p->code = 'supprimer_numero(calculer_url(' .
432
-			champ_sql('url_site', $p) . ',' .
433
-			champ_sql('nom_site', $p) .
434
-			", 'titre', \$connect, false))";
435
-	} else {
436
-		$p->code = champ_sql('nom_site', $p);
437
-	}
430
+    if (!$p->etoile) {
431
+        $p->code = 'supprimer_numero(calculer_url(' .
432
+            champ_sql('url_site', $p) . ',' .
433
+            champ_sql('nom_site', $p) .
434
+            ", 'titre', \$connect, false))";
435
+    } else {
436
+        $p->code = champ_sql('nom_site', $p);
437
+    }
438 438
 
439
-	$p->interdire_scripts = true;
439
+    $p->interdire_scripts = true;
440 440
 
441
-	return $p;
441
+    return $p;
442 442
 }
443 443
 
444 444
 
@@ -455,11 +455,11 @@  discard block
 block discarded – undo
455 455
  *     Pile complétée par le code à générer
456 456
  **/
457 457
 function balise_NOTES_dist($p) {
458
-	// Recuperer les notes
459
-	$p->code = 'calculer_notes()';
458
+    // Recuperer les notes
459
+    $p->code = 'calculer_notes()';
460 460
 
461
-	#$p->interdire_scripts = true;
462
-	return $p;
461
+    #$p->interdire_scripts = true;
462
+    return $p;
463 463
 }
464 464
 
465 465
 
@@ -481,10 +481,10 @@  discard block
 block discarded – undo
481 481
  *     Pile complétée par le code à générer
482 482
  **/
483 483
 function balise_RECHERCHE_dist($p) {
484
-	$p->code = 'entites_html(_request("recherche"))';
485
-	$p->interdire_scripts = false;
484
+    $p->code = 'entites_html(_request("recherche"))';
485
+    $p->interdire_scripts = false;
486 486
 
487
-	return $p;
487
+    return $p;
488 488
 }
489 489
 
490 490
 
@@ -502,18 +502,18 @@  discard block
 block discarded – undo
502 502
  *     Pile complétée par le code à générer
503 503
  **/
504 504
 function balise_COMPTEUR_BOUCLE_dist($p) {
505
-	$b = index_boucle_mere($p);
506
-	if ($b === '') {
507
-		$msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]];
508
-		erreur_squelette($msg, $p);
509
-		return null;
510
-	} else {
511
-		$p->code = "(\$Numrows['$b']['compteur_boucle'] ?? 0)";
512
-		$p->boucles[$b]->cptrows = true;
513
-		$p->interdire_scripts = false;
505
+    $b = index_boucle_mere($p);
506
+    if ($b === '') {
507
+        $msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]];
508
+        erreur_squelette($msg, $p);
509
+        return null;
510
+    } else {
511
+        $p->code = "(\$Numrows['$b']['compteur_boucle'] ?? 0)";
512
+        $p->boucles[$b]->cptrows = true;
513
+        $p->interdire_scripts = false;
514 514
 
515
-		return $p;
516
-	}
515
+        return $p;
516
+    }
517 517
 }
518 518
 
519 519
 /**
@@ -531,17 +531,17 @@  discard block
 block discarded – undo
531 531
  *     Pile complétée par le code à générer
532 532
  **/
533 533
 function balise_TOTAL_BOUCLE_dist($p) {
534
-	$b = index_boucle_mere($p);
535
-	if ($b === '') {
536
-		$msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]];
537
-		erreur_squelette($msg, $p);
538
-	} else {
539
-		$p->code = "(\$Numrows['$b']['total'] ?? 0)";
540
-		$p->boucles[$b]->numrows = true;
541
-		$p->interdire_scripts = false;
542
-	}
534
+    $b = index_boucle_mere($p);
535
+    if ($b === '') {
536
+        $msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]];
537
+        erreur_squelette($msg, $p);
538
+    } else {
539
+        $p->code = "(\$Numrows['$b']['total'] ?? 0)";
540
+        $p->boucles[$b]->numrows = true;
541
+        $p->interdire_scripts = false;
542
+    }
543 543
 
544
-	return $p;
544
+    return $p;
545 545
 }
546 546
 
547 547
 
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
  *     Pile complétée par le code à générer
562 562
  **/
563 563
 function balise_POINTS_dist($p) {
564
-	return rindex_pile($p, 'points', 'recherche');
564
+    return rindex_pile($p, 'points', 'recherche');
565 565
 }
566 566
 
567 567
 
@@ -582,12 +582,12 @@  discard block
 block discarded – undo
582 582
  *     Pile complétée par le code à générer
583 583
  **/
584 584
 function balise_POPULARITE_ABSOLUE_dist($p) {
585
-	$p->code = 'ceil(' .
586
-		champ_sql('popularite', $p) .
587
-		')';
588
-	$p->interdire_scripts = false;
585
+    $p->code = 'ceil(' .
586
+        champ_sql('popularite', $p) .
587
+        ')';
588
+    $p->interdire_scripts = false;
589 589
 
590
-	return $p;
590
+    return $p;
591 591
 }
592 592
 
593 593
 /**
@@ -607,10 +607,10 @@  discard block
 block discarded – undo
607 607
  *     Pile complétée par le code à générer
608 608
  **/
609 609
 function balise_POPULARITE_SITE_dist($p) {
610
-	$p->code = 'ceil($GLOBALS["meta"][\'popularite_total\'])';
611
-	$p->interdire_scripts = false;
610
+    $p->code = 'ceil($GLOBALS["meta"][\'popularite_total\'])';
611
+    $p->interdire_scripts = false;
612 612
 
613
-	return $p;
613
+    return $p;
614 614
 }
615 615
 
616 616
 /**
@@ -631,10 +631,10 @@  discard block
 block discarded – undo
631 631
  *     Pile complétée par le code à générer
632 632
  **/
633 633
 function balise_POPULARITE_MAX_dist($p) {
634
-	$p->code = 'ceil($GLOBALS["meta"][\'popularite_max\'])';
635
-	$p->interdire_scripts = false;
634
+    $p->code = 'ceil($GLOBALS["meta"][\'popularite_max\'])';
635
+    $p->interdire_scripts = false;
636 636
 
637
-	return $p;
637
+    return $p;
638 638
 }
639 639
 
640 640
 
@@ -660,15 +660,15 @@  discard block
 block discarded – undo
660 660
  *     Pile complétée par le code à générer
661 661
  **/
662 662
 function balise_VALEUR_dist($p) {
663
-	$b = $p->nom_boucle ?: $p->id_boucle;
664
-	$p->code = index_pile($p->id_boucle, 'valeur', $p->boucles, $b);
663
+    $b = $p->nom_boucle ?: $p->id_boucle;
664
+    $p->code = index_pile($p->id_boucle, 'valeur', $p->boucles, $b);
665 665
 ;
666
-	if (($v = interprete_argument_balise(1, $p)) !== null) {
667
-		$p->code = 'table_valeur(' . $p->code . ', ' . $v . ')';
668
-	}
669
-	$p->interdire_scripts = true;
666
+    if (($v = interprete_argument_balise(1, $p)) !== null) {
667
+        $p->code = 'table_valeur(' . $p->code . ', ' . $v . ')';
668
+    }
669
+    $p->interdire_scripts = true;
670 670
 
671
-	return $p;
671
+    return $p;
672 672
 }
673 673
 
674 674
 /**
@@ -697,16 +697,16 @@  discard block
 block discarded – undo
697 697
  *     Pile complétée par le code à générer
698 698
  **/
699 699
 function balise_EXPOSE_dist($p) {
700
-	$on = "'on'";
701
-	$off = "''";
702
-	if (($v = interprete_argument_balise(1, $p)) !== null) {
703
-		$on = $v;
704
-		if (($v = interprete_argument_balise(2, $p)) !== null) {
705
-			$off = $v;
706
-		}
707
-	}
700
+    $on = "'on'";
701
+    $off = "''";
702
+    if (($v = interprete_argument_balise(1, $p)) !== null) {
703
+        $on = $v;
704
+        if (($v = interprete_argument_balise(2, $p)) !== null) {
705
+            $off = $v;
706
+        }
707
+    }
708 708
 
709
-	return calculer_balise_expose($p, $on, $off);
709
+    return calculer_balise_expose($p, $on, $off);
710 710
 }
711 711
 
712 712
 /**
@@ -724,35 +724,35 @@  discard block
 block discarded – undo
724 724
  *     Pile complétée par le code à générer
725 725
  **/
726 726
 function calculer_balise_expose($p, $on, $off) {
727
-	$b = index_boucle($p);
728
-	if (empty($p->boucles[$b]->primary)) {
729
-		$msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]];
730
-		erreur_squelette($msg, $p);
731
-	} else {
732
-		$key = $p->boucles[$b]->primary;
733
-		$type = $p->boucles[$p->id_boucle]->primary;
734
-		$desc = $p->boucles[$b]->show;
735
-		$connect = sql_quote($p->boucles[$b]->sql_serveur);
727
+    $b = index_boucle($p);
728
+    if (empty($p->boucles[$b]->primary)) {
729
+        $msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]];
730
+        erreur_squelette($msg, $p);
731
+    } else {
732
+        $key = $p->boucles[$b]->primary;
733
+        $type = $p->boucles[$p->id_boucle]->primary;
734
+        $desc = $p->boucles[$b]->show;
735
+        $connect = sql_quote($p->boucles[$b]->sql_serveur);
736 736
 
737
-		// Ne pas utiliser champ_sql, on jongle avec le nom boucle explicite
738
-		$c = index_pile($p->id_boucle, $type, $p->boucles);
737
+        // Ne pas utiliser champ_sql, on jongle avec le nom boucle explicite
738
+        $c = index_pile($p->id_boucle, $type, $p->boucles);
739 739
 
740
-		if (isset($desc['field']['id_parent'])) {
741
-			$parent = 0; // pour if (!$parent) dans calculer_expose
742
-		} elseif (isset($desc['field']['id_rubrique'])) {
743
-			$parent = index_pile($p->id_boucle, 'id_rubrique', $p->boucles, $b);
744
-		} elseif (isset($desc['field']['id_groupe'])) {
745
-			$parent = index_pile($p->id_boucle, 'id_groupe', $p->boucles, $b);
746
-		} else {
747
-			$parent = "''";
748
-		}
740
+        if (isset($desc['field']['id_parent'])) {
741
+            $parent = 0; // pour if (!$parent) dans calculer_expose
742
+        } elseif (isset($desc['field']['id_rubrique'])) {
743
+            $parent = index_pile($p->id_boucle, 'id_rubrique', $p->boucles, $b);
744
+        } elseif (isset($desc['field']['id_groupe'])) {
745
+            $parent = index_pile($p->id_boucle, 'id_groupe', $p->boucles, $b);
746
+        } else {
747
+            $parent = "''";
748
+        }
749 749
 
750
-		$p->code = "(calcul_exposer($c, '$type', \$Pile[0], $parent, '$key', $connect) ? $on : $off)";
751
-	}
750
+        $p->code = "(calcul_exposer($c, '$type', \$Pile[0], $parent, '$key', $connect) ? $on : $off)";
751
+    }
752 752
 
753
-	$p->interdire_scripts = false;
753
+    $p->interdire_scripts = false;
754 754
 
755
-	return $p;
755
+    return $p;
756 756
 }
757 757
 
758 758
 
@@ -793,46 +793,46 @@  discard block
 block discarded – undo
793 793
  **/
794 794
 function balise_INTRODUCTION_dist($p) {
795 795
 
796
-	$type_objet = $p->type_requete;
797
-	$cle_objet = id_table_objet($type_objet);
798
-	$_id_objet = champ_sql($cle_objet, $p);
799
-
800
-	// Récupérer les valeurs sql nécessaires : descriptif, texte et chapo
801
-	// ainsi que le longueur d'introduction donnée dans la description de l'objet.
802
-	$_introduction_longueur = 'null';
803
-	$_ligne = 'array(';
804
-	$trouver_table = charger_fonction('trouver_table', 'base');
805
-	if ($desc = $trouver_table(table_objet_sql($type_objet))) {
806
-		if (isset($desc['field']['descriptif'])) {
807
-			$_ligne .= "'descriptif' => " . champ_sql('descriptif', $p) . ',';
808
-		}
809
-		if (isset($desc['field']['texte'])) {
810
-			$_ligne .= "'texte' => " . champ_sql('texte', $p) . ',';
811
-		}
812
-		if (isset($desc['field']['chapo'])) {
813
-			$_ligne .= "'chapo' => " . champ_sql('chapo', $p) . ',';
814
-		}
815
-		if (isset($desc['introduction_longueur'])) {
816
-			$_introduction_longueur = "'" . $desc['introduction_longueur'] . "'";
817
-		}
818
-	}
819
-	$_ligne .= ')';
820
-
821
-	// Récupérer la longueur et la suite passés en paramètres
822
-	$_longueur_ou_suite = 'null';
823
-	if (($v1 = interprete_argument_balise(1, $p)) !== null) {
824
-		$_longueur_ou_suite = $v1;
825
-	}
826
-	$_suite = 'null';
827
-	if (($v2 = interprete_argument_balise(2, $p)) !== null) {
828
-		$_suite = $v2;
829
-	}
830
-
831
-	$p->code = "generer_objet_introduction((int)$_id_objet, '$type_objet', $_ligne, $_introduction_longueur, $_longueur_ou_suite, $_suite, \$connect)";
832
-
833
-	#$p->interdire_scripts = true;
834
-	$p->etoile = '*'; // propre est deja fait dans le calcul de l'intro
835
-	return $p;
796
+    $type_objet = $p->type_requete;
797
+    $cle_objet = id_table_objet($type_objet);
798
+    $_id_objet = champ_sql($cle_objet, $p);
799
+
800
+    // Récupérer les valeurs sql nécessaires : descriptif, texte et chapo
801
+    // ainsi que le longueur d'introduction donnée dans la description de l'objet.
802
+    $_introduction_longueur = 'null';
803
+    $_ligne = 'array(';
804
+    $trouver_table = charger_fonction('trouver_table', 'base');
805
+    if ($desc = $trouver_table(table_objet_sql($type_objet))) {
806
+        if (isset($desc['field']['descriptif'])) {
807
+            $_ligne .= "'descriptif' => " . champ_sql('descriptif', $p) . ',';
808
+        }
809
+        if (isset($desc['field']['texte'])) {
810
+            $_ligne .= "'texte' => " . champ_sql('texte', $p) . ',';
811
+        }
812
+        if (isset($desc['field']['chapo'])) {
813
+            $_ligne .= "'chapo' => " . champ_sql('chapo', $p) . ',';
814
+        }
815
+        if (isset($desc['introduction_longueur'])) {
816
+            $_introduction_longueur = "'" . $desc['introduction_longueur'] . "'";
817
+        }
818
+    }
819
+    $_ligne .= ')';
820
+
821
+    // Récupérer la longueur et la suite passés en paramètres
822
+    $_longueur_ou_suite = 'null';
823
+    if (($v1 = interprete_argument_balise(1, $p)) !== null) {
824
+        $_longueur_ou_suite = $v1;
825
+    }
826
+    $_suite = 'null';
827
+    if (($v2 = interprete_argument_balise(2, $p)) !== null) {
828
+        $_suite = $v2;
829
+    }
830
+
831
+    $p->code = "generer_objet_introduction((int)$_id_objet, '$type_objet', $_ligne, $_introduction_longueur, $_longueur_ou_suite, $_suite, \$connect)";
832
+
833
+    #$p->interdire_scripts = true;
834
+    $p->etoile = '*'; // propre est deja fait dans le calcul de l'intro
835
+    return $p;
836 836
 }
837 837
 
838 838
 
@@ -852,15 +852,15 @@  discard block
 block discarded – undo
852 852
  *     Pile complétée par le code à générer
853 853
  **/
854 854
 function balise_LANG_dist($p) {
855
-	$_lang = champ_sql('lang', $p);
856
-	if (!$p->etoile) {
857
-		$p->code = "spip_htmlentities($_lang ? $_lang : \$GLOBALS['spip_lang'])";
858
-	} else {
859
-		$p->code = "spip_htmlentities($_lang)";
860
-	}
861
-	$p->interdire_scripts = false;
855
+    $_lang = champ_sql('lang', $p);
856
+    if (!$p->etoile) {
857
+        $p->code = "spip_htmlentities($_lang ? $_lang : \$GLOBALS['spip_lang'])";
858
+    } else {
859
+        $p->code = "spip_htmlentities($_lang)";
860
+    }
861
+    $p->interdire_scripts = false;
862 862
 
863
-	return $p;
863
+    return $p;
864 864
 }
865 865
 
866 866
 /**
@@ -882,45 +882,45 @@  discard block
 block discarded – undo
882 882
  *     Pile complétée par le code à générer
883 883
  */
884 884
 function balise_LESAUTEURS_dist($p) {
885
-	// Cherche le champ 'lesauteurs' dans la pile
886
-	$_lesauteurs = champ_sql('lesauteurs', $p, '');
887
-
888
-	// Si le champ n'existe pas (cas de spip_articles), on applique
889
-	// le modele lesauteurs.html en passant id_article dans le contexte;
890
-	// dans le cas contraire on prend le champ 'lesauteurs'
891
-	// (cf extension sites/)
892
-	if ($_lesauteurs) {
893
-		$p->code = "safehtml($_lesauteurs)";
894
-		// $p->interdire_scripts = true;
895
-	} else {
896
-		if (!$p->id_boucle) {
897
-			$connect = '';
898
-			$objet = 'article';
899
-			$id_table_objet = 'id_article';
900
-		} else {
901
-			$b = $p->nom_boucle ?: $p->id_boucle;
902
-			$connect = $p->boucles[$b]->sql_serveur;
903
-			$type_boucle = $p->boucles[$b]->type_requete;
904
-			$objet = objet_type($type_boucle);
905
-			$id_table_objet = id_table_objet($type_boucle);
906
-		}
907
-		$c = memoriser_contexte_compil($p);
908
-
909
-		$p->code = sprintf(
910
-			CODE_RECUPERER_FOND,
911
-			"'modeles/lesauteurs'",
912
-			"array('objet'=>'" . $objet .
913
-			"','id_objet' => " . champ_sql($id_table_objet, $p) .
914
-			",'$id_table_objet' => " . champ_sql($id_table_objet, $p) .
915
-			($objet == 'article' ? '' : ",'id_article' => " . champ_sql('id_article', $p)) .
916
-			')',
917
-			"'trim'=>true, 'compil'=>array($c)",
918
-			_q($connect)
919
-		);
920
-		$p->interdire_scripts = false; // securite apposee par recuperer_fond()
921
-	}
922
-
923
-	return $p;
885
+    // Cherche le champ 'lesauteurs' dans la pile
886
+    $_lesauteurs = champ_sql('lesauteurs', $p, '');
887
+
888
+    // Si le champ n'existe pas (cas de spip_articles), on applique
889
+    // le modele lesauteurs.html en passant id_article dans le contexte;
890
+    // dans le cas contraire on prend le champ 'lesauteurs'
891
+    // (cf extension sites/)
892
+    if ($_lesauteurs) {
893
+        $p->code = "safehtml($_lesauteurs)";
894
+        // $p->interdire_scripts = true;
895
+    } else {
896
+        if (!$p->id_boucle) {
897
+            $connect = '';
898
+            $objet = 'article';
899
+            $id_table_objet = 'id_article';
900
+        } else {
901
+            $b = $p->nom_boucle ?: $p->id_boucle;
902
+            $connect = $p->boucles[$b]->sql_serveur;
903
+            $type_boucle = $p->boucles[$b]->type_requete;
904
+            $objet = objet_type($type_boucle);
905
+            $id_table_objet = id_table_objet($type_boucle);
906
+        }
907
+        $c = memoriser_contexte_compil($p);
908
+
909
+        $p->code = sprintf(
910
+            CODE_RECUPERER_FOND,
911
+            "'modeles/lesauteurs'",
912
+            "array('objet'=>'" . $objet .
913
+            "','id_objet' => " . champ_sql($id_table_objet, $p) .
914
+            ",'$id_table_objet' => " . champ_sql($id_table_objet, $p) .
915
+            ($objet == 'article' ? '' : ",'id_article' => " . champ_sql('id_article', $p)) .
916
+            ')',
917
+            "'trim'=>true, 'compil'=>array($c)",
918
+            _q($connect)
919
+        );
920
+        $p->interdire_scripts = false; // securite apposee par recuperer_fond()
921
+    }
922
+
923
+    return $p;
924 924
 }
925 925
 
926 926
 
@@ -947,76 +947,76 @@  discard block
 block discarded – undo
947 947
  *     Pile complétée par le code à générer
948 948
  */
949 949
 function balise_RANG_dist($p) {
950
-	$b = index_boucle($p);
951
-	if ($b === '') {
952
-		$msg = [
953
-			'zbug_champ_hors_boucle',
954
-			['champ' => '#RANG']
955
-		];
956
-		erreur_squelette($msg, $p);
957
-	} else {
958
-		// chercher d'abord un champ sql rang (mais pas dans le env : defaut '' si on trouve pas de champ sql)
959
-		// dans la boucle immediatement englobante uniquement
960
-		// sinon on compose le champ calcule
961
-		$_rang = champ_sql('rang', $p, '', false);
962
-
963
-		// si pas trouve de champ sql rang :
964
-		if (!$_rang || $_rang == "''") {
965
-			$boucle = &$p->boucles[$b];
966
-
967
-			// on gere le cas ou #RANG est une extraction du numero dans le titre
968
-			$trouver_table = charger_fonction('trouver_table', 'base');
969
-			$desc = $trouver_table($boucle->id_table);
970
-			$_titre = ''; # où extraire le numero ?
971
-
972
-			if (isset($desc['titre'])) {
973
-				$t = $desc['titre'];
974
-				if (
975
-					// Soit on trouve avec la déclaration de la lang AVANT
976
-					preg_match(';(?:lang\s*,)\s*(.*?titre)\s*(,|$);', $t, $m)
977
-					// Soit on prend depuis le début
978
-					|| preg_match(';^(.*?titre)\s*(,|$);', $t, $m)
979
-				) {
980
-					$m = preg_replace(',as\s+titre$,i', '', $m[1]);
981
-					$m = trim($m);
982
-					if ($m != "''") {
983
-						if (!preg_match(',\W,', $m)) {
984
-							$m = $boucle->id_table . ".$m";
985
-						}
986
-
987
-						$m .= ' AS titre_rang';
988
-
989
-						$boucle->select[] = $m;
990
-						$_titre = '$Pile[$SP][\'titre_rang\']';
991
-					}
992
-				}
993
-			}
994
-
995
-			// si on n'a rien trouvé, on utilise le champ titre classique
996
-			if (!$_titre) {
997
-				$_titre = champ_sql('titre', $p);
998
-			}
999
-
1000
-			// et on recupere aussi les infos de liaison si on est en train d'editer les liens justement
1001
-			// cas des formulaires xxx_lies utilises par #FORMULAIRE_EDITER_LIENS
1002
-			$type_boucle = $boucle->type_requete;
1003
-			$objet = objet_type($type_boucle);
1004
-			$id_table_objet = id_table_objet($type_boucle);
1005
-			$_primary = champ_sql($id_table_objet, $p, '', false);
1006
-			$_env = '$Pile[0]';
1007
-
1008
-			if (!$_titre) {$_titre = "''";
1009
-			}
1010
-			if (!$_primary) {$_primary = "''";
1011
-			}
1012
-			$_rang = "calculer_rang_smart($_titre, '$objet', $_primary, $_env)";
1013
-		}
1014
-
1015
-		$p->code = $_rang;
1016
-		$p->interdire_scripts = false;
1017
-	}
1018
-
1019
-	return $p;
950
+    $b = index_boucle($p);
951
+    if ($b === '') {
952
+        $msg = [
953
+            'zbug_champ_hors_boucle',
954
+            ['champ' => '#RANG']
955
+        ];
956
+        erreur_squelette($msg, $p);
957
+    } else {
958
+        // chercher d'abord un champ sql rang (mais pas dans le env : defaut '' si on trouve pas de champ sql)
959
+        // dans la boucle immediatement englobante uniquement
960
+        // sinon on compose le champ calcule
961
+        $_rang = champ_sql('rang', $p, '', false);
962
+
963
+        // si pas trouve de champ sql rang :
964
+        if (!$_rang || $_rang == "''") {
965
+            $boucle = &$p->boucles[$b];
966
+
967
+            // on gere le cas ou #RANG est une extraction du numero dans le titre
968
+            $trouver_table = charger_fonction('trouver_table', 'base');
969
+            $desc = $trouver_table($boucle->id_table);
970
+            $_titre = ''; # où extraire le numero ?
971
+
972
+            if (isset($desc['titre'])) {
973
+                $t = $desc['titre'];
974
+                if (
975
+                    // Soit on trouve avec la déclaration de la lang AVANT
976
+                    preg_match(';(?:lang\s*,)\s*(.*?titre)\s*(,|$);', $t, $m)
977
+                    // Soit on prend depuis le début
978
+                    || preg_match(';^(.*?titre)\s*(,|$);', $t, $m)
979
+                ) {
980
+                    $m = preg_replace(',as\s+titre$,i', '', $m[1]);
981
+                    $m = trim($m);
982
+                    if ($m != "''") {
983
+                        if (!preg_match(',\W,', $m)) {
984
+                            $m = $boucle->id_table . ".$m";
985
+                        }
986
+
987
+                        $m .= ' AS titre_rang';
988
+
989
+                        $boucle->select[] = $m;
990
+                        $_titre = '$Pile[$SP][\'titre_rang\']';
991
+                    }
992
+                }
993
+            }
994
+
995
+            // si on n'a rien trouvé, on utilise le champ titre classique
996
+            if (!$_titre) {
997
+                $_titre = champ_sql('titre', $p);
998
+            }
999
+
1000
+            // et on recupere aussi les infos de liaison si on est en train d'editer les liens justement
1001
+            // cas des formulaires xxx_lies utilises par #FORMULAIRE_EDITER_LIENS
1002
+            $type_boucle = $boucle->type_requete;
1003
+            $objet = objet_type($type_boucle);
1004
+            $id_table_objet = id_table_objet($type_boucle);
1005
+            $_primary = champ_sql($id_table_objet, $p, '', false);
1006
+            $_env = '$Pile[0]';
1007
+
1008
+            if (!$_titre) {$_titre = "''";
1009
+            }
1010
+            if (!$_primary) {$_primary = "''";
1011
+            }
1012
+            $_rang = "calculer_rang_smart($_titre, '$objet', $_primary, $_env)";
1013
+        }
1014
+
1015
+        $p->code = $_rang;
1016
+        $p->interdire_scripts = false;
1017
+    }
1018
+
1019
+    return $p;
1020 1020
 }
1021 1021
 
1022 1022
 
@@ -1038,12 +1038,12 @@  discard block
 block discarded – undo
1038 1038
  *     Pile complétée par le code à générer
1039 1039
  **/
1040 1040
 function balise_POPULARITE_dist($p) {
1041
-	$_popularite = champ_sql('popularite', $p);
1042
-	$p->code = "(ceil(min(100, 100 * $_popularite
1041
+    $_popularite = champ_sql('popularite', $p);
1042
+    $p->code = "(ceil(min(100, 100 * $_popularite
1043 1043
 	/ max(1 , 0 + \$GLOBALS['meta']['popularite_max']))))";
1044
-	$p->interdire_scripts = false;
1044
+    $p->interdire_scripts = false;
1045 1045
 
1046
-	return $p;
1046
+    return $p;
1047 1047
 }
1048 1048
 
1049 1049
 /**
@@ -1054,8 +1054,8 @@  discard block
 block discarded – undo
1054 1054
  * l'absence peut-être due à une faute de frappe dans le contexte inclus.
1055 1055
  */
1056 1056
 define(
1057
-	'CODE_PAGINATION',
1058
-	'%s($Numrows["%s"]["grand_total"],
1057
+    'CODE_PAGINATION',
1058
+    '%s($Numrows["%s"]["grand_total"],
1059 1059
  		%s,
1060 1060
 		isset($Pile[0][%4$s])?$Pile[0][%4$s]:intval(_request(%4$s)),
1061 1061
 		%5$s, %6$s, %7$s, %8$s, array(%9$s))'
@@ -1092,75 +1092,75 @@  discard block
 block discarded – undo
1092 1092
  *     Pile complétée par le code à générer
1093 1093
  */
1094 1094
 function balise_PAGINATION_dist($p, $liste = 'true') {
1095
-	$b = index_boucle_mere($p);
1096
-
1097
-	// s'il n'y a pas de nom de boucle, on ne peut pas paginer
1098
-	if ($b === '') {
1099
-		$msg = [
1100
-			'zbug_champ_hors_boucle',
1101
-			['champ' => $liste ? 'PAGINATION' : 'ANCRE_PAGINATION']
1102
-		];
1103
-		erreur_squelette($msg, $p);
1104
-
1105
-		return $p;
1106
-	}
1107
-
1108
-	// s'il n'y a pas de mode_partie, c'est qu'on se trouve
1109
-	// dans un boucle recursive ou qu'on a oublie le critere {pagination}
1110
-	if (!$p->boucles[$b]->mode_partie) {
1111
-		if (!$p->boucles[$b]->table_optionnelle) {
1112
-			$msg = [
1113
-				'zbug_pagination_sans_critere',
1114
-				['champ' => '#PAGINATION']
1115
-			];
1116
-			erreur_squelette($msg, $p);
1117
-		}
1118
-
1119
-		return $p;
1120
-	}
1121
-
1122
-	// a priori true
1123
-	// si false, le compilo va bloquer sur des syntaxes avec un filtre sans argument qui suit la balise
1124
-	// si true, les arguments simples (sans truc=chose) vont degager
1125
-	$_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $p->id_boucle, false, false);
1126
-	if (is_countable($_contexte) ? count($_contexte) : 0) {
1127
-		$key = key($_contexte);
1128
-		if (is_numeric($key)) {
1129
-			array_shift($_contexte);
1130
-			$__modele = interprete_argument_balise(1, $p);
1131
-		}
1132
-	}
1133
-
1134
-	if (is_countable($_contexte) ? count($_contexte) : 0) {
1135
-		$code_contexte = implode(',', $_contexte);
1136
-	} else {
1137
-		$code_contexte = '';
1138
-	}
1139
-
1140
-	$connect = $p->boucles[$b]->sql_serveur;
1141
-	$pas = $p->boucles[$b]->total_parties;
1142
-	$f_pagination = chercher_filtre('pagination');
1143
-	$type = $p->boucles[$b]->modificateur['debut_nom'];
1144
-	$modif = ($type[0] !== "'") ? "'debut'.$type"
1145
-		: ("'debut" . substr($type, 1));
1146
-
1147
-	$p->code = sprintf(
1148
-		CODE_PAGINATION,
1149
-		$f_pagination,
1150
-		$b,
1151
-		$type,
1152
-		$modif,
1153
-		$pas,
1154
-		$liste,
1155
-		((isset($__modele) && $__modele) ? $__modele : "''"),
1156
-		_q($connect),
1157
-		$code_contexte
1158
-	);
1159
-
1160
-	$p->boucles[$b]->numrows = true;
1161
-	$p->interdire_scripts = false;
1162
-
1163
-	return $p;
1095
+    $b = index_boucle_mere($p);
1096
+
1097
+    // s'il n'y a pas de nom de boucle, on ne peut pas paginer
1098
+    if ($b === '') {
1099
+        $msg = [
1100
+            'zbug_champ_hors_boucle',
1101
+            ['champ' => $liste ? 'PAGINATION' : 'ANCRE_PAGINATION']
1102
+        ];
1103
+        erreur_squelette($msg, $p);
1104
+
1105
+        return $p;
1106
+    }
1107
+
1108
+    // s'il n'y a pas de mode_partie, c'est qu'on se trouve
1109
+    // dans un boucle recursive ou qu'on a oublie le critere {pagination}
1110
+    if (!$p->boucles[$b]->mode_partie) {
1111
+        if (!$p->boucles[$b]->table_optionnelle) {
1112
+            $msg = [
1113
+                'zbug_pagination_sans_critere',
1114
+                ['champ' => '#PAGINATION']
1115
+            ];
1116
+            erreur_squelette($msg, $p);
1117
+        }
1118
+
1119
+        return $p;
1120
+    }
1121
+
1122
+    // a priori true
1123
+    // si false, le compilo va bloquer sur des syntaxes avec un filtre sans argument qui suit la balise
1124
+    // si true, les arguments simples (sans truc=chose) vont degager
1125
+    $_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $p->id_boucle, false, false);
1126
+    if (is_countable($_contexte) ? count($_contexte) : 0) {
1127
+        $key = key($_contexte);
1128
+        if (is_numeric($key)) {
1129
+            array_shift($_contexte);
1130
+            $__modele = interprete_argument_balise(1, $p);
1131
+        }
1132
+    }
1133
+
1134
+    if (is_countable($_contexte) ? count($_contexte) : 0) {
1135
+        $code_contexte = implode(',', $_contexte);
1136
+    } else {
1137
+        $code_contexte = '';
1138
+    }
1139
+
1140
+    $connect = $p->boucles[$b]->sql_serveur;
1141
+    $pas = $p->boucles[$b]->total_parties;
1142
+    $f_pagination = chercher_filtre('pagination');
1143
+    $type = $p->boucles[$b]->modificateur['debut_nom'];
1144
+    $modif = ($type[0] !== "'") ? "'debut'.$type"
1145
+        : ("'debut" . substr($type, 1));
1146
+
1147
+    $p->code = sprintf(
1148
+        CODE_PAGINATION,
1149
+        $f_pagination,
1150
+        $b,
1151
+        $type,
1152
+        $modif,
1153
+        $pas,
1154
+        $liste,
1155
+        ((isset($__modele) && $__modele) ? $__modele : "''"),
1156
+        _q($connect),
1157
+        $code_contexte
1158
+    );
1159
+
1160
+    $p->boucles[$b]->numrows = true;
1161
+    $p->interdire_scripts = false;
1162
+
1163
+    return $p;
1164 1164
 }
1165 1165
 
1166 1166
 
@@ -1187,11 +1187,11 @@  discard block
 block discarded – undo
1187 1187
  *     Pile complétée par le code à générer
1188 1188
  **/
1189 1189
 function balise_ANCRE_PAGINATION_dist($p) {
1190
-	if ($f = charger_fonction('PAGINATION', 'balise', true)) {
1191
-		return $f($p, $liste = 'false');
1192
-	} else {
1193
-		return null;
1194
-	} // ou une erreur ?
1190
+    if ($f = charger_fonction('PAGINATION', 'balise', true)) {
1191
+        return $f($p, $liste = 'false');
1192
+    } else {
1193
+        return null;
1194
+    } // ou une erreur ?
1195 1195
 }
1196 1196
 
1197 1197
 
@@ -1212,17 +1212,17 @@  discard block
 block discarded – undo
1212 1212
  *     Pile complétée par le code à générer
1213 1213
  **/
1214 1214
 function balise_GRAND_TOTAL_dist($p) {
1215
-	$b = index_boucle_mere($p);
1216
-	if ($b === '') {
1217
-		$msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]];
1218
-		erreur_squelette($msg, $p);
1219
-	} else {
1220
-		$p->code = "(\$Numrows['$b']['grand_total'] ?? \$Numrows['$b']['total'] ?? 0)";
1221
-		$p->boucles[$b]->numrows = true;
1222
-		$p->interdire_scripts = false;
1223
-	}
1215
+    $b = index_boucle_mere($p);
1216
+    if ($b === '') {
1217
+        $msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]];
1218
+        erreur_squelette($msg, $p);
1219
+    } else {
1220
+        $p->code = "(\$Numrows['$b']['grand_total'] ?? \$Numrows['$b']['total'] ?? 0)";
1221
+        $p->boucles[$b]->numrows = true;
1222
+        $p->interdire_scripts = false;
1223
+    }
1224 1224
 
1225
-	return $p;
1225
+    return $p;
1226 1226
 }
1227 1227
 
1228 1228
 
@@ -1250,10 +1250,10 @@  discard block
 block discarded – undo
1250 1250
  *     Pile complétée par le code à générer
1251 1251
  **/
1252 1252
 function balise_SELF_dist($p) {
1253
-	$p->code = 'self()';
1254
-	$p->interdire_scripts = false;
1253
+    $p->code = 'self()';
1254
+    $p->interdire_scripts = false;
1255 1255
 
1256
-	return $p;
1256
+    return $p;
1257 1257
 }
1258 1258
 
1259 1259
 
@@ -1280,17 +1280,17 @@  discard block
 block discarded – undo
1280 1280
  *     Pile complétée par le code à générer
1281 1281
  **/
1282 1282
 function balise_CHEMIN_dist($p) {
1283
-	$arg = interprete_argument_balise(1, $p);
1284
-	if (!$arg) {
1285
-		$msg = ['zbug_balise_sans_argument', ['balise' => ' CHEMIN']];
1286
-		erreur_squelette($msg, $p);
1287
-	} else {
1288
-		$p->code = 'find_in_path((string)' . $arg . ')';
1289
-	}
1283
+    $arg = interprete_argument_balise(1, $p);
1284
+    if (!$arg) {
1285
+        $msg = ['zbug_balise_sans_argument', ['balise' => ' CHEMIN']];
1286
+        erreur_squelette($msg, $p);
1287
+    } else {
1288
+        $p->code = 'find_in_path((string)' . $arg . ')';
1289
+    }
1290 1290
 
1291
-	$p->interdire_scripts = false;
1291
+    $p->interdire_scripts = false;
1292 1292
 
1293
-	return $p;
1293
+    return $p;
1294 1294
 }
1295 1295
 
1296 1296
 /**
@@ -1315,16 +1315,16 @@  discard block
 block discarded – undo
1315 1315
  *     Pile complétée par le code à générer
1316 1316
  **/
1317 1317
 function balise_CHEMIN_IMAGE_dist($p) {
1318
-	$arg = interprete_argument_balise(1, $p);
1319
-	if (!$arg) {
1320
-		$msg = ['zbug_balise_sans_argument', ['balise' => ' CHEMIN_IMAGE']];
1321
-		erreur_squelette($msg, $p);
1322
-	} else {
1323
-		$p->code = 'chemin_image((string)' . $arg . ')';
1324
-	}
1318
+    $arg = interprete_argument_balise(1, $p);
1319
+    if (!$arg) {
1320
+        $msg = ['zbug_balise_sans_argument', ['balise' => ' CHEMIN_IMAGE']];
1321
+        erreur_squelette($msg, $p);
1322
+    } else {
1323
+        $p->code = 'chemin_image((string)' . $arg . ')';
1324
+    }
1325 1325
 
1326
-	$p->interdire_scripts = false;
1327
-	return $p;
1326
+    $p->interdire_scripts = false;
1327
+    return $p;
1328 1328
 }
1329 1329
 
1330 1330
 
@@ -1362,36 +1362,36 @@  discard block
 block discarded – undo
1362 1362
  **/
1363 1363
 function balise_ENV_dist($p, $src = null) {
1364 1364
 
1365
-	// cle du tableau desiree
1366
-	$_nom = interprete_argument_balise(1, $p);
1367
-	// valeur par defaut
1368
-	$_sinon = interprete_argument_balise(2, $p);
1365
+    // cle du tableau desiree
1366
+    $_nom = interprete_argument_balise(1, $p);
1367
+    // valeur par defaut
1368
+    $_sinon = interprete_argument_balise(2, $p);
1369 1369
 
1370
-	// $src est un tableau de donnees sources eventuellement transmis
1371
-	// en absence, on utilise l'environnement du squelette $Pile[0]
1370
+    // $src est un tableau de donnees sources eventuellement transmis
1371
+    // en absence, on utilise l'environnement du squelette $Pile[0]
1372 1372
 
1373
-	if (!$_nom) {
1374
-		// cas de #ENV sans argument : on retourne le serialize() du tableau
1375
-		// une belle fonction [(#ENV|affiche_env)] serait pratique
1376
-		if ($src) {
1377
-			$p->code = '(is_array($a = (' . $src . ')) ? serialize($a) : "")';
1378
-		} else {
1379
-			$p->code = 'serialize($Pile[0]??[])';
1380
-		}
1381
-	} else {
1382
-		if (!$src) {
1383
-			$src = '$Pile[0]??[]';
1384
-		}
1385
-		if ($_sinon) {
1386
-			$p->code = "sinon(table_valeur($src, (string)$_nom, null), $_sinon)";
1387
-		} else {
1388
-			$p->code = "table_valeur($src, (string)$_nom, null)";
1389
-		}
1390
-	}
1373
+    if (!$_nom) {
1374
+        // cas de #ENV sans argument : on retourne le serialize() du tableau
1375
+        // une belle fonction [(#ENV|affiche_env)] serait pratique
1376
+        if ($src) {
1377
+            $p->code = '(is_array($a = (' . $src . ')) ? serialize($a) : "")';
1378
+        } else {
1379
+            $p->code = 'serialize($Pile[0]??[])';
1380
+        }
1381
+    } else {
1382
+        if (!$src) {
1383
+            $src = '$Pile[0]??[]';
1384
+        }
1385
+        if ($_sinon) {
1386
+            $p->code = "sinon(table_valeur($src, (string)$_nom, null), $_sinon)";
1387
+        } else {
1388
+            $p->code = "table_valeur($src, (string)$_nom, null)";
1389
+        }
1390
+    }
1391 1391
 
1392
-	#$p->interdire_scripts = true;
1392
+    #$p->interdire_scripts = true;
1393 1393
 
1394
-	return $p;
1394
+    return $p;
1395 1395
 }
1396 1396
 
1397 1397
 /**
@@ -1421,16 +1421,16 @@  discard block
 block discarded – undo
1421 1421
  *     Pile completée du code PHP d'exécution de la balise
1422 1422
  */
1423 1423
 function balise_CONFIG_dist($p) {
1424
-	if (!$arg = interprete_argument_balise(1, $p)) {
1425
-		$arg = "''";
1426
-	}
1427
-	$_sinon = interprete_argument_balise(2, $p);
1428
-	$_unserialize = sinon(interprete_argument_balise(3, $p), 'false');
1424
+    if (!$arg = interprete_argument_balise(1, $p)) {
1425
+        $arg = "''";
1426
+    }
1427
+    $_sinon = interprete_argument_balise(2, $p);
1428
+    $_unserialize = sinon(interprete_argument_balise(3, $p), 'false');
1429 1429
 
1430
-	$p->code = '(include_spip(\'inc/config\')?lire_config(' . $arg . ',' .
1431
-		($_sinon && $_sinon != "''" ? $_sinon : 'null') . ',' . $_unserialize . "):'')";
1430
+    $p->code = '(include_spip(\'inc/config\')?lire_config(' . $arg . ',' .
1431
+        ($_sinon && $_sinon != "''" ? $_sinon : 'null') . ',' . $_unserialize . "):'')";
1432 1432
 
1433
-	return $p;
1433
+    return $p;
1434 1434
 }
1435 1435
 
1436 1436
 
@@ -1453,10 +1453,10 @@  discard block
 block discarded – undo
1453 1453
  *     Pile completée du code PHP d'exécution de la balise
1454 1454
  */
1455 1455
 function balise_CONNECT_dist($p) {
1456
-	$p->code = '($connect ? $connect : NULL)';
1457
-	$p->interdire_scripts = false;
1456
+    $p->code = '($connect ? $connect : NULL)';
1457
+    $p->interdire_scripts = false;
1458 1458
 
1459
-	return $p;
1459
+    return $p;
1460 1460
 }
1461 1461
 
1462 1462
 
@@ -1484,15 +1484,15 @@  discard block
 block discarded – undo
1484 1484
  *     Pile completée du code PHP d'exécution de la balise
1485 1485
  **/
1486 1486
 function balise_SESSION_dist($p) {
1487
-	$p->descr['session'] = true;
1487
+    $p->descr['session'] = true;
1488 1488
 
1489
-	$f = function_exists('balise_ENV')
1490
-		? 'balise_ENV'
1491
-		: 'balise_ENV_dist';
1489
+    $f = function_exists('balise_ENV')
1490
+        ? 'balise_ENV'
1491
+        : 'balise_ENV_dist';
1492 1492
 
1493
-	$p = $f($p, '$GLOBALS["visiteur_session"]??[]');
1493
+    $p = $f($p, '$GLOBALS["visiteur_session"]??[]');
1494 1494
 
1495
-	return $p;
1495
+    return $p;
1496 1496
 }
1497 1497
 
1498 1498
 
@@ -1515,18 +1515,18 @@  discard block
 block discarded – undo
1515 1515
  *     Pile completée du code PHP d'exécution de la balise
1516 1516
  **/
1517 1517
 function balise_SESSION_SET_dist($p) {
1518
-	$_nom = interprete_argument_balise(1, $p);
1519
-	$_val = interprete_argument_balise(2, $p);
1520
-	if (!$_nom || !$_val) {
1521
-		$err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'SESSION_SET']];
1522
-		erreur_squelette($err_b_s_a, $p);
1523
-	} else {
1524
-		$p->code = '(include_spip("inc/session") AND session_set(' . $_nom . ',' . $_val . '))';
1525
-	}
1518
+    $_nom = interprete_argument_balise(1, $p);
1519
+    $_val = interprete_argument_balise(2, $p);
1520
+    if (!$_nom || !$_val) {
1521
+        $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'SESSION_SET']];
1522
+        erreur_squelette($err_b_s_a, $p);
1523
+    } else {
1524
+        $p->code = '(include_spip("inc/session") AND session_set(' . $_nom . ',' . $_val . '))';
1525
+    }
1526 1526
 
1527
-	$p->interdire_scripts = false;
1527
+    $p->interdire_scripts = false;
1528 1528
 
1529
-	return $p;
1529
+    return $p;
1530 1530
 }
1531 1531
 
1532 1532
 
@@ -1557,30 +1557,30 @@  discard block
 block discarded – undo
1557 1557
  *     Pile completée du code PHP d'exécution de la balise
1558 1558
  **/
1559 1559
 function balise_EVAL_dist($p) {
1560
-	$php = interprete_argument_balise(1, $p);
1561
-	if ($php) {
1562
-		# optimisation sur les #EVAL{une expression sans #BALISE}
1563
-		# attention au commentaire "// x signes" qui precede
1564
-		if (
1565
-			preg_match(
1566
-				",^([[:space:]]*//[^\n]*\n)'([^']+)'$,ms",
1567
-				$php,
1568
-				$r
1569
-			)
1570
-		) {
1571
-			$p->code = /* $r[1]. */
1572
-				'(' . $r[2] . ')';
1573
-		} else {
1574
-			$p->code = "eval('return '.$php.';')";
1575
-		}
1576
-	} else {
1577
-		$msg = ['zbug_balise_sans_argument', ['balise' => ' EVAL']];
1578
-		erreur_squelette($msg, $p);
1579
-	}
1580
-
1581
-	#$p->interdire_scripts = true;
1582
-
1583
-	return $p;
1560
+    $php = interprete_argument_balise(1, $p);
1561
+    if ($php) {
1562
+        # optimisation sur les #EVAL{une expression sans #BALISE}
1563
+        # attention au commentaire "// x signes" qui precede
1564
+        if (
1565
+            preg_match(
1566
+                ",^([[:space:]]*//[^\n]*\n)'([^']+)'$,ms",
1567
+                $php,
1568
+                $r
1569
+            )
1570
+        ) {
1571
+            $p->code = /* $r[1]. */
1572
+                '(' . $r[2] . ')';
1573
+        } else {
1574
+            $p->code = "eval('return '.$php.';')";
1575
+        }
1576
+    } else {
1577
+        $msg = ['zbug_balise_sans_argument', ['balise' => ' EVAL']];
1578
+        erreur_squelette($msg, $p);
1579
+    }
1580
+
1581
+    #$p->interdire_scripts = true;
1582
+
1583
+    return $p;
1584 1584
 }
1585 1585
 
1586 1586
 
@@ -1610,19 +1610,19 @@  discard block
 block discarded – undo
1610 1610
  **/
1611 1611
 function balise_CHAMP_SQL_dist($p) {
1612 1612
 
1613
-	if (
1614
-		$p->param
1615
-		&& isset($p->param[0][1][0])
1616
-		&& ($champ = ($p->param[0][1][0]->texte))
1617
-	) {
1618
-		$p->code = champ_sql($champ, $p);
1619
-	} else {
1620
-		$err_b_s_a = ['zbug_balise_sans_argument', ['balise' => ' CHAMP_SQL']];
1621
-		erreur_squelette($err_b_s_a, $p);
1622
-	}
1613
+    if (
1614
+        $p->param
1615
+        && isset($p->param[0][1][0])
1616
+        && ($champ = ($p->param[0][1][0]->texte))
1617
+    ) {
1618
+        $p->code = champ_sql($champ, $p);
1619
+    } else {
1620
+        $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => ' CHAMP_SQL']];
1621
+        erreur_squelette($err_b_s_a, $p);
1622
+    }
1623 1623
 
1624
-	#$p->interdire_scripts = true;
1625
-	return $p;
1624
+    #$p->interdire_scripts = true;
1625
+    return $p;
1626 1626
 }
1627 1627
 
1628 1628
 /**
@@ -1648,13 +1648,13 @@  discard block
 block discarded – undo
1648 1648
  *     Pile complétée par le code à générer
1649 1649
  **/
1650 1650
 function balise_VAL_dist($p) {
1651
-	$p->code = interprete_argument_balise(1, $p) ?? '';
1652
-	if (!strlen($p->code)) {
1653
-		$p->code = "''";
1654
-	}
1655
-	$p->interdire_scripts = false;
1651
+    $p->code = interprete_argument_balise(1, $p) ?? '';
1652
+    if (!strlen($p->code)) {
1653
+        $p->code = "''";
1654
+    }
1655
+    $p->interdire_scripts = false;
1656 1656
 
1657
-	return $p;
1657
+    return $p;
1658 1658
 }
1659 1659
 
1660 1660
 /**
@@ -1683,10 +1683,10 @@  discard block
 block discarded – undo
1683 1683
  *     Pile complétée par le code à générer
1684 1684
  **/
1685 1685
 function balise_REM_dist($p) {
1686
-	$p->code = "''";
1687
-	$p->interdire_scripts = false;
1686
+    $p->code = "''";
1687
+    $p->interdire_scripts = false;
1688 1688
 
1689
-	return $p;
1689
+    return $p;
1690 1690
 }
1691 1691
 
1692 1692
 /**
@@ -1696,10 +1696,10 @@  discard block
 block discarded – undo
1696 1696
  * @return mixed
1697 1697
  */
1698 1698
 function balise_NULL_dist($p) {
1699
-	$p->code = 'null';
1700
-	$p->interdire_scripts = false;
1699
+    $p->code = 'null';
1700
+    $p->interdire_scripts = false;
1701 1701
 
1702
-	return $p;
1702
+    return $p;
1703 1703
 }
1704 1704
 
1705 1705
 
@@ -1723,18 +1723,18 @@  discard block
 block discarded – undo
1723 1723
  **/
1724 1724
 function balise_HTTP_HEADER_dist($p) {
1725 1725
 
1726
-	$header = interprete_argument_balise(1, $p);
1727
-	if (!$header) {
1728
-		$err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'HTTP_HEADER']];
1729
-		erreur_squelette($err_b_s_a, $p);
1730
-	} else {
1731
-		$p->code = "'<'.'?php header(' . _q("
1732
-			. $header
1733
-			. ") . '); ?'.'>'";
1734
-	}
1735
-	$p->interdire_scripts = false;
1726
+    $header = interprete_argument_balise(1, $p);
1727
+    if (!$header) {
1728
+        $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'HTTP_HEADER']];
1729
+        erreur_squelette($err_b_s_a, $p);
1730
+    } else {
1731
+        $p->code = "'<'.'?php header(' . _q("
1732
+            . $header
1733
+            . ") . '); ?'.'>'";
1734
+    }
1735
+    $p->interdire_scripts = false;
1736 1736
 
1737
-	return $p;
1737
+    return $p;
1738 1738
 }
1739 1739
 
1740 1740
 
@@ -1759,22 +1759,22 @@  discard block
 block discarded – undo
1759 1759
  *     Pile complétée par le code à générer
1760 1760
  **/
1761 1761
 function balise_FILTRE_dist($p) {
1762
-	if ($p->param) {
1763
-		$args = [];
1764
-		foreach ($p->param as $i => $ignore) {
1765
-			$args[] = interprete_argument_balise($i + 1, $p);
1766
-		}
1767
-		$p->code = "'<' . '"
1768
-			. '?php header("X-Spip-Filtre: \'.'
1769
-			. join('.\'|\'.', $args)
1770
-			. " . '\"); ?'.'>'";
1762
+    if ($p->param) {
1763
+        $args = [];
1764
+        foreach ($p->param as $i => $ignore) {
1765
+            $args[] = interprete_argument_balise($i + 1, $p);
1766
+        }
1767
+        $p->code = "'<' . '"
1768
+            . '?php header("X-Spip-Filtre: \'.'
1769
+            . join('.\'|\'.', $args)
1770
+            . " . '\"); ?'.'>'";
1771 1771
 
1772
-		$p->interdire_scripts = false;
1772
+        $p->interdire_scripts = false;
1773 1773
 
1774
-		return $p;
1775
-	}
1774
+        return $p;
1775
+    }
1776 1776
 
1777
-	return null;
1777
+    return null;
1778 1778
 }
1779 1779
 
1780 1780
 
@@ -1810,55 +1810,55 @@  discard block
 block discarded – undo
1810 1810
  **/
1811 1811
 function balise_CACHE_dist($p) {
1812 1812
 
1813
-	if ($p->param) {
1814
-		$duree = valeur_numerique($p->param[0][1][0]->texte);
1815
-
1816
-		// noter la duree du cache dans un entete proprietaire
1817
-
1818
-		$code = "'<'.'" . '?php header("X-Spip-Cache: '
1819
-			. $duree
1820
-			. '"); ?' . "'.'>'";
1821
-
1822
-		// Remplir le header Cache-Control
1823
-		// cas #CACHE{0}
1824
-		if ($duree == 0) {
1825
-			$code .= ".'<'.'"
1826
-				. '?php header("Cache-Control: no-cache, must-revalidate"); ?'
1827
-				. "'.'><'.'"
1828
-				. '?php header("Pragma: no-cache"); ?'
1829
-				. "'.'>'";
1830
-		}
1831
-
1832
-		// recuperer les parametres suivants
1833
-		$i = 1;
1834
-		while (isset($p->param[0][++$i])) {
1835
-			$pa = ($p->param[0][$i][0]->texte);
1836
-
1837
-			if (
1838
-				$pa == 'cache-client'
1839
-				&& $duree > 0
1840
-			) {
1841
-				$code .= ".'<'.'" . '?php header("Cache-Control: max-age='
1842
-					. $duree
1843
-					. '"); ?' . "'.'>'";
1844
-				// il semble logique, si on cache-client, de ne pas invalider
1845
-				$pa = 'statique';
1846
-			}
1847
-
1848
-			if (
1849
-				$pa == 'statique'
1850
-				&& $duree > 0
1851
-			) {
1852
-				$code .= ".'<'.'" . '?php header("X-Spip-Statique: oui"); ?' . "'.'>'";
1853
-			}
1854
-		}
1855
-	} else {
1856
-		$code = "''";
1857
-	}
1858
-	$p->code = $code;
1859
-	$p->interdire_scripts = false;
1860
-
1861
-	return $p;
1813
+    if ($p->param) {
1814
+        $duree = valeur_numerique($p->param[0][1][0]->texte);
1815
+
1816
+        // noter la duree du cache dans un entete proprietaire
1817
+
1818
+        $code = "'<'.'" . '?php header("X-Spip-Cache: '
1819
+            . $duree
1820
+            . '"); ?' . "'.'>'";
1821
+
1822
+        // Remplir le header Cache-Control
1823
+        // cas #CACHE{0}
1824
+        if ($duree == 0) {
1825
+            $code .= ".'<'.'"
1826
+                . '?php header("Cache-Control: no-cache, must-revalidate"); ?'
1827
+                . "'.'><'.'"
1828
+                . '?php header("Pragma: no-cache"); ?'
1829
+                . "'.'>'";
1830
+        }
1831
+
1832
+        // recuperer les parametres suivants
1833
+        $i = 1;
1834
+        while (isset($p->param[0][++$i])) {
1835
+            $pa = ($p->param[0][$i][0]->texte);
1836
+
1837
+            if (
1838
+                $pa == 'cache-client'
1839
+                && $duree > 0
1840
+            ) {
1841
+                $code .= ".'<'.'" . '?php header("Cache-Control: max-age='
1842
+                    . $duree
1843
+                    . '"); ?' . "'.'>'";
1844
+                // il semble logique, si on cache-client, de ne pas invalider
1845
+                $pa = 'statique';
1846
+            }
1847
+
1848
+            if (
1849
+                $pa == 'statique'
1850
+                && $duree > 0
1851
+            ) {
1852
+                $code .= ".'<'.'" . '?php header("X-Spip-Statique: oui"); ?' . "'.'>'";
1853
+            }
1854
+        }
1855
+    } else {
1856
+        $code = "''";
1857
+    }
1858
+    $p->code = $code;
1859
+    $p->interdire_scripts = false;
1860
+
1861
+    return $p;
1862 1862
 }
1863 1863
 
1864 1864
 
@@ -1890,13 +1890,13 @@  discard block
 block discarded – undo
1890 1890
  *     Pile complétée par le code à générer
1891 1891
  */
1892 1892
 function balise_INSERT_HEAD_dist($p) {
1893
-	$p->code = "'<'.'"
1894
-		. '?php header("X-Spip-Filtre: insert_head_css_conditionnel"); ?'
1895
-		. "'.'>'";
1896
-	$p->code .= ". pipeline('insert_head','<!-- insert_head -->')";
1897
-	$p->interdire_scripts = false;
1893
+    $p->code = "'<'.'"
1894
+        . '?php header("X-Spip-Filtre: insert_head_css_conditionnel"); ?'
1895
+        . "'.'>'";
1896
+    $p->code .= ". pipeline('insert_head','<!-- insert_head -->')";
1897
+    $p->interdire_scripts = false;
1898 1898
 
1899
-	return $p;
1899
+    return $p;
1900 1900
 }
1901 1901
 
1902 1902
 /**
@@ -1914,10 +1914,10 @@  discard block
 block discarded – undo
1914 1914
  *     Pile complétée par le code à générer
1915 1915
  */
1916 1916
 function balise_INSERT_HEAD_CSS_dist($p) {
1917
-	$p->code = "pipeline('insert_head_css','<!-- insert_head_css -->')";
1918
-	$p->interdire_scripts = false;
1917
+    $p->code = "pipeline('insert_head_css','<!-- insert_head_css -->')";
1918
+    $p->interdire_scripts = false;
1919 1919
 
1920
-	return $p;
1920
+    return $p;
1921 1921
 }
1922 1922
 
1923 1923
 /**
@@ -1932,11 +1932,11 @@  discard block
 block discarded – undo
1932 1932
  *     Pile complétée par le code à générer
1933 1933
  **/
1934 1934
 function balise_INCLUDE_dist($p) {
1935
-	if (function_exists('balise_INCLURE')) {
1936
-		return balise_INCLURE($p);
1937
-	} else {
1938
-		return balise_INCLURE_dist($p);
1939
-	}
1935
+    if (function_exists('balise_INCLURE')) {
1936
+        return balise_INCLURE($p);
1937
+    } else {
1938
+        return balise_INCLURE_dist($p);
1939
+    }
1940 1940
 }
1941 1941
 
1942 1942
 /**
@@ -1970,66 +1970,66 @@  discard block
 block discarded – undo
1970 1970
  *     Pile complétée par le code à générer
1971 1971
  **/
1972 1972
 function balise_INCLURE_dist($p) {
1973
-	$id_boucle = $p->id_boucle;
1974
-	// la lang n'est pas passe de facon automatique par argumenter
1975
-	// mais le sera pas recuperer_fond, sauf si etoile=>true est passe
1976
-	// en option
1977
-
1978
-	$_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $id_boucle, false, false);
1979
-
1980
-	// erreur de syntaxe = fond absent
1981
-	// (2 messages d'erreur SPIP pour le prix d'un, mais pas d'erreur PHP
1982
-	if (!$_contexte) {
1983
-		$_contexte = [];
1984
-	}
1985
-
1986
-	if (isset($_contexte['fond'])) {
1987
-		$f = $_contexte['fond'];
1988
-		// toujours vrai :
1989
-		if (preg_match('/^.fond.\s*=>(.*)$/s', $f, $r)) {
1990
-			$f = $r[1];
1991
-			unset($_contexte['fond']);
1992
-		} else {
1993
-			spip_log('compilation de #INCLURE a revoir');
1994
-		}
1995
-
1996
-		// #INCLURE{doublons}
1997
-		if (isset($_contexte['doublons'])) {
1998
-			$_contexte['doublons'] = "'doublons' => \$doublons";
1999
-		}
2000
-
2001
-		// Critere d'inclusion {env} (et {self} pour compatibilite ascendante)
2002
-		$flag_env = false;
2003
-		if (isset($_contexte['env']) || isset($_contexte['self'])) {
2004
-			$flag_env = true;
2005
-			unset($_contexte['env']);
2006
-		}
2007
-
2008
-		$_options = [];
2009
-		if (isset($_contexte['ajax'])) {
2010
-			$_options[] = preg_replace(',=>(.*)$,ims', '=> ($v=(\\1))?$v:true', $_contexte['ajax']);
2011
-			unset($_contexte['ajax']);
2012
-		}
2013
-		if ($p->etoile) {
2014
-			$_options[] = "'etoile'=>true";
2015
-		}
2016
-		$_options[] = "'compil'=>array(" . memoriser_contexte_compil($p) . ')';
2017
-
2018
-		$_l = 'array(' . join(",\n\t", $_contexte) . ')';
2019
-		if ($flag_env) {
2020
-			$_l = "array_merge(\$Pile[0],$_l)";
2021
-		}
2022
-
2023
-		$p->code = sprintf(CODE_RECUPERER_FOND, $f, $_l, join(',', $_options), "_request('connect') ?? ''");
2024
-	} elseif (!isset($_contexte[1])) {
2025
-		$msg = ['zbug_balise_sans_argument', ['balise' => ' INCLURE']];
2026
-		erreur_squelette($msg, $p);
2027
-	} else {
2028
-		$p->code = 'charge_scripts(' . $_contexte[1] . ',false)';
2029
-	}
2030
-
2031
-	$p->interdire_scripts = false; // la securite est assuree par recuperer_fond
2032
-	return $p;
1973
+    $id_boucle = $p->id_boucle;
1974
+    // la lang n'est pas passe de facon automatique par argumenter
1975
+    // mais le sera pas recuperer_fond, sauf si etoile=>true est passe
1976
+    // en option
1977
+
1978
+    $_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $id_boucle, false, false);
1979
+
1980
+    // erreur de syntaxe = fond absent
1981
+    // (2 messages d'erreur SPIP pour le prix d'un, mais pas d'erreur PHP
1982
+    if (!$_contexte) {
1983
+        $_contexte = [];
1984
+    }
1985
+
1986
+    if (isset($_contexte['fond'])) {
1987
+        $f = $_contexte['fond'];
1988
+        // toujours vrai :
1989
+        if (preg_match('/^.fond.\s*=>(.*)$/s', $f, $r)) {
1990
+            $f = $r[1];
1991
+            unset($_contexte['fond']);
1992
+        } else {
1993
+            spip_log('compilation de #INCLURE a revoir');
1994
+        }
1995
+
1996
+        // #INCLURE{doublons}
1997
+        if (isset($_contexte['doublons'])) {
1998
+            $_contexte['doublons'] = "'doublons' => \$doublons";
1999
+        }
2000
+
2001
+        // Critere d'inclusion {env} (et {self} pour compatibilite ascendante)
2002
+        $flag_env = false;
2003
+        if (isset($_contexte['env']) || isset($_contexte['self'])) {
2004
+            $flag_env = true;
2005
+            unset($_contexte['env']);
2006
+        }
2007
+
2008
+        $_options = [];
2009
+        if (isset($_contexte['ajax'])) {
2010
+            $_options[] = preg_replace(',=>(.*)$,ims', '=> ($v=(\\1))?$v:true', $_contexte['ajax']);
2011
+            unset($_contexte['ajax']);
2012
+        }
2013
+        if ($p->etoile) {
2014
+            $_options[] = "'etoile'=>true";
2015
+        }
2016
+        $_options[] = "'compil'=>array(" . memoriser_contexte_compil($p) . ')';
2017
+
2018
+        $_l = 'array(' . join(",\n\t", $_contexte) . ')';
2019
+        if ($flag_env) {
2020
+            $_l = "array_merge(\$Pile[0],$_l)";
2021
+        }
2022
+
2023
+        $p->code = sprintf(CODE_RECUPERER_FOND, $f, $_l, join(',', $_options), "_request('connect') ?? ''");
2024
+    } elseif (!isset($_contexte[1])) {
2025
+        $msg = ['zbug_balise_sans_argument', ['balise' => ' INCLURE']];
2026
+        erreur_squelette($msg, $p);
2027
+    } else {
2028
+        $p->code = 'charge_scripts(' . $_contexte[1] . ',false)';
2029
+    }
2030
+
2031
+    $p->interdire_scripts = false; // la securite est assuree par recuperer_fond
2032
+    return $p;
2033 2033
 }
2034 2034
 
2035 2035
 
@@ -2057,69 +2057,69 @@  discard block
 block discarded – undo
2057 2057
  **/
2058 2058
 function balise_MODELE_dist($p) {
2059 2059
 
2060
-	$_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $p->id_boucle, false);
2061
-
2062
-	// erreur de syntaxe = fond absent
2063
-	// (2 messages d'erreur SPIP pour le prix d'un, mais pas d'erreur PHP
2064
-	if (!$_contexte) {
2065
-		$_contexte = [];
2066
-	}
2067
-
2068
-	if (!isset($_contexte[1])) {
2069
-		$msg = ['zbug_balise_sans_argument', ['balise' => ' MODELE']];
2070
-		erreur_squelette($msg, $p);
2071
-	} else {
2072
-		$nom = $_contexte[1];
2073
-		unset($_contexte[1]);
2074
-
2075
-		if (preg_match("/^\s*'[^']*'/s", $nom)) {
2076
-			$nom = "'modeles/" . substr($nom, 1);
2077
-		} else {
2078
-			$nom = "'modeles/' . $nom";
2079
-		}
2080
-
2081
-		$flag_env = false;
2082
-		if (isset($_contexte['env'])) {
2083
-			$flag_env = true;
2084
-			unset($_contexte['env']);
2085
-		}
2086
-
2087
-		// Incoherence dans la syntaxe du contexte. A revoir.
2088
-		// Reserver la cle primaire de la boucle courante si elle existe
2089
-		if (isset($p->boucles[$p->id_boucle]->primary)) {
2090
-			$primary = $p->boucles[$p->id_boucle]->primary;
2091
-			if (!strpos($primary, ',')) {
2092
-				$id = champ_sql($primary, $p);
2093
-				$_contexte[] = "'$primary'=>" . $id;
2094
-				$_contexte[] = "'id'=>" . $id;
2095
-			}
2096
-		}
2097
-		$_contexte[] = "'recurs'=>(++\$recurs)";
2098
-		$connect = '';
2099
-		if (isset($p->boucles[$p->id_boucle])) {
2100
-			$connect = $p->boucles[$p->id_boucle]->sql_serveur;
2101
-		}
2102
-
2103
-		$_options = memoriser_contexte_compil($p);
2104
-		$_options = "'compil'=>array($_options), 'trim'=>true";
2105
-		if (isset($_contexte['ajax'])) {
2106
-			$_options .= ', ' . preg_replace(',=>(.*)$,ims', '=> ($v=(\\1))?$v:true', $_contexte['ajax']);
2107
-			unset($_contexte['ajax']);
2108
-		}
2109
-
2110
-		$_l = 'array(' . join(",\n\t", $_contexte) . ')';
2111
-		if ($flag_env) {
2112
-			$_l = "array_merge(\$Pile[0],$_l)";
2113
-		}
2114
-
2115
-		$page = sprintf(CODE_RECUPERER_FOND, $nom, $_l, $_options, _q($connect));
2116
-
2117
-		$p->code = "\n\t(((\$recurs=(isset(\$Pile[0]['recurs'])?\$Pile[0]['recurs']:0))>=5)? '' :\n\t$page)\n";
2118
-
2119
-		$p->interdire_scripts = false; // securite assuree par le squelette
2120
-	}
2121
-
2122
-	return $p;
2060
+    $_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $p->id_boucle, false);
2061
+
2062
+    // erreur de syntaxe = fond absent
2063
+    // (2 messages d'erreur SPIP pour le prix d'un, mais pas d'erreur PHP
2064
+    if (!$_contexte) {
2065
+        $_contexte = [];
2066
+    }
2067
+
2068
+    if (!isset($_contexte[1])) {
2069
+        $msg = ['zbug_balise_sans_argument', ['balise' => ' MODELE']];
2070
+        erreur_squelette($msg, $p);
2071
+    } else {
2072
+        $nom = $_contexte[1];
2073
+        unset($_contexte[1]);
2074
+
2075
+        if (preg_match("/^\s*'[^']*'/s", $nom)) {
2076
+            $nom = "'modeles/" . substr($nom, 1);
2077
+        } else {
2078
+            $nom = "'modeles/' . $nom";
2079
+        }
2080
+
2081
+        $flag_env = false;
2082
+        if (isset($_contexte['env'])) {
2083
+            $flag_env = true;
2084
+            unset($_contexte['env']);
2085
+        }
2086
+
2087
+        // Incoherence dans la syntaxe du contexte. A revoir.
2088
+        // Reserver la cle primaire de la boucle courante si elle existe
2089
+        if (isset($p->boucles[$p->id_boucle]->primary)) {
2090
+            $primary = $p->boucles[$p->id_boucle]->primary;
2091
+            if (!strpos($primary, ',')) {
2092
+                $id = champ_sql($primary, $p);
2093
+                $_contexte[] = "'$primary'=>" . $id;
2094
+                $_contexte[] = "'id'=>" . $id;
2095
+            }
2096
+        }
2097
+        $_contexte[] = "'recurs'=>(++\$recurs)";
2098
+        $connect = '';
2099
+        if (isset($p->boucles[$p->id_boucle])) {
2100
+            $connect = $p->boucles[$p->id_boucle]->sql_serveur;
2101
+        }
2102
+
2103
+        $_options = memoriser_contexte_compil($p);
2104
+        $_options = "'compil'=>array($_options), 'trim'=>true";
2105
+        if (isset($_contexte['ajax'])) {
2106
+            $_options .= ', ' . preg_replace(',=>(.*)$,ims', '=> ($v=(\\1))?$v:true', $_contexte['ajax']);
2107
+            unset($_contexte['ajax']);
2108
+        }
2109
+
2110
+        $_l = 'array(' . join(",\n\t", $_contexte) . ')';
2111
+        if ($flag_env) {
2112
+            $_l = "array_merge(\$Pile[0],$_l)";
2113
+        }
2114
+
2115
+        $page = sprintf(CODE_RECUPERER_FOND, $nom, $_l, $_options, _q($connect));
2116
+
2117
+        $p->code = "\n\t(((\$recurs=(isset(\$Pile[0]['recurs'])?\$Pile[0]['recurs']:0))>=5)? '' :\n\t$page)\n";
2118
+
2119
+        $p->interdire_scripts = false; // securite assuree par le squelette
2120
+    }
2121
+
2122
+    return $p;
2123 2123
 }
2124 2124
 
2125 2125
 
@@ -2143,21 +2143,21 @@  discard block
 block discarded – undo
2143 2143
  *     Pile complétée par le code à générer
2144 2144
  **/
2145 2145
 function balise_SET_dist($p) {
2146
-	$_nom = interprete_argument_balise(1, $p);
2147
-	$_val = interprete_argument_balise(2, $p);
2146
+    $_nom = interprete_argument_balise(1, $p);
2147
+    $_val = interprete_argument_balise(2, $p);
2148 2148
 
2149
-	if (!$_nom || !$_val) {
2150
-		$err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'SET']];
2151
-		erreur_squelette($err_b_s_a, $p);
2152
-	}
2153
-	// affectation $_zzz inutile, mais permet de contourner un bug OpCode cache sous PHP 5.5.4
2154
-	// cf https://bugs.php.net/bug.php?id=65845
2155
-	else {
2156
-		$p->code = "vide(\$Pile['vars'][\$_zzz=(string)$_nom] = $_val)";
2157
-	}
2149
+    if (!$_nom || !$_val) {
2150
+        $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'SET']];
2151
+        erreur_squelette($err_b_s_a, $p);
2152
+    }
2153
+    // affectation $_zzz inutile, mais permet de contourner un bug OpCode cache sous PHP 5.5.4
2154
+    // cf https://bugs.php.net/bug.php?id=65845
2155
+    else {
2156
+        $p->code = "vide(\$Pile['vars'][\$_zzz=(string)$_nom] = $_val)";
2157
+    }
2158 2158
 
2159
-	$p->interdire_scripts = false; // la balise ne renvoie rien
2160
-	return $p;
2159
+    $p->interdire_scripts = false; // la balise ne renvoie rien
2160
+    return $p;
2161 2161
 }
2162 2162
 
2163 2163
 
@@ -2187,12 +2187,12 @@  discard block
 block discarded – undo
2187 2187
  *     Pile complétée par le code à générer
2188 2188
  **/
2189 2189
 function balise_GET_dist($p) {
2190
-	$p->interdire_scripts = false; // le contenu vient de #SET, donc il est de confiance
2191
-	if (function_exists('balise_ENV')) {
2192
-		return balise_ENV($p, '$Pile["vars"]??[]');
2193
-	} else {
2194
-		return balise_ENV_dist($p, '$Pile["vars"]??[]');
2195
-	}
2190
+    $p->interdire_scripts = false; // le contenu vient de #SET, donc il est de confiance
2191
+    if (function_exists('balise_ENV')) {
2192
+        return balise_ENV($p, '$Pile["vars"]??[]');
2193
+    } else {
2194
+        return balise_ENV_dist($p, '$Pile["vars"]??[]');
2195
+    }
2196 2196
 }
2197 2197
 
2198 2198
 
@@ -2215,22 +2215,22 @@  discard block
 block discarded – undo
2215 2215
  *     Pile complétée par le code à générer
2216 2216
  **/
2217 2217
 function balise_DOUBLONS_dist($p) {
2218
-	if ($type = interprete_argument_balise(1, $p)) {
2219
-		if ($famille = interprete_argument_balise(2, $p)) {
2220
-			$type .= '.' . $famille;
2221
-		}
2222
-		$p->code = '(isset($doublons[' . $type . ']) ? $doublons[' . $type . '] : "")';
2223
-		if (!$p->etoile) {
2224
-			$p->code = 'array_filter(array_map("intval",explode(",",'
2225
-				. $p->code . ')))';
2226
-		}
2227
-	} else {
2228
-		$p->code = '$doublons';
2229
-	}
2218
+    if ($type = interprete_argument_balise(1, $p)) {
2219
+        if ($famille = interprete_argument_balise(2, $p)) {
2220
+            $type .= '.' . $famille;
2221
+        }
2222
+        $p->code = '(isset($doublons[' . $type . ']) ? $doublons[' . $type . '] : "")';
2223
+        if (!$p->etoile) {
2224
+            $p->code = 'array_filter(array_map("intval",explode(",",'
2225
+                . $p->code . ')))';
2226
+        }
2227
+    } else {
2228
+        $p->code = '$doublons';
2229
+    }
2230 2230
 
2231
-	$p->interdire_scripts = false;
2231
+    $p->interdire_scripts = false;
2232 2232
 
2233
-	return $p;
2233
+    return $p;
2234 2234
 }
2235 2235
 
2236 2236
 
@@ -2253,18 +2253,18 @@  discard block
 block discarded – undo
2253 2253
  *     Pile complétée par le code à générer
2254 2254
  **/
2255 2255
 function balise_PIPELINE_dist($p) {
2256
-	$_pipe = interprete_argument_balise(1, $p);
2257
-	if (!$_pipe) {
2258
-		$err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'PIPELINE']];
2259
-		erreur_squelette($err_b_s_a, $p);
2260
-	} else {
2261
-		$_flux = interprete_argument_balise(2, $p);
2262
-		$_flux = $_flux ?: "''";
2263
-		$p->code = "pipeline( $_pipe , $_flux )";
2264
-		$p->interdire_scripts = false;
2265
-	}
2256
+    $_pipe = interprete_argument_balise(1, $p);
2257
+    if (!$_pipe) {
2258
+        $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'PIPELINE']];
2259
+        erreur_squelette($err_b_s_a, $p);
2260
+    } else {
2261
+        $_flux = interprete_argument_balise(2, $p);
2262
+        $_flux = $_flux ?: "''";
2263
+        $p->code = "pipeline( $_pipe , $_flux )";
2264
+        $p->interdire_scripts = false;
2265
+    }
2266 2266
 
2267
-	return $p;
2267
+    return $p;
2268 2268
 }
2269 2269
 
2270 2270
 
@@ -2289,10 +2289,10 @@  discard block
 block discarded – undo
2289 2289
  *     Pile complétée par le code à générer
2290 2290
  **/
2291 2291
 function balise_EDIT_dist($p) {
2292
-	$p->code = "''";
2293
-	$p->interdire_scripts = false;
2292
+    $p->code = "''";
2293
+    $p->interdire_scripts = false;
2294 2294
 
2295
-	return $p;
2295
+    return $p;
2296 2296
 }
2297 2297
 
2298 2298
 
@@ -2315,11 +2315,11 @@  discard block
 block discarded – undo
2315 2315
  *     Pile complétée par le code à générer
2316 2316
  **/
2317 2317
 function balise_TOTAL_UNIQUE_dist($p) {
2318
-	$_famille = interprete_argument_balise(1, $p);
2319
-	$_famille = $_famille ?: "''";
2320
-	$p->code = "unique('', $_famille, true)";
2318
+    $_famille = interprete_argument_balise(1, $p);
2319
+    $_famille = $_famille ?: "''";
2320
+    $p->code = "unique('', $_famille, true)";
2321 2321
 
2322
-	return $p;
2322
+    return $p;
2323 2323
 }
2324 2324
 
2325 2325
 /**
@@ -2342,19 +2342,19 @@  discard block
 block discarded – undo
2342 2342
  *     Pile complétée par le code à générer
2343 2343
  **/
2344 2344
 function balise_ARRAY_dist($p) {
2345
-	$_code = [];
2346
-	$n = 1;
2347
-	do {
2348
-		$_key = interprete_argument_balise($n++, $p);
2349
-		$_val = interprete_argument_balise($n++, $p);
2350
-		if ($_key && $_val) {
2351
-			$_code[] = "$_key => $_val";
2352
-		}
2353
-	} while ($_key && $_val);
2354
-	$p->code = 'array(' . join(', ', $_code) . ')';
2355
-	$p->interdire_scripts = false;
2345
+    $_code = [];
2346
+    $n = 1;
2347
+    do {
2348
+        $_key = interprete_argument_balise($n++, $p);
2349
+        $_val = interprete_argument_balise($n++, $p);
2350
+        if ($_key && $_val) {
2351
+            $_code[] = "$_key => $_val";
2352
+        }
2353
+    } while ($_key && $_val);
2354
+    $p->code = 'array(' . join(', ', $_code) . ')';
2355
+    $p->interdire_scripts = false;
2356 2356
 
2357
-	return $p;
2357
+    return $p;
2358 2358
 }
2359 2359
 
2360 2360
 /**
@@ -2373,15 +2373,15 @@  discard block
 block discarded – undo
2373 2373
  *     Pile complétée par le code à générer
2374 2374
  */
2375 2375
 function balise_LISTE_dist($p) {
2376
-	$_code = [];
2377
-	$n = 1;
2378
-	while ($_val = interprete_argument_balise($n++, $p)) {
2379
-		$_code[] = $_val;
2380
-	}
2381
-	$p->code = 'array(' . join(', ', $_code) . ')';
2382
-	$p->interdire_scripts = false;
2376
+    $_code = [];
2377
+    $n = 1;
2378
+    while ($_val = interprete_argument_balise($n++, $p)) {
2379
+        $_code[] = $_val;
2380
+    }
2381
+    $p->code = 'array(' . join(', ', $_code) . ')';
2382
+    $p->interdire_scripts = false;
2383 2383
 
2384
-	return $p;
2384
+    return $p;
2385 2385
 }
2386 2386
 
2387 2387
 
@@ -2415,21 +2415,21 @@  discard block
 block discarded – undo
2415 2415
  *     Pile complétée par le code à générer
2416 2416
  **/
2417 2417
 function balise_AUTORISER_dist($p) {
2418
-	$_code = [];
2419
-	$p->descr['session'] = true; // faire un cache par session
2418
+    $_code = [];
2419
+    $p->descr['session'] = true; // faire un cache par session
2420 2420
 
2421
-	$n = 1;
2422
-	while ($_v = interprete_argument_balise($n++, $p)) {
2423
-		$_code[] = $_v;
2424
-	}
2421
+    $n = 1;
2422
+    while ($_v = interprete_argument_balise($n++, $p)) {
2423
+        $_code[] = $_v;
2424
+    }
2425 2425
 
2426
-	$p->code = '((function_exists("autoriser")||include_spip("inc/autoriser"))&&autoriser(' . join(
2427
-		', ',
2428
-		$_code
2429
-	) . ')?" ":"")';
2430
-	$p->interdire_scripts = false;
2426
+    $p->code = '((function_exists("autoriser")||include_spip("inc/autoriser"))&&autoriser(' . join(
2427
+        ', ',
2428
+        $_code
2429
+    ) . ')?" ":"")';
2430
+    $p->interdire_scripts = false;
2431 2431
 
2432
-	return $p;
2432
+    return $p;
2433 2433
 }
2434 2434
 
2435 2435
 
@@ -2453,15 +2453,15 @@  discard block
 block discarded – undo
2453 2453
  *     Pile complétée par le code à générer
2454 2454
  **/
2455 2455
 function balise_PLUGIN_dist($p) {
2456
-	$plugin = interprete_argument_balise(1, $p);
2457
-	$plugin = isset($plugin) ? str_replace('\'', '"', $plugin) : '""';
2458
-	$type_info = interprete_argument_balise(2, $p);
2459
-	$type_info = isset($type_info) ? str_replace('\'', '"', $type_info) : '"est_actif"';
2456
+    $plugin = interprete_argument_balise(1, $p);
2457
+    $plugin = isset($plugin) ? str_replace('\'', '"', $plugin) : '""';
2458
+    $type_info = interprete_argument_balise(2, $p);
2459
+    $type_info = isset($type_info) ? str_replace('\'', '"', $type_info) : '"est_actif"';
2460 2460
 
2461
-	$f = chercher_filtre('info_plugin');
2462
-	$p->code = $f . '(' . $plugin . ', ' . $type_info . ')';
2461
+    $f = chercher_filtre('info_plugin');
2462
+    $p->code = $f . '(' . $plugin . ', ' . $type_info . ')';
2463 2463
 
2464
-	return $p;
2464
+    return $p;
2465 2465
 }
2466 2466
 
2467 2467
 /**
@@ -2482,9 +2482,9 @@  discard block
 block discarded – undo
2482 2482
  *     Pile complétée par le code à générer
2483 2483
  **/
2484 2484
 function balise_AIDER_dist($p) {
2485
-	$_motif = interprete_argument_balise(1, $p);
2486
-	$p->code = "((\$aider=charger_fonction('aide','inc',true))?\$aider($_motif):'')";
2487
-	return $p;
2485
+    $_motif = interprete_argument_balise(1, $p);
2486
+    $p->code = "((\$aider=charger_fonction('aide','inc',true))?\$aider($_motif):'')";
2487
+    return $p;
2488 2488
 }
2489 2489
 
2490 2490
 /**
@@ -2510,16 +2510,16 @@  discard block
 block discarded – undo
2510 2510
  *     Pile complétée par le code à générer
2511 2511
  **/
2512 2512
 function balise_ACTION_FORMULAIRE($p) {
2513
-	if (!$_url = interprete_argument_balise(1, $p)) {
2514
-		$_url = "(\$Pile[0]['action'] ?? '')";
2515
-	}
2516
-	if (!$_form = interprete_argument_balise(2, $p)) {
2517
-		$_form = "(\$Pile[0]['form'] ?? '')";
2518
-	}
2519
-
2520
-	// envoyer le nom du formulaire que l'on traite
2521
-	// transmettre les eventuels args de la balise formulaire
2522
-	$p->code = "	'<span class=\"form-hidden\">' .
2513
+    if (!$_url = interprete_argument_balise(1, $p)) {
2514
+        $_url = "(\$Pile[0]['action'] ?? '')";
2515
+    }
2516
+    if (!$_form = interprete_argument_balise(2, $p)) {
2517
+        $_form = "(\$Pile[0]['form'] ?? '')";
2518
+    }
2519
+
2520
+    // envoyer le nom du formulaire que l'on traite
2521
+    // transmettre les eventuels args de la balise formulaire
2522
+    $p->code = "	'<span class=\"form-hidden\">' .
2523 2523
 	form_hidden($_url) .
2524 2524
 	'<input name=\'formulaire_action\' type=\'hidden\'
2525 2525
 		value=\'' . $_form . '\' />' .
@@ -2530,9 +2530,9 @@  discard block
 block discarded – undo
2530 2530
 	(\$Pile[0]['_hidden'] ?? '') .
2531 2531
 	'</span>'";
2532 2532
 
2533
-	$p->interdire_scripts = false;
2533
+    $p->interdire_scripts = false;
2534 2534
 
2535
-	return $p;
2535
+    return $p;
2536 2536
 }
2537 2537
 
2538 2538
 
@@ -2573,25 +2573,25 @@  discard block
 block discarded – undo
2573 2573
  */
2574 2574
 function balise_BOUTON_ACTION_dist($p) {
2575 2575
 
2576
-	$args = [];
2577
-	for ($k = 1; $k <= 6; $k++) {
2578
-		$_a = interprete_argument_balise($k, $p);
2579
-		if (!$_a) {
2580
-			$_a = "''";
2581
-		}
2582
-		$args[] = $_a;
2583
-	}
2584
-	// supprimer les args vides
2585
-	while (end($args) == "''" && count($args) > 2) {
2586
-		array_pop($args);
2587
-	}
2588
-	$args = implode(',', $args);
2576
+    $args = [];
2577
+    for ($k = 1; $k <= 6; $k++) {
2578
+        $_a = interprete_argument_balise($k, $p);
2579
+        if (!$_a) {
2580
+            $_a = "''";
2581
+        }
2582
+        $args[] = $_a;
2583
+    }
2584
+    // supprimer les args vides
2585
+    while (end($args) == "''" && count($args) > 2) {
2586
+        array_pop($args);
2587
+    }
2588
+    $args = implode(',', $args);
2589 2589
 
2590
-	$bouton_action = chercher_filtre('bouton_action');
2591
-	$p->code = "$bouton_action($args)";
2592
-	$p->interdire_scripts = false;
2590
+    $bouton_action = chercher_filtre('bouton_action');
2591
+    $p->code = "$bouton_action($args)";
2592
+    $p->interdire_scripts = false;
2593 2593
 
2594
-	return $p;
2594
+    return $p;
2595 2595
 }
2596 2596
 
2597 2597
 
@@ -2610,10 +2610,10 @@  discard block
 block discarded – undo
2610 2610
  *     Pile complétée par le code à générer
2611 2611
  */
2612 2612
 function balise_SLOGAN_SITE_SPIP_dist($p) {
2613
-	$p->code = "\$GLOBALS['meta']['slogan_site']";
2613
+    $p->code = "\$GLOBALS['meta']['slogan_site']";
2614 2614
 
2615
-	#$p->interdire_scripts = true;
2616
-	return $p;
2615
+    #$p->interdire_scripts = true;
2616
+    return $p;
2617 2617
 }
2618 2618
 
2619 2619
 
@@ -2637,10 +2637,10 @@  discard block
 block discarded – undo
2637 2637
  *     Pile complétée par le code à générer
2638 2638
  */
2639 2639
 function balise_HTML5_dist($p) {
2640
-	$p->code = html5_permis() ? "' '" : "''";
2641
-	$p->interdire_scripts = false;
2640
+    $p->code = html5_permis() ? "' '" : "''";
2641
+    $p->interdire_scripts = false;
2642 2642
 
2643
-	return $p;
2643
+    return $p;
2644 2644
 }
2645 2645
 
2646 2646
 
@@ -2666,60 +2666,60 @@  discard block
 block discarded – undo
2666 2666
  *     Pile complétée par le code à générer
2667 2667
  */
2668 2668
 function balise_TRI_dist($p, $liste = 'true') {
2669
-	$b = index_boucle_mere($p);
2670
-	// s'il n'y a pas de nom de boucle, on ne peut pas trier
2671
-	if ($b === '') {
2672
-		$msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]];
2673
-		erreur_squelette($msg, $p);
2674
-		$p->code = "''";
2669
+    $b = index_boucle_mere($p);
2670
+    // s'il n'y a pas de nom de boucle, on ne peut pas trier
2671
+    if ($b === '') {
2672
+        $msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]];
2673
+        erreur_squelette($msg, $p);
2674
+        $p->code = "''";
2675 2675
 
2676
-		return $p;
2677
-	}
2678
-	$boucle = $p->boucles[$b];
2676
+        return $p;
2677
+    }
2678
+    $boucle = $p->boucles[$b];
2679 2679
 
2680
-	// s'il n'y a pas de tri_champ, c'est qu'on se trouve
2681
-	// dans un boucle recursive ou qu'on a oublie le critere {tri}
2682
-	if (!isset($boucle->modificateur['tri_champ'])) {
2683
-		$msg = ['zbug_champ_hors_critere', [
2684
-			'champ' => zbug_presenter_champ($p),
2685
-			'critere' => 'tri'
2686
-		]];
2687
-		erreur_squelette($msg, $p);
2688
-		$p->code = "''";
2680
+    // s'il n'y a pas de tri_champ, c'est qu'on se trouve
2681
+    // dans un boucle recursive ou qu'on a oublie le critere {tri}
2682
+    if (!isset($boucle->modificateur['tri_champ'])) {
2683
+        $msg = ['zbug_champ_hors_critere', [
2684
+            'champ' => zbug_presenter_champ($p),
2685
+            'critere' => 'tri'
2686
+        ]];
2687
+        erreur_squelette($msg, $p);
2688
+        $p->code = "''";
2689 2689
 
2690
-		return $p;
2691
-	}
2690
+        return $p;
2691
+    }
2692 2692
 
2693
-	// Différentes infos relatives au tri présentes dans les modificateurs
2694
-	$_tri_nom = $boucle->modificateur['tri_nom'] ; // nom du paramètre définissant le tri
2695
-	$_tri_champ = $boucle->modificateur['tri_champ']; // champ actuel utilisé le tri
2696
-	$_tri_sens = $boucle->modificateur['tri_sens']; // sens de tri actuel
2697
-	$_tri_liste_sens_defaut = $boucle->modificateur['tri_liste_sens_defaut']; // sens par défaut pour chaque champ
2693
+    // Différentes infos relatives au tri présentes dans les modificateurs
2694
+    $_tri_nom = $boucle->modificateur['tri_nom'] ; // nom du paramètre définissant le tri
2695
+    $_tri_champ = $boucle->modificateur['tri_champ']; // champ actuel utilisé le tri
2696
+    $_tri_sens = $boucle->modificateur['tri_sens']; // sens de tri actuel
2697
+    $_tri_liste_sens_defaut = $boucle->modificateur['tri_liste_sens_defaut']; // sens par défaut pour chaque champ
2698 2698
 
2699
-	$_champ_ou_sens = interprete_argument_balise(1, $p);
2700
-	// si pas de champ, renvoyer le critère de tri actuel
2701
-	if (!$_champ_ou_sens) {
2702
-		$p->code = $_tri_champ;
2699
+    $_champ_ou_sens = interprete_argument_balise(1, $p);
2700
+    // si pas de champ, renvoyer le critère de tri actuel
2701
+    if (!$_champ_ou_sens) {
2702
+        $p->code = $_tri_champ;
2703 2703
 
2704
-		return $p;
2705
-	}
2706
-	// forcer la jointure si besoin, et si le champ est statique
2707
-	if (preg_match(",^'([\w.]+)'$,i", $_champ_ou_sens, $m)) {
2708
-		index_pile($b, $m[1], $p->boucles, '', null, true, false);
2709
-	}
2704
+        return $p;
2705
+    }
2706
+    // forcer la jointure si besoin, et si le champ est statique
2707
+    if (preg_match(",^'([\w.]+)'$,i", $_champ_ou_sens, $m)) {
2708
+        index_pile($b, $m[1], $p->boucles, '', null, true, false);
2709
+    }
2710 2710
 
2711
-	$_libelle = interprete_argument_balise(2, $p);
2712
-	$_libelle = $_libelle ?: $_champ_ou_sens;
2711
+    $_libelle = interprete_argument_balise(2, $p);
2712
+    $_libelle = $_libelle ?: $_champ_ou_sens;
2713 2713
 
2714
-	$_class = interprete_argument_balise(3, $p) ?? "''";
2714
+    $_class = interprete_argument_balise(3, $p) ?? "''";
2715 2715
 
2716
-	$nom_pagination = $boucle->modificateur['debut_nom'] ?? '';
2716
+    $nom_pagination = $boucle->modificateur['debut_nom'] ?? '';
2717 2717
 
2718
-	$p->code = "calculer_balise_tri($_champ_ou_sens, $_libelle, $_class, $_tri_nom, $_tri_champ, $_tri_sens, $_tri_liste_sens_defaut, $nom_pagination)";
2718
+    $p->code = "calculer_balise_tri($_champ_ou_sens, $_libelle, $_class, $_tri_nom, $_tri_champ, $_tri_sens, $_tri_liste_sens_defaut, $nom_pagination)";
2719 2719
 
2720
-	$p->interdire_scripts = false;
2720
+    $p->interdire_scripts = false;
2721 2721
 
2722
-	return $p;
2722
+    return $p;
2723 2723
 }
2724 2724
 
2725 2725
 
@@ -2740,21 +2740,21 @@  discard block
 block discarded – undo
2740 2740
  *     Pile complétée par le code à générer
2741 2741
  */
2742 2742
 function balise_SAUTER_dist($p) {
2743
-	$id_boucle = $p->id_boucle;
2743
+    $id_boucle = $p->id_boucle;
2744 2744
 
2745
-	if (empty($p->boucles[$id_boucle])) {
2746
-		$msg = ['zbug_champ_hors_boucle', ['champ' => '#SAUTER']];
2747
-		erreur_squelette($msg, $p);
2748
-	} else {
2749
-		$_saut = interprete_argument_balise(1, $p);
2750
-		$_compteur = "\$Numrows['$id_boucle']['compteur_boucle']";
2751
-		$_total = "(\$Numrows['$id_boucle']['total'] ?? null)";
2745
+    if (empty($p->boucles[$id_boucle])) {
2746
+        $msg = ['zbug_champ_hors_boucle', ['champ' => '#SAUTER']];
2747
+        erreur_squelette($msg, $p);
2748
+    } else {
2749
+        $_saut = interprete_argument_balise(1, $p);
2750
+        $_compteur = "\$Numrows['$id_boucle']['compteur_boucle']";
2751
+        $_total = "(\$Numrows['$id_boucle']['total'] ?? null)";
2752 2752
 
2753
-		$p->code = "vide($_compteur=\$iter->skip($_saut,$_total))";
2754
-	}
2755
-	$p->interdire_scripts = false;
2753
+        $p->code = "vide($_compteur=\$iter->skip($_saut,$_total))";
2754
+    }
2755
+    $p->interdire_scripts = false;
2756 2756
 
2757
-	return $p;
2757
+    return $p;
2758 2758
 }
2759 2759
 
2760 2760
 
@@ -2776,22 +2776,22 @@  discard block
 block discarded – undo
2776 2776
  *     Pile complétée par le code à générer
2777 2777
  */
2778 2778
 function balise_PUBLIE_dist($p) {
2779
-	if (!$_type = interprete_argument_balise(1, $p)) {
2780
-		$_type = _q($p->type_requete);
2781
-		$_id = champ_sql($p->boucles[$p->id_boucle]->primary, $p);
2782
-	} else {
2783
-		$_id = interprete_argument_balise(2, $p);
2784
-	}
2779
+    if (!$_type = interprete_argument_balise(1, $p)) {
2780
+        $_type = _q($p->type_requete);
2781
+        $_id = champ_sql($p->boucles[$p->id_boucle]->primary, $p);
2782
+    } else {
2783
+        $_id = interprete_argument_balise(2, $p);
2784
+    }
2785 2785
 
2786
-	$connect = '';
2787
-	if (isset($p->boucles[$p->id_boucle])) {
2788
-		$connect = $p->boucles[$p->id_boucle]->sql_serveur;
2789
-	}
2786
+    $connect = '';
2787
+    if (isset($p->boucles[$p->id_boucle])) {
2788
+        $connect = $p->boucles[$p->id_boucle]->sql_serveur;
2789
+    }
2790 2790
 
2791
-	$p->code = '(objet_test_si_publie(' . $_type . ',intval(' . $_id . '),' . _q($connect) . ")?' ':'')";
2792
-	$p->interdire_scripts = false;
2791
+    $p->code = '(objet_test_si_publie(' . $_type . ',intval(' . $_id . '),' . _q($connect) . ")?' ':'')";
2792
+    $p->interdire_scripts = false;
2793 2793
 
2794
-	return $p;
2794
+    return $p;
2795 2795
 }
2796 2796
 
2797 2797
 /**
@@ -2820,12 +2820,12 @@  discard block
 block discarded – undo
2820 2820
  *     Pile complétée par le code à générer
2821 2821
  */
2822 2822
 function balise_PRODUIRE_dist($p) {
2823
-	$balise_inclure = charger_fonction('INCLURE', 'balise');
2824
-	$p = $balise_inclure($p);
2823
+    $balise_inclure = charger_fonction('INCLURE', 'balise');
2824
+    $p = $balise_inclure($p);
2825 2825
 
2826
-	$p->code = str_replace('recuperer_fond(', 'produire_fond_statique(', $p->code);
2826
+    $p->code = str_replace('recuperer_fond(', 'produire_fond_statique(', $p->code);
2827 2827
 
2828
-	return $p;
2828
+    return $p;
2829 2829
 }
2830 2830
 
2831 2831
 /**
@@ -2844,13 +2844,13 @@  discard block
 block discarded – undo
2844 2844
  *     Pile complétée par le code à générer
2845 2845
  */
2846 2846
 function balise_LARGEUR_ECRAN_dist($p) {
2847
-	$_class = interprete_argument_balise(1, $p);
2848
-	if (!$_class) {
2849
-		$_class = 'null';
2850
-	}
2851
-	$p->code = "(is_string($_class)?vide(\$GLOBALS['largeur_ecran']=$_class):(isset(\$GLOBALS['largeur_ecran'])?\$GLOBALS['largeur_ecran']:''))";
2847
+    $_class = interprete_argument_balise(1, $p);
2848
+    if (!$_class) {
2849
+        $_class = 'null';
2850
+    }
2851
+    $p->code = "(is_string($_class)?vide(\$GLOBALS['largeur_ecran']=$_class):(isset(\$GLOBALS['largeur_ecran'])?\$GLOBALS['largeur_ecran']:''))";
2852 2852
 
2853
-	return $p;
2853
+    return $p;
2854 2854
 }
2855 2855
 
2856 2856
 
@@ -2866,14 +2866,14 @@  discard block
 block discarded – undo
2866 2866
  *     Pile complétée par le code à générer
2867 2867
  **/
2868 2868
 function balise_CONST_dist($p) {
2869
-	$_const = interprete_argument_balise(1, $p);
2870
-	if (!strlen($_const ?? '')) {
2871
-		$p->code = "''";
2872
-	}
2873
-	else {
2874
-		$p->code = "(defined($_const)?constant($_const):'')";
2875
-	}
2876
-	$p->interdire_scripts = false;
2877
-
2878
-	return $p;
2869
+    $_const = interprete_argument_balise(1, $p);
2870
+    if (!strlen($_const ?? '')) {
2871
+        $p->code = "''";
2872
+    }
2873
+    else {
2874
+        $p->code = "(defined($_const)?constant($_const):'')";
2875
+    }
2876
+    $p->interdire_scripts = false;
2877
+
2878
+    return $p;
2879 2879
 }
Please login to merge, or discard this patch.
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
  */
358 358
 function balise_DOSSIER_SQUELETTE_dist($p) {
359 359
 	$code = substr(addslashes(dirname($p->descr['sourcefile'])), strlen(_DIR_RACINE));
360
-	$p->code = "_DIR_RACINE . '$code'" .
360
+	$p->code = "_DIR_RACINE . '$code'".
361 361
 		$p->interdire_scripts = false;
362 362
 
363 363
 	return $p;
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
  */
377 377
 function balise_SQUELETTE_dist($p) {
378 378
 	$code = addslashes($p->descr['sourcefile']);
379
-	$p->code = "'$code'" .
379
+	$p->code = "'$code'".
380 380
 		$p->interdire_scripts = false;
381 381
 
382 382
 	return $p;
@@ -428,9 +428,9 @@  discard block
 block discarded – undo
428 428
  **/
429 429
 function balise_NOM_SITE_dist($p) {
430 430
 	if (!$p->etoile) {
431
-		$p->code = 'supprimer_numero(calculer_url(' .
432
-			champ_sql('url_site', $p) . ',' .
433
-			champ_sql('nom_site', $p) .
431
+		$p->code = 'supprimer_numero(calculer_url('.
432
+			champ_sql('url_site', $p).','.
433
+			champ_sql('nom_site', $p).
434 434
 			", 'titre', \$connect, false))";
435 435
 	} else {
436 436
 		$p->code = champ_sql('nom_site', $p);
@@ -582,8 +582,8 @@  discard block
 block discarded – undo
582 582
  *     Pile complétée par le code à générer
583 583
  **/
584 584
 function balise_POPULARITE_ABSOLUE_dist($p) {
585
-	$p->code = 'ceil(' .
586
-		champ_sql('popularite', $p) .
585
+	$p->code = 'ceil('.
586
+		champ_sql('popularite', $p).
587 587
 		')';
588 588
 	$p->interdire_scripts = false;
589 589
 
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 	$p->code = index_pile($p->id_boucle, 'valeur', $p->boucles, $b);
665 665
 ;
666 666
 	if (($v = interprete_argument_balise(1, $p)) !== null) {
667
-		$p->code = 'table_valeur(' . $p->code . ', ' . $v . ')';
667
+		$p->code = 'table_valeur('.$p->code.', '.$v.')';
668 668
 	}
669 669
 	$p->interdire_scripts = true;
670 670
 
@@ -804,16 +804,16 @@  discard block
 block discarded – undo
804 804
 	$trouver_table = charger_fonction('trouver_table', 'base');
805 805
 	if ($desc = $trouver_table(table_objet_sql($type_objet))) {
806 806
 		if (isset($desc['field']['descriptif'])) {
807
-			$_ligne .= "'descriptif' => " . champ_sql('descriptif', $p) . ',';
807
+			$_ligne .= "'descriptif' => ".champ_sql('descriptif', $p).',';
808 808
 		}
809 809
 		if (isset($desc['field']['texte'])) {
810
-			$_ligne .= "'texte' => " . champ_sql('texte', $p) . ',';
810
+			$_ligne .= "'texte' => ".champ_sql('texte', $p).',';
811 811
 		}
812 812
 		if (isset($desc['field']['chapo'])) {
813
-			$_ligne .= "'chapo' => " . champ_sql('chapo', $p) . ',';
813
+			$_ligne .= "'chapo' => ".champ_sql('chapo', $p).',';
814 814
 		}
815 815
 		if (isset($desc['introduction_longueur'])) {
816
-			$_introduction_longueur = "'" . $desc['introduction_longueur'] . "'";
816
+			$_introduction_longueur = "'".$desc['introduction_longueur']."'";
817 817
 		}
818 818
 	}
819 819
 	$_ligne .= ')';
@@ -909,10 +909,10 @@  discard block
 block discarded – undo
909 909
 		$p->code = sprintf(
910 910
 			CODE_RECUPERER_FOND,
911 911
 			"'modeles/lesauteurs'",
912
-			"array('objet'=>'" . $objet .
913
-			"','id_objet' => " . champ_sql($id_table_objet, $p) .
914
-			",'$id_table_objet' => " . champ_sql($id_table_objet, $p) .
915
-			($objet == 'article' ? '' : ",'id_article' => " . champ_sql('id_article', $p)) .
912
+			"array('objet'=>'".$objet.
913
+			"','id_objet' => ".champ_sql($id_table_objet, $p).
914
+			",'$id_table_objet' => ".champ_sql($id_table_objet, $p).
915
+			($objet == 'article' ? '' : ",'id_article' => ".champ_sql('id_article', $p)).
916 916
 			')',
917 917
 			"'trim'=>true, 'compil'=>array($c)",
918 918
 			_q($connect)
@@ -981,7 +981,7 @@  discard block
 block discarded – undo
981 981
 					$m = trim($m);
982 982
 					if ($m != "''") {
983 983
 						if (!preg_match(',\W,', $m)) {
984
-							$m = $boucle->id_table . ".$m";
984
+							$m = $boucle->id_table.".$m";
985 985
 						}
986 986
 
987 987
 						$m .= ' AS titre_rang';
@@ -1142,7 +1142,7 @@  discard block
 block discarded – undo
1142 1142
 	$f_pagination = chercher_filtre('pagination');
1143 1143
 	$type = $p->boucles[$b]->modificateur['debut_nom'];
1144 1144
 	$modif = ($type[0] !== "'") ? "'debut'.$type"
1145
-		: ("'debut" . substr($type, 1));
1145
+		: ("'debut".substr($type, 1));
1146 1146
 
1147 1147
 	$p->code = sprintf(
1148 1148
 		CODE_PAGINATION,
@@ -1285,7 +1285,7 @@  discard block
 block discarded – undo
1285 1285
 		$msg = ['zbug_balise_sans_argument', ['balise' => ' CHEMIN']];
1286 1286
 		erreur_squelette($msg, $p);
1287 1287
 	} else {
1288
-		$p->code = 'find_in_path((string)' . $arg . ')';
1288
+		$p->code = 'find_in_path((string)'.$arg.')';
1289 1289
 	}
1290 1290
 
1291 1291
 	$p->interdire_scripts = false;
@@ -1320,7 +1320,7 @@  discard block
 block discarded – undo
1320 1320
 		$msg = ['zbug_balise_sans_argument', ['balise' => ' CHEMIN_IMAGE']];
1321 1321
 		erreur_squelette($msg, $p);
1322 1322
 	} else {
1323
-		$p->code = 'chemin_image((string)' . $arg . ')';
1323
+		$p->code = 'chemin_image((string)'.$arg.')';
1324 1324
 	}
1325 1325
 
1326 1326
 	$p->interdire_scripts = false;
@@ -1374,7 +1374,7 @@  discard block
 block discarded – undo
1374 1374
 		// cas de #ENV sans argument : on retourne le serialize() du tableau
1375 1375
 		// une belle fonction [(#ENV|affiche_env)] serait pratique
1376 1376
 		if ($src) {
1377
-			$p->code = '(is_array($a = (' . $src . ')) ? serialize($a) : "")';
1377
+			$p->code = '(is_array($a = ('.$src.')) ? serialize($a) : "")';
1378 1378
 		} else {
1379 1379
 			$p->code = 'serialize($Pile[0]??[])';
1380 1380
 		}
@@ -1427,8 +1427,8 @@  discard block
 block discarded – undo
1427 1427
 	$_sinon = interprete_argument_balise(2, $p);
1428 1428
 	$_unserialize = sinon(interprete_argument_balise(3, $p), 'false');
1429 1429
 
1430
-	$p->code = '(include_spip(\'inc/config\')?lire_config(' . $arg . ',' .
1431
-		($_sinon && $_sinon != "''" ? $_sinon : 'null') . ',' . $_unserialize . "):'')";
1430
+	$p->code = '(include_spip(\'inc/config\')?lire_config('.$arg.','.
1431
+		($_sinon && $_sinon != "''" ? $_sinon : 'null').','.$_unserialize."):'')";
1432 1432
 
1433 1433
 	return $p;
1434 1434
 }
@@ -1521,7 +1521,7 @@  discard block
 block discarded – undo
1521 1521
 		$err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'SESSION_SET']];
1522 1522
 		erreur_squelette($err_b_s_a, $p);
1523 1523
 	} else {
1524
-		$p->code = '(include_spip("inc/session") AND session_set(' . $_nom . ',' . $_val . '))';
1524
+		$p->code = '(include_spip("inc/session") AND session_set('.$_nom.','.$_val.'))';
1525 1525
 	}
1526 1526
 
1527 1527
 	$p->interdire_scripts = false;
@@ -1569,7 +1569,7 @@  discard block
 block discarded – undo
1569 1569
 			)
1570 1570
 		) {
1571 1571
 			$p->code = /* $r[1]. */
1572
-				'(' . $r[2] . ')';
1572
+				'('.$r[2].')';
1573 1573
 		} else {
1574 1574
 			$p->code = "eval('return '.$php.';')";
1575 1575
 		}
@@ -1815,9 +1815,9 @@  discard block
 block discarded – undo
1815 1815
 
1816 1816
 		// noter la duree du cache dans un entete proprietaire
1817 1817
 
1818
-		$code = "'<'.'" . '?php header("X-Spip-Cache: '
1818
+		$code = "'<'.'".'?php header("X-Spip-Cache: '
1819 1819
 			. $duree
1820
-			. '"); ?' . "'.'>'";
1820
+			. '"); ?'."'.'>'";
1821 1821
 
1822 1822
 		// Remplir le header Cache-Control
1823 1823
 		// cas #CACHE{0}
@@ -1838,9 +1838,9 @@  discard block
 block discarded – undo
1838 1838
 				$pa == 'cache-client'
1839 1839
 				&& $duree > 0
1840 1840
 			) {
1841
-				$code .= ".'<'.'" . '?php header("Cache-Control: max-age='
1841
+				$code .= ".'<'.'".'?php header("Cache-Control: max-age='
1842 1842
 					. $duree
1843
-					. '"); ?' . "'.'>'";
1843
+					. '"); ?'."'.'>'";
1844 1844
 				// il semble logique, si on cache-client, de ne pas invalider
1845 1845
 				$pa = 'statique';
1846 1846
 			}
@@ -1849,7 +1849,7 @@  discard block
 block discarded – undo
1849 1849
 				$pa == 'statique'
1850 1850
 				&& $duree > 0
1851 1851
 			) {
1852
-				$code .= ".'<'.'" . '?php header("X-Spip-Statique: oui"); ?' . "'.'>'";
1852
+				$code .= ".'<'.'".'?php header("X-Spip-Statique: oui"); ?'."'.'>'";
1853 1853
 			}
1854 1854
 		}
1855 1855
 	} else {
@@ -2013,9 +2013,9 @@  discard block
 block discarded – undo
2013 2013
 		if ($p->etoile) {
2014 2014
 			$_options[] = "'etoile'=>true";
2015 2015
 		}
2016
-		$_options[] = "'compil'=>array(" . memoriser_contexte_compil($p) . ')';
2016
+		$_options[] = "'compil'=>array(".memoriser_contexte_compil($p).')';
2017 2017
 
2018
-		$_l = 'array(' . join(",\n\t", $_contexte) . ')';
2018
+		$_l = 'array('.join(",\n\t", $_contexte).')';
2019 2019
 		if ($flag_env) {
2020 2020
 			$_l = "array_merge(\$Pile[0],$_l)";
2021 2021
 		}
@@ -2025,7 +2025,7 @@  discard block
 block discarded – undo
2025 2025
 		$msg = ['zbug_balise_sans_argument', ['balise' => ' INCLURE']];
2026 2026
 		erreur_squelette($msg, $p);
2027 2027
 	} else {
2028
-		$p->code = 'charge_scripts(' . $_contexte[1] . ',false)';
2028
+		$p->code = 'charge_scripts('.$_contexte[1].',false)';
2029 2029
 	}
2030 2030
 
2031 2031
 	$p->interdire_scripts = false; // la securite est assuree par recuperer_fond
@@ -2073,7 +2073,7 @@  discard block
 block discarded – undo
2073 2073
 		unset($_contexte[1]);
2074 2074
 
2075 2075
 		if (preg_match("/^\s*'[^']*'/s", $nom)) {
2076
-			$nom = "'modeles/" . substr($nom, 1);
2076
+			$nom = "'modeles/".substr($nom, 1);
2077 2077
 		} else {
2078 2078
 			$nom = "'modeles/' . $nom";
2079 2079
 		}
@@ -2090,8 +2090,8 @@  discard block
 block discarded – undo
2090 2090
 			$primary = $p->boucles[$p->id_boucle]->primary;
2091 2091
 			if (!strpos($primary, ',')) {
2092 2092
 				$id = champ_sql($primary, $p);
2093
-				$_contexte[] = "'$primary'=>" . $id;
2094
-				$_contexte[] = "'id'=>" . $id;
2093
+				$_contexte[] = "'$primary'=>".$id;
2094
+				$_contexte[] = "'id'=>".$id;
2095 2095
 			}
2096 2096
 		}
2097 2097
 		$_contexte[] = "'recurs'=>(++\$recurs)";
@@ -2103,11 +2103,11 @@  discard block
 block discarded – undo
2103 2103
 		$_options = memoriser_contexte_compil($p);
2104 2104
 		$_options = "'compil'=>array($_options), 'trim'=>true";
2105 2105
 		if (isset($_contexte['ajax'])) {
2106
-			$_options .= ', ' . preg_replace(',=>(.*)$,ims', '=> ($v=(\\1))?$v:true', $_contexte['ajax']);
2106
+			$_options .= ', '.preg_replace(',=>(.*)$,ims', '=> ($v=(\\1))?$v:true', $_contexte['ajax']);
2107 2107
 			unset($_contexte['ajax']);
2108 2108
 		}
2109 2109
 
2110
-		$_l = 'array(' . join(",\n\t", $_contexte) . ')';
2110
+		$_l = 'array('.join(",\n\t", $_contexte).')';
2111 2111
 		if ($flag_env) {
2112 2112
 			$_l = "array_merge(\$Pile[0],$_l)";
2113 2113
 		}
@@ -2217,12 +2217,12 @@  discard block
 block discarded – undo
2217 2217
 function balise_DOUBLONS_dist($p) {
2218 2218
 	if ($type = interprete_argument_balise(1, $p)) {
2219 2219
 		if ($famille = interprete_argument_balise(2, $p)) {
2220
-			$type .= '.' . $famille;
2220
+			$type .= '.'.$famille;
2221 2221
 		}
2222
-		$p->code = '(isset($doublons[' . $type . ']) ? $doublons[' . $type . '] : "")';
2222
+		$p->code = '(isset($doublons['.$type.']) ? $doublons['.$type.'] : "")';
2223 2223
 		if (!$p->etoile) {
2224 2224
 			$p->code = 'array_filter(array_map("intval",explode(",",'
2225
-				. $p->code . ')))';
2225
+				. $p->code.')))';
2226 2226
 		}
2227 2227
 	} else {
2228 2228
 		$p->code = '$doublons';
@@ -2351,7 +2351,7 @@  discard block
 block discarded – undo
2351 2351
 			$_code[] = "$_key => $_val";
2352 2352
 		}
2353 2353
 	} while ($_key && $_val);
2354
-	$p->code = 'array(' . join(', ', $_code) . ')';
2354
+	$p->code = 'array('.join(', ', $_code).')';
2355 2355
 	$p->interdire_scripts = false;
2356 2356
 
2357 2357
 	return $p;
@@ -2378,7 +2378,7 @@  discard block
 block discarded – undo
2378 2378
 	while ($_val = interprete_argument_balise($n++, $p)) {
2379 2379
 		$_code[] = $_val;
2380 2380
 	}
2381
-	$p->code = 'array(' . join(', ', $_code) . ')';
2381
+	$p->code = 'array('.join(', ', $_code).')';
2382 2382
 	$p->interdire_scripts = false;
2383 2383
 
2384 2384
 	return $p;
@@ -2423,10 +2423,10 @@  discard block
 block discarded – undo
2423 2423
 		$_code[] = $_v;
2424 2424
 	}
2425 2425
 
2426
-	$p->code = '((function_exists("autoriser")||include_spip("inc/autoriser"))&&autoriser(' . join(
2426
+	$p->code = '((function_exists("autoriser")||include_spip("inc/autoriser"))&&autoriser('.join(
2427 2427
 		', ',
2428 2428
 		$_code
2429
-	) . ')?" ":"")';
2429
+	).')?" ":"")';
2430 2430
 	$p->interdire_scripts = false;
2431 2431
 
2432 2432
 	return $p;
@@ -2459,7 +2459,7 @@  discard block
 block discarded – undo
2459 2459
 	$type_info = isset($type_info) ? str_replace('\'', '"', $type_info) : '"est_actif"';
2460 2460
 
2461 2461
 	$f = chercher_filtre('info_plugin');
2462
-	$p->code = $f . '(' . $plugin . ', ' . $type_info . ')';
2462
+	$p->code = $f.'('.$plugin.', '.$type_info.')';
2463 2463
 
2464 2464
 	return $p;
2465 2465
 }
@@ -2691,7 +2691,7 @@  discard block
 block discarded – undo
2691 2691
 	}
2692 2692
 
2693 2693
 	// Différentes infos relatives au tri présentes dans les modificateurs
2694
-	$_tri_nom = $boucle->modificateur['tri_nom'] ; // nom du paramètre définissant le tri
2694
+	$_tri_nom = $boucle->modificateur['tri_nom']; // nom du paramètre définissant le tri
2695 2695
 	$_tri_champ = $boucle->modificateur['tri_champ']; // champ actuel utilisé le tri
2696 2696
 	$_tri_sens = $boucle->modificateur['tri_sens']; // sens de tri actuel
2697 2697
 	$_tri_liste_sens_defaut = $boucle->modificateur['tri_liste_sens_defaut']; // sens par défaut pour chaque champ
@@ -2788,7 +2788,7 @@  discard block
 block discarded – undo
2788 2788
 		$connect = $p->boucles[$p->id_boucle]->sql_serveur;
2789 2789
 	}
2790 2790
 
2791
-	$p->code = '(objet_test_si_publie(' . $_type . ',intval(' . $_id . '),' . _q($connect) . ")?' ':'')";
2791
+	$p->code = '(objet_test_si_publie('.$_type.',intval('.$_id.'),'._q($connect).")?' ':'')";
2792 2792
 	$p->interdire_scripts = false;
2793 2793
 
2794 2794
 	return $p;
Please login to merge, or discard this patch.
ecrire/charsets/translit.php 1 patch
Indentation   +358 added lines, -358 removed lines patch added patch discarded remove patch
@@ -9,384 +9,384 @@
 block discarded – undo
9 9
 
10 10
 $GLOBALS['CHARSET']['translit'] = [
11 11
 // latin [fausse plage]
12
-	128 => 'EUR',
13
-	131 => 'f',
14
-	140 => 'OE',
15
-	147 => '\'\'',
16
-	148 => '\'\'',
17
-	153 => '(TM)',
18
-	156 => 'oe',
19
-	159 => 'Y',
12
+    128 => 'EUR',
13
+    131 => 'f',
14
+    140 => 'OE',
15
+    147 => '\'\'',
16
+    148 => '\'\'',
17
+    153 => '(TM)',
18
+    156 => 'oe',
19
+    159 => 'Y',
20 20
 
21 21
 // latin [legal]
22
-	160 => ' ',
23
-	161 => '!',
24
-	162 => 'c',
25
-	163 => 'L',
26
-	164 => 'O',
27
-	165 => 'yen',
28
-	166 => '|',
29
-	167 => 'p',
30
-	169 => '(c)',
31
-	171 => '<<',
32
-	172 => '-',
33
-	173 => '-',
34
-	174 => '(R)',
35
-	176 => 'o',
36
-	177 => '+-',
37
-	181 => 'mu',
38
-	182 => 'p',
39
-	183 => '.',
40
-	186 => 'o ',
41
-	187 => '>>',
42
-	191 => '?',
43
-	192 => 'A',
44
-	193 => 'A',
45
-	194 => 'A',
46
-	195 => 'A',
47
-	196 => 'A',
48
-	197 => 'A',
49
-	198 => 'AE',
50
-	199 => 'C',
51
-	200 => 'E',
52
-	201 => 'E',
53
-	202 => 'E',
54
-	203 => 'E',
55
-	204 => 'I',
56
-	205 => 'I',
57
-	206 => 'I',
58
-	207 => 'I',
59
-	209 => 'N',
60
-	210 => 'O',
61
-	211 => 'O',
62
-	212 => 'O',
63
-	213 => 'O',
64
-	214 => 'O',
65
-	216 => 'O',
66
-	217 => 'U',
67
-	218 => 'U',
68
-	219 => 'U',
69
-	220 => 'U',
70
-	223 => 'ss',
71
-	224 => 'a',
72
-	225 => 'a',
73
-	226 => 'a',
74
-	227 => 'a',
75
-	228 => 'a',
76
-	229 => 'a',
77
-	230 => 'ae',
78
-	231 => 'c',
79
-	232 => 'e',
80
-	233 => 'e',
81
-	234 => 'e',
82
-	235 => 'e',
83
-	236 => 'i',
84
-	237 => 'i',
85
-	238 => 'i',
86
-	239 => 'i',
87
-	241 => 'n',
88
-	242 => 'o',
89
-	243 => 'o',
90
-	244 => 'o',
91
-	245 => 'o',
92
-	246 => 'o',
93
-	248 => 'o',
94
-	249 => 'u',
95
-	250 => 'u',
96
-	251 => 'u',
97
-	252 => 'u',
98
-	255 => 'y',
22
+    160 => ' ',
23
+    161 => '!',
24
+    162 => 'c',
25
+    163 => 'L',
26
+    164 => 'O',
27
+    165 => 'yen',
28
+    166 => '|',
29
+    167 => 'p',
30
+    169 => '(c)',
31
+    171 => '<<',
32
+    172 => '-',
33
+    173 => '-',
34
+    174 => '(R)',
35
+    176 => 'o',
36
+    177 => '+-',
37
+    181 => 'mu',
38
+    182 => 'p',
39
+    183 => '.',
40
+    186 => 'o ',
41
+    187 => '>>',
42
+    191 => '?',
43
+    192 => 'A',
44
+    193 => 'A',
45
+    194 => 'A',
46
+    195 => 'A',
47
+    196 => 'A',
48
+    197 => 'A',
49
+    198 => 'AE',
50
+    199 => 'C',
51
+    200 => 'E',
52
+    201 => 'E',
53
+    202 => 'E',
54
+    203 => 'E',
55
+    204 => 'I',
56
+    205 => 'I',
57
+    206 => 'I',
58
+    207 => 'I',
59
+    209 => 'N',
60
+    210 => 'O',
61
+    211 => 'O',
62
+    212 => 'O',
63
+    213 => 'O',
64
+    214 => 'O',
65
+    216 => 'O',
66
+    217 => 'U',
67
+    218 => 'U',
68
+    219 => 'U',
69
+    220 => 'U',
70
+    223 => 'ss',
71
+    224 => 'a',
72
+    225 => 'a',
73
+    226 => 'a',
74
+    227 => 'a',
75
+    228 => 'a',
76
+    229 => 'a',
77
+    230 => 'ae',
78
+    231 => 'c',
79
+    232 => 'e',
80
+    233 => 'e',
81
+    234 => 'e',
82
+    235 => 'e',
83
+    236 => 'i',
84
+    237 => 'i',
85
+    238 => 'i',
86
+    239 => 'i',
87
+    241 => 'n',
88
+    242 => 'o',
89
+    243 => 'o',
90
+    244 => 'o',
91
+    245 => 'o',
92
+    246 => 'o',
93
+    248 => 'o',
94
+    249 => 'u',
95
+    250 => 'u',
96
+    251 => 'u',
97
+    252 => 'u',
98
+    255 => 'y',
99 99
 
100 100
 // turc
101
-	286 => 'G',
102
-	287 => 'g',
103
-	304 => 'I',
104
-	305 => 'i',
101
+    286 => 'G',
102
+    287 => 'g',
103
+    304 => 'I',
104
+    305 => 'i',
105 105
 
106 106
 // esperanto
107
-	264 => 'Cx',
108
-	265 => 'cx',
109
-	284 => 'Gx',
110
-	285 => 'gx',
111
-	292 => 'Hx',
112
-	293 => 'hx',
113
-	308 => 'Jx',
114
-	309 => 'jx',
115
-	348 => 'Sx',
116
-	349 => 'sx',
117
-	364 => 'Ux',
118
-	365 => 'ux',
107
+    264 => 'Cx',
108
+    265 => 'cx',
109
+    284 => 'Gx',
110
+    285 => 'gx',
111
+    292 => 'Hx',
112
+    293 => 'hx',
113
+    308 => 'Jx',
114
+    309 => 'jx',
115
+    348 => 'Sx',
116
+    349 => 'sx',
117
+    364 => 'Ux',
118
+    365 => 'ux',
119 119
 
120 120
 
121 121
 // latin2 [Czech]
122
-	283 => 'e',
123
-	353 => 's',
124
-	269 => 'c',
125
-	345 => 'r',
126
-	382 => 'z',
127
-	367 => 'u',
128
-	328 => 'n',
129
-	357 => 't',
130
-	271 => 'd',
131
-	449 => 'o',
132
-	282 => 'E',
133
-	352 => 'S',
134
-	268 => 'C',
135
-	344 => 'R',
136
-	381 => 'Z',
137
-	366 => 'U',
138
-	327 => 'N',
139
-	356 => 'T',
140
-	270 => 'D',
141
-	467 => 'O',
122
+    283 => 'e',
123
+    353 => 's',
124
+    269 => 'c',
125
+    345 => 'r',
126
+    382 => 'z',
127
+    367 => 'u',
128
+    328 => 'n',
129
+    357 => 't',
130
+    271 => 'd',
131
+    449 => 'o',
132
+    282 => 'E',
133
+    352 => 'S',
134
+    268 => 'C',
135
+    344 => 'R',
136
+    381 => 'Z',
137
+    366 => 'U',
138
+    327 => 'N',
139
+    356 => 'T',
140
+    270 => 'D',
141
+    467 => 'O',
142 142
 
143 143
 // francais
144
-	338 => 'OE',
145
-	339 => 'oe',
146
-	376 => 'Y',
147
-	402 => 'f',
144
+    338 => 'OE',
145
+    339 => 'oe',
146
+    376 => 'Y',
147
+    402 => 'f',
148 148
 
149 149
 //polskie
150
-	260 => 'A',
151
-	261 => 'a',
152
-	262 => 'C',
153
-	263 => 'c',
154
-	280 => 'E',
155
-	281 => 'e',
156
-	321 => 'L',
157
-	322 => 'l',
158
-	323 => 'N',
159
-	324 => 'n',
160
-	346 => 'S',
161
-	347 => 's',
162
-	377 => 'Z',
163
-	378 => 'z',
164
-	379 => 'Z',
165
-	380 => 'z',
150
+    260 => 'A',
151
+    261 => 'a',
152
+    262 => 'C',
153
+    263 => 'c',
154
+    280 => 'E',
155
+    281 => 'e',
156
+    321 => 'L',
157
+    322 => 'l',
158
+    323 => 'N',
159
+    324 => 'n',
160
+    346 => 'S',
161
+    347 => 's',
162
+    377 => 'Z',
163
+    378 => 'z',
164
+    379 => 'Z',
165
+    380 => 'z',
166 166
 
167 167
 //roumain
168
-	258 => 'A',
169
-	259 => 'a',
170
-	354 => 'T',
171
-	355 => 't',
168
+    258 => 'A',
169
+    259 => 'a',
170
+    354 => 'T',
171
+    355 => 't',
172 172
 
173 173
 //turc & roumain
174
-	350 => 'S',
175
-	351 => 's',
174
+    350 => 'S',
175
+    351 => 's',
176 176
 
177 177
 // cyrillique
178
-	1026 => 'D%',
179
-	1027 => 'G%',
180
-	8218 => '\'',
181
-	1107 => 'g%',
182
-	8222 => '"',
183
-	8230 => '...',
184
-	8224 => '/-',
185
-	8225 => '/=',
186
-	8364 => 'EUR',
187
-	8240 => '0/00',
188
-	1033 => 'LJ',
189
-	8249 => '<',
190
-	1034 => 'NJ',
191
-	1036 => 'KJ',
192
-	1035 => 'Ts',
193
-	1039 => 'DZ',
194
-	1106 => 'd%',
195
-	8216 => '`',
196
-	8217 => '\'',
197
-	8220 => '"',
198
-	8221 => '"',
199
-	8226 => ' o ',
200
-	8211 => '-',
201
-	8212 => '~',
202
-	8482 => '(TM)',
203
-	1113 => 'lj',
204
-	8250 => '>',
205
-	1114 => 'nj',
206
-	1116 => 'kj',
207
-	1115 => 'ts',
208
-	1119 => 'dz',
209
-	1038 => 'V%',
210
-	1118 => 'v%',
211
-	1032 => 'J%',
212
-	1168 => 'G3',
213
-	1025 => 'IO',
214
-	1028 => 'IE',
215
-	1031 => 'YI',
216
-	1030 => 'II',
217
-	1110 => 'ii',
218
-	1169 => 'g3',
219
-	1105 => 'io',
220
-	8470 => 'No.',
221
-	1108 => 'ie',
222
-	1112 => 'j%',
223
-	1029 => 'DS',
224
-	1109 => 'ds',
225
-	1111 => 'yi',
226
-	1040 => 'A',
227
-	1041 => 'B',
228
-	1042 => 'V',
229
-	1043 => 'G',
230
-	1044 => 'D',
231
-	1045 => 'E',
232
-	1046 => 'ZH',
233
-	1047 => 'Z',
234
-	1048 => 'I',
235
-	1049 => 'J',
236
-	1050 => 'K',
237
-	1051 => 'L',
238
-	1052 => 'M',
239
-	1053 => 'N',
240
-	1054 => 'O',
241
-	1055 => 'P',
242
-	1056 => 'R',
243
-	1057 => 'S',
244
-	1058 => 'T',
245
-	1059 => 'U',
246
-	1060 => 'F',
247
-	1061 => 'H',
248
-	1062 => 'C',
249
-	1063 => 'CH',
250
-	1064 => 'SH',
251
-	1065 => 'SCH',
252
-	1066 => '"',
253
-	1067 => 'Y',
254
-	1068 => '\'',
255
-	1069 => '`E',
256
-	1070 => 'YU',
257
-	1071 => 'YA',
258
-	1072 => 'a',
259
-	1073 => 'b',
260
-	1074 => 'v',
261
-	1075 => 'g',
262
-	1076 => 'd',
263
-	1077 => 'e',
264
-	1078 => 'zh',
265
-	1079 => 'z',
266
-	1080 => 'i',
267
-	1081 => 'j',
268
-	1082 => 'k',
269
-	1083 => 'l',
270
-	1084 => 'm',
271
-	1085 => 'n',
272
-	1086 => 'o',
273
-	1087 => 'p',
274
-	1088 => 'r',
275
-	1089 => 's',
276
-	1090 => 't',
277
-	1091 => 'u',
278
-	1092 => 'f',
279
-	1093 => 'h',
280
-	1094 => 'c',
281
-	1095 => 'ch',
282
-	1096 => 'sh',
283
-	1097 => 'sch',
284
-	1098 => '"',
285
-	1099 => 'y',
286
-	1100 => '\'',
287
-	1101 => '`e',
288
-	1102 => 'yu',
289
-	1103 => 'ya',
178
+    1026 => 'D%',
179
+    1027 => 'G%',
180
+    8218 => '\'',
181
+    1107 => 'g%',
182
+    8222 => '"',
183
+    8230 => '...',
184
+    8224 => '/-',
185
+    8225 => '/=',
186
+    8364 => 'EUR',
187
+    8240 => '0/00',
188
+    1033 => 'LJ',
189
+    8249 => '<',
190
+    1034 => 'NJ',
191
+    1036 => 'KJ',
192
+    1035 => 'Ts',
193
+    1039 => 'DZ',
194
+    1106 => 'd%',
195
+    8216 => '`',
196
+    8217 => '\'',
197
+    8220 => '"',
198
+    8221 => '"',
199
+    8226 => ' o ',
200
+    8211 => '-',
201
+    8212 => '~',
202
+    8482 => '(TM)',
203
+    1113 => 'lj',
204
+    8250 => '>',
205
+    1114 => 'nj',
206
+    1116 => 'kj',
207
+    1115 => 'ts',
208
+    1119 => 'dz',
209
+    1038 => 'V%',
210
+    1118 => 'v%',
211
+    1032 => 'J%',
212
+    1168 => 'G3',
213
+    1025 => 'IO',
214
+    1028 => 'IE',
215
+    1031 => 'YI',
216
+    1030 => 'II',
217
+    1110 => 'ii',
218
+    1169 => 'g3',
219
+    1105 => 'io',
220
+    8470 => 'No.',
221
+    1108 => 'ie',
222
+    1112 => 'j%',
223
+    1029 => 'DS',
224
+    1109 => 'ds',
225
+    1111 => 'yi',
226
+    1040 => 'A',
227
+    1041 => 'B',
228
+    1042 => 'V',
229
+    1043 => 'G',
230
+    1044 => 'D',
231
+    1045 => 'E',
232
+    1046 => 'ZH',
233
+    1047 => 'Z',
234
+    1048 => 'I',
235
+    1049 => 'J',
236
+    1050 => 'K',
237
+    1051 => 'L',
238
+    1052 => 'M',
239
+    1053 => 'N',
240
+    1054 => 'O',
241
+    1055 => 'P',
242
+    1056 => 'R',
243
+    1057 => 'S',
244
+    1058 => 'T',
245
+    1059 => 'U',
246
+    1060 => 'F',
247
+    1061 => 'H',
248
+    1062 => 'C',
249
+    1063 => 'CH',
250
+    1064 => 'SH',
251
+    1065 => 'SCH',
252
+    1066 => '"',
253
+    1067 => 'Y',
254
+    1068 => '\'',
255
+    1069 => '`E',
256
+    1070 => 'YU',
257
+    1071 => 'YA',
258
+    1072 => 'a',
259
+    1073 => 'b',
260
+    1074 => 'v',
261
+    1075 => 'g',
262
+    1076 => 'd',
263
+    1077 => 'e',
264
+    1078 => 'zh',
265
+    1079 => 'z',
266
+    1080 => 'i',
267
+    1081 => 'j',
268
+    1082 => 'k',
269
+    1083 => 'l',
270
+    1084 => 'm',
271
+    1085 => 'n',
272
+    1086 => 'o',
273
+    1087 => 'p',
274
+    1088 => 'r',
275
+    1089 => 's',
276
+    1090 => 't',
277
+    1091 => 'u',
278
+    1092 => 'f',
279
+    1093 => 'h',
280
+    1094 => 'c',
281
+    1095 => 'ch',
282
+    1096 => 'sh',
283
+    1097 => 'sch',
284
+    1098 => '"',
285
+    1099 => 'y',
286
+    1100 => '\'',
287
+    1101 => '`e',
288
+    1102 => 'yu',
289
+    1103 => 'ya',
290 290
 
291 291
 // vietnamien en translitteration de base
292
-	7843 => 'a',
293
-	7841 => 'a',
294
-	7845 => 'a',
295
-	7847 => 'a',
296
-	7849 => 'a',
297
-	7851 => 'a',
298
-	7853 => 'a',
299
-	7855 => 'a',
300
-	7857 => 'a',
301
-	7859 => 'a',
302
-	7861 => 'a',
303
-	7863 => 'a',
304
-	7842 => 'A',
305
-	7840 => 'A',
306
-	7844 => 'A',
307
-	7846 => 'A',
308
-	7848 => 'A',
309
-	7850 => 'A',
310
-	7852 => 'A',
311
-	7854 => 'A',
312
-	7856 => 'A',
313
-	7858 => 'A',
314
-	7860 => 'A',
315
-	7862 => 'A',
316
-	7867 => 'e',
317
-	7869 => 'e',
318
-	7865 => 'e',
319
-	7871 => 'e',
320
-	7873 => 'e',
321
-	7875 => 'e',
322
-	7877 => 'e',
323
-	7879 => 'e',
324
-	7866 => 'E',
325
-	7868 => 'E',
326
-	7864 => 'E',
327
-	7870 => 'E',
328
-	7872 => 'E',
329
-	7874 => 'E',
330
-	7876 => 'E',
331
-	7878 => 'E',
332
-	7881 => 'i',
333
-	7883 => 'i',
334
-	7880 => 'I',
335
-	7882 => 'I',
336
-	7887 => 'o',
337
-	7885 => 'o',
338
-	7889 => 'o',
339
-	7891 => 'o',
340
-	7893 => 'o',
341
-	7895 => 'o',
342
-	7897 => 'o',
343
-	417 => 'o',
344
-	7899 => 'o',
345
-	7901 => 'o',
346
-	7903 => 'o',
347
-	7905 => 'o',
348
-	7907 => 'o',
349
-	7886 => 'O',
350
-	7884 => 'O',
351
-	7888 => 'O',
352
-	7890 => 'O',
353
-	7892 => 'O',
354
-	7894 => 'O',
355
-	7896 => 'O',
356
-	416 => 'O',
357
-	7898 => 'O',
358
-	7900 => 'O',
359
-	7902 => 'O',
360
-	7904 => 'O',
361
-	7906 => 'O',
362
-	7911 => 'u',
363
-	361 => 'u',
364
-	7909 => 'u',
365
-	432 => 'u',
366
-	7913 => 'u',
367
-	7915 => 'u',
368
-	7917 => 'u',
369
-	7919 => 'u',
370
-	7921 => 'u',
371
-	7910 => 'U',
372
-	360 => 'U',
373
-	7908 => 'U',
374
-	431 => 'U',
375
-	7912 => 'U',
376
-	7914 => 'U',
377
-	7916 => 'U',
378
-	7918 => 'U',
379
-	7920 => 'U',
380
-	253 => 'y',
381
-	7923 => 'y',
382
-	7927 => 'y',
383
-	7929 => 'y',
384
-	7925 => 'y',
385
-	221 => 'Y',
386
-	7922 => 'Y',
387
-	7926 => 'Y',
388
-	7928 => 'Y',
389
-	7924 => 'Y',
390
-	273 => 'd'
292
+    7843 => 'a',
293
+    7841 => 'a',
294
+    7845 => 'a',
295
+    7847 => 'a',
296
+    7849 => 'a',
297
+    7851 => 'a',
298
+    7853 => 'a',
299
+    7855 => 'a',
300
+    7857 => 'a',
301
+    7859 => 'a',
302
+    7861 => 'a',
303
+    7863 => 'a',
304
+    7842 => 'A',
305
+    7840 => 'A',
306
+    7844 => 'A',
307
+    7846 => 'A',
308
+    7848 => 'A',
309
+    7850 => 'A',
310
+    7852 => 'A',
311
+    7854 => 'A',
312
+    7856 => 'A',
313
+    7858 => 'A',
314
+    7860 => 'A',
315
+    7862 => 'A',
316
+    7867 => 'e',
317
+    7869 => 'e',
318
+    7865 => 'e',
319
+    7871 => 'e',
320
+    7873 => 'e',
321
+    7875 => 'e',
322
+    7877 => 'e',
323
+    7879 => 'e',
324
+    7866 => 'E',
325
+    7868 => 'E',
326
+    7864 => 'E',
327
+    7870 => 'E',
328
+    7872 => 'E',
329
+    7874 => 'E',
330
+    7876 => 'E',
331
+    7878 => 'E',
332
+    7881 => 'i',
333
+    7883 => 'i',
334
+    7880 => 'I',
335
+    7882 => 'I',
336
+    7887 => 'o',
337
+    7885 => 'o',
338
+    7889 => 'o',
339
+    7891 => 'o',
340
+    7893 => 'o',
341
+    7895 => 'o',
342
+    7897 => 'o',
343
+    417 => 'o',
344
+    7899 => 'o',
345
+    7901 => 'o',
346
+    7903 => 'o',
347
+    7905 => 'o',
348
+    7907 => 'o',
349
+    7886 => 'O',
350
+    7884 => 'O',
351
+    7888 => 'O',
352
+    7890 => 'O',
353
+    7892 => 'O',
354
+    7894 => 'O',
355
+    7896 => 'O',
356
+    416 => 'O',
357
+    7898 => 'O',
358
+    7900 => 'O',
359
+    7902 => 'O',
360
+    7904 => 'O',
361
+    7906 => 'O',
362
+    7911 => 'u',
363
+    361 => 'u',
364
+    7909 => 'u',
365
+    432 => 'u',
366
+    7913 => 'u',
367
+    7915 => 'u',
368
+    7917 => 'u',
369
+    7919 => 'u',
370
+    7921 => 'u',
371
+    7910 => 'U',
372
+    360 => 'U',
373
+    7908 => 'U',
374
+    431 => 'U',
375
+    7912 => 'U',
376
+    7914 => 'U',
377
+    7916 => 'U',
378
+    7918 => 'U',
379
+    7920 => 'U',
380
+    253 => 'y',
381
+    7923 => 'y',
382
+    7927 => 'y',
383
+    7929 => 'y',
384
+    7925 => 'y',
385
+    221 => 'Y',
386
+    7922 => 'Y',
387
+    7926 => 'Y',
388
+    7928 => 'Y',
389
+    7924 => 'Y',
390
+    273 => 'd'
391 391
 
392 392
 ];
Please login to merge, or discard this patch.
ecrire/src/Chiffrer/Password.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 			$pass_poivre = hash_hmac('sha256', $password_clair, $key);
38 38
 			return password_verify($pass_poivre, $password_hash);
39 39
 		}
40
-		spip_log('Aucune clé pour vérifier le mot de passe', 'chiffrer' . _LOG_INFO_IMPORTANTE);
40
+		spip_log('Aucune clé pour vérifier le mot de passe', 'chiffrer'._LOG_INFO_IMPORTANTE);
41 41
 		return false;
42 42
 	}
43 43
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 			$pass_poivre = hash_hmac('sha256', $password_clair, $key);
60 60
 			return password_hash($pass_poivre, PASSWORD_DEFAULT);
61 61
 		}
62
-		spip_log('Aucune clé pour chiffrer le mot de passe', 'chiffrer' . _LOG_INFO_IMPORTANTE);
62
+		spip_log('Aucune clé pour chiffrer le mot de passe', 'chiffrer'._LOG_INFO_IMPORTANTE);
63 63
 		return null;
64 64
 	}
65 65
 
Please login to merge, or discard this patch.
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -13,49 +13,49 @@
 block discarded – undo
13 13
 
14 14
 /** Vérification et hachage de mot de passe */
15 15
 class Password {
16
-	/**
17
-	 * verifier qu'un mot de passe en clair est correct a l'aide de son hash
18
-	 *
19
-	 * Le mot de passe est poivre via la cle secret_des_auth
20
-	 */
21
-	public static function verifier(
22
-		#[\SensitiveParameter]
23
-		string $password_clair,
24
-		#[\SensitiveParameter]
25
-		string $password_hash,
26
-		#[\SensitiveParameter]
27
-		?string $key = null
28
-	): bool {
29
-		$key ??= self::getDefaultKey();
30
-		if ($key) {
31
-			$pass_poivre = hash_hmac('sha256', $password_clair, $key);
32
-			return password_verify($pass_poivre, $password_hash);
33
-		}
34
-		spip_log('Aucune clé pour vérifier le mot de passe', 'chiffrer' . _LOG_INFO_IMPORTANTE);
35
-		return false;
36
-	}
16
+    /**
17
+     * verifier qu'un mot de passe en clair est correct a l'aide de son hash
18
+     *
19
+     * Le mot de passe est poivre via la cle secret_des_auth
20
+     */
21
+    public static function verifier(
22
+        #[\SensitiveParameter]
23
+        string $password_clair,
24
+        #[\SensitiveParameter]
25
+        string $password_hash,
26
+        #[\SensitiveParameter]
27
+        ?string $key = null
28
+    ): bool {
29
+        $key ??= self::getDefaultKey();
30
+        if ($key) {
31
+            $pass_poivre = hash_hmac('sha256', $password_clair, $key);
32
+            return password_verify($pass_poivre, $password_hash);
33
+        }
34
+        spip_log('Aucune clé pour vérifier le mot de passe', 'chiffrer' . _LOG_INFO_IMPORTANTE);
35
+        return false;
36
+    }
37 37
 
38
-	/**
39
-	 * Calculer un hash salé du mot de passe
40
-	 */
41
-	public static function hacher(
42
-		#[\SensitiveParameter]
43
-		string $password_clair,
44
-		#[\SensitiveParameter]
45
-		?string $key = null
46
-	): ?string {
47
-		$key ??= self::getDefaultKey();
48
-		// ne pas fournir un hash errone si la cle nous manque
49
-		if ($key) {
50
-			$pass_poivre = hash_hmac('sha256', $password_clair, $key);
51
-			return password_hash($pass_poivre, PASSWORD_DEFAULT);
52
-		}
53
-		spip_log('Aucune clé pour chiffrer le mot de passe', 'chiffrer' . _LOG_INFO_IMPORTANTE);
54
-		return null;
55
-	}
38
+    /**
39
+     * Calculer un hash salé du mot de passe
40
+     */
41
+    public static function hacher(
42
+        #[\SensitiveParameter]
43
+        string $password_clair,
44
+        #[\SensitiveParameter]
45
+        ?string $key = null
46
+    ): ?string {
47
+        $key ??= self::getDefaultKey();
48
+        // ne pas fournir un hash errone si la cle nous manque
49
+        if ($key) {
50
+            $pass_poivre = hash_hmac('sha256', $password_clair, $key);
51
+            return password_hash($pass_poivre, PASSWORD_DEFAULT);
52
+        }
53
+        spip_log('Aucune clé pour chiffrer le mot de passe', 'chiffrer' . _LOG_INFO_IMPORTANTE);
54
+        return null;
55
+    }
56 56
 
57
-	private static function getDefaultKey(): ?string {
58
-		$keys = SpipCles::instance();
59
-		return $keys->getSecretAuth();
60
-	}
57
+    private static function getDefaultKey(): ?string {
58
+        $keys = SpipCles::instance();
59
+        return $keys->getSecretAuth();
60
+    }
61 61
 }
Please login to merge, or discard this patch.
ecrire/src/Chiffrer/Cles.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
 	public function generate(string $name): string {
31 31
 		$key = Chiffrement::keygen();
32 32
 		$this->keys[$name] = $key;
33
-		spip_log("Création de la cle $name", 'chiffrer' . _LOG_INFO_IMPORTANTE);
33
+		spip_log("Création de la cle $name", 'chiffrer'._LOG_INFO_IMPORTANTE);
34 34
 		return $key;
35 35
 	}
36 36
 
Please login to merge, or discard this patch.
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -13,46 +13,46 @@
 block discarded – undo
13 13
 
14 14
 /** Conteneur de clés (chiffrement, authentification) */
15 15
 class Cles implements \Countable /* , ContainerInterface */ {
16
-	public function __construct(private array $keys) {
17
-	}
18
-
19
-	public function has(string $name): bool {
20
-		return array_key_exists($name, $this->keys);
21
-	}
22
-
23
-	public function get(string $name): ?string {
24
-		return $this->keys[$name] ?? null;
25
-	}
26
-
27
-	public function generate(string $name): string {
28
-		$key = Chiffrement::keygen();
29
-		$this->keys[$name] = $key;
30
-		spip_log("Création de la cle $name", 'chiffrer' . _LOG_INFO_IMPORTANTE);
31
-		return $key;
32
-	}
33
-
34
-	public function set(
35
-		string $name,
36
-		#[\SensitiveParameter]
37
-		string $key
38
-	): void {
39
-		$this->keys[$name] = $key;
40
-	}
41
-
42
-	public function delete(string $name): bool {
43
-		if (isset($this->keys[$name])) {
44
-			unset($this->keys[$name]);
45
-			return true;
46
-		};
47
-		return false;
48
-	}
49
-
50
-	public function count(): int {
51
-		return count($this->keys);
52
-	}
53
-
54
-	public function toJson(): string {
55
-		$json = array_map('base64_encode', $this->keys);
56
-		return \json_encode($json, JSON_THROW_ON_ERROR);
57
-	}
16
+    public function __construct(private array $keys) {
17
+    }
18
+
19
+    public function has(string $name): bool {
20
+        return array_key_exists($name, $this->keys);
21
+    }
22
+
23
+    public function get(string $name): ?string {
24
+        return $this->keys[$name] ?? null;
25
+    }
26
+
27
+    public function generate(string $name): string {
28
+        $key = Chiffrement::keygen();
29
+        $this->keys[$name] = $key;
30
+        spip_log("Création de la cle $name", 'chiffrer' . _LOG_INFO_IMPORTANTE);
31
+        return $key;
32
+    }
33
+
34
+    public function set(
35
+        string $name,
36
+        #[\SensitiveParameter]
37
+        string $key
38
+    ): void {
39
+        $this->keys[$name] = $key;
40
+    }
41
+
42
+    public function delete(string $name): bool {
43
+        if (isset($this->keys[$name])) {
44
+            unset($this->keys[$name]);
45
+            return true;
46
+        };
47
+        return false;
48
+    }
49
+
50
+    public function count(): int {
51
+        return count($this->keys);
52
+    }
53
+
54
+    public function toJson(): string {
55
+        $json = array_map('base64_encode', $this->keys);
56
+        return \json_encode($json, JSON_THROW_ON_ERROR);
57
+    }
58 58
 }
Please login to merge, or discard this patch.
ecrire/install/etape_ldap2.php 3 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,8 +39,7 @@
 block discarded – undo
39 39
 		} else {
40 40
 			$tls = true;
41 41
 		}
42
-	}
43
-	else {
42
+	} else {
44 43
 		$tls_ldap == 'non';
45 44
 	}
46 45
 
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	$adresse_ldap = filter_var($adresse_ldap, FILTER_SANITIZE_URL) ?: '';
49 49
 
50 50
 	$ldap_link = ldap_connect($adresse_ldap, $port_ldap);
51
-	$erreur = 'ldap_connect(' . spip_htmlspecialchars($adresse_ldap) . ', ' . spip_htmlspecialchars($port_ldap) . ')';
51
+	$erreur = 'ldap_connect('.spip_htmlspecialchars($adresse_ldap).', '.spip_htmlspecialchars($port_ldap).')';
52 52
 
53 53
 	if ($ldap_link) {
54 54
 		if (!ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap)) {
@@ -56,18 +56,18 @@  discard block
 block discarded – undo
56 56
 			ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap);
57 57
 		}
58 58
 		if ($tls && !ldap_start_tls($ldap_link)) {
59
-			$erreur = 'ldap_start_tls(' . spip_htmlspecialchars($ldap_link)
60
-				. ' ' . spip_htmlspecialchars($adresse_ldap)
61
-				. ', ' . spip_htmlspecialchars($port_ldap) . ')';
59
+			$erreur = 'ldap_start_tls('.spip_htmlspecialchars($ldap_link)
60
+				. ' '.spip_htmlspecialchars($adresse_ldap)
61
+				. ', '.spip_htmlspecialchars($port_ldap).')';
62 62
 			$ldap_link = false;
63 63
 		}
64 64
 		if ($ldap_link) {
65 65
 			$ldap_link = ldap_bind($ldap_link, $login_ldap, $pass_ldap);
66
-			$erreur = "ldap_bind('" . spip_htmlspecialchars($ldap_link)
67
-				. "', '" . spip_htmlspecialchars($login_ldap)
68
-				. "', '" . spip_htmlspecialchars($pass_ldap)
69
-				. "'): " . spip_htmlspecialchars($adresse_ldap)
70
-				. ', ' . spip_htmlspecialchars($port_ldap);
66
+			$erreur = "ldap_bind('".spip_htmlspecialchars($ldap_link)
67
+				. "', '".spip_htmlspecialchars($login_ldap)
68
+				. "', '".spip_htmlspecialchars($pass_ldap)
69
+				. "'): ".spip_htmlspecialchars($adresse_ldap)
70
+				. ', '.spip_htmlspecialchars($port_ldap);
71 71
 		}
72 72
 	}
73 73
 
@@ -75,22 +75,22 @@  discard block
 block discarded – undo
75 75
 		echo info_etape(
76 76
 			_T('titre_connexion_ldap'),
77 77
 			info_progression_etape(2, 'etape_ldap', 'install/')
78
-		),  _T('info_connexion_ldap_ok');
78
+		), _T('info_connexion_ldap_ok');
79 79
 		echo generer_form_ecrire('install', (
80 80
 			"\n<input type='hidden' name='etape' value='ldap3' />"
81
-			. "\n<input type='hidden' name='adresse_ldap' value=\"" . spip_htmlspecialchars($adresse_ldap) . '" />'
82
-			. "\n<input type='hidden' name='port_ldap' value=\"" . spip_htmlspecialchars($port_ldap) . '" />'
83
-			. "\n<input type='hidden' name='login_ldap' value=\"" . spip_htmlspecialchars($login_ldap) . '" />'
84
-			. "\n<input type='hidden' name='pass_ldap' value=\"" . spip_htmlspecialchars($pass_ldap) . '" />'
85
-			. "\n<input type='hidden' name='protocole_ldap' value=\"" . spip_htmlspecialchars($protocole_ldap) . '" />'
86
-			. "\n<input type='hidden' name='tls_ldap' value=\"" . spip_htmlspecialchars($tls_ldap) . '" />'
81
+			. "\n<input type='hidden' name='adresse_ldap' value=\"".spip_htmlspecialchars($adresse_ldap).'" />'
82
+			. "\n<input type='hidden' name='port_ldap' value=\"".spip_htmlspecialchars($port_ldap).'" />'
83
+			. "\n<input type='hidden' name='login_ldap' value=\"".spip_htmlspecialchars($login_ldap).'" />'
84
+			. "\n<input type='hidden' name='pass_ldap' value=\"".spip_htmlspecialchars($pass_ldap).'" />'
85
+			. "\n<input type='hidden' name='protocole_ldap' value=\"".spip_htmlspecialchars($protocole_ldap).'" />'
86
+			. "\n<input type='hidden' name='tls_ldap' value=\"".spip_htmlspecialchars($tls_ldap).'" />'
87 87
 			. bouton_suivant()));
88 88
 	} else {
89 89
 		echo info_etape(_T('titre_connexion_ldap')), info_progression_etape(1, 'etape_ldap', 'install/', true),
90
-			"<div class='error'><p>" . _T('avis_connexion_ldap_echec_1') . '</p>',
91
-			'<p>' . _T('avis_connexion_ldap_echec_2') .
92
-			"<br />\n" . _T('avis_connexion_ldap_echec_3') .
93
-			'<br /><br />' . $erreur . '<b> ?</b></p></div>';
90
+			"<div class='error'><p>"._T('avis_connexion_ldap_echec_1').'</p>',
91
+			'<p>'._T('avis_connexion_ldap_echec_2').
92
+			"<br />\n"._T('avis_connexion_ldap_echec_3').
93
+			'<br /><br />'.$erreur.'<b> ?</b></p></div>';
94 94
 	}
95 95
 
96 96
 	echo $minipage->installFinPage();
Please login to merge, or discard this patch.
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -12,88 +12,88 @@
 block discarded – undo
12 12
 \***************************************************************************/
13 13
 
14 14
 if (!defined('_ECRIRE_INC_VERSION')) {
15
-	return;
15
+    return;
16 16
 }
17 17
 
18 18
 function install_etape_ldap2_dist() {
19
-	$minipage = new Installation();
20
-	echo $minipage->installDebutPage(['onload' => 'document.getElementById(\'suivant\').focus();return false;']);
21
-
22
-	$adresse_ldap = _request('adresse_ldap');
23
-
24
-	$port_ldap = _request('port_ldap');
25
-
26
-	$tls_ldap = _request('tls_ldap');
27
-
28
-	$protocole_ldap = _request('protocole_ldap');
29
-
30
-	$login_ldap = _request('login_ldap');
31
-
32
-	$pass_ldap = _request('pass_ldap');
33
-
34
-	$port_ldap = (int) $port_ldap;
35
-
36
-	$tls = false;
37
-
38
-	if ($tls_ldap == 'oui') {
39
-		if ($port_ldap == 636) {
40
-			$adresse_ldap = "ldaps://$adresse_ldap";
41
-		} else {
42
-			$tls = true;
43
-		}
44
-	}
45
-	else {
46
-		$tls_ldap == 'non';
47
-	}
48
-
49
-	// Verifions que l'adresse demandee est valide
50
-	$adresse_ldap = filter_var($adresse_ldap, FILTER_SANITIZE_URL) ?: '';
51
-
52
-	$ldap_link = ldap_connect($adresse_ldap, $port_ldap);
53
-	$erreur = 'ldap_connect(' . spip_htmlspecialchars($adresse_ldap) . ', ' . spip_htmlspecialchars($port_ldap) . ')';
54
-
55
-	if ($ldap_link) {
56
-		if (!ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap)) {
57
-			$protocole_ldap = 2;
58
-			ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap);
59
-		}
60
-		if ($tls && !ldap_start_tls($ldap_link)) {
61
-			$erreur = 'ldap_start_tls(' . spip_htmlspecialchars($ldap_link)
62
-				. ' ' . spip_htmlspecialchars($adresse_ldap)
63
-				. ', ' . spip_htmlspecialchars($port_ldap) . ')';
64
-			$ldap_link = false;
65
-		}
66
-		if ($ldap_link) {
67
-			$ldap_link = ldap_bind($ldap_link, $login_ldap, $pass_ldap);
68
-			$erreur = "ldap_bind('" . spip_htmlspecialchars($ldap_link)
69
-				. "', '" . spip_htmlspecialchars($login_ldap)
70
-				. "', '" . spip_htmlspecialchars($pass_ldap)
71
-				. "'): " . spip_htmlspecialchars($adresse_ldap)
72
-				. ', ' . spip_htmlspecialchars($port_ldap);
73
-		}
74
-	}
75
-
76
-	if ($ldap_link) {
77
-		echo info_etape(
78
-			_T('titre_connexion_ldap'),
79
-			info_progression_etape(2, 'etape_ldap', 'install/')
80
-		),  _T('info_connexion_ldap_ok');
81
-		echo generer_form_ecrire('install', (
82
-			"\n<input type='hidden' name='etape' value='ldap3' />"
83
-			. "\n<input type='hidden' name='adresse_ldap' value=\"" . spip_htmlspecialchars($adresse_ldap) . '" />'
84
-			. "\n<input type='hidden' name='port_ldap' value=\"" . spip_htmlspecialchars($port_ldap) . '" />'
85
-			. "\n<input type='hidden' name='login_ldap' value=\"" . spip_htmlspecialchars($login_ldap) . '" />'
86
-			. "\n<input type='hidden' name='pass_ldap' value=\"" . spip_htmlspecialchars($pass_ldap) . '" />'
87
-			. "\n<input type='hidden' name='protocole_ldap' value=\"" . spip_htmlspecialchars($protocole_ldap) . '" />'
88
-			. "\n<input type='hidden' name='tls_ldap' value=\"" . spip_htmlspecialchars($tls_ldap) . '" />'
89
-			. bouton_suivant()));
90
-	} else {
91
-		echo info_etape(_T('titre_connexion_ldap')), info_progression_etape(1, 'etape_ldap', 'install/', true),
92
-			"<div class='error'><p>" . _T('avis_connexion_ldap_echec_1') . '</p>',
93
-			'<p>' . _T('avis_connexion_ldap_echec_2') .
94
-			"<br />\n" . _T('avis_connexion_ldap_echec_3') .
95
-			'<br /><br />' . $erreur . '<b> ?</b></p></div>';
96
-	}
97
-
98
-	echo $minipage->installFinPage();
19
+    $minipage = new Installation();
20
+    echo $minipage->installDebutPage(['onload' => 'document.getElementById(\'suivant\').focus();return false;']);
21
+
22
+    $adresse_ldap = _request('adresse_ldap');
23
+
24
+    $port_ldap = _request('port_ldap');
25
+
26
+    $tls_ldap = _request('tls_ldap');
27
+
28
+    $protocole_ldap = _request('protocole_ldap');
29
+
30
+    $login_ldap = _request('login_ldap');
31
+
32
+    $pass_ldap = _request('pass_ldap');
33
+
34
+    $port_ldap = (int) $port_ldap;
35
+
36
+    $tls = false;
37
+
38
+    if ($tls_ldap == 'oui') {
39
+        if ($port_ldap == 636) {
40
+            $adresse_ldap = "ldaps://$adresse_ldap";
41
+        } else {
42
+            $tls = true;
43
+        }
44
+    }
45
+    else {
46
+        $tls_ldap == 'non';
47
+    }
48
+
49
+    // Verifions que l'adresse demandee est valide
50
+    $adresse_ldap = filter_var($adresse_ldap, FILTER_SANITIZE_URL) ?: '';
51
+
52
+    $ldap_link = ldap_connect($adresse_ldap, $port_ldap);
53
+    $erreur = 'ldap_connect(' . spip_htmlspecialchars($adresse_ldap) . ', ' . spip_htmlspecialchars($port_ldap) . ')';
54
+
55
+    if ($ldap_link) {
56
+        if (!ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap)) {
57
+            $protocole_ldap = 2;
58
+            ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap);
59
+        }
60
+        if ($tls && !ldap_start_tls($ldap_link)) {
61
+            $erreur = 'ldap_start_tls(' . spip_htmlspecialchars($ldap_link)
62
+                . ' ' . spip_htmlspecialchars($adresse_ldap)
63
+                . ', ' . spip_htmlspecialchars($port_ldap) . ')';
64
+            $ldap_link = false;
65
+        }
66
+        if ($ldap_link) {
67
+            $ldap_link = ldap_bind($ldap_link, $login_ldap, $pass_ldap);
68
+            $erreur = "ldap_bind('" . spip_htmlspecialchars($ldap_link)
69
+                . "', '" . spip_htmlspecialchars($login_ldap)
70
+                . "', '" . spip_htmlspecialchars($pass_ldap)
71
+                . "'): " . spip_htmlspecialchars($adresse_ldap)
72
+                . ', ' . spip_htmlspecialchars($port_ldap);
73
+        }
74
+    }
75
+
76
+    if ($ldap_link) {
77
+        echo info_etape(
78
+            _T('titre_connexion_ldap'),
79
+            info_progression_etape(2, 'etape_ldap', 'install/')
80
+        ),  _T('info_connexion_ldap_ok');
81
+        echo generer_form_ecrire('install', (
82
+            "\n<input type='hidden' name='etape' value='ldap3' />"
83
+            . "\n<input type='hidden' name='adresse_ldap' value=\"" . spip_htmlspecialchars($adresse_ldap) . '" />'
84
+            . "\n<input type='hidden' name='port_ldap' value=\"" . spip_htmlspecialchars($port_ldap) . '" />'
85
+            . "\n<input type='hidden' name='login_ldap' value=\"" . spip_htmlspecialchars($login_ldap) . '" />'
86
+            . "\n<input type='hidden' name='pass_ldap' value=\"" . spip_htmlspecialchars($pass_ldap) . '" />'
87
+            . "\n<input type='hidden' name='protocole_ldap' value=\"" . spip_htmlspecialchars($protocole_ldap) . '" />'
88
+            . "\n<input type='hidden' name='tls_ldap' value=\"" . spip_htmlspecialchars($tls_ldap) . '" />'
89
+            . bouton_suivant()));
90
+    } else {
91
+        echo info_etape(_T('titre_connexion_ldap')), info_progression_etape(1, 'etape_ldap', 'install/', true),
92
+            "<div class='error'><p>" . _T('avis_connexion_ldap_echec_1') . '</p>',
93
+            '<p>' . _T('avis_connexion_ldap_echec_2') .
94
+            "<br />\n" . _T('avis_connexion_ldap_echec_3') .
95
+            '<br /><br />' . $erreur . '<b> ?</b></p></div>';
96
+    }
97
+
98
+    echo $minipage->installFinPage();
99 99
 }
Please login to merge, or discard this patch.
ecrire/action/editer_rubrique.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 			$id_rubrique,
151 151
 			[
152 152
 			'data' => $set,
153
-			'nonvide' => ['titre' => _T('titre_nouvelle_rubrique') . ' ' . _T('info_numero_abbreviation') . $id_rubrique]
153
+			'nonvide' => ['titre' => _T('titre_nouvelle_rubrique').' '._T('info_numero_abbreviation').$id_rubrique]
154 154
 			],
155 155
 			$c
156 156
 		)
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 				)
255 255
 			) {
256 256
 				if ($s['statut'] != 'prepa') {
257
-					spip_log("deplacement de $id_rubrique vers $id_parent refuse a " . $GLOBALS['visiteur_session']['id_auteur'] . ' ' . $GLOBALS['visiteur_session']['statut']);
257
+					spip_log("deplacement de $id_rubrique vers $id_parent refuse a ".$GLOBALS['visiteur_session']['id_auteur'].' '.$GLOBALS['visiteur_session']['statut']);
258 258
 				}
259 259
 			} elseif (editer_rubrique_breves($id_rubrique, $id_parent, $c)) {
260 260
 				$statut_ancien = $s['statut'];
Please login to merge, or discard this patch.
Indentation   +218 added lines, -218 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  * @package SPIP\Core\Rubriques\Edition
16 16
  */
17 17
 if (!defined('_ECRIRE_INC_VERSION')) {
18
-	return;
18
+    return;
19 19
 }
20 20
 
21 21
 include_spip('inc/rubriques');
@@ -37,34 +37,34 @@  discard block
 block discarded – undo
37 37
  */
38 38
 function action_editer_rubrique_dist($arg = null) {
39 39
 
40
-	if (is_null($arg)) {
41
-		$securiser_action = charger_fonction('securiser_action', 'inc');
42
-		$arg = $securiser_action();
43
-	}
44
-
45
-	if (!$id_rubrique = (int) $arg) {
46
-		if ($arg != 'oui') {
47
-			include_spip('inc/headers');
48
-			redirige_url_ecrire();
49
-		}
50
-		$id_rubrique = rubrique_inserer(_request('id_parent'));
51
-	}
52
-
53
-	$err = rubrique_modifier($id_rubrique);
54
-
55
-	if (_request('redirect')) {
56
-		$redirect = parametre_url(
57
-			urldecode((string) _request('redirect')),
58
-			'id_rubrique',
59
-			$id_rubrique,
60
-			'&'
61
-		);
62
-
63
-		include_spip('inc/headers');
64
-		redirige_par_entete($redirect);
65
-	}
66
-
67
-	return [$id_rubrique, $err];
40
+    if (is_null($arg)) {
41
+        $securiser_action = charger_fonction('securiser_action', 'inc');
42
+        $arg = $securiser_action();
43
+    }
44
+
45
+    if (!$id_rubrique = (int) $arg) {
46
+        if ($arg != 'oui') {
47
+            include_spip('inc/headers');
48
+            redirige_url_ecrire();
49
+        }
50
+        $id_rubrique = rubrique_inserer(_request('id_parent'));
51
+    }
52
+
53
+    $err = rubrique_modifier($id_rubrique);
54
+
55
+    if (_request('redirect')) {
56
+        $redirect = parametre_url(
57
+            urldecode((string) _request('redirect')),
58
+            'id_rubrique',
59
+            $id_rubrique,
60
+            '&'
61
+        );
62
+
63
+        include_spip('inc/headers');
64
+        redirige_par_entete($redirect);
65
+    }
66
+
67
+    return [$id_rubrique, $err];
68 68
 }
69 69
 
70 70
 
@@ -79,64 +79,64 @@  discard block
 block discarded – undo
79 79
  *     Identifiant de la rubrique crée
80 80
  */
81 81
 function rubrique_inserer($id_parent, $set = null) {
82
-	$champs = [
83
-		'titre' => _T('item_nouvelle_rubrique'),
84
-		'id_parent' => (int) $id_parent,
85
-		'statut' => 'prepa'
86
-	];
87
-
88
-	if ($set) {
89
-		$champs = array_merge($champs, $set);
90
-	}
91
-
92
-	// Envoyer aux plugins
93
-	$champs = pipeline(
94
-		'pre_insertion',
95
-		[
96
-			'args' => [
97
-				'table' => 'spip_rubriques',
98
-			],
99
-			'data' => $champs
100
-		]
101
-	);
102
-
103
-	$id_rubrique = sql_insertq('spip_rubriques', $champs);
104
-	pipeline(
105
-		'post_insertion',
106
-		[
107
-			'args' => [
108
-				'table' => 'spip_rubriques',
109
-				'id_objet' => $id_rubrique
110
-			],
111
-			'data' => $champs
112
-		]
113
-	);
114
-	propager_les_secteurs();
115
-	calculer_langues_rubriques();
116
-
117
-	// Appeler une notification
118
-	if ($notifications = charger_fonction('notifications', 'inc')) {
119
-		$notifications(
120
-			'rubrique_inserer',
121
-			$id_rubrique,
122
-			[
123
-				'id_parent' => $id_parent,
124
-				'champs' => $champs,
125
-			]
126
-		);
127
-		$notifications(
128
-			'objet_inserer',
129
-			$id_rubrique,
130
-			[
131
-				'objet' => 'rubrique',
132
-				'id_objet' => $id_rubrique,
133
-				'id_parent' => $id_parent,
134
-				'champs' => $champs,
135
-			]
136
-		);
137
-	}
138
-
139
-	return $id_rubrique;
82
+    $champs = [
83
+        'titre' => _T('item_nouvelle_rubrique'),
84
+        'id_parent' => (int) $id_parent,
85
+        'statut' => 'prepa'
86
+    ];
87
+
88
+    if ($set) {
89
+        $champs = array_merge($champs, $set);
90
+    }
91
+
92
+    // Envoyer aux plugins
93
+    $champs = pipeline(
94
+        'pre_insertion',
95
+        [
96
+            'args' => [
97
+                'table' => 'spip_rubriques',
98
+            ],
99
+            'data' => $champs
100
+        ]
101
+    );
102
+
103
+    $id_rubrique = sql_insertq('spip_rubriques', $champs);
104
+    pipeline(
105
+        'post_insertion',
106
+        [
107
+            'args' => [
108
+                'table' => 'spip_rubriques',
109
+                'id_objet' => $id_rubrique
110
+            ],
111
+            'data' => $champs
112
+        ]
113
+    );
114
+    propager_les_secteurs();
115
+    calculer_langues_rubriques();
116
+
117
+    // Appeler une notification
118
+    if ($notifications = charger_fonction('notifications', 'inc')) {
119
+        $notifications(
120
+            'rubrique_inserer',
121
+            $id_rubrique,
122
+            [
123
+                'id_parent' => $id_parent,
124
+                'champs' => $champs,
125
+            ]
126
+        );
127
+        $notifications(
128
+            'objet_inserer',
129
+            $id_rubrique,
130
+            [
131
+                'objet' => 'rubrique',
132
+                'id_objet' => $id_rubrique,
133
+                'id_parent' => $id_parent,
134
+                'champs' => $champs,
135
+            ]
136
+        );
137
+    }
138
+
139
+    return $id_rubrique;
140 140
 }
141 141
 
142 142
 /**
@@ -152,46 +152,46 @@  discard block
 block discarded – undo
152 152
  *     - chaîne : texte d'un message d'erreur
153 153
  */
154 154
 function rubrique_modifier($id_rubrique, $set = null) {
155
-	include_spip('inc/autoriser');
156
-	include_spip('inc/filtres');
157
-
158
-	include_spip('inc/modifier');
159
-	$c = collecter_requests(
160
-		// include list
161
-		objet_info('rubrique', 'champs_editables'),
162
-		// exclude list
163
-		['id_parent', 'confirme_deplace'],
164
-		// donnees eventuellement fournies
165
-		$set
166
-	);
167
-
168
-	if (
169
-		$err = objet_modifier_champs(
170
-			'rubrique',
171
-			$id_rubrique,
172
-			[
173
-			'data' => $set,
174
-			'nonvide' => ['titre' => _T('titre_nouvelle_rubrique') . ' ' . _T('info_numero_abbreviation') . $id_rubrique]
175
-			],
176
-			$c
177
-		)
178
-	) {
179
-		return $err;
180
-	}
181
-
182
-	$c = collecter_requests(['id_parent', 'confirme_deplace'], [], $set);
183
-	// Deplacer la rubrique
184
-	if (isset($c['id_parent'])) {
185
-		$err = rubrique_instituer($id_rubrique, $c);
186
-	}
187
-
188
-	// invalider les caches marques de cette rubrique
189
-	include_spip('inc/invalideur');
190
-	suivre_invalideur("id='rubrique/$id_rubrique'");
191
-	// et celui de menu_rubriques
192
-	effacer_meta('date_calcul_rubriques');
193
-
194
-	return $err;
155
+    include_spip('inc/autoriser');
156
+    include_spip('inc/filtres');
157
+
158
+    include_spip('inc/modifier');
159
+    $c = collecter_requests(
160
+        // include list
161
+        objet_info('rubrique', 'champs_editables'),
162
+        // exclude list
163
+        ['id_parent', 'confirme_deplace'],
164
+        // donnees eventuellement fournies
165
+        $set
166
+    );
167
+
168
+    if (
169
+        $err = objet_modifier_champs(
170
+            'rubrique',
171
+            $id_rubrique,
172
+            [
173
+            'data' => $set,
174
+            'nonvide' => ['titre' => _T('titre_nouvelle_rubrique') . ' ' . _T('info_numero_abbreviation') . $id_rubrique]
175
+            ],
176
+            $c
177
+        )
178
+    ) {
179
+        return $err;
180
+    }
181
+
182
+    $c = collecter_requests(['id_parent', 'confirme_deplace'], [], $set);
183
+    // Deplacer la rubrique
184
+    if (isset($c['id_parent'])) {
185
+        $err = rubrique_instituer($id_rubrique, $c);
186
+    }
187
+
188
+    // invalider les caches marques de cette rubrique
189
+    include_spip('inc/invalideur');
190
+    suivre_invalideur("id='rubrique/$id_rubrique'");
191
+    // et celui de menu_rubriques
192
+    effacer_meta('date_calcul_rubriques');
193
+
194
+    return $err;
195 195
 }
196 196
 
197 197
 /**
@@ -214,29 +214,29 @@  discard block
 block discarded – undo
214 214
  *     false si la confirmation du déplacement n'est pas présente
215 215
  */
216 216
 function editer_rubrique_breves($id_rubrique, $id_parent, $c = []) {
217
-	if (!sql_table_exists('spip_breves')) {
218
-		return true;
219
-	}
220
-
221
-	if (!sql_countsel('spip_breves', "id_rubrique=$id_rubrique")) {
222
-		return true;
223
-	}
224
-
225
-	if (empty($c['confirme_deplace']) || $c['confirme_deplace'] != 'oui') {
226
-		return false;
227
-	}
228
-
229
-	if (
230
-		$id_secteur = sql_getfetsel(
231
-			'id_secteur',
232
-			'spip_rubriques',
233
-			"id_rubrique=$id_parent"
234
-		)
235
-	) {
236
-		sql_updateq('spip_breves', ['id_rubrique' => $id_secteur], "id_rubrique=$id_rubrique");
237
-	}
238
-
239
-	return true;
217
+    if (!sql_table_exists('spip_breves')) {
218
+        return true;
219
+    }
220
+
221
+    if (!sql_countsel('spip_breves', "id_rubrique=$id_rubrique")) {
222
+        return true;
223
+    }
224
+
225
+    if (empty($c['confirme_deplace']) || $c['confirme_deplace'] != 'oui') {
226
+        return false;
227
+    }
228
+
229
+    if (
230
+        $id_secteur = sql_getfetsel(
231
+            'id_secteur',
232
+            'spip_rubriques',
233
+            "id_rubrique=$id_parent"
234
+        )
235
+    ) {
236
+        sql_updateq('spip_breves', ['id_rubrique' => $id_secteur], "id_rubrique=$id_rubrique");
237
+    }
238
+
239
+    return true;
240 240
 }
241 241
 
242 242
 
@@ -258,72 +258,72 @@  discard block
 block discarded – undo
258 258
  *     Chaîne : texte du message d'erreur
259 259
  */
260 260
 function rubrique_instituer($id_rubrique, $c) {
261
-	// traitement de la rubrique parente
262
-	// interdiction de deplacer vers ou a partir d'une rubrique
263
-	// qu'on n'administre pas.
264
-
265
-	if (null !== ($id_parent = $c['id_parent'])) {
266
-		$id_parent = (int) $id_parent;
267
-		$filles = calcul_branche_in($id_rubrique);
268
-		if (str_contains(",$id_parent,", (string) ",$filles,")) {
269
-			spip_log("La rubrique $id_rubrique ne peut etre fille de sa descendante $id_parent");
270
-		} else {
271
-			$s = sql_fetsel('id_parent, statut', 'spip_rubriques', "id_rubrique=$id_rubrique");
272
-			$old_parent = $s['id_parent'];
273
-
274
-			if (
275
-				!($id_parent != $old_parent
276
-				&& autoriser('publierdans', 'rubrique', $id_parent)
277
-				&& autoriser('creerrubriquedans', 'rubrique', $id_parent)
278
-				&& autoriser('publierdans', 'rubrique', $old_parent)
279
-				)
280
-			) {
281
-				if ($s['statut'] != 'prepa') {
282
-					spip_log("deplacement de $id_rubrique vers $id_parent refuse a " . $GLOBALS['visiteur_session']['id_auteur'] . ' ' . $GLOBALS['visiteur_session']['statut']);
283
-				}
284
-			} elseif (editer_rubrique_breves($id_rubrique, $id_parent, $c)) {
285
-				$statut_ancien = $s['statut'];
286
-				sql_updateq('spip_rubriques', ['id_parent' => $id_parent], "id_rubrique=$id_rubrique");
287
-
288
-
289
-				propager_les_secteurs();
290
-
291
-				// Deplacement d'une rubrique publiee ==> chgt general de leur statut
292
-				if ($statut_ancien == 'publie') {
293
-					calculer_rubriques_if($old_parent, ['id_rubrique' => $id_parent], ['statut_ancien' => $statut_ancien]);
294
-				}
295
-				// Creation ou deplacement d'une rubrique non publiee
296
-				// invalider le cache de leur menu
297
-				elseif (!$statut_ancien || $old_parent != $id_parent) {
298
-					effacer_meta('date_calcul_rubriques');
299
-				}
300
-
301
-				calculer_langues_rubriques();
302
-
303
-				// Appeler une notification
304
-				if ($notifications = charger_fonction('notifications', 'inc')) {
305
-					$notifications(
306
-						'rubrique_instituer',
307
-						$id_rubrique,
308
-						[
309
-							'statut_ancien' => $statut_ancien,
310
-							'id_parent_ancien' => $old_parent,
311
-						]
312
-					);
313
-					$notifications(
314
-						'objet_instituer',
315
-						$id_rubrique,
316
-						[
317
-							'objet' => 'rubrique',
318
-							'id_objet' => $id_rubrique,
319
-							'statut_ancien' => $statut_ancien,
320
-							'id_parent_ancien' => $old_parent,
321
-						]
322
-					);
323
-				}
324
-			}
325
-		}
326
-	}
327
-
328
-	return ''; // pas d'erreur
261
+    // traitement de la rubrique parente
262
+    // interdiction de deplacer vers ou a partir d'une rubrique
263
+    // qu'on n'administre pas.
264
+
265
+    if (null !== ($id_parent = $c['id_parent'])) {
266
+        $id_parent = (int) $id_parent;
267
+        $filles = calcul_branche_in($id_rubrique);
268
+        if (str_contains(",$id_parent,", (string) ",$filles,")) {
269
+            spip_log("La rubrique $id_rubrique ne peut etre fille de sa descendante $id_parent");
270
+        } else {
271
+            $s = sql_fetsel('id_parent, statut', 'spip_rubriques', "id_rubrique=$id_rubrique");
272
+            $old_parent = $s['id_parent'];
273
+
274
+            if (
275
+                !($id_parent != $old_parent
276
+                && autoriser('publierdans', 'rubrique', $id_parent)
277
+                && autoriser('creerrubriquedans', 'rubrique', $id_parent)
278
+                && autoriser('publierdans', 'rubrique', $old_parent)
279
+                )
280
+            ) {
281
+                if ($s['statut'] != 'prepa') {
282
+                    spip_log("deplacement de $id_rubrique vers $id_parent refuse a " . $GLOBALS['visiteur_session']['id_auteur'] . ' ' . $GLOBALS['visiteur_session']['statut']);
283
+                }
284
+            } elseif (editer_rubrique_breves($id_rubrique, $id_parent, $c)) {
285
+                $statut_ancien = $s['statut'];
286
+                sql_updateq('spip_rubriques', ['id_parent' => $id_parent], "id_rubrique=$id_rubrique");
287
+
288
+
289
+                propager_les_secteurs();
290
+
291
+                // Deplacement d'une rubrique publiee ==> chgt general de leur statut
292
+                if ($statut_ancien == 'publie') {
293
+                    calculer_rubriques_if($old_parent, ['id_rubrique' => $id_parent], ['statut_ancien' => $statut_ancien]);
294
+                }
295
+                // Creation ou deplacement d'une rubrique non publiee
296
+                // invalider le cache de leur menu
297
+                elseif (!$statut_ancien || $old_parent != $id_parent) {
298
+                    effacer_meta('date_calcul_rubriques');
299
+                }
300
+
301
+                calculer_langues_rubriques();
302
+
303
+                // Appeler une notification
304
+                if ($notifications = charger_fonction('notifications', 'inc')) {
305
+                    $notifications(
306
+                        'rubrique_instituer',
307
+                        $id_rubrique,
308
+                        [
309
+                            'statut_ancien' => $statut_ancien,
310
+                            'id_parent_ancien' => $old_parent,
311
+                        ]
312
+                    );
313
+                    $notifications(
314
+                        'objet_instituer',
315
+                        $id_rubrique,
316
+                        [
317
+                            'objet' => 'rubrique',
318
+                            'id_objet' => $id_rubrique,
319
+                            'statut_ancien' => $statut_ancien,
320
+                            'id_parent_ancien' => $old_parent,
321
+                        ]
322
+                    );
323
+                }
324
+            }
325
+        }
326
+    }
327
+
328
+    return ''; // pas d'erreur
329 329
 }
Please login to merge, or discard this patch.
ecrire/inc/config.php 3 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -312,8 +312,7 @@
 block discarded – undo
312 312
 					ecrire_meta($casier, $serialized_store, null, $table);
313 313
 				}
314 314
 			}
315
-		}
316
-		else {
315
+		} else {
317 316
 			ecrire_meta($casier, $store, null, $table);
318 317
 		}
319 318
 	}
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -303,9 +303,9 @@
 block discarded – undo
303 303
 			// et dans ce cas il faut verifier que l'ecriture en base a bien eu lieu a l'identique si il y a des planes dans la chaine
304 304
 			// car sinon ca casse le serialize PHP - par exemple si on est en mysql utf8 (non mb4)
305 305
 			if ($has_planes) {
306
-				$check_store = sql_getfetsel('valeur', 'spip_' . $table, 'nom=' . sql_quote($casier));
306
+				$check_store = sql_getfetsel('valeur', 'spip_'.$table, 'nom='.sql_quote($casier));
307 307
 				if ($check_store !== $serialized_store) {
308
-					array_walk_recursive($store, function (&$value, $key) {
308
+					array_walk_recursive($store, function(&$value, $key) {
309 309
 						if (is_string($value)) {
310 310
 							$value = utf8_noplanes($value);
311 311
 						}
Please login to merge, or discard this patch.
Indentation   +348 added lines, -348 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  **/
17 17
 
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
  * @return void
28 28
  */
29 29
 function inc_config_dist() {
30
-	actualise_metas(liste_metas());
30
+    actualise_metas(liste_metas());
31 31
 }
32 32
 
33 33
 /**
@@ -44,32 +44,32 @@  discard block
 block discarded – undo
44 44
  *     Liste (table, casier, sous_casier)
45 45
  */
46 46
 function expliquer_config($cfg) {
47
-	// par defaut, sur la table des meta
48
-	$table = 'meta';
49
-	$casier = null;
50
-	$sous_casier = [];
51
-	$cfg = explode('/', $cfg);
52
-
53
-	// si le premier argument est vide, c'est une syntaxe /table/ ou un appel vide ''
54
-	if (!reset($cfg) && count($cfg) > 1) {
55
-		array_shift($cfg);
56
-		$table = array_shift($cfg);
57
-		if (!isset($GLOBALS[$table])) {
58
-			lire_metas($table);
59
-		}
60
-	}
61
-
62
-	// si on a demande #CONFIG{/meta,'',0}
63
-	// pas sur un appel vide ''
64
-	if (count($cfg) && '' !== ($c = array_shift($cfg))) {
65
-		$casier = $c;
66
-	}
67
-
68
-	if ($cfg !== []) {
69
-		$sous_casier = $cfg;
70
-	}
71
-
72
-	return [$table, $casier, $sous_casier];
47
+    // par defaut, sur la table des meta
48
+    $table = 'meta';
49
+    $casier = null;
50
+    $sous_casier = [];
51
+    $cfg = explode('/', $cfg);
52
+
53
+    // si le premier argument est vide, c'est une syntaxe /table/ ou un appel vide ''
54
+    if (!reset($cfg) && count($cfg) > 1) {
55
+        array_shift($cfg);
56
+        $table = array_shift($cfg);
57
+        if (!isset($GLOBALS[$table])) {
58
+            lire_metas($table);
59
+        }
60
+    }
61
+
62
+    // si on a demande #CONFIG{/meta,'',0}
63
+    // pas sur un appel vide ''
64
+    if (count($cfg) && '' !== ($c = array_shift($cfg))) {
65
+        $casier = $c;
66
+    }
67
+
68
+    if ($cfg !== []) {
69
+        $sous_casier = $cfg;
70
+    }
71
+
72
+    return [$table, $casier, $sous_casier];
73 73
 }
74 74
 
75 75
 /**
@@ -97,63 +97,63 @@  discard block
 block discarded – undo
97 97
  *    Contenu de la configuration obtenue
98 98
  */
99 99
 function lire_config($cfg = '', mixed $def = null, $unserialize = true) {
100
-	// lire le stockage sous la forme /table/valeur
101
-	// ou valeur qui est en fait implicitement /meta/valeur
102
-	// ou casier/valeur qui est en fait implicitement /meta/casier/valeur
103
-
104
-	// traiter en priorite le cas simple et frequent
105
-	// de lecture direct $GLOBALS['meta']['truc'], si $cfg ne contient ni / ni :
106
-	if ($cfg && strpbrk($cfg, '/:') === false) {
107
-		return isset($GLOBALS['meta'][$cfg])
108
-			? (!$unserialize
109
-				// ne pas essayer de deserialiser autre chose qu'une chaine
110
-				|| !is_string($GLOBALS['meta'][$cfg])
111
-				// ne pas essayer de deserialiser si ce n'est visiblement pas une chaine serializee
112
-				|| !str_contains($GLOBALS['meta'][$cfg], ':')
113
-				|| ($t = @unserialize($GLOBALS['meta'][$cfg])) === false ? $GLOBALS['meta'][$cfg] : $t)
114
-			: $def;
115
-	}
116
-
117
-	// Brancher sur methodes externes si besoin
118
-	if ($cfg && ($p = strpos($cfg, '::'))) {
119
-		$methode = substr($cfg, 0, $p);
120
-		$lire_config = charger_fonction($methode, 'lire_config');
121
-
122
-		return $lire_config(substr($cfg, $p + 2), $def, $unserialize);
123
-	}
124
-
125
-	[$table, $casier, $sous_casier] = expliquer_config($cfg);
126
-
127
-	if (!isset($GLOBALS[$table])) {
128
-		return $def;
129
-	}
130
-
131
-	$r = $GLOBALS[$table];
132
-
133
-	// si on a demande #CONFIG{/meta,'',0}
134
-	if (!$casier) {
135
-		return $unserialize ? $r : serialize($r);
136
-	}
137
-
138
-	// casier principal :
139
-	// le deserializer si demande
140
-	// ou si on a besoin
141
-	// d'un sous casier
142
-	$r = $r[$casier] ?? null;
143
-	if (($unserialize || (is_countable($sous_casier) ? count($sous_casier) : 0)) && $r && is_string($r)) {
144
-		$r = (($t = @unserialize($r)) === false ? $r : $t);
145
-	}
146
-
147
-	// aller chercher le sous_casier
148
-	while (!is_null($r) && ($casier = array_shift($sous_casier))) {
149
-		$r = $r[$casier] ?? null;
150
-	}
151
-
152
-	if (is_null($r)) {
153
-		return $def;
154
-	}
155
-
156
-	return $r;
100
+    // lire le stockage sous la forme /table/valeur
101
+    // ou valeur qui est en fait implicitement /meta/valeur
102
+    // ou casier/valeur qui est en fait implicitement /meta/casier/valeur
103
+
104
+    // traiter en priorite le cas simple et frequent
105
+    // de lecture direct $GLOBALS['meta']['truc'], si $cfg ne contient ni / ni :
106
+    if ($cfg && strpbrk($cfg, '/:') === false) {
107
+        return isset($GLOBALS['meta'][$cfg])
108
+            ? (!$unserialize
109
+                // ne pas essayer de deserialiser autre chose qu'une chaine
110
+                || !is_string($GLOBALS['meta'][$cfg])
111
+                // ne pas essayer de deserialiser si ce n'est visiblement pas une chaine serializee
112
+                || !str_contains($GLOBALS['meta'][$cfg], ':')
113
+                || ($t = @unserialize($GLOBALS['meta'][$cfg])) === false ? $GLOBALS['meta'][$cfg] : $t)
114
+            : $def;
115
+    }
116
+
117
+    // Brancher sur methodes externes si besoin
118
+    if ($cfg && ($p = strpos($cfg, '::'))) {
119
+        $methode = substr($cfg, 0, $p);
120
+        $lire_config = charger_fonction($methode, 'lire_config');
121
+
122
+        return $lire_config(substr($cfg, $p + 2), $def, $unserialize);
123
+    }
124
+
125
+    [$table, $casier, $sous_casier] = expliquer_config($cfg);
126
+
127
+    if (!isset($GLOBALS[$table])) {
128
+        return $def;
129
+    }
130
+
131
+    $r = $GLOBALS[$table];
132
+
133
+    // si on a demande #CONFIG{/meta,'',0}
134
+    if (!$casier) {
135
+        return $unserialize ? $r : serialize($r);
136
+    }
137
+
138
+    // casier principal :
139
+    // le deserializer si demande
140
+    // ou si on a besoin
141
+    // d'un sous casier
142
+    $r = $r[$casier] ?? null;
143
+    if (($unserialize || (is_countable($sous_casier) ? count($sous_casier) : 0)) && $r && is_string($r)) {
144
+        $r = (($t = @unserialize($r)) === false ? $r : $t);
145
+    }
146
+
147
+    // aller chercher le sous_casier
148
+    while (!is_null($r) && ($casier = array_shift($sous_casier))) {
149
+        $r = $r[$casier] ?? null;
150
+    }
151
+
152
+    if (is_null($r)) {
153
+        return $def;
154
+    }
155
+
156
+    return $r;
157 157
 }
158 158
 
159 159
 /**
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
  * @return mixed
167 167
  */
168 168
 function lire_config_metapack_dist($cfg = '', mixed $def = null, $unserialize = true) {
169
-	return lire_config($cfg, $def, $unserialize);
169
+    return lire_config($cfg, $def, $unserialize);
170 170
 }
171 171
 
172 172
 
@@ -177,144 +177,144 @@  discard block
 block discarded – undo
177 177
  * @return bool
178 178
  */
179 179
 function ecrire_config($cfg, mixed $store) {
180
-	// Brancher sur methodes externes si besoin
181
-	if ($cfg && ($p = strpos($cfg, '::'))) {
182
-		$methode = substr($cfg, 0, $p);
183
-		$ecrire_config = charger_fonction($methode, 'ecrire_config');
184
-
185
-		return $ecrire_config(substr($cfg, $p + 2), $store);
186
-	}
187
-
188
-	[$table, $casier, $sous_casier] = expliquer_config($cfg);
189
-	// il faut au moins un casier pour ecrire
190
-	if (!$casier) {
191
-		return false;
192
-	}
193
-
194
-	// trouvons ou creons le pointeur sur le casier
195
-	$st = $GLOBALS[$table][$casier] ?? null;
196
-	if (!is_array($st) && ($sous_casier || is_array($store))) {
197
-		if ($st === null) {
198
-			// ne rien creer si c'est une demande d'effacement
199
-			if ($store === null) {
200
-				return false;
201
-			}
202
-			$st = [];
203
-		} else {
204
-			$st = unserialize($st);
205
-			if ($st === false) {
206
-				// ne rien creer si c'est une demande d'effacement
207
-				if ($store === null) {
208
-					return false;
209
-				}
210
-				$st = [];
211
-			}
212
-		}
213
-	}
214
-
215
-	$has_planes = false;
216
-	// si on a affaire a un sous caiser
217
-	// il faut ecrire au bon endroit sans perdre les autres sous casier freres
218
-	if ($c = $sous_casier) {
219
-		$sc = &$st;
220
-		$pointeurs = [];
221
-		while ((is_countable($c) ? count($c) : 0) && ($cc = array_shift($c))) {
222
-			// creer l'entree si elle n'existe pas
223
-			if (!isset($sc[$cc])) {
224
-				// si on essaye d'effacer une config qui n'existe pas
225
-				// ne rien creer mais sortir
226
-				if (is_null($store)) {
227
-					return false;
228
-				}
229
-				$sc[$cc] = [];
230
-			}
231
-			$pointeurs[$cc] = &$sc;
232
-			$sc = &$sc[$cc];
233
-		}
234
-
235
-		// si c'est une demande d'effacement
236
-		if (is_null($store)) {
237
-			$c = $sous_casier;
238
-			$sous = array_pop($c);
239
-			// effacer, et remonter pour effacer les parents vides
240
-			do {
241
-				unset($pointeurs[$sous][$sous]);
242
-			} while (($sous = array_pop($c)) && !(is_countable($pointeurs[$sous][$sous]) ? count($pointeurs[$sous][$sous]) : 0));
243
-
244
-			// si on a vide tous les sous casiers,
245
-			// et que le casier est vide
246
-			// vider aussi la meta
247
-			if (!$sous && !(is_countable($st) ? count($st) : 0)) {
248
-				$st = null;
249
-			}
250
-		} // dans tous les autres cas, on ecrase
251
-		else {
252
-			if (
253
-				defined('_MYSQL_NOPLANES')
254
-				&& _MYSQL_NOPLANES
255
-				&& !empty($GLOBALS['meta']['charset_sql_connexion'])
256
-				&& $GLOBALS['meta']['charset_sql_connexion'] == 'utf8'
257
-			) {
258
-				// detecter si la valeur qu'on veut ecrire a des planes
259
-				// @see utf8_noplanes
260
-				$serialized_store = (is_string($store) ? $store : serialize($store));
261
-				// un preg_match rapide pour voir si ca vaut le coup de lancer utf8_noplanes
262
-				if (preg_match(',[\xF0-\xF4],ms', $serialized_store)) {
263
-					if (!function_exists('utf8_noplanes')) {
264
-						include_spip('inc/charsets');
265
-					}
266
-					if ($serialized_store !== utf8_noplanes($serialized_store)) {
267
-						$has_planes = true;
268
-					}
269
-				}
270
-			}
271
-
272
-			$sc = $store;
273
-		}
274
-
275
-		// Maintenant que $st est modifiee
276
-		// reprenons la comme valeur a stocker dans le casier principal
277
-		$store = $st;
278
-	}
279
-
280
-	if (is_null($store)) {
281
-		if (is_null($st) && !$sous_casier) {
282
-			return false;
283
-		} // la config n'existait deja pas !
284
-		effacer_meta($casier, $table);
285
-		supprimer_table_meta($table); // supprimons la table (si elle est bien vide)
286
-	} // les meta ne peuvent etre que des chaines : il faut serializer le reste
287
-	else {
288
-		if (!isset($GLOBALS[$table])) {
289
-			installer_table_meta($table);
290
-		}
291
-		// si ce n'est pas une chaine
292
-		// il faut serializer
293
-		if (!is_string($store)) {
294
-			$serialized_store = serialize($store);
295
-			ecrire_meta($casier, $serialized_store, null, $table);
296
-			// et dans ce cas il faut verifier que l'ecriture en base a bien eu lieu a l'identique si il y a des planes dans la chaine
297
-			// car sinon ca casse le serialize PHP - par exemple si on est en mysql utf8 (non mb4)
298
-			if ($has_planes) {
299
-				$check_store = sql_getfetsel('valeur', 'spip_' . $table, 'nom=' . sql_quote($casier));
300
-				if ($check_store !== $serialized_store) {
301
-					array_walk_recursive($store, function (&$value, $key) {
302
-						if (is_string($value)) {
303
-							$value = utf8_noplanes($value);
304
-						}
305
-					});
306
-					$serialized_store = serialize($store);
307
-					ecrire_meta($casier, $serialized_store, null, $table);
308
-				}
309
-			}
310
-		}
311
-		else {
312
-			ecrire_meta($casier, $store, null, $table);
313
-		}
314
-	}
315
-
316
-	// verifier que lire_config($cfg)==$store ?
317
-	return true;
180
+    // Brancher sur methodes externes si besoin
181
+    if ($cfg && ($p = strpos($cfg, '::'))) {
182
+        $methode = substr($cfg, 0, $p);
183
+        $ecrire_config = charger_fonction($methode, 'ecrire_config');
184
+
185
+        return $ecrire_config(substr($cfg, $p + 2), $store);
186
+    }
187
+
188
+    [$table, $casier, $sous_casier] = expliquer_config($cfg);
189
+    // il faut au moins un casier pour ecrire
190
+    if (!$casier) {
191
+        return false;
192
+    }
193
+
194
+    // trouvons ou creons le pointeur sur le casier
195
+    $st = $GLOBALS[$table][$casier] ?? null;
196
+    if (!is_array($st) && ($sous_casier || is_array($store))) {
197
+        if ($st === null) {
198
+            // ne rien creer si c'est une demande d'effacement
199
+            if ($store === null) {
200
+                return false;
201
+            }
202
+            $st = [];
203
+        } else {
204
+            $st = unserialize($st);
205
+            if ($st === false) {
206
+                // ne rien creer si c'est une demande d'effacement
207
+                if ($store === null) {
208
+                    return false;
209
+                }
210
+                $st = [];
211
+            }
212
+        }
213
+    }
214
+
215
+    $has_planes = false;
216
+    // si on a affaire a un sous caiser
217
+    // il faut ecrire au bon endroit sans perdre les autres sous casier freres
218
+    if ($c = $sous_casier) {
219
+        $sc = &$st;
220
+        $pointeurs = [];
221
+        while ((is_countable($c) ? count($c) : 0) && ($cc = array_shift($c))) {
222
+            // creer l'entree si elle n'existe pas
223
+            if (!isset($sc[$cc])) {
224
+                // si on essaye d'effacer une config qui n'existe pas
225
+                // ne rien creer mais sortir
226
+                if (is_null($store)) {
227
+                    return false;
228
+                }
229
+                $sc[$cc] = [];
230
+            }
231
+            $pointeurs[$cc] = &$sc;
232
+            $sc = &$sc[$cc];
233
+        }
234
+
235
+        // si c'est une demande d'effacement
236
+        if (is_null($store)) {
237
+            $c = $sous_casier;
238
+            $sous = array_pop($c);
239
+            // effacer, et remonter pour effacer les parents vides
240
+            do {
241
+                unset($pointeurs[$sous][$sous]);
242
+            } while (($sous = array_pop($c)) && !(is_countable($pointeurs[$sous][$sous]) ? count($pointeurs[$sous][$sous]) : 0));
243
+
244
+            // si on a vide tous les sous casiers,
245
+            // et que le casier est vide
246
+            // vider aussi la meta
247
+            if (!$sous && !(is_countable($st) ? count($st) : 0)) {
248
+                $st = null;
249
+            }
250
+        } // dans tous les autres cas, on ecrase
251
+        else {
252
+            if (
253
+                defined('_MYSQL_NOPLANES')
254
+                && _MYSQL_NOPLANES
255
+                && !empty($GLOBALS['meta']['charset_sql_connexion'])
256
+                && $GLOBALS['meta']['charset_sql_connexion'] == 'utf8'
257
+            ) {
258
+                // detecter si la valeur qu'on veut ecrire a des planes
259
+                // @see utf8_noplanes
260
+                $serialized_store = (is_string($store) ? $store : serialize($store));
261
+                // un preg_match rapide pour voir si ca vaut le coup de lancer utf8_noplanes
262
+                if (preg_match(',[\xF0-\xF4],ms', $serialized_store)) {
263
+                    if (!function_exists('utf8_noplanes')) {
264
+                        include_spip('inc/charsets');
265
+                    }
266
+                    if ($serialized_store !== utf8_noplanes($serialized_store)) {
267
+                        $has_planes = true;
268
+                    }
269
+                }
270
+            }
271
+
272
+            $sc = $store;
273
+        }
274
+
275
+        // Maintenant que $st est modifiee
276
+        // reprenons la comme valeur a stocker dans le casier principal
277
+        $store = $st;
278
+    }
279
+
280
+    if (is_null($store)) {
281
+        if (is_null($st) && !$sous_casier) {
282
+            return false;
283
+        } // la config n'existait deja pas !
284
+        effacer_meta($casier, $table);
285
+        supprimer_table_meta($table); // supprimons la table (si elle est bien vide)
286
+    } // les meta ne peuvent etre que des chaines : il faut serializer le reste
287
+    else {
288
+        if (!isset($GLOBALS[$table])) {
289
+            installer_table_meta($table);
290
+        }
291
+        // si ce n'est pas une chaine
292
+        // il faut serializer
293
+        if (!is_string($store)) {
294
+            $serialized_store = serialize($store);
295
+            ecrire_meta($casier, $serialized_store, null, $table);
296
+            // et dans ce cas il faut verifier que l'ecriture en base a bien eu lieu a l'identique si il y a des planes dans la chaine
297
+            // car sinon ca casse le serialize PHP - par exemple si on est en mysql utf8 (non mb4)
298
+            if ($has_planes) {
299
+                $check_store = sql_getfetsel('valeur', 'spip_' . $table, 'nom=' . sql_quote($casier));
300
+                if ($check_store !== $serialized_store) {
301
+                    array_walk_recursive($store, function (&$value, $key) {
302
+                        if (is_string($value)) {
303
+                            $value = utf8_noplanes($value);
304
+                        }
305
+                    });
306
+                    $serialized_store = serialize($store);
307
+                    ecrire_meta($casier, $serialized_store, null, $table);
308
+                }
309
+            }
310
+        }
311
+        else {
312
+            ecrire_meta($casier, $store, null, $table);
313
+        }
314
+    }
315
+
316
+    // verifier que lire_config($cfg)==$store ?
317
+    return true;
318 318
 }
319 319
 
320 320
 
@@ -327,14 +327,14 @@  discard block
 block discarded – undo
327 327
  * @return bool
328 328
  */
329 329
 function ecrire_config_metapack_dist($cfg, mixed $store) {
330
-	// cas particulier en metapack::
331
-	// si on ecrit une chaine deja serializee, il faut la reserializer pour la rendre
332
-	// intacte en sortie ...
333
-	if (is_string($store) && strpos($store, ':') && unserialize($store)) {
334
-		$store = serialize($store);
335
-	}
336
-
337
-	return ecrire_config($cfg, $store);
330
+    // cas particulier en metapack::
331
+    // si on ecrit une chaine deja serializee, il faut la reserializer pour la rendre
332
+    // intacte en sortie ...
333
+    if (is_string($store) && strpos($store, ':') && unserialize($store)) {
334
+        $store = serialize($store);
335
+    }
336
+
337
+    return ecrire_config($cfg, $store);
338 338
 }
339 339
 
340 340
 /**
@@ -344,9 +344,9 @@  discard block
 block discarded – undo
344 344
  * @return bool
345 345
  */
346 346
 function effacer_config($cfg) {
347
-	ecrire_config($cfg, null);
347
+    ecrire_config($cfg, null);
348 348
 
349
-	return true;
349
+    return true;
350 350
 }
351 351
 
352 352
 /**
@@ -363,58 +363,58 @@  discard block
 block discarded – undo
363 363
  *    Couples nom de la `meta` => valeur par défaut
364 364
  */
365 365
 function liste_metas() {
366
-	return pipeline('configurer_liste_metas', [
367
-		'nom_site' => _T('info_mon_site_spip'),
368
-		'slogan_site' => '',
369
-		'adresse_site' => preg_replace(',/$,', '', (string) url_de_base()),
370
-		'descriptif_site' => '',
371
-		'activer_logos' => 'oui',
372
-		'activer_logos_survol' => 'non',
373
-		'articles_surtitre' => 'non',
374
-		'articles_soustitre' => 'non',
375
-		'articles_descriptif' => 'non',
376
-		'articles_chapeau' => 'non',
377
-		'articles_texte' => 'oui',
378
-		'articles_ps' => 'non',
379
-		'articles_redac' => 'non',
380
-		'post_dates' => 'non',
381
-		'articles_urlref' => 'non',
382
-		'articles_redirection' => 'non',
383
-		'creer_preview' => 'non',
384
-		'taille_preview' => 150,
385
-		'articles_modif' => 'non',
386
-
387
-		'rubriques_descriptif' => 'non',
388
-		'rubriques_texte' => 'oui',
389
-
390
-		'accepter_inscriptions' => 'non',
391
-		'accepter_visiteurs' => 'non',
392
-		'prevenir_auteurs' => 'non',
393
-		'suivi_edito' => 'non',
394
-		'adresse_suivi' => '',
395
-		'adresse_suivi_inscription' => '',
396
-		'adresse_neuf' => '',
397
-		'jours_neuf' => '',
398
-		'quoi_de_neuf' => 'non',
399
-		'preview' => ',0minirezo,1comite,',
400
-
401
-		'syndication_integrale' => 'oui',
402
-		'charset' => _DEFAULT_CHARSET,
403
-		'dir_img' => substr((string) _DIR_IMG, strlen(_DIR_RACINE)),
404
-
405
-		'multi_rubriques' => 'non',
406
-		'multi_secteurs' => 'non',
407
-		'gerer_trad' => 'non',
408
-		'langues_multilingue' => '',
409
-
410
-		'version_html_max' => 'html4',
411
-
412
-		'type_urls' => 'page',
413
-
414
-		'email_envoi' => '',
415
-		'email_webmaster' => '',
416
-		'auto_compress_http' => 'non',
417
-	]);
366
+    return pipeline('configurer_liste_metas', [
367
+        'nom_site' => _T('info_mon_site_spip'),
368
+        'slogan_site' => '',
369
+        'adresse_site' => preg_replace(',/$,', '', (string) url_de_base()),
370
+        'descriptif_site' => '',
371
+        'activer_logos' => 'oui',
372
+        'activer_logos_survol' => 'non',
373
+        'articles_surtitre' => 'non',
374
+        'articles_soustitre' => 'non',
375
+        'articles_descriptif' => 'non',
376
+        'articles_chapeau' => 'non',
377
+        'articles_texte' => 'oui',
378
+        'articles_ps' => 'non',
379
+        'articles_redac' => 'non',
380
+        'post_dates' => 'non',
381
+        'articles_urlref' => 'non',
382
+        'articles_redirection' => 'non',
383
+        'creer_preview' => 'non',
384
+        'taille_preview' => 150,
385
+        'articles_modif' => 'non',
386
+
387
+        'rubriques_descriptif' => 'non',
388
+        'rubriques_texte' => 'oui',
389
+
390
+        'accepter_inscriptions' => 'non',
391
+        'accepter_visiteurs' => 'non',
392
+        'prevenir_auteurs' => 'non',
393
+        'suivi_edito' => 'non',
394
+        'adresse_suivi' => '',
395
+        'adresse_suivi_inscription' => '',
396
+        'adresse_neuf' => '',
397
+        'jours_neuf' => '',
398
+        'quoi_de_neuf' => 'non',
399
+        'preview' => ',0minirezo,1comite,',
400
+
401
+        'syndication_integrale' => 'oui',
402
+        'charset' => _DEFAULT_CHARSET,
403
+        'dir_img' => substr((string) _DIR_IMG, strlen(_DIR_RACINE)),
404
+
405
+        'multi_rubriques' => 'non',
406
+        'multi_secteurs' => 'non',
407
+        'gerer_trad' => 'non',
408
+        'langues_multilingue' => '',
409
+
410
+        'version_html_max' => 'html4',
411
+
412
+        'type_urls' => 'page',
413
+
414
+        'email_envoi' => '',
415
+        'email_webmaster' => '',
416
+        'auto_compress_http' => 'non',
417
+    ]);
418 418
 }
419 419
 
420 420
 /**
@@ -425,43 +425,43 @@  discard block
 block discarded – undo
425 425
  * @return void
426 426
  */
427 427
 function actualise_metas($liste_meta) {
428
-	$meta_serveur =
429
-		[
430
-			'version_installee',
431
-			'adresse_site',
432
-			'alea_ephemere_ancien',
433
-			'alea_ephemere',
434
-			'alea_ephemere_date',
435
-			'langue_site',
436
-			'langues_proposees',
437
-			'date_calcul_rubriques',
438
-			'derniere_modif',
439
-			'optimiser_table',
440
-			'drapeau_edition',
441
-			'creer_preview',
442
-			'taille_preview',
443
-			'creer_htpasswd',
444
-			'creer_htaccess',
445
-			'gd_formats_read',
446
-			'gd_formats',
447
-			'netpbm_formats',
448
-			'formats_graphiques',
449
-			'image_process',
450
-			'plugin_header',
451
-			'plugin'
452
-		];
453
-	// verifier le impt=non
454
-	sql_updateq('spip_meta', ['impt' => 'non'], sql_in('nom', $meta_serveur));
455
-
456
-	foreach ($liste_meta as $nom => $valeur) {
457
-		if (empty($GLOBALS['meta'][$nom])) {
458
-			ecrire_meta($nom, $valeur);
459
-		}
460
-	}
461
-
462
-	include_spip('inc/rubriques');
463
-	$langues = calculer_langues_utilisees();
464
-	ecrire_meta('langues_utilisees', $langues);
428
+    $meta_serveur =
429
+        [
430
+            'version_installee',
431
+            'adresse_site',
432
+            'alea_ephemere_ancien',
433
+            'alea_ephemere',
434
+            'alea_ephemere_date',
435
+            'langue_site',
436
+            'langues_proposees',
437
+            'date_calcul_rubriques',
438
+            'derniere_modif',
439
+            'optimiser_table',
440
+            'drapeau_edition',
441
+            'creer_preview',
442
+            'taille_preview',
443
+            'creer_htpasswd',
444
+            'creer_htaccess',
445
+            'gd_formats_read',
446
+            'gd_formats',
447
+            'netpbm_formats',
448
+            'formats_graphiques',
449
+            'image_process',
450
+            'plugin_header',
451
+            'plugin'
452
+        ];
453
+    // verifier le impt=non
454
+    sql_updateq('spip_meta', ['impt' => 'non'], sql_in('nom', $meta_serveur));
455
+
456
+    foreach ($liste_meta as $nom => $valeur) {
457
+        if (empty($GLOBALS['meta'][$nom])) {
458
+            ecrire_meta($nom, $valeur);
459
+        }
460
+    }
461
+
462
+    include_spip('inc/rubriques');
463
+    $langues = calculer_langues_utilisees();
464
+    ecrire_meta('langues_utilisees', $langues);
465 465
 }
466 466
 
467 467
 
@@ -483,18 +483,18 @@  discard block
 block discarded – undo
483 483
  */
484 484
 function appliquer_modifs_config($purger_skel = false) {
485 485
 
486
-	foreach (liste_metas() as $i => $v) {
487
-		if (($x = _request($i)) !== null) {
488
-			ecrire_meta($i, $x);
489
-		} elseif (!isset($GLOBALS['meta'][$i])) {
490
-			ecrire_meta($i, $v);
491
-		}
492
-	}
493
-
494
-	if ($purger_skel) {
495
-		include_spip('inc/invalideur');
496
-		purger_repertoire(_DIR_SKELS);
497
-	}
486
+    foreach (liste_metas() as $i => $v) {
487
+        if (($x = _request($i)) !== null) {
488
+            ecrire_meta($i, $x);
489
+        } elseif (!isset($GLOBALS['meta'][$i])) {
490
+            ecrire_meta($i, $v);
491
+        }
492
+    }
493
+
494
+    if ($purger_skel) {
495
+        include_spip('inc/invalideur');
496
+        purger_repertoire(_DIR_SKELS);
497
+    }
498 498
 }
499 499
 
500 500
 /**
@@ -505,21 +505,21 @@  discard block
 block discarded – undo
505 505
  * @return string
506 506
  */
507 507
 function appliquer_adresse_site($adresse_site) {
508
-	if ($adresse_site !== null) {
509
-		if (!strlen($adresse_site)) {
510
-			$GLOBALS['profondeur_url'] = _DIR_RESTREINT ? 0 : 1;
511
-			$adresse_site = url_de_base();
512
-		}
513
-		$adresse_site = preg_replace(',/?\s*$,', '', (string) $adresse_site);
508
+    if ($adresse_site !== null) {
509
+        if (!strlen($adresse_site)) {
510
+            $GLOBALS['profondeur_url'] = _DIR_RESTREINT ? 0 : 1;
511
+            $adresse_site = url_de_base();
512
+        }
513
+        $adresse_site = preg_replace(',/?\s*$,', '', (string) $adresse_site);
514 514
 
515
-		if (!tester_url_absolue($adresse_site)) {
516
-			$adresse_site = "http://$adresse_site";
517
-		}
515
+        if (!tester_url_absolue($adresse_site)) {
516
+            $adresse_site = "http://$adresse_site";
517
+        }
518 518
 
519
-		$adresse_site = entites_html($adresse_site);
519
+        $adresse_site = entites_html($adresse_site);
520 520
 
521
-		ecrire_meta('adresse_site', $adresse_site);
522
-	}
521
+        ecrire_meta('adresse_site', $adresse_site);
522
+    }
523 523
 
524
-	return $adresse_site;
524
+    return $adresse_site;
525 525
 }
Please login to merge, or discard this patch.
ecrire/inc/commencer_page.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	$titre = '['
91 91
 		. $nom_site_spip
92 92
 		. ']'
93
-		. ($titre ? ' ' . textebrut(typo($titre)) : '');
93
+		. ($titre ? ' '.textebrut(typo($titre)) : '');
94 94
 
95 95
 	return _DOCTYPE_ECRIRE
96 96
 	. html_lang_attributes()
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 function init_body($rubrique = 'accueil', $sous_rubrique = 'accueil', $id_rubrique = '', $menu = true) {
134 134
 
135 135
 	$res = pipeline('body_prive', "<body class='"
136
-		. init_body_class() . ' ' . _request('exec') . "'"
136
+		. init_body_class().' '._request('exec')."'"
137 137
 		. ($GLOBALS['spip_lang_rtl'] ? " dir='rtl'" : '')
138 138
 		. '>');
139 139
 
Please login to merge, or discard this patch.
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  **/
17 17
 
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 /**
@@ -42,25 +42,25 @@  discard block
 block discarded – undo
42 42
  * @return string Code HTML
43 43
  **/
44 44
 function inc_commencer_page_dist(
45
-	$titre = '',
46
-	$rubrique = 'accueil',
47
-	$sous_rubrique = 'accueil',
48
-	$id_rubrique = '',
49
-	$menu = true,
50
-	$minipres = false,
51
-	$alertes = true
45
+    $titre = '',
46
+    $rubrique = 'accueil',
47
+    $sous_rubrique = 'accueil',
48
+    $id_rubrique = '',
49
+    $menu = true,
50
+    $minipres = false,
51
+    $alertes = true
52 52
 ) {
53 53
 
54
-	include_spip('inc/headers');
54
+    include_spip('inc/headers');
55 55
 
56
-	http_no_cache();
56
+    http_no_cache();
57 57
 
58
-	return init_entete($titre, $id_rubrique, $minipres)
59
-	. init_body($rubrique, $sous_rubrique, $id_rubrique, $menu)
60
-	. "<div id='page'>"
61
-	. auteurs_recemment_connectes($GLOBALS['connect_id_auteur'])
62
-	. ($alertes ? alertes_auteur($GLOBALS['connect_id_auteur']) : '')
63
-	. '<div class="largeur">';
58
+    return init_entete($titre, $id_rubrique, $minipres)
59
+    . init_body($rubrique, $sous_rubrique, $id_rubrique, $menu)
60
+    . "<div id='page'>"
61
+    . auteurs_recemment_connectes($GLOBALS['connect_id_auteur'])
62
+    . ($alertes ? alertes_auteur($GLOBALS['connect_id_auteur']) : '')
63
+    . '<div class="largeur">';
64 64
 }
65 65
 
66 66
 /**
@@ -81,21 +81,21 @@  discard block
 block discarded – undo
81 81
  *     Entête du fichier HTML avec le DOCTYPE
82 82
  */
83 83
 function init_entete($titre = '', $dummy = 0, $minipres = false) {
84
-	include_spip('inc/texte');
85
-	if (!$nom_site_spip = textebrut(typo($GLOBALS['meta']['nom_site']))) {
86
-		$nom_site_spip = _T('info_mon_site_spip');
87
-	}
88
-
89
-	$titre = '['
90
-		. $nom_site_spip
91
-		. ']'
92
-		. ($titre ? ' ' . textebrut(typo($titre)) : '');
93
-
94
-	return _DOCTYPE_ECRIRE
95
-	. html_lang_attributes()
96
-	. "<head>\n"
97
-	. init_head($titre, $dummy, $minipres)
98
-	. "</head>\n";
84
+    include_spip('inc/texte');
85
+    if (!$nom_site_spip = textebrut(typo($GLOBALS['meta']['nom_site']))) {
86
+        $nom_site_spip = _T('info_mon_site_spip');
87
+    }
88
+
89
+    $titre = '['
90
+        . $nom_site_spip
91
+        . ']'
92
+        . ($titre ? ' ' . textebrut(typo($titre)) : '');
93
+
94
+    return _DOCTYPE_ECRIRE
95
+    . html_lang_attributes()
96
+    . "<head>\n"
97
+    . init_head($titre, $dummy, $minipres)
98
+    . "</head>\n";
99 99
 }
100 100
 
101 101
 /**
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
  * @return string
110 110
  */
111 111
 function init_head($titre = '', $dummy = 0, $minipres = false) {
112
-	return recuperer_fond('prive/squelettes/head/dist', ['titre' => $titre, 'minipres' => $minipres ? ' ' : '']);
112
+    return recuperer_fond('prive/squelettes/head/dist', ['titre' => $titre, 'minipres' => $minipres ? ' ' : '']);
113 113
 }
114 114
 
115 115
 /**
@@ -131,20 +131,20 @@  discard block
 block discarded – undo
131 131
  */
132 132
 function init_body($rubrique = 'accueil', $sous_rubrique = 'accueil', $id_rubrique = '', $menu = true) {
133 133
 
134
-	$res = pipeline('body_prive', "<body class='"
135
-		. init_body_class() . ' ' . _request('exec') . "'"
136
-		. ($GLOBALS['spip_lang_rtl'] ? " dir='rtl'" : '')
137
-		. '>');
134
+    $res = pipeline('body_prive', "<body class='"
135
+        . init_body_class() . ' ' . _request('exec') . "'"
136
+        . ($GLOBALS['spip_lang_rtl'] ? " dir='rtl'" : '')
137
+        . '>');
138 138
 
139
-	if (!$menu) {
140
-		return $res;
141
-	}
139
+    if (!$menu) {
140
+        return $res;
141
+    }
142 142
 
143 143
 
144
-	$bandeau = charger_fonction('bandeau', 'inc');
144
+    $bandeau = charger_fonction('bandeau', 'inc');
145 145
 
146
-	return $res
147
-	. $bandeau();
146
+    return $res
147
+    . $bandeau();
148 148
 }
149 149
 
150 150
 /**
@@ -156,23 +156,23 @@  discard block
 block discarded – undo
156 156
  * @return string Classes CSS (séparées par des espaces)
157 157
  */
158 158
 function init_body_class() {
159
-	$display_modes = [
160
-		0 => 'icones_img_texte' // défaut.
161
-		/*init*/,
162
-		1 => 'icones_texte',
163
-		2 => 'icones_img_texte',
164
-		3 => 'icones_img'
165
-	];
159
+    $display_modes = [
160
+        0 => 'icones_img_texte' // défaut.
161
+        /*init*/,
162
+        1 => 'icones_texte',
163
+        2 => 'icones_img_texte',
164
+        3 => 'icones_img'
165
+    ];
166 166
 
167
-	$prefs = $GLOBALS['visiteur_session']['prefs'] ?? [];
167
+    $prefs = $GLOBALS['visiteur_session']['prefs'] ?? [];
168 168
 
169
-	$display_mode = $display_modes[(int) ($prefs['display'] ?? 0)] ?? $display_modes[0];
170
-	$spip_display_navigation = isset($prefs['display_navigation']) ? spip_sanitize_classname($prefs['display_navigation']) : 'navigation_avec_icones';
169
+    $display_mode = $display_modes[(int) ($prefs['display'] ?? 0)] ?? $display_modes[0];
170
+    $spip_display_navigation = isset($prefs['display_navigation']) ? spip_sanitize_classname($prefs['display_navigation']) : 'navigation_avec_icones';
171 171
 
172
-	$couleur = (int) ($prefs['couleur'] ?? 2);
172
+    $couleur = (int) ($prefs['couleur'] ?? 2);
173 173
 
174
-	$classes = "spip-theme-colors-$couleur $spip_display_navigation $display_mode";
175
-	return spip_sanitize_classname($classes);
174
+    $classes = "spip-theme-colors-$couleur $spip_display_navigation $display_mode";
175
+    return spip_sanitize_classname($classes);
176 176
 }
177 177
 
178 178
 
@@ -183,5 +183,5 @@  discard block
 block discarded – undo
183 183
  * @return string
184 184
  */
185 185
 function auteurs_recemment_connectes($id_auteur) {
186
-	return recuperer_fond('prive/objets/liste/auteurs_enligne');
186
+    return recuperer_fond('prive/objets/liste/auteurs_enligne');
187 187
 }
Please login to merge, or discard this patch.
ecrire/public/interfaces.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -813,9 +813,9 @@
 block discarded – undo
813 813
 	if (!defined('_TRAITEMENT_TYPO_SANS_NUMERO')) {
814 814
 		define('_TRAITEMENT_TYPO_SANS_NUMERO', 'supprimer_numero(typo(%s, "TYPO", $connect, $Pile[0]))');
815 815
 	}
816
-	$GLOBALS['table_des_traitements']['BIO'][] = 'safehtml(' . _TRAITEMENT_RACCOURCIS . ')';
816
+	$GLOBALS['table_des_traitements']['BIO'][] = 'safehtml('._TRAITEMENT_RACCOURCIS.')';
817 817
 	$GLOBALS['table_des_traitements']['NOM_SITE']['auteurs'] = 'entites_html(%s)';
818
-	$GLOBALS['table_des_traitements']['NOM']['auteurs'] = 'safehtml(' . _TRAITEMENT_TYPO_SANS_NUMERO . ')';
818
+	$GLOBALS['table_des_traitements']['NOM']['auteurs'] = 'safehtml('._TRAITEMENT_TYPO_SANS_NUMERO.')';
819 819
 	$GLOBALS['table_des_traitements']['CHAPO'][] = _TRAITEMENT_RACCOURCIS;
820 820
 	$GLOBALS['table_des_traitements']['DATE'][] = 'normaliser_date(%s)';
821 821
 	$GLOBALS['table_des_traitements']['DATE_REDAC'][] = 'normaliser_date(%s)';
Please login to merge, or discard this patch.
Indentation   +85 added lines, -85 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
 
@@ -48,90 +48,90 @@  discard block
 block discarded – undo
48 48
  */
49 49
 function declarer_interfaces() {
50 50
 
51
-	$GLOBALS['table_des_tables']['articles'] = 'articles';
52
-	$GLOBALS['table_des_tables']['auteurs'] = 'auteurs';
53
-	$GLOBALS['table_des_tables']['rubriques'] = 'rubriques';
54
-	$GLOBALS['table_des_tables']['hierarchie'] = 'rubriques';
55
-
56
-	// definition des statuts de publication
57
-	$GLOBALS['table_statut'] = [];
58
-
59
-	//
60
-	// tableau des tables de jointures
61
-	// Ex: gestion du critere {id_mot} dans la boucle(ARTICLES)
62
-	$GLOBALS['tables_jointures'] = [];
63
-	$GLOBALS['tables_jointures']['spip_jobs'][] = 'jobs_liens';
64
-
65
-	// $GLOBALS['exceptions_des_jointures']['titre_mot'] = array('spip_mots', 'titre'); // pour exemple
66
-	$GLOBALS['exceptions_des_jointures']['profondeur'] = ['spip_rubriques', 'profondeur'];
67
-
68
-
69
-	if (!defined('_TRAITEMENT_TYPO')) {
70
-		define('_TRAITEMENT_TYPO', 'typo(%s, "TYPO", $connect, $Pile[0])');
71
-	}
72
-	if (!defined('_TRAITEMENT_RACCOURCIS')) {
73
-		define('_TRAITEMENT_RACCOURCIS', 'propre(%s, $connect, $Pile[0])');
74
-	}
75
-	if (!defined('_TRAITEMENT_TYPO_SANS_NUMERO')) {
76
-		define('_TRAITEMENT_TYPO_SANS_NUMERO', 'supprimer_numero(typo(%s, "TYPO", $connect, $Pile[0]))');
77
-	}
78
-	$GLOBALS['table_des_traitements']['BIO'][] = 'safehtml(' . _TRAITEMENT_RACCOURCIS . ')';
79
-	$GLOBALS['table_des_traitements']['NOM_SITE']['auteurs'] = 'entites_html(%s)';
80
-	$GLOBALS['table_des_traitements']['NOM']['auteurs'] = 'safehtml(' . _TRAITEMENT_TYPO_SANS_NUMERO . ')';
81
-	$GLOBALS['table_des_traitements']['CHAPO'][] = _TRAITEMENT_RACCOURCIS;
82
-	$GLOBALS['table_des_traitements']['DATE'][] = 'normaliser_date(%s)';
83
-	$GLOBALS['table_des_traitements']['DATE_REDAC'][] = 'normaliser_date(%s)';
84
-	$GLOBALS['table_des_traitements']['DATE_MODIF'][] = 'normaliser_date(%s)';
85
-	$GLOBALS['table_des_traitements']['DATE_NOUVEAUTES'][] = 'normaliser_date(%s)';
86
-	$GLOBALS['table_des_traitements']['DESCRIPTIF'][] = _TRAITEMENT_RACCOURCIS;
87
-	$GLOBALS['table_des_traitements']['INTRODUCTION'][] = _TRAITEMENT_RACCOURCIS;
88
-	$GLOBALS['table_des_traitements']['NOM_SITE_SPIP'][] = _TRAITEMENT_TYPO;
89
-	$GLOBALS['table_des_traitements']['NOM'][] = _TRAITEMENT_TYPO_SANS_NUMERO;
90
-	$GLOBALS['table_des_traitements']['AUTEUR'][] = _TRAITEMENT_TYPO;
91
-	$GLOBALS['table_des_traitements']['PS'][] = _TRAITEMENT_RACCOURCIS;
92
-	$GLOBALS['table_des_traitements']['SOURCE'][] = _TRAITEMENT_TYPO;
93
-	$GLOBALS['table_des_traitements']['SOUSTITRE'][] = _TRAITEMENT_TYPO;
94
-	$GLOBALS['table_des_traitements']['SURTITRE'][] = _TRAITEMENT_TYPO;
95
-	$GLOBALS['table_des_traitements']['TAGS'][] = '%s';
96
-	$GLOBALS['table_des_traitements']['TEXTE'][] = _TRAITEMENT_RACCOURCIS;
97
-	$GLOBALS['table_des_traitements']['TITRE'][] = _TRAITEMENT_TYPO_SANS_NUMERO;
98
-	$GLOBALS['table_des_traitements']['TYPE'][] = _TRAITEMENT_TYPO;
99
-	$GLOBALS['table_des_traitements']['DESCRIPTIF_SITE_SPIP'][] = _TRAITEMENT_RACCOURCIS;
100
-	$GLOBALS['table_des_traitements']['SLOGAN_SITE_SPIP'][] = _TRAITEMENT_TYPO;
101
-	$GLOBALS['table_des_traitements']['ENV'][] = 'entites_html(%s,true)';
102
-
103
-	// valeur par defaut pour les balises non listees ci-dessus
104
-	$GLOBALS['table_des_traitements']['*'][] = false; // pas de traitement, mais permet au compilo de trouver la declaration suivante
105
-	// toujours securiser les DATA
106
-	$GLOBALS['table_des_traitements']['*']['DATA'] = 'safehtml(%s)';
107
-	// expliciter pour VALEUR qui est un champ calcule et ne sera pas protege par le catch-all *
108
-	$GLOBALS['table_des_traitements']['VALEUR']['DATA'] = 'safehtml(%s)';
109
-
110
-
111
-	// gerer l'affectation en 2 temps car si le pipe n'est pas encore declare, on ecrase les globales
112
-	$interfaces = pipeline(
113
-		'declarer_tables_interfaces',
114
-		[
115
-			'table_des_tables' => $GLOBALS['table_des_tables'],
116
-			'exceptions_des_tables' => $GLOBALS['exceptions_des_tables'],
117
-			'table_date' => $GLOBALS['table_date'],
118
-			'table_titre' => $GLOBALS['table_titre'],
119
-			'tables_jointures' => $GLOBALS['tables_jointures'],
120
-			'exceptions_des_jointures' => $GLOBALS['exceptions_des_jointures'],
121
-			'table_des_traitements' => $GLOBALS['table_des_traitements'],
122
-			'table_statut' => $GLOBALS['table_statut'],
123
-		]
124
-	);
125
-	if ($interfaces) {
126
-		$GLOBALS['table_des_tables'] = $interfaces['table_des_tables'];
127
-		$GLOBALS['exceptions_des_tables'] = $interfaces['exceptions_des_tables'];
128
-		$GLOBALS['table_date'] = $interfaces['table_date'];
129
-		$GLOBALS['table_titre'] = $interfaces['table_titre'];
130
-		$GLOBALS['tables_jointures'] = $interfaces['tables_jointures'];
131
-		$GLOBALS['exceptions_des_jointures'] = $interfaces['exceptions_des_jointures'];
132
-		$GLOBALS['table_des_traitements'] = $interfaces['table_des_traitements'];
133
-		$GLOBALS['table_statut'] = $interfaces['table_statut'];
134
-	}
51
+    $GLOBALS['table_des_tables']['articles'] = 'articles';
52
+    $GLOBALS['table_des_tables']['auteurs'] = 'auteurs';
53
+    $GLOBALS['table_des_tables']['rubriques'] = 'rubriques';
54
+    $GLOBALS['table_des_tables']['hierarchie'] = 'rubriques';
55
+
56
+    // definition des statuts de publication
57
+    $GLOBALS['table_statut'] = [];
58
+
59
+    //
60
+    // tableau des tables de jointures
61
+    // Ex: gestion du critere {id_mot} dans la boucle(ARTICLES)
62
+    $GLOBALS['tables_jointures'] = [];
63
+    $GLOBALS['tables_jointures']['spip_jobs'][] = 'jobs_liens';
64
+
65
+    // $GLOBALS['exceptions_des_jointures']['titre_mot'] = array('spip_mots', 'titre'); // pour exemple
66
+    $GLOBALS['exceptions_des_jointures']['profondeur'] = ['spip_rubriques', 'profondeur'];
67
+
68
+
69
+    if (!defined('_TRAITEMENT_TYPO')) {
70
+        define('_TRAITEMENT_TYPO', 'typo(%s, "TYPO", $connect, $Pile[0])');
71
+    }
72
+    if (!defined('_TRAITEMENT_RACCOURCIS')) {
73
+        define('_TRAITEMENT_RACCOURCIS', 'propre(%s, $connect, $Pile[0])');
74
+    }
75
+    if (!defined('_TRAITEMENT_TYPO_SANS_NUMERO')) {
76
+        define('_TRAITEMENT_TYPO_SANS_NUMERO', 'supprimer_numero(typo(%s, "TYPO", $connect, $Pile[0]))');
77
+    }
78
+    $GLOBALS['table_des_traitements']['BIO'][] = 'safehtml(' . _TRAITEMENT_RACCOURCIS . ')';
79
+    $GLOBALS['table_des_traitements']['NOM_SITE']['auteurs'] = 'entites_html(%s)';
80
+    $GLOBALS['table_des_traitements']['NOM']['auteurs'] = 'safehtml(' . _TRAITEMENT_TYPO_SANS_NUMERO . ')';
81
+    $GLOBALS['table_des_traitements']['CHAPO'][] = _TRAITEMENT_RACCOURCIS;
82
+    $GLOBALS['table_des_traitements']['DATE'][] = 'normaliser_date(%s)';
83
+    $GLOBALS['table_des_traitements']['DATE_REDAC'][] = 'normaliser_date(%s)';
84
+    $GLOBALS['table_des_traitements']['DATE_MODIF'][] = 'normaliser_date(%s)';
85
+    $GLOBALS['table_des_traitements']['DATE_NOUVEAUTES'][] = 'normaliser_date(%s)';
86
+    $GLOBALS['table_des_traitements']['DESCRIPTIF'][] = _TRAITEMENT_RACCOURCIS;
87
+    $GLOBALS['table_des_traitements']['INTRODUCTION'][] = _TRAITEMENT_RACCOURCIS;
88
+    $GLOBALS['table_des_traitements']['NOM_SITE_SPIP'][] = _TRAITEMENT_TYPO;
89
+    $GLOBALS['table_des_traitements']['NOM'][] = _TRAITEMENT_TYPO_SANS_NUMERO;
90
+    $GLOBALS['table_des_traitements']['AUTEUR'][] = _TRAITEMENT_TYPO;
91
+    $GLOBALS['table_des_traitements']['PS'][] = _TRAITEMENT_RACCOURCIS;
92
+    $GLOBALS['table_des_traitements']['SOURCE'][] = _TRAITEMENT_TYPO;
93
+    $GLOBALS['table_des_traitements']['SOUSTITRE'][] = _TRAITEMENT_TYPO;
94
+    $GLOBALS['table_des_traitements']['SURTITRE'][] = _TRAITEMENT_TYPO;
95
+    $GLOBALS['table_des_traitements']['TAGS'][] = '%s';
96
+    $GLOBALS['table_des_traitements']['TEXTE'][] = _TRAITEMENT_RACCOURCIS;
97
+    $GLOBALS['table_des_traitements']['TITRE'][] = _TRAITEMENT_TYPO_SANS_NUMERO;
98
+    $GLOBALS['table_des_traitements']['TYPE'][] = _TRAITEMENT_TYPO;
99
+    $GLOBALS['table_des_traitements']['DESCRIPTIF_SITE_SPIP'][] = _TRAITEMENT_RACCOURCIS;
100
+    $GLOBALS['table_des_traitements']['SLOGAN_SITE_SPIP'][] = _TRAITEMENT_TYPO;
101
+    $GLOBALS['table_des_traitements']['ENV'][] = 'entites_html(%s,true)';
102
+
103
+    // valeur par defaut pour les balises non listees ci-dessus
104
+    $GLOBALS['table_des_traitements']['*'][] = false; // pas de traitement, mais permet au compilo de trouver la declaration suivante
105
+    // toujours securiser les DATA
106
+    $GLOBALS['table_des_traitements']['*']['DATA'] = 'safehtml(%s)';
107
+    // expliciter pour VALEUR qui est un champ calcule et ne sera pas protege par le catch-all *
108
+    $GLOBALS['table_des_traitements']['VALEUR']['DATA'] = 'safehtml(%s)';
109
+
110
+
111
+    // gerer l'affectation en 2 temps car si le pipe n'est pas encore declare, on ecrase les globales
112
+    $interfaces = pipeline(
113
+        'declarer_tables_interfaces',
114
+        [
115
+            'table_des_tables' => $GLOBALS['table_des_tables'],
116
+            'exceptions_des_tables' => $GLOBALS['exceptions_des_tables'],
117
+            'table_date' => $GLOBALS['table_date'],
118
+            'table_titre' => $GLOBALS['table_titre'],
119
+            'tables_jointures' => $GLOBALS['tables_jointures'],
120
+            'exceptions_des_jointures' => $GLOBALS['exceptions_des_jointures'],
121
+            'table_des_traitements' => $GLOBALS['table_des_traitements'],
122
+            'table_statut' => $GLOBALS['table_statut'],
123
+        ]
124
+    );
125
+    if ($interfaces) {
126
+        $GLOBALS['table_des_tables'] = $interfaces['table_des_tables'];
127
+        $GLOBALS['exceptions_des_tables'] = $interfaces['exceptions_des_tables'];
128
+        $GLOBALS['table_date'] = $interfaces['table_date'];
129
+        $GLOBALS['table_titre'] = $interfaces['table_titre'];
130
+        $GLOBALS['tables_jointures'] = $interfaces['tables_jointures'];
131
+        $GLOBALS['exceptions_des_jointures'] = $interfaces['exceptions_des_jointures'];
132
+        $GLOBALS['table_des_traitements'] = $interfaces['table_des_traitements'];
133
+        $GLOBALS['table_statut'] = $interfaces['table_statut'];
134
+    }
135 135
 }
136 136
 
137 137
 declarer_interfaces();
Please login to merge, or discard this patch.