Completed
Push — master ( 0413e0...9052da )
by cam
01:14
created
ecrire/req/sqlite_fonctions.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 
251 251
 // https://code.spip.net/@_sqlite_func_preg_replace
252 252
 function _sqlite_func_preg_replace($quoi, $cherche, $remplace) {
253
-	$return = preg_replace('%' . $cherche . '%', $remplace, $quoi);
253
+	$return = preg_replace('%'.$cherche.'%', $remplace, $quoi);
254 254
 
255 255
 	#spip_log("preg_replace : $quoi, $cherche, $remplace, $return",'sqlite.'._LOG_DEBUG);
256 256
 	return $return;
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 	// il faut enlever un niveau d'echappement pour être homogène à mysql
309 309
 	$cherche = str_replace('\\\\', '\\', $cherche);
310 310
 	$u = isset($GLOBALS['meta']['pcre_u']) ? $GLOBALS['meta']['pcre_u'] : 'u';
311
-	$return = preg_match('%' . $cherche . '%imsS' . $u, $quoi);
311
+	$return = preg_match('%'.$cherche.'%imsS'.$u, $quoi);
312 312
 
313 313
 	#spip_log("regexp_replace : $quoi, $cherche, $remplace, $return",'sqlite.'._LOG_DEBUG);
314 314
 	return $return;
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 		$count = 0;
358 358
 		str_replace($mysql_to_strftime_not_ok, '', $conv, $count);
359 359
 		if ($count > 0) {
360
-			spip_log("DATE_FORMAT : At least one parameter can't be parsed by strftime with format '$conv'", 'sqlite.' . _LOG_ERREUR);
360
+			spip_log("DATE_FORMAT : At least one parameter can't be parsed by strftime with format '$conv'", 'sqlite.'._LOG_ERREUR);
361 361
 		}
362 362
 		$to_strftime[$conv] = str_replace(array_keys($mysql_to_strftime), $mysql_to_strftime, $conv);
363 363
 	}
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
  */
375 375
 function _sqlite_func_to_days($d) {
376 376
 	static $offset = 719528; // nb de jour entre 0000-00-00 et timestamp 0=1970-01-01
377
-	$result = $offset + (int)ceil(_sqlite_func_unix_timestamp($d) / (24 * 3600));
377
+	$result = $offset + (int) ceil(_sqlite_func_unix_timestamp($d) / (24 * 3600));
378 378
 
379 379
 	#spip_log("Passage avec TO_DAYS : $d, $result",'sqlite.'._LOG_DEBUG);
380 380
 	return $result;
Please login to merge, or discard this patch.
ecrire/req/sqlite_generique.php 1 patch
Spacing   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -64,27 +64,27 @@  discard block
 block discarded – undo
64 64
 	// determiner le dossier de la base : $addr ou _DIR_DB
65 65
 	$f = _DIR_DB;
66 66
 	if ($addr and strpos($addr, '/') !== false) {
67
-		$f = rtrim($addr, '/') . '/';
67
+		$f = rtrim($addr, '/').'/';
68 68
 	}
69 69
 
70 70
 	// un nom de base demande et impossible d'obtenir la base, on s'en va :
71 71
 	// il faut que la base existe ou que le repertoire parent soit writable
72
-	if ($db and !is_file($f .= $db . '.sqlite') and !is_writable(dirname($f))) {
73
-		spip_log("base $f non trouvee ou droits en ecriture manquants", 'sqlite.' . _LOG_HS);
72
+	if ($db and !is_file($f .= $db.'.sqlite') and !is_writable(dirname($f))) {
73
+		spip_log("base $f non trouvee ou droits en ecriture manquants", 'sqlite.'._LOG_HS);
74 74
 
75 75
 		return false;
76 76
 	}
77 77
 
78 78
 	// charger les modules sqlite au besoin
79 79
 	if (!_sqlite_charger_version($sqlite_version)) {
80
-		spip_log("Impossible de trouver/charger le module SQLite ($sqlite_version)!", 'sqlite.' . _LOG_HS);
80
+		spip_log("Impossible de trouver/charger le module SQLite ($sqlite_version)!", 'sqlite.'._LOG_HS);
81 81
 
82 82
 		return false;
83 83
 	}
84 84
 
85 85
 	// chargement des constantes
86 86
 	// il ne faut pas definir les constantes avant d'avoir charge les modules sqlite
87
-	$define = "spip_sqlite" . $sqlite_version . "_constantes";
87
+	$define = "spip_sqlite".$sqlite_version."_constantes";
88 88
 	$define();
89 89
 
90 90
 	$ok = false;
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 		// si pas de db ->
93 93
 		// base temporaire tant qu'on ne connait pas son vrai nom
94 94
 		// pour tester la connexion
95
-		$db = "_sqlite" . $sqlite_version . "_install";
96
-		$tmp = _DIR_DB . $db . ".sqlite";
95
+		$db = "_sqlite".$sqlite_version."_install";
96
+		$tmp = _DIR_DB.$db.".sqlite";
97 97
 		$ok = $link = new \PDO("sqlite:$tmp");
98 98
 	} else {
99 99
 		// Ouvrir (eventuellement creer la base)
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
 	if (!$ok) {
104 104
 		$e = _sqlite_last_error_from_link($link);
105
-		spip_log("Impossible d'ouvrir la base SQLite($sqlite_version) $f : $e", 'sqlite.' . _LOG_HS);
105
+		spip_log("Impossible d'ouvrir la base SQLite($sqlite_version) $f : $e", 'sqlite.'._LOG_HS);
106 106
 
107 107
 		return false;
108 108
 	}
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		$table = $regs[3];
189 189
 		$suite = $regs[4];
190 190
 	} else {
191
-		spip_log("SQLite : Probleme de ALTER TABLE mal forme dans $query", 'sqlite.' . _LOG_ERREUR);
191
+		spip_log("SQLite : Probleme de ALTER TABLE mal forme dans $query", 'sqlite.'._LOG_ERREUR);
192 192
 
193 193
 		return false;
194 194
 	}
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 	$i = 0;
206 206
 	$ouverte = false;
207 207
 	while ($do = array_shift($todo)) {
208
-		$todo2[$i] = isset($todo2[$i]) ? $todo2[$i] . "," . $do : $do;
208
+		$todo2[$i] = isset($todo2[$i]) ? $todo2[$i].",".$do : $do;
209 209
 		$o = (false !== strpos($do, "("));
210 210
 		$f = (false !== strpos($do, ")"));
211 211
 		if ($o and !$f) {
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 			. ')\s*([^\s]*)\s*(.*)?/i', $do, $matches)
230 230
 		) {
231 231
 			spip_log("SQLite : Probleme de ALTER TABLE, utilisation non reconnue dans : $do \n(requete d'origine : $query)",
232
-				'sqlite.' . _LOG_ERREUR);
232
+				'sqlite.'._LOG_ERREUR);
233 233
 
234 234
 			return false;
235 235
 		}
@@ -316,10 +316,10 @@  discard block
 block discarded – undo
316 316
 
317 317
 			// pas geres en sqlite2
318 318
 			case 'RENAME':
319
-				$do = "RENAME TO" . substr($do, 6);
319
+				$do = "RENAME TO".substr($do, 6);
320 320
 			case 'RENAME TO':
321 321
 				if (!spip_sqlite::executer_requete("$debut $do", $serveur)) {
322
-					spip_log("SQLite : Erreur ALTER TABLE / RENAME : $query", 'sqlite.' . _LOG_ERREUR);
322
+					spip_log("SQLite : Erreur ALTER TABLE / RENAME : $query", 'sqlite.'._LOG_ERREUR);
323 323
 
324 324
 					return false;
325 325
 				}
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 						$colonnes = substr($colonne_origine, 1, -1);
361 361
 						if (false !== strpos(",", $colonnes)) {
362 362
 							spip_log("SQLite : Erreur, impossible de creer un index sur plusieurs colonnes"
363
-								. " sans qu'il ait de nom ($table, ($colonnes))", 'sqlite.' . _LOG_ERREUR);
363
+								. " sans qu'il ait de nom ($table, ($colonnes))", 'sqlite.'._LOG_ERREUR);
364 364
 							break;
365 365
 						} else {
366 366
 							$nom_index = $colonnes;
@@ -375,12 +375,12 @@  discard block
 block discarded – undo
375 375
 
376 376
 			// pas geres en sqlite2
377 377
 			case 'ADD COLUMN':
378
-				$do = "ADD" . substr($do, 10);
378
+				$do = "ADD".substr($do, 10);
379 379
 			case 'ADD':
380 380
 			default:
381 381
 				if (!preg_match(',primary\s+key,i', $do)) {
382 382
 					if (!spip_sqlite::executer_requete("$debut $do", $serveur)) {
383
-						spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.' . _LOG_ERREUR);
383
+						spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.'._LOG_ERREUR);
384 384
 
385 385
 						return false;
386 386
 					}
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 					}
402 402
 					$opts['field'] = array($colonne_ajoutee => $def);
403 403
 					if (!_sqlite_modifier_table($table, array($colonne_ajoutee), $opts, $serveur)) {
404
-						spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.' . _LOG_ERREUR);
404
+						spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.'._LOG_ERREUR);
405 405
 
406 406
 						return false;
407 407
 					}
@@ -409,10 +409,10 @@  discard block
 block discarded – undo
409 409
 				break;
410 410
 		}
411 411
 		// tout est bon, ouf !
412
-		spip_log("SQLite ($serveur) : Changements OK : $debut $do", 'sqlite.' . _LOG_INFO);
412
+		spip_log("SQLite ($serveur) : Changements OK : $debut $do", 'sqlite.'._LOG_INFO);
413 413
 	}
414 414
 
415
-	spip_log("SQLite ($serveur) : fin ALTER TABLE OK !", 'sqlite.' . _LOG_INFO);
415
+	spip_log("SQLite ($serveur) : fin ALTER TABLE OK !", 'sqlite.'._LOG_INFO);
416 416
 
417 417
 	return true;
418 418
 }
@@ -481,9 +481,9 @@  discard block
 block discarded – undo
481 481
  * @return bool true si la base est créee.
482 482
  **/
483 483
 function spip_sqlite_create_base($nom, $serveur = '', $option = true) {
484
-	$f = $nom . '.sqlite';
484
+	$f = $nom.'.sqlite';
485 485
 	if (strpos($nom, "/") === false) {
486
-		$f = _DIR_DB . $f;
486
+		$f = _DIR_DB.$f;
487 487
 	}
488 488
 
489 489
 	$ok = new \PDO("sqlite:$f");
@@ -522,12 +522,12 @@  discard block
 block discarded – undo
522 522
 	// vue deja presente
523 523
 	if (sql_showtable($nom, false, $serveur)) {
524 524
 		spip_log("Echec creation d'une vue sql ($nom) car celle-ci existe deja (serveur:$serveur)",
525
-			'sqlite.' . _LOG_ERREUR);
525
+			'sqlite.'._LOG_ERREUR);
526 526
 
527 527
 		return false;
528 528
 	}
529 529
 
530
-	$query = "CREATE VIEW $nom AS " . $query_select;
530
+	$query = "CREATE VIEW $nom AS ".$query_select;
531 531
 
532 532
 	return spip_sqlite_query($query, $serveur, $requeter);
533 533
 }
@@ -552,15 +552,15 @@  discard block
 block discarded – undo
552 552
  */
553 553
 function spip_sqlite_create_index($nom, $table, $champs, $unique = '', $serveur = '', $requeter = true) {
554 554
 	if (!($nom or $table or $champs)) {
555
-		spip_log("Champ manquant pour creer un index sqlite ($nom, $table, (" . join(',', $champs) . "))",
556
-			'sqlite.' . _LOG_ERREUR);
555
+		spip_log("Champ manquant pour creer un index sqlite ($nom, $table, (".join(',', $champs)."))",
556
+			'sqlite.'._LOG_ERREUR);
557 557
 
558 558
 		return false;
559 559
 	}
560 560
 
561 561
 	// SQLite ne differentie pas noms des index en fonction des tables
562 562
 	// il faut donc creer des noms uniques d'index pour une base sqlite
563
-	$nom = $table . '_' . $nom;
563
+	$nom = $table.'_'.$nom;
564 564
 	// enlever d'eventuelles parentheses deja presentes sur champs
565 565
 	if (!is_array($champs)) {
566 566
 		if ($champs[0] == "(") {
@@ -582,12 +582,12 @@  discard block
 block discarded – undo
582 582
 	} else {
583 583
 		/* simuler le IF EXISTS - version 2 et sqlite < 3.3a */
584 584
 		$a = spip_sqlite_showtable($table, $serveur);
585
-		if (isset($a['key']['KEY ' . $nom])) {
585
+		if (isset($a['key']['KEY '.$nom])) {
586 586
 			return true;
587 587
 		}
588 588
 	}
589 589
 
590
-	$query = "CREATE " . ($unique ? "UNIQUE " : "") . "INDEX$ifnotexists $nom ON $table (" . join(',', $champs) . ")";
590
+	$query = "CREATE ".($unique ? "UNIQUE " : "")."INDEX$ifnotexists $nom ON $table (".join(',', $champs).")";
591 591
 	$res = spip_sqlite_query($query, $serveur, $requeter);
592 592
 	if (!$requeter) {
593 593
 		return $res;
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 	$serveur = '',
664 664
 	$requeter = true
665 665
 ) {
666
-	$c = !$groupby ? '*' : ('DISTINCT ' . (is_string($groupby) ? $groupby : join(',', $groupby)));
666
+	$c = !$groupby ? '*' : ('DISTINCT '.(is_string($groupby) ? $groupby : join(',', $groupby)));
667 667
 	$r = spip_sqlite_select("COUNT($c)", $from, $where, '', '', '',
668 668
 		$having, $serveur, $requeter);
669 669
 	if ((is_resource($r) or is_object($r)) && $requeter) { // ressource : sqlite2, object : sqlite3
@@ -761,14 +761,14 @@  discard block
 block discarded – undo
761 761
  */
762 762
 function spip_sqlite_drop_index($nom, $table, $serveur = '', $requeter = true) {
763 763
 	if (!($nom or $table)) {
764
-		spip_log("Champ manquant pour supprimer un index sqlite ($nom, $table)", 'sqlite.' . _LOG_ERREUR);
764
+		spip_log("Champ manquant pour supprimer un index sqlite ($nom, $table)", 'sqlite.'._LOG_ERREUR);
765 765
 
766 766
 		return false;
767 767
 	}
768 768
 
769 769
 	// SQLite ne differentie pas noms des index en fonction des tables
770 770
 	// il faut donc creer des noms uniques d'index pour une base sqlite
771
-	$index = $table . '_' . $nom;
771
+	$index = $table.'_'.$nom;
772 772
 	$exist = " IF EXISTS";
773 773
 
774 774
 	$query = "DROP INDEX$exist $index";
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
 	if ($s) {
801 801
 		$trace = debug_backtrace();
802 802
 		if ($trace[0]['function'] != "spip_sqlite_error") {
803
-			spip_log("$s - $query - " . sql_error_backtrace(), 'sqlite.' . _LOG_ERREUR);
803
+			spip_log("$s - $query - ".sql_error_backtrace(), 'sqlite.'._LOG_ERREUR);
804 804
 		}
805 805
 	}
806 806
 
@@ -847,14 +847,14 @@  discard block
 block discarded – undo
847 847
 		$t = $link->errorInfo();
848 848
 		$s = ltrim($t[0], '0'); // 00000 si pas d'erreur
849 849
 		if ($s) {
850
-			$s .= ' / ' . $t[1];
850
+			$s .= ' / '.$t[1];
851 851
 		} // ajoute l'erreur du moteur SQLite
852 852
 	} else {
853 853
 		$s = ": aucune ressource sqlite (link)";
854 854
 	}
855 855
 
856 856
 	if ($s) {
857
-		spip_log("Erreur sqlite $s", 'sqlite.' . _LOG_ERREUR);
857
+		spip_log("Erreur sqlite $s", 'sqlite.'._LOG_ERREUR);
858 858
 	}
859 859
 
860 860
 	return $s ? $s : 0;
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
 	}
879 879
 
880 880
 	$query = spip_sqlite::traduire_requete($query, $serveur);
881
-	$query = 'EXPLAIN ' . $query;
881
+	$query = 'EXPLAIN '.$query;
882 882
 	if (!$requeter) {
883 883
 		return $query;
884 884
 	}
@@ -1038,7 +1038,7 @@  discard block
 block discarded – undo
1038 1038
  **/
1039 1039
 function spip_sqlite_insert($table, $champs, $valeurs, $desc = array(), $serveur = '', $requeter = true) {
1040 1040
 
1041
-	$query = "INSERT INTO $table " . ($champs ? "$champs VALUES $valeurs" : "DEFAULT VALUES");
1041
+	$query = "INSERT INTO $table ".($champs ? "$champs VALUES $valeurs" : "DEFAULT VALUES");
1042 1042
 	if ($r = spip_sqlite_query($query, $serveur, $requeter)) {
1043 1043
 		if (!$requeter) {
1044 1044
 			return $r;
@@ -1094,8 +1094,8 @@  discard block
 block discarded – undo
1094 1094
 
1095 1095
 	$cles = $valeurs = "";
1096 1096
 	if (count($couples)) {
1097
-		$cles = "(" . join(',', array_keys($couples)) . ")";
1098
-		$valeurs = "(" . join(',', $couples) . ")";
1097
+		$cles = "(".join(',', array_keys($couples)).")";
1098
+		$valeurs = "(".join(',', $couples).")";
1099 1099
 	}
1100 1100
 
1101 1101
 	return spip_sqlite_insert($table, $cles, $valeurs, $desc, $serveur, $requeter);
@@ -1155,11 +1155,11 @@  discard block
 block discarded – undo
1155 1155
 
1156 1156
 		$champs = $valeurs = "";
1157 1157
 		if (count($couples)) {
1158
-			$champs = "(" . join(',', array_keys($couples)) . ")";
1159
-			$valeurs = "(" . join(',', $couples) . ")";
1160
-			$query = $query_start . "$champs VALUES $valeurs";
1158
+			$champs = "(".join(',', array_keys($couples)).")";
1159
+			$valeurs = "(".join(',', $couples).")";
1160
+			$query = $query_start."$champs VALUES $valeurs";
1161 1161
 		} else {
1162
-			$query = $query_start . "DEFAULT VALUES";
1162
+			$query = $query_start."DEFAULT VALUES";
1163 1163
 		}
1164 1164
 
1165 1165
 		if ($requeter) {
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
  * @return string       Texte de sélection pour la requête
1292 1292
  */
1293 1293
 function spip_sqlite_multi($objet, $lang) {
1294
-	$r = "EXTRAIRE_MULTI(" . $objet . ", '" . $lang . "') AS multi";
1294
+	$r = "EXTRAIRE_MULTI(".$objet.", '".$lang."') AS multi";
1295 1295
 
1296 1296
 	return $r;
1297 1297
 }
@@ -1362,7 +1362,7 @@  discard block
 block discarded – undo
1362 1362
 function spip_sqlite_date_proche($champ, $interval, $unite) {
1363 1363
 	$op = (($interval <= 0) ? '>' : '<');
1364 1364
 
1365
-	return "($champ $op datetime('" . date("Y-m-d H:i:s") . "', '$interval $unite'))";
1365
+	return "($champ $op datetime('".date("Y-m-d H:i:s")."', '$interval $unite'))";
1366 1366
 }
1367 1367
 
1368 1368
 
@@ -1392,7 +1392,7 @@  discard block
 block discarded – undo
1392 1392
 				and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c)
1393 1393
 			) {
1394 1394
 				spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT ''", $serveur);
1395
-				spip_log("ALTER $q", "repair" . _LOG_INFO_IMPORTANTE);
1395
+				spip_log("ALTER $q", "repair"._LOG_INFO_IMPORTANTE);
1396 1396
 			}
1397 1397
 			if (preg_match(",^(INTEGER),i", $d)
1398 1398
 				and stripos($d, "NOT NULL") !== false
@@ -1401,7 +1401,7 @@  discard block
 block discarded – undo
1401 1401
 				and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c)
1402 1402
 			) {
1403 1403
 				spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT '0'", $serveur);
1404
-				spip_log("ALTER $q", "repair" . _LOG_INFO_IMPORTANTE);
1404
+				spip_log("ALTER $q", "repair"._LOG_INFO_IMPORTANTE);
1405 1405
 			}
1406 1406
 			if (preg_match(",^(datetime),i", $d)
1407 1407
 				and stripos($d, "NOT NULL") !== false
@@ -1410,7 +1410,7 @@  discard block
 block discarded – undo
1410 1410
 				and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c)
1411 1411
 			) {
1412 1412
 				spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT '0000-00-00 00:00:00'", $serveur);
1413
-				spip_log("ALTER $q", "repair" . _LOG_INFO_IMPORTANTE);
1413
+				spip_log("ALTER $q", "repair"._LOG_INFO_IMPORTANTE);
1414 1414
 			}
1415 1415
 		}
1416 1416
 
@@ -1461,8 +1461,8 @@  discard block
 block discarded – undo
1461 1461
 	// recherche de champs 'timestamp' pour mise a jour auto de ceux-ci
1462 1462
 	$couples = _sqlite_ajouter_champs_timestamp($table, $couples, $desc, $serveur);
1463 1463
 
1464
-	return spip_sqlite_query("REPLACE INTO $table (" . join(',', array_keys($couples)) . ') VALUES (' . join(',',
1465
-			$couples) . ')', $serveur);
1464
+	return spip_sqlite_query("REPLACE INTO $table (".join(',', array_keys($couples)).') VALUES ('.join(',',
1465
+			$couples).')', $serveur);
1466 1466
 }
1467 1467
 
1468 1468
 
@@ -1548,7 +1548,7 @@  discard block
 block discarded – undo
1548 1548
 		. _sqlite_calculer_expression('WHERE', $where)
1549 1549
 		. _sqlite_calculer_expression('GROUP BY', $groupby, ',')
1550 1550
 		. _sqlite_calculer_expression('HAVING', $having)
1551
-		. ($orderby ? ("\nORDER BY " . _sqlite_calculer_order($orderby)) : '')
1551
+		. ($orderby ? ("\nORDER BY "._sqlite_calculer_order($orderby)) : '')
1552 1552
 		. ($limit ? "\nLIMIT $limit" : '');
1553 1553
 
1554 1554
 	// dans un select, on doit renvoyer la requête en cas d'erreur
@@ -1585,10 +1585,10 @@  discard block
 block discarded – undo
1585 1585
 
1586 1586
 	// interdire la creation d'une nouvelle base, 
1587 1587
 	// sauf si on est dans l'installation
1588
-	if (!is_file($f = _DIR_DB . $db . '.sqlite')
1588
+	if (!is_file($f = _DIR_DB.$db.'.sqlite')
1589 1589
 		&& (!defined('_ECRIRE_INSTALL') || !_ECRIRE_INSTALL)
1590 1590
 	) {
1591
-		spip_log("Il est interdit de creer la base $db", 'sqlite.' . _LOG_HS);
1591
+		spip_log("Il est interdit de creer la base $db", 'sqlite.'._LOG_HS);
1592 1592
 
1593 1593
 		return false;
1594 1594
 	}
@@ -1597,12 +1597,12 @@  discard block
 block discarded – undo
1597 1597
 	// avec les identifiants connus
1598 1598
 	$index = $serveur ? $serveur : 0;
1599 1599
 
1600
-	if ($link = spip_connect_db('', '', '', '', '@selectdb@' . $db, $serveur, '', '')) {
1600
+	if ($link = spip_connect_db('', '', '', '', '@selectdb@'.$db, $serveur, '', '')) {
1601 1601
 		if (($db == $link['db']) && $GLOBALS['connexions'][$index] = $link) {
1602 1602
 			return $db;
1603 1603
 		}
1604 1604
 	} else {
1605
-		spip_log("Impossible de selectionner la base $db", 'sqlite.' . _LOG_HS);
1605
+		spip_log("Impossible de selectionner la base $db", 'sqlite.'._LOG_HS);
1606 1606
 
1607 1607
 		return false;
1608 1608
 	}
@@ -1653,7 +1653,7 @@  discard block
 block discarded – undo
1653 1653
 	$match = str_replace("[[POURCENT]]", "%", $match);
1654 1654
 	$match = "^$match$";
1655 1655
 
1656
-	return spip_sqlite_query("SELECT name FROM sqlite_master WHERE type='table' AND tbl_name REGEXP " . _q($match),
1656
+	return spip_sqlite_query("SELECT name FROM sqlite_master WHERE type='table' AND tbl_name REGEXP "._q($match),
1657 1657
 		$serveur, $requeter);
1658 1658
 }
1659 1659
 
@@ -1743,7 +1743,7 @@  discard block
 block discarded – undo
1743 1743
 				// s'il y a une parenthèse fermante dans la clé
1744 1744
 				// ou dans la définition sans qu'il n'y ait une ouverture avant
1745 1745
 				if (false !== strpos($k, ')') or preg_match('/^[^\(]*\)/', $def)) {
1746
-					$fields[$k_precedent] .= ',' . $k . ' ' . $def;
1746
+					$fields[$k_precedent] .= ','.$k.' '.$def;
1747 1747
 					continue;
1748 1748
 				}
1749 1749
 
@@ -1778,13 +1778,13 @@  discard block
 block discarded – undo
1778 1778
 				. 'ORDER BY substr(type,2,1), name';
1779 1779
 			$a = spip_sqlite_query($query, $serveur, $requeter);
1780 1780
 			while ($r = spip_sqlite_fetch($a, null, $serveur)) {
1781
-				$key = str_replace($nom_table . '_', '', $r['name']); // enlever le nom de la table ajoute a l'index
1781
+				$key = str_replace($nom_table.'_', '', $r['name']); // enlever le nom de la table ajoute a l'index
1782 1782
 				$keytype = "KEY";
1783 1783
 				if (strpos($r['sql'], "UNIQUE INDEX") !== false) {
1784 1784
 					$keytype = "UNIQUE KEY";
1785 1785
 				}
1786 1786
 				$colonnes = preg_replace(',.*\((.*)\).*,', '$1', $r['sql']);
1787
-				$keys[$keytype . ' ' . $key] = $colonnes;
1787
+				$keys[$keytype.' '.$key] = $colonnes;
1788 1788
 			}
1789 1789
 		}
1790 1790
 
@@ -1833,7 +1833,7 @@  discard block
 block discarded – undo
1833 1833
 
1834 1834
 	$set = array();
1835 1835
 	foreach ($champs as $champ => $val) {
1836
-		$set[] = $champ . "=$val";
1836
+		$set[] = $champ."=$val";
1837 1837
 	}
1838 1838
 	if (!empty($set)) {
1839 1839
 		return spip_sqlite_query(
@@ -1884,7 +1884,7 @@  discard block
 block discarded – undo
1884 1884
 
1885 1885
 	$set = array();
1886 1886
 	foreach ($champs as $champ => $val) {
1887
-		$set[$champ] = $champ . '=' . _sqlite_calculer_cite($val, isset($fields[$champ]) ? $fields[$champ] : '');
1887
+		$set[$champ] = $champ.'='._sqlite_calculer_cite($val, isset($fields[$champ]) ? $fields[$champ] : '');
1888 1888
 	}
1889 1889
 
1890 1890
 	// recherche de champs 'timestamp' pour mise a jour auto de ceux-ci
@@ -1892,7 +1892,7 @@  discard block
 block discarded – undo
1892 1892
 	$maj = _sqlite_ajouter_champs_timestamp($table, [], $desc, $serveur);
1893 1893
 	foreach ($maj as $champ => $val) {
1894 1894
 		if (!isset($set[$champ])) {
1895
-			$set[$champ] = $champ . '=' . $val;
1895
+			$set[$champ] = $champ.'='.$val;
1896 1896
 		}
1897 1897
 	}
1898 1898
 
@@ -1919,7 +1919,7 @@  discard block
 block discarded – undo
1919 1919
  */
1920 1920
 function _sqlite_init() {
1921 1921
 	if (!defined('_DIR_DB')) {
1922
-		define('_DIR_DB', _DIR_ETC . 'bases/');
1922
+		define('_DIR_DB', _DIR_ETC.'bases/');
1923 1923
 	}
1924 1924
 	if (!defined('_SQLITE_CHMOD')) {
1925 1925
 		define('_SQLITE_CHMOD', _SPIP_CHMOD);
@@ -2025,9 +2025,9 @@  discard block
 block discarded – undo
2025 2025
 	}
2026 2026
 
2027 2027
 	// echapper les ' en ''
2028
-	spip_log("Pas de methode ->quote pour echapper", "sqlite." . _LOG_INFO_IMPORTANTE);
2028
+	spip_log("Pas de methode ->quote pour echapper", "sqlite."._LOG_INFO_IMPORTANTE);
2029 2029
 
2030
-	return ("'" . str_replace("'", "''", $v) . "'");
2030
+	return ("'".str_replace("'", "''", $v)."'");
2031 2031
 }
2032 2032
 
2033 2033
 
@@ -2050,12 +2050,12 @@  discard block
 block discarded – undo
2050 2050
 	$exp = "\n$expression ";
2051 2051
 
2052 2052
 	if (!is_array($v)) {
2053
-		return $exp . $v;
2053
+		return $exp.$v;
2054 2054
 	} else {
2055 2055
 		if (strtoupper($join) === 'AND') {
2056
-			return $exp . join("\n\t$join ", array_map('_sqlite_calculer_where', $v));
2056
+			return $exp.join("\n\t$join ", array_map('_sqlite_calculer_where', $v));
2057 2057
 		} else {
2058
-			return $exp . join($join, $v);
2058
+			return $exp.join($join, $v);
2059 2059
 		}
2060 2060
 	}
2061 2061
 }
@@ -2089,17 +2089,17 @@  discard block
 block discarded – undo
2089 2089
 		if (substr($k, -1) == '@') {
2090 2090
 			// c'est une jointure qui se refere au from precedent
2091 2091
 			// pas de virgule
2092
-			$res .= '  ' . $v;
2092
+			$res .= '  '.$v;
2093 2093
 		} else {
2094 2094
 			if (!is_numeric($k)) {
2095 2095
 				$p = strpos($v, " ");
2096 2096
 				if ($p) {
2097
-					$v = substr($v, 0, $p) . " AS '$k'" . substr($v, $p);
2097
+					$v = substr($v, 0, $p)." AS '$k'".substr($v, $p);
2098 2098
 				} else {
2099 2099
 					$v .= " AS '$k'";
2100 2100
 				}
2101 2101
 			}
2102
-			$res .= ', ' . $v;
2102
+			$res .= ', '.$v;
2103 2103
 		}
2104 2104
 	}
2105 2105
 
@@ -2237,13 +2237,13 @@  discard block
 block discarded – undo
2237 2237
 
2238 2238
 	$def_origine = sql_showtable($table_origine, false, $serveur);
2239 2239
 	if (!$def_origine or !isset($def_origine['field'])) {
2240
-		spip_log("Alter table impossible sur $table_origine : table non trouvee", 'sqlite' . _LOG_ERREUR);
2240
+		spip_log("Alter table impossible sur $table_origine : table non trouvee", 'sqlite'._LOG_ERREUR);
2241 2241
 
2242 2242
 		return false;
2243 2243
 	}
2244 2244
 
2245 2245
 
2246
-	$table_tmp = $table_origine . '_tmp';
2246
+	$table_tmp = $table_origine.'_tmp';
2247 2247
 
2248 2248
 	// 1) creer une table temporaire avec les modifications	
2249 2249
 	// - DROP : suppression de la colonne
@@ -2329,7 +2329,7 @@  discard block
 block discarded – undo
2329 2329
 		} else {
2330 2330
 			// enlever KEY
2331 2331
 			$k = substr($k, 4);
2332
-			$queries[] = "CREATE INDEX $table_destination" . "_$k ON $table_destination ($v)";
2332
+			$queries[] = "CREATE INDEX $table_destination"."_$k ON $table_destination ($v)";
2333 2333
 		}
2334 2334
 	}
2335 2335
 
@@ -2340,7 +2340,7 @@  discard block
 block discarded – undo
2340 2340
 		foreach ($queries as $q) {
2341 2341
 			if (!spip_sqlite::executer_requete($q, $serveur)) {
2342 2342
 				spip_log("SQLite : ALTER TABLE table :"
2343
-					. " Erreur a l'execution de la requete : $q", 'sqlite.' . _LOG_ERREUR);
2343
+					. " Erreur a l'execution de la requete : $q", 'sqlite.'._LOG_ERREUR);
2344 2344
 				spip_sqlite::annuler_transaction($serveur);
2345 2345
 
2346 2346
 				return false;
@@ -2429,27 +2429,27 @@  discard block
 block discarded – undo
2429 2429
 	$enum = "(\s*\([^\)]*\))?";
2430 2430
 
2431 2431
 	$remplace = array(
2432
-		'/enum' . $enum . '/is' => 'VARCHAR(255)',
2432
+		'/enum'.$enum.'/is' => 'VARCHAR(255)',
2433 2433
 		'/COLLATE \w+_bin/is' => 'COLLATE BINARY',
2434 2434
 		'/COLLATE \w+_ci/is' => 'COLLATE NOCASE',
2435 2435
 		'/auto_increment/is' => '',
2436 2436
 		'/current_timestamp\(\)/is' => 'CURRENT_TIMESTAMP', // Fix export depuis mariaDB #4374
2437 2437
 		'/(timestamp .* )ON .*$/is' => '\\1',
2438 2438
 		'/character set \w+/is' => '',
2439
-		'/((big|small|medium|tiny)?int(eger)?)' . $num . '\s*unsigned/is' => '\\1 UNSIGNED',
2439
+		'/((big|small|medium|tiny)?int(eger)?)'.$num.'\s*unsigned/is' => '\\1 UNSIGNED',
2440 2440
 		'/(text\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''",
2441
-		'/((char|varchar)' . $num . '\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''",
2441
+		'/((char|varchar)'.$num.'\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''",
2442 2442
 		'/(datetime\s+not\s+null)\s*$/is' => "\\1 DEFAULT '0000-00-00 00:00:00'",
2443 2443
 		'/(date\s+not\s+null)\s*$/is' => "\\1 DEFAULT '0000-00-00'",
2444 2444
 	);
2445 2445
 
2446 2446
 	// pour l'autoincrement, il faut des INTEGER NOT NULL PRIMARY KEY
2447 2447
 	$remplace_autocinc = array(
2448
-		'/(big|small|medium|tiny)?int(eger)?' . $num . '/is' => 'INTEGER'
2448
+		'/(big|small|medium|tiny)?int(eger)?'.$num.'/is' => 'INTEGER'
2449 2449
 	);
2450 2450
 	// pour les int non autoincrement, il faut un DEFAULT
2451 2451
 	$remplace_nonautocinc = array(
2452
-		'/((big|small|medium|tiny)?int(eger)?' . $num . '\s+not\s+null)\s*$/is' => "\\1 DEFAULT 0",
2452
+		'/((big|small|medium|tiny)?int(eger)?'.$num.'\s+not\s+null)\s*$/is' => "\\1 DEFAULT 0",
2453 2453
 	);
2454 2454
 
2455 2455
 	if (is_string($query)) {
@@ -2491,7 +2491,7 @@  discard block
 block discarded – undo
2491 2491
 		return str_ireplace("BINARY", "COLLATE BINARY", $champ);
2492 2492
 	}
2493 2493
 	if (preg_match(",^(char|varchar|(long|small|medium|tiny)?text),i", $champ)) {
2494
-		return $champ . " COLLATE NOCASE";
2494
+		return $champ." COLLATE NOCASE";
2495 2495
 	}
2496 2496
 
2497 2497
 	return $champ;
@@ -2578,7 +2578,7 @@  discard block
 block discarded – undo
2578 2578
 		} else {
2579 2579
 			/* simuler le IF EXISTS - version 2 et sqlite < 3.3a */
2580 2580
 			$a = spip_sqlite_showtable($nom, $serveur);
2581
-			if (isset($a['key']['KEY ' . $nom])) {
2581
+			if (isset($a['key']['KEY '.$nom])) {
2582 2582
 				return true;
2583 2583
 			}
2584 2584
 		}
@@ -2586,7 +2586,7 @@  discard block
 block discarded – undo
2586 2586
 	}
2587 2587
 
2588 2588
 	$temporary = $temporary ? ' TEMPORARY' : '';
2589
-	$q = "CREATE$temporary TABLE$ifnotexists $nom ($query" . ($keys ? ",$keys" : '') . ")\n";
2589
+	$q = "CREATE$temporary TABLE$ifnotexists $nom ($query".($keys ? ",$keys" : '').")\n";
2590 2590
 
2591 2591
 	return $q;
2592 2592
 }
@@ -2807,7 +2807,7 @@  discard block
 block discarded – undo
2807 2807
 		$this->serveur = strtolower($serveur);
2808 2808
 
2809 2809
 		if (!($this->link = _sqlite_link($this->serveur)) && (!defined('_ECRIRE_INSTALL') || !_ECRIRE_INSTALL)) {
2810
-			spip_log("Aucune connexion sqlite (link)", 'sqlite.' . _LOG_ERREUR);
2810
+			spip_log("Aucune connexion sqlite (link)", 'sqlite.'._LOG_ERREUR);
2811 2811
 
2812 2812
 			return false;
2813 2813
 		}
@@ -2853,7 +2853,7 @@  discard block
 block discarded – undo
2853 2853
 			try {
2854 2854
 				$r = $this->link->query($query);
2855 2855
 			} catch (\PDOException $e) {
2856
-				spip_log("PDOException: " . $e->getMessage(), 'sqlite.' . _LOG_DEBUG);
2856
+				spip_log("PDOException: ".$e->getMessage(), 'sqlite.'._LOG_DEBUG);
2857 2857
 				$r = false;
2858 2858
 			}
2859 2859
 			// sauvegarde de la requete (elle y est deja dans $r->queryString)
@@ -2874,11 +2874,11 @@  discard block
 block discarded – undo
2874 2874
 
2875 2875
 			// loger les warnings/erreurs eventuels de sqlite remontant dans PHP
2876 2876
 			if ($e and $e instanceof \PDOException) {
2877
-				$err = strip_tags($e->getMessage()) . " in " . $e->getFile() . " line " . $e->getLine();
2878
-				spip_log("$err - " . $query, 'sqlite.' . _LOG_ERREUR);
2877
+				$err = strip_tags($e->getMessage())." in ".$e->getFile()." line ".$e->getLine();
2878
+				spip_log("$err - ".$query, 'sqlite.'._LOG_ERREUR);
2879 2879
 			} elseif ($err = (function_exists('error_get_last') ? error_get_last() : "") and $err != $last_error) {
2880
-				$err = strip_tags($err['message']) . " in " . $err['file'] . " line " . $err['line'];
2881
-				spip_log("$err - " . $query, 'sqlite.' . _LOG_ERREUR);
2880
+				$err = strip_tags($err['message'])." in ".$err['file']." line ".$err['line'];
2881
+				spip_log("$err - ".$query, 'sqlite.'._LOG_ERREUR);
2882 2882
 			} else {
2883 2883
 				$err = "";
2884 2884
 			}
@@ -2957,15 +2957,15 @@  discard block
 block discarded – undo
2957 2957
 		// Correction Create Database
2958 2958
 		// Create Database -> requete ignoree
2959 2959
 		if (strpos($this->query, 'CREATE DATABASE') === 0) {
2960
-			spip_log("Sqlite : requete non executee -> $this->query", 'sqlite.' . _LOG_AVERTISSEMENT);
2960
+			spip_log("Sqlite : requete non executee -> $this->query", 'sqlite.'._LOG_AVERTISSEMENT);
2961 2961
 			$this->query = "SELECT 1";
2962 2962
 		}
2963 2963
 
2964 2964
 		// Correction Insert Ignore
2965 2965
 		// INSERT IGNORE -> insert (tout court et pas 'insert or replace')
2966 2966
 		if (strpos($this->query, 'INSERT IGNORE') === 0) {
2967
-			spip_log("Sqlite : requete transformee -> $this->query", 'sqlite.' . _LOG_DEBUG);
2968
-			$this->query = 'INSERT ' . substr($this->query, '13');
2967
+			spip_log("Sqlite : requete transformee -> $this->query", 'sqlite.'._LOG_DEBUG);
2968
+			$this->query = 'INSERT '.substr($this->query, '13');
2969 2969
 		}
2970 2970
 
2971 2971
 		// Correction des dates avec INTERVAL
@@ -2990,7 +2990,7 @@  discard block
 block discarded – undo
2990 2990
 		// problematique car la jointure ne se fait pas du coup.
2991 2991
 		if (($this->sqlite_version == 2) && (strpos($this->query, "USING") !== false)) {
2992 2992
 			spip_log("'USING (champ)' n'est pas reconnu en SQLite 2. Utilisez 'ON table1.champ = table2.champ'",
2993
-				'sqlite.' . _LOG_ERREUR);
2993
+				'sqlite.'._LOG_ERREUR);
2994 2994
 			$this->query = preg_replace('/USING\s*\([^\)]*\)/', '', $this->query);
2995 2995
 		}
2996 2996
 
@@ -3010,8 +3010,8 @@  discard block
 block discarded – undo
3010 3010
 		} else {
3011 3011
 			$suite = '';
3012 3012
 		}
3013
-		$pref = ($this->prefixe) ? $this->prefixe . "_" : "";
3014
-		$this->query = preg_replace('/([,\s])spip_/S', '\1' . $pref, $this->query) . $suite;
3013
+		$pref = ($this->prefixe) ? $this->prefixe."_" : "";
3014
+		$this->query = preg_replace('/([,\s])spip_/S', '\1'.$pref, $this->query).$suite;
3015 3015
 
3016 3016
 		// Correction zero AS x
3017 3017
 		// pg n'aime pas 0+x AS alias, sqlite, dans le meme style, 
Please login to merge, or discard this patch.
ecrire/public/criteres.php 1 patch
Spacing   +180 added lines, -188 removed lines patch added patch discarded remove patch
@@ -46,10 +46,9 @@  discard block
 block discarded – undo
46 46
 	$not = $crit->not;
47 47
 	$boucle = &$boucles[$idb];
48 48
 	$id_parent = isset($GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent']) ?
49
-		$GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] :
50
-		'id_parent';
49
+		$GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : 'id_parent';
51 50
 
52
-	$c = array("'='", "'$boucle->id_table." . "$id_parent'", 0);
51
+	$c = array("'='", "'$boucle->id_table."."$id_parent'", 0);
53 52
 	$boucle->where[] = ($crit->not ? array("'NOT'", $c) : $c);
54 53
 }
55 54
 
@@ -72,10 +71,10 @@  discard block
 block discarded – undo
72 71
 	$id = $boucle->primary;
73 72
 
74 73
 	if ($not or !$id) {
75
-		return (array('zbug_critere_inconnu', array('critere' => $not . $crit->op)));
74
+		return (array('zbug_critere_inconnu', array('critere' => $not.$crit->op)));
76 75
 	}
77 76
 	$arg = kwote(calculer_argument_precedent($idb, $id, $boucles));
78
-	$boucle->where[] = array("'!='", "'$boucle->id_table." . "$id'", $arg);
77
+	$boucle->where[] = array("'!='", "'$boucle->id_table."."$id'", $arg);
79 78
 }
80 79
 
81 80
 
@@ -106,12 +105,12 @@  discard block
 block discarded – undo
106 105
 	$not = ($crit->not ? '' : 'NOT');
107 106
 
108 107
 	// le doublon s'applique sur un type de boucle (article)
109
-	$nom = "'" . $boucle->type_requete . "'";
108
+	$nom = "'".$boucle->type_requete."'";
110 109
 
111 110
 	// compléter le nom avec un nom précisé {doublons nom}
112 111
 	// on obtient $nom = "'article' . 'nom'"
113 112
 	if (isset($crit->param[0])) {
114
-		$nom .= "." . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent);
113
+		$nom .= ".".calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent);
115 114
 	}
116 115
 
117 116
 	// code qui déclarera l'index du stockage de nos doublons (pour éviter une notice PHP)
@@ -123,13 +122,13 @@  discard block
 block discarded – undo
123 122
 	// $doublons et son index, ici $nom
124 123
 
125 124
 	// debut du code "sql_in('articles.id_article', "
126
-	$debut_in = "sql_in('" . $boucle->id_table . '.' . $primary . "', ";
125
+	$debut_in = "sql_in('".$boucle->id_table.'.'.$primary."', ";
127 126
 	// lecture des données du doublon "$doublons[$doublon_index[] = "
128 127
 	// Attention : boucle->doublons désigne une variable qu'on affecte
129
-	$debut_doub = '$doublons[' . (!$not ? '' : ($boucle->doublons . "[]= "));
128
+	$debut_doub = '$doublons['.(!$not ? '' : ($boucle->doublons."[]= "));
130 129
 
131 130
 	// le debut complet du code des doublons
132
-	$debut_doub = $debut_in . $debut_doub;
131
+	$debut_doub = $debut_in.$debut_doub;
133 132
 
134 133
 	// nom du doublon "('article' . 'nom')]"
135 134
 	$fin_doub = "($nom)]";
@@ -139,22 +138,22 @@  discard block
 block discarded – undo
139 138
 	foreach ($boucle->where as $k => $w) {
140 139
 		if (strpos($w[0], $debut_doub) === 0) {
141 140
 			// fusionner le sql_in (du where)
142
-			$boucle->where[$k][0] = $debut_doub . $fin_doub . ' . ' . substr($w[0], strlen($debut_in));
141
+			$boucle->where[$k][0] = $debut_doub.$fin_doub.' . '.substr($w[0], strlen($debut_in));
143 142
 			// fusionner l'initialisation (du hash) pour faire plus joli
144 143
 			$x = strpos($boucle->hash, $init_comment);
145 144
 			$len = strlen($init_comment);
146 145
 			$boucle->hash =
147
-				substr($boucle->hash, 0, $x + $len) . $init_code . substr($boucle->hash, $x + $len);
146
+				substr($boucle->hash, 0, $x + $len).$init_code.substr($boucle->hash, $x + $len);
148 147
 
149 148
 			return;
150 149
 		}
151 150
 	}
152 151
 
153 152
 	// mettre l'ensemble dans un tableau pour que ce ne soit pas vu comme une constante
154
-	$boucle->where[] = array($debut_doub . $fin_doub . ", '" . $not . "')");
153
+	$boucle->where[] = array($debut_doub.$fin_doub.", '".$not."')");
155 154
 
156 155
 	// déclarer le doublon s'il n'existe pas encore
157
-	$boucle->hash .= $init_comment . $init_code;
156
+	$boucle->hash .= $init_comment.$init_code;
158 157
 
159 158
 
160 159
 	# la ligne suivante avait l'intention d'eviter une collecte deja faite
@@ -215,10 +214,10 @@  discard block
 block discarded – undo
215 214
 	$un = $un[0]->texte;
216 215
 	$deux = $deux[0]->texte;
217 216
 	if ($deux) {
218
-		$boucles[$idb]->limit = 'intval($Pile[0]["debut' .
219
-			$un .
220
-			'"]) . ",' .
221
-			$deux .
217
+		$boucles[$idb]->limit = 'intval($Pile[0]["debut'.
218
+			$un.
219
+			'"]) . ",'.
220
+			$deux.
222 221
 			'"';
223 222
 	} else {
224 223
 		calculer_critere_DEFAUT_dist($idb, $boucles, $crit);
@@ -281,26 +280,26 @@  discard block
 block discarded – undo
281 280
 		$type = calculer_liste(array($crit->param[1][0]), $idb, $boucles, $boucle->id_parent);
282 281
 	}
283 282
 
284
-	$debut = ($type[0] !== "'") ? "'debut'.$type" : ("'debut" . substr($type, 1));
283
+	$debut = ($type[0] !== "'") ? "'debut'.$type" : ("'debut".substr($type, 1));
285 284
 	$boucle->modificateur['debut_nom'] = $type;
286 285
 	$partie =
287 286
 		// tester si le numero de page demande est de la forme '@yyy'
288
-		'isset($Pile[0][' . $debut . ']) ? $Pile[0][' . $debut . '] : _request(' . $debut . ");\n"
287
+		'isset($Pile[0]['.$debut.']) ? $Pile[0]['.$debut.'] : _request('.$debut.");\n"
289 288
 		. "\tif(substr(\$debut_boucle,0,1)=='@'){\n"
290
-		. "\t\t" . '$debut_boucle = $Pile[0][' . $debut . '] = quete_debut_pagination(\'' . $boucle->primary . '\',$Pile[0][\'@' . $boucle->primary . '\'] = substr($debut_boucle,1),' . $pas . ',$iter);' . "\n"
291
-		. "\t\t" . '$iter->seek(0);' . "\n"
289
+		. "\t\t".'$debut_boucle = $Pile[0]['.$debut.'] = quete_debut_pagination(\''.$boucle->primary.'\',$Pile[0][\'@'.$boucle->primary.'\'] = substr($debut_boucle,1),'.$pas.',$iter);'."\n"
290
+		. "\t\t".'$iter->seek(0);'."\n"
292 291
 		. "\t}\n"
293
-		. "\t" . '$debut_boucle = intval($debut_boucle)';
292
+		. "\t".'$debut_boucle = intval($debut_boucle)';
294 293
 
295 294
 	$boucle->hash .= '
296
-	$command[\'pagination\'] = array((isset($Pile[0][' . $debut . ']) ? $Pile[0][' . $debut . '] : null), ' . $pas . ');';
295
+	$command[\'pagination\'] = array((isset($Pile[0][' . $debut.']) ? $Pile[0]['.$debut.'] : null), '.$pas.');';
297 296
 
298 297
 	$boucle->total_parties = $pas;
299 298
 	calculer_parties($boucles, $idb, $partie, 'p+');
300 299
 	// ajouter la cle primaire dans le select pour pouvoir gerer la pagination referencee par @id
301 300
 	// sauf si pas de primaire, ou si primaire composee
302 301
 	// dans ce cas, on ne sait pas gerer une pagination indirecte
303
-	$t = $boucle->id_table . '.' . $boucle->primary;
302
+	$t = $boucle->id_table.'.'.$boucle->primary;
304 303
 	if ($boucle->primary
305 304
 		and !preg_match('/[,\s]/', $boucle->primary)
306 305
 		and !in_array($t, $boucle->select)
@@ -346,24 +345,24 @@  discard block
 block discarded – undo
346 345
 	$boucle->hash .= '
347 346
 	// RECHERCHE'
348 347
 		. ($crit->cond ? '
349
-	if (!strlen(' . $quoi . ')){
348
+	if (!strlen(' . $quoi.')){
350 349
 		list($rech_select, $rech_where) = array("0 as points","");
351
-	} else' : '') . '
350
+	} else' : '').'
352 351
 	{
353 352
 		$prepare_recherche = charger_fonction(\'prepare_recherche\', \'inc\');
354
-		list($rech_select, $rech_where) = $prepare_recherche(' . $quoi . ', "' . $boucle->id_table . '", "' . $crit->cond . '","' . $boucle->sql_serveur . '",' . $_modificateur . ',"' . $boucle->primary . '");
353
+		list($rech_select, $rech_where) = $prepare_recherche(' . $quoi.', "'.$boucle->id_table.'", "'.$crit->cond.'","'.$boucle->sql_serveur.'",'.$_modificateur.',"'.$boucle->primary.'");
355 354
 	}
356 355
 	';
357 356
 
358 357
 
359
-	$t = $boucle->id_table . '.' . $boucle->primary;
358
+	$t = $boucle->id_table.'.'.$boucle->primary;
360 359
 	if (!in_array($t, $boucles[$idb]->select)) {
361 360
 		$boucle->select[] = $t;
362 361
 	} # pour postgres, neuneu ici
363 362
 	// jointure uniquement sur le serveur principal
364 363
 	// (on ne peut joindre une table d'un serveur distant avec la table des resultats du serveur principal)
365 364
 	if (!$boucle->sql_serveur) {
366
-		$boucle->join['resultats'] = array("'" . $boucle->id_table . "'", "'id'", "'" . $boucle->primary . "'");
365
+		$boucle->join['resultats'] = array("'".$boucle->id_table."'", "'id'", "'".$boucle->primary."'");
367 366
 		$boucle->from['resultats'] = 'spip_resultats';
368 367
 	}
369 368
 	$boucle->select[] = '$rech_select';
@@ -430,7 +429,7 @@  discard block
 block discarded – undo
430 429
 	$c =
431 430
 		array(
432 431
 			"'OR'",
433
-			array("'='", "'$table." . "id_trad'", "'$table.$prim'"),
432
+			array("'='", "'$table."."id_trad'", "'$table.$prim'"),
434 433
 			array("'='", "'$table.id_trad'", "'0'")
435 434
 		);
436 435
 	$boucle->where[] = ($crit->not ? array("'NOT'", $c) : $c);
@@ -453,16 +452,15 @@  discard block
 block discarded – undo
453 452
 	$boucle = &$boucles[$idb];
454 453
 	$arg = kwote(calculer_argument_precedent($idb, 'id_parent', $boucles));
455 454
 	$id_parent = isset($GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent']) ?
456
-		$GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] :
457
-		'id_parent';
458
-	$mparent = $boucle->id_table . '.' . $id_parent;
455
+		$GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : 'id_parent';
456
+	$mparent = $boucle->id_table.'.'.$id_parent;
459 457
 
460 458
 	if ($boucle->type_requete == 'rubriques' or isset($GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'])) {
461 459
 		$boucle->where[] = array("'='", "'$mparent'", $arg);
462 460
 
463 461
 	} // le cas FORUMS est gere dans le plugin forum, dans la fonction critere_FORUMS_meme_parent_dist()
464 462
 	else {
465
-		return (array('zbug_critere_inconnu', array('critere' => $crit->op . ' ' . $boucle->type_requete)));
463
+		return (array('zbug_critere_inconnu', array('critere' => $crit->op.' '.$boucle->type_requete)));
466 464
 	}
467 465
 }
468 466
 
@@ -515,16 +513,15 @@  discard block
 block discarded – undo
515 513
 		if (count(trouver_champs_decomposes($champ, $desc)) > 1) {
516 514
 			$decompose = decompose_champ_id_objet($champ);
517 515
 			$champ = array_shift($decompose);
518
-			$boucle->where[] = array("'='", _q($cle . "." . reset($decompose)), '"' . sql_quote(end($decompose)) . '"');
516
+			$boucle->where[] = array("'='", _q($cle.".".reset($decompose)), '"'.sql_quote(end($decompose)).'"');
519 517
 		}
520 518
 	} else {
521 519
 		$cle = $boucle->id_table;
522 520
 	}
523 521
 
524
-	$c = "sql_in('$cle" . ".$champ', calcul_branche_in($arg)"
525
-		. ($not ? ", 'NOT'" : '') . ")";
526
-	$boucle->where[] = !$crit->cond ? $c :
527
-		("($arg ? $c : " . ($not ? "'0=1'" : "'1=1'") . ')');
522
+	$c = "sql_in('$cle".".$champ', calcul_branche_in($arg)"
523
+		. ($not ? ", 'NOT'" : '').")";
524
+	$boucle->where[] = !$crit->cond ? $c : ("($arg ? $c : ".($not ? "'0=1'" : "'1=1'").')');
528 525
 }
529 526
 
530 527
 /**
@@ -544,9 +541,9 @@  discard block
 block discarded – undo
544 541
 	$not = ($crit->not ? 'NOT' : '');
545 542
 	$serveur = $boucle->sql_serveur;
546 543
 
547
-	$c = "sql_in('" .
548
-		$boucle->id_table . '.' . $boucle->primary
549
-		. "', lister_objets_avec_logos('" . $boucle->primary . "'), '$not', '$serveur')";
544
+	$c = "sql_in('".
545
+		$boucle->id_table.'.'.$boucle->primary
546
+		. "', lister_objets_avec_logos('".$boucle->primary."'), '$not', '$serveur')";
550 547
 
551 548
 	$boucle->where[] = $c;
552 549
 }
@@ -578,7 +575,7 @@  discard block
 block discarded – undo
578 575
 				$t = table_objet_sql($r[1]);
579 576
 				$t = array_search($t, $boucles[$idb]->from);
580 577
 				if ($t) {
581
-					$t .= '.' . $r[2];
578
+					$t .= '.'.$r[2];
582 579
 				}
583 580
 			}
584 581
 		} else {
@@ -593,7 +590,7 @@  discard block
 block discarded – undo
593 590
 			$boucles[$idb]->select[] = $t;
594 591
 		}
595 592
 	} else {
596
-		return (array('zbug_critere_inconnu', array('critere' => $crit->op . ' ?')));
593
+		return (array('zbug_critere_inconnu', array('critere' => $crit->op.' ?')));
597 594
 	}
598 595
 }
599 596
 
@@ -613,7 +610,7 @@  discard block
 block discarded – undo
613 610
  * @param Critere $crit Paramètres du critère dans cette boucle
614 611
  * @return void
615 612
  **/
616
-function critere_fusion_supprimer_dist($idb, &$boucles, $crit){
613
+function critere_fusion_supprimer_dist($idb, &$boucles, $crit) {
617 614
 	$boucles[$idb]->group = array();
618 615
 }
619 616
 
@@ -663,26 +660,26 @@  discard block
 block discarded – undo
663 660
 				(false !== $i = strpos($boucle->order[$n - 1], 'ASC'))
664 661
 				OR (false !== $i = strpos($boucle->order[$n - 1], 'DESC'))
665 662
 			) {
666
-				$boucle->order[$n - 1] = substr_replace($boucle->order[$n - 1], "' . " . $boucle->modificateur['collate'] . " . ' ", $i, 0);
663
+				$boucle->order[$n - 1] = substr_replace($boucle->order[$n - 1], "' . ".$boucle->modificateur['collate']." . ' ", $i, 0);
667 664
 			} else {
668
-				$boucle->order[$n - 1] .= " . " . $boucle->modificateur['collate'];
665
+				$boucle->order[$n - 1] .= " . ".$boucle->modificateur['collate'];
669 666
 			}
670 667
 		}
671 668
 	} else {
672
-		return (array('zbug_critere_inconnu', array('critere' => $crit->op . " " . count($boucles[$idb]->order))));
669
+		return (array('zbug_critere_inconnu', array('critere' => $crit->op." ".count($boucles[$idb]->order))));
673 670
 	}
674 671
 }
675 672
 
676 673
 // https://code.spip.net/@calculer_critere_arg_dynamique
677 674
 function calculer_critere_arg_dynamique($idb, &$boucles, $crit, $suffix = '') {
678 675
 	$boucle = $boucles[$idb];
679
-	$alt = "('" . $boucle->id_table . '.\' . $x' . $suffix . ')';
680
-	$var = '$champs_' . $idb;
676
+	$alt = "('".$boucle->id_table.'.\' . $x'.$suffix.')';
677
+	$var = '$champs_'.$idb;
681 678
 	$desc = (strpos($boucle->in, "static $var =") !== false);
682 679
 	if (!$desc) {
683 680
 		$desc = $boucle->show['field'];
684 681
 		$desc = implode(',', array_map('_q', array_keys($desc)));
685
-		$boucles[$idb]->in .= "\n\tstatic $var = array(" . $desc . ");";
682
+		$boucles[$idb]->in .= "\n\tstatic $var = array(".$desc.");";
686 683
 	}
687 684
 	if ($desc) {
688 685
 		$alt = "(in_array(\$x, $var)  ? $alt :(\$x$suffix))";
@@ -757,7 +754,7 @@  discard block
 block discarded – undo
757 754
 		$sens = " . ' DESC'";
758 755
 	}
759 756
 	if (isset($boucle->modificateur['collate'])) {
760
-		$collecte = ' . ' . $boucle->modificateur['collate'];
757
+		$collecte = ' . '.$boucle->modificateur['collate'];
761 758
 	}
762 759
 
763 760
 	// Pour chaque paramètre du critère
@@ -779,14 +776,14 @@  discard block
 block discarded – undo
779 776
 			if (preg_match(",^(\w+)[\s]+(.*)$,", $par, $m)) {
780 777
 				$expression = trim($m[1]);
781 778
 				$champ = trim($m[2]);
782
-				if (function_exists($f = 'calculer_critere_par_expression_' . $expression)) {
779
+				if (function_exists($f = 'calculer_critere_par_expression_'.$expression)) {
783 780
 					$order = $f($idb, $boucles, $crit, $tri, $champ);
784 781
 				} else {
785
-					return array('zbug_critere_inconnu', array('critere' => $crit->op . " $par"));
782
+					return array('zbug_critere_inconnu', array('critere' => $crit->op." $par"));
786 783
 				}
787 784
 
788 785
 			// tris de la forme {par champ} ou {par FONCTION(champ)}
789
-			} elseif (preg_match(",^" . CHAMP_SQL_PLUS_FONC . '$,is', $par, $match)) {
786
+			} elseif (preg_match(",^".CHAMP_SQL_PLUS_FONC.'$,is', $par, $match)) {
790 787
 				// {par FONCTION(champ)}
791 788
 				if (count($match) > 2) {
792 789
 					$par = substr($match[2], 1, -1);
@@ -796,7 +793,7 @@  discard block
 block discarded – undo
796 793
 				if ($par == 'hasard') {
797 794
 					$order = calculer_critere_par_hasard($idb, $boucles, $crit);
798 795
 				} elseif ($par == 'date' and !empty($boucle->show['date'])) {
799
-					$order = "'" . $boucle->id_table . "." . $boucle->show['date'] . "'";
796
+					$order = "'".$boucle->id_table.".".$boucle->show['date']."'";
800 797
 				} else {
801 798
 					// cas général {par champ}, {par table.champ}, ...
802 799
 					$order = calculer_critere_par_champ($idb, $boucles, $crit, $par);
@@ -805,7 +802,7 @@  discard block
 block discarded – undo
805 802
 
806 803
 			// on ne sait pas traiter…
807 804
 			else {
808
-				return array('zbug_critere_inconnu', array('critere' => $crit->op . " $par"));
805
+				return array('zbug_critere_inconnu', array('critere' => $crit->op." $par"));
809 806
 			}
810 807
 
811 808
 			// En cas d'erreur de squelette retournée par une fonction
@@ -825,14 +822,14 @@  discard block
 block discarded – undo
825 822
 
826 823
 		if ($fct) {
827 824
 			if (preg_match("/^\s*'(.*)'\s*$/", $order, $r)) {
828
-				$order = "'$fct(" . $r[1] . ")'";
825
+				$order = "'$fct(".$r[1].")'";
829 826
 			} else {
830 827
 				$order = "'$fct(' . $order . ')'";
831 828
 			}
832 829
 		}
833
-		$t = $order . $collecte . $sens;
830
+		$t = $order.$collecte.$sens;
834 831
 		if (preg_match("/^(.*)'\s*\.\s*'([^']*')$/", $t, $r)) {
835
-			$t = $r[1] . $r[2];
832
+			$t = $r[1].$r[2];
836 833
 		}
837 834
 
838 835
 		$boucle->order[] = $t;
@@ -882,16 +879,16 @@  discard block
 block discarded – undo
882 879
 function calculer_critere_par_expression_num($idb, &$boucles, $crit, $tri, $champ) {
883 880
 	$_champ = calculer_critere_par_champ($idb, $boucles, $crit, $champ, true);
884 881
 	if (is_array($_champ)) {
885
-		return array('zbug_critere_inconnu', array('critere' => $crit->op . " num $champ"));
882
+		return array('zbug_critere_inconnu', array('critere' => $crit->op." num $champ"));
886 883
 	}
887 884
 	$boucle = &$boucles[$idb];
888
-	$texte = '0+' . $_champ;
885
+	$texte = '0+'.$_champ;
889 886
 	$suite = calculer_liste($tri, $idb, $boucles, $boucle->id_parent);
890 887
 	if ($suite !== "''") {
891
-		$texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')" . " . \"";
888
+		$texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')"." . \"";
892 889
 	}
893
-	$asnum = 'num' . ($boucle->order ? count($boucle->order) : "");
894
-	$boucle->select[] = $texte . " AS $asnum";
890
+	$asnum = 'num'.($boucle->order ? count($boucle->order) : "");
891
+	$boucle->select[] = $texte." AS $asnum";
895 892
 
896 893
 	$orderassinum = calculer_critere_par_expression_sinum($idb, $boucles, $crit, $tri, $champ);
897 894
 	$orderassinum = trim($orderassinum, "'");
@@ -920,13 +917,13 @@  discard block
 block discarded – undo
920 917
 function calculer_critere_par_expression_sinum($idb, &$boucles, $crit, $tri, $champ) {
921 918
 	$_champ = calculer_critere_par_champ($idb, $boucles, $crit, $champ, true);
922 919
 	if (is_array($_champ)) {
923
-		return array('zbug_critere_inconnu', array('critere' => $crit->op . " sinum $champ"));
920
+		return array('zbug_critere_inconnu', array('critere' => $crit->op." sinum $champ"));
924 921
 	}
925 922
 	$boucle = &$boucles[$idb];
926
-	$texte = '0+' . $_champ;
923
+	$texte = '0+'.$_champ;
927 924
 	$suite = calculer_liste($tri, $idb, $boucles, $boucle->id_parent);
928 925
 	if ($suite !== "''") {
929
-		$texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')" . " . \"";
926
+		$texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')"." . \"";
930 927
 	}
931 928
 
932 929
 	$as = false;
@@ -942,8 +939,8 @@  discard block
 block discarded – undo
942 939
 	}
943 940
 
944 941
 	if (!$as) {
945
-		$as = 'sinum' . ($boucle->order ? count($boucle->order) : "");
946
-		$boucle->select[] = $select . $as;
942
+		$as = 'sinum'.($boucle->order ? count($boucle->order) : "");
943
+		$boucle->select[] = $select.$as;
947 944
 	}
948 945
 	$order = "'$as'";
949 946
 	return $order;
@@ -968,10 +965,10 @@  discard block
 block discarded – undo
968 965
 function calculer_critere_par_expression_multi($idb, &$boucles, $crit, $tri, $champ) {
969 966
 	$_champ = calculer_critere_par_champ($idb, $boucles, $crit, $champ, true);
970 967
 	if (is_array($_champ)) {
971
-		return array('zbug_critere_inconnu', array('critere' => $crit->op . " multi $champ"));
968
+		return array('zbug_critere_inconnu', array('critere' => $crit->op." multi $champ"));
972 969
 	}
973 970
 	$boucle = &$boucles[$idb];
974
-	$boucle->select[] = "\".sql_multi('" . $_champ . "', \$GLOBALS['spip_lang']).\"";
971
+	$boucle->select[] = "\".sql_multi('".$_champ."', \$GLOBALS['spip_lang']).\"";
975 972
 	$order = "'multi'";
976 973
 	return $order;
977 974
 }
@@ -991,13 +988,13 @@  discard block
 block discarded – undo
991 988
  * @param bool $raw Retourne le champ pour le compilateur ("'alias.champ'") ou brut ('alias.champ')
992 989
  * @return array|string
993 990
  */
994
-function calculer_critere_par_champ($idb, &$boucles, $crit,  $par, $raw = false) {
991
+function calculer_critere_par_champ($idb, &$boucles, $crit, $par, $raw = false) {
995 992
 	$boucle = &$boucles[$idb];
996 993
 	$desc = $boucle->show;
997 994
 
998 995
 	// le champ existe dans la table, pas de souci (le plus commun)
999 996
 	if (isset($desc['field'][$par])) {
1000
-		$par = $boucle->id_table . "." . $par;
997
+		$par = $boucle->id_table.".".$par;
1001 998
 	}
1002 999
 	// le champ est peut être une jointure
1003 1000
 	else {
@@ -1018,24 +1015,24 @@  discard block
 block discarded – undo
1018 1015
 		// Sinon on cherche le champ dans les tables possibles de jointures
1019 1016
 		// Si la table est déjà dans le from, on la réutilise.
1020 1017
 		if ($infos = chercher_champ_dans_tables($champ, $boucle->from, $boucle->sql_serveur, $table)) {
1021
-			$par = $infos['alias'] . "." . $champ;
1018
+			$par = $infos['alias'].".".$champ;
1022 1019
 		} elseif (
1023 1020
 			$boucle->jointures_explicites
1024 1021
 			and $alias = trouver_jointure_champ($champ, $boucle, explode(' ', $boucle->jointures_explicites), false, $table)
1025 1022
 		) {
1026
-			$par = $alias . "." . $champ;
1023
+			$par = $alias.".".$champ;
1027 1024
 		} elseif ($alias = trouver_jointure_champ($champ, $boucle, $boucle->jointures, false, $table)) {
1028
-			$par = $alias . "." . $champ;
1025
+			$par = $alias.".".$champ;
1029 1026
 		// en spécifiant directement l'alias {par L2.titre} (situation hasardeuse tout de même)
1030 1027
 		} elseif (
1031 1028
 			$table_alias
1032 1029
 			and isset($boucle->from[$table_alias])
1033 1030
 			and $infos = chercher_champ_dans_tables($champ, $boucle->from, $boucle->sql_serveur, $boucle->from[$table_alias])
1034 1031
 		) {
1035
-			$par = $infos['alias'] . "." . $champ;
1032
+			$par = $infos['alias'].".".$champ;
1036 1033
 		} elseif ($table) {
1037 1034
 			// On avait table + champ, mais on ne les a pas trouvés
1038
-			return array('zbug_critere_inconnu', array('critere' => $crit->op . " $par"));
1035
+			return array('zbug_critere_inconnu', array('critere' => $crit->op." $par"));
1039 1036
 		} else {
1040 1037
 			// Sinon tant pis, ca doit etre un champ synthetise (cf points)
1041 1038
 		}
@@ -1059,7 +1056,7 @@  discard block
 block discarded – undo
1059 1056
 	if (!$t) {
1060 1057
 		$t = trouver_jointure_champ($champ, $boucle);
1061 1058
 	}
1062
-	return !$t ? '' : ("'" . $t . '.' . $champ . "'");
1059
+	return !$t ? '' : ("'".$t.'.'.$champ."'");
1063 1060
 }
1064 1061
 
1065 1062
 /**
@@ -1104,9 +1101,9 @@  discard block
 block discarded – undo
1104 1101
 				$boucle->default_order[] = ' DESC';
1105 1102
 			}
1106 1103
 		} else {
1107
-			$t = $boucle->order[$n - 1] . " . $order";
1104
+			$t = $boucle->order[$n - 1]." . $order";
1108 1105
 			if (preg_match("/^(.*)'\s*\.\s*'([^']*')$/", $t, $r)) {
1109
-				$t = $r[1] . $r[2];
1106
+				$t = $r[1].$r[2];
1110 1107
 			}
1111 1108
 			$boucle->order[$n - 1] = $t;
1112 1109
 		}
@@ -1120,11 +1117,11 @@  discard block
 block discarded – undo
1120 1117
  * @param $crit
1121 1118
  * @return array|string
1122 1119
  */
1123
-function critere_par_ordre_liste_dist($idb, &$boucles, $crit){
1120
+function critere_par_ordre_liste_dist($idb, &$boucles, $crit) {
1124 1121
 	$boucle = &$boucles[$idb];
1125 1122
 
1126 1123
 	$sens = $collecte = '';
1127
-	if ($crit->not){
1124
+	if ($crit->not) {
1128 1125
 		$sens = " . ' DESC'";
1129 1126
 	}
1130 1127
 
@@ -1134,14 +1131,14 @@  discard block
 block discarded – undo
1134 1131
 	$res = critere_parinverse($idb, $boucles, $crit2);
1135 1132
 
1136 1133
 	// erreur ?
1137
-	if (is_array($res)){
1134
+	if (is_array($res)) {
1138 1135
 		return $res;
1139 1136
 	}
1140 1137
 
1141 1138
 	$_order = array_pop($boucle->order);
1142 1139
 
1143 1140
 	$_liste = calculer_liste($crit->param[1], array(), $boucles, $boucles[$idb]->id_parent);
1144
-	$boucle->order[] = "'FIELD(' . $_order . ',' . ((\$zl=formate_liste_critere_par_ordre_liste($_liste,'" . $boucle->sql_serveur . "')) ? \$zl : '0').')'$sens";
1141
+	$boucle->order[] = "'FIELD(' . $_order . ',' . ((\$zl=formate_liste_critere_par_ordre_liste($_liste,'".$boucle->sql_serveur."')) ? \$zl : '0').')'$sens";
1145 1142
 }
1146 1143
 
1147 1144
 
@@ -1150,7 +1147,7 @@  discard block
 block discarded – undo
1150 1147
 	$params = $crit->param;
1151 1148
 
1152 1149
 	if (count($params) < 1) {
1153
-		return array('zbug_critere_inconnu', array('critere' => $crit->op . " ?"));
1150
+		return array('zbug_critere_inconnu', array('critere' => $crit->op." ?"));
1154 1151
 	}
1155 1152
 
1156 1153
 	$boucle = &$boucles[$idb];
@@ -1171,7 +1168,7 @@  discard block
 block discarded – undo
1171 1168
 	if ((count($date) == 1) and ($date[0]->type == 'texte')) {
1172 1169
 		$date = $date[0]->texte;
1173 1170
 		if (!isset($fields[$date])) {
1174
-			return array('zbug_critere_inconnu', array('critere' => $crit->op . " " . $date));
1171
+			return array('zbug_critere_inconnu', array('critere' => $crit->op." ".$date));
1175 1172
 		}
1176 1173
 	} else {
1177 1174
 		$a = calculer_liste($date, $idb, $boucles, $parent);
@@ -1183,38 +1180,38 @@  discard block
 block discarded – undo
1183 1180
 		$date = "'.(($cond)\n?\$a:\"$defaut\").'";
1184 1181
 	}
1185 1182
 	$annee = $params ? array_shift($params) : "";
1186
-	$annee = "\n" . 'sprintf("%04d", ($x = ' .
1187
-		calculer_liste($annee, $idb, $boucles, $parent) .
1183
+	$annee = "\n".'sprintf("%04d", ($x = '.
1184
+		calculer_liste($annee, $idb, $boucles, $parent).
1188 1185
 		') ? $x : date("Y"))';
1189 1186
 
1190 1187
 	$mois = $params ? array_shift($params) : "";
1191
-	$mois = "\n" . 'sprintf("%02d", ($x = ' .
1192
-		calculer_liste($mois, $idb, $boucles, $parent) .
1188
+	$mois = "\n".'sprintf("%02d", ($x = '.
1189
+		calculer_liste($mois, $idb, $boucles, $parent).
1193 1190
 		') ? $x : date("m"))';
1194 1191
 
1195 1192
 	$jour = $params ? array_shift($params) : "";
1196
-	$jour = "\n" . 'sprintf("%02d", ($x = ' .
1197
-		calculer_liste($jour, $idb, $boucles, $parent) .
1193
+	$jour = "\n".'sprintf("%02d", ($x = '.
1194
+		calculer_liste($jour, $idb, $boucles, $parent).
1198 1195
 		') ? $x : date("d"))';
1199 1196
 
1200 1197
 	$annee2 = $params ? array_shift($params) : "";
1201
-	$annee2 = "\n" . 'sprintf("%04d", ($x = ' .
1202
-		calculer_liste($annee2, $idb, $boucles, $parent) .
1198
+	$annee2 = "\n".'sprintf("%04d", ($x = '.
1199
+		calculer_liste($annee2, $idb, $boucles, $parent).
1203 1200
 		') ? $x : date("Y"))';
1204 1201
 
1205 1202
 	$mois2 = $params ? array_shift($params) : "";
1206
-	$mois2 = "\n" . 'sprintf("%02d", ($x = ' .
1207
-		calculer_liste($mois2, $idb, $boucles, $parent) .
1203
+	$mois2 = "\n".'sprintf("%02d", ($x = '.
1204
+		calculer_liste($mois2, $idb, $boucles, $parent).
1208 1205
 		') ? $x : date("m"))';
1209 1206
 
1210 1207
 	$jour2 = $params ? array_shift($params) : "";
1211
-	$jour2 = "\n" . 'sprintf("%02d", ($x = ' .
1212
-		calculer_liste($jour2, $idb, $boucles, $parent) .
1208
+	$jour2 = "\n".'sprintf("%02d", ($x = '.
1209
+		calculer_liste($jour2, $idb, $boucles, $parent).
1213 1210
 		') ? $x : date("d"))';
1214 1211
 
1215
-	$date = $boucle->id_table . ".$date";
1212
+	$date = $boucle->id_table.".$date";
1216 1213
 
1217
-	$quote_end = ",'" . $boucle->sql_serveur . "','text'";
1214
+	$quote_end = ",'".$boucle->sql_serveur."','text'";
1218 1215
 	if ($type == 'jour') {
1219 1216
 		$boucle->where[] = array(
1220 1217
 			"'='",
@@ -1286,14 +1283,13 @@  discard block
 block discarded – undo
1286 1283
 	list($a21, $a22) = calculer_critere_parties_aux($idb, $boucles, $a2);
1287 1284
 
1288 1285
 	if (($op == ',') && (is_numeric($a11) && (is_numeric($a21)))) {
1289
-		$boucle->limit = $a11 . ',' . $a21;
1286
+		$boucle->limit = $a11.','.$a21;
1290 1287
 	} else {
1291 1288
 		// 3 dans {1/3}, {2,3} ou {1,n-3}
1292 1289
 		$boucle->total_parties = ($a21 != 'n') ? $a21 : $a22;
1293 1290
 		// 2 dans {2/3}, {2,5}, {n-2,1}
1294 1291
 		$partie = ($a11 != 'n') ? $a11 : $a12;
1295
-		$mode = (($op == '/') ? '/' :
1296
-			(($a11 == 'n') ? '-' : '+') . (($a21 == 'n') ? '-' : '+'));
1292
+		$mode = (($op == '/') ? '/' : (($a11 == 'n') ? '-' : '+').(($a21 == 'n') ? '-' : '+'));
1297 1293
 		// cas simple {0,#ENV{truc}} compilons le en LIMIT :
1298 1294
 		if ($a11 !== 'n' and $a21 !== 'n' and $mode == "++" and $op == ',') {
1299 1295
 			$boucle->limit =
@@ -1339,8 +1335,7 @@  discard block
 block discarded – undo
1339 1335
 	// {1/3}
1340 1336
 	if ($op1 == '/') {
1341 1337
 		$pmoins1 = is_numeric($debut) ? ($debut - 1) : "($debut-1)";
1342
-		$totpos = is_numeric($total_parties) ? ($total_parties) :
1343
-			"($total_parties ? $total_parties : 1)";
1338
+		$totpos = is_numeric($total_parties) ? ($total_parties) : "($total_parties ? $total_parties : 1)";
1344 1339
 		$fin = "ceil(($nombre_boucle * $debut )/$totpos) - 1";
1345 1340
 		$debut = !$pmoins1 ? 0 : "ceil(($nombre_boucle * $pmoins1)/$totpos);";
1346 1341
 	} else {
@@ -1351,15 +1346,13 @@  discard block
 block discarded – undo
1351 1346
 
1352 1347
 		// cas {x,n-1}
1353 1348
 		if ($op2 == '-') {
1354
-			$fin = '$debut_boucle + ' . $nombre_boucle . ' - '
1355
-				. (is_numeric($total_parties) ? ($total_parties + 1) :
1356
-					($total_parties . ' - 1'));
1349
+			$fin = '$debut_boucle + '.$nombre_boucle.' - '
1350
+				. (is_numeric($total_parties) ? ($total_parties + 1) : ($total_parties.' - 1'));
1357 1351
 		} else {
1358 1352
 			// {x,1} ou {pagination}
1359 1353
 			$fin = '$debut_boucle'
1360 1354
 				. (is_numeric($total_parties) ?
1361
-					(($total_parties == 1) ? "" : (' + ' . ($total_parties - 1))) :
1362
-					('+' . $total_parties . ' - 1'));
1355
+					(($total_parties == 1) ? "" : (' + '.($total_parties - 1))) : ('+'.$total_parties.' - 1'));
1363 1356
 		}
1364 1357
 
1365 1358
 		// {pagination}, gerer le debut_xx=-1 pour tout voir
@@ -1377,11 +1370,11 @@  discard block
 block discarded – undo
1377 1370
 	// Utiliser min pour rabattre $fin_boucle sur total_boucle.
1378 1371
 
1379 1372
 	$boucles[$id_boucle]->mode_partie = "\n\t"
1380
-		. '$debut_boucle = ' . $debut . ";\n	"
1373
+		. '$debut_boucle = '.$debut.";\n	"
1381 1374
 		. "\$debut_boucle = intval(\$debut_boucle);\n	"
1382
-		. '$fin_boucle = min(' . $fin . ", \$Numrows['$id_boucle']['total'] - 1);\n	"
1383
-		. '$Numrows[\'' . $id_boucle . "']['grand_total'] = \$Numrows['$id_boucle']['total'];\n	"
1384
-		. '$Numrows[\'' . $id_boucle . '\']["total"] = max(0,$fin_boucle - $debut_boucle + 1);'
1375
+		. '$fin_boucle = min('.$fin.", \$Numrows['$id_boucle']['total'] - 1);\n	"
1376
+		. '$Numrows[\''.$id_boucle."']['grand_total'] = \$Numrows['$id_boucle']['total'];\n	"
1377
+		. '$Numrows[\''.$id_boucle.'\']["total"] = max(0,$fin_boucle - $debut_boucle + 1);'
1385 1378
 		. "\n\tif (\$debut_boucle>0"
1386 1379
 		. " AND \$debut_boucle < \$Numrows['$id_boucle']['grand_total']"
1387 1380
 		. " AND \$iter->seek(\$debut_boucle,'continue'))"
@@ -1466,16 +1459,16 @@  discard block
 block discarded – undo
1466 1459
 		// critere personnalise ?
1467 1460
 		if (
1468 1461
 			(!$serveur or
1469
-				((!function_exists($f = "critere_" . $serveur . "_" . $table . "_" . $critere))
1470
-					and (!function_exists($f = $f . "_dist"))
1471
-					and (!function_exists($f = "critere_" . $serveur . "_" . $critere))
1472
-					and (!function_exists($f = $f . "_dist"))
1462
+				((!function_exists($f = "critere_".$serveur."_".$table."_".$critere))
1463
+					and (!function_exists($f = $f."_dist"))
1464
+					and (!function_exists($f = "critere_".$serveur."_".$critere))
1465
+					and (!function_exists($f = $f."_dist"))
1473 1466
 				)
1474 1467
 			)
1475
-			and (!function_exists($f = "critere_" . $table . "_" . $critere))
1476
-			and (!function_exists($f = $f . "_dist"))
1477
-			and (!function_exists($f = "critere_" . $critere))
1478
-			and (!function_exists($f = $f . "_dist"))
1468
+			and (!function_exists($f = "critere_".$table."_".$critere))
1469
+			and (!function_exists($f = $f."_dist"))
1470
+			and (!function_exists($f = "critere_".$critere))
1471
+			and (!function_exists($f = $f."_dist"))
1479 1472
 		) {
1480 1473
 			// fonction critere standard
1481 1474
 			$f = $defaut;
@@ -1508,9 +1501,9 @@  discard block
 block discarded – undo
1508 1501
  */
1509 1502
 function kwote($lisp, $serveur = '', $type = '') {
1510 1503
 	if (preg_match(_CODE_QUOTE, $lisp, $r)) {
1511
-		return $r[1] . "\"" . sql_quote(str_replace(array("\\'", "\\\\"), array("'", "\\"), $r[2]), $serveur, $type) . "\"";
1504
+		return $r[1]."\"".sql_quote(str_replace(array("\\'", "\\\\"), array("'", "\\"), $r[2]), $serveur, $type)."\"";
1512 1505
 	} else {
1513
-		return "sql_quote($lisp, '$serveur', '" . str_replace("'", "\\'", $type) . "')";
1506
+		return "sql_quote($lisp, '$serveur', '".str_replace("'", "\\'", $type)."')";
1514 1507
 	}
1515 1508
 }
1516 1509
 
@@ -1532,7 +1525,7 @@  discard block
 block discarded – undo
1532 1525
 function critere_IN_dist($idb, &$boucles, $crit) {
1533 1526
 	$r = calculer_critere_infixe($idb, $boucles, $crit);
1534 1527
 	if (!$r) {
1535
-		return (array('zbug_critere_inconnu', array('critere' => $crit->op . " ?")));
1528
+		return (array('zbug_critere_inconnu', array('critere' => $crit->op." ?")));
1536 1529
 	}
1537 1530
 	list($arg, $op, $val, $col, $where_complement) = $r;
1538 1531
 
@@ -1559,8 +1552,8 @@  discard block
 block discarded – undo
1559 1552
 				"'NOT'",
1560 1553
 				array(
1561 1554
 					"'IN'",
1562
-					"'" . $boucles[$idb]->id_table . "." . $boucles[$idb]->primary . "'",
1563
-					array("'SELF'", "'" . $boucles[$idb]->id_table . "." . $boucles[$idb]->primary . "'", $where)
1555
+					"'".$boucles[$idb]->id_table.".".$boucles[$idb]->primary."'",
1556
+					array("'SELF'", "'".$boucles[$idb]->id_table.".".$boucles[$idb]->primary."'", $where)
1564 1557
 				)
1565 1558
 			);
1566 1559
 		}
@@ -1579,22 +1572,22 @@  discard block
 block discarded – undo
1579 1572
 	$descr = $boucles[$idb]->descr;
1580 1573
 	$cpt = &$num[$descr['nom']][$descr['gram']][$idb];
1581 1574
 
1582
-	$var = '$in' . $cpt++;
1575
+	$var = '$in'.$cpt++;
1583 1576
 	$x = "\n\t$var = array();";
1584 1577
 	foreach ($val as $k => $v) {
1585 1578
 		if (preg_match(",^(\n//.*\n)?'(.*)'$,", $v, $r)) {
1586 1579
 			// optimiser le traitement des constantes
1587 1580
 			if (is_numeric($r[2])) {
1588
-				$x .= "\n\t$var" . "[]= $r[2];";
1581
+				$x .= "\n\t$var"."[]= $r[2];";
1589 1582
 			} else {
1590
-				$x .= "\n\t$var" . "[]= " . sql_quote($r[2]) . ";";
1583
+				$x .= "\n\t$var"."[]= ".sql_quote($r[2]).";";
1591 1584
 			}
1592 1585
 		} else {
1593 1586
 			// Pour permettre de passer des tableaux de valeurs
1594 1587
 			// on repere l'utilisation brute de #ENV**{X},
1595 1588
 			// c'est-a-dire sa  traduction en ($PILE[0][X]).
1596 1589
 			// et on deballe mais en rajoutant l'anti XSS
1597
-			$x .= "\n\tif (!(is_array(\$a = ($v))))\n\t\t$var" . "[]= \$a;\n\telse $var = array_merge($var, \$a);";
1590
+			$x .= "\n\tif (!(is_array(\$a = ($v))))\n\t\t$var"."[]= \$a;\n\telse $var = array_merge($var, \$a);";
1598 1591
 		}
1599 1592
 	}
1600 1593
 
@@ -1608,7 +1601,7 @@  discard block
 block discarded – undo
1608 1601
 		$boucles[$idb]->default_order[] = "((!\$zqv=sql_quote($var) OR \$zqv===\"''\") ? 0 : ('FIELD($arg,' . \$zqv . ')'))";
1609 1602
 	}
1610 1603
 
1611
-	return "sql_in('$arg', $var" . ($crit2 == 'NOT' ? ",'NOT'" : "") . ")";
1604
+	return "sql_in('$arg', $var".($crit2 == 'NOT' ? ",'NOT'" : "").")";
1612 1605
 }
1613 1606
 
1614 1607
 /**
@@ -1681,7 +1674,7 @@  discard block
 block discarded – undo
1681 1674
 		$champs = array_diff($champs, array_keys($boucle->modificateur['criteres']));
1682 1675
 	}
1683 1676
 	// nous aider en mode debug.
1684
-	$boucle->debug[] = "id_ : " . implode(', ', $champs);
1677
+	$boucle->debug[] = "id_ : ".implode(', ', $champs);
1685 1678
 	$boucle->modificateur['id_'] = $champs;
1686 1679
 
1687 1680
 	// créer un critère {id_xxx?} de chaque champ retenu
@@ -1722,7 +1715,7 @@  discard block
 block discarded – undo
1722 1715
 	// Les champs id_xx de la table demandée
1723 1716
 	$champs = array_filter(
1724 1717
 		array_keys($desc['field']),
1725
-		function($champ){
1718
+		function($champ) {
1726 1719
 			return
1727 1720
 				strpos($champ, 'id_') === 0
1728 1721
 				or (in_array($champ, array('objet')));
@@ -1937,8 +1930,8 @@  discard block
 block discarded – undo
1937 1930
 				"'NOT'",
1938 1931
 				array(
1939 1932
 					"'IN'",
1940
-					"'" . $boucles[$idb]->id_table . "." . $boucles[$idb]->primary . "'",
1941
-					array("'SELF'", "'" . $boucles[$idb]->id_table . "." . $boucles[$idb]->primary . "'", $where)
1933
+					"'".$boucles[$idb]->id_table.".".$boucles[$idb]->primary."'",
1934
+					array("'SELF'", "'".$boucles[$idb]->id_table.".".$boucles[$idb]->primary."'", $where)
1942 1935
 				)
1943 1936
 			);
1944 1937
 		}
@@ -1949,7 +1942,7 @@  discard block
 block discarded – undo
1949 1942
 	if ($crit->cond) {
1950 1943
 		$pred = calculer_argument_precedent($idb, $col, $boucles);
1951 1944
 		if ($col == "date" or $col == "date_redac") {
1952
-			if ($pred == "\$Pile[0]['" . $col . "']") {
1945
+			if ($pred == "\$Pile[0]['".$col."']") {
1953 1946
 				$pred = "(\$Pile[0]['{$col}_default']?'':$pred)";
1954 1947
 			}
1955 1948
 		}
@@ -2110,7 +2103,7 @@  discard block
 block discarded – undo
2110 2103
 		// defaire le quote des int et les passer dans sql_quote avec le bon type de champ si on le connait, int sinon
2111 2104
 		// prendre en compte le debug ou la valeur arrive avec un commentaire PHP en debut
2112 2105
 		if (preg_match(",^\\A(\s*//.*?$\s*)?\"'(-?\d+)'\"\\z,ms", $val[0], $r)) {
2113
-			$val[0] = $r[1] . '"' . sql_quote($r[2], $boucle->sql_serveur, $type_cast_quote) . '"';
2106
+			$val[0] = $r[1].'"'.sql_quote($r[2], $boucle->sql_serveur, $type_cast_quote).'"';
2114 2107
 		}
2115 2108
 		// sinon expliciter les
2116 2109
 		// sql_quote(truc) en sql_quote(truc,'',type)
@@ -2121,22 +2114,22 @@  discard block
 block discarded – undo
2121 2114
 		// sql_quote(truc,'','varchar')
2122 2115
 		elseif (preg_match('/\Asql_quote[(](.*?)(,[^)]*?)?(,[^)]*(?:\(\d+\)[^)]*)?)?[)]\s*\z/ms', $val[0], $r)
2123 2116
 			// si pas deja un type
2124
-			and (!isset($r[3]) or !$r[3] or !trim($r[3],", '"))
2117
+			and (!isset($r[3]) or !$r[3] or !trim($r[3], ", '"))
2125 2118
 		) {
2126 2119
 			$r = $r[1]
2127 2120
 				. ((isset($r[2]) and $r[2]) ? $r[2] : ",''")
2128
-				. ",'" . addslashes($type_cast_quote) . "'";
2121
+				. ",'".addslashes($type_cast_quote)."'";
2129 2122
 			$val[0] = "sql_quote($r)";
2130 2123
 		}
2131
-		elseif(strpos($val[0], '@@defaultcast@@') !== false
2124
+		elseif (strpos($val[0], '@@defaultcast@@') !== false
2132 2125
 		  and preg_match("/'@@defaultcast@@'\s*\)\s*\z/ms", $val[0], $r)) {
2133
-			$val[0] = substr($val[0], 0, -strlen($r[0])) . "'" . addslashes($type_cast_quote) . "')";
2126
+			$val[0] = substr($val[0], 0, -strlen($r[0]))."'".addslashes($type_cast_quote)."')";
2134 2127
 		}
2135 2128
 	}
2136 2129
 
2137
-	if(strpos($val[0], '@@defaultcast@@') !== false
2130
+	if (strpos($val[0], '@@defaultcast@@') !== false
2138 2131
 	  and preg_match("/'@@defaultcast@@'\s*\)\s*\z/ms", $val[0], $r)) {
2139
-		$val[0] = substr($val[0], 0, -strlen($r[0])) . "'char')";
2132
+		$val[0] = substr($val[0], 0, -strlen($r[0]))."'char')";
2140 2133
 	}
2141 2134
 
2142 2135
 	// Indicateur pour permettre aux fonctionx boucle_X de modifier
@@ -2152,7 +2145,7 @@  discard block
 block discarded – undo
2152 2145
 	// inserer le nom de la table SQL devant le nom du champ
2153 2146
 	if ($table) {
2154 2147
 		if ($col[0] == "`") {
2155
-			$arg = "$table." . substr($col, 1, -1);
2148
+			$arg = "$table.".substr($col, 1, -1);
2156 2149
 		} else {
2157 2150
 			$arg = "$table.$col";
2158 2151
 		}
@@ -2286,9 +2279,9 @@  discard block
 block discarded – undo
2286 2279
  **/
2287 2280
 function primary_doublee($decompose, $table) {
2288 2281
 	$e1 = reset($decompose);
2289
-	$e2 = "sql_quote('" . end($decompose) . "')";
2282
+	$e2 = "sql_quote('".end($decompose)."')";
2290 2283
 
2291
-	return array("'='", "'$table." . $e1 . "'", $e2);
2284
+	return array("'='", "'$table.".$e1."'", $e2);
2292 2285
 }
2293 2286
 
2294 2287
 /**
@@ -2326,7 +2319,7 @@  discard block
 block discarded – undo
2326 2319
 	if ($checkarrivee
2327 2320
 		and is_string($checkarrivee)
2328 2321
 		and $a = table_objet($checkarrivee)
2329
-		and in_array($a . '_liens', $joints)
2322
+		and in_array($a.'_liens', $joints)
2330 2323
 	) {
2331 2324
 		if ($res = calculer_lien_externe_init($boucle, $joints, $col, $desc, $cond, $checkarrivee)) {
2332 2325
 			return $res;
@@ -2346,12 +2339,12 @@  discard block
 block discarded – undo
2346 2339
 				// la table est déjà dans le FROM, on vérifie si le champ est utilisé.
2347 2340
 				$joindre = false;
2348 2341
 				foreach ($cols as $col) {
2349
-					$c = '/\b' . $t . ".$col" . '\b/';
2342
+					$c = '/\b'.$t.".$col".'\b/';
2350 2343
 					if (trouver_champ($c, $boucle->where)) {
2351 2344
 						$joindre = true;
2352 2345
 					} else {
2353 2346
 						// mais ca peut etre dans le FIELD pour le Having
2354
-						$c = "/FIELD.$t" . ".$col,/";
2347
+						$c = "/FIELD.$t".".$col,/";
2355 2348
 						if (trouver_champ($c, $boucle->select)) {
2356 2349
 							$joindre = true;
2357 2350
 						}
@@ -2398,7 +2391,7 @@  discard block
 block discarded – undo
2398 2391
 	$primary_arrivee = id_table_objet($checkarrivee);
2399 2392
 
2400 2393
 	// [FIXME] $checkarrivee peut-il arriver avec false ????
2401
-	$intermediaire = trouver_champ_exterieur($primary_arrivee, $joints, $boucle, $checkarrivee . "_liens");
2394
+	$intermediaire = trouver_champ_exterieur($primary_arrivee, $joints, $boucle, $checkarrivee."_liens");
2402 2395
 	$arrivee = trouver_champ_exterieur($col, $joints, $boucle, $checkarrivee);
2403 2396
 
2404 2397
 	if (!$intermediaire or !$arrivee) {
@@ -2496,7 +2489,7 @@  discard block
 block discarded – undo
2496 2489
 			} elseif ($crit->cond and ($col == "date" or $col == "date_redac")) {
2497 2490
 				// un critere conditionnel sur date est traite a part
2498 2491
 				// car la date est mise d'office par SPIP,
2499
-				$defaut = "(\$Pile[0]['{$col}_default']?'':\$Pile[0]['" . $col . "'])";
2492
+				$defaut = "(\$Pile[0]['{$col}_default']?'':\$Pile[0]['".$col."'])";
2500 2493
 			}
2501 2494
 
2502 2495
 			$val = calculer_argument_precedent($idb, $val, $boucles, $defaut);
@@ -2527,7 +2520,7 @@  discard block
 block discarded – undo
2527 2520
 			and (($p == "'") or ($p == '"'))
2528 2521
 			and $params[0][1]->type == 'champ'
2529 2522
 		) {
2530
-			$val[] = "$p\\$p#" . $params[0][1]->nom_champ . "\\$p$p";
2523
+			$val[] = "$p\\$p#".$params[0][1]->nom_champ."\\$p$p";
2531 2524
 		} else {
2532 2525
 			foreach ((($op != 'IN') ? $params : calculer_vieux_in($params)) as $p) {
2533 2526
 				$a = calculer_liste($p, $idb, $boucles, $parent);
@@ -2543,7 +2536,7 @@  discard block
 block discarded – undo
2543 2536
 	$fct = $args_sql = '';
2544 2537
 	// fonction SQL ?
2545 2538
 	// chercher FONCTION(champ) tel que CONCAT(titre,descriptif)
2546
-	if (preg_match('/^(.*)' . SQL_ARGS . '$/', $col, $m)) {
2539
+	if (preg_match('/^(.*)'.SQL_ARGS.'$/', $col, $m)) {
2547 2540
 		$fct = $m[1];
2548 2541
 		preg_match('/^\(([^,]*)(.*)\)$/', $m[2], $a);
2549 2542
 		$col = $a[1];
@@ -2633,7 +2626,7 @@  discard block
 block discarded – undo
2633 2626
 		# si oui choisir ce champ, sinon choisir xxxx
2634 2627
 
2635 2628
 		if (isset($table['field']["date$suite"])) {
2636
-			$date_orig = 'date' . $suite;
2629
+			$date_orig = 'date'.$suite;
2637 2630
 		} else {
2638 2631
 			$date_orig = substr($suite, 1);
2639 2632
 		}
@@ -2644,12 +2637,12 @@  discard block
 block discarded – undo
2644 2637
 		}
2645 2638
 	}
2646 2639
 
2647
-	$date_compare = "\"' . normaliser_date(" .
2648
-		calculer_argument_precedent($idb, $pred, $boucles) .
2640
+	$date_compare = "\"' . normaliser_date(".
2641
+		calculer_argument_precedent($idb, $pred, $boucles).
2649 2642
 		") . '\"";
2650 2643
 
2651 2644
 	$col_vraie = $date_orig;
2652
-	$date_orig = $boucle->id_table . '.' . $date_orig;
2645
+	$date_orig = $boucle->id_table.'.'.$date_orig;
2653 2646
 
2654 2647
 	switch ($col) {
2655 2648
 		case 'date':
@@ -2669,26 +2662,26 @@  discard block
 block discarded – undo
2669 2662
 			break;
2670 2663
 		case 'age':
2671 2664
 			$col = calculer_param_date("\'' . date('Y-m-d H:i:00') . '\'", $date_orig);
2672
-			$col_vraie = "";// comparer a un int (par defaut)
2665
+			$col_vraie = ""; // comparer a un int (par defaut)
2673 2666
 			break;
2674 2667
 		case 'age_relatif':
2675 2668
 			$col = calculer_param_date($date_compare, $date_orig);
2676
-			$col_vraie = "";// comparer a un int (par defaut)
2669
+			$col_vraie = ""; // comparer a un int (par defaut)
2677 2670
 			break;
2678 2671
 		case 'jour_relatif':
2679
-			$col = "(TO_DAYS(" . $date_compare . ")-TO_DAYS(" . $date_orig . "))";
2680
-			$col_vraie = "";// comparer a un int (par defaut)
2672
+			$col = "(TO_DAYS(".$date_compare.")-TO_DAYS(".$date_orig."))";
2673
+			$col_vraie = ""; // comparer a un int (par defaut)
2681 2674
 			break;
2682 2675
 		case 'mois_relatif':
2683
-			$col = "MONTH(" . $date_compare . ")-MONTH(" .
2684
-				$date_orig . ")+12*(YEAR(" . $date_compare .
2685
-				")-YEAR(" . $date_orig . "))";
2686
-			$col_vraie = "";// comparer a un int (par defaut)
2676
+			$col = "MONTH(".$date_compare.")-MONTH(".
2677
+				$date_orig.")+12*(YEAR(".$date_compare.
2678
+				")-YEAR(".$date_orig."))";
2679
+			$col_vraie = ""; // comparer a un int (par defaut)
2687 2680
 			break;
2688 2681
 		case 'annee_relatif':
2689
-			$col = "YEAR(" . $date_compare . ")-YEAR(" .
2690
-				$date_orig . ")";
2691
-			$col_vraie = "";// comparer a un int (par defaut)
2682
+			$col = "YEAR(".$date_compare.")-YEAR(".
2683
+				$date_orig.")";
2684
+			$col_vraie = ""; // comparer a un int (par defaut)
2692 2685
 			break;
2693 2686
 	}
2694 2687
 
@@ -2747,10 +2740,10 @@  discard block
 block discarded – undo
2747 2740
 	}
2748 2741
 
2749 2742
 	$boucle->hash .= '
2750
-	$command[\'sourcemode\'] = ' . array_shift($args) . ";\n";
2743
+	$command[\'sourcemode\'] = ' . array_shift($args).";\n";
2751 2744
 
2752 2745
 	$boucle->hash .= '
2753
-	$command[\'source\'] = array(' . join(', ', $args) . ");\n";
2746
+	$command[\'source\'] = array(' . join(', ', $args).");\n";
2754 2747
 }
2755 2748
 
2756 2749
 /**
@@ -2769,7 +2762,7 @@  discard block
 block discarded – undo
2769 2762
 function critere_DATA_datacache_dist($idb, &$boucles, $crit) {
2770 2763
 	$boucle = &$boucles[$idb];
2771 2764
 	$boucle->hash .= '
2772
-	$command[\'datacache\'] = ' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent) . ';';
2765
+	$command[\'datacache\'] = ' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent).';';
2773 2766
 }
2774 2767
 
2775 2768
 
@@ -2788,7 +2781,7 @@  discard block
 block discarded – undo
2788 2781
 	$boucle->hash .= '$command[\'args\']=array();';
2789 2782
 	foreach ($crit->param as $param) {
2790 2783
 		$boucle->hash .= '
2791
-			$command[\'args\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent) . ';';
2784
+			$command[\'args\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent).';';
2792 2785
 	}
2793 2786
 }
2794 2787
 
@@ -2807,10 +2800,10 @@  discard block
 block discarded – undo
2807 2800
  */
2808 2801
 function critere_DATA_liste_dist($idb, &$boucles, $crit) {
2809 2802
 	$boucle = &$boucles[$idb];
2810
-	$boucle->hash .= "\n\t" . '$command[\'liste\'] = array();' . "\n";
2803
+	$boucle->hash .= "\n\t".'$command[\'liste\'] = array();'."\n";
2811 2804
 	foreach ($crit->param as $param) {
2812
-		$boucle->hash .= "\t" . '$command[\'liste\'][] = ' . calculer_liste($param, $idb, $boucles,
2813
-				$boucles[$idb]->id_parent) . ";\n";
2805
+		$boucle->hash .= "\t".'$command[\'liste\'][] = '.calculer_liste($param, $idb, $boucles,
2806
+				$boucles[$idb]->id_parent).";\n";
2814 2807
 	}
2815 2808
 }
2816 2809
 
@@ -2837,10 +2830,10 @@  discard block
 block discarded – undo
2837 2830
  */
2838 2831
 function critere_DATA_enum_dist($idb, &$boucles, $crit) {
2839 2832
 	$boucle = &$boucles[$idb];
2840
-	$boucle->hash .= "\n\t" . '$command[\'enum\'] = array();' . "\n";
2833
+	$boucle->hash .= "\n\t".'$command[\'enum\'] = array();'."\n";
2841 2834
 	foreach ($crit->param as $param) {
2842
-		$boucle->hash .= "\t" . '$command[\'enum\'][] = ' . calculer_liste($param, $idb, $boucles,
2843
-				$boucles[$idb]->id_parent) . ";\n";
2835
+		$boucle->hash .= "\t".'$command[\'enum\'][] = '.calculer_liste($param, $idb, $boucles,
2836
+				$boucles[$idb]->id_parent).";\n";
2844 2837
 	}
2845 2838
 }
2846 2839
 
@@ -2859,7 +2852,7 @@  discard block
 block discarded – undo
2859 2852
 	$boucle = &$boucles[$idb];
2860 2853
 	foreach ($crit->param as $param) {
2861 2854
 		$boucle->hash .= '
2862
-			$command[\'datapath\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent) . ';';
2855
+			$command[\'datapath\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent).';';
2863 2856
 	}
2864 2857
 }
2865 2858
 
@@ -2900,7 +2893,7 @@  discard block
 block discarded – undo
2900 2893
 	if ($crit->param) {
2901 2894
 		foreach ($crit->param as $param) {
2902 2895
 			$boucle->hash .= "\t\$command['si'][] = "
2903
-				. calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent) . ";\n";
2896
+				. calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent).";\n";
2904 2897
 		}
2905 2898
 		// interdire {si 0} aussi !
2906 2899
 	} else {
@@ -2924,7 +2917,7 @@  discard block
 block discarded – undo
2924 2917
 function critere_POUR_tableau_dist($idb, &$boucles, $crit) {
2925 2918
 	$boucle = &$boucles[$idb];
2926 2919
 	$boucle->hash .= '
2927
-	$command[\'source\'] = array(' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent) . ');
2920
+	$command[\'source\'] = array(' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent).');
2928 2921
 	$command[\'sourcemode\'] = \'table\';';
2929 2922
 }
2930 2923
 
@@ -2957,11 +2950,10 @@  discard block
 block discarded – undo
2957 2950
 	$table_sql = table_objet_sql(objet_type($table));
2958 2951
 
2959 2952
 	$id_parent = isset($GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent']) ?
2960
-		$GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] :
2961
-		'id_parent';
2953
+		$GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : 'id_parent';
2962 2954
 
2963 2955
 	$in = "IN";
2964
-	$where = array("'IN'", "'$boucle->id_table." . "$primary'", "'('.sql_get_select('$id_parent', '$table_sql').')'");
2956
+	$where = array("'IN'", "'$boucle->id_table."."$primary'", "'('.sql_get_select('$id_parent', '$table_sql').')'");
2965 2957
 	if ($not) {
2966 2958
 		$where = array("'NOT'", $where);
2967 2959
 	}
Please login to merge, or discard this patch.
ecrire/public/fonctions.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	if (strlen($intro)) {
84 84
 		$texte = $intro;
85 85
 	} else {
86
-		if (strpos("\n" . $texte, "\n|") === false
86
+		if (strpos("\n".$texte, "\n|") === false
87 87
 			and strlen($texte) > 2.5 * $longueur
88 88
 		) {
89 89
 			if (strpos($texte, "<multi") !== false) {
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
 	if ($pas < 1) {
169 169
 		return '';
170 170
 	}
171
-	$ancre = 'pagination' . $nom; // #pagination_articles
172
-	$debut = 'debut' . $nom; // 'debut_articles'
171
+	$ancre = 'pagination'.$nom; // #pagination_articles
172
+	$debut = 'debut'.$nom; // 'debut_articles'
173 173
 
174 174
 	// n'afficher l'ancre qu'une fois
175 175
 	if (!isset($ancres[$ancre])) {
176
-		$bloc_ancre = $ancres[$ancre] = "<a id='" . $ancre . "' class='pagination_ancre'></a>";
176
+		$bloc_ancre = $ancres[$ancre] = "<a id='".$ancre."' class='pagination_ancre'></a>";
177 177
 	} else {
178 178
 		$bloc_ancre = '';
179 179
 	}
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	if ($modele) {
207 207
 		$pagination['type_pagination'] = $modele;
208 208
 		if (trouver_fond('pagination_'.$modele, 'modeles')) {
209
-			$modele = '_' . $modele;
209
+			$modele = '_'.$modele;
210 210
 		}
211 211
 		else {
212 212
 			$modele = '';
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
  * @param $objet_lien
338 338
  * @return string
339 339
  */
340
-function retrouver_rang_lien($objet_source, $ids, $objet_lie, $idl, $objet_lien){
340
+function retrouver_rang_lien($objet_source, $ids, $objet_lie, $idl, $objet_lien) {
341 341
 	$res = lister_objets_liens($objet_source, $objet_lie, $idl, $objet_lien);
342 342
 	$res = array_column($res, 'rang_lien', $objet_source);
343 343
 
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
  * @param array $from
429 429
  * @return string
430 430
  */
431
-function tri_champ_order($t, $from = null, $senstri='') {
431
+function tri_champ_order($t, $from = null, $senstri = '') {
432 432
 	if (strncmp($t, 'multi ', 6) == 0) {
433 433
 		return "multi";
434 434
 	}
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 		case 'sinum ':
464 464
 			return "CASE( 0+$champ ) WHEN 0 THEN 1 ELSE 0 END{$senstri}";
465 465
 		default:
466
-			return $champ . $senstri;
466
+			return $champ.$senstri;
467 467
 	}
468 468
 }
469 469
 
@@ -500,12 +500,12 @@  discard block
 block discarded – undo
500 500
  * @param string $serveur
501 501
  * @return string
502 502
  */
503
-function formate_liste_critere_par_ordre_liste($valeurs, $serveur = ''){
504
-	if (!is_array($valeurs)){
503
+function formate_liste_critere_par_ordre_liste($valeurs, $serveur = '') {
504
+	if (!is_array($valeurs)) {
505 505
 		return '';
506 506
 	}
507 507
 	$f = sql_serveur('quote', $serveur, true);
508
-	if (!is_string($f) or !$f){
508
+	if (!is_string($f) or !$f) {
509 509
 		return '';
510 510
 	}
511 511
 	$valeurs = implode(',', array_map($f, array_unique($valeurs)));
Please login to merge, or discard this patch.
ecrire/public/references.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	$select = true
125 125
 ) {
126 126
 	if (!is_string($defaut)) {
127
-		$defaut = '@$Pile[0][\'' . strtolower($nom_champ) . '\']';
127
+		$defaut = '@$Pile[0][\''.strtolower($nom_champ).'\']';
128 128
 	}
129 129
 
130 130
 	$idb_origine = $idb;
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 			}
158 158
 			// renseigner la boucle source de ce champ pour les traitements
159 159
 			$boucles[$idb_origine]->index_champ[$nom_champ_origine] = $idb;
160
-			$champ = '$Pile[$SP' . ($i ? "-$i" : "") . '][\'' . $c . '\']';
160
+			$champ = '$Pile[$SP'.($i ? "-$i" : "").'][\''.$c.'\']';
161 161
 			if (!$joker) {
162 162
 				return index_compose($conditionnel, $champ);
163 163
 			}
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 function index_compose($conditionnel, $defaut) {
199 199
 	while ($c = array_pop($conditionnel)) {
200 200
 		// si on passe defaut = '', ne pas générer d'erreur de compilation.
201
-		$defaut = "($c:(" . ($defaut ? $defaut : "''") . "))";
201
+		$defaut = "($c:(".($defaut ? $defaut : "''")."))";
202 202
 	}
203 203
 
204 204
 	return $defaut;
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	if (!$r) {
246 246
 		$joker = false; // indiquer a l'appelant
247 247
 		# continuer pour chercher l'erreur suivante
248
-		return array("'#" . $r . ':' . $nom_champ . "'", '');
248
+		return array("'#".$r.':'.$nom_champ."'", '');
249 249
 	}
250 250
 
251 251
 	$desc = $boucles[$idb]->show;
@@ -345,8 +345,8 @@  discard block
 block discarded – undo
345 345
 			$t = $index_exception_derogatoire($boucle, $desc, $nom_champ, $excep);
346 346
 		}
347 347
 		if ($t == null) {
348
-			list($e, $x) = $excep;  #PHP4 affecte de gauche a droite
349
-			$excep = $x;    #PHP5 de droite a gauche !
348
+			list($e, $x) = $excep; #PHP4 affecte de gauche a droite
349
+			$excep = $x; #PHP5 de droite a gauche !
350 350
 			$j = $trouver_table($e, $boucle->sql_serveur);
351 351
 			if (!$j) {
352 352
 				return array('', '');
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 					$l = (preg_split('/\s*,\s*/', $k));
359 359
 					$k = $desc['key']['PRIMARY KEY'];
360 360
 					if (!in_array($k, $l)) {
361
-						spip_log("jointure impossible $e " . join(',', $l));
361
+						spip_log("jointure impossible $e ".join(',', $l));
362 362
 
363 363
 						return array('', '');
364 364
 					}
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 	// demander a SQL de gerer le synonyme
375 375
 	// ca permet que excep soit dynamique (Cedric, 2/3/06)
376 376
 	if ($excep != $nom_champ) {
377
-		$excep .= ' AS ' . $nom_champ;
377
+		$excep .= ' AS '.$nom_champ;
378 378
 	}
379 379
 
380 380
 	return array("$t.$excep", $nom_champ);
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
 		join(',', $collecte),
606 606
 		($collecte ? $param : substr($param, 1)), # virer la virgule
607 607
 		memoriser_contexte_compil($p),
608
-		(!$supp ? '' : (', ' . join(',', $supp))));
608
+		(!$supp ? '' : (', '.join(',', $supp))));
609 609
 
610 610
 	$p->interdire_scripts = false;
611 611
 
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 	$nom = $p->id_boucle;
701 701
 
702 702
 	if ($nom and trouver_nom_serveur_distant($p)) {
703
-		spip_log($nom . ':' . $p->nom_champ . ' ' . _T('zbug_distant_interdit'));
703
+		spip_log($nom.':'.$p->nom_champ.' '._T('zbug_distant_interdit'));
704 704
 
705 705
 		return false;
706 706
 	}
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
 			(strpos($ps, 'typo') !== false)
786 786
 		)
787 787
 	) {
788
-		$ps = 'traiter_doublons_documents($doublons, ' . $ps . ')';
788
+		$ps = 'traiter_doublons_documents($doublons, '.$ps.')';
789 789
 	}
790 790
 
791 791
 	// La protection des champs par |safehtml est assuree par les extensions
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
 function compose_filtres_args($p, $args, $sep) {
907 907
 	$arglist = "";
908 908
 	foreach ($args as $arg) {
909
-		$arglist .= $sep .
909
+		$arglist .= $sep.
910 910
 			calculer_liste($arg, $p->descr, $p->boucles, $p->id_boucle);
911 911
 	}
912 912
 
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
 	while ($b != '') {
958 958
 		foreach ($p->boucles[$b]->criteres as $critere) {
959 959
 			if ($critere->op == $motif) {
960
-				$p->code = '$Pile[$SP' . (($n == 0) ? "" : "-$n") .
960
+				$p->code = '$Pile[$SP'.(($n == 0) ? "" : "-$n").
961 961
 					"]['$champ']";
962 962
 				$b = '';
963 963
 				break 2;
@@ -985,6 +985,6 @@  discard block
 block discarded – undo
985 985
  */
986 986
 function zbug_presenter_champ($p, $champ = "") {
987 987
 	$balise = $champ ? $champ : $p->nom_champ;
988
-	$explicite = $explicite = $p->nom_boucle ? $p->nom_boucle . ':' : '';
988
+	$explicite = $explicite = $p->nom_boucle ? $p->nom_boucle.':' : '';
989 989
 	return "#{$explicite}{$balise}";
990 990
 }
991 991
\ No newline at end of file
Please login to merge, or discard this patch.
ecrire/plugins/afficher_plugin.php 1 patch
Spacing   +35 added lines, -36 removed lines patch added patch discarded remove patch
@@ -57,18 +57,18 @@  discard block
 block discarded – undo
57 57
 		$class_li .= " error";
58 58
 		$erreur = http_img_pack("plugin-err-32.png", _T('plugin_info_erreur_xml'), " class='picto_err'",
59 59
 				_T('plugin_info_erreur_xml'))
60
-			. "<div class='erreur'>" . join('<br >', $info['erreur']) . "</div>";
60
+			. "<div class='erreur'>".join('<br >', $info['erreur'])."</div>";
61 61
 		$checkable = false;
62 62
 
63
-	} elseif (isset($GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file])) {
63
+	} elseif (isset($GLOBALS['erreurs_activation_raw'][$dir_plugins.$plug_file])) {
64 64
 		$class_li .= " error";
65 65
 		$erreur = http_img_pack("plugin-err-32.png", _T('plugin_impossible_activer', array('plugin' => $nom)),
66 66
 				" class='picto_err'", _T('plugin_impossible_activer', array('plugin' => $nom)))
67
-			. "<div class='erreur'>" . implode("<br />",
68
-				$GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file]) . "</div>";
67
+			. "<div class='erreur'>".implode("<br />",
68
+				$GLOBALS['erreurs_activation_raw'][$dir_plugins.$plug_file])."</div>";
69 69
 	} else {
70 70
 		$cfg = $actif ? plugin_bouton_config($plug_file, $info, $dir_plugins) : "";
71
-		if (defined('_DEV_VERSION_SPIP_COMPAT') and !plugin_version_compatible($info['compatibilite'], $GLOBALS['spip_version_branche'])){
71
+		if (defined('_DEV_VERSION_SPIP_COMPAT') and !plugin_version_compatible($info['compatibilite'], $GLOBALS['spip_version_branche'])) {
72 72
 			//$info['slogan'] = _T('plugin_info_non_compatible_spip');
73 73
 			$erreur = http_img_pack("plugin-dis-32.png", _T('plugin_info_non_compatible_spip'), " class='picto_err picto_compat_forcee'",
74 74
 				_L('Version incompatible : compatibilité forcée'));
@@ -78,11 +78,11 @@  discard block
 block discarded – undo
78 78
 	// numerotons les occurrences d'un meme prefix
79 79
 	$versions[$prefix] = $id = isset($versions[$prefix]) ? intval($versions[$prefix]) + 1 : '';
80 80
 
81
-	$class_li .= ($actif ? " actif" : "") . ($expose ? " on" : "");
81
+	$class_li .= ($actif ? " actif" : "").($expose ? " on" : "");
82 82
 
83 83
 	return "<li id='$prefix$id' class='$class_li'>"
84 84
 	. ((!$checkable and !$checked)
85
-		? '' : plugin_checkbox(++$id_input, $dir_plugins . $plug_file, $checked))
85
+		? '' : plugin_checkbox(++$id_input, $dir_plugins.$plug_file, $checked))
86 86
 	. plugin_resume($info, $dir_plugins, $plug_file, $url_page)
87 87
 	. $cfg
88 88
 	. $erreur
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
 	$prefix = strtolower($infos['prefix']);
101 101
 	// si paquet.xml fournit un squelette, le prendre
102 102
 	if (isset($infos['config']) and $infos['config']) {
103
-		return recuperer_fond("$dir$nom/" . $infos['config'],
103
+		return recuperer_fond("$dir$nom/".$infos['config'],
104 104
 			array(
105
-				'script' => 'configurer_' . $prefix,
105
+				'script' => 'configurer_'.$prefix,
106 106
 				'nom' => $nom
107 107
 			));
108 108
 	}
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	// sinon prendre le squelette std sur le nom std
121 121
 	return recuperer_fond("prive/squelettes/inclure/cfg",
122 122
 		array(
123
-			'script' => 'configurer_' . $prefix,
123
+			'script' => 'configurer_'.$prefix,
124 124
 			'nom' => $nom
125 125
 		));
126 126
 }
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	. "<input type='checkbox' name='s$name' id='label_$id_input'"
136 136
 	. ($actif ? " checked='checked'" : "")
137 137
 	. " class='checkbox'  value='O' />"
138
-	. "\n<label for='label_$id_input'>" . _T('activer_plugin') . "</label>"
138
+	. "\n<label for='label_$id_input'>"._T('activer_plugin')."</label>"
139 139
 	. "</div>";
140 140
 }
141 141
 
@@ -190,11 +190,11 @@  discard block
 block discarded – undo
190 190
 	. "<h3><a href='$url' rel='info'>"
191 191
 	. $nom
192 192
 	. "</a></h3>"
193
-	. " <span class='version'>" . $info['version'] . "</span>"
193
+	. " <span class='version'>".$info['version']."</span>"
194 194
 	. " <span class='etat'> - "
195 195
 	. plugin_etat_en_clair($info['etat'])
196 196
 	. "</span>"
197
-	. "<div class='short'>" . $slogan . "</div>"
197
+	. "<div class='short'>".$slogan."</div>"
198 198
 	. $i
199 199
 	. "</div>";
200 200
 }
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	$text2 = _T('info_desinstaller_plugin');
210 210
 	$file = basename($plug_file);
211 211
 
212
-	return "<div class='actions'>[" .
212
+	return "<div class='actions'>[".
213 213
 	"<a href='$action'
214 214
 		onclick='return confirm(\"$text $nom ?\\n$text2\")'>"
215 215
 	. $text
@@ -231,17 +231,17 @@  discard block
 block discarded – undo
231 231
 		$etat = 'developpement';
232 232
 	}
233 233
 
234
-	return _T('plugin_etat_' . $etat);
234
+	return _T('plugin_etat_'.$etat);
235 235
 }
236 236
 
237 237
 // https://code.spip.net/@plugin_propre
238
-function plugin_propre($texte, $module = '',$propre='propre') {
238
+function plugin_propre($texte, $module = '', $propre = 'propre') {
239 239
 	// retirer le retour a la racine du module, car le find_in_path se fait depuis la racine
240 240
 	if (_DIR_RACINE and strncmp($module, _DIR_RACINE, strlen(_DIR_RACINE)) == 0) {
241 241
 		$module = substr($module, strlen(_DIR_RACINE));
242 242
 	}
243 243
 	if (preg_match("|^\w+_[\w_]+$|", $texte)) {
244
-		$texte = _T(($module ? "$module:" : '') . $texte, array(), array('force' => false));
244
+		$texte = _T(($module ? "$module:" : '').$texte, array(), array('force' => false));
245 245
 	}
246 246
 
247 247
 	return $propre($texte);
@@ -273,9 +273,9 @@  discard block
 block discarded – undo
273 273
 	if (isset($info['documentation'])
274 274
 		and $lien = $info['documentation']
275 275
 	) {
276
-		$description .= "<p><em class='site'><a href='$lien' class='spip_out'>" . _T('en_savoir_plus') . '</a></em></p>';
276
+		$description .= "<p><em class='site'><a href='$lien' class='spip_out'>"._T('en_savoir_plus').'</a></em></p>';
277 277
 	}
278
-	$s .= "<dd class='desc'>" . $description . "</dd>\n";
278
+	$s .= "<dd class='desc'>".$description."</dd>\n";
279 279
 
280 280
 	if (isset($info['auteur'])) {
281 281
 		if (is_array($info['auteur'])) {
@@ -285,15 +285,15 @@  discard block
 block discarded – undo
285 285
 			$a = trim($info['auteur']);
286 286
 		}
287 287
 		if ($a) {
288
-			$s .= "<dt class='auteurs'>" . _T('public:par_auteur') . "</dt><dd class='auteurs'>" . PtoBR(propre($a,
289
-					$dir)) . "</dd>\n";
288
+			$s .= "<dt class='auteurs'>"._T('public:par_auteur')."</dt><dd class='auteurs'>".PtoBR(propre($a,
289
+					$dir))."</dd>\n";
290 290
 		}
291 291
 	}
292 292
 
293 293
 	if (isset($info['credit'])) {
294 294
 		if ($a = formater_credits($info['credit'], ', ')) {
295
-			$s .= "<dt class='credits'>" . _T('plugin_info_credit') . "</dt><dd class='credits'>" . PtoBR(propre($a,
296
-					$dir)) . "</dd>\n";
295
+			$s .= "<dt class='credits'>"._T('plugin_info_credit')."</dt><dd class='credits'>".PtoBR(propre($a,
296
+					$dir))."</dd>\n";
297 297
 		}
298 298
 	}
299 299
 
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
 			$a = trim($info['licence']);
306 306
 		}
307 307
 		if ($a) {
308
-			$s .= "<dt class='licence'>" . _T('intitule_licence') . "</dt><dd class='licence'>" . PtoBR(propre($a,
309
-					$dir)) . "</dd>\n";
308
+			$s .= "<dt class='licence'>"._T('intitule_licence')."</dt><dd class='licence'>".PtoBR(propre($a,
309
+					$dir))."</dd>\n";
310 310
 		}
311 311
 	}
312 312
 
@@ -317,23 +317,22 @@  discard block
 block discarded – undo
317 317
 	//
318 318
 	$infotech = array();
319 319
 
320
-	$version = "<dt>" . _T('version') . "</dt><dd>" . $info['version'];
320
+	$version = "<dt>"._T('version')."</dt><dd>".$info['version'];
321 321
 	// Version VCS
322
-	if ($vcs = version_vcs_courante($dir_plugins . $plug_file)) {
323
-		$version .= ' ' . $vcs;
322
+	if ($vcs = version_vcs_courante($dir_plugins.$plug_file)) {
323
+		$version .= ' '.$vcs;
324 324
 	}
325 325
 	$version .= "</dd>";
326 326
 	$infotech[] = $version;
327
-	$infotech[] = "<dt>" . _T('repertoire_plugins') . "</dt><dd>" . joli_repertoire("$dir_plugins$plug_file") . "</dd>";
327
+	$infotech[] = "<dt>"._T('repertoire_plugins')."</dt><dd>".joli_repertoire("$dir_plugins$plug_file")."</dd>";
328 328
 	// source zip le cas echeant
329
-	$infotech[] = (lire_fichier($dir_plugins . $plug_file . '/install.log', $log)
329
+	$infotech[] = (lire_fichier($dir_plugins.$plug_file.'/install.log', $log)
330 330
 		and preg_match(',^source:(.*)$,m', $log, $r))
331
-		? '<dt>' . _T('plugin_source') . '</dt><dd>' . trim($r[1]) . "</dd>"
331
+		? '<dt>'._T('plugin_source').'</dt><dd>'.trim($r[1])."</dd>"
332 332
 		: '';
333 333
 
334
-	$infotech[] = !$info['necessite'] ? '' :
335
-		('<dt>' . _T('plugin_info_necessite') . '</dt><dd>' . join(' ',
336
-				array_map('array_shift', $info['necessite'])) . '</dd>');
334
+	$infotech[] = !$info['necessite'] ? '' : ('<dt>'._T('plugin_info_necessite').'</dt><dd>'.join(' ',
335
+				array_map('array_shift', $info['necessite'])).'</dd>');
337 336
 
338 337
 	$s .= "<dl class='tech'>"
339 338
 		. join('', $infotech)
@@ -354,8 +353,8 @@  discard block
 block discarded – undo
354 353
 		$texte .=
355 354
 			(!is_array($_credit))
356 355
 				? PtoBR(propre($_credit))
357
-				: ($_credit['url'] ? '<a href="' . $_credit['url'] . '">' : '') .
358
-				$_credit['nom'] .
356
+				: ($_credit['url'] ? '<a href="'.$_credit['url'].'">' : '').
357
+				$_credit['nom'].
359 358
 				($_credit['url'] ? '</a>' : '');
360 359
 	}
361 360
 
Please login to merge, or discard this patch.
ecrire/inc/commencer_page.php 1 patch
Spacing   +3 added lines, -3 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
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 
177 177
 	$couleur = isset($prefs['couleur']) ? (int) $prefs['couleur'] : 2;
178 178
 
179
-	$classes = $GLOBALS['spip_ecran'] . " spip-theme-colors-$couleur $spip_display_navigation $spip_display_outils " . $display_class[$GLOBALS['spip_display']];
179
+	$classes = $GLOBALS['spip_ecran']." spip-theme-colors-$couleur $spip_display_navigation $spip_display_outils ".$display_class[$GLOBALS['spip_display']];
180 180
 	return spip_sanitize_classname($classes);
181 181
 }
182 182
 
Please login to merge, or discard this patch.
ecrire/inc/filtres.php 1 patch
Spacing   +167 added lines, -168 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	}
95 95
 
96 96
 	include_fichiers_fonctions();
97
-	foreach (array('filtre_' . $fonc, 'filtre_' . $fonc . '_dist', $fonc) as $f) {
97
+	foreach (array('filtre_'.$fonc, 'filtre_'.$fonc.'_dist', $fonc) as $f) {
98 98
 		trouver_filtre_matrice($f); // charge des fichiers spécifiques éventuels
99 99
 		// fonction ou name\space\fonction
100 100
 		if (is_callable($f)) {
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	// affichage "GIT [master: abcdef]"
222 222
 	$commit = isset($desc['commit_short']) ? $desc['commit_short'] : $desc['commit'];
223 223
 	if ($desc['branch']) {
224
-		$commit = $desc['branch'] . ': ' . $commit;
224
+		$commit = $desc['branch'].': '.$commit;
225 225
 	}
226 226
 	return "{$desc['vcs']} [$commit]";
227 227
 }
@@ -240,9 +240,9 @@  discard block
 block discarded – undo
240 240
 	}
241 241
 
242 242
 	// version installee par GIT
243
-	if (lire_fichier($dir . '/.git/HEAD', $c)) {
243
+	if (lire_fichier($dir.'/.git/HEAD', $c)) {
244 244
 		$currentHead = trim(substr($c, 4));
245
-		if (lire_fichier($dir . '/.git/' . $currentHead, $hash)) {
245
+		if (lire_fichier($dir.'/.git/'.$currentHead, $hash)) {
246 246
 			return [
247 247
 				'vcs' => 'GIT',
248 248
 				'branch' => basename($currentHead),
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 		$dir = '.';
270 270
 	}
271 271
 	// version installee par SVN
272
-	if (file_exists($dir . '/.svn/wc.db') && class_exists('SQLite3')) {
273
-		$db = new SQLite3($dir . '/.svn/wc.db');
272
+	if (file_exists($dir.'/.svn/wc.db') && class_exists('SQLite3')) {
273
+		$db = new SQLite3($dir.'/.svn/wc.db');
274 274
 		$result = $db->query('SELECT changed_revision FROM nodes WHERE local_relpath = "" LIMIT 1');
275 275
 		if ($result) {
276 276
 			$row = $result->fetchArray();
@@ -288,12 +288,12 @@  discard block
 block discarded – undo
288 288
 
289 289
 // La matrice est necessaire pour ne filtrer _que_ des fonctions definies dans filtres_images
290 290
 // et laisser passer les fonctions personnelles baptisees image_...
291
-$GLOBALS['spip_matrice']['image_graver'] = true;//'inc/filtres_images_mini.php';
292
-$GLOBALS['spip_matrice']['image_select'] = true;//'inc/filtres_images_mini.php';
293
-$GLOBALS['spip_matrice']['image_reduire'] = true;//'inc/filtres_images_mini.php';
294
-$GLOBALS['spip_matrice']['image_reduire_par'] = true;//'inc/filtres_images_mini.php';
295
-$GLOBALS['spip_matrice']['image_passe_partout'] = true;//'inc/filtres_images_mini.php';
296
-$GLOBALS['spip_matrice']['image_recadre_avec_fallback'] = true;//'inc/filtres_images_mini.php';
291
+$GLOBALS['spip_matrice']['image_graver'] = true; //'inc/filtres_images_mini.php';
292
+$GLOBALS['spip_matrice']['image_select'] = true; //'inc/filtres_images_mini.php';
293
+$GLOBALS['spip_matrice']['image_reduire'] = true; //'inc/filtres_images_mini.php';
294
+$GLOBALS['spip_matrice']['image_reduire_par'] = true; //'inc/filtres_images_mini.php';
295
+$GLOBALS['spip_matrice']['image_passe_partout'] = true; //'inc/filtres_images_mini.php';
296
+$GLOBALS['spip_matrice']['image_recadre_avec_fallback'] = true; //'inc/filtres_images_mini.php';
297 297
 
298 298
 $GLOBALS['spip_matrice']['couleur_html_to_hex'] = 'inc/filtres_images_mini.php';
299 299
 $GLOBALS['spip_matrice']['couleur_hex_to_hsl'] = 'inc/filtres_images_mini.php';
@@ -452,8 +452,8 @@  discard block
 block discarded – undo
452 452
  */
453 453
 function filtre_debug($val, $key = null) {
454 454
 	$debug = (
455
-		is_null($key) ? '' : (var_export($key, true) . " = ")
456
-		) . var_export($val, true);
455
+		is_null($key) ? '' : (var_export($key, true)." = ")
456
+		).var_export($val, true);
457 457
 
458 458
 	include_spip('inc/autoriser');
459 459
 	if (autoriser('webmestre')) {
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 						if (preg_match(",this[.]src=['\"]([^'\"]+)['\"],ims", $mouseover, $match)) {
553 553
 							$srcover = $match[1];
554 554
 							array_shift($args);
555
-							array_unshift($args, "<img src='" . $match[1] . "' />");
555
+							array_unshift($args, "<img src='".$match[1]."' />");
556 556
 							$srcover_filter = call_user_func_array($filtre, $args);
557 557
 							$srcover_filter = extraire_attribut($srcover_filter, 'src');
558 558
 							$reduit = str_replace($srcover, $srcover_filter, $reduit);
@@ -623,14 +623,14 @@  discard block
 block discarded – undo
623 623
 				$hauteur_img[$src] = $srcHeight = $srcsize[1];
624 624
 			}
625 625
 		}
626
-		elseif(strpos($src, "<svg") !== false) {
626
+		elseif (strpos($src, "<svg") !== false) {
627 627
 			include_spip('inc/svg');
628
-			if ($attrs = svg_lire_attributs($src)){
628
+			if ($attrs = svg_lire_attributs($src)) {
629 629
 				list($width, $height, $viewbox) = svg_getimagesize_from_attr($attrs);
630
-				if (!$srcWidth){
630
+				if (!$srcWidth) {
631 631
 					$largeur_img[$src] = $srcWidth = $width;
632 632
 				}
633
-				if (!$srcHeight){
633
+				if (!$srcHeight) {
634 634
 					$hauteur_img[$src] = $srcHeight = $height;
635 635
 				}
636 636
 			}
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
 	// " -> &quot; et tout ce genre de choses
915 915
 	$u = $GLOBALS['meta']['pcre_u'];
916 916
 	$texte = str_replace("&nbsp;", " ", $texte);
917
-	$texte = preg_replace('/\s{2,}/S' . $u, " ", $texte);
917
+	$texte = preg_replace('/\s{2,}/S'.$u, " ", $texte);
918 918
 	// ne pas echapper les sinqle quotes car certains outils de syndication gerent mal
919 919
 	$texte = entites_html($texte, false, false);
920 920
 	// mais bien echapper les double quotes !
@@ -974,7 +974,7 @@  discard block
 block discarded – undo
974 974
  **/
975 975
 function supprimer_numero($texte) {
976 976
 	return preg_replace(
977
-		",^[[:space:]]*([0-9]+)([.)]|" . chr(194) . '?' . chr(176) . ")[[:space:]]+,S",
977
+		",^[[:space:]]*([0-9]+)([.)]|".chr(194).'?'.chr(176).")[[:space:]]+,S",
978 978
 		"", $texte);
979 979
 }
980 980
 
@@ -999,7 +999,7 @@  discard block
 block discarded – undo
999 999
  **/
1000 1000
 function recuperer_numero($texte) {
1001 1001
 	if (preg_match(
1002
-		",^[[:space:]]*([0-9]+)([.)]|" . chr(194) . '?' . chr(176) . ")[[:space:]]+,S",
1002
+		",^[[:space:]]*([0-9]+)([.)]|".chr(194).'?'.chr(176).")[[:space:]]+,S",
1003 1003
 		$texte, $regs)) {
1004 1004
 		return strval($regs[1]);
1005 1005
 	} else {
@@ -1084,8 +1084,8 @@  discard block
 block discarded – undo
1084 1084
  **/
1085 1085
 function textebrut($texte) {
1086 1086
 	$u = $GLOBALS['meta']['pcre_u'];
1087
-	$texte = preg_replace('/\s+/S' . $u, " ", $texte);
1088
-	$texte = preg_replace("/<(p|br)( [^>]*)?" . ">/iS", "\n\n", $texte);
1087
+	$texte = preg_replace('/\s+/S'.$u, " ", $texte);
1088
+	$texte = preg_replace("/<(p|br)( [^>]*)?".">/iS", "\n\n", $texte);
1089 1089
 	$texte = preg_replace("/^\n+/", "", $texte);
1090 1090
 	$texte = preg_replace("/\n+$/", "", $texte);
1091 1091
 	$texte = preg_replace("/\n +/", "\n", $texte);
@@ -1113,7 +1113,7 @@  discard block
 block discarded – undo
1113 1113
 	if (preg_match_all(",(<a\s+[^>]*https?://[^>]*class=[\"']spip_(out|url)\b[^>]+>),imsS",
1114 1114
 		$texte, $liens, PREG_PATTERN_ORDER)) {
1115 1115
 		foreach ($liens[0] as $a) {
1116
-			$rel = 'noopener noreferrer ' . extraire_attribut($a, 'rel');
1116
+			$rel = 'noopener noreferrer '.extraire_attribut($a, 'rel');
1117 1117
 			$ablank = inserer_attribut($a, 'rel', $rel);
1118 1118
 			$ablank = inserer_attribut($ablank, 'target', '_blank');
1119 1119
 			$texte = str_replace($a, $ablank, $texte);
@@ -1138,7 +1138,7 @@  discard block
 block discarded – undo
1138 1138
 		foreach ($regs[0] as $a) {
1139 1139
 			$rel = extraire_attribut($a, "rel");
1140 1140
 			if (strpos($rel, "nofollow") === false) {
1141
-				$rel = "nofollow" . ($rel ? " $rel" : "");
1141
+				$rel = "nofollow".($rel ? " $rel" : "");
1142 1142
 				$anofollow = inserer_attribut($a, "rel", $rel);
1143 1143
 				$texte = str_replace($a, $anofollow, $texte);
1144 1144
 			}
@@ -1167,7 +1167,7 @@  discard block
 block discarded – undo
1167 1167
 	$u = $GLOBALS['meta']['pcre_u'];
1168 1168
 	$texte = preg_replace("@</p>@iS", "\n", $texte);
1169 1169
 	$texte = preg_replace("@<p\b.*>@UiS", "<br />", $texte);
1170
-	$texte = preg_replace("@^\s*<br />@S" . $u, "", $texte);
1170
+	$texte = preg_replace("@^\s*<br />@S".$u, "", $texte);
1171 1171
 
1172 1172
 	return $texte;
1173 1173
 }
@@ -1198,7 +1198,7 @@  discard block
 block discarded – undo
1198 1198
 		return $texte;
1199 1199
 	}
1200 1200
 	include_spip('inc/texte');
1201
-	$tag = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $texte) ?
1201
+	$tag = preg_match(',</?('._BALISES_BLOCS.')[>[:space:]],iS', $texte) ?
1202 1202
 		'div' : 'span';
1203 1203
 
1204 1204
 	return "<$tag style='word-wrap:break-word;'>$texte</$tag>";
@@ -1307,7 +1307,7 @@  discard block
 block discarded – undo
1307 1307
 function attribut_html($texte, $textebrut = true) {
1308 1308
 	$u = $GLOBALS['meta']['pcre_u'];
1309 1309
 	if ($textebrut) {
1310
-		$texte = preg_replace(array(",\n,", ",\s(?=\s),msS" . $u), array(" ", ""), textebrut($texte));
1310
+		$texte = preg_replace(array(",\n,", ",\s(?=\s),msS".$u), array(" ", ""), textebrut($texte));
1311 1311
 	}
1312 1312
 	$texte = texte_backend($texte);
1313 1313
 	$texte = str_replace(array("'", '"'), array('&#039;', '&#034;'), $texte);
@@ -1336,7 +1336,7 @@  discard block
 block discarded – undo
1336 1336
 	# un message pour abs_url
1337 1337
 	$GLOBALS['mode_abs_url'] = 'url';
1338 1338
 	$url = trim($url);
1339
-	$r = ",^(?:" . _PROTOCOLES_STD . '):?/?/?$,iS';
1339
+	$r = ",^(?:"._PROTOCOLES_STD.'):?/?/?$,iS';
1340 1340
 
1341 1341
 	return preg_match($r, $url) ? '' : ($entites ? entites_html($url) : $url);
1342 1342
 }
@@ -1538,14 +1538,14 @@  discard block
 block discarded – undo
1538 1538
 	if (strpos($texte, "<") !== false) {
1539 1539
 		include_spip('inc/lien');
1540 1540
 		if (defined('_PREG_MODELE')) {
1541
-			$preg_modeles = "@" . _PREG_MODELE . "@imsS";
1541
+			$preg_modeles = "@"._PREG_MODELE."@imsS";
1542 1542
 			$texte = echappe_html($texte, '', true, $preg_modeles);
1543 1543
 		}
1544 1544
 	}
1545 1545
 
1546 1546
 	$debut = '';
1547 1547
 	$suite = $texte;
1548
-	while ($t = strpos('-' . $suite, "\n", 1)) {
1548
+	while ($t = strpos('-'.$suite, "\n", 1)) {
1549 1549
 		$debut .= substr($suite, 0, $t - 1);
1550 1550
 		$suite = substr($suite, $t);
1551 1551
 		$car = substr($suite, 0, 1);
@@ -1562,11 +1562,11 @@  discard block
 block discarded – undo
1562 1562
 			$suite = substr($suite, strlen($regs[0]));
1563 1563
 		}
1564 1564
 	}
1565
-	$texte = $debut . $suite;
1565
+	$texte = $debut.$suite;
1566 1566
 
1567 1567
 	$texte = echappe_retour($texte);
1568 1568
 
1569
-	return $texte . $fin;
1569
+	return $texte.$fin;
1570 1570
 }
1571 1571
 
1572 1572
 
@@ -1627,7 +1627,7 @@  discard block
 block discarded – undo
1627 1627
 		}
1628 1628
 
1629 1629
 		foreach ($regs as $reg) {
1630
-			$cle = ($reg[1] ? $reg[1] . ':' : '') . $reg[2];
1630
+			$cle = ($reg[1] ? $reg[1].':' : '').$reg[2];
1631 1631
 			$desc = $traduire($cle, $lang, true);
1632 1632
 			$l = $desc->langue;
1633 1633
 			// si pas de traduction, on laissera l'écriture de l'idiome entier dans le texte.
@@ -1740,9 +1740,9 @@  discard block
 block discarded – undo
1740 1740
 					// il ne faut pas echapper en div si propre produit un seul paragraphe
1741 1741
 					include_spip('inc/texte');
1742 1742
 					$trad_propre = preg_replace(",(^<p[^>]*>|</p>$),Uims", "", propre($trad));
1743
-					$mode = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $trad_propre) ? 'div' : 'span';
1743
+					$mode = preg_match(',</?('._BALISES_BLOCS.')[>[:space:]],iS', $trad_propre) ? 'div' : 'span';
1744 1744
 					if ($mode === 'div') {
1745
-						$trad = rtrim($trad) . "\n\n";
1745
+						$trad = rtrim($trad)."\n\n";
1746 1746
 					}
1747 1747
 					$trad = code_echappement($trad, 'multi', false, $mode);
1748 1748
 					$trad = str_replace("'", '"', inserer_attribut($trad, 'lang', $l));
@@ -1936,7 +1936,7 @@  discard block
 block discarded – undo
1936 1936
 	if (is_array($balise)) {
1937 1937
 		array_walk(
1938 1938
 			$balise,
1939
-			function(&$a, $key, $t){
1939
+			function(&$a, $key, $t) {
1940 1940
 				$a = extraire_attribut($a, $t);
1941 1941
 			},
1942 1942
 			$attribut
@@ -2023,14 +2023,14 @@  discard block
 block discarded – undo
2023 2023
 
2024 2024
 	if ($old !== null) {
2025 2025
 		// Remplacer l'ancien attribut du meme nom
2026
-		$balise = $r[1] . $insert . $r[5];
2026
+		$balise = $r[1].$insert.$r[5];
2027 2027
 	} else {
2028 2028
 		// preferer une balise " />" (comme <img />)
2029 2029
 		if (preg_match(',/>,', $balise)) {
2030
-			$balise = preg_replace(",\s?/>,S", $insert . " />", $balise, 1);
2030
+			$balise = preg_replace(",\s?/>,S", $insert." />", $balise, 1);
2031 2031
 		} // sinon une balise <a ...> ... </a>
2032 2032
 		else {
2033
-			$balise = preg_replace(",\s?>,S", $insert . ">", $balise, 1);
2033
+			$balise = preg_replace(",\s?>,S", $insert.">", $balise, 1);
2034 2034
 		}
2035 2035
 	}
2036 2036
 
@@ -2063,7 +2063,7 @@  discard block
 block discarded – undo
2063 2063
  * @param string $operation
2064 2064
  * @return string
2065 2065
  */
2066
-function modifier_class($balise, $class, $operation='ajouter') {
2066
+function modifier_class($balise, $class, $operation = 'ajouter') {
2067 2067
 	if (is_string($class)) {
2068 2068
 		$class = explode(' ', trim($class));
2069 2069
 	}
@@ -2088,7 +2088,7 @@  discard block
 block discarded – undo
2088 2088
 				}
2089 2089
 				if (in_array($operation, ['ajouter', 'commuter'])
2090 2090
 					and !$is_class_presente) {
2091
-					$class_new = rtrim($class_new) . " " . $c;
2091
+					$class_new = rtrim($class_new)." ".$c;
2092 2092
 				}
2093 2093
 				elseif (in_array($operation, ['supprimer', 'commuter'])
2094 2094
 					and $is_class_presente) {
@@ -2116,7 +2116,7 @@  discard block
 block discarded – undo
2116 2116
  * @param string|array $class
2117 2117
  * @return string
2118 2118
  */
2119
-function ajouter_class($balise, $class){
2119
+function ajouter_class($balise, $class) {
2120 2120
 	return modifier_class($balise, $class, 'ajouter');
2121 2121
 }
2122 2122
 
@@ -2126,7 +2126,7 @@  discard block
 block discarded – undo
2126 2126
  * @param string|array $class
2127 2127
  * @return string
2128 2128
  */
2129
-function supprimer_class($balise, $class){
2129
+function supprimer_class($balise, $class) {
2130 2130
 	return modifier_class($balise, $class, 'supprimer');
2131 2131
 }
2132 2132
 
@@ -2137,7 +2137,7 @@  discard block
 block discarded – undo
2137 2137
  * @param string|array $class
2138 2138
  * @return string
2139 2139
  */
2140
-function commuter_class($balise, $class){
2140
+function commuter_class($balise, $class) {
2141 2141
 	return modifier_class($balise, $class, 'commuter');
2142 2142
 }
2143 2143
 
@@ -2157,8 +2157,8 @@  discard block
 block discarded – undo
2157 2157
 //
2158 2158
 // Quelques fonctions de calcul arithmetique
2159 2159
 //
2160
-function floatstr($a) { return str_replace(',','.',(string)floatval($a)); }
2161
-function strize($f, $a, $b) { return floatstr($f(floatstr($a),floatstr($b))); }
2160
+function floatstr($a) { return str_replace(',', '.', (string) floatval($a)); }
2161
+function strize($f, $a, $b) { return floatstr($f(floatstr($a), floatstr($b))); }
2162 2162
 
2163 2163
 /**
2164 2164
  * Additionne 2 nombres
@@ -2178,7 +2178,7 @@  discard block
 block discarded – undo
2178 2178
 function plus($a, $b) {
2179 2179
 	return $a + $b;
2180 2180
 }
2181
-function strplus($a, $b) {return strize('plus', $a, $b);}
2181
+function strplus($a, $b) {return strize('plus', $a, $b); }
2182 2182
 /**
2183 2183
  * Soustrait 2 nombres
2184 2184
  *
@@ -2197,7 +2197,7 @@  discard block
 block discarded – undo
2197 2197
 function moins($a, $b) {
2198 2198
 	return $a - $b;
2199 2199
 }
2200
-function strmoins($a, $b) {return strize('moins', $a, $b);}
2200
+function strmoins($a, $b) {return strize('moins', $a, $b); }
2201 2201
 
2202 2202
 /**
2203 2203
  * Multiplie 2 nombres
@@ -2218,7 +2218,7 @@  discard block
 block discarded – undo
2218 2218
 function mult($a, $b) {
2219 2219
 	return $a * $b;
2220 2220
 }
2221
-function strmult($a, $b) {return strize('mult', $a, $b);}
2221
+function strmult($a, $b) {return strize('mult', $a, $b); }
2222 2222
 
2223 2223
 /**
2224 2224
  * Divise 2 nombres
@@ -2239,7 +2239,7 @@  discard block
 block discarded – undo
2239 2239
 function div($a, $b) {
2240 2240
 	return $b ? $a / $b : 0;
2241 2241
 }
2242
-function strdiv($a, $b) {return strize('div', $a, $b);}
2242
+function strdiv($a, $b) {return strize('div', $a, $b); }
2243 2243
 
2244 2244
 /**
2245 2245
  * Retourne le modulo 2 nombres
@@ -2280,13 +2280,13 @@  discard block
 block discarded – undo
2280 2280
 	if (!defined('_TAGS_NOM_AUTEUR')) {
2281 2281
 		define('_TAGS_NOM_AUTEUR', '');
2282 2282
 	}
2283
-	$tags_acceptes = array_unique(explode(',', 'multi,' . _TAGS_NOM_AUTEUR));
2283
+	$tags_acceptes = array_unique(explode(',', 'multi,'._TAGS_NOM_AUTEUR));
2284 2284
 	foreach ($tags_acceptes as $tag) {
2285 2285
 		if (strlen($tag)) {
2286
-			$remp1[] = '<' . trim($tag) . '>';
2287
-			$remp1[] = '</' . trim($tag) . '>';
2288
-			$remp2[] = '\x60' . trim($tag) . '\x61';
2289
-			$remp2[] = '\x60/' . trim($tag) . '\x61';
2286
+			$remp1[] = '<'.trim($tag).'>';
2287
+			$remp1[] = '</'.trim($tag).'>';
2288
+			$remp2[] = '\x60'.trim($tag).'\x61';
2289
+			$remp2[] = '\x60/'.trim($tag).'\x61';
2290 2290
 		}
2291 2291
 	}
2292 2292
 	$v_nom = str_replace($remp2, $remp1, supprimer_tags(str_replace($remp1, $remp2, $nom)));
@@ -2336,7 +2336,7 @@  discard block
 block discarded – undo
2336 2336
 			$s[] = preg_replace(',>[^<]+</a>,S',
2337 2337
 				'>'
2338 2338
 				. http_img_pack('attachment-16.png', $t,
2339
-					'title="' . attribut_html($t) . '"')
2339
+					'title="'.attribut_html($t).'"')
2340 2340
 				. '</a>', $tag);
2341 2341
 		}
2342 2342
 	}
@@ -2397,10 +2397,10 @@  discard block
 block discarded – undo
2397 2397
 	$fichier = basename($url);
2398 2398
 
2399 2399
 	return '<a rel="enclosure"'
2400
-	. ($url ? ' href="' . spip_htmlspecialchars($url) . '"' : '')
2401
-	. ($type ? ' type="' . spip_htmlspecialchars($type) . '"' : '')
2402
-	. ($length ? ' title="' . spip_htmlspecialchars($length) . '"' : '')
2403
-	. '>' . $fichier . '</a>';
2400
+	. ($url ? ' href="'.spip_htmlspecialchars($url).'"' : '')
2401
+	. ($type ? ' type="'.spip_htmlspecialchars($type).'"' : '')
2402
+	. ($length ? ' title="'.spip_htmlspecialchars($length).'"' : '')
2403
+	. '>'.$fichier.'</a>';
2404 2404
 }
2405 2405
 
2406 2406
 /**
@@ -2428,9 +2428,9 @@  discard block
 block discarded – undo
2428 2428
 			} # vieux data
2429 2429
 			$fichier = basename($url);
2430 2430
 			$enclosures[] = '<enclosure'
2431
-				. ($url ? ' url="' . spip_htmlspecialchars($url) . '"' : '')
2432
-				. ($type ? ' type="' . spip_htmlspecialchars($type) . '"' : '')
2433
-				. ($length ? ' length="' . $length . '"' : '')
2431
+				. ($url ? ' url="'.spip_htmlspecialchars($url).'"' : '')
2432
+				. ($type ? ' type="'.spip_htmlspecialchars($type).'"' : '')
2433
+				. ($length ? ' length="'.$length.'"' : '')
2434 2434
 				. ' />';
2435 2435
 		}
2436 2436
 	}
@@ -2456,7 +2456,7 @@  discard block
 block discarded – undo
2456 2456
 		if (extraire_attribut($e, 'rel') == 'tag') {
2457 2457
 			$subjects .= '<dc:subject>'
2458 2458
 				. texte_backend(textebrut($e))
2459
-				. '</dc:subject>' . "\n";
2459
+				. '</dc:subject>'."\n";
2460 2460
 		}
2461 2461
 	}
2462 2462
 
@@ -2492,7 +2492,7 @@  discard block
 block discarded – undo
2492 2492
 	if (is_array($texte)) {
2493 2493
 		array_walk(
2494 2494
 			$texte,
2495
-			function(&$a, $key, $t){
2495
+			function(&$a, $key, $t) {
2496 2496
 				$a = extraire_balise($a, $t);
2497 2497
 			},
2498 2498
 			$tag
@@ -2536,7 +2536,7 @@  discard block
 block discarded – undo
2536 2536
 	if (is_array($texte)) {
2537 2537
 		array_walk(
2538 2538
 			$texte,
2539
-			function(&$a, $key, $t){
2539
+			function(&$a, $key, $t) {
2540 2540
 				$a = extraire_balises($a, $t);
2541 2541
 			},
2542 2542
 			$tag
@@ -2662,7 +2662,7 @@  discard block
 block discarded – undo
2662 2662
 		if ($fond != '404') {
2663 2663
 			$contexte = array_shift($p);
2664 2664
 			$contexte['page'] = $fond;
2665
-			$action = preg_replace('/([?]' . preg_quote($fond) . '[^&=]*[0-9]+)(&|$)/', '?&', $action);
2665
+			$action = preg_replace('/([?]'.preg_quote($fond).'[^&=]*[0-9]+)(&|$)/', '?&', $action);
2666 2666
 		}
2667 2667
 	}
2668 2668
 	// defaire ce qu'a injecte urls_decoder_url : a revoir en modifiant la signature de urls_decoder_url
@@ -2717,9 +2717,9 @@  discard block
 block discarded – undo
2717 2717
 			. '"'
2718 2718
 			. (is_null($val)
2719 2719
 				? ''
2720
-				: ' value="' . entites_html($val) . '"'
2720
+				: ' value="'.entites_html($val).'"'
2721 2721
 			)
2722
-			. ' type="hidden"' . "\n/>";
2722
+			. ' type="hidden"'."\n/>";
2723 2723
 	}
2724 2724
 
2725 2725
 	return join("", $hidden);
@@ -2830,7 +2830,7 @@  discard block
 block discarded – undo
2830 2830
 	return preg_replace_callback(
2831 2831
 		",url\s*\(\s*['\"]?([^'\"/#\s][^:]*)['\"]?\s*\),Uims",
2832 2832
 		function($x) use ($path) {
2833
-			return "url('" . suivre_lien($path, $x[1]) . "')";
2833
+			return "url('".suivre_lien($path, $x[1])."')";
2834 2834
 		},
2835 2835
 		$contenu
2836 2836
 	);
@@ -2892,14 +2892,14 @@  discard block
 block discarded – undo
2892 2892
 	) {
2893 2893
 		$distant = true;
2894 2894
 		$cssf = parse_url($css);
2895
-		$cssf = $cssf['path'] . ($cssf['query'] ? "?" . $cssf['query'] : "");
2895
+		$cssf = $cssf['path'].($cssf['query'] ? "?".$cssf['query'] : "");
2896 2896
 		$cssf = preg_replace(',[?:&=],', "_", $cssf);
2897 2897
 	} else {
2898 2898
 		$distant = false;
2899 2899
 		$cssf = $css;
2900 2900
 		// 1. regarder d'abord si un fichier avec la bonne direction n'est pas aussi
2901 2901
 		//propose (rien a faire dans ce cas)
2902
-		$f = preg_replace(',(_rtl)?\.css$,i', '_' . $ndir . '.css', $css);
2902
+		$f = preg_replace(',(_rtl)?\.css$,i', '_'.$ndir.'.css', $css);
2903 2903
 		if (@file_exists($f)) {
2904 2904
 			return $f;
2905 2905
 		}
@@ -2909,7 +2909,7 @@  discard block
 block discarded – undo
2909 2909
 	$dir_var = sous_repertoire(_DIR_VAR, 'cache-css');
2910 2910
 	$f = $dir_var
2911 2911
 		. preg_replace(',.*/(.*?)(_rtl)?\.css,', '\1', $cssf)
2912
-		. '.' . substr(md5($cssf), 0, 4) . '_' . $ndir . '.css';
2912
+		. '.'.substr(md5($cssf), 0, 4).'_'.$ndir.'.css';
2913 2913
 
2914 2914
 	// la css peut etre distante (url absolue !)
2915 2915
 	if ($distant) {
@@ -2954,8 +2954,8 @@  discard block
 block discarded – undo
2954 2954
 		} // si la css_direction commence par $dir_var on la fait passer pour une absolue
2955 2955
 		elseif (substr($css_direction, 0, strlen($dir_var)) == $dir_var) {
2956 2956
 			$css_direction = substr($css_direction, strlen($dir_var));
2957
-			$src_faux_abs["/@@@@@@/" . $css_direction] = $css_direction;
2958
-			$css_direction = "/@@@@@@/" . $css_direction;
2957
+			$src_faux_abs["/@@@@@@/".$css_direction] = $css_direction;
2958
+			$css_direction = "/@@@@@@/".$css_direction;
2959 2959
 		}
2960 2960
 		$src[] = $regs[0][$k];
2961 2961
 		$src_direction_css[] = str_replace($import_css, $css_direction, $regs[0][$k]);
@@ -3004,7 +3004,7 @@  discard block
 block discarded – undo
3004 3004
 
3005 3005
 	$f = basename($css, '.css');
3006 3006
 	$f = sous_repertoire(_DIR_VAR, 'cache-css')
3007
-		. preg_replace(",(.*?)(_rtl|_ltr)?$,", "\\1-urlabs-" . substr(md5("$css-urlabs"), 0, 4) . "\\2", $f)
3007
+		. preg_replace(",(.*?)(_rtl|_ltr)?$,", "\\1-urlabs-".substr(md5("$css-urlabs"), 0, 4)."\\2", $f)
3008 3008
 		. '.css';
3009 3009
 
3010 3010
 	if ((@filemtime($f) > @filemtime($css)) and (_VAR_MODE != 'recalcul')) {
@@ -3013,7 +3013,7 @@  discard block
 block discarded – undo
3013 3013
 
3014 3014
 	if ($url_absolue_css == $css) {
3015 3015
 		if (strncmp($GLOBALS['meta']['adresse_site'], $css, $l = strlen($GLOBALS['meta']['adresse_site'])) != 0
3016
-			or !lire_fichier(_DIR_RACINE . substr($css, $l), $contenu)
3016
+			or !lire_fichier(_DIR_RACINE.substr($css, $l), $contenu)
3017 3017
 		) {
3018 3018
 			include_spip('inc/distant');
3019 3019
 			$contenu = recuperer_url($css);
@@ -3125,7 +3125,7 @@  discard block
 block discarded – undo
3125 3125
 	$expression = str_replace("\/", "/", $expression);
3126 3126
 	$expression = str_replace("/", "\/", $expression);
3127 3127
 
3128
-	if (preg_match('/' . $expression . '/' . $modif, $texte, $r)) {
3128
+	if (preg_match('/'.$expression.'/'.$modif, $texte, $r)) {
3129 3129
 		if (isset($r[$capte])) {
3130 3130
 			return $r[$capte];
3131 3131
 		} else {
@@ -3163,7 +3163,7 @@  discard block
 block discarded – undo
3163 3163
 	$expression = str_replace("\/", "/", $expression);
3164 3164
 	$expression = str_replace("/", "\/", $expression);
3165 3165
 
3166
-	return preg_replace('/' . $expression . '/' . $modif, $replace, $texte);
3166
+	return preg_replace('/'.$expression.'/'.$modif, $replace, $texte);
3167 3167
 }
3168 3168
 
3169 3169
 
@@ -3182,7 +3182,7 @@  discard block
 block discarded – undo
3182 3182
 function traiter_doublons_documents(&$doublons, $letexte) {
3183 3183
 
3184 3184
 	// Verifier dans le texte & les notes (pas beau, helas)
3185
-	$t = $letexte . $GLOBALS['les_notes'];
3185
+	$t = $letexte.$GLOBALS['les_notes'];
3186 3186
 
3187 3187
 	if (strstr($t, 'spip_document_') // evite le preg_match_all si inutile
3188 3188
 		and preg_match_all(
@@ -3192,7 +3192,7 @@  discard block
 block discarded – undo
3192 3192
 		if (!isset($doublons['documents'])) {
3193 3193
 			$doublons['documents'] = "";
3194 3194
 		}
3195
-		$doublons['documents'] .= "," . join(',', $matches[1]);
3195
+		$doublons['documents'] .= ",".join(',', $matches[1]);
3196 3196
 	}
3197 3197
 
3198 3198
 	return $letexte;
@@ -3249,7 +3249,7 @@  discard block
 block discarded – undo
3249 3249
 	if ($env) {
3250 3250
 		foreach ($env as $i => $j) {
3251 3251
 			if (is_string($j) and !in_array($i, $ignore_params)) {
3252
-				$texte .= "<param name='" . attribut_html($i) . "'\n\tvalue='" . attribut_html($j) . "' />";
3252
+				$texte .= "<param name='".attribut_html($i)."'\n\tvalue='".attribut_html($j)."' />";
3253 3253
 			}
3254 3254
 		}
3255 3255
 	}
@@ -3288,7 +3288,7 @@  discard block
 block discarded – undo
3288 3288
 	if ($env) {
3289 3289
 		foreach ($env as $i => $j) {
3290 3290
 			if (is_string($j) and !in_array($i, $ignore_params)) {
3291
-				$texte .= attribut_html($i) . "='" . attribut_html($j) . "' ";
3291
+				$texte .= attribut_html($i)."='".attribut_html($j)."' ";
3292 3292
 			}
3293 3293
 		}
3294 3294
 	}
@@ -3361,9 +3361,9 @@  discard block
 block discarded – undo
3361 3361
 	// on peut fournir une icone generique -xx.svg qui fera le job dans toutes les tailles, et qui est prioritaire sur le png
3362 3362
 	// si il y a un .svg a la bonne taille (-16.svg) a cote, on l'utilise en remplacement du -16.png
3363 3363
 	if (preg_match(',-(\d+)[.](png|gif|svg)$,', $img_file, $m)
3364
-	  and $variante_svg_generique = substr($img_file, 0, -strlen($m[0])) . "-xx.svg"
3364
+	  and $variante_svg_generique = substr($img_file, 0, -strlen($m[0]))."-xx.svg"
3365 3365
 	  and file_exists($variante_svg_generique)) {
3366
-		if ($variante_svg_size = substr($variante_svg_generique,0,-6) . $m[1] . ".svg" and file_exists($variante_svg_size)) {
3366
+		if ($variante_svg_size = substr($variante_svg_generique, 0, -6).$m[1].".svg" and file_exists($variante_svg_size)) {
3367 3367
 			$img_file = $variante_svg_size;
3368 3368
 		}
3369 3369
 		else {
@@ -3394,13 +3394,13 @@  discard block
 block discarded – undo
3394 3394
 
3395 3395
 	$img_file = $img;
3396 3396
 	if ($p = strpos($img_file, '?')) {
3397
-		$img_file = substr($img_file,0, $p);
3397
+		$img_file = substr($img_file, 0, $p);
3398 3398
 	}
3399 3399
 	if (!isset($options['chemin_image']) or $options['chemin_image'] == true) {
3400 3400
 		$img_file = chemin_image($img);
3401 3401
 	}
3402 3402
 	else {
3403
-		if (!isset($options['variante_svg_si_possible']) or $options['variante_svg_si_possible'] == true){
3403
+		if (!isset($options['variante_svg_si_possible']) or $options['variante_svg_si_possible'] == true) {
3404 3404
 			$img_file = http_img_variante_svg_si_possible($img_file);
3405 3405
 		}
3406 3406
 	}
@@ -3420,7 +3420,7 @@  discard block
 block discarded – undo
3420 3420
 				return "";
3421 3421
 			}
3422 3422
 		}
3423
-		$atts .= " width='" . $largeur . "' height='" . $hauteur . "'";
3423
+		$atts .= " width='".$largeur."' height='".$hauteur."'";
3424 3424
 	}
3425 3425
 
3426 3426
 	if (file_exists($img_file)) {
@@ -3429,15 +3429,15 @@  discard block
 block discarded – undo
3429 3429
 	if ($alt === false) {
3430 3430
 		$alt = '';
3431 3431
 	}
3432
-	elseif($alt or $alt==='') {
3432
+	elseif ($alt or $alt === '') {
3433 3433
 		$alt = " alt='".attribut_html($alt)."'";
3434 3434
 	}
3435 3435
 	else {
3436 3436
 		$alt = " alt='".attribut_html($title)."'";
3437 3437
 	}
3438 3438
 	return "<img src='$img_file'$alt"
3439
-	. ($title ? ' title="' . attribut_html($title) . '"' : '')
3440
-	. " " . ltrim($atts)
3439
+	. ($title ? ' title="'.attribut_html($title).'"' : '')
3440
+	. " ".ltrim($atts)
3441 3441
 	. " />";
3442 3442
 }
3443 3443
 
@@ -3449,12 +3449,12 @@  discard block
 block discarded – undo
3449 3449
  * @param string $size
3450 3450
  * @return string
3451 3451
  */
3452
-function http_style_background($img, $att = '', $size=null) {
3453
-	if ($size and is_numeric($size)){
3454
-		$size = trim($size) . "px";
3452
+function http_style_background($img, $att = '', $size = null) {
3453
+	if ($size and is_numeric($size)) {
3454
+		$size = trim($size)."px";
3455 3455
 	}
3456
-	return " style='background" .
3457
-		($att ? "" : "-image") . ": url(\"" . chemin_image($img) . "\")" . ($att ? (' ' . $att) : '') . ";"
3456
+	return " style='background".
3457
+		($att ? "" : "-image").": url(\"".chemin_image($img)."\")".($att ? (' '.$att) : '').";"
3458 3458
 		. ($size ? "background-size:{$size};" : '')
3459 3459
 		. "'";
3460 3460
 }
@@ -3480,7 +3480,7 @@  discard block
 block discarded – undo
3480 3480
 			$args[] = $maybe_size;
3481 3481
 			$maybe_size = null;
3482 3482
 		}
3483
-		while (count($args)<2) {
3483
+		while (count($args) < 2) {
3484 3484
 			$args[] = null; // default alt or class
3485 3485
 		}
3486 3486
 		$args[] = $maybe_size;
@@ -3490,7 +3490,7 @@  discard block
 block discarded – undo
3490 3490
 
3491 3491
 function helper_filtre_balise_img_svg_size($img, $size) {
3492 3492
 	// si size est de la forme '@2x' c'est un coeff multiplicateur sur la densite
3493
-	if (strpos($size, '@') === 0 and substr($size,-1) === 'x') {
3493
+	if (strpos($size, '@') === 0 and substr($size, -1) === 'x') {
3494 3494
 		$coef = floatval(substr($size, 1, -1));
3495 3495
 		list($h, $w) = taille_image($img);
3496 3496
 		$height = intval(round($h / $coef));
@@ -3545,7 +3545,7 @@  discard block
 block discarded – undo
3545 3545
  * @return string
3546 3546
  *     Code HTML de la balise IMG
3547 3547
  */
3548
-function filtre_balise_img_dist($img, $alt = '', $class = null, $size=null) {
3548
+function filtre_balise_img_dist($img, $alt = '', $class = null, $size = null) {
3549 3549
 
3550 3550
 	list($alt, $class, $size) = helper_filtre_balise_img_svg_arguments($alt, $class, $size);
3551 3551
 
@@ -3564,7 +3564,7 @@  discard block
 block discarded – undo
3564 3564
 		}
3565 3565
 	}
3566 3566
 	else {
3567
-		$img = http_img_pack($img, $alt, $class ? " class='" . attribut_html($class) . "'" : '', '',
3567
+		$img = http_img_pack($img, $alt, $class ? " class='".attribut_html($class)."'" : '', '',
3568 3568
 				array('chemin_image' => false, 'utiliser_suffixe_size' => false));
3569 3569
 		if (is_null($alt)) {
3570 3570
 			$img = vider_attribut($img, 'alt');
@@ -3610,16 +3610,16 @@  discard block
 block discarded – undo
3610 3610
  * @return string
3611 3611
  *     Code HTML de la balise SVG
3612 3612
  */
3613
-function filtre_balise_svg_dist($img, $alt = '', $class = null, $size=null) {
3613
+function filtre_balise_svg_dist($img, $alt = '', $class = null, $size = null) {
3614 3614
 
3615 3615
 	$img = trim($img);
3616 3616
 	$img_file = $img;
3617
-	if (strpos($img, '<svg') === false){
3618
-		if ($p = strpos($img_file, '?')){
3617
+	if (strpos($img, '<svg') === false) {
3618
+		if ($p = strpos($img_file, '?')) {
3619 3619
 			$img_file = substr($img_file, 0, $p);
3620 3620
 		}
3621 3621
 
3622
-		if (!$img_file or !$svg = file_get_contents($img_file)){
3622
+		if (!$img_file or !$svg = file_get_contents($img_file)) {
3623 3623
 			return '';
3624 3624
 		}
3625 3625
 	}
@@ -3634,7 +3634,7 @@  discard block
 block discarded – undo
3634 3634
 	$balise_svg_source = $balise_svg;
3635 3635
 
3636 3636
 	// entete XML à supprimer
3637
-	$svg = preg_replace(',^\s*<\?xml[^>]*\?' . '>,', '', $svg);
3637
+	$svg = preg_replace(',^\s*<\?xml[^>]*\?'.'>,', '', $svg);
3638 3638
 
3639 3639
 	// IE est toujours mon ami
3640 3640
 	$balise_svg = inserer_attribut($balise_svg, 'focusable', 'false');
@@ -3650,11 +3650,11 @@  discard block
 block discarded – undo
3650 3650
 	}
3651 3651
 
3652 3652
 	// regler le alt
3653
-	if ($alt){
3653
+	if ($alt) {
3654 3654
 		$balise_svg = inserer_attribut($balise_svg, 'role', 'img');
3655
-		$id = "img-svg-title-" . substr(md5("$img_file:$svg:$alt"),0,4);
3655
+		$id = "img-svg-title-".substr(md5("$img_file:$svg:$alt"), 0, 4);
3656 3656
 		$balise_svg = inserer_attribut($balise_svg, 'aria-labelledby', $id);
3657
-		$title = "<title id=\"$id\">" . entites_html($alt)."</title>\n";
3657
+		$title = "<title id=\"$id\">".entites_html($alt)."</title>\n";
3658 3658
 		$balise_svg .= $title;
3659 3659
 	}
3660 3660
 	else {
@@ -3701,7 +3701,7 @@  discard block
 block discarded – undo
3701 3701
 	$texte = '';
3702 3702
 	if (is_array($tableau)) {
3703 3703
 		foreach ($tableau as $k => $v) {
3704
-			$res = recuperer_fond('modeles/' . $modele,
3704
+			$res = recuperer_fond('modeles/'.$modele,
3705 3705
 				array_merge(array('cle' => $k), (is_array($v) ? $v : array('valeur' => $v)))
3706 3706
 			);
3707 3707
 			$texte .= $res;
@@ -3878,7 +3878,7 @@  discard block
 block discarded – undo
3878 3878
 	}
3879 3879
 
3880 3880
 	$c = serialize($c);
3881
-	$cle = calculer_cle_action($form . $c);
3881
+	$cle = calculer_cle_action($form.$c);
3882 3882
 	$c = "$cle:$c";
3883 3883
 
3884 3884
 	// on ne stocke pas les contextes dans des fichiers en cache
@@ -3935,15 +3935,15 @@  discard block
 block discarded – undo
3935 3935
 	}
3936 3936
 	// toujours encoder l'url source dans le bloc ajax
3937 3937
 	$r = self();
3938
-	$r = ' data-origin="' . $r . '"';
3938
+	$r = ' data-origin="'.$r.'"';
3939 3939
 	$class = 'ajaxbloc';
3940 3940
 	if ($ajaxid and is_string($ajaxid)) {
3941 3941
 		// ajaxid est normalement conforme a un nom de classe css
3942 3942
 		// on ne verifie pas la conformite, mais on passe entites_html par dessus par precaution
3943
-		$class .= ' ajax-id-' . entites_html($ajaxid);
3943
+		$class .= ' ajax-id-'.entites_html($ajaxid);
3944 3944
 	}
3945 3945
 
3946
-	return "<div class='$class' " . "data-ajax-env='$env'$r>\n$emboite</div><!--ajaxbloc-->\n";
3946
+	return "<div class='$class' "."data-ajax-env='$env'$r>\n$emboite</div><!--ajaxbloc-->\n";
3947 3947
 }
3948 3948
 
3949 3949
 /**
@@ -3982,11 +3982,11 @@  discard block
 block discarded – undo
3982 3982
 	// extraire la signature en debut de contexte
3983 3983
 	// et la verifier avant de deserializer
3984 3984
 	// format : signature:donneesserializees
3985
-	if ($p = strpos($c,":")){
3986
-		$cle = substr($c,0,$p);
3987
-		$c = substr($c,$p+1);
3985
+	if ($p = strpos($c, ":")) {
3986
+		$cle = substr($c, 0, $p);
3987
+		$c = substr($c, $p + 1);
3988 3988
 
3989
-		if ($cle == calculer_cle_action($form . $c)) {
3989
+		if ($cle == calculer_cle_action($form.$c)) {
3990 3990
 			$env = @unserialize($c);
3991 3991
 			return $env;
3992 3992
 		}
@@ -4092,24 +4092,24 @@  discard block
 block discarded – undo
4092 4092
 		$att = "";
4093 4093
 		// si $on passe la balise et optionnelement une ou ++classe
4094 4094
 		// a.active span.selected.active etc....
4095
-		if (is_string($on) and (strncmp($on, 'a', 1)==0 or strncmp($on, 'span', 4)==0 or strncmp($on, 'strong', 6)==0)){
4095
+		if (is_string($on) and (strncmp($on, 'a', 1) == 0 or strncmp($on, 'span', 4) == 0 or strncmp($on, 'strong', 6) == 0)) {
4096 4096
 			$on = explode(".", $on);
4097 4097
 			// on verifie que c'est exactement une des 3 balises a, span ou strong
4098
-			if (in_array(reset($on), array('a', 'span', 'strong'))){
4098
+			if (in_array(reset($on), array('a', 'span', 'strong'))) {
4099 4099
 				$bal = array_shift($on);
4100 4100
 				$class = implode(" ", $on);
4101
-				if ($bal=="a"){
4101
+				if ($bal == "a") {
4102 4102
 					$att = 'href="#" ';
4103 4103
 				}
4104 4104
 			}
4105 4105
 		}
4106
-		$att .= 'class="' . ($class ? attribut_html($class) . ' ' : '') . (defined('_LIEN_OU_EXPOSE_CLASS_ON') ? _LIEN_OU_EXPOSE_CLASS_ON : 'on') . '"';
4106
+		$att .= 'class="'.($class ? attribut_html($class).' ' : '').(defined('_LIEN_OU_EXPOSE_CLASS_ON') ? _LIEN_OU_EXPOSE_CLASS_ON : 'on').'"';
4107 4107
 	} else {
4108 4108
 		$bal = 'a';
4109 4109
 		$att = "href='$url'"
4110
-			. ($title ? " title='" . attribut_html($title) . "'" : '')
4111
-			. ($class ? " class='" . attribut_html($class) . "'" : '')
4112
-			. ($rel ? " rel='" . attribut_html($rel) . "'" : '')
4110
+			. ($title ? " title='".attribut_html($title)."'" : '')
4111
+			. ($class ? " class='".attribut_html($class)."'" : '')
4112
+			. ($rel ? " rel='".attribut_html($rel)."'" : '')
4113 4113
 			. $evt;
4114 4114
 	}
4115 4115
 	if ($libelle === null) {
@@ -4244,7 +4244,7 @@  discard block
 block discarded – undo
4244 4244
 
4245 4245
 	// Icône
4246 4246
 	$icone = http_img_pack($fond, $alt, "width='$size' height='$size'");
4247
-	$icone = "<span class=\"icone-image".($fonction ? " icone-fonction icone-fonction-$fonction" : "") . "\">$icone</span>";
4247
+	$icone = "<span class=\"icone-image".($fonction ? " icone-fonction icone-fonction-$fonction" : "")."\">$icone</span>";
4248 4248
 
4249 4249
 	// Markup final
4250 4250
 	if ($type == 'lien') {
@@ -4519,20 +4519,20 @@  discard block
 block discarded – undo
4519 4519
 		$class_form = 'ajax';
4520 4520
 		$class = str_replace('ajax', '', $class);
4521 4521
 	}
4522
-	$class_btn = 'submit ' . trim($class);
4522
+	$class_btn = 'submit '.trim($class);
4523 4523
 
4524 4524
 	if ($confirm) {
4525
-		$confirm = "confirm(\"" . attribut_html($confirm) . "\")";
4525
+		$confirm = "confirm(\"".attribut_html($confirm)."\")";
4526 4526
 		if ($callback) {
4527 4527
 			$callback = "$confirm?($callback):false";
4528 4528
 		} else {
4529 4529
 			$callback = $confirm;
4530 4530
 		}
4531 4531
 	}
4532
-	$onclick = $callback ? " onclick='return " . addcslashes($callback, "'") . "'" : "";
4532
+	$onclick = $callback ? " onclick='return ".addcslashes($callback, "'")."'" : "";
4533 4533
 	$title = $title ? " title='$title'" : '';
4534 4534
 
4535
-	return "<form class='bouton_action_post $class_form' method='post' action='$url'><div>" . form_hidden($url)
4535
+	return "<form class='bouton_action_post $class_form' method='post' action='$url'><div>".form_hidden($url)
4536 4536
 	. "<button type='submit' class='$class_btn'$title$onclick>$libelle</button></div></form>";
4537 4537
 }
4538 4538
 
@@ -4596,14 +4596,14 @@  discard block
 block discarded – undo
4596 4596
 		$champ_titre = "";
4597 4597
 		if ($demande_titre) {
4598 4598
 			// si pas de titre declare mais champ titre, il sera peuple par le select *
4599
-			$champ_titre = (!empty($desc['titre'])) ? ', ' . $desc['titre'] : '';
4599
+			$champ_titre = (!empty($desc['titre'])) ? ', '.$desc['titre'] : '';
4600 4600
 		}
4601 4601
 		include_spip('base/abstract_sql');
4602 4602
 		include_spip('base/connect_sql');
4603 4603
 		$objets[$type_objet][$id_objet] = sql_fetsel(
4604
-			'*' . $champ_titre,
4604
+			'*'.$champ_titre,
4605 4605
 			$desc['table_sql'],
4606
-			id_table_objet($type_objet) . ' = ' . intval($id_objet)
4606
+			id_table_objet($type_objet).' = '.intval($id_objet)
4607 4607
 		);
4608 4608
 
4609 4609
 		// Toujours noter la longueur d'introduction, même si pas demandé cette fois-ci
@@ -4677,8 +4677,7 @@  discard block
 block discarded – undo
4677 4677
 	if (isset($ligne_sql['chapo'])) {
4678 4678
 		$chapo = $ligne_sql['chapo'];
4679 4679
 		$texte = strlen($descriptif) ?
4680
-			'' :
4681
-			"$chapo \n\n $texte";
4680
+			'' : "$chapo \n\n $texte";
4682 4681
 	}
4683 4682
 
4684 4683
 	// Longueur en paramètre, sinon celle renseignée dans la description de l'objet, sinon valeur en dur
@@ -4745,7 +4744,7 @@  discard block
 block discarded – undo
4745 4744
 		return $texte;
4746 4745
 	}
4747 4746
 
4748
-	$traitement = str_replace('%s', "'" . texte_script($texte) . "'", $traitement);
4747
+	$traitement = str_replace('%s', "'".texte_script($texte)."'", $traitement);
4749 4748
 
4750 4749
 	// Fournir $connect et $Pile[0] au traitement si besoin
4751 4750
 	$Pile = array(0 => $env);
@@ -4779,7 +4778,7 @@  discard block
 block discarded – undo
4779 4778
 	}
4780 4779
 	$url = generer_url_entite($id_objet, $objet, '', '', $connect);
4781 4780
 
4782
-	return "<a href='$url' class='$objet'>" . couper($titre, $longueur) . "</a>";
4781
+	return "<a href='$url' class='$objet'>".couper($titre, $longueur)."</a>";
4783 4782
 }
4784 4783
 
4785 4784
 
@@ -4798,10 +4797,10 @@  discard block
 block discarded – undo
4798 4797
 function wrap($texte, $wrap) {
4799 4798
 	$balises = extraire_balises($wrap);
4800 4799
 	if (preg_match_all(",<([a-z]\w*)\b[^>]*>,UimsS", $wrap, $regs, PREG_PATTERN_ORDER)) {
4801
-		$texte = $wrap . $texte;
4800
+		$texte = $wrap.$texte;
4802 4801
 		$regs = array_reverse($regs[1]);
4803
-		$wrap = "</" . implode("></", $regs) . ">";
4804
-		$texte = $texte . $wrap;
4802
+		$wrap = "</".implode("></", $regs).">";
4803
+		$texte = $texte.$wrap;
4805 4804
 	}
4806 4805
 
4807 4806
 	return $texte;
@@ -4832,7 +4831,7 @@  discard block
 block discarded – undo
4832 4831
 
4833 4832
 	// caster $u en array si besoin
4834 4833
 	if (is_object($u)) {
4835
-		$u = (array)$u;
4834
+		$u = (array) $u;
4836 4835
 	}
4837 4836
 
4838 4837
 	if (is_array($u)) {
@@ -4853,7 +4852,7 @@  discard block
 block discarded – undo
4853 4852
 		// sinon on passe a la ligne et on indente
4854 4853
 		$i_str = str_pad("", $indent, " ");
4855 4854
 		foreach ($u as $k => $v) {
4856
-			$out .= $join . $i_str . "$k: " . filtre_print_dist($v, $join, $indent + 2);
4855
+			$out .= $join.$i_str."$k: ".filtre_print_dist($v, $join, $indent + 2);
4857 4856
 		}
4858 4857
 
4859 4858
 		return $out;
@@ -4906,8 +4905,8 @@  discard block
 block discarded – undo
4906 4905
  * @param string $class
4907 4906
  * @return string
4908 4907
  */
4909
-function objet_icone($objet, $taille = 24, $class='') {
4910
-	$icone = objet_info($objet, 'icone_objet') . "-" . $taille . ".png";
4908
+function objet_icone($objet, $taille = 24, $class = '') {
4909
+	$icone = objet_info($objet, 'icone_objet')."-".$taille.".png";
4911 4910
 	$icone = chemin_image($icone);
4912 4911
 	$balise_img = charger_filtre('balise_img');
4913 4912
 
@@ -4931,12 +4930,12 @@  discard block
 block discarded – undo
4931 4930
  * @param array $options
4932 4931
  * @return string
4933 4932
  */
4934
-function objet_T($objet, $chaine, $args = array(), $options = array()){
4935
-	$chaine = explode(':',$chaine);
4936
-	if ($t = _T($objet . ':' . end($chaine), $args, array_merge($options, array('force'=>false)))) {
4933
+function objet_T($objet, $chaine, $args = array(), $options = array()) {
4934
+	$chaine = explode(':', $chaine);
4935
+	if ($t = _T($objet.':'.end($chaine), $args, array_merge($options, array('force'=>false)))) {
4937 4936
 		return $t;
4938 4937
 	}
4939
-	$chaine = implode(':',$chaine);
4938
+	$chaine = implode(':', $chaine);
4940 4939
 	return _T($chaine, $args, $options);
4941 4940
 }
4942 4941
 
@@ -4998,7 +4997,7 @@  discard block
 block discarded – undo
4998 4997
 	$cache = recuperer_fond($fond, $contexte, $options, $connect);
4999 4998
 
5000 4999
 	// calculer le nom de la css
5001
-	$dir_var = sous_repertoire(_DIR_VAR, 'cache-' . $extension);
5000
+	$dir_var = sous_repertoire(_DIR_VAR, 'cache-'.$extension);
5002 5001
 	$nom_safe = preg_replace(",\W,", '_', str_replace('.', '_', $fond));
5003 5002
 	$contexte_implicite = calculer_contexte_implicite();
5004 5003
 
@@ -5006,22 +5005,22 @@  discard block
 block discarded – undo
5006 5005
 	// mais on peut hasher selon le contenu a la demande, si plusieurs contextes produisent un meme contenu
5007 5006
 	// reduit la variabilite du nom et donc le nombre de css concatenees possibles in fine
5008 5007
 	if (isset($options['hash_on_content']) and $options['hash_on_content']) {
5009
-		$hash = md5($contexte_implicite['host'] . '::'. $cache);
5008
+		$hash = md5($contexte_implicite['host'].'::'.$cache);
5010 5009
 	}
5011 5010
 	else {
5012 5011
 		unset($contexte_implicite['notes']); // pas pertinent pour signaler un changeemnt de contenu pour des css/js
5013 5012
 		ksort($contexte);
5014
-		$hash = md5($fond . json_encode($contexte_implicite) . json_encode($contexte) . $connect);
5013
+		$hash = md5($fond.json_encode($contexte_implicite).json_encode($contexte).$connect);
5015 5014
 	}
5016
-	$filename = $dir_var . $extension . "dyn-$nom_safe-" . substr($hash, 0, 8) . ".$extension";
5015
+	$filename = $dir_var.$extension."dyn-$nom_safe-".substr($hash, 0, 8).".$extension";
5017 5016
 
5018 5017
 	// mettre a jour le fichier si il n'existe pas
5019 5018
 	// ou trop ancien
5020 5019
 	// le dernier fichier produit est toujours suffixe par .last
5021 5020
 	// et recopie sur le fichier cible uniquement si il change
5022 5021
 	if (!file_exists($filename)
5023
-		or !file_exists($filename . ".last")
5024
-		or (isset($cache['lastmodified']) and $cache['lastmodified'] and filemtime($filename . ".last") < $cache['lastmodified'])
5022
+		or !file_exists($filename.".last")
5023
+		or (isset($cache['lastmodified']) and $cache['lastmodified'] and filemtime($filename.".last") < $cache['lastmodified'])
5025 5024
 		or (defined('_VAR_MODE') and _VAR_MODE == 'recalcul')
5026 5025
 	) {
5027 5026
 		$contenu = $cache['texte'];
@@ -5040,10 +5039,10 @@  discard block
 block discarded – undo
5040 5039
 			}
5041 5040
 			// pas de date dans le commentaire car sinon ca invalide le md5 et force la maj
5042 5041
 			// mais on peut mettre un md5 du contenu, ce qui donne un aperu rapide si la feuille a change ou non
5043
-			$comment .= "}\n   md5:" . md5($contenu) . " */\n";
5042
+			$comment .= "}\n   md5:".md5($contenu)." */\n";
5044 5043
 		}
5045 5044
 		// et ecrire le fichier si il change
5046
-		ecrire_fichier_calcule_si_modifie($filename, $comment . $contenu, false, true);
5045
+		ecrire_fichier_calcule_si_modifie($filename, $comment.$contenu, false, true);
5047 5046
 	}
5048 5047
 
5049 5048
 	return timestamp($filename);
@@ -5238,11 +5237,11 @@  discard block
 block discarded – undo
5238 5237
 function spip_affiche_mot_de_passe_masque($passe, $afficher_partiellement = false, $portion_pourcent = null) {
5239 5238
 	$l = strlen($passe);
5240 5239
 
5241
-	if ($l<=8 or !$afficher_partiellement){
5240
+	if ($l <= 8 or !$afficher_partiellement) {
5242 5241
 		if (!$l) {
5243 5242
 			return ''; // montrer qu'il y a pas de mot de passe si il y en a pas
5244 5243
 		}
5245
-		return str_pad('',$afficher_partiellement ? $l : 16,'*');
5244
+		return str_pad('', $afficher_partiellement ? $l : 16, '*');
5246 5245
 	}
5247 5246
 
5248 5247
 	if (is_null($portion_pourcent)) {
@@ -5256,11 +5255,11 @@  discard block
 block discarded – undo
5256 5255
 	}
5257 5256
 	$e = intval(ceil($l * $portion_pourcent / 100 / 2));
5258 5257
 	$e = max($e, 0);
5259
-	$mid = str_pad('',$l-2*$e,'*');
5260
-	if ($e>0 and strlen($mid)>8){
5258
+	$mid = str_pad('', $l - 2 * $e, '*');
5259
+	if ($e > 0 and strlen($mid) > 8) {
5261 5260
 		$mid = '***...***';
5262 5261
 	}
5263
-	return substr($passe,0,$e) . $mid . ($e > 0 ? substr($passe,-$e) : '');
5262
+	return substr($passe, 0, $e).$mid.($e > 0 ? substr($passe, -$e) : '');
5264 5263
 }
5265 5264
 
5266 5265
 
@@ -5282,9 +5281,9 @@  discard block
 block discarded – undo
5282 5281
 function identifiant_slug($texte, $type = '', $options = array()) {
5283 5282
 
5284 5283
 	$original = $texte;
5285
-	$separateur = (isset($options['separateur'])?$options['separateur']:'_');
5286
-	$longueur_maxi = (isset($options['longueur_maxi'])?$options['longueur_maxi']:60);
5287
-	$longueur_mini = (isset($options['longueur_mini'])?$options['longueur_mini']:0);
5284
+	$separateur = (isset($options['separateur']) ? $options['separateur'] : '_');
5285
+	$longueur_maxi = (isset($options['longueur_maxi']) ? $options['longueur_maxi'] : 60);
5286
+	$longueur_mini = (isset($options['longueur_mini']) ? $options['longueur_mini'] : 0);
5288 5287
 
5289 5288
 	if (!function_exists('translitteration')) {
5290 5289
 		include_spip('inc/charsets');
@@ -5326,15 +5325,15 @@  discard block
 block discarded – undo
5326 5325
 			}
5327 5326
 	}
5328 5327
 
5329
-	if (strlen($texte)>$longueur_maxi) {
5328
+	if (strlen($texte) > $longueur_maxi) {
5330 5329
 		$texte = substr($texte, 0, $longueur_maxi);
5331 5330
 	}
5332 5331
 
5333 5332
 	if (strlen($texte) < $longueur_mini and $longueur_mini < $longueur_maxi) {
5334 5333
 		if (preg_match(',^\d,', $texte)) {
5335
-			$texte = ($type ? substr($type,0,1) : "s") . $texte;
5334
+			$texte = ($type ? substr($type, 0, 1) : "s").$texte;
5336 5335
 		}
5337
-		$texte .= $separateur . md5($original);
5336
+		$texte .= $separateur.md5($original);
5338 5337
 		$texte = substr($texte, 0, $longueur_mini);
5339 5338
 	}
5340 5339
 
Please login to merge, or discard this patch.
ecrire/inc_version.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -49,11 +49,11 @@  discard block
 block discarded – undo
49 49
 define('_DIR_RACINE', _DIR_RESTREINT ? '' : '../');
50 50
 
51 51
 /** chemin absolu vers la racine */
52
-define('_ROOT_RACINE', dirname(__DIR__) . '/');
52
+define('_ROOT_RACINE', dirname(__DIR__).'/');
53 53
 /** chemin absolu vers le repertoire de travail */
54
-define('_ROOT_CWD', getcwd() . '/');
54
+define('_ROOT_CWD', getcwd().'/');
55 55
 /** chemin absolu vers ecrire */
56
-define('_ROOT_RESTREINT', _ROOT_CWD . _DIR_RESTREINT);
56
+define('_ROOT_RESTREINT', _ROOT_CWD._DIR_RESTREINT);
57 57
 
58 58
 // Icones
59 59
 if (!defined('_NOM_IMG_PACK')) {
@@ -61,17 +61,17 @@  discard block
 block discarded – undo
61 61
 	define('_NOM_IMG_PACK', 'images/');
62 62
 }
63 63
 /** le chemin http (relatif) vers les images standard */
64
-define('_DIR_IMG_PACK', (_DIR_RACINE . 'prive/' . _NOM_IMG_PACK));
64
+define('_DIR_IMG_PACK', (_DIR_RACINE.'prive/'._NOM_IMG_PACK));
65 65
 
66 66
 /** le chemin php (absolu) vers les images standard (pour hebergement centralise) */
67
-define('_ROOT_IMG_PACK', dirname(__DIR__) . '/prive/' . _NOM_IMG_PACK);
67
+define('_ROOT_IMG_PACK', dirname(__DIR__).'/prive/'._NOM_IMG_PACK);
68 68
 
69 69
 if (!defined('_JAVASCRIPT')) {
70 70
 	/** Nom du repertoire des  bibliotheques JavaScript */
71 71
 	define('_JAVASCRIPT', 'javascript/');
72 72
 } // utilisable avec #CHEMIN et find_in_path
73 73
 /** le nom du repertoire des  bibliotheques JavaScript du prive */
74
-define('_DIR_JAVASCRIPT', (_DIR_RACINE . 'prive/' . _JAVASCRIPT));
74
+define('_DIR_JAVASCRIPT', (_DIR_RACINE.'prive/'._JAVASCRIPT));
75 75
 
76 76
 # Le nom des 4 repertoires modifiables par les scripts lances par httpd
77 77
 # Par defaut ces 4 noms seront suffixes par _DIR_RACINE (cf plus bas)
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 }
102 102
 
103 103
 // Son emplacement absolu si on le trouve
104
-if (@file_exists($f = _ROOT_RACINE . _NOM_PERMANENTS_INACCESSIBLES . _NOM_CONFIG . '.php')
105
-	or (@file_exists($f = _ROOT_RESTREINT . _NOM_CONFIG . '.php'))
104
+if (@file_exists($f = _ROOT_RACINE._NOM_PERMANENTS_INACCESSIBLES._NOM_CONFIG.'.php')
105
+	or (@file_exists($f = _ROOT_RESTREINT._NOM_CONFIG.'.php'))
106 106
 ) {
107 107
 	/** Emplacement absolu du fichier d'option */
108 108
 	define('_FILE_OPTIONS', $f);
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 
126 126
 // Inclure l'ecran de securite
127 127
 if (!defined('_ECRAN_SECURITE')
128
-	and @file_exists($f = _ROOT_RACINE . _NOM_PERMANENTS_INACCESSIBLES . 'ecran_securite.php')
128
+	and @file_exists($f = _ROOT_RACINE._NOM_PERMANENTS_INACCESSIBLES.'ecran_securite.php')
129 129
 ) {
130 130
 	include $f;
131 131
 }
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 			. 'MSIE 6\.0|'
145 145
 			// UA plus cibles
146 146
 			. '80legs|accoona|AltaVista|ASPSeek|Baidu|Charlotte|EC2LinkFinder|eStyle|facebook|flipboard|hootsuite|FunWebProducts|Google|Genieo|INA dlweb|InfegyAtlas|Java VM|LiteFinder|Lycos|MetaURI|Moreover|Rambler|Scooter|ScrubbyBloglines|Yahoo|Yeti'
147
-			. ',i', (string)$_SERVER['HTTP_USER_AGENT'])
147
+			. ',i', (string) $_SERVER['HTTP_USER_AGENT'])
148 148
 	);
149 149
 }
150 150
 
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 //
275 275
 // Prendre en compte les entetes HTTP_X_FORWARDED_XX
276 276
 //
277
-if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) and $_SERVER['HTTP_X_FORWARDED_PROTO']==='https'){
277
+if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) and $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
278 278
 	if (empty($_SERVER['HTTP_X_FORWARDED_HOST'])) {
279 279
 		$_SERVER['HTTP_X_FORWARDED_HOST'] = $_SERVER['HTTP_HOST'];
280 280
 	}
@@ -282,10 +282,10 @@  discard block
 block discarded – undo
282 282
 		$_SERVER['HTTP_X_FORWARDED_PORT'] = 443;
283 283
 	}
284 284
 }
285
-if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])){
286
-	if (isset($_SERVER['HTTP_X_FORWARDED_PORT']) and is_numeric($_SERVER['HTTP_X_FORWARDED_PORT'])){
285
+if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
286
+	if (isset($_SERVER['HTTP_X_FORWARDED_PORT']) and is_numeric($_SERVER['HTTP_X_FORWARDED_PORT'])) {
287 287
 		$_SERVER['SERVER_PORT'] = $_SERVER['HTTP_X_FORWARDED_PORT'];
288
-		if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) and $_SERVER['HTTP_X_FORWARDED_PROTO']==='https'){
288
+		if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) and $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
289 289
 			$_SERVER['HTTPS'] = 'on';
290 290
 			if (isset($_SERVER['REQUEST_SCHEME'])) {
291 291
 				$_SERVER['REQUEST_SCHEME'] = 'https';
@@ -293,8 +293,8 @@  discard block
 block discarded – undo
293 293
 		}
294 294
 	}
295 295
 	$host = $_SERVER['HTTP_X_FORWARDED_HOST'];
296
-	if (strpos($host,',')!==false){
297
-		$h = explode(',',$host);
296
+	if (strpos($host, ',') !== false) {
297
+		$h = explode(',', $host);
298 298
 		$host = trim(reset($h));
299 299
 	}
300 300
 	// securite sur le contenu de l'entete
@@ -306,12 +306,12 @@  discard block
 block discarded – undo
306 306
 //
307 307
 if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
308 308
 	$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
309
-	if (strpos($ip,',')!==false){
310
-		$ip = explode(',',$ip);
309
+	if (strpos($ip, ',') !== false) {
310
+		$ip = explode(',', $ip);
311 311
 		$ip = reset($ip);
312 312
 	}
313 313
 	// ecraser $_SERVER['REMOTE_ADDR'] si elle est en localhost
314
-	if (isset($_SERVER['REMOTE_ADDR']) AND $_SERVER['REMOTE_ADDR']==='127.0.0.1'){
314
+	if (isset($_SERVER['REMOTE_ADDR']) AND $_SERVER['REMOTE_ADDR'] === '127.0.0.1') {
315 315
 		$_SERVER['REMOTE_ADDR'] = $ip;
316 316
 	}
317 317
 }
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 # la matrice standard (fichiers definissant les fonctions a inclure)
385 385
 $spip_matrice = array();
386 386
 # les plugins a activer
387
-$plugins = array();  // voir le contenu du repertoire /plugins/
387
+$plugins = array(); // voir le contenu du repertoire /plugins/
388 388
 # les surcharges de include_spip()
389 389
 $surcharges = array(); // format 'inc_truc' => '/plugins/chose/inc_truc2.php'
390 390
 
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 
439 439
 // cette version dev accepte tous les plugins compatible avec la version ci-dessous
440 440
 // a supprimer en phase beta/rc/release
441
-define('_DEV_VERSION_SPIP_COMPAT',"4.0.99");
441
+define('_DEV_VERSION_SPIP_COMPAT', "4.0.99");
442 442
 // version des signatures de fonctions PHP
443 443
 // (= date de leur derniere modif cassant la compatibilite et/ou necessitant un recalcul des squelettes)
444 444
 $spip_version_code = 20210708;
@@ -462,8 +462,8 @@  discard block
 block discarded – undo
462 462
 //
463 463
 // Charger les fonctions liees aux serveurs Http et Sql.
464 464
 //
465
-require_once _ROOT_RESTREINT . 'inc/utils.php';
466
-require_once _ROOT_RESTREINT . 'base/connect_sql.php';
465
+require_once _ROOT_RESTREINT.'inc/utils.php';
466
+require_once _ROOT_RESTREINT.'base/connect_sql.php';
467 467
 
468 468
 // Definition personnelles eventuelles
469 469
 
@@ -486,10 +486,10 @@  discard block
 block discarded – undo
486 486
 // ===> on execute en neutralisant les messages d'erreur
487 487
 
488 488
 spip_initialisation_core(
489
-	(_DIR_RACINE . _NOM_PERMANENTS_INACCESSIBLES),
490
-	(_DIR_RACINE . _NOM_PERMANENTS_ACCESSIBLES),
491
-	(_DIR_RACINE . _NOM_TEMPORAIRES_INACCESSIBLES),
492
-	(_DIR_RACINE . _NOM_TEMPORAIRES_ACCESSIBLES)
489
+	(_DIR_RACINE._NOM_PERMANENTS_INACCESSIBLES),
490
+	(_DIR_RACINE._NOM_PERMANENTS_ACCESSIBLES),
491
+	(_DIR_RACINE._NOM_TEMPORAIRES_INACCESSIBLES),
492
+	(_DIR_RACINE._NOM_TEMPORAIRES_ACCESSIBLES)
493 493
 );
494 494
 
495 495
 
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 		// Si on est dans le site public, dire que qq s'en occupe
545 545
 		include_spip('inc/minipres');
546 546
 		utiliser_langue_visiteur();
547
-		echo minipres(_T('info_travaux_titre'), "<p style='text-align: center;'>" . _T('info_travaux_texte') . "</p>", array('status' => 503));
547
+		echo minipres(_T('info_travaux_titre'), "<p style='text-align: center;'>"._T('info_travaux_texte')."</p>", array('status' => 503));
548 548
 		exit;
549 549
 	}
550 550
 	// autrement c'est une install ad hoc (spikini...), on sait pas faire
@@ -558,7 +558,7 @@  discard block
 block discarded – undo
558 558
 	if (!function_exists('session_set')) {
559 559
 		include_spip('inc/session');
560 560
 	}
561
-	$t = preg_replace(",\W,","_", $t);
561
+	$t = preg_replace(",\W,", "_", $t);
562 562
 	if ($v = _request($t)) {
563 563
 		session_set($t, $v);
564 564
 	}
@@ -582,12 +582,12 @@  discard block
 block discarded – undo
582 582
 	}
583 583
 	if (!isset($GLOBALS['spip_header_silencieux']) or !$GLOBALS['spip_header_silencieux']) {
584 584
 		include_spip('inc/filtres_mini');
585
-		header(_HEADER_COMPOSED_BY . " $spip_version_affichee @ www.spip.net + " . url_absolue(_DIR_VAR . "config.txt"));
585
+		header(_HEADER_COMPOSED_BY." $spip_version_affichee @ www.spip.net + ".url_absolue(_DIR_VAR."config.txt"));
586 586
 	} else {
587 587
 		// header minimal
588
-		header(_HEADER_COMPOSED_BY . " @ www.spip.net");
588
+		header(_HEADER_COMPOSED_BY." @ www.spip.net");
589 589
 	}
590 590
 }
591 591
 
592 592
 $methode = (isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : ((php_sapi_name() == 'cli') ? 'cli' : ''));
593
-spip_log($methode . ' ' . self() . ' - ' . _FILE_CONNECT, _LOG_DEBUG);
593
+spip_log($methode.' '.self().' - '._FILE_CONNECT, _LOG_DEBUG);
Please login to merge, or discard this patch.