Completed
Push — master ( f50317...15d2e0 )
by cam
01:07
created
ecrire/src/Compilateur/Iterateur/Decorator.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 				return $this->iter->{$nom}();
151 151
 			} catch (Exception $e) {
152 152
 				// #GETCHILDREN sur un fichier de DirectoryIterator ...
153
-				spip_log("Methode {$nom} en echec sur " . get_class($this->iter));
153
+				spip_log("Methode {$nom} en echec sur ".get_class($this->iter));
154 154
 				spip_log("Cela peut être normal : retour d'une ligne de resultat ne pouvant pas calculer cette methode");
155 155
 
156 156
 				return '';
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 			return null;
375 375
 		}
376 376
 
377
-		return '(' . implode(") {$operateur} (", $filtres_string) . ')';
377
+		return '('.implode(") {$operateur} (", $filtres_string).')';
378 378
 	}
379 379
 
380 380
 	/**
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 			return $this->composer_filtre($v[1], $v[0], $v[2]);
458 458
 		}
459 459
 
460
-		return null;  // sera ignore
460
+		return null; // sera ignore
461 461
 	}
462 462
 
463 463
 	/**
@@ -485,28 +485,28 @@  discard block
 block discarded – undo
485 485
 		// if (!in_array($cle, array('cle', 'valeur')))
486 486
 		//	return;
487 487
 
488
-		$a = '$this->get_select(\'' . $cle . '\')';
488
+		$a = '$this->get_select(\''.$cle.'\')';
489 489
 
490 490
 		$filtre = '';
491 491
 
492 492
 		if ('REGEXP' == $op) {
493
-			$filtre = 'filtrer("match", ' . $a . ', ' . str_replace('\"', '"', $valeur) . ')';
493
+			$filtre = 'filtrer("match", '.$a.', '.str_replace('\"', '"', $valeur).')';
494 494
 			$op = '';
495 495
 		} else {
496 496
 			if ('LIKE' == $op) {
497 497
 				$valeur = str_replace(['\"', '_', '%'], ['"', '.', '.*'], preg_quote($valeur));
498
-				$filtre = 'filtrer("match", ' . $a . ', ' . $valeur . ')';
498
+				$filtre = 'filtrer("match", '.$a.', '.$valeur.')';
499 499
 				$op = '';
500 500
 			} else {
501 501
 				if ('=' == $op) {
502 502
 					$op = '==';
503 503
 				} else {
504 504
 					if ('IN' == $op) {
505
-						$filtre = 'in_array(' . $a . ', array' . $valeur . ')';
505
+						$filtre = 'in_array('.$a.', array'.$valeur.')';
506 506
 						$op = '';
507 507
 					} else {
508 508
 						if (!in_array($op, ['<', '<=', '>', '>='])) {
509
-							spip_log('operateur non reconnu ' . $op); // [todo] mettre une erreur de squelette
509
+							spip_log('operateur non reconnu '.$op); // [todo] mettre une erreur de squelette
510 510
 							$op = '';
511 511
 						}
512 512
 					}
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 		}
516 516
 
517 517
 		if ($op) {
518
-			$filtre = $a . $op . str_replace('\"', '"', $valeur);
518
+			$filtre = $a.$op.str_replace('\"', '"', $valeur);
519 519
 		}
520 520
 
521 521
 		if ($not) {
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
 		// Creer la fonction de filtrage sur $this
565 565
 		if ($this->filtre) {
566 566
 			if ($filtres = $this->assembler_filtres($this->filtre)) {
567
-				$filtres = 'return ' . $filtres . ';';
567
+				$filtres = 'return '.$filtres.';';
568 568
 				$this->func_filtre = fn () => eval($filtres);
569 569
 			} else {
570 570
 				$this->func_filtre = null;
Please login to merge, or discard this patch.
ecrire/src/Compilateur/Iterateur/Data.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 		// Si a ce stade on n'a pas de table, il y a un bug
164 164
 		if (!is_array($this->tableau)) {
165 165
 			$this->err = true;
166
-			spip_log('erreur datasource ' . var_export($command, true));
166
+			spip_log('erreur datasource '.var_export($command, true));
167 167
 		}
168 168
 
169 169
 		// {datapath query.results}
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 			isset($this->command['sourcemode'])
206 206
 			and !in_array($this->command['sourcemode'], ['table', 'array', 'tableau'])
207 207
 		) {
208
-			charger_fonction($this->command['sourcemode'] . '_to_array', 'inc', true);
208
+			charger_fonction($this->command['sourcemode'].'_to_array', 'inc', true);
209 209
 		}
210 210
 
211 211
 		# le premier argument peut etre un array, une URL etc.
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 		# avons-nous un cache dispo ?
215 215
 		$cle = null;
216 216
 		if (is_string($src)) {
217
-			$cle = 'datasource_' . md5($this->command['sourcemode'] . ':' . var_export($this->command['source'], true));
217
+			$cle = 'datasource_'.md5($this->command['sourcemode'].':'.var_export($this->command['source'], true));
218 218
 		}
219 219
 
220 220
 		$cache = $this->cache_get($cle);
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 
274 274
 					if (
275 275
 						!$this->err
276
-						and $data_to_array = charger_fonction($this->command['sourcemode'] . '_to_array', 'inc', true)
276
+						and $data_to_array = charger_fonction($this->command['sourcemode'].'_to_array', 'inc', true)
277 277
 					) {
278 278
 						$args = $this->command['source'];
279 279
 						$args[0] = $data;
@@ -413,13 +413,13 @@  discard block
 block discarded – undo
413 413
 							$tv = '%s';
414 414
 						} # {par valeur/xx/yy} ??
415 415
 						else {
416
-							$tv = 'table_valeur(%s, ' . var_export($r[1], true) . ')';
416
+							$tv = 'table_valeur(%s, '.var_export($r[1], true).')';
417 417
 						}
418 418
 						$sortfunc .= '
419
-					$a = ' . sprintf($tv, '$aa') . ';
420
-					$b = ' . sprintf($tv, '$bb') . ';
419
+					$a = ' . sprintf($tv, '$aa').';
420
+					$b = ' . sprintf($tv, '$bb').';
421 421
 					if ($a <> $b)
422
-						return ($a ' . (!empty($r[2]) ? '>' : '<') . ' $b) ? -1 : 1;';
422
+						return ($a ' . (!empty($r[2]) ? '>' : '<').' $b) ? -1 : 1;';
423 423
 					}
424 424
 				}
425 425
 			}
Please login to merge, or discard this patch.
ecrire/src/Compilateur/Iterateur/Factory.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,12 +51,12 @@
 block discarded – undo
51 51
 			// chercher la classe d'iterateur Iterateur/XXX
52 52
 			// definie dans le fichier src/Compilateur/Iterateur/xxx.php
53 53
 			// FIXME: déclarer quelque part les iterateurs supplémentaires
54
-			$class = __NAMESPACE__ . '\\' . ucfirst(strtolower($iterateur));
54
+			$class = __NAMESPACE__.'\\'.ucfirst(strtolower($iterateur));
55 55
 			if (!class_exists($class)) {
56 56
 				// historique
57 57
 				// Chercher IterateurXXX
58
-				include_spip('iterateur/' . $iterateur);
59
-				$class = 'Iterateur' . $iterateur;
58
+				include_spip('iterateur/'.$iterateur);
59
+				$class = 'Iterateur'.$iterateur;
60 60
 				if (!class_exists($class)) {
61 61
 					exit("Iterateur {$iterateur} non trouv&#233;");
62 62
 					// si l'iterateur n'existe pas, on se rabat sur le generique
Please login to merge, or discard this patch.
ecrire/inc/presentation_mini.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 		$rejouer = (_SESSION_REJOUER === true) ? rejouer_session() : _SESSION_REJOUER;
190 190
 	}
191 191
 
192
-	return $rejouer . (defined('_TESTER_NOSCRIPT') ? _TESTER_NOSCRIPT : '');
192
+	return $rejouer.(defined('_TESTER_NOSCRIPT') ? _TESTER_NOSCRIPT : '');
193 193
 }
194 194
 
195 195
 /**
@@ -235,9 +235,9 @@  discard block
 block discarded – undo
235 235
 	//
236 236
 	if ($vcs = version_vcs_courante(_DIR_RACINE, true)) {
237 237
 		if ($vcs['vcs'] === 'GIT') {
238
-			$url = 'https://git.spip.net/spip/spip/commit/' . $vcs['commit'];
238
+			$url = 'https://git.spip.net/spip/spip/commit/'.$vcs['commit'];
239 239
 		} elseif ($vcs['vcs'] === 'SVN') {
240
-			$url = 'https://core.spip.net/projects/spip/repository/revisions/' . $vcs['commit'];
240
+			$url = 'https://core.spip.net/projects/spip/repository/revisions/'.$vcs['commit'];
241 241
 		} else {
242 242
 			$url = '';
243 243
 		}
@@ -247,21 +247,21 @@  discard block
 block discarded – undo
247 247
 			$commit = "<a href=\"$url\" target=\"_blank\" rel=\"noopener noreferrer\">$commit</a>";
248 248
 		}
249 249
 		if ($vcs['branch']) {
250
-			$commit = $vcs['branch'] . ': ' . $commit;
250
+			$commit = $vcs['branch'].': '.$commit;
251 251
 		}
252 252
 		$version .= " {$vcs['vcs']} [$commit]";
253 253
 	}
254 254
 
255 255
 	// et la version de l'ecran de securite
256 256
 	$secu = defined('_ECRAN_SECURITE')
257
-		? '<br />' . _T('ecran_securite', ['version' => _ECRAN_SECURITE])
257
+		? '<br />'._T('ecran_securite', ['version' => _ECRAN_SECURITE])
258 258
 		: '';
259 259
 
260 260
 	return _T(
261 261
 		'info_copyright',
262 262
 		[
263 263
 			'spip' => "<b>SPIP $version</b> ",
264
-			'lien_gpl' => '<a href="https://www.gnu.org/licenses/gpl-3.0.html">' . _T('info_copyright_gpl') . '</a>'
264
+			'lien_gpl' => '<a href="https://www.gnu.org/licenses/gpl-3.0.html">'._T('info_copyright_gpl').'</a>'
265 265
 		]
266 266
 	)
267 267
 	. $secu;
@@ -288,8 +288,8 @@  discard block
 block discarded – undo
288 288
 		$onfocus = '';
289 289
 	}
290 290
 
291
-	$form = '<input type="text" size="10" value="' . $recherche_aff . '" name="recherche" class="recherche" accesskey="r"' . $onfocus . ' />';
292
-	$form .= "<input type='image' src='" . chemin_image('rechercher-20.png') . "' name='submit' class='submit' alt='" . _T('info_rechercher') . "' />";
291
+	$form = '<input type="text" size="10" value="'.$recherche_aff.'" name="recherche" class="recherche" accesskey="r"'.$onfocus.' />';
292
+	$form .= "<input type='image' src='".chemin_image('rechercher-20.png')."' name='submit' class='submit' alt='"._T('info_rechercher')."' />";
293 293
 
294
-	return "<div class='spip_recherche'>" . generer_form_ecrire($page, $form . $complement, " method='get'") . '</div>';
294
+	return "<div class='spip_recherche'>".generer_form_ecrire($page, $form.$complement, " method='get'").'</div>';
295 295
 }
Please login to merge, or discard this patch.
ecrire/inc/texte_mini.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -44,13 +44,13 @@  discard block
 block discarded – undo
44 44
 	// celle du texte) et public (spip_lang est la langue du texte)
45 45
 	$dir = _DIR_RESTREINT ? lang_dir() : lang_dir($GLOBALS['spip_lang']);
46 46
 
47
-	$p = 'puce' . (test_espace_prive() ? '_prive' : '');
47
+	$p = 'puce'.(test_espace_prive() ? '_prive' : '');
48 48
 	if ($dir == 'rtl') {
49 49
 		$p .= '_rtl';
50 50
 	}
51 51
 
52 52
 	if (!isset($GLOBALS[$p])) {
53
-		$GLOBALS[$p] = '<span class="spip-puce ' . $dir . '"><b>–</b></span>';
53
+		$GLOBALS[$p] = '<span class="spip-puce '.$dir.'"><b>–</b></span>';
54 54
 	}
55 55
 
56 56
 	return $GLOBALS[$p];
@@ -68,13 +68,13 @@  discard block
 block discarded – undo
68 68
 function spip_balisage_code(string $corps, bool $bloc = false, string $attributs = '', string $langage = '') {
69 69
 
70 70
 	$echap = spip_htmlspecialchars($corps); // il ne faut pas passer dans entites_html, ne pas transformer les &#xxx; du code !
71
-	$class = "spip_code " . ($bloc ? 'spip_code_block' : 'spip_code_inline');
71
+	$class = "spip_code ".($bloc ? 'spip_code_block' : 'spip_code_inline');
72 72
 	if ($attributs) {
73
-		$attributs = " " . trim($attributs);
73
+		$attributs = " ".trim($attributs);
74 74
 	}
75 75
 	if ($langage) {
76 76
 		$class .= " language-$langage";
77
-		$attributs .= ' data-language="'. $langage .'"';
77
+		$attributs .= ' data-language="'.$langage.'"';
78 78
 	}
79 79
 	if ($bloc) {
80 80
 		$html = "<div class=\"precode\">"
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	else {
89 89
 		$echap = str_replace("\t", "&nbsp; &nbsp; &nbsp; &nbsp; ", $echap);
90 90
 		$echap = str_replace("  ", " &nbsp;", $echap);
91
-		$html = "<code class=\"$class\" dir=\"ltr\"$attributs>" . $echap . '</code>';
91
+		$html = "<code class=\"$class\" dir=\"ltr\"$attributs>".$echap.'</code>';
92 92
 	}
93 93
 
94 94
 	return $html;
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 }
107 107
 
108 108
 if (!defined('_BALISES_BLOCS_REGEXP')) {
109
-	define('_BALISES_BLOCS_REGEXP', ',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS');
109
+	define('_BALISES_BLOCS_REGEXP', ',</?('._BALISES_BLOCS.')[>[:space:]],iS');
110 110
 }
111 111
 
112 112
 //
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
 	// Tester si on echappe en span ou en div
125 125
 	if (is_null($mode) or !in_array($mode, ['div', 'span'])) {
126
-		$mode = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $rempl) ? 'div' : 'span';
126
+		$mode = preg_match(',</?('._BALISES_BLOCS.')[>[:space:]],iS', $rempl) ? 'div' : 'span';
127 127
 	}
128 128
 
129 129
 	// Decouper en morceaux, base64 a des probleme selon la taille de la pile
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	) {
159 159
 		foreach ($matches as $m) {
160 160
 			if ($m[1] === 'code') {
161
-				$code = '<code' . $m[2] . '>' . spip_htmlspecialchars($m[3]) . '</code>';
161
+				$code = '<code'.$m[2].'>'.spip_htmlspecialchars($m[3]).'</code>';
162 162
 				$pre = str_replace($m[0], $code, $pre);
163 163
 			}
164 164
 		}
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
 // Echapper les <code>...</ code>
170 170
 function traiter_echap_code_dist($regs, $options = []) {
171
-	[, , $att, $corps] = $regs;
171
+	[,, $att, $corps] = $regs;
172 172
 
173 173
 	// ne pas mettre le <div...> s'il n'y a qu'une ligne
174 174
 	if (strpos($corps, "\n") !== false) {
@@ -252,11 +252,11 @@  discard block
 block discarded – undo
252 252
 			else {
253 253
 				$callback_secure_prefix = ($callback_options['secure_prefix'] ?? '');
254 254
 				if (
255
-					function_exists($f = $callback_prefix . $callback_secure_prefix . 'traiter_echap_' . strtolower($regs[1]))
256
-					or function_exists($f = $f . '_dist')
255
+					function_exists($f = $callback_prefix.$callback_secure_prefix.'traiter_echap_'.strtolower($regs[1]))
256
+					or function_exists($f = $f.'_dist')
257 257
 					or ($callback_secure_prefix and (
258
-						function_exists($f = $callback_prefix . 'traiter_echap_' . strtolower($regs[1]))
259
-						or function_exists($f = $f . '_dist')
258
+						function_exists($f = $callback_prefix.'traiter_echap_'.strtolower($regs[1]))
259
+						or function_exists($f = $f.'_dist')
260 260
 					))
261 261
 				) {
262 262
 					$echap = $f($regs, $callback_options);
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	// dans une callback autonommee
279 279
 	if (strpos($preg ?: _PROTEGE_BLOCS, 'script') !== false) {
280 280
 		if (
281
-			strpos($letexte, '<' . '?') !== false and preg_match_all(
281
+			strpos($letexte, '<'.'?') !== false and preg_match_all(
282 282
 				',<[?].*($|[?]>),UisS',
283 283
 				$letexte,
284 284
 				$matches,
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 			strpos($letexte, '<') !== false
311 311
 			and
312 312
 			preg_match_all(
313
-				',<(span|div)\sclass=[\'"]base64' . $source . '[\'"]\s(.*)>\s*</\1>,UmsS',
313
+				',<(span|div)\sclass=[\'"]base64'.$source.'[\'"]\s(.*)>\s*</\1>,UmsS',
314 314
 				$letexte,
315 315
 				$regs,
316 316
 				PREG_SET_ORDER
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 					}
328 328
 				}
329 329
 				if ($at) {
330
-					$rempl = '<' . $reg[1] . '>' . $rempl . '</' . $reg[1] . '>';
330
+					$rempl = '<'.$reg[1].'>'.$rempl.'</'.$reg[1].'>';
331 331
 					foreach ($at as $attr => $a) {
332 332
 						$rempl = inserer_attribut($rempl, $attr, $a);
333 333
 					}
@@ -408,8 +408,8 @@  discard block
 block discarded – undo
408 408
 	$texte = nettoyer_raccourcis_typo($texte);
409 409
 
410 410
 	// balises de sauts de ligne et paragraphe
411
-	$texte = preg_replace('/<p( [^>]*)?' . '>/', "\r", $texte);
412
-	$texte = preg_replace('/<br( [^>]*)?' . '>/', "\n", $texte);
411
+	$texte = preg_replace('/<p( [^>]*)?'.'>/', "\r", $texte);
412
+	$texte = preg_replace('/<br( [^>]*)?'.'>/', "\n", $texte);
413 413
 
414 414
 	// on repasse les doubles \n en \r que nettoyer_raccourcis_typo() a pu modifier
415 415
 	$texte = str_replace("\n\n", "\r", $texte);
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 	// supprimer les tags
418 418
 	$texte = supprimer_tags($texte);
419 419
 	$texte = trim(str_replace("\n", ' ', $texte));
420
-	$texte .= "\n";  // marquer la fin
420
+	$texte .= "\n"; // marquer la fin
421 421
 
422 422
 	// corriger la longueur de coupe
423 423
 	// en fonction de la presence de caracteres utf
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 	// couper au mot precedent
433 433
 	$long = spip_substr($texte, 0, max($taille - 4, 1));
434 434
 	$u = $GLOBALS['meta']['pcre_u'];
435
-	$court = preg_replace("/([^\s][\s]+)[^\s]*\n?$/" . $u, "\\1", $long);
435
+	$court = preg_replace("/([^\s][\s]+)[^\s]*\n?$/".$u, "\\1", $long);
436 436
 	if (is_null($suite)) {
437 437
 		$suite = (defined('_COUPER_SUITE') ? _COUPER_SUITE : '&nbsp;(...)');
438 438
 	}
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 	if (spip_strlen($court) < max(0.75 * $taille, 2)) {
443 443
 		$points = '';
444 444
 		$long = spip_substr($texte, 0, $taille);
445
-		$texte = preg_replace("/([^\s][\s]+)[^\s]*\n?$/" . $u, "\\1", $long);
445
+		$texte = preg_replace("/([^\s][\s]+)[^\s]*\n?$/".$u, "\\1", $long);
446 446
 		// encore trop court ? couper au caractere
447 447
 		if (spip_strlen($texte) < 0.75 * $taille) {
448 448
 			$texte = $long;
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 	// supprimer l'eventuelle entite finale mal coupee
462 462
 	$texte = preg_replace('/&#?[a-z0-9]*$/S', '', $texte);
463 463
 
464
-	return quote_amp(trim($texte)) . $points;
464
+	return quote_amp(trim($texte)).$points;
465 465
 }
466 466
 
467 467
 
@@ -473,16 +473,16 @@  discard block
 block discarded – undo
473 473
 				define('_PROTEGE_JS_MODELES', creer_uniqid());
474 474
 			}
475 475
 			foreach ($r as $regs) {
476
-				$t = str_replace($regs[0], code_echappement($regs[0], 'javascript' . _PROTEGE_JS_MODELES), $t);
476
+				$t = str_replace($regs[0], code_echappement($regs[0], 'javascript'._PROTEGE_JS_MODELES), $t);
477 477
 			}
478 478
 		}
479
-		if (preg_match_all(',<\?php.*?($|\?' . '>),isS', $t, $r, PREG_SET_ORDER)) {
479
+		if (preg_match_all(',<\?php.*?($|\?'.'>),isS', $t, $r, PREG_SET_ORDER)) {
480 480
 			if (!defined('_PROTEGE_PHP_MODELES')) {
481 481
 				include_spip('inc/acces');
482 482
 				define('_PROTEGE_PHP_MODELES', creer_uniqid());
483 483
 			}
484 484
 			foreach ($r as $regs) {
485
-				$t = str_replace($regs[0], code_echappement($regs[0], 'php' . _PROTEGE_PHP_MODELES), $t);
485
+				$t = str_replace($regs[0], code_echappement($regs[0], 'php'._PROTEGE_PHP_MODELES), $t);
486 486
 			}
487 487
 		}
488 488
 	}
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
 			if (!empty($options['wrap_suspect'])) {
601 601
 				$texte = wrap($texte, $options['wrap_suspect']);
602 602
 			}
603
-			$texte = "<mark class='danger-js' title='" . attribut_html(_T('erreur_contenu_suspect')) . "'>⚠️</mark> " . $texte;
603
+			$texte = "<mark class='danger-js' title='".attribut_html(_T('erreur_contenu_suspect'))."'>⚠️</mark> ".$texte;
604 604
 		}
605 605
 
606 606
 		$texte = $collecteurModeles->retablir($texte);
@@ -747,11 +747,11 @@  discard block
 block discarded – undo
747 747
  **/
748 748
 function supprime_img($letexte, $message = null) {
749 749
 	if ($message === null) {
750
-		$message = '(' . _T('img_indisponible') . ')';
750
+		$message = '('._T('img_indisponible').')';
751 751
 	}
752 752
 
753 753
 	return preg_replace(
754
-		',<(img|doc|emb)([0-9]+)(\|([^>]*))?' . '\s*/?' . '>,i',
754
+		',<(img|doc|emb)([0-9]+)(\|([^>]*))?'.'\s*/?'.'>,i',
755 755
 		$message,
756 756
 		$letexte
757 757
 	);
Please login to merge, or discard this patch.
ecrire/req/sqlite_generique.php 1 patch
Spacing   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -66,27 +66,27 @@  discard block
 block discarded – undo
66 66
 	// determiner le dossier de la base : $addr ou _DIR_DB
67 67
 	$f = _DIR_DB;
68 68
 	if ($addr and str_contains($addr, '/')) {
69
-		$f = rtrim($addr, '/') . '/';
69
+		$f = rtrim($addr, '/').'/';
70 70
 	}
71 71
 
72 72
 	// un nom de base demande et impossible d'obtenir la base, on s'en va :
73 73
 	// il faut que la base existe ou que le repertoire parent soit writable
74
-	if ($db and !is_file($f .= $db . '.sqlite') and !is_writable(dirname($f))) {
75
-		spip_log("base $f non trouvee ou droits en ecriture manquants", 'sqlite.' . _LOG_HS);
74
+	if ($db and !is_file($f .= $db.'.sqlite') and !is_writable(dirname($f))) {
75
+		spip_log("base $f non trouvee ou droits en ecriture manquants", 'sqlite.'._LOG_HS);
76 76
 
77 77
 		return false;
78 78
 	}
79 79
 
80 80
 	// charger les modules sqlite au besoin
81 81
 	if (!_sqlite_charger_version($sqlite_version)) {
82
-		spip_log("Impossible de trouver/charger le module SQLite ($sqlite_version)!", 'sqlite.' . _LOG_HS);
82
+		spip_log("Impossible de trouver/charger le module SQLite ($sqlite_version)!", 'sqlite.'._LOG_HS);
83 83
 
84 84
 		return false;
85 85
 	}
86 86
 
87 87
 	// chargement des constantes
88 88
 	// il ne faut pas definir les constantes avant d'avoir charge les modules sqlite
89
-	$define = 'spip_sqlite' . $sqlite_version . '_constantes';
89
+	$define = 'spip_sqlite'.$sqlite_version.'_constantes';
90 90
 	$define();
91 91
 
92 92
 	$ok = false;
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
 		// si pas de db ->
95 95
 		// base temporaire tant qu'on ne connait pas son vrai nom
96 96
 		// pour tester la connexion
97
-		$db = '_sqlite' . $sqlite_version . '_install';
98
-		$tmp = _DIR_DB . $db . '.sqlite';
97
+		$db = '_sqlite'.$sqlite_version.'_install';
98
+		$tmp = _DIR_DB.$db.'.sqlite';
99 99
 		$ok = $link = new \PDO("sqlite:$tmp");
100 100
 	} else {
101 101
 		// Ouvrir (eventuellement creer la base)
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 
105 105
 	if (!$ok) {
106 106
 		$e = _sqlite_last_error_from_link($link);
107
-		spip_log("Impossible d'ouvrir la base SQLite($sqlite_version) $f : $e", 'sqlite.' . _LOG_HS);
107
+		spip_log("Impossible d'ouvrir la base SQLite($sqlite_version) $f : $e", 'sqlite.'._LOG_HS);
108 108
 
109 109
 		return false;
110 110
 	}
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 		$table = $regs[3];
193 193
 		$suite = $regs[4];
194 194
 	} else {
195
-		spip_log("SQLite : Probleme de ALTER TABLE mal forme dans $query", 'sqlite.' . _LOG_ERREUR);
195
+		spip_log("SQLite : Probleme de ALTER TABLE mal forme dans $query", 'sqlite.'._LOG_ERREUR);
196 196
 
197 197
 		return false;
198 198
 	}
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	$i = 0;
210 210
 	$ouverte = false;
211 211
 	while ($do = array_shift($todo)) {
212
-		$todo2[$i] = isset($todo2[$i]) ? $todo2[$i] . ',' . $do : $do;
212
+		$todo2[$i] = isset($todo2[$i]) ? $todo2[$i].','.$do : $do;
213 213
 		$o = (str_contains($do, '('));
214 214
 		$f = (str_contains($do, ')'));
215 215
 		if ($o and !$f) {
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 		) {
236 236
 			spip_log(
237 237
 				"SQLite : Probleme de ALTER TABLE, utilisation non reconnue dans : $do \n(requete d'origine : $query)",
238
-				'sqlite.' . _LOG_ERREUR
238
+				'sqlite.'._LOG_ERREUR
239 239
 			);
240 240
 
241 241
 			return false;
@@ -331,10 +331,10 @@  discard block
 block discarded – undo
331 331
 
332 332
 				// pas geres en sqlite2
333 333
 			case 'RENAME':
334
-				$do = 'RENAME TO' . substr($do, 6);
334
+				$do = 'RENAME TO'.substr($do, 6);
335 335
 			case 'RENAME TO':
336 336
 				if (!Sqlite::executer_requete("$debut $do", $serveur)) {
337
-					spip_log("SQLite : Erreur ALTER TABLE / RENAME : $query", 'sqlite.' . _LOG_ERREUR);
337
+					spip_log("SQLite : Erreur ALTER TABLE / RENAME : $query", 'sqlite.'._LOG_ERREUR);
338 338
 
339 339
 					return false;
340 340
 				}
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 						$colonnes = substr($colonne_origine, 1, -1);
378 378
 						if (str_contains(',', $colonnes)) {
379 379
 							spip_log('SQLite : Erreur, impossible de creer un index sur plusieurs colonnes'
380
-								. " sans qu'il ait de nom ($table, ($colonnes))", 'sqlite.' . _LOG_ERREUR);
380
+								. " sans qu'il ait de nom ($table, ($colonnes))", 'sqlite.'._LOG_ERREUR);
381 381
 							break;
382 382
 						} else {
383 383
 							$nom_index = $colonnes;
@@ -392,12 +392,12 @@  discard block
 block discarded – undo
392 392
 
393 393
 				// pas geres en sqlite2
394 394
 			case 'ADD COLUMN':
395
-				$do = 'ADD' . substr($do, 10);
395
+				$do = 'ADD'.substr($do, 10);
396 396
 			case 'ADD':
397 397
 			default:
398 398
 				if (!preg_match(',primary\s+key,i', $do)) {
399 399
 					if (!Sqlite::executer_requete("$debut $do", $serveur)) {
400
-						spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.' . _LOG_ERREUR);
400
+						spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.'._LOG_ERREUR);
401 401
 
402 402
 						return false;
403 403
 					}
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 					}
418 418
 					$opts['field'] = [$colonne_ajoutee => $def];
419 419
 					if (!_sqlite_modifier_table($table, [$colonne_ajoutee], $opts, $serveur)) {
420
-						spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.' . _LOG_ERREUR);
420
+						spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.'._LOG_ERREUR);
421 421
 
422 422
 						return false;
423 423
 					}
@@ -425,10 +425,10 @@  discard block
 block discarded – undo
425 425
 				break;
426 426
 		}
427 427
 		// tout est bon, ouf !
428
-		spip_log("SQLite ($serveur) : Changements OK : $debut $do", 'sqlite.' . _LOG_INFO);
428
+		spip_log("SQLite ($serveur) : Changements OK : $debut $do", 'sqlite.'._LOG_INFO);
429 429
 	}
430 430
 
431
-	spip_log("SQLite ($serveur) : fin ALTER TABLE OK !", 'sqlite.' . _LOG_INFO);
431
+	spip_log("SQLite ($serveur) : fin ALTER TABLE OK !", 'sqlite.'._LOG_INFO);
432 432
 
433 433
 	return true;
434 434
 }
@@ -497,9 +497,9 @@  discard block
 block discarded – undo
497 497
  **/
498 498
 function spip_sqlite_create_base($nom, $serveur = '', $option = true)
499 499
 {
500
-	$f = $nom . '.sqlite';
500
+	$f = $nom.'.sqlite';
501 501
 	if (strpos($nom, '/') === false) {
502
-		$f = _DIR_DB . $f;
502
+		$f = _DIR_DB.$f;
503 503
 	}
504 504
 
505 505
 	$ok = new \PDO("sqlite:$f");
@@ -540,13 +540,13 @@  discard block
 block discarded – undo
540 540
 	if (sql_showtable($nom, false, $serveur)) {
541 541
 		spip_log(
542 542
 			"Echec creation d'une vue sql ($nom) car celle-ci existe deja (serveur:$serveur)",
543
-			'sqlite.' . _LOG_ERREUR
543
+			'sqlite.'._LOG_ERREUR
544 544
 		);
545 545
 
546 546
 		return false;
547 547
 	}
548 548
 
549
-	$query = "CREATE VIEW $nom AS " . $query_select;
549
+	$query = "CREATE VIEW $nom AS ".$query_select;
550 550
 
551 551
 	return spip_sqlite_query($query, $serveur, $requeter);
552 552
 }
@@ -573,8 +573,8 @@  discard block
 block discarded – undo
573 573
 {
574 574
 	if (!($nom or $table or $champs)) {
575 575
 		spip_log(
576
-			"Champ manquant pour creer un index sqlite ($nom, $table, (" . join(',', $champs) . '))',
577
-			'sqlite.' . _LOG_ERREUR
576
+			"Champ manquant pour creer un index sqlite ($nom, $table, (".join(',', $champs).'))',
577
+			'sqlite.'._LOG_ERREUR
578 578
 		);
579 579
 
580 580
 		return false;
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 
583 583
 	// SQLite ne differentie pas noms des index en fonction des tables
584 584
 	// il faut donc creer des noms uniques d'index pour une base sqlite
585
-	$nom = $table . '_' . $nom;
585
+	$nom = $table.'_'.$nom;
586 586
 	// enlever d'eventuelles parentheses deja presentes sur champs
587 587
 	if (!is_array($champs)) {
588 588
 		if ($champs[0] == '(') {
@@ -604,12 +604,12 @@  discard block
 block discarded – undo
604 604
 	} else {
605 605
 		/* simuler le IF EXISTS - version 2 et sqlite < 3.3a */
606 606
 		$a = spip_sqlite_showtable($table, $serveur);
607
-		if (isset($a['key']['KEY ' . $nom])) {
607
+		if (isset($a['key']['KEY '.$nom])) {
608 608
 			return true;
609 609
 		}
610 610
 	}
611 611
 
612
-	$query = 'CREATE ' . ($unique ? 'UNIQUE ' : '') . "INDEX$ifnotexists $nom ON $table (" . join(',', $champs) . ')';
612
+	$query = 'CREATE '.($unique ? 'UNIQUE ' : '')."INDEX$ifnotexists $nom ON $table (".join(',', $champs).')';
613 613
 	$res = spip_sqlite_query($query, $serveur, $requeter);
614 614
 	if (!$requeter) {
615 615
 		return $res;
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 	$serveur = '',
687 687
 	$requeter = true
688 688
 ) {
689
-	$c = !$groupby ? '*' : ('DISTINCT ' . (is_string($groupby) ? $groupby : join(',', $groupby)));
689
+	$c = !$groupby ? '*' : ('DISTINCT '.(is_string($groupby) ? $groupby : join(',', $groupby)));
690 690
 	$r = spip_sqlite_select(
691 691
 		"COUNT($c)",
692 692
 		$from,
@@ -799,14 +799,14 @@  discard block
 block discarded – undo
799 799
 function spip_sqlite_drop_index($nom, $table, $serveur = '', $requeter = true)
800 800
 {
801 801
 	if (!($nom or $table)) {
802
-		spip_log("Champ manquant pour supprimer un index sqlite ($nom, $table)", 'sqlite.' . _LOG_ERREUR);
802
+		spip_log("Champ manquant pour supprimer un index sqlite ($nom, $table)", 'sqlite.'._LOG_ERREUR);
803 803
 
804 804
 		return false;
805 805
 	}
806 806
 
807 807
 	// SQLite ne differentie pas noms des index en fonction des tables
808 808
 	// il faut donc creer des noms uniques d'index pour une base sqlite
809
-	$index = $table . '_' . $nom;
809
+	$index = $table.'_'.$nom;
810 810
 	$exist = ' IF EXISTS';
811 811
 
812 812
 	$query = "DROP INDEX$exist $index";
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
 	if ($s) {
840 840
 		$trace = debug_backtrace();
841 841
 		if ($trace[0]['function'] != 'spip_sqlite_error') {
842
-			spip_log("$s - $query - " . sql_error_backtrace(), 'sqlite.' . _LOG_ERREUR);
842
+			spip_log("$s - $query - ".sql_error_backtrace(), 'sqlite.'._LOG_ERREUR);
843 843
 		}
844 844
 	}
845 845
 
@@ -888,14 +888,14 @@  discard block
 block discarded – undo
888 888
 		$t = $link->errorInfo();
889 889
 		$s = ltrim($t[0], '0'); // 00000 si pas d'erreur
890 890
 		if ($s) {
891
-			$s .= ' / ' . $t[1];
891
+			$s .= ' / '.$t[1];
892 892
 		} // ajoute l'erreur du moteur SQLite
893 893
 	} else {
894 894
 		$s = ': aucune ressource sqlite (link)';
895 895
 	}
896 896
 
897 897
 	if ($s) {
898
-		spip_log("Erreur sqlite $s", 'sqlite.' . _LOG_ERREUR);
898
+		spip_log("Erreur sqlite $s", 'sqlite.'._LOG_ERREUR);
899 899
 	}
900 900
 
901 901
 	return $s ? $s : 0;
@@ -920,7 +920,7 @@  discard block
 block discarded – undo
920 920
 	}
921 921
 
922 922
 	$query = Sqlite::traduire_requete($query, $serveur);
923
-	$query = 'EXPLAIN ' . $query;
923
+	$query = 'EXPLAIN '.$query;
924 924
 	if (!$requeter) {
925 925
 		return $query;
926 926
 	}
@@ -1096,7 +1096,7 @@  discard block
 block discarded – undo
1096 1096
 function spip_sqlite_insert($table, $champs, $valeurs, $desc = [], $serveur = '', $requeter = true)
1097 1097
 {
1098 1098
 
1099
-	$query = "INSERT INTO $table " . ($champs ? "$champs VALUES $valeurs" : 'DEFAULT VALUES');
1099
+	$query = "INSERT INTO $table ".($champs ? "$champs VALUES $valeurs" : 'DEFAULT VALUES');
1100 1100
 	if ($r = spip_sqlite_query($query, $serveur, $requeter)) {
1101 1101
 		if (!$requeter) {
1102 1102
 			return $r;
@@ -1152,8 +1152,8 @@  discard block
 block discarded – undo
1152 1152
 
1153 1153
 	$cles = $valeurs = '';
1154 1154
 	if (count($couples)) {
1155
-		$cles = '(' . join(',', array_keys($couples)) . ')';
1156
-		$valeurs = '(' . join(',', $couples) . ')';
1155
+		$cles = '('.join(',', array_keys($couples)).')';
1156
+		$valeurs = '('.join(',', $couples).')';
1157 1157
 	}
1158 1158
 
1159 1159
 	return spip_sqlite_insert($table, $cles, $valeurs, $desc, $serveur, $requeter);
@@ -1214,11 +1214,11 @@  discard block
 block discarded – undo
1214 1214
 
1215 1215
 		$champs = $valeurs = '';
1216 1216
 		if (count($couples)) {
1217
-			$champs = '(' . join(',', array_keys($couples)) . ')';
1218
-			$valeurs = '(' . join(',', $couples) . ')';
1219
-			$query = $query_start . "$champs VALUES $valeurs";
1217
+			$champs = '('.join(',', array_keys($couples)).')';
1218
+			$valeurs = '('.join(',', $couples).')';
1219
+			$query = $query_start."$champs VALUES $valeurs";
1220 1220
 		} else {
1221
-			$query = $query_start . 'DEFAULT VALUES';
1221
+			$query = $query_start.'DEFAULT VALUES';
1222 1222
 		}
1223 1223
 
1224 1224
 		if ($requeter) {
@@ -1355,7 +1355,7 @@  discard block
 block discarded – undo
1355 1355
  */
1356 1356
 function spip_sqlite_multi($objet, $lang)
1357 1357
 {
1358
-	$r = 'EXTRAIRE_MULTI(' . $objet . ", '" . $lang . "') AS multi";
1358
+	$r = 'EXTRAIRE_MULTI('.$objet.", '".$lang."') AS multi";
1359 1359
 
1360 1360
 	return $r;
1361 1361
 }
@@ -1429,7 +1429,7 @@  discard block
 block discarded – undo
1429 1429
 {
1430 1430
 	$op = (($interval <= 0) ? '>' : '<');
1431 1431
 
1432
-	return "($champ $op datetime('" . date('Y-m-d H:i:s') . "', '$interval $unite'))";
1432
+	return "($champ $op datetime('".date('Y-m-d H:i:s')."', '$interval $unite'))";
1433 1433
 }
1434 1434
 
1435 1435
 
@@ -1462,7 +1462,7 @@  discard block
 block discarded – undo
1462 1462
 				and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c)
1463 1463
 			) {
1464 1464
 				spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT ''", $serveur);
1465
-				spip_log("ALTER $q", 'repair' . _LOG_INFO_IMPORTANTE);
1465
+				spip_log("ALTER $q", 'repair'._LOG_INFO_IMPORTANTE);
1466 1466
 			}
1467 1467
 			if (
1468 1468
 				preg_match(',^(INTEGER),i', $d)
@@ -1472,7 +1472,7 @@  discard block
 block discarded – undo
1472 1472
 				and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c)
1473 1473
 			) {
1474 1474
 				spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT '0'", $serveur);
1475
-				spip_log("ALTER $q", 'repair' . _LOG_INFO_IMPORTANTE);
1475
+				spip_log("ALTER $q", 'repair'._LOG_INFO_IMPORTANTE);
1476 1476
 			}
1477 1477
 			if (
1478 1478
 				preg_match(',^(datetime),i', $d)
@@ -1482,7 +1482,7 @@  discard block
 block discarded – undo
1482 1482
 				and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c)
1483 1483
 			) {
1484 1484
 				spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT '0000-00-00 00:00:00'", $serveur);
1485
-				spip_log("ALTER $q", 'repair' . _LOG_INFO_IMPORTANTE);
1485
+				spip_log("ALTER $q", 'repair'._LOG_INFO_IMPORTANTE);
1486 1486
 			}
1487 1487
 		}
1488 1488
 
@@ -1534,10 +1534,10 @@  discard block
 block discarded – undo
1534 1534
 	// recherche de champs 'timestamp' pour mise a jour auto de ceux-ci
1535 1535
 	$couples = _sqlite_ajouter_champs_timestamp($table, $couples, $desc, $serveur);
1536 1536
 
1537
-	return spip_sqlite_query("REPLACE INTO $table (" . join(',', array_keys($couples)) . ') VALUES (' . join(
1537
+	return spip_sqlite_query("REPLACE INTO $table (".join(',', array_keys($couples)).') VALUES ('.join(
1538 1538
 		',',
1539 1539
 		$couples
1540
-	) . ')', $serveur);
1540
+	).')', $serveur);
1541 1541
 }
1542 1542
 
1543 1543
 
@@ -1624,7 +1624,7 @@  discard block
 block discarded – undo
1624 1624
 		. _sqlite_calculer_expression('WHERE', $where)
1625 1625
 		. _sqlite_calculer_expression('GROUP BY', $groupby, ',')
1626 1626
 		. _sqlite_calculer_expression('HAVING', $having)
1627
-		. ($orderby ? ("\nORDER BY " . _sqlite_calculer_order($orderby)) : '')
1627
+		. ($orderby ? ("\nORDER BY "._sqlite_calculer_order($orderby)) : '')
1628 1628
 		. ($limit ? "\nLIMIT $limit" : '');
1629 1629
 
1630 1630
 	// dans un select, on doit renvoyer la requête en cas d'erreur
@@ -1663,10 +1663,10 @@  discard block
 block discarded – undo
1663 1663
 	// interdire la creation d'une nouvelle base,
1664 1664
 	// sauf si on est dans l'installation
1665 1665
 	if (
1666
-		!is_file($f = _DIR_DB . $db . '.sqlite')
1666
+		!is_file($f = _DIR_DB.$db.'.sqlite')
1667 1667
 		&& (!defined('_ECRIRE_INSTALL') || !_ECRIRE_INSTALL)
1668 1668
 	) {
1669
-		spip_log("Il est interdit de creer la base $db", 'sqlite.' . _LOG_HS);
1669
+		spip_log("Il est interdit de creer la base $db", 'sqlite.'._LOG_HS);
1670 1670
 
1671 1671
 		return false;
1672 1672
 	}
@@ -1675,12 +1675,12 @@  discard block
 block discarded – undo
1675 1675
 	// avec les identifiants connus
1676 1676
 	$index = $serveur ? $serveur : 0;
1677 1677
 
1678
-	if ($link = spip_connect_db('', '', '', '', '@selectdb@' . $db, $serveur, '', '')) {
1678
+	if ($link = spip_connect_db('', '', '', '', '@selectdb@'.$db, $serveur, '', '')) {
1679 1679
 		if (($db == $link['db']) && $GLOBALS['connexions'][$index] = $link) {
1680 1680
 			return $db;
1681 1681
 		}
1682 1682
 	} else {
1683
-		spip_log("Impossible de selectionner la base $db", 'sqlite.' . _LOG_HS);
1683
+		spip_log("Impossible de selectionner la base $db", 'sqlite.'._LOG_HS);
1684 1684
 	}
1685 1685
 
1686 1686
 	return false;
@@ -1733,7 +1733,7 @@  discard block
 block discarded – undo
1733 1733
 	$match = "^$match$";
1734 1734
 
1735 1735
 	return spip_sqlite_query(
1736
-		"SELECT name FROM sqlite_master WHERE type='table' AND tbl_name REGEXP " . _q($match),
1736
+		"SELECT name FROM sqlite_master WHERE type='table' AND tbl_name REGEXP "._q($match),
1737 1737
 		$serveur,
1738 1738
 		$requeter
1739 1739
 	);
@@ -1758,7 +1758,7 @@  discard block
 block discarded – undo
1758 1758
 	$r = spip_sqlite_query(
1759 1759
 		'SELECT name FROM sqlite_master WHERE'
1760 1760
 			. ' type=\'table\''
1761
-			. ' AND name=' . spip_sqlite_quote($table, 'string')
1761
+			. ' AND name='.spip_sqlite_quote($table, 'string')
1762 1762
 			. ' AND name NOT LIKE \'sqlite_%\'',
1763 1763
 		$serveur,
1764 1764
 		$requeter
@@ -1856,7 +1856,7 @@  discard block
 block discarded – undo
1856 1856
 				// s'il y a une parenthèse fermante dans la clé
1857 1857
 				// ou dans la définition sans qu'il n'y ait une ouverture avant
1858 1858
 				if (str_contains($k, ')') or preg_match('/^[^\(]*\)/', $def)) {
1859
-					$fields[$k_precedent] .= ',' . $k . ' ' . $def;
1859
+					$fields[$k_precedent] .= ','.$k.' '.$def;
1860 1860
 					continue;
1861 1861
 				}
1862 1862
 
@@ -1891,13 +1891,13 @@  discard block
 block discarded – undo
1891 1891
 				. 'ORDER BY substr(type,2,1), name';
1892 1892
 			$a = spip_sqlite_query($query, $serveur, $requeter);
1893 1893
 			while ($r = spip_sqlite_fetch($a, null, $serveur)) {
1894
-				$key = str_replace($nom_table . '_', '', $r['name']); // enlever le nom de la table ajoute a l'index
1894
+				$key = str_replace($nom_table.'_', '', $r['name']); // enlever le nom de la table ajoute a l'index
1895 1895
 				$keytype = 'KEY';
1896 1896
 				if (strpos($r['sql'], 'UNIQUE INDEX') !== false) {
1897 1897
 					$keytype = 'UNIQUE KEY';
1898 1898
 				}
1899 1899
 				$colonnes = preg_replace(',.*\((.*)\).*,', '$1', $r['sql']);
1900
-				$keys[$keytype . ' ' . $key] = $colonnes;
1900
+				$keys[$keytype.' '.$key] = $colonnes;
1901 1901
 			}
1902 1902
 		}
1903 1903
 	} // c'est une vue, on liste les champs disponibles simplement
@@ -1945,7 +1945,7 @@  discard block
 block discarded – undo
1945 1945
 
1946 1946
 	$set = [];
1947 1947
 	foreach ($champs as $champ => $val) {
1948
-		$set[] = $champ . "=$val";
1948
+		$set[] = $champ."=$val";
1949 1949
 	}
1950 1950
 	if (!empty($set)) {
1951 1951
 		return spip_sqlite_query(
@@ -2001,7 +2001,7 @@  discard block
 block discarded – undo
2001 2001
 
2002 2002
 	$set = [];
2003 2003
 	foreach ($champs as $champ => $val) {
2004
-		$set[$champ] = $champ . '=' . _sqlite_calculer_cite($val, isset($fields[$champ]) ? $fields[$champ] : '');
2004
+		$set[$champ] = $champ.'='._sqlite_calculer_cite($val, isset($fields[$champ]) ? $fields[$champ] : '');
2005 2005
 	}
2006 2006
 
2007 2007
 	// recherche de champs 'timestamp' pour mise a jour auto de ceux-ci
@@ -2009,7 +2009,7 @@  discard block
 block discarded – undo
2009 2009
 	$maj = _sqlite_ajouter_champs_timestamp($table, [], $desc, $serveur);
2010 2010
 	foreach ($maj as $champ => $val) {
2011 2011
 		if (!isset($set[$champ])) {
2012
-			$set[$champ] = $champ . '=' . $val;
2012
+			$set[$champ] = $champ.'='.$val;
2013 2013
 		}
2014 2014
 	}
2015 2015
 
@@ -2039,7 +2039,7 @@  discard block
 block discarded – undo
2039 2039
 function _sqlite_init()
2040 2040
 {
2041 2041
 	if (!defined('_DIR_DB')) {
2042
-		define('_DIR_DB', _DIR_ETC . 'bases/');
2042
+		define('_DIR_DB', _DIR_ETC.'bases/');
2043 2043
 	}
2044 2044
 	if (!defined('_SQLITE_CHMOD')) {
2045 2045
 		define('_SQLITE_CHMOD', _SPIP_CHMOD);
@@ -2151,9 +2151,9 @@  discard block
 block discarded – undo
2151 2151
 	}
2152 2152
 
2153 2153
 	// echapper les ' en ''
2154
-	spip_log('Pas de methode ->quote pour echapper', 'sqlite.' . _LOG_INFO_IMPORTANTE);
2154
+	spip_log('Pas de methode ->quote pour echapper', 'sqlite.'._LOG_INFO_IMPORTANTE);
2155 2155
 
2156
-	return ("'" . str_replace("'", "''", $v) . "'");
2156
+	return ("'".str_replace("'", "''", $v)."'");
2157 2157
 }
2158 2158
 
2159 2159
 
@@ -2177,12 +2177,12 @@  discard block
 block discarded – undo
2177 2177
 	$exp = "\n$expression ";
2178 2178
 
2179 2179
 	if (!is_array($v)) {
2180
-		return $exp . $v;
2180
+		return $exp.$v;
2181 2181
 	} else {
2182 2182
 		if (strtoupper($join) === 'AND') {
2183
-			return $exp . join("\n\t$join ", array_map('_sqlite_calculer_where', $v));
2183
+			return $exp.join("\n\t$join ", array_map('_sqlite_calculer_where', $v));
2184 2184
 		} else {
2185
-			return $exp . join($join, $v);
2185
+			return $exp.join($join, $v);
2186 2186
 		}
2187 2187
 	}
2188 2188
 }
@@ -2218,17 +2218,17 @@  discard block
 block discarded – undo
2218 2218
 		if (substr($k, -1) == '@') {
2219 2219
 			// c'est une jointure qui se refere au from precedent
2220 2220
 			// pas de virgule
2221
-			$res .= '  ' . $v;
2221
+			$res .= '  '.$v;
2222 2222
 		} else {
2223 2223
 			if (!is_numeric($k)) {
2224 2224
 				$p = strpos($v, ' ');
2225 2225
 				if ($p) {
2226
-					$v = substr($v, 0, $p) . " AS '$k'" . substr($v, $p);
2226
+					$v = substr($v, 0, $p)." AS '$k'".substr($v, $p);
2227 2227
 				} else {
2228 2228
 					$v .= " AS '$k'";
2229 2229
 				}
2230 2230
 			}
2231
-			$res .= ', ' . $v;
2231
+			$res .= ', '.$v;
2232 2232
 		}
2233 2233
 	}
2234 2234
 
@@ -2369,13 +2369,13 @@  discard block
 block discarded – undo
2369 2369
 
2370 2370
 	$def_origine = sql_showtable($table_origine, false, $serveur);
2371 2371
 	if (!$def_origine or !isset($def_origine['field'])) {
2372
-		spip_log("Alter table impossible sur $table_origine : table non trouvee", 'sqlite' . _LOG_ERREUR);
2372
+		spip_log("Alter table impossible sur $table_origine : table non trouvee", 'sqlite'._LOG_ERREUR);
2373 2373
 
2374 2374
 		return false;
2375 2375
 	}
2376 2376
 
2377 2377
 
2378
-	$table_tmp = $table_origine . '_tmp';
2378
+	$table_tmp = $table_origine.'_tmp';
2379 2379
 
2380 2380
 	// 1) creer une table temporaire avec les modifications
2381 2381
 	// - DROP : suppression de la colonne
@@ -2462,7 +2462,7 @@  discard block
 block discarded – undo
2462 2462
 		} else {
2463 2463
 			// enlever KEY
2464 2464
 			$k = substr($k, 4);
2465
-			$queries[] = "CREATE INDEX $table_destination" . "_$k ON $table_destination ($v)";
2465
+			$queries[] = "CREATE INDEX $table_destination"."_$k ON $table_destination ($v)";
2466 2466
 		}
2467 2467
 	}
2468 2468
 
@@ -2473,7 +2473,7 @@  discard block
 block discarded – undo
2473 2473
 		foreach ($queries as $q) {
2474 2474
 			if (!Sqlite::executer_requete($q, $serveur)) {
2475 2475
 				spip_log('SQLite : ALTER TABLE table :'
2476
-					. " Erreur a l'execution de la requete : $q", 'sqlite.' . _LOG_ERREUR);
2476
+					. " Erreur a l'execution de la requete : $q", 'sqlite.'._LOG_ERREUR);
2477 2477
 				Sqlite::annuler_transaction($serveur);
2478 2478
 
2479 2479
 				return false;
@@ -2565,27 +2565,27 @@  discard block
 block discarded – undo
2565 2565
 	$enum = '(\s*\([^\)]*\))?';
2566 2566
 
2567 2567
 	$remplace = [
2568
-		'/enum' . $enum . '/is' => 'VARCHAR(255)',
2568
+		'/enum'.$enum.'/is' => 'VARCHAR(255)',
2569 2569
 		'/COLLATE \w+_bin/is' => 'COLLATE BINARY',
2570 2570
 		'/COLLATE \w+_ci/is' => 'COLLATE NOCASE',
2571 2571
 		'/auto_increment/is' => '',
2572 2572
 		'/current_timestamp\(\)/is' => 'CURRENT_TIMESTAMP', // Fix export depuis mariaDB #4374
2573 2573
 		'/(timestamp .* )ON .*$/is' => '\\1',
2574 2574
 		'/character set \w+/is' => '',
2575
-		'/((big|small|medium|tiny)?int(eger)?)' . $num . '\s*unsigned/is' => '\\1 UNSIGNED',
2575
+		'/((big|small|medium|tiny)?int(eger)?)'.$num.'\s*unsigned/is' => '\\1 UNSIGNED',
2576 2576
 		'/(text\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''",
2577
-		'/((char|varchar)' . $num . '\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''",
2577
+		'/((char|varchar)'.$num.'\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''",
2578 2578
 		'/(datetime\s+not\s+null)\s*$/is' => "\\1 DEFAULT '0000-00-00 00:00:00'",
2579 2579
 		'/(date\s+not\s+null)\s*$/is' => "\\1 DEFAULT '0000-00-00'",
2580 2580
 	];
2581 2581
 
2582 2582
 	// pour l'autoincrement, il faut des INTEGER NOT NULL PRIMARY KEY
2583 2583
 	$remplace_autocinc = [
2584
-		'/(big|small|medium|tiny)?int(eger)?' . $num . '/is' => 'INTEGER'
2584
+		'/(big|small|medium|tiny)?int(eger)?'.$num.'/is' => 'INTEGER'
2585 2585
 	];
2586 2586
 	// pour les int non autoincrement, il faut un DEFAULT
2587 2587
 	$remplace_nonautocinc = [
2588
-		'/((big|small|medium|tiny)?int(eger)?' . $num . '\s+not\s+null)\s*$/is' => "\\1 DEFAULT 0",
2588
+		'/((big|small|medium|tiny)?int(eger)?'.$num.'\s+not\s+null)\s*$/is' => "\\1 DEFAULT 0",
2589 2589
 	];
2590 2590
 
2591 2591
 	if (is_string($query)) {
@@ -2628,7 +2628,7 @@  discard block
 block discarded – undo
2628 2628
 		return str_ireplace('BINARY', 'COLLATE BINARY', $champ);
2629 2629
 	}
2630 2630
 	if (preg_match(',^(char|varchar|(long|small|medium|tiny)?text),i', $champ)) {
2631
-		return $champ . ' COLLATE NOCASE';
2631
+		return $champ.' COLLATE NOCASE';
2632 2632
 	}
2633 2633
 
2634 2634
 	return $champ;
@@ -2718,14 +2718,14 @@  discard block
 block discarded – undo
2718 2718
 		} else {
2719 2719
 			/* simuler le IF EXISTS - version 2 et sqlite < 3.3a */
2720 2720
 			$a = spip_sqlite_showtable($nom, $serveur);
2721
-			if (isset($a['key']['KEY ' . $nom])) {
2721
+			if (isset($a['key']['KEY '.$nom])) {
2722 2722
 				return true;
2723 2723
 			}
2724 2724
 		}
2725 2725
 	}
2726 2726
 
2727 2727
 	$temporary = $temporary ? ' TEMPORARY' : '';
2728
-	$q = "CREATE$temporary TABLE$ifnotexists $nom ($query" . ($keys ? ",$keys" : '') . ")\n";
2728
+	$q = "CREATE$temporary TABLE$ifnotexists $nom ($query".($keys ? ",$keys" : '').")\n";
2729 2729
 
2730 2730
 	return $q;
2731 2731
 }
Please login to merge, or discard this patch.
ecrire/req/mysql.php 1 patch
Spacing   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -58,12 +58,12 @@  discard block
 block discarded – undo
58 58
 			$link = @mysqli_connect($host, $login, $pass);
59 59
 		}
60 60
 	} catch (\mysqli_sql_exception $e) {
61
-		spip_log('mysqli_sql_exception: ' . $e->getMessage(), 'mysql.' . _LOG_DEBUG);
61
+		spip_log('mysqli_sql_exception: '.$e->getMessage(), 'mysql.'._LOG_DEBUG);
62 62
 		$link = false;
63 63
 	}
64 64
 
65 65
 	if (!$link) {
66
-		spip_log('Echec mysqli_connect. Erreur : ' . mysqli_connect_error(), 'mysql.' . _LOG_HS);
66
+		spip_log('Echec mysqli_connect. Erreur : '.mysqli_connect_error(), 'mysql.'._LOG_HS);
67 67
 
68 68
 		return false;
69 69
 	}
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 	}
83 83
 
84 84
 	spip_log(
85
-		"Connexion MySQLi vers $host, base $db, prefixe $prefixe " . ($ok ? 'operationnelle' : 'impossible'),
85
+		"Connexion MySQLi vers $host, base $db, prefixe $prefixe ".($ok ? 'operationnelle' : 'impossible'),
86 86
 		_LOG_DEBUG
87 87
 	);
88 88
 
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
  */
174 174
 function spip_mysql_set_charset($charset, $serveur = '', $requeter = true) {
175 175
 	$connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
176
-	spip_log('changement de charset sql : ' . 'SET NAMES ' . _q($charset), _LOG_DEBUG);
176
+	spip_log('changement de charset sql : '.'SET NAMES '._q($charset), _LOG_DEBUG);
177 177
 
178
-	return mysqli_query($connexion['link'], $connexion['last'] = 'SET NAMES ' . _q($charset));
178
+	return mysqli_query($connexion['link'], $connexion['last'] = 'SET NAMES '._q($charset));
179 179
 }
180 180
 
181 181
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 function spip_mysql_get_charset($charset = [], $serveur = '', $requeter = true) {
191 191
 	$connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0];
192 192
 	$connexion['last'] = $c = 'SHOW CHARACTER SET'
193
-		. (!$charset ? '' : (' LIKE ' . _q($charset['charset'])));
193
+		. (!$charset ? '' : (' LIKE '._q($charset['charset'])));
194 194
 
195 195
 	return spip_mysql_fetch(mysqli_query($connexion['link'], $c), null, $serveur);
196 196
 }
@@ -234,21 +234,21 @@  discard block
 block discarded – undo
234 234
 	$debug = '';
235 235
 	if (defined('_DEBUG_SLOW_QUERIES') and _DEBUG_SLOW_QUERIES) {
236 236
 		if (isset($GLOBALS['debug']['aucasou'])) {
237
-			[, $id, , $infos] = $GLOBALS['debug']['aucasou'];
238
-			$debug .= "BOUCLE$id @ " . ($infos[0] ?? '') . ' | ';
237
+			[, $id,, $infos] = $GLOBALS['debug']['aucasou'];
238
+			$debug .= "BOUCLE$id @ ".($infos[0] ?? '').' | ';
239 239
 		}
240 240
 		if (isset($_SERVER['REQUEST_URI'])) {
241 241
 			$debug .= $_SERVER['REQUEST_URI'];
242 242
 		}
243 243
 		if (!empty($GLOBALS['ip'])) {
244
-			$debug .= ' + ' . $GLOBALS['ip'];
244
+			$debug .= ' + '.$GLOBALS['ip'];
245 245
 		}
246
-		$debug = ' /* ' . mysqli_real_escape_string($link, str_replace('*/', '@/', $debug)) . ' */';
246
+		$debug = ' /* '.mysqli_real_escape_string($link, str_replace('*/', '@/', $debug)).' */';
247 247
 	}
248 248
 	try {
249
-		$r = mysqli_query($link, $query . $debug);
249
+		$r = mysqli_query($link, $query.$debug);
250 250
 	} catch (\mysqli_sql_exception $e) {
251
-		spip_log('mysqli_sql_exception: ' . $e->getMessage(), 'mysql.' . _LOG_DEBUG);
251
+		spip_log('mysqli_sql_exception: '.$e->getMessage(), 'mysql.'._LOG_DEBUG);
252 252
 		$r = false;
253 253
 		// TODO: utiliser l’exception ensuite plutôt que les appels à spip_mysql_errno()
254 254
 		// mais il faut pour php < 8.1 forcer les exeptions via mysqli_report().
@@ -266,9 +266,9 @@  discard block
 block discarded – undo
266 266
 			$link = $connexion['link'];
267 267
 			//On retente au cas où
268 268
 			try {
269
-				$r = mysqli_query($link, $query . $debug);
269
+				$r = mysqli_query($link, $query.$debug);
270 270
 			} catch (\mysqli_sql_exception $e) {
271
-				spip_log('mysqli_sql_exception: ' . $e->getMessage(), 'mysql.' . _LOG_DEBUG);
271
+				spip_log('mysqli_sql_exception: '.$e->getMessage(), 'mysql.'._LOG_DEBUG);
272 272
 				$r = false;
273 273
 				// TODO: utiliser l’exception ensuite plutôt que les appels à spip_mysql_errno()
274 274
 				// mais il faut pour php < 8.1 forcer les exeptions via mysqli_report().
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
 	// d'utiliser ceux-ci, copie-colle de phpmyadmin
302 302
 	$query = preg_replace(',^TABLE\s*`([^`]*)`,i', "TABLE \\1", $query);
303 303
 
304
-	return spip_mysql_query('ALTER ' . $query, $serveur, $requeter); # i.e. que PG se debrouille
304
+	return spip_mysql_query('ALTER '.$query, $serveur, $requeter); # i.e. que PG se debrouille
305 305
 }
306 306
 
307 307
 
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
  * @return bool            Toujours true
315 315
  */
316 316
 function spip_mysql_optimize($table, $serveur = '', $requeter = true) {
317
-	spip_mysql_query('OPTIMIZE TABLE ' . $table);
317
+	spip_mysql_query('OPTIMIZE TABLE '.$table);
318 318
 
319 319
 	return true;
320 320
 }
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 	$link = $connexion['link'];
338 338
 	$db = $connexion['db'];
339 339
 
340
-	$query = 'EXPLAIN ' . _mysql_traite_query($query, $db, $prefixe);
340
+	$query = 'EXPLAIN '._mysql_traite_query($query, $db, $prefixe);
341 341
 	$r = mysqli_query($link, $query);
342 342
 
343 343
 	return spip_mysql_fetch($r, null, $serveur);
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 		. calculer_mysql_expression('WHERE', $where)
389 389
 		. calculer_mysql_expression('GROUP BY', $groupby, ',')
390 390
 		. calculer_mysql_expression('HAVING', $having)
391
-		. ($orderby ? ("\nORDER BY " . spip_mysql_order($orderby)) : '')
391
+		. ($orderby ? ("\nORDER BY ".spip_mysql_order($orderby)) : '')
392 392
 		. ($limit ? "\nLIMIT $limit" : '');
393 393
 
394 394
 	// renvoyer la requete inerte si demandee
@@ -478,12 +478,12 @@  discard block
 block discarded – undo
478 478
 	$exp = "\n$expression ";
479 479
 
480 480
 	if (!is_array($v)) {
481
-		return $exp . $v;
481
+		return $exp.$v;
482 482
 	} else {
483 483
 		if (strtoupper($join) === 'AND') {
484
-			return $exp . join("\n\t$join ", array_map('calculer_mysql_where', $v));
484
+			return $exp.join("\n\t$join ", array_map('calculer_mysql_where', $v));
485 485
 		} else {
486
-			return $exp . join($join, $v);
486
+			return $exp.join($join, $v);
487 487
 		}
488 488
 	}
489 489
 }
@@ -501,17 +501,17 @@  discard block
 block discarded – undo
501 501
 		if (substr($k, -1) == '@') {
502 502
 			// c'est une jointure qui se refere au from precedent
503 503
 			// pas de virgule
504
-			$res .= '  ' . $v;
504
+			$res .= '  '.$v;
505 505
 		} else {
506 506
 			if (!is_numeric($k)) {
507 507
 				$p = strpos($v, ' ');
508 508
 				if ($p) {
509
-					$v = substr($v, 0, $p) . " AS `$k`" . substr($v, $p);
509
+					$v = substr($v, 0, $p)." AS `$k`".substr($v, $p);
510 510
 				} else {
511 511
 					$v .= " AS `$k`";
512 512
 				}
513 513
 			}
514
-			$res .= ', ' . $v;
514
+			$res .= ', '.$v;
515 515
 		}
516 516
 	}
517 517
 
@@ -541,13 +541,13 @@  discard block
 block discarded – undo
541 541
 function _mysql_traite_query($query, $db = '', $prefixe = '', $echappe_textes = true) {
542 542
 
543 543
 	if ($GLOBALS['mysql_rappel_nom_base'] and $db) {
544
-		$pref = '`' . $db . '`.';
544
+		$pref = '`'.$db.'`.';
545 545
 	} else {
546 546
 		$pref = '';
547 547
 	}
548 548
 
549 549
 	if ($prefixe) {
550
-		$pref .= $prefixe . '_';
550
+		$pref .= $prefixe.'_';
551 551
 	}
552 552
 
553 553
 	if (!preg_match('/\s(SET|VALUES|WHERE|DATABASE)\s/i', $query, $regs)) {
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 				$suite_echap = $suite;
567 567
 			}
568 568
 			if (preg_match('/^(.*?)([(]\s*SELECT\b.*)$/si', $suite_echap, $r)) {
569
-				$suite_echap = $r[1] . _mysql_traite_query($r[2], $db, $prefixe, false);
569
+				$suite_echap = $r[1]._mysql_traite_query($r[2], $db, $prefixe, false);
570 570
 				if ($echappe_textes) {
571 571
 					$suite = query_reinjecte_textes($suite_echap, $textes);
572 572
 				}
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 			}
577 577
 		}
578 578
 	}
579
-	$r = preg_replace(_SQL_PREFIXE_TABLE_MYSQL, '\1' . $pref, $query) . $suite;
579
+	$r = preg_replace(_SQL_PREFIXE_TABLE_MYSQL, '\1'.$pref, $query).$suite;
580 580
 
581 581
 	// en option, remplacer les emoji (que mysql ne sait pas gérer) en &#128169;
582 582
 	// remplacer les emoji (que mysql ne sait pas gérer) en &#128169;
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
 		$ok = false;
617 617
 	}
618 618
 	if (!$ok) {
619
-		spip_log('Echec mysqli_selectdb. Erreur : ' . mysqli_error($link), 'mysql.' . _LOG_CRITIQUE);
619
+		spip_log('Echec mysqli_selectdb. Erreur : '.mysqli_error($link), 'mysql.'._LOG_CRITIQUE);
620 620
 	}
621 621
 
622 622
 	return $ok;
@@ -706,10 +706,10 @@  discard block
 block discarded – undo
706 706
 
707 707
 	$character_set = '';
708 708
 	if (@$GLOBALS['meta']['charset_sql_base']) {
709
-		$character_set .= ' CHARACTER SET ' . $GLOBALS['meta']['charset_sql_base'];
709
+		$character_set .= ' CHARACTER SET '.$GLOBALS['meta']['charset_sql_base'];
710 710
 	}
711 711
 	if (@$GLOBALS['meta']['charset_collation_sql_base']) {
712
-		$character_set .= ' COLLATE ' . $GLOBALS['meta']['charset_collation_sql_base'];
712
+		$character_set .= ' COLLATE '.$GLOBALS['meta']['charset_collation_sql_base'];
713 713
 	}
714 714
 
715 715
 	foreach ($champs as $k => $v) {
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
 				preg_match(',(char|text),i', $defs[1])
720 720
 				and !preg_match(',(binary|CHARACTER|COLLATE),i', $v)
721 721
 			) {
722
-				$v = $defs[1] . $character_set . ' ' . substr($v, strlen($defs[1]));
722
+				$v = $defs[1].$character_set.' '.substr($v, strlen($defs[1]));
723 723
 			}
724 724
 		}
725 725
 
@@ -731,8 +731,8 @@  discard block
 block discarded – undo
731 731
 		$s = ',';
732 732
 	}
733 733
 	$temporary = $temporary ? 'TEMPORARY' : '';
734
-	$q = "CREATE $temporary TABLE IF NOT EXISTS $nom ($query" . ($keys ? ",$keys" : '') . ')'
735
-		. (defined('_MYSQL_ENGINE') ? ' ENGINE=' . _MYSQL_ENGINE : '')
734
+	$q = "CREATE $temporary TABLE IF NOT EXISTS $nom ($query".($keys ? ",$keys" : '').')'
735
+		. (defined('_MYSQL_ENGINE') ? ' ENGINE='._MYSQL_ENGINE : '')
736 736
 		. ($character_set ? " DEFAULT $character_set" : '')
737 737
 		. "\n";
738 738
 
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
 		return false;
812 812
 	}
813 813
 
814
-	$query = "CREATE VIEW $nom AS " . $query_select;
814
+	$query = "CREATE VIEW $nom AS ".$query_select;
815 815
 
816 816
 	return spip_mysql_query($query, $serveur, $requeter);
817 817
 }
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
  *     Ressource à utiliser avec sql_fetch()
870 870
  **/
871 871
 function spip_mysql_showbase($match, $serveur = '', $requeter = true) {
872
-	return spip_mysql_query('SHOW TABLES LIKE ' . _q($match), $serveur, $requeter);
872
+	return spip_mysql_query('SHOW TABLES LIKE '._q($match), $serveur, $requeter);
873 873
 }
874 874
 
875 875
 /**
@@ -885,7 +885,7 @@  discard block
 block discarded – undo
885 885
  *     - true si la requête a réussie, false sinon
886 886
  */
887 887
 function spip_mysql_repair($table, $serveur = '', $requeter = true) {
888
-	$table_status = spip_mysql_fetch(spip_mysql_query('SHOW TABLE STATUS WHERE Name = ' . _q($table), $serveur, true));
888
+	$table_status = spip_mysql_fetch(spip_mysql_query('SHOW TABLE STATUS WHERE Name = '._q($table), $serveur, true));
889 889
 	$engine = $table_status['Engine'];
890 890
 	if ($engine == 'InnoDB') {
891 891
 		if (spip_mysql_alter("TABLE $table ENGINE = InnoDB", $serveur, $requeter)) {
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
 	} elseif ($engine == 'MyISAM') {
895 895
 		return spip_mysql_query("REPAIR TABLE `$table`", $serveur, $requeter);
896 896
 	} else {
897
-		spip_log("spip_mysql_repair impossible pour la table $table engine $engine", 'mysql.' . _LOG_DEBUG);
897
+		spip_log("spip_mysql_repair impossible pour la table $table engine $engine", 'mysql.'._LOG_DEBUG);
898 898
 	}
899 899
 	return false;
900 900
 }
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
  *     - string : requete sql, si $requeter = true
915 915
  **/
916 916
 function spip_mysql_table_exists(string $table, $serveur = '', $requeter = true) {
917
-	$r = spip_mysql_query('SHOW TABLES LIKE ' . _q($table), $serveur, $requeter);
917
+	$r = spip_mysql_query('SHOW TABLES LIKE '._q($table), $serveur, $requeter);
918 918
 	if (!$requeter) {
919 919
 		return $r;
920 920
 	}
@@ -996,22 +996,22 @@  discard block
 block discarded – undo
996 996
 			}
997 997
 			if ($val['Default'] === '0' || $val['Default']) {
998 998
 				if (preg_match('/[A-Z_]/', $val['Default'])) {
999
-					$nfields[$val['Field']] .= ' DEFAULT ' . $val['Default'];
999
+					$nfields[$val['Field']] .= ' DEFAULT '.$val['Default'];
1000 1000
 				} else {
1001
-					$nfields[$val['Field']] .= " DEFAULT '" . $val['Default'] . "'";
1001
+					$nfields[$val['Field']] .= " DEFAULT '".$val['Default']."'";
1002 1002
 				}
1003 1003
 			}
1004 1004
 			if ($val['Extra']) {
1005
-				$nfields[$val['Field']] .= ' ' . $val['Extra'];
1005
+				$nfields[$val['Field']] .= ' '.$val['Extra'];
1006 1006
 			}
1007 1007
 			if ($val['Key'] == 'PRI') {
1008 1008
 				$nkeys['PRIMARY KEY'] = $val['Field'];
1009 1009
 			} else {
1010 1010
 				if ($val['Key'] == 'MUL') {
1011
-					$nkeys['KEY ' . $val['Field']] = $val['Field'];
1011
+					$nkeys['KEY '.$val['Field']] = $val['Field'];
1012 1012
 				} else {
1013 1013
 					if ($val['Key'] == 'UNI') {
1014
-						$nkeys['UNIQUE KEY ' . $val['Field']] = $val['Field'];
1014
+						$nkeys['UNIQUE KEY '.$val['Field']] = $val['Field'];
1015 1015
 					}
1016 1016
 				}
1017 1017
 			}
@@ -1087,7 +1087,7 @@  discard block
 block discarded – undo
1087 1087
 	$serveur = '',
1088 1088
 	$requeter = true
1089 1089
 ) {
1090
-	$c = !$groupby ? '*' : ('DISTINCT ' . (is_string($groupby) ? $groupby : join(',', $groupby)));
1090
+	$c = !$groupby ? '*' : ('DISTINCT '.(is_string($groupby) ? $groupby : join(',', $groupby)));
1091 1091
 
1092 1092
 	$r = spip_mysql_select("COUNT($c)", $from, $where, '', '', '', $having, $serveur, $requeter);
1093 1093
 	if (!$requeter) {
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
 	if ($s) {
1128 1128
 		$trace = debug_backtrace();
1129 1129
 		if ($trace[0]['function'] != 'spip_mysql_error') {
1130
-			spip_log("$s - $query - " . sql_error_backtrace(), 'mysql.' . _LOG_ERREUR);
1130
+			spip_log("$s - $query - ".sql_error_backtrace(), 'mysql.'._LOG_ERREUR);
1131 1131
 		}
1132 1132
 	}
1133 1133
 
@@ -1257,7 +1257,7 @@  discard block
 block discarded – undo
1257 1257
 	try {
1258 1258
 		$insert = mysqli_query($link, $query);
1259 1259
 	} catch (\mysqli_sql_exception $e) {
1260
-		spip_log('mysqli_sql_exception: ' . $e->getMessage(), 'mysql.' . _LOG_DEBUG);
1260
+		spip_log('mysqli_sql_exception: '.$e->getMessage(), 'mysql.'._LOG_DEBUG);
1261 1261
 		// TODO: utiliser l’exception ensuite plutôt que les appels à spip_mysql_errno()
1262 1262
 		// mais il faut pour php < 8.1 forcer les exeptions via mysqli_report().
1263 1263
 	}
@@ -1312,8 +1312,8 @@  discard block
 block discarded – undo
1312 1312
 
1313 1313
 	return spip_mysql_insert(
1314 1314
 		$table,
1315
-		'(' . join(',', array_keys($couples)) . ')',
1316
-		'(' . join(',', $couples) . ')',
1315
+		'('.join(',', array_keys($couples)).')',
1316
+		'('.join(',', $couples).')',
1317 1317
 		$desc,
1318 1318
 		$serveur,
1319 1319
 		$requeter
@@ -1350,7 +1350,7 @@  discard block
 block discarded – undo
1350 1350
 	}
1351 1351
 	$fields = $desc['field'] ?? [];
1352 1352
 
1353
-	$cles = '(' . join(',', array_keys(reset($tab_couples))) . ')';
1353
+	$cles = '('.join(',', array_keys(reset($tab_couples))).')';
1354 1354
 	$valeurs = [];
1355 1355
 	$r = false;
1356 1356
 
@@ -1359,7 +1359,7 @@  discard block
 block discarded – undo
1359 1359
 		foreach ($couples as $champ => $val) {
1360 1360
 			$couples[$champ] = spip_mysql_cite($val, $fields[$champ]);
1361 1361
 		}
1362
-		$valeurs[] = '(' . join(',', $couples) . ')';
1362
+		$valeurs[] = '('.join(',', $couples).')';
1363 1363
 		if (count($valeurs) >= 100) {
1364 1364
 			$r = spip_mysql_insert($table, $cles, join(', ', $valeurs), $desc, $serveur, $requeter);
1365 1365
 			$valeurs = [];
@@ -1396,7 +1396,7 @@  discard block
 block discarded – undo
1396 1396
 function spip_mysql_update($table, $champs, $where = '', $desc = [], $serveur = '', $requeter = true) {
1397 1397
 	$set = [];
1398 1398
 	foreach ($champs as $champ => $val) {
1399
-		$set[] = $champ . "=$val";
1399
+		$set[] = $champ."=$val";
1400 1400
 	}
1401 1401
 	if (!empty($set)) {
1402 1402
 		return spip_mysql_query(
@@ -1453,7 +1453,7 @@  discard block
 block discarded – undo
1453 1453
 	}
1454 1454
 	$set = [];
1455 1455
 	foreach ($champs as $champ => $val) {
1456
-		$set[] = $champ . '=' . spip_mysql_cite($val, @$fields[$champ]);
1456
+		$set[] = $champ.'='.spip_mysql_cite($val, @$fields[$champ]);
1457 1457
 	}
1458 1458
 
1459 1459
 	return spip_mysql_query(
@@ -1522,10 +1522,10 @@  discard block
 block discarded – undo
1522 1522
  *     - false en cas d'erreur.
1523 1523
  **/
1524 1524
 function spip_mysql_replace($table, $couples, $desc = [], $serveur = '', $requeter = true) {
1525
-	return spip_mysql_query("REPLACE $table (" . join(',', array_keys($couples)) . ') VALUES (' . join(
1525
+	return spip_mysql_query("REPLACE $table (".join(',', array_keys($couples)).') VALUES ('.join(
1526 1526
 		',',
1527 1527
 		array_map('_q', $couples)
1528
-	) . ')', $serveur, $requeter);
1528
+	).')', $serveur, $requeter);
1529 1529
 }
1530 1530
 
1531 1531
 
@@ -1554,10 +1554,10 @@  discard block
 block discarded – undo
1554 1554
  *     - false en cas d'erreur.
1555 1555
  **/
1556 1556
 function spip_mysql_replace_multi($table, $tab_couples, $desc = [], $serveur = '', $requeter = true) {
1557
-	$cles = '(' . join(',', array_keys($tab_couples[0])) . ')';
1557
+	$cles = '('.join(',', array_keys($tab_couples[0])).')';
1558 1558
 	$valeurs = [];
1559 1559
 	foreach ($tab_couples as $couples) {
1560
-		$valeurs[] = '(' . join(',', array_map('_q', $couples)) . ')';
1560
+		$valeurs[] = '('.join(',', array_map('_q', $couples)).')';
1561 1561
 	}
1562 1562
 	$valeurs = implode(', ', $valeurs);
1563 1563
 
@@ -1577,28 +1577,28 @@  discard block
 block discarded – undo
1577 1577
  */
1578 1578
 function spip_mysql_multi($objet, $lang) {
1579 1579
 	$lengthlang = strlen("[$lang]");
1580
-	$posmulti = 'INSTR(' . $objet . ", '<multi>')";
1581
-	$posfinmulti = 'INSTR(' . $objet . ", '</multi>')";
1582
-	$debutchaine = 'LEFT(' . $objet . ", $posmulti-1)";
1583
-	$finchaine = 'RIGHT(' . $objet . ', CHAR_LENGTH(' . $objet . ") -(7+$posfinmulti))";
1584
-	$chainemulti = 'TRIM(SUBSTRING(' . $objet . ", $posmulti+7, $posfinmulti -(7+$posmulti)))";
1585
-	$poslang = "INSTR($chainemulti,'[" . $lang . "]')";
1580
+	$posmulti = 'INSTR('.$objet.", '<multi>')";
1581
+	$posfinmulti = 'INSTR('.$objet.", '</multi>')";
1582
+	$debutchaine = 'LEFT('.$objet.", $posmulti-1)";
1583
+	$finchaine = 'RIGHT('.$objet.', CHAR_LENGTH('.$objet.") -(7+$posfinmulti))";
1584
+	$chainemulti = 'TRIM(SUBSTRING('.$objet.", $posmulti+7, $posfinmulti -(7+$posmulti)))";
1585
+	$poslang = "INSTR($chainemulti,'[".$lang."]')";
1586 1586
 	$poslang = "IF($poslang=0,INSTR($chainemulti,']')+1,$poslang+$lengthlang)";
1587
-	$chainelang = 'TRIM(SUBSTRING(' . $objet . ", $posmulti+7+$poslang-1,$posfinmulti -($posmulti+7+$poslang-1) ))";
1588
-	$posfinlang = 'INSTR(' . $chainelang . ", '[')";
1587
+	$chainelang = 'TRIM(SUBSTRING('.$objet.", $posmulti+7+$poslang-1,$posfinmulti -($posmulti+7+$poslang-1) ))";
1588
+	$posfinlang = 'INSTR('.$chainelang.", '[')";
1589 1589
 	$chainelang = "IF($posfinlang>0,LEFT($chainelang,$posfinlang-1),$chainelang)";
1590 1590
 	//$chainelang = "LEFT($chainelang,$posfinlang-1)";
1591
-	$retour = "(TRIM(IF($posmulti = 0 , " .
1592
-		'     TRIM(' . $objet . '), ' .
1593
-		'     CONCAT( ' .
1594
-		"          $debutchaine, " .
1595
-		'          IF( ' .
1596
-		"               $poslang = 0, " .
1597
-		"                     $chainemulti, " .
1598
-		"               $chainelang" .
1599
-		'          ), ' .
1600
-		"          $finchaine" .
1601
-		'     ) ' .
1591
+	$retour = "(TRIM(IF($posmulti = 0 , ".
1592
+		'     TRIM('.$objet.'), '.
1593
+		'     CONCAT( '.
1594
+		"          $debutchaine, ".
1595
+		'          IF( '.
1596
+		"               $poslang = 0, ".
1597
+		"                     $chainemulti, ".
1598
+		"               $chainelang".
1599
+		'          ), '.
1600
+		"          $finchaine".
1601
+		'     ) '.
1602 1602
 		'))) AS multi';
1603 1603
 
1604 1604
 	return $retour;
@@ -1615,7 +1615,7 @@  discard block
 block discarded – undo
1615 1615
  *     Valeur hexadécimale pour MySQL
1616 1616
  **/
1617 1617
 function spip_mysql_hex($v) {
1618
-	return '0x' . $v;
1618
+	return '0x'.$v;
1619 1619
 }
1620 1620
 
1621 1621
 /**
@@ -1655,7 +1655,7 @@  discard block
 block discarded – undo
1655 1655
  *     Expression SQL
1656 1656
  **/
1657 1657
 function spip_mysql_date_proche($champ, $interval, $unite) {
1658
-	$use_now = ( ($champ === 'maj' or strpos($champ, '.maj')) ? true : false );
1658
+	$use_now = (($champ === 'maj' or strpos($champ, '.maj')) ? true : false);
1659 1659
 	return '('
1660 1660
 	. $champ
1661 1661
 	. (($interval <= 0) ? '>' : '<')
@@ -1710,7 +1710,7 @@  discard block
 block discarded – undo
1710 1710
 		} elseif ($v === null) {
1711 1711
 			return "''";
1712 1712
 		}
1713
-		return "'" . addslashes($v) . "'";
1713
+		return "'".addslashes($v)."'";
1714 1714
 	}
1715 1715
 
1716 1716
 	if ($v === null) {
@@ -1734,7 +1734,7 @@  discard block
 block discarded – undo
1734 1734
 		}
1735 1735
 	}
1736 1736
 
1737
-	return ("'" . addslashes($v) . "'");
1737
+	return ("'".addslashes($v)."'");
1738 1738
 }
1739 1739
 
1740 1740
 /**
@@ -1768,7 +1768,7 @@  discard block
 block discarded – undo
1768 1768
 	} else {
1769 1769
 		$GLOBALS['mysql_rappel_nom_base'] = false;
1770 1770
 
1771
-		return "\$GLOBALS['mysql_rappel_nom_base'] = false; " .
1771
+		return "\$GLOBALS['mysql_rappel_nom_base'] = false; ".
1772 1772
 		"/* echec de test_rappel_nom_base_mysql a l'installation. */\n";
1773 1773
 	}
1774 1774
 }
Please login to merge, or discard this patch.
ecrire/inc/distant.php 1 patch
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	define('_INC_DISTANT_CONTENT_ENCODING', 'gzip');
29 29
 }
30 30
 if (!defined('_INC_DISTANT_USER_AGENT')) {
31
-	define('_INC_DISTANT_USER_AGENT', 'SPIP-' . $GLOBALS['spip_version_affichee'] . ' (' . $GLOBALS['home_server'] . ')');
31
+	define('_INC_DISTANT_USER_AGENT', 'SPIP-'.$GLOBALS['spip_version_affichee'].' ('.$GLOBALS['home_server'].')');
32 32
 }
33 33
 if (!defined('_INC_DISTANT_MAX_SIZE')) {
34 34
 	define('_INC_DISTANT_MAX_SIZE', 2_097_152);
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	define('_INC_DISTANT_CONNECT_TIMEOUT', 10);
38 38
 }
39 39
 
40
-define('_REGEXP_COPIE_LOCALE', ',' 	.
40
+define('_REGEXP_COPIE_LOCALE', ','.
41 41
 	preg_replace(
42 42
 		'@^https?:@',
43 43
 		'https?:',
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 
75 75
 	// si c'est la protection de soi-meme, retourner le path
76 76
 	if ($mode !== 'force' and preg_match(_REGEXP_COPIE_LOCALE, $source, $match)) {
77
-		$source = substr(_DIR_IMG, strlen(_DIR_RACINE)) . urldecode($match[1]);
77
+		$source = substr(_DIR_IMG, strlen(_DIR_RACINE)).urldecode($match[1]);
78 78
 
79 79
 		return @file_exists($source) ? $source : false;
80 80
 	}
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 		return false;
95 95
 	}
96 96
 
97
-	$localrac = _DIR_RACINE . $local;
97
+	$localrac = _DIR_RACINE.$local;
98 98
 	$t = ($mode === 'force') ? false : @file_exists($localrac);
99 99
 
100 100
 	// test d'existence du fichier
@@ -114,18 +114,18 @@  discard block
 block discarded – undo
114 114
 		if (!$taille_max) {
115 115
 			$taille_max = _COPIE_LOCALE_MAX_SIZE;
116 116
 		}
117
-		$localrac_tmp = $localrac . '.tmp';
117
+		$localrac_tmp = $localrac.'.tmp';
118 118
 		$res = recuperer_url(
119 119
 			$source,
120 120
 			['file' => $localrac_tmp, 'taille_max' => $taille_max, 'if_modified_since' => $t ? filemtime($localrac) : '']
121 121
 		);
122 122
 
123 123
 		if (!$res or (!$res['length'] and $res['status'] != 304)) {
124
-			spip_log("copie_locale : Echec recuperation $source sur $localrac_tmp status : " . ($res ? $res['status'] : '-'), 'distant' . _LOG_INFO_IMPORTANTE);
124
+			spip_log("copie_locale : Echec recuperation $source sur $localrac_tmp status : ".($res ? $res['status'] : '-'), 'distant'._LOG_INFO_IMPORTANTE);
125 125
 			@unlink($localrac_tmp);
126 126
 		}
127 127
 		else {
128
-			spip_log("copie_locale : recuperation $source sur $localrac_tmp OK | taille " . $res['length'] . ' status ' . $res['status'], 'distant');
128
+			spip_log("copie_locale : recuperation $source sur $localrac_tmp OK | taille ".$res['length'].' status '.$res['status'], 'distant');
129 129
 		}
130 130
 		if (!$res or !$res['length']) {
131 131
 			// si $t c'est sans doute juste un not-modified-since
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 			and is_callable($callback_valider_url)
139 139
 			and !$callback_valider_url($res['url'])
140 140
 		) {
141
-			spip_log('copie_locale : url finale ' . $res['url'] . " non valide, on refuse le fichier $localrac_tmp", 'distant' . _LOG_INFO_IMPORTANTE);
141
+			spip_log('copie_locale : url finale '.$res['url']." non valide, on refuse le fichier $localrac_tmp", 'distant'._LOG_INFO_IMPORTANTE);
142 142
 			@unlink($localrac_tmp);
143 143
 			return $t ? $local : false;
144 144
 		}
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 
230 230
 	if (!$is_known_host) {
231 231
 		$host = trim($parsed_url['host'], '.');
232
-		if (! $ip = filter_var($host, FILTER_VALIDATE_IP)) {
232
+		if (!$ip = filter_var($host, FILTER_VALIDATE_IP)) {
233 233
 			$ip = gethostbyname($host);
234 234
 			if ($ip === $host) {
235 235
 				// Error condition for gethostbyname()
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 			}
251 251
 		}
252 252
 		if ($ip) {
253
-			if (! filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
253
+			if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
254 254
 				return false;
255 255
 			}
256 256
 		}
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 	}
262 262
 
263 263
 	$port = $parsed_url['port'];
264
-	if ($port === 80  or $port === 443  or $port === 8080) {
264
+	if ($port === 80 or $port === 443 or $port === 8080) {
265 265
 		return $url;
266 266
 	}
267 267
 
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 				}
332 332
 			}
333 333
 			if ($taille > 500) {
334
-				$boundary = substr(md5(random_int(0, mt_getrandmax()) . 'spip'), 0, 8);
334
+				$boundary = substr(md5(random_int(0, mt_getrandmax()).'spip'), 0, 8);
335 335
 			}
336 336
 		}
337 337
 
@@ -359,16 +359,16 @@  discard block
 block discarded – undo
359 359
 			}
360 360
 		} else {
361 361
 			// fabrique une chaine HTTP simple pour un POST
362
-			$entete = 'Content-Type: application/x-www-form-urlencoded' . "\r\n";
362
+			$entete = 'Content-Type: application/x-www-form-urlencoded'."\r\n";
363 363
 			$chaine = [];
364 364
 			if (is_array($donnees)) {
365 365
 				foreach ($donnees as $cle => $valeur) {
366 366
 					if (is_array($valeur)) {
367 367
 						foreach ($valeur as $val2) {
368
-							$chaine[] = rawurlencode($cle) . '[]=' . rawurlencode($val2);
368
+							$chaine[] = rawurlencode($cle).'[]='.rawurlencode($val2);
369 369
 						}
370 370
 					} else {
371
-						$chaine[] = rawurlencode($cle) . '=' . rawurlencode($valeur);
371
+						$chaine[] = rawurlencode($cle).'='.rawurlencode($valeur);
372 372
 					}
373 373
 				}
374 374
 				$chaine = implode('&', $chaine);
@@ -469,13 +469,13 @@  discard block
 block discarded – undo
469 469
 		$options['taille_max'] = $copy ? _COPIE_LOCALE_MAX_SIZE : _INC_DISTANT_MAX_SIZE;
470 470
 	}
471 471
 
472
-	spip_log('recuperer_url ' . $options['methode'] . " sur $url", 'distant' . _LOG_DEBUG);
472
+	spip_log('recuperer_url '.$options['methode']." sur $url", 'distant'._LOG_DEBUG);
473 473
 
474 474
 	// Ajout des en-têtes spécifiques si besoin
475 475
 	$formatted_data = '';
476 476
 	if (!empty($options['headers'])) {
477 477
 		foreach ($options['headers'] as $champ => $valeur) {
478
-			$formatted_data .= $champ . ': ' . $valeur . "\r\n";
478
+			$formatted_data .= $champ.': '.$valeur."\r\n";
479 479
 		}
480 480
 	}
481 481
 
@@ -483,9 +483,9 @@  discard block
 block discarded – undo
483 483
 		[$head, $postdata] = prepare_donnees_post($options['datas'], $options['boundary']);
484 484
 		$head .= $formatted_data;
485 485
 		if (stripos($head, 'Content-Length:') === false) {
486
-			$head .= 'Content-Length: ' . strlen($postdata) . "\r\n";
486
+			$head .= 'Content-Length: '.strlen($postdata)."\r\n";
487 487
 		}
488
-		$formatted_data = $head . "\r\n" . $postdata;
488
+		$formatted_data = $head."\r\n".$postdata;
489 489
 		if (
490 490
 			strlen($postdata)
491 491
 			and !$methode_demandee
@@ -499,9 +499,9 @@  discard block
 block discarded – undo
499 499
 	// Accepter les URLs au format feed:// ou qui ont oublie le http:// ou les urls relatives au protocole
500 500
 	$url = preg_replace(',^feed://,i', 'http://', $url);
501 501
 	if (!tester_url_absolue($url)) {
502
-		$url = 'http://' . $url;
502
+		$url = 'http://'.$url;
503 503
 	} elseif (strncmp($url, '//', 2) == 0) {
504
-		$url = 'http:' . $url;
504
+		$url = 'http:'.$url;
505 505
 	}
506 506
 
507 507
 	$url = url_to_ascii($url);
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 		$options['if_modified_since']
531 531
 	);
532 532
 	if (!$handle) {
533
-		spip_log("ECHEC init_http $url", 'distant' . _LOG_ERREUR);
533
+		spip_log("ECHEC init_http $url", 'distant'._LOG_ERREUR);
534 534
 
535 535
 		return false;
536 536
 	}
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 					'status' => 200,
561 561
 				];
562 562
 			} else {
563
-				spip_log("ECHEC chinoiserie $url", 'distant' . _LOG_ERREUR);
563
+				spip_log("ECHEC chinoiserie $url", 'distant'._LOG_ERREUR);
564 564
 				return false;
565 565
 			}
566 566
 		} elseif ($res['location'] and $options['follow_location']) {
@@ -576,11 +576,11 @@  discard block
 block discarded – undo
576 576
 					$options['datas'] = '';
577 577
 				}
578 578
 			}
579
-			spip_log('recuperer_url recommence ' . $options['methode'] . " sur $url", 'distant' . _LOG_DEBUG);
579
+			spip_log('recuperer_url recommence '.$options['methode']." sur $url", 'distant'._LOG_DEBUG);
580 580
 
581 581
 			return recuperer_url($url, $options);
582 582
 		} elseif ($res['status'] !== 200) {
583
-			spip_log('HTTP status ' . $res['status'] . " pour $url", 'distant');
583
+			spip_log('HTTP status '.$res['status']." pour $url", 'distant');
584 584
 		}
585 585
 		$result['status'] = $res['status'];
586 586
 		if (isset($res['headers'])) {
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
 
597 597
 	// on ne veut que les entetes
598 598
 	if (!$options['taille_max'] or $options['methode'] == 'HEAD' or $result['status'] == '304') {
599
-		spip_log('RESULTAT recuperer_url ' . $options['methode'] . " sur $url : " . json_encode($result), 'distant' . _LOG_DEBUG);
599
+		spip_log('RESULTAT recuperer_url '.$options['methode']." sur $url : ".json_encode($result), 'distant'._LOG_DEBUG);
600 600
 		return $result;
601 601
 	}
602 602
 
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 
607 607
 	$gz = false;
608 608
 	if (preg_match(",\bContent-Encoding: .*gzip,is", $result['headers'])) {
609
-		$gz = (_DIR_TMP . md5(uniqid(random_int(0, mt_getrandmax()))) . '.tmp.gz');
609
+		$gz = (_DIR_TMP.md5(uniqid(random_int(0, mt_getrandmax()))).'.tmp.gz');
610 610
 	}
611 611
 
612 612
 	// si on a pas deja recuperer le contenu par une methode detournee
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
 
643 643
 	$trace = json_decode(json_encode($result), true);
644 644
 	$trace['page'] = '...';
645
-	spip_log('RESULTAT recuperer_url ' . $options['methode'] . " sur $url : " . json_encode($trace), 'distant' . _LOG_DEBUG);
645
+	spip_log('RESULTAT recuperer_url '.$options['methode']." sur $url : ".json_encode($trace), 'distant'._LOG_DEBUG);
646 646
 
647 647
 	return $result;
648 648
 }
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 	$sig['url'] = $url;
697 697
 
698 698
 	$dir = sous_repertoire(_DIR_CACHE, 'curl');
699
-	$cache = md5(serialize($sig)) . '-' . substr(preg_replace(',\W+,', '_', $url), 0, 80);
699
+	$cache = md5(serialize($sig)).'-'.substr(preg_replace(',\W+,', '_', $url), 0, 80);
700 700
 	$sub = sous_repertoire($dir, substr($cache, 0, 2));
701 701
 	$cache = "$sub$cache";
702 702
 
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
 	$fp = false;
751 751
 	if ($fichier) {
752 752
 		include_spip('inc/acces');
753
-		$tmpfile = "$fichier." . creer_uniqid() . '.tmp';
753
+		$tmpfile = "$fichier.".creer_uniqid().'.tmp';
754 754
 		$fp = spip_fopen_lock($tmpfile, 'w', LOCK_EX);
755 755
 		if (!$fp and file_exists($fichier)) {
756 756
 			return filesize($fichier);
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 	}
810 810
 	$result['status'] = intval($r[1]);
811 811
 	while ($s = trim(fgets($handle, 16384))) {
812
-		$result['headers'][] = $s . "\n";
812
+		$result['headers'][] = $s."\n";
813 813
 		preg_match(',^([^:]*): *(.*)$,i', $s, $r);
814 814
 		[, $d, $v] = $r;
815 815
 		if (strtolower(trim($d)) == 'location' and $result['status'] >= 300 and $result['status'] < 400) {
@@ -858,13 +858,13 @@  discard block
 block discarded – undo
858 858
 
859 859
 	// on se place tout le temps comme si on etait a la racine
860 860
 	if (_DIR_RACINE) {
861
-		$d = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $d);
861
+		$d = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $d);
862 862
 	}
863 863
 
864 864
 	$m = md5($source);
865 865
 
866 866
 	return $d
867
-	. substr(preg_replace(',[^\w-],', '', basename($source)) . '-' . $m, 0, 12)
867
+	. substr(preg_replace(',[^\w-],', '', basename($source)).'-'.$m, 0, 12)
868 868
 	. substr($m, 0, 4)
869 869
 	. ".$extension";
870 870
 }
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
 	// Si c'est deja local pas de souci
889 889
 	if (!tester_url_absolue($source)) {
890 890
 		if (_DIR_RACINE) {
891
-			$source = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $source);
891
+			$source = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $source);
892 892
 		}
893 893
 
894 894
 		return $source;
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
 		$ext
907 907
 		and preg_match(',^\w+$,', $ext) // pas de php?truc=1&...
908 908
 		and $f = nom_fichier_copie_locale($source, $ext)
909
-		and file_exists(_DIR_RACINE . $f)
909
+		and file_exists(_DIR_RACINE.$f)
910 910
 	) {
911 911
 		return $f;
912 912
 	}
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
 
915 915
 	// Si c'est deja dans la table des documents,
916 916
 	// ramener le nom de sa copie potentielle
917
-	$ext = sql_getfetsel('extension', 'spip_documents', 'fichier=' . sql_quote($source) . " AND distant='oui' AND extension <> ''");
917
+	$ext = sql_getfetsel('extension', 'spip_documents', 'fichier='.sql_quote($source)." AND distant='oui' AND extension <> ''");
918 918
 
919 919
 	if ($ext) {
920 920
 		return nom_fichier_copie_locale($source, $ext);
@@ -925,9 +925,9 @@  discard block
 block discarded – undo
925 925
 
926 926
 	$ext = $path_parts ? $path_parts['extension'] : '';
927 927
 
928
-	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) {
928
+	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) {
929 929
 		$f = nom_fichier_copie_locale($source, $ext);
930
-		if (file_exists(_DIR_RACINE . $f)) {
930
+		if (file_exists(_DIR_RACINE.$f)) {
931 931
 			return $f;
932 932
 		}
933 933
 	}
@@ -935,7 +935,7 @@  discard block
 block discarded – undo
935 935
 	// Ping  pour voir si son extension est connue et autorisee
936 936
 	// avec mise en cache du resultat du ping
937 937
 
938
-	$cache = sous_repertoire(_DIR_CACHE, 'rid') . md5($source);
938
+	$cache = sous_repertoire(_DIR_CACHE, 'rid').md5($source);
939 939
 	if (
940 940
 		!@file_exists($cache)
941 941
 		or !$path_parts = @unserialize(spip_file_get_contents($cache))
@@ -945,11 +945,11 @@  discard block
 block discarded – undo
945 945
 		ecrire_fichier($cache, serialize($path_parts));
946 946
 	}
947 947
 	$ext = !empty($path_parts['extension']) ? $path_parts['extension'] : '';
948
-	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) {
948
+	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) {
949 949
 		return nom_fichier_copie_locale($source, $ext);
950 950
 	}
951 951
 
952
-	spip_log("pas de copie locale pour $source", 'distant' . _LOG_ERREUR);
952
+	spip_log("pas de copie locale pour $source", 'distant'._LOG_ERREUR);
953 953
 	return null;
954 954
 }
955 955
 
@@ -1048,7 +1048,7 @@  discard block
 block discarded – undo
1048 1048
 		} else {
1049 1049
 			if ($a['body']) {
1050 1050
 				$a['extension'] = $extension;
1051
-				$a['fichier'] = _DIR_RACINE . nom_fichier_copie_locale($source, $extension);
1051
+				$a['fichier'] = _DIR_RACINE.nom_fichier_copie_locale($source, $extension);
1052 1052
 				ecrire_fichier($a['fichier'], $a['body']);
1053 1053
 				$size_image = @spip_getimagesize($a['fichier']);
1054 1054
 				$a['largeur'] = intval($size_image[0]);
@@ -1116,20 +1116,20 @@  discard block
 block discarded – undo
1116 1116
 			!$t
1117 1117
 			and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext)
1118 1118
 		) {
1119
-			$t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text'));
1119
+			$t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text'));
1120 1120
 		}
1121 1121
 		if (
1122 1122
 			!$t
1123 1123
 			and preg_match(',^Content-Disposition:\s*attachment;\s*filename=(.*)$,Uims', $headers, $m)
1124 1124
 			and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $m[1], $rext)
1125 1125
 		) {
1126
-			$t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text'));
1126
+			$t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text'));
1127 1127
 		}
1128 1128
 	}
1129 1129
 
1130 1130
 	// Autre mime/type (ou text/plain avec fichier d'extension inconnue)
1131 1131
 	if (!$t) {
1132
-		$t = sql_fetsel('extension', 'spip_types_documents', 'mime_type=' . sql_quote($mime_type));
1132
+		$t = sql_fetsel('extension', 'spip_types_documents', 'mime_type='.sql_quote($mime_type));
1133 1133
 	}
1134 1134
 
1135 1135
 	// Toujours rien ? (ex: audio/x-ogg au lieu de application/ogg)
@@ -1140,11 +1140,11 @@  discard block
 block discarded – undo
1140 1140
 		and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext)
1141 1141
 	) {
1142 1142
 		# eviter xxx.3 => 3gp (> SPIP 3)
1143
-		$t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text'));
1143
+		$t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text'));
1144 1144
 	}
1145 1145
 
1146 1146
 	if ($t) {
1147
-		spip_log("mime-type $mime_type ok, extension " . $t['extension'], 'distant');
1147
+		spip_log("mime-type $mime_type ok, extension ".$t['extension'], 'distant');
1148 1148
 		return $t['extension'];
1149 1149
 	} else {
1150 1150
 		# par defaut on retombe sur '.bin' si c'est autorise
@@ -1247,7 +1247,7 @@  discard block
 block discarded – undo
1247 1247
 		}
1248 1248
 	} else {
1249 1249
 		$scheme = $t['scheme'];
1250
-		$noproxy = $scheme . '://';
1250
+		$noproxy = $scheme.'://';
1251 1251
 	}
1252 1252
 	if (isset($t['user'])) {
1253 1253
 		$user = [$t['user'], $t['pass']];
@@ -1261,7 +1261,7 @@  discard block
 block discarded – undo
1261 1261
 	}
1262 1262
 
1263 1263
 	if (!empty($t['query'])) {
1264
-		$path .= '?' . $t['query'];
1264
+		$path .= '?'.$t['query'];
1265 1265
 	}
1266 1266
 
1267 1267
 	$f = lance_requete($method, $scheme, $user, $host, $path, $port, $noproxy, $refuse_gz, $referer, $datas, $vers, $date);
@@ -1335,29 +1335,29 @@  discard block
 block discarded – undo
1335 1335
 	$proxy_user = '';
1336 1336
 	$http_proxy = need_proxy($host);
1337 1337
 	if ($user) {
1338
-		$user = urlencode($user[0]) . ':' . urlencode($user[1]);
1338
+		$user = urlencode($user[0]).':'.urlencode($user[1]);
1339 1339
 	}
1340 1340
 
1341 1341
 	$connect = '';
1342 1342
 	if ($http_proxy) {
1343
-		if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, ['tls','ssl'])) {
1344
-			$path_host = (!$user ? '' : "$user@") . $host . (($port != 80) ? ":$port" : '');
1345
-			$connect = 'CONNECT ' . $path_host . " $vers\r\n"
1343
+		if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, ['tls', 'ssl'])) {
1344
+			$path_host = (!$user ? '' : "$user@").$host.(($port != 80) ? ":$port" : '');
1345
+			$connect = 'CONNECT '.$path_host." $vers\r\n"
1346 1346
 				. "Host: $path_host\r\n"
1347 1347
 				. "Proxy-Connection: Keep-Alive\r\n";
1348 1348
 		} else {
1349
-			$path = (in_array($scheme, ['tls','ssl']) ? 'https://' : "$scheme://")
1349
+			$path = (in_array($scheme, ['tls', 'ssl']) ? 'https://' : "$scheme://")
1350 1350
 				. (!$user ? '' : "$user@")
1351
-				. "$host" . (($port != 80) ? ":$port" : '') . $path;
1351
+				. "$host".(($port != 80) ? ":$port" : '').$path;
1352 1352
 		}
1353 1353
 		$t2 = @parse_url($http_proxy);
1354 1354
 		$first_host = $t2['host'];
1355 1355
 		$port = ($t2['port'] ?? null) ?: 80;
1356 1356
 		if ($t2['user'] ?? null) {
1357
-			$proxy_user = base64_encode($t2['user'] . ':' . $t2['pass']);
1357
+			$proxy_user = base64_encode($t2['user'].':'.$t2['pass']);
1358 1358
 		}
1359 1359
 	} else {
1360
-		$first_host = $noproxy . $host;
1360
+		$first_host = $noproxy.$host;
1361 1361
 	}
1362 1362
 
1363 1363
 	if ($connect) {
@@ -1379,7 +1379,7 @@  discard block
 block discarded – undo
1379 1379
 		);
1380 1380
 		spip_log("Recuperer $path sur $first_host:$port par $f (via CONNECT)", 'connect');
1381 1381
 		if (!$f) {
1382
-			spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR);
1382
+			spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR);
1383 1383
 			return $errno;
1384 1384
 		}
1385 1385
 		stream_set_timeout($f, _INC_DISTANT_CONNECT_TIMEOUT);
@@ -1392,7 +1392,7 @@  discard block
 block discarded – undo
1392 1392
 			or !count($res = explode(' ', $res))
1393 1393
 			or $res[1] !== '200'
1394 1394
 		) {
1395
-			spip_log("Echec CONNECT sur $first_host:$port", 'connect' . _LOG_INFO_IMPORTANTE);
1395
+			spip_log("Echec CONNECT sur $first_host:$port", 'connect'._LOG_INFO_IMPORTANTE);
1396 1396
 			fclose($f);
1397 1397
 
1398 1398
 			return false;
@@ -1409,7 +1409,7 @@  discard block
 block discarded – undo
1409 1409
 		} while (!$f and $ntry-- and $errno !== 110 and sleep(1));
1410 1410
 		spip_log("Recuperer $path sur $first_host:$port par $f");
1411 1411
 		if (!$f) {
1412
-			spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR);
1412
+			spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR);
1413 1413
 
1414 1414
 			return $errno;
1415 1415
 		}
@@ -1419,16 +1419,16 @@  discard block
 block discarded – undo
1419 1419
 	$site = $GLOBALS['meta']['adresse_site'] ?? '';
1420 1420
 
1421 1421
 	$host_port = $host;
1422
-	if ($port != (in_array($scheme, ['tls','ssl']) ? 443 : 80)) {
1422
+	if ($port != (in_array($scheme, ['tls', 'ssl']) ? 443 : 80)) {
1423 1423
 		$host_port .= ":$port";
1424 1424
 	}
1425 1425
 	$req = "$method $path $vers\r\n"
1426 1426
 		. "Host: $host_port\r\n"
1427
-		. 'User-Agent: ' . _INC_DISTANT_USER_AGENT . "\r\n"
1428
-		. ($refuse_gz ? '' : ('Accept-Encoding: ' . _INC_DISTANT_CONTENT_ENCODING . "\r\n"))
1427
+		. 'User-Agent: '._INC_DISTANT_USER_AGENT."\r\n"
1428
+		. ($refuse_gz ? '' : ('Accept-Encoding: '._INC_DISTANT_CONTENT_ENCODING."\r\n"))
1429 1429
 		. (!$site ? '' : "Referer: $site/$referer\r\n")
1430
-		. (!$date ? '' : 'If-Modified-Since: ' . (gmdate('D, d M Y H:i:s', $date) . " GMT\r\n"))
1431
-		. (!$user ? '' : ('Authorization: Basic ' . base64_encode($user) . "\r\n"))
1430
+		. (!$date ? '' : 'If-Modified-Since: '.(gmdate('D, d M Y H:i:s', $date)." GMT\r\n"))
1431
+		. (!$user ? '' : ('Authorization: Basic '.base64_encode($user)."\r\n"))
1432 1432
 		. (!$proxy_user ? '' : "Proxy-Authorization: Basic $proxy_user\r\n")
1433 1433
 		. (!strpos($vers, '1.1') ? '' : "Keep-Alive: 300\r\nConnection: keep-alive\r\n");
1434 1434
 
Please login to merge, or discard this patch.
ecrire/inc/filtres.php 1 patch
Spacing   +124 added lines, -125 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	}
97 97
 
98 98
 	include_fichiers_fonctions();
99
-	foreach (['filtre_' . $fonc, 'filtre_' . $fonc . '_dist', $fonc] as $f) {
99
+	foreach (['filtre_'.$fonc, 'filtre_'.$fonc.'_dist', $fonc] as $f) {
100 100
 		trouver_filtre_matrice($f); // charge des fichiers spécifiques éventuels
101 101
 		if (is_callable($f)) {
102 102
 			return $f;
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	// affichage "GIT [master: abcdef]"
232 232
 	$commit = $desc['commit_short'] ?? $desc['commit'];
233 233
 	if ($desc['branch']) {
234
-		$commit = $desc['branch'] . ': ' . $commit;
234
+		$commit = $desc['branch'].': '.$commit;
235 235
 	}
236 236
 	return "{$desc['vcs']} [$commit]";
237 237
 }
@@ -250,9 +250,9 @@  discard block
 block discarded – undo
250 250
 	}
251 251
 
252 252
 	// version installee par GIT
253
-	if (lire_fichier($dir . '/.git/HEAD', $c)) {
253
+	if (lire_fichier($dir.'/.git/HEAD', $c)) {
254 254
 		$currentHead = trim(substr($c, 4));
255
-		if (lire_fichier($dir . '/.git/' . $currentHead, $hash)) {
255
+		if (lire_fichier($dir.'/.git/'.$currentHead, $hash)) {
256 256
 			return [
257 257
 				'vcs' => 'GIT',
258 258
 				'branch' => basename($currentHead),
@@ -267,12 +267,12 @@  discard block
 block discarded – undo
267 267
 
268 268
 // La matrice est necessaire pour ne filtrer _que_ des fonctions definies dans filtres_images
269 269
 // et laisser passer les fonctions personnelles baptisees image_...
270
-$GLOBALS['spip_matrice']['image_graver'] = true;//'inc/filtres_images_mini.php';
271
-$GLOBALS['spip_matrice']['image_select'] = true;//'inc/filtres_images_mini.php';
272
-$GLOBALS['spip_matrice']['image_reduire'] = true;//'inc/filtres_images_mini.php';
273
-$GLOBALS['spip_matrice']['image_reduire_par'] = true;//'inc/filtres_images_mini.php';
274
-$GLOBALS['spip_matrice']['image_passe_partout'] = true;//'inc/filtres_images_mini.php';
275
-$GLOBALS['spip_matrice']['image_recadre_avec_fallback'] = true;//'inc/filtres_images_mini.php';
270
+$GLOBALS['spip_matrice']['image_graver'] = true; //'inc/filtres_images_mini.php';
271
+$GLOBALS['spip_matrice']['image_select'] = true; //'inc/filtres_images_mini.php';
272
+$GLOBALS['spip_matrice']['image_reduire'] = true; //'inc/filtres_images_mini.php';
273
+$GLOBALS['spip_matrice']['image_reduire_par'] = true; //'inc/filtres_images_mini.php';
274
+$GLOBALS['spip_matrice']['image_passe_partout'] = true; //'inc/filtres_images_mini.php';
275
+$GLOBALS['spip_matrice']['image_recadre_avec_fallback'] = true; //'inc/filtres_images_mini.php';
276 276
 
277 277
 $GLOBALS['spip_matrice']['couleur_html_to_hex'] = 'inc/filtres_images_mini.php';
278 278
 $GLOBALS['spip_matrice']['couleur_hex_to_hsl'] = 'inc/filtres_images_mini.php';
@@ -431,8 +431,8 @@  discard block
 block discarded – undo
431 431
  */
432 432
 function filtre_debug($val, $key = null) {
433 433
 	$debug = (
434
-		is_null($key) ? '' : (var_export($key, true) . ' = ')
435
-		) . var_export($val, true);
434
+		is_null($key) ? '' : (var_export($key, true).' = ')
435
+		).var_export($val, true);
436 436
 
437 437
 	include_spip('inc/autoriser');
438 438
 	if (autoriser('webmestre')) {
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 		$is_file = false;
489 489
 	}
490 490
 	if ($is_file) {
491
-		$is_local_file = function ($path) {
491
+		$is_local_file = function($path) {
492 492
 			if (strpos($path, '?') !== false) {
493 493
 				$path = supprimer_timestamp($path);
494 494
 				// remove ?24px added by find_in_theme on .svg files
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 					if ($mouseover = extraire_attribut($reduit, 'onmouseover')) {
538 538
 						if (preg_match(",this[.]src=['\"]([^'\"]+)['\"],ims", $mouseover, $match)) {
539 539
 							$srcover = $match[1];
540
-							$srcover_filter = $filtre("<img src='" . $match[1] . "' />", ...$args);
540
+							$srcover_filter = $filtre("<img src='".$match[1]."' />", ...$args);
541 541
 							$srcover_filter = extraire_attribut($srcover_filter, 'src');
542 542
 							$reduit = str_replace($srcover, $srcover_filter, $reduit);
543 543
 						}
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
 	// " -> &quot; et tout ce genre de choses
940 940
 	$u = $GLOBALS['meta']['pcre_u'];
941 941
 	$texte = str_replace('&nbsp;', ' ', $texte);
942
-	$texte = preg_replace('/\s{2,}/S' . $u, ' ', $texte);
942
+	$texte = preg_replace('/\s{2,}/S'.$u, ' ', $texte);
943 943
 	// ne pas echapper les sinqle quotes car certains outils de syndication gerent mal
944 944
 	$texte = entites_html($texte, false, false);
945 945
 	// mais bien echapper les double quotes !
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
 		return '';
1002 1002
 	}
1003 1003
 	return preg_replace(
1004
-		',^[[:space:]]*([0-9]+)([.)]|' . chr(194) . '?' . chr(176) . ')[[:space:]]+,S',
1004
+		',^[[:space:]]*([0-9]+)([.)]|'.chr(194).'?'.chr(176).')[[:space:]]+,S',
1005 1005
 		'',
1006 1006
 		$texte
1007 1007
 	);
@@ -1030,7 +1030,7 @@  discard block
 block discarded – undo
1030 1030
 	if (
1031 1031
 		$texte and
1032 1032
 		preg_match(
1033
-			',^[[:space:]]*([0-9]+)([.)]|' . chr(194) . '?' . chr(176) . ')[[:space:]]+,S',
1033
+			',^[[:space:]]*([0-9]+)([.)]|'.chr(194).'?'.chr(176).')[[:space:]]+,S',
1034 1034
 			$texte,
1035 1035
 			$regs
1036 1036
 		)
@@ -1121,8 +1121,8 @@  discard block
 block discarded – undo
1121 1121
  **/
1122 1122
 function textebrut($texte) {
1123 1123
 	$u = $GLOBALS['meta']['pcre_u'];
1124
-	$texte = preg_replace('/\s+/S' . $u, ' ', $texte);
1125
-	$texte = preg_replace('/<(p|br)( [^>]*)?' . '>/iS', "\n\n", $texte);
1124
+	$texte = preg_replace('/\s+/S'.$u, ' ', $texte);
1125
+	$texte = preg_replace('/<(p|br)( [^>]*)?'.'>/iS', "\n\n", $texte);
1126 1126
 	$texte = preg_replace("/^\n+/", '', $texte);
1127 1127
 	$texte = preg_replace("/\n+$/", '', $texte);
1128 1128
 	$texte = preg_replace("/\n +/", "\n", $texte);
@@ -1156,7 +1156,7 @@  discard block
 block discarded – undo
1156 1156
 		)
1157 1157
 	) {
1158 1158
 		foreach ($liens[0] as $a) {
1159
-			$rel = 'noopener noreferrer ' . extraire_attribut($a, 'rel');
1159
+			$rel = 'noopener noreferrer '.extraire_attribut($a, 'rel');
1160 1160
 			$ablank = inserer_attribut($a, 'rel', $rel);
1161 1161
 			$ablank = inserer_attribut($ablank, 'target', '_blank');
1162 1162
 			$texte = str_replace($a, $ablank, $texte);
@@ -1181,7 +1181,7 @@  discard block
 block discarded – undo
1181 1181
 		foreach ($regs[0] as $a) {
1182 1182
 			$rel = extraire_attribut($a, 'rel') ?? '';
1183 1183
 			if (strpos($rel, 'nofollow') === false) {
1184
-				$rel = 'nofollow' . ($rel ? " $rel" : '');
1184
+				$rel = 'nofollow'.($rel ? " $rel" : '');
1185 1185
 				$anofollow = inserer_attribut($a, 'rel', $rel);
1186 1186
 				$texte = str_replace($a, $anofollow, $texte);
1187 1187
 			}
@@ -1210,7 +1210,7 @@  discard block
 block discarded – undo
1210 1210
 	$u = $GLOBALS['meta']['pcre_u'];
1211 1211
 	$texte = preg_replace('@</p>@iS', "\n", $texte);
1212 1212
 	$texte = preg_replace("@<p\b.*>@UiS", '<br />', $texte);
1213
-	$texte = preg_replace('@^\s*<br />@S' . $u, '', $texte);
1213
+	$texte = preg_replace('@^\s*<br />@S'.$u, '', $texte);
1214 1214
 
1215 1215
 	return $texte;
1216 1216
 }
@@ -1241,7 +1241,7 @@  discard block
 block discarded – undo
1241 1241
 		return $texte;
1242 1242
 	}
1243 1243
 	include_spip('inc/texte');
1244
-	$tag = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $texte) ?
1244
+	$tag = preg_match(',</?('._BALISES_BLOCS.')[>[:space:]],iS', $texte) ?
1245 1245
 		'div' : 'span';
1246 1246
 
1247 1247
 	return "<$tag style='word-wrap:break-word;'>$texte</$tag>";
@@ -1332,7 +1332,7 @@  discard block
 block discarded – undo
1332 1332
 
1333 1333
 		// Calcul de la taille et choix de l'unité
1334 1334
 		$affichage = _T(
1335
-			'spip:taille_' . $unites[$puissance] . $suffixe_item,
1335
+			'spip:taille_'.$unites[$puissance].$suffixe_item,
1336 1336
 			[
1337 1337
 				'taille' => round($octets / pow($kilo, $puissance), $precisions[$puissance])
1338 1338
 			]
@@ -1366,7 +1366,7 @@  discard block
 block discarded – undo
1366 1366
 	}
1367 1367
 	$u = $GLOBALS['meta']['pcre_u'];
1368 1368
 	if ($textebrut) {
1369
-		$texte = preg_replace([",\n,", ',\s(?=\s),msS' . $u], [' ', ''], textebrut($texte));
1369
+		$texte = preg_replace([",\n,", ',\s(?=\s),msS'.$u], [' ', ''], textebrut($texte));
1370 1370
 	}
1371 1371
 	$texte = texte_backend($texte);
1372 1372
 	$texte = str_replace(["'", '"'], ['&#039;', '&#034;'], $texte);
@@ -1401,7 +1401,7 @@  discard block
 block discarded – undo
1401 1401
 	# un message pour abs_url
1402 1402
 	$GLOBALS['mode_abs_url'] = 'url';
1403 1403
 	$url = trim($url);
1404
-	$r = ',^(?:' . _PROTOCOLES_STD . '):?/?/?$,iS';
1404
+	$r = ',^(?:'._PROTOCOLES_STD.'):?/?/?$,iS';
1405 1405
 
1406 1406
 	return preg_match($r, $url) ? '' : ($entites ? entites_html($url) : $url);
1407 1407
 }
@@ -1608,7 +1608,7 @@  discard block
 block discarded – undo
1608 1608
 
1609 1609
 	$debut = '';
1610 1610
 	$suite = $texte;
1611
-	while ($t = strpos('-' . $suite, "\n", 1)) {
1611
+	while ($t = strpos('-'.$suite, "\n", 1)) {
1612 1612
 		$debut .= substr($suite, 0, $t - 1);
1613 1613
 		$suite = substr($suite, $t);
1614 1614
 		$car = substr($suite, 0, 1);
@@ -1626,7 +1626,7 @@  discard block
 block discarded – undo
1626 1626
 			$suite = substr($suite, strlen($regs[0]));
1627 1627
 		}
1628 1628
 	}
1629
-	$texte = $debut . $suite;
1629
+	$texte = $debut.$suite;
1630 1630
 
1631 1631
 	if ($collecteurModeles) {
1632 1632
 		$texte = $collecteurModeles->retablir($texte);
@@ -1634,7 +1634,7 @@  discard block
 block discarded – undo
1634 1634
 
1635 1635
 	$texte = echappe_retour($texte);
1636 1636
 
1637
-	return $texte . $fin;
1637
+	return $texte.$fin;
1638 1638
 }
1639 1639
 
1640 1640
 
@@ -1910,7 +1910,7 @@  discard block
 block discarded – undo
1910 1910
 	if (is_array($balise)) {
1911 1911
 		array_walk(
1912 1912
 			$balise,
1913
-			function (&$a, $key, $t) {
1913
+			function(&$a, $key, $t) {
1914 1914
 				$a = extraire_attribut($a, $t);
1915 1915
 			},
1916 1916
 			$attribut
@@ -2008,14 +2008,14 @@  discard block
 block discarded – undo
2008 2008
 
2009 2009
 	if ($old !== null) {
2010 2010
 		// Remplacer l'ancien attribut du meme nom
2011
-		$balise = $r[1] . $insert . $r[5];
2011
+		$balise = $r[1].$insert.$r[5];
2012 2012
 	} else {
2013 2013
 		// preferer une balise " />" (comme <img />)
2014 2014
 		if (preg_match(',/>,', $balise)) {
2015
-			$balise = preg_replace(',\s?/>,S', $insert . ' />', $balise, 1);
2015
+			$balise = preg_replace(',\s?/>,S', $insert.' />', $balise, 1);
2016 2016
 		} // sinon une balise <a ...> ... </a>
2017 2017
 		else {
2018
-			$balise = preg_replace(',\s?>,S', $insert . '>', $balise, 1);
2018
+			$balise = preg_replace(',\s?>,S', $insert.'>', $balise, 1);
2019 2019
 		}
2020 2020
 	}
2021 2021
 
@@ -2070,7 +2070,7 @@  discard block
 block discarded – undo
2070 2070
 		if (
2071 2071
 			$class_courante
2072 2072
 			and str_contains($class_courante, (string) $c)
2073
-			and preg_match('/(^|\s)' . preg_quote($c) . '($|\s)/', $class_courante)
2073
+			and preg_match('/(^|\s)'.preg_quote($c).'($|\s)/', $class_courante)
2074 2074
 		) {
2075 2075
 			$is_class_presente = true;
2076 2076
 		}
@@ -2078,12 +2078,12 @@  discard block
 block discarded – undo
2078 2078
 			in_array($operation, ['ajouter', 'commuter'])
2079 2079
 			and !$is_class_presente
2080 2080
 		) {
2081
-			$class_new = ltrim(rtrim($class_new ?? '') . ' ' . $c);
2081
+			$class_new = ltrim(rtrim($class_new ?? '').' '.$c);
2082 2082
 		} elseif (
2083 2083
 			in_array($operation, ['supprimer', 'commuter'])
2084 2084
 			and $is_class_presente
2085 2085
 		) {
2086
-			$class_new = trim(preg_replace('/(^|\s)' . preg_quote($c) . '($|\s)/', "\\1", $class_new));
2086
+			$class_new = trim(preg_replace('/(^|\s)'.preg_quote($c).'($|\s)/', "\\1", $class_new));
2087 2087
 		}
2088 2088
 	}
2089 2089
 
@@ -2146,7 +2146,7 @@  discard block
 block discarded – undo
2146 2146
 // Quelques fonctions de calcul arithmetique
2147 2147
 //
2148 2148
 function floatstr($a) {
2149
- return str_replace(',', '.', (string)floatval($a));
2149
+ return str_replace(',', '.', (string) floatval($a));
2150 2150
 }
2151 2151
 function strize($f, $a, $b) {
2152 2152
  return floatstr($f(floatstr($a), floatstr($b)));
@@ -2287,13 +2287,13 @@  discard block
 block discarded – undo
2287 2287
 	if (!defined('_TAGS_NOM_AUTEUR')) {
2288 2288
 		define('_TAGS_NOM_AUTEUR', '');
2289 2289
 	}
2290
-	$tags_acceptes = array_unique(explode(',', 'multi,' . _TAGS_NOM_AUTEUR));
2290
+	$tags_acceptes = array_unique(explode(',', 'multi,'._TAGS_NOM_AUTEUR));
2291 2291
 	foreach ($tags_acceptes as $tag) {
2292 2292
 		if (strlen($tag)) {
2293
-			$remp1[] = '<' . trim($tag) . '>';
2294
-			$remp1[] = '</' . trim($tag) . '>';
2295
-			$remp2[] = '\x60' . trim($tag) . '\x61';
2296
-			$remp2[] = '\x60/' . trim($tag) . '\x61';
2293
+			$remp1[] = '<'.trim($tag).'>';
2294
+			$remp1[] = '</'.trim($tag).'>';
2295
+			$remp2[] = '\x60'.trim($tag).'\x61';
2296
+			$remp2[] = '\x60/'.trim($tag).'\x61';
2297 2297
 		}
2298 2298
 	}
2299 2299
 	$v_nom = str_replace($remp2, $remp1, supprimer_tags(str_replace($remp1, $remp2, $nom)));
@@ -2413,10 +2413,10 @@  discard block
 block discarded – undo
2413 2413
 	$fichier = basename($url);
2414 2414
 
2415 2415
 	return '<a rel="enclosure"'
2416
-	. ($url ? ' href="' . spip_htmlspecialchars($url) . '"' : '')
2417
-	. ($type ? ' type="' . spip_htmlspecialchars($type) . '"' : '')
2418
-	. ($length ? ' title="' . spip_htmlspecialchars($length) . '"' : '')
2419
-	. '>' . $fichier . '</a>';
2416
+	. ($url ? ' href="'.spip_htmlspecialchars($url).'"' : '')
2417
+	. ($type ? ' type="'.spip_htmlspecialchars($type).'"' : '')
2418
+	. ($length ? ' title="'.spip_htmlspecialchars($length).'"' : '')
2419
+	. '>'.$fichier.'</a>';
2420 2420
 }
2421 2421
 
2422 2422
 /**
@@ -2444,9 +2444,9 @@  discard block
 block discarded – undo
2444 2444
 			} # vieux data
2445 2445
 			$fichier = basename($url);
2446 2446
 			$enclosures[] = '<enclosure'
2447
-				. ($url ? ' url="' . spip_htmlspecialchars($url) . '"' : '')
2448
-				. ($type ? ' type="' . spip_htmlspecialchars($type) . '"' : '')
2449
-				. ($length ? ' length="' . $length . '"' : '')
2447
+				. ($url ? ' url="'.spip_htmlspecialchars($url).'"' : '')
2448
+				. ($type ? ' type="'.spip_htmlspecialchars($type).'"' : '')
2449
+				. ($length ? ' length="'.$length.'"' : '')
2450 2450
 				. ' />';
2451 2451
 		}
2452 2452
 	}
@@ -2472,7 +2472,7 @@  discard block
 block discarded – undo
2472 2472
 		if (extraire_attribut($e, 'rel') == 'tag') {
2473 2473
 			$subjects .= '<dc:subject>'
2474 2474
 				. texte_backend(textebrut($e))
2475
-				. '</dc:subject>' . "\n";
2475
+				. '</dc:subject>'."\n";
2476 2476
 		}
2477 2477
 	}
2478 2478
 
@@ -2508,7 +2508,7 @@  discard block
 block discarded – undo
2508 2508
 	if (is_array($texte)) {
2509 2509
 		array_walk(
2510 2510
 			$texte,
2511
-			function (&$a, $key, $t) {
2511
+			function(&$a, $key, $t) {
2512 2512
 				$a = extraire_balise($a, $t);
2513 2513
 			},
2514 2514
 			$tag
@@ -2556,7 +2556,7 @@  discard block
 block discarded – undo
2556 2556
 	if (is_array($texte)) {
2557 2557
 		array_walk(
2558 2558
 			$texte,
2559
-			function (&$a, $key, $t) {
2559
+			function(&$a, $key, $t) {
2560 2560
 				$a = extraire_balises($a, $t);
2561 2561
 			},
2562 2562
 			$tag
@@ -2689,7 +2689,7 @@  discard block
 block discarded – undo
2689 2689
 		if ($fond != '404') {
2690 2690
 			$contexte = array_shift($p);
2691 2691
 			$contexte['page'] = $fond;
2692
-			$action = preg_replace('/([?]' . preg_quote($fond) . '[^&=]*[0-9]+)(&|$)/', '?&', $action);
2692
+			$action = preg_replace('/([?]'.preg_quote($fond).'[^&=]*[0-9]+)(&|$)/', '?&', $action);
2693 2693
 		}
2694 2694
 	}
2695 2695
 	// defaire ce qu'a injecte urls_decoder_url : a revoir en modifiant la signature de urls_decoder_url
@@ -2744,9 +2744,9 @@  discard block
 block discarded – undo
2744 2744
 			. '"'
2745 2745
 			. (is_null($val)
2746 2746
 				? ''
2747
-				: ' value="' . entites_html($val) . '"'
2747
+				: ' value="'.entites_html($val).'"'
2748 2748
 			)
2749
-			. ' type="hidden"' . "\n/>";
2749
+			. ' type="hidden"'."\n/>";
2750 2750
 	}
2751 2751
 
2752 2752
 	return join('', $hidden);
@@ -2856,7 +2856,7 @@  discard block
 block discarded – undo
2856 2856
 
2857 2857
 	return preg_replace_callback(
2858 2858
 		",url\s*\(\s*['\"]?([^'\"/#\s][^:]*)['\"]?\s*\),Uims",
2859
-		fn($x) => "url('" . suivre_lien($path, $x[1]) . "')",
2859
+		fn($x) => "url('".suivre_lien($path, $x[1])."')",
2860 2860
 		$contenu
2861 2861
 	);
2862 2862
 }
@@ -2917,14 +2917,14 @@  discard block
 block discarded – undo
2917 2917
 	) {
2918 2918
 		$distant = true;
2919 2919
 		$cssf = parse_url($css);
2920
-		$cssf = $cssf['path'] . ($cssf['query'] ? '?' . $cssf['query'] : '');
2920
+		$cssf = $cssf['path'].($cssf['query'] ? '?'.$cssf['query'] : '');
2921 2921
 		$cssf = preg_replace(',[?:&=],', '_', $cssf);
2922 2922
 	} else {
2923 2923
 		$distant = false;
2924 2924
 		$cssf = $css;
2925 2925
 		// 1. regarder d'abord si un fichier avec la bonne direction n'est pas aussi
2926 2926
 		//propose (rien a faire dans ce cas)
2927
-		$f = preg_replace(',(_rtl)?\.css$,i', '_' . $ndir . '.css', $css);
2927
+		$f = preg_replace(',(_rtl)?\.css$,i', '_'.$ndir.'.css', $css);
2928 2928
 		if (@file_exists($f)) {
2929 2929
 			return $f;
2930 2930
 		}
@@ -2934,7 +2934,7 @@  discard block
 block discarded – undo
2934 2934
 	$dir_var = sous_repertoire(_DIR_VAR, 'cache-css');
2935 2935
 	$f = $dir_var
2936 2936
 		. preg_replace(',.*/(.*?)(_rtl)?\.css,', '\1', $cssf)
2937
-		. '.' . substr(md5($cssf), 0, 4) . '_' . $ndir . '.css';
2937
+		. '.'.substr(md5($cssf), 0, 4).'_'.$ndir.'.css';
2938 2938
 
2939 2939
 	// la css peut etre distante (url absolue !)
2940 2940
 	if ($distant) {
@@ -2980,8 +2980,8 @@  discard block
 block discarded – undo
2980 2980
 		} // si la css_direction commence par $dir_var on la fait passer pour une absolue
2981 2981
 		elseif (substr($css_direction, 0, strlen($dir_var)) == $dir_var) {
2982 2982
 			$css_direction = substr($css_direction, strlen($dir_var));
2983
-			$src_faux_abs['/@@@@@@/' . $css_direction] = $css_direction;
2984
-			$css_direction = '/@@@@@@/' . $css_direction;
2983
+			$src_faux_abs['/@@@@@@/'.$css_direction] = $css_direction;
2984
+			$css_direction = '/@@@@@@/'.$css_direction;
2985 2985
 		}
2986 2986
 		$src[] = $regs[0][$k];
2987 2987
 		$src_direction_css[] = str_replace($import_css, $css_direction, $regs[0][$k]);
@@ -3030,7 +3030,7 @@  discard block
 block discarded – undo
3030 3030
 
3031 3031
 	$f = basename($css, '.css');
3032 3032
 	$f = sous_repertoire(_DIR_VAR, 'cache-css')
3033
-		. preg_replace(',(.*?)(_rtl|_ltr)?$,', "\\1-urlabs-" . substr(md5("$css-urlabs"), 0, 4) . "\\2", $f)
3033
+		. preg_replace(',(.*?)(_rtl|_ltr)?$,', "\\1-urlabs-".substr(md5("$css-urlabs"), 0, 4)."\\2", $f)
3034 3034
 		. '.css';
3035 3035
 
3036 3036
 	if ((@filemtime($f) > @filemtime($css)) and (_VAR_MODE != 'recalcul')) {
@@ -3040,7 +3040,7 @@  discard block
 block discarded – undo
3040 3040
 	if ($url_absolue_css == $css) {
3041 3041
 		if (
3042 3042
 			strncmp($GLOBALS['meta']['adresse_site'], $css, $l = strlen($GLOBALS['meta']['adresse_site'])) != 0
3043
-			or !lire_fichier(_DIR_RACINE . substr($css, $l), $contenu)
3043
+			or !lire_fichier(_DIR_RACINE.substr($css, $l), $contenu)
3044 3044
 		) {
3045 3045
 			include_spip('inc/distant');
3046 3046
 			$contenu = recuperer_url($css);
@@ -3152,7 +3152,7 @@  discard block
 block discarded – undo
3152 3152
 	$expression = str_replace('\/', '/', $expression);
3153 3153
 	$expression = str_replace('/', '\/', $expression);
3154 3154
 
3155
-	if (preg_match('/' . $expression . '/' . $modif, $texte ?? '', $r)) {
3155
+	if (preg_match('/'.$expression.'/'.$modif, $texte ?? '', $r)) {
3156 3156
 		if (isset($r[$capte])) {
3157 3157
 			return $r[$capte];
3158 3158
 		} else {
@@ -3190,7 +3190,7 @@  discard block
 block discarded – undo
3190 3190
 	$expression = str_replace('\/', '/', $expression);
3191 3191
 	$expression = str_replace('/', '\/', $expression);
3192 3192
 
3193
-	return preg_replace('/' . $expression . '/' . $modif, $replace, $texte);
3193
+	return preg_replace('/'.$expression.'/'.$modif, $replace, $texte);
3194 3194
 }
3195 3195
 
3196 3196
 
@@ -3209,7 +3209,7 @@  discard block
 block discarded – undo
3209 3209
 function traiter_doublons_documents(&$doublons, $letexte) {
3210 3210
 
3211 3211
 	// Verifier dans le texte & les notes (pas beau, helas)
3212
-	$t = $letexte . $GLOBALS['les_notes'];
3212
+	$t = $letexte.$GLOBALS['les_notes'];
3213 3213
 
3214 3214
 	if (
3215 3215
 		strstr($t, 'spip_document_') // evite le preg_match_all si inutile
@@ -3223,7 +3223,7 @@  discard block
 block discarded – undo
3223 3223
 		if (!isset($doublons['documents'])) {
3224 3224
 			$doublons['documents'] = '';
3225 3225
 		}
3226
-		$doublons['documents'] .= ',' . join(',', $matches[1]);
3226
+		$doublons['documents'] .= ','.join(',', $matches[1]);
3227 3227
 	}
3228 3228
 
3229 3229
 	return $letexte;
@@ -3280,7 +3280,7 @@  discard block
 block discarded – undo
3280 3280
 	if ($env) {
3281 3281
 		foreach ($env as $i => $j) {
3282 3282
 			if (is_string($j) and !in_array($i, $ignore_params)) {
3283
-				$texte .= "<param name='" . attribut_html($i) . "'\n\tvalue='" . attribut_html($j) . "' />";
3283
+				$texte .= "<param name='".attribut_html($i)."'\n\tvalue='".attribut_html($j)."' />";
3284 3284
 			}
3285 3285
 		}
3286 3286
 	}
@@ -3319,7 +3319,7 @@  discard block
 block discarded – undo
3319 3319
 	if ($env) {
3320 3320
 		foreach ($env as $i => $j) {
3321 3321
 			if (is_string($j) and !in_array($i, $ignore_params)) {
3322
-				$texte .= attribut_html($i) . "='" . attribut_html($j) . "' ";
3322
+				$texte .= attribut_html($i)."='".attribut_html($j)."' ";
3323 3323
 			}
3324 3324
 		}
3325 3325
 	}
@@ -3393,10 +3393,10 @@  discard block
 block discarded – undo
3393 3393
 	// si il y a un .svg a la bonne taille (-16.svg) a cote, on l'utilise en remplacement du -16.png
3394 3394
 	if (
3395 3395
 		preg_match(',-(\d+)[.](png|gif|svg)$,', $img_file, $m)
3396
-		and $variante_svg_generique = substr($img_file, 0, -strlen($m[0])) . '-xx.svg'
3396
+		and $variante_svg_generique = substr($img_file, 0, -strlen($m[0])).'-xx.svg'
3397 3397
 		and file_exists($variante_svg_generique)
3398 3398
 	) {
3399
-		if ($variante_svg_size = substr($variante_svg_generique, 0, -6) . $m[1] . '.svg' and file_exists($variante_svg_size)) {
3399
+		if ($variante_svg_size = substr($variante_svg_generique, 0, -6).$m[1].'.svg' and file_exists($variante_svg_size)) {
3400 3400
 			$img_file = $variante_svg_size;
3401 3401
 		}
3402 3402
 		else {
@@ -3454,7 +3454,7 @@  discard block
 block discarded – undo
3454 3454
 				return '';
3455 3455
 			}
3456 3456
 		}
3457
-		$atts .= " width='" . $largeur . "' height='" . $hauteur . "'";
3457
+		$atts .= " width='".$largeur."' height='".$hauteur."'";
3458 3458
 	}
3459 3459
 
3460 3460
 	if (file_exists($img_file)) {
@@ -3464,14 +3464,14 @@  discard block
 block discarded – undo
3464 3464
 		$alt = '';
3465 3465
 	}
3466 3466
 	elseif ($alt or $alt === '') {
3467
-		$alt = " alt='" . attribut_html($alt) . "'";
3467
+		$alt = " alt='".attribut_html($alt)."'";
3468 3468
 	}
3469 3469
 	else {
3470
-		$alt = " alt='" . attribut_html($title) . "'";
3470
+		$alt = " alt='".attribut_html($title)."'";
3471 3471
 	}
3472
-	return "<img src='" . attribut_html($img_file) . "'$alt"
3473
-	. ($title ? ' title="' . attribut_html($title) . '"' : '')
3474
-	. ' ' . ltrim($atts)
3472
+	return "<img src='".attribut_html($img_file)."'$alt"
3473
+	. ($title ? ' title="'.attribut_html($title).'"' : '')
3474
+	. ' '.ltrim($atts)
3475 3475
 	. ' />';
3476 3476
 }
3477 3477
 
@@ -3485,10 +3485,10 @@  discard block
 block discarded – undo
3485 3485
  */
3486 3486
 function http_style_background($img, $att = '', $size = null) {
3487 3487
 	if ($size and is_numeric($size)) {
3488
-		$size = trim($size) . 'px';
3488
+		$size = trim($size).'px';
3489 3489
 	}
3490
-	return " style='background" .
3491
-		($att ? '' : '-image') . ': url("' . chemin_image($img) . '")' . ($att ? (' ' . $att) : '') . ';'
3490
+	return " style='background".
3491
+		($att ? '' : '-image').': url("'.chemin_image($img).'")'.($att ? (' '.$att) : '').';'
3492 3492
 		. ($size ? "background-size:{$size};" : '')
3493 3493
 		. "'";
3494 3494
 }
@@ -3603,7 +3603,7 @@  discard block
 block discarded – undo
3603 3603
 		$img = http_img_pack(
3604 3604
 			$img,
3605 3605
 			$alt,
3606
-			$class ? " class='" . attribut_html($class) . "'" : '',
3606
+			$class ? " class='".attribut_html($class)."'" : '',
3607 3607
 			'',
3608 3608
 			['chemin_image' => false, 'utiliser_suffixe_size' => false]
3609 3609
 		);
@@ -3688,7 +3688,7 @@  discard block
 block discarded – undo
3688 3688
 	$balise_svg_source = $balise_svg;
3689 3689
 
3690 3690
 	// entete XML à supprimer
3691
-	$svg = preg_replace(',^\s*<\?xml[^>]*\?' . '>,', '', $svg);
3691
+	$svg = preg_replace(',^\s*<\?xml[^>]*\?'.'>,', '', $svg);
3692 3692
 
3693 3693
 	// IE est toujours mon ami
3694 3694
 	$balise_svg = inserer_attribut($balise_svg, 'focusable', 'false');
@@ -3706,9 +3706,9 @@  discard block
 block discarded – undo
3706 3706
 	// regler le alt
3707 3707
 	if ($alt) {
3708 3708
 		$balise_svg = inserer_attribut($balise_svg, 'role', 'img');
3709
-		$id = 'img-svg-title-' . substr(md5("$img_file:$svg:$alt"), 0, 4);
3709
+		$id = 'img-svg-title-'.substr(md5("$img_file:$svg:$alt"), 0, 4);
3710 3710
 		$balise_svg = inserer_attribut($balise_svg, 'aria-labelledby', $id);
3711
-		$title = "<title id=\"$id\">" . entites_html($alt) . "</title>\n";
3711
+		$title = "<title id=\"$id\">".entites_html($alt)."</title>\n";
3712 3712
 		$balise_svg .= $title;
3713 3713
 	}
3714 3714
 	else {
@@ -3756,7 +3756,7 @@  discard block
 block discarded – undo
3756 3756
 	if (is_array($tableau)) {
3757 3757
 		foreach ($tableau as $k => $v) {
3758 3758
 			$res = recuperer_fond(
3759
-				'modeles/' . $modele,
3759
+				'modeles/'.$modele,
3760 3760
 				array_merge(['cle' => $k], (is_array($v) ? $v : ['valeur' => $v]))
3761 3761
 			);
3762 3762
 			$texte .= $res;
@@ -3941,7 +3941,7 @@  discard block
 block discarded – undo
3941 3941
 	}
3942 3942
 
3943 3943
 	$c = serialize($c);
3944
-	$cle = calculer_cle_action($form . $c);
3944
+	$cle = calculer_cle_action($form.$c);
3945 3945
 	$c = "$cle:$c";
3946 3946
 
3947 3947
 	// on ne stocke pas les contextes dans des fichiers en cache
@@ -3999,15 +3999,15 @@  discard block
 block discarded – undo
3999 3999
 	}
4000 4000
 	// toujours encoder l'url source dans le bloc ajax
4001 4001
 	$r = self();
4002
-	$r = ' data-origin="' . $r . '"';
4002
+	$r = ' data-origin="'.$r.'"';
4003 4003
 	$class = 'ajaxbloc';
4004 4004
 	if ($ajaxid and is_string($ajaxid)) {
4005 4005
 		// ajaxid est normalement conforme a un nom de classe css
4006 4006
 		// on ne verifie pas la conformite, mais on passe entites_html par dessus par precaution
4007
-		$class .= ' ajax-id-' . entites_html($ajaxid);
4007
+		$class .= ' ajax-id-'.entites_html($ajaxid);
4008 4008
 	}
4009 4009
 
4010
-	return "<div class='$class' " . "data-ajax-env='$env'$r>\n$emboite</div><!--ajaxbloc-->\n";
4010
+	return "<div class='$class' "."data-ajax-env='$env'$r>\n$emboite</div><!--ajaxbloc-->\n";
4011 4011
 }
4012 4012
 
4013 4013
 /**
@@ -4051,7 +4051,7 @@  discard block
 block discarded – undo
4051 4051
 		$cle = substr($c, 0, $p);
4052 4052
 		$c = substr($c, $p + 1);
4053 4053
 
4054
-		if ($cle == calculer_cle_action($form . $c)) {
4054
+		if ($cle == calculer_cle_action($form.$c)) {
4055 4055
 			$env = @unserialize($c);
4056 4056
 			return $env;
4057 4057
 		}
@@ -4172,13 +4172,13 @@  discard block
 block discarded – undo
4172 4172
 				}
4173 4173
 			}
4174 4174
 		}
4175
-		$att .= 'class="' . ($class ? attribut_html($class) . ' ' : '') . (defined('_LIEN_OU_EXPOSE_CLASS_ON') ? _LIEN_OU_EXPOSE_CLASS_ON : 'on') . '"';
4175
+		$att .= 'class="'.($class ? attribut_html($class).' ' : '').(defined('_LIEN_OU_EXPOSE_CLASS_ON') ? _LIEN_OU_EXPOSE_CLASS_ON : 'on').'"';
4176 4176
 	} else {
4177 4177
 		$bal = 'a';
4178 4178
 		$att = "href='$url'"
4179
-			. ($title ? " title='" . attribut_html($title) . "'" : '')
4180
-			. ($class ? " class='" . attribut_html($class) . "'" : '')
4181
-			. ($rel ? " rel='" . attribut_html($rel) . "'" : '')
4179
+			. ($title ? " title='".attribut_html($title)."'" : '')
4180
+			. ($class ? " class='".attribut_html($class)."'" : '')
4181
+			. ($rel ? " rel='".attribut_html($rel)."'" : '')
4182 4182
 			. $evt;
4183 4183
 	}
4184 4184
 	if ($libelle === null) {
@@ -4317,7 +4317,7 @@  discard block
 block discarded – undo
4317 4317
 
4318 4318
 	// Icône
4319 4319
 	$icone = http_img_pack($fond, $alt, "width='$size' height='$size'");
4320
-	$icone = '<span class="icone-image' . ($fonction ? " icone-fonction icone-fonction-$fonction" : '') . "\">$icone</span>";
4320
+	$icone = '<span class="icone-image'.($fonction ? " icone-fonction icone-fonction-$fonction" : '')."\">$icone</span>";
4321 4321
 
4322 4322
 	// Markup final
4323 4323
 	if ($type == 'lien') {
@@ -4592,20 +4592,20 @@  discard block
 block discarded – undo
4592 4592
 		$class_form = 'ajax';
4593 4593
 		$class = str_replace('ajax', '', $class);
4594 4594
 	}
4595
-	$class_btn = 'submit ' . trim($class);
4595
+	$class_btn = 'submit '.trim($class);
4596 4596
 
4597 4597
 	if ($confirm) {
4598
-		$confirm = 'confirm("' . attribut_html($confirm) . '")';
4598
+		$confirm = 'confirm("'.attribut_html($confirm).'")';
4599 4599
 		if ($callback) {
4600 4600
 			$callback = "$confirm?($callback):false";
4601 4601
 		} else {
4602 4602
 			$callback = $confirm;
4603 4603
 		}
4604 4604
 	}
4605
-	$onclick = $callback ? " onclick='return " . addcslashes($callback, "'") . "'" : '';
4605
+	$onclick = $callback ? " onclick='return ".addcslashes($callback, "'")."'" : '';
4606 4606
 	$title = $title ? " title='$title'" : '';
4607 4607
 
4608
-	return "<form class='bouton_action_post $class_form' method='post' action='$url'><div>" . form_hidden($url)
4608
+	return "<form class='bouton_action_post $class_form' method='post' action='$url'><div>".form_hidden($url)
4609 4609
 	. "<button type='submit' class='$class_btn'$title$onclick>$libelle</button></div></form>";
4610 4610
 }
4611 4611
 
@@ -4670,14 +4670,14 @@  discard block
 block discarded – undo
4670 4670
 		$champ_titre = '';
4671 4671
 		if ($demande_titre) {
4672 4672
 			// si pas de titre declare mais champ titre, il sera peuple par le select *
4673
-			$champ_titre = (!empty($desc['titre'])) ? ', ' . $desc['titre'] : '';
4673
+			$champ_titre = (!empty($desc['titre'])) ? ', '.$desc['titre'] : '';
4674 4674
 		}
4675 4675
 		include_spip('base/abstract_sql');
4676 4676
 		include_spip('base/connect_sql');
4677 4677
 		$objets[$type_objet][$id_objet] = sql_fetsel(
4678
-			'*' . $champ_titre,
4678
+			'*'.$champ_titre,
4679 4679
 			$desc['table_sql'],
4680
-			id_table_objet($type_objet) . ' = ' . intval($id_objet)
4680
+			id_table_objet($type_objet).' = '.intval($id_objet)
4681 4681
 		);
4682 4682
 
4683 4683
 		// Toujours noter la longueur d'introduction, même si pas demandé cette fois-ci
@@ -4770,8 +4770,7 @@  discard block
 block discarded – undo
4770 4770
 	if (isset($ligne_sql['chapo'])) {
4771 4771
 		$chapo = $ligne_sql['chapo'];
4772 4772
 		$texte = strlen($descriptif) ?
4773
-			'' :
4774
-			"$chapo \n\n $texte";
4773
+			'' : "$chapo \n\n $texte";
4775 4774
 	}
4776 4775
 
4777 4776
 	// Longueur en paramètre, sinon celle renseignée dans la description de l'objet, sinon valeur en dur
@@ -4846,7 +4845,7 @@  discard block
 block discarded – undo
4846 4845
 		return $texte;
4847 4846
 	}
4848 4847
 
4849
-	$traitement = str_replace('%s', "'" . texte_script($texte) . "'", $traitement);
4848
+	$traitement = str_replace('%s', "'".texte_script($texte)."'", $traitement);
4850 4849
 
4851 4850
 	// signaler qu'on est dans l'espace prive pour les filtres qui se servent de ce flag
4852 4851
 	if (test_espace_prive()) {
@@ -4885,7 +4884,7 @@  discard block
 block discarded – undo
4885 4884
 	}
4886 4885
 	$url = generer_objet_url($id_objet, $objet, '', '', null, '', $connect);
4887 4886
 
4888
-	return "<a href='$url' class='$objet'>" . couper($titre, $longueur) . '</a>';
4887
+	return "<a href='$url' class='$objet'>".couper($titre, $longueur).'</a>';
4889 4888
 }
4890 4889
 
4891 4890
 /**
@@ -4911,10 +4910,10 @@  discard block
 block discarded – undo
4911 4910
 function wrap($texte, $wrap) {
4912 4911
 	$balises = extraire_balises($wrap);
4913 4912
 	if (preg_match_all(",<([a-z]\w*)\b[^>]*>,UimsS", $wrap, $regs, PREG_PATTERN_ORDER)) {
4914
-		$texte = $wrap . $texte;
4913
+		$texte = $wrap.$texte;
4915 4914
 		$regs = array_reverse($regs[1]);
4916
-		$wrap = '</' . implode('></', $regs) . '>';
4917
-		$texte = $texte . $wrap;
4915
+		$wrap = '</'.implode('></', $regs).'>';
4916
+		$texte = $texte.$wrap;
4918 4917
 	}
4919 4918
 
4920 4919
 	return $texte;
@@ -4945,7 +4944,7 @@  discard block
 block discarded – undo
4945 4944
 
4946 4945
 	// caster $u en array si besoin
4947 4946
 	if (is_object($u)) {
4948
-		$u = (array)$u;
4947
+		$u = (array) $u;
4949 4948
 	}
4950 4949
 
4951 4950
 	if (is_array($u)) {
@@ -4967,7 +4966,7 @@  discard block
 block discarded – undo
4967 4966
 		// sinon on passe a la ligne et on indente
4968 4967
 		$i_str = str_pad('', $indent, ' ');
4969 4968
 		foreach ($u as $k => $v) {
4970
-			$out .= $join . $i_str . "$k: " . filtre_print_dist($v, $join, $indent + 2);
4969
+			$out .= $join.$i_str."$k: ".filtre_print_dist($v, $join, $indent + 2);
4971 4970
 		}
4972 4971
 
4973 4972
 		return $out;
@@ -5021,7 +5020,7 @@  discard block
 block discarded – undo
5021 5020
  * @return string
5022 5021
  */
5023 5022
 function objet_icone($objet, $taille = 24, $class = '') {
5024
-	$icone = objet_info($objet, 'icone_objet') . '-' . $taille . '.png';
5023
+	$icone = objet_info($objet, 'icone_objet').'-'.$taille.'.png';
5025 5024
 	$icone = chemin_image($icone);
5026 5025
 	$balise_img = charger_filtre('balise_img');
5027 5026
 
@@ -5047,7 +5046,7 @@  discard block
 block discarded – undo
5047 5046
  */
5048 5047
 function objet_T($objet, $chaine, $args = [], $options = []) {
5049 5048
 	$chaine = explode(':', $chaine);
5050
-	if ($t = _T($objet . ':' . end($chaine), $args, array_merge($options, ['force' => false]))) {
5049
+	if ($t = _T($objet.':'.end($chaine), $args, array_merge($options, ['force' => false]))) {
5051 5050
 		return $t;
5052 5051
 	}
5053 5052
 	$chaine = implode(':', $chaine);
@@ -5113,7 +5112,7 @@  discard block
 block discarded – undo
5113 5112
 	$cache = recuperer_fond($fond, $contexte, $options, $connect);
5114 5113
 
5115 5114
 	// calculer le nom de la css
5116
-	$dir_var = sous_repertoire(_DIR_VAR, 'cache-' . $extension);
5115
+	$dir_var = sous_repertoire(_DIR_VAR, 'cache-'.$extension);
5117 5116
 	$nom_safe = preg_replace(',\W,', '_', str_replace('.', '_', $fond));
5118 5117
 	$contexte_implicite = calculer_contexte_implicite();
5119 5118
 
@@ -5121,14 +5120,14 @@  discard block
 block discarded – undo
5121 5120
 	// mais on peut hasher selon le contenu a la demande, si plusieurs contextes produisent un meme contenu
5122 5121
 	// reduit la variabilite du nom et donc le nombre de css concatenees possibles in fine
5123 5122
 	if (isset($options['hash_on_content']) and $options['hash_on_content']) {
5124
-		$hash = md5($contexte_implicite['host'] . '::' . $cache);
5123
+		$hash = md5($contexte_implicite['host'].'::'.$cache);
5125 5124
 	}
5126 5125
 	else {
5127 5126
 		unset($contexte_implicite['notes']); // pas pertinent pour signaler un changeemnt de contenu pour des css/js
5128 5127
 		ksort($contexte);
5129
-		$hash = md5($fond . json_encode($contexte_implicite, JSON_THROW_ON_ERROR) . json_encode($contexte, JSON_THROW_ON_ERROR) . $connect);
5128
+		$hash = md5($fond.json_encode($contexte_implicite, JSON_THROW_ON_ERROR).json_encode($contexte, JSON_THROW_ON_ERROR).$connect);
5130 5129
 	}
5131
-	$filename = $dir_var . $extension . "dyn-$nom_safe-" . substr($hash, 0, 8) . ".$extension";
5130
+	$filename = $dir_var.$extension."dyn-$nom_safe-".substr($hash, 0, 8).".$extension";
5132 5131
 
5133 5132
 	// mettre a jour le fichier si il n'existe pas
5134 5133
 	// ou trop ancien
@@ -5136,8 +5135,8 @@  discard block
 block discarded – undo
5136 5135
 	// et recopie sur le fichier cible uniquement si il change
5137 5136
 	if (
5138 5137
 		!file_exists($filename)
5139
-		or !file_exists($filename . '.last')
5140
-		or (isset($cache['lastmodified']) and $cache['lastmodified'] and filemtime($filename . '.last') < $cache['lastmodified'])
5138
+		or !file_exists($filename.'.last')
5139
+		or (isset($cache['lastmodified']) and $cache['lastmodified'] and filemtime($filename.'.last') < $cache['lastmodified'])
5141 5140
 		or (defined('_VAR_MODE') and _VAR_MODE == 'recalcul')
5142 5141
 	) {
5143 5142
 		$contenu = $cache['texte'];
@@ -5161,10 +5160,10 @@  discard block
 block discarded – undo
5161 5160
 			}
5162 5161
 			// pas de date dans le commentaire car sinon ca invalide le md5 et force la maj
5163 5162
 			// mais on peut mettre un md5 du contenu, ce qui donne un aperu rapide si la feuille a change ou non
5164
-			$comment .= "}\n   md5:" . md5($contenu) . " */\n";
5163
+			$comment .= "}\n   md5:".md5($contenu)." */\n";
5165 5164
 		}
5166 5165
 		// et ecrire le fichier si il change
5167
-		ecrire_fichier_calcule_si_modifie($filename, $comment . $contenu, false, true);
5166
+		ecrire_fichier_calcule_si_modifie($filename, $comment.$contenu, false, true);
5168 5167
 	}
5169 5168
 
5170 5169
 	return timestamp($filename);
@@ -5397,7 +5396,7 @@  discard block
 block discarded – undo
5397 5396
 	if ($e > 0 and strlen($mid) > 8) {
5398 5397
 		$mid = '***...***';
5399 5398
 	}
5400
-	return substr($passe, 0, $e) . $mid . ($e > 0 ? substr($passe, -$e) : '');
5399
+	return substr($passe, 0, $e).$mid.($e > 0 ? substr($passe, -$e) : '');
5401 5400
 }
5402 5401
 
5403 5402
 
@@ -5459,7 +5458,7 @@  discard block
 block discarded – undo
5459 5458
 		case 'id':
5460 5459
 		case 'anchor':
5461 5460
 			if (preg_match(',^\d,', $texte)) {
5462
-				$texte = substr($type, 0, 1) . $texte;
5461
+				$texte = substr($type, 0, 1).$texte;
5463 5462
 			}
5464 5463
 	}
5465 5464
 
@@ -5469,9 +5468,9 @@  discard block
 block discarded – undo
5469 5468
 
5470 5469
 	if (strlen($texte) < $longueur_mini and $longueur_mini < $longueur_maxi) {
5471 5470
 		if (preg_match(',^\d,', $texte)) {
5472
-			$texte = ($type ? substr($type, 0, 1) : 's') . $texte;
5471
+			$texte = ($type ? substr($type, 0, 1) : 's').$texte;
5473 5472
 		}
5474
-		$texte .= $separateur . md5($original);
5473
+		$texte .= $separateur.md5($original);
5475 5474
 		$texte = substr($texte, 0, $longueur_mini);
5476 5475
 	}
5477 5476
 
Please login to merge, or discard this patch.