Completed
Push — master ( 169128...25861b )
by cam
01:08
created
ecrire/inc/invalideur.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	$n = 0;
46 46
 	$time = $GLOBALS['meta']['cache_mark'] ?? 0;
47 47
 	for ($i = 0; $i < 256; $i++) {
48
-		$dir = _DIR_CACHE . sprintf('%02s', dechex($i));
48
+		$dir = _DIR_CACHE.sprintf('%02s', dechex($i));
49 49
 		if (@is_dir($dir) and is_readable($dir) and $d = opendir($dir)) {
50 50
 			while (($f = readdir($d)) !== false) {
51 51
 				if (preg_match(',^[[0-9a-f]+\.cache$,S', $f) and $a = stat("$dir/$f")) {
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
 	// stocker la date_modif_$objet (ne sert a rien pour le moment)
104 104
 	if (isset($objet)) {
105
-		ecrire_meta('derniere_modif_' . $objet, time());
105
+		ecrire_meta('derniere_modif_'.$objet, time());
106 106
 	}
107 107
 
108 108
 	// si $derniere_modif_invalide est un array('article', 'rubrique')
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 
146 146
 	// sur certains sites on veut absolument garder certains caches référencés dans un CDN
147 147
 	// on peut donc inhiber la purge de ces répertoires pour eviter tout probleme
148
-	if (file_exists(rtrim($dir, '/') . '/inhib_purger_repertoire.txt')) {
148
+	if (file_exists(rtrim($dir, '/').'/inhib_purger_repertoire.txt')) {
149 149
 		return 0;
150 150
 	}
151 151
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 		)
209 209
 	) {
210 210
 		// supprimer le fichier (de facon propre)
211
-		supprimer_fichier(_DIR_CACHE . $cache);
211
+		supprimer_fichier(_DIR_CACHE.$cache);
212 212
 	} else {
213 213
 		spip_log("Nom de fichier cache incorrect : $cache");
214 214
 	}
Please login to merge, or discard this patch.
ecrire/inc/utils.php 1 patch
Spacing   +120 added lines, -121 removed lines patch added patch discarded remove patch
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
 	if (strlen($dossier) and substr($dossier, -1) != '/') {
54 54
 		$dossier .= '/';
55 55
 	}
56
-	$f = str_replace('/', '_', $dossier) . $nom;
56
+	$f = str_replace('/', '_', $dossier).$nom;
57 57
 
58 58
 	if (function_exists($f)) {
59 59
 		return $f;
60 60
 	}
61
-	if (function_exists($g = $f . '_dist')) {
61
+	if (function_exists($g = $f.'_dist')) {
62 62
 		return $g;
63 63
 	}
64 64
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	// passer en minuscules (cf les balises de formulaires)
80 80
 	// et inclure le fichier
81 81
 	if (
82
-		!$inc = include_spip($dossier . ($d = strtolower($nom)))
82
+		!$inc = include_spip($dossier.($d = strtolower($nom)))
83 83
 		// si le fichier truc/machin/nom.php n'existe pas,
84 84
 		// la fonction peut etre definie dans truc/machin.php qui regroupe plusieurs petites fonctions
85 85
 		and strlen(dirname($dossier)) and dirname($dossier) != '.'
@@ -98,14 +98,14 @@  discard block
 block discarded – undo
98 98
 	}
99 99
 
100 100
 	// Echec : message d'erreur
101
-	spip_log("fonction $nom ($f ou $g) indisponible" .
101
+	spip_log("fonction $nom ($f ou $g) indisponible".
102 102
 		($inc ? '' : " (fichier $d absent de $dossier)"));
103 103
 
104 104
 	include_spip('inc/minipres');
105 105
 	echo minipres(
106 106
 		_T('forum_titre_erreur'),
107
-		_T('fichier_introuvable', ['fichier' => '<b>' . spip_htmlentities($d) . '</b>']),
108
-		['all_inline' => true,'status' => 404]
107
+		_T('fichier_introuvable', ['fichier' => '<b>'.spip_htmlentities($d).'</b>']),
108
+		['all_inline' => true, 'status' => 404]
109 109
 	);
110 110
 	exit;
111 111
 }
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
  *     - string : chemin du fichier trouvé
152 152
  **/
153 153
 function include_spip($f, $include = true) {
154
-	return find_in_path($f . '.php', '', $include);
154
+	return find_in_path($f.'.php', '', $include);
155 155
 }
156 156
 
157 157
 /**
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
  *     - string : chemin du fichier trouvé
172 172
  **/
173 173
 function require_spip($f) {
174
-	return find_in_path($f . '.php', '', 'required');
174
+	return find_in_path($f.'.php', '', 'required');
175 175
 }
176 176
 
177 177
 
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		// donc il faut l'inclure "en globals"
189 189
 		if ($f = find_in_path('mes_fonctions.php')) {
190 190
 			global $dossier_squelettes;
191
-			include_once(_ROOT_CWD . $f);
191
+			include_once(_ROOT_CWD.$f);
192 192
 		}
193 193
 
194 194
 		if (@is_readable(_CACHE_PLUGINS_FCT)) {
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 	}
294 294
 
295 295
 	// appliquer notre fonction si elle existe
296
-	$fonc = 'execute_pipeline_' . strtolower($action);
296
+	$fonc = 'execute_pipeline_'.strtolower($action);
297 297
 	if (function_exists($fonc)) {
298 298
 		$val = $fonc($val);
299 299
 	} // plantage ?
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 function spip_log($message = null, $name = null) {
359 359
 	static $pre = [];
360 360
 	static $log;
361
-	preg_match('/^([a-z_]*)\.?(\d)?$/iS', (string)$name, $regs);
361
+	preg_match('/^([a-z_]*)\.?(\d)?$/iS', (string) $name, $regs);
362 362
 	if (!isset($regs[1]) or !$logname = $regs[1]) {
363 363
 		$logname = null;
364 364
 	}
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 		if (!is_string($message)) {
387 387
 			$message = print_r($message, true);
388 388
 		}
389
-		$log($pre[$niveau] . ' ' . $message, $logname);
389
+		$log($pre[$niveau].' '.$message, $logname);
390 390
 	}
391 391
 }
392 392
 
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 		$a = './';
588 588
 	}
589 589
 
590
-	$regexp = ',^(' . str_replace('[]', '\[\]', $c) . '[[]?[]]?)(=.*)?$,';
590
+	$regexp = ',^('.str_replace('[]', '\[\]', $c).'[[]?[]]?)(=.*)?$,';
591 591
 	$ajouts = array_flip(explode('|', $c));
592 592
 	$u = is_array($v) ? $v : rawurlencode((string) $v);
593 593
 	$testv = (is_array($v) ? count($v) : strlen((string) $v));
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
 			// Ajout. Pour une variable, remplacer au meme endroit,
615 615
 			// pour un tableau ce sera fait dans la prochaine boucle
616 616
 			elseif (substr($r[1], -2) != '[]') {
617
-				$url[$n] = $r[1] . '=' . $u;
617
+				$url[$n] = $r[1].'='.$u;
618 618
 				unset($ajouts[$r[1]]);
619 619
 			}
620 620
 			// Pour les tableaux on laisse tomber les valeurs de
@@ -635,11 +635,11 @@  discard block
 block discarded – undo
635 635
 	} elseif ($testv) {
636 636
 		foreach ($ajouts as $k => $n) {
637 637
 			if (!is_array($v)) {
638
-				$url[] = $k . '=' . $u;
638
+				$url[] = $k.'='.$u;
639 639
 			} else {
640
-				$id = (substr($k, -2) == '[]') ? $k : ($k . '[]');
640
+				$id = (substr($k, -2) == '[]') ? $k : ($k.'[]');
641 641
 				foreach ($v as $w) {
642
-					$url[] = $id . '=' . (is_array($w) ? 'Array' : rawurlencode($w));
642
+					$url[] = $id.'='.(is_array($w) ? 'Array' : rawurlencode($w));
643 643
 				}
644 644
 			}
645 645
 		}
@@ -650,10 +650,10 @@  discard block
 block discarded – undo
650 650
 
651 651
 	// recomposer l'adresse
652 652
 	if ($url) {
653
-		$a .= '?' . join($sep, $url);
653
+		$a .= '?'.join($sep, $url);
654 654
 	}
655 655
 
656
-	return $a . $ancre;
656
+	return $a.$ancre;
657 657
 }
658 658
 
659 659
 /**
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
 			translitteration($ancre)
686 686
 		);
687 687
 	}
688
-	return $url . (strlen($ancre) ? '#' . $ancre : '');
688
+	return $url.(strlen($ancre) ? '#'.$ancre : '');
689 689
 }
690 690
 
691 691
 /**
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
  * @return bool
802 802
  */
803 803
 function test_plugin_actif($plugin) {
804
-	return ($plugin and defined('_DIR_PLUGIN_' . strtoupper($plugin))) ? true : false;
804
+	return ($plugin and defined('_DIR_PLUGIN_'.strtoupper($plugin))) ? true : false;
805 805
 }
806 806
 
807 807
 /**
@@ -933,7 +933,7 @@  discard block
 block discarded – undo
933 933
 					$value = interdire_scripts($value, -1);
934 934
 				}
935 935
 				if (!empty($options['class'])) {
936
-					$value = "<span class='" . $options['class'] . "'>$value</span>";
936
+					$value = "<span class='".$options['class']."'>$value</span>";
937 937
 				}
938 938
 				$text = str_replace("@$name@", $value, $text);
939 939
 				unset($args[$name]);
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
 		// Si des variables n'ont pas ete inserees, le signaler
943 943
 		// (chaines de langues pas a jour)
944 944
 		if ($args) {
945
-			spip_log("$f:  variables inutilisees " . join(', ', array_keys($args)), _LOG_DEBUG);
945
+			spip_log("$f:  variables inutilisees ".join(', ', array_keys($args)), _LOG_DEBUG);
946 946
 		}
947 947
 	}
948 948
 
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
 function joli_repertoire($rep) {
967 967
 	$a = substr($rep, 0, 1);
968 968
 	if ($a <> '.' and $a <> '/') {
969
-		$rep = (_DIR_RESTREINT ? '' : _DIR_RESTREINT_ABS) . $rep;
969
+		$rep = (_DIR_RESTREINT ? '' : _DIR_RESTREINT_ABS).$rep;
970 970
 	}
971 971
 	$rep = preg_replace(',(^\.\.\/),', '', $rep);
972 972
 
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
 			$p -= ($x * 1000);
1021 1021
 		}
1022 1022
 
1023
-		return $s . sprintf($s ? '%07.3f ms' : '%.3f ms', $p);
1023
+		return $s.sprintf($s ? '%07.3f ms' : '%.3f ms', $p);
1024 1024
 	}
1025 1025
 }
1026 1026
 
@@ -1088,7 +1088,7 @@  discard block
 block discarded – undo
1088 1088
 	if ($taches and count($taches) and !spip_connect()) {
1089 1089
 		return false;
1090 1090
 	}
1091
-	spip_log('cron !', 'jq' . _LOG_DEBUG);
1091
+	spip_log('cron !', 'jq'._LOG_DEBUG);
1092 1092
 	if ($genie = charger_fonction('genie', 'inc', true)) {
1093 1093
 		return $genie($taches);
1094 1094
 	}
@@ -1192,7 +1192,7 @@  discard block
 block discarded – undo
1192 1192
 
1193 1193
 	if ($queue_next_job_time == -1) {
1194 1194
 		if (!defined('_JQ_NEXT_JOB_TIME_FILENAME')) {
1195
-			define('_JQ_NEXT_JOB_TIME_FILENAME', _DIR_TMP . 'job_queue_next.txt');
1195
+			define('_JQ_NEXT_JOB_TIME_FILENAME', _DIR_TMP.'job_queue_next.txt');
1196 1196
 		}
1197 1197
 		// utiliser un cache memoire si dispo
1198 1198
 		if (function_exists('cache_get') and defined('_MEMOIZE_MEMORY') and _MEMOIZE_MEMORY) {
@@ -1261,8 +1261,8 @@  discard block
 block discarded – undo
1261 1261
 		$src = '';
1262 1262
 	}
1263 1263
 	if ($script) {
1264
-		$script = ("/*<![CDATA[*/\n" .
1265
-			preg_replace(',</([^>]*)>,', '<\/\1>', $script) .
1264
+		$script = ("/*<![CDATA[*/\n".
1265
+			preg_replace(',</([^>]*)>,', '<\/\1>', $script).
1266 1266
 			'/*]]>*/');
1267 1267
 	}
1268 1268
 	if ($noscript) {
@@ -1348,13 +1348,13 @@  discard block
 block discarded – undo
1348 1348
 	if ($path_base == null) {
1349 1349
 		// Chemin standard depuis l'espace public
1350 1350
 		$path = defined('_SPIP_PATH') ? _SPIP_PATH :
1351
-			_DIR_RACINE . ':' .
1352
-			_DIR_RACINE . 'squelettes-dist/:' .
1353
-			_DIR_RACINE . 'prive/:' .
1351
+			_DIR_RACINE.':'.
1352
+			_DIR_RACINE.'squelettes-dist/:'.
1353
+			_DIR_RACINE.'prive/:'.
1354 1354
 			_DIR_RESTREINT;
1355 1355
 		// Ajouter squelettes/
1356
-		if (@is_dir(_DIR_RACINE . 'squelettes')) {
1357
-			$path = _DIR_RACINE . 'squelettes/:' . $path;
1356
+		if (@is_dir(_DIR_RACINE.'squelettes')) {
1357
+			$path = _DIR_RACINE.'squelettes/:'.$path;
1358 1358
 		}
1359 1359
 		foreach (explode(':', $path) as $dir) {
1360 1360
 			if (strlen($dir) and substr($dir, -1) != '/') {
@@ -1366,7 +1366,7 @@  discard block
 block discarded – undo
1366 1366
 		// Et le(s) dossier(s) des squelettes nommes
1367 1367
 		if (strlen($GLOBALS['dossier_squelettes'])) {
1368 1368
 			foreach (array_reverse(explode(':', $GLOBALS['dossier_squelettes'])) as $d) {
1369
-				array_unshift($path_full, ($d[0] == '/' ? '' : _DIR_RACINE) . $d . '/');
1369
+				array_unshift($path_full, ($d[0] == '/' ? '' : _DIR_RACINE).$d.'/');
1370 1370
 			}
1371 1371
 		}
1372 1372
 		$GLOBALS['path_sig'] = md5(serialize($path_full));
@@ -1377,7 +1377,7 @@  discard block
 block discarded – undo
1377 1377
 
1378 1378
 	if (is_array($dir_path) or strlen($dir_path)) {
1379 1379
 		$tete = '';
1380
-		if (reset($path_base) == _DIR_RACINE . 'squelettes/') {
1380
+		if (reset($path_base) == _DIR_RACINE.'squelettes/') {
1381 1381
 			$tete = array_shift($path_base);
1382 1382
 		}
1383 1383
 		$dirs = (is_array($dir_path) ? $dir_path : explode(':', $dir_path));
@@ -1398,7 +1398,7 @@  discard block
 block discarded – undo
1398 1398
 	// Et le(s) dossier(s) des squelettes nommes
1399 1399
 	if (strlen($GLOBALS['dossier_squelettes'])) {
1400 1400
 		foreach (array_reverse(explode(':', $GLOBALS['dossier_squelettes'])) as $d) {
1401
-			array_unshift($path_full, ((isset($d[0]) and $d[0] == '/') ? '' : _DIR_RACINE) . $d . '/');
1401
+			array_unshift($path_full, ((isset($d[0]) and $d[0] == '/') ? '' : _DIR_RACINE).$d.'/');
1402 1402
 		}
1403 1403
 	}
1404 1404
 
@@ -1469,14 +1469,14 @@  discard block
 block discarded – undo
1469 1469
 	// si il y a un .svg a la bonne taille (-16.svg) a cote, on l'utilise en remplacement du -16.png
1470 1470
 	if (
1471 1471
 		preg_match(',-(\d+)[.](png|gif|svg)$,', $file, $m)
1472
-		and $file_svg_generique = substr($file, 0, -strlen($m[0])) . '-xx.svg'
1472
+		and $file_svg_generique = substr($file, 0, -strlen($m[0])).'-xx.svg'
1473 1473
 		and $f = find_in_theme("$file_svg_generique")
1474 1474
 	) {
1475
-		if ($fsize = substr($f, 0, -6) . $m[1] . '.svg' and file_exists($fsize)) {
1475
+		if ($fsize = substr($f, 0, -6).$m[1].'.svg' and file_exists($fsize)) {
1476 1476
 			return $themefiles["$subdir$file"] = $fsize;
1477 1477
 		}
1478 1478
 		else {
1479
-			return $themefiles["$subdir$file"] = "$f?" . $m[1] . 'px';
1479
+			return $themefiles["$subdir$file"] = "$f?".$m[1].'px';
1480 1480
 		}
1481 1481
 	}
1482 1482
 
@@ -1486,7 +1486,7 @@  discard block
 block discarded – undo
1486 1486
 			return $themefiles["$subdir$file"] = $f;
1487 1487
 		}
1488 1488
 	}
1489
-	spip_log("$file introuvable dans le theme prive " . reset($themes), 'theme');
1489
+	spip_log("$file introuvable dans le theme prive ".reset($themes), 'theme');
1490 1490
 
1491 1491
 	return $themefiles["$subdir$file"] = '';
1492 1492
 }
@@ -1594,8 +1594,8 @@  discard block
 block discarded – undo
1594 1594
 			return false;
1595 1595
 		}
1596 1596
 		if ($include and !isset($inc[$dirname][$file])) {
1597
-			include_once _ROOT_CWD . $GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file];
1598
-			$inc[$dirname][$file] = $inc[''][$dirname . $file] = true;
1597
+			include_once _ROOT_CWD.$GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file];
1598
+			$inc[$dirname][$file] = $inc[''][$dirname.$file] = true;
1599 1599
 		}
1600 1600
 
1601 1601
 		return $GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file];
@@ -1608,14 +1608,14 @@  discard block
 block discarded – undo
1608 1608
 	}
1609 1609
 
1610 1610
 	foreach (creer_chemin() as $dir) {
1611
-		if (!isset($dirs[$a = $dir . $dirname])) {
1612
-			$dirs[$a] = (is_dir(_ROOT_CWD . $a) || !$a);
1611
+		if (!isset($dirs[$a = $dir.$dirname])) {
1612
+			$dirs[$a] = (is_dir(_ROOT_CWD.$a) || !$a);
1613 1613
 		}
1614 1614
 		if ($dirs[$a]) {
1615
-			if (file_exists(_ROOT_CWD . ($a .= $file))) {
1615
+			if (file_exists(_ROOT_CWD.($a .= $file))) {
1616 1616
 				if ($include and !isset($inc[$dirname][$file])) {
1617
-					include_once _ROOT_CWD . $a;
1618
-					$inc[$dirname][$file] = $inc[''][$dirname . $file] = true;
1617
+					include_once _ROOT_CWD.$a;
1618
+					$inc[$dirname][$file] = $inc[''][$dirname.$file] = true;
1619 1619
 				}
1620 1620
 				if (!defined('_SAUVER_CHEMIN')) {
1621 1621
 					// si le chemin n'a pas encore ete charge, ne pas lever le flag, ne pas cacher
@@ -1625,7 +1625,7 @@  discard block
 block discarded – undo
1625 1625
 					define('_SAUVER_CHEMIN', true);
1626 1626
 				}
1627 1627
 
1628
-				return $GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file] = $GLOBALS['path_files'][$GLOBALS['path_sig']][''][$dirname . $file] = $a;
1628
+				return $GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file] = $GLOBALS['path_files'][$GLOBALS['path_sig']][''][$dirname.$file] = $a;
1629 1629
 			}
1630 1630
 		}
1631 1631
 	}
@@ -1651,7 +1651,7 @@  discard block
 block discarded – undo
1651 1651
 		define('_SAUVER_CHEMIN', true);
1652 1652
 	}
1653 1653
 
1654
-	return $GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file] = $GLOBALS['path_files'][$GLOBALS['path_sig']][''][$dirname . $file] = false;
1654
+	return $GLOBALS['path_files'][$GLOBALS['path_sig']][$dirname][$file] = $GLOBALS['path_files'][$GLOBALS['path_sig']][''][$dirname.$file] = false;
1655 1655
 }
1656 1656
 
1657 1657
 function clear_path_cache() {
@@ -1721,12 +1721,12 @@  discard block
 block discarded – undo
1721 1721
 	// cas borderline si dans mes_options on appelle redirige_par_entete qui utilise _T et charge un fichier de langue
1722 1722
 	// on a pas encore inclus flock.php
1723 1723
 	if (!function_exists('preg_files')) {
1724
-		include_once _ROOT_RESTREINT . 'inc/flock.php';
1724
+		include_once _ROOT_RESTREINT.'inc/flock.php';
1725 1725
 	}
1726 1726
 
1727 1727
 	// Parcourir le chemin
1728 1728
 	foreach (creer_chemin() as $d) {
1729
-		$f = $d . $dir;
1729
+		$f = $d.$dir;
1730 1730
 		if (@is_dir($f)) {
1731 1731
 			$liste = preg_files($f, $pattern, $maxfiles - count($liste_fichiers), $recurs === true ? [] : $recurs);
1732 1732
 			foreach ($liste as $chemin) {
@@ -1834,7 +1834,7 @@  discard block
 block discarded – undo
1834 1834
 		return $res;
1835 1835
 	}
1836 1836
 	// Sinon c'est un raccourci ou compat SPIP < 2
1837
-	if (!function_exists($f = 'generer_url_' . $entite)) {
1837
+	if (!function_exists($f = 'generer_url_'.$entite)) {
1838 1838
 		if (!function_exists($f .= '_dist')) {
1839 1839
 			$f = '';
1840 1840
 		}
@@ -1843,8 +1843,8 @@  discard block
 block discarded – undo
1843 1843
 		$url = $f($id, $args, $ancre);
1844 1844
 		if (strlen($args)) {
1845 1845
 			$url .= strstr($url, '?')
1846
-				? '&amp;' . $args
1847
-				: '?' . $args;
1846
+				? '&amp;'.$args
1847
+				: '?'.$args;
1848 1848
 		}
1849 1849
 
1850 1850
 		return $url;
@@ -1875,8 +1875,8 @@  discard block
 block discarded – undo
1875 1875
 	include_spip('base/connect_sql');
1876 1876
 	$id_type = id_table_objet($entite, $public);
1877 1877
 
1878
-	return _DIR_RACINE . get_spip_script('./')
1879
-	. '?' . _SPIP_PAGE . "=$entite&$id_type=$i&connect=$public"
1878
+	return _DIR_RACINE.get_spip_script('./')
1879
+	. '?'._SPIP_PAGE."=$entite&$id_type=$i&connect=$public"
1880 1880
 	. (!$args ? '' : "&$args")
1881 1881
 	. (!$ancre ? '' : "#$ancre");
1882 1882
 }
@@ -2030,7 +2030,7 @@  discard block
 block discarded – undo
2030 2030
 				!empty($_SERVER['QUERY_STRING'])
2031 2031
 				and !strpos($_SERVER['REQUEST_URI'], '?')
2032 2032
 			) {
2033
-				$GLOBALS['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
2033
+				$GLOBALS['REQUEST_URI'] .= '?'.$_SERVER['QUERY_STRING'];
2034 2034
 			}
2035 2035
 		}
2036 2036
 	}
@@ -2065,9 +2065,9 @@  discard block
 block discarded – undo
2065 2065
 		array_shift($myself);
2066 2066
 		$myself = implode('/', $myself);
2067 2067
 	}
2068
-	$url = join('/', array_slice(explode('/', $myself), 0, -1 - $prof)) . '/';
2068
+	$url = join('/', array_slice(explode('/', $myself), 0, -1 - $prof)).'/';
2069 2069
 
2070
-	$url = $http . '://' . rtrim($host, '/') . '/' . ltrim($url, '/');
2070
+	$url = $http.'://'.rtrim($host, '/').'/'.ltrim($url, '/');
2071 2071
 
2072 2072
 	return $url;
2073 2073
 }
@@ -2105,16 +2105,16 @@  discard block
 block discarded – undo
2105 2105
  **/
2106 2106
 function generer_url_ecrire($script = '', $args = '', $no_entities = false, $rel = false) {
2107 2107
 	if (!$rel) {
2108
-		$rel = url_de_base() . _DIR_RESTREINT_ABS . _SPIP_ECRIRE_SCRIPT;
2108
+		$rel = url_de_base()._DIR_RESTREINT_ABS._SPIP_ECRIRE_SCRIPT;
2109 2109
 	} else {
2110 2110
 		if (!is_string($rel)) {
2111
-			$rel = _DIR_RESTREINT ?: './' . _SPIP_ECRIRE_SCRIPT;
2111
+			$rel = _DIR_RESTREINT ?: './'._SPIP_ECRIRE_SCRIPT;
2112 2112
 		}
2113 2113
 	}
2114 2114
 
2115 2115
 	[$script, $ancre] = array_pad(explode('#', $script), 2, null);
2116 2116
 	if ($script and ($script <> 'accueil' or $rel)) {
2117
-		$args = "?exec=$script" . (!$args ? '' : "&$args");
2117
+		$args = "?exec=$script".(!$args ? '' : "&$args");
2118 2118
 	} elseif ($args) {
2119 2119
 		$args = "?$args";
2120 2120
 	}
@@ -2122,7 +2122,7 @@  discard block
 block discarded – undo
2122 2122
 		$args .= "#$ancre";
2123 2123
 	}
2124 2124
 
2125
-	return $rel . ($no_entities ? $args : str_replace('&', '&amp;', $args));
2125
+	return $rel.($no_entities ? $args : str_replace('&', '&amp;', $args));
2126 2126
 }
2127 2127
 
2128 2128
 //
@@ -2195,25 +2195,25 @@  discard block
 block discarded – undo
2195 2195
 		if (is_array($args)) {
2196 2196
 			$r = '';
2197 2197
 			foreach ($args as $k => $v) {
2198
-				$r .= '&' . $k . '=' . $v;
2198
+				$r .= '&'.$k.'='.$v;
2199 2199
 			}
2200 2200
 			$args = substr($r, 1);
2201 2201
 		}
2202 2202
 		$action .=
2203
-			(strpos($action, '?') !== false ? '&' : '?') . $args;
2203
+			(strpos($action, '?') !== false ? '&' : '?').$args;
2204 2204
 	}
2205 2205
 	if (!$no_entities) {
2206 2206
 		$action = quote_amp($action);
2207 2207
 	}
2208 2208
 
2209 2209
 	// ne pas generer une url avec /./?page= en cas d'url absolue et de _SPIP_SCRIPT vide
2210
-	return ($rel ? _DIR_RACINE . $action : rtrim(url_de_base(), '/') . preg_replace(',^/[.]/,', '/', "/$action"));
2210
+	return ($rel ? _DIR_RACINE . $action : rtrim(url_de_base(), '/').preg_replace(',^/[.]/,', '/', "/$action"));
2211 2211
 }
2212 2212
 
2213 2213
 // https://code.spip.net/@generer_url_prive
2214 2214
 function generer_url_prive($script, $args = '', $no_entities = false) {
2215 2215
 
2216
-	return generer_url_public($script, $args, $no_entities, false, _DIR_RESTREINT_ABS . 'prive.php');
2216
+	return generer_url_public($script, $args, $no_entities, false, _DIR_RESTREINT_ABS.'prive.php');
2217 2217
 }
2218 2218
 
2219 2219
 // Pour les formulaires en methode POST,
@@ -2248,8 +2248,7 @@  discard block
 block discarded – undo
2248 2248
 	. "><div>\n"
2249 2249
 	. "<input type='hidden' name='exec' value='$script1' />"
2250 2250
 	. $corps
2251
-	. (!$submit ? '' :
2252
-		("<div style='text-align: " . $GLOBALS['spip_lang_right'] . "'><input class='fondo submit btn' type='submit' value=\"" . entites_html($submit) . '" /></div>'))
2251
+	. (!$submit ? '' : ("<div style='text-align: ".$GLOBALS['spip_lang_right']."'><input class='fondo submit btn' type='submit' value=\"".entites_html($submit).'" /></div>'))
2253 2252
 	. "</div></form>\n";
2254 2253
 }
2255 2254
 
@@ -2274,14 +2273,14 @@  discard block
 block discarded – undo
2274 2273
 		? generer_url_ecrire(_request('exec'))
2275 2274
 		: generer_url_public();
2276 2275
 
2277
-	return "\n<form action='" .
2278
-	$h .
2279
-	"'" .
2280
-	$atts .
2281
-	">\n" .
2282
-	'<div>' .
2283
-	"\n<input type='hidden' name='action' value='$script' />" .
2284
-	$corps .
2276
+	return "\n<form action='".
2277
+	$h.
2278
+	"'".
2279
+	$atts.
2280
+	">\n".
2281
+	'<div>'.
2282
+	"\n<input type='hidden' name='action' value='$script' />".
2283
+	$corps.
2285 2284
 	'</div></form>';
2286 2285
 }
2287 2286
 
@@ -2309,7 +2308,7 @@  discard block
 block discarded – undo
2309 2308
 		: generer_url_public('', '', false, false);
2310 2309
 	$url = parametre_url($url, 'action', $script);
2311 2310
 	if ($args) {
2312
-		$url .= quote_amp('&' . $args);
2311
+		$url .= quote_amp('&'.$args);
2313 2312
 	}
2314 2313
 
2315 2314
 	if ($no_entities) {
@@ -2359,17 +2358,17 @@  discard block
 block discarded – undo
2359 2358
 
2360 2359
 	// le nom du repertoire plugins/ activables/desactivables
2361 2360
 	if (!defined('_DIR_PLUGINS')) {
2362
-		define('_DIR_PLUGINS', _DIR_RACINE . 'plugins/');
2361
+		define('_DIR_PLUGINS', _DIR_RACINE.'plugins/');
2363 2362
 	}
2364 2363
 
2365 2364
 	// le nom du repertoire des extensions/ permanentes du core, toujours actives
2366 2365
 	if (!defined('_DIR_PLUGINS_DIST')) {
2367
-		define('_DIR_PLUGINS_DIST', _DIR_RACINE . 'plugins-dist/');
2366
+		define('_DIR_PLUGINS_DIST', _DIR_RACINE.'plugins-dist/');
2368 2367
 	}
2369 2368
 
2370 2369
 	// le nom du repertoire des librairies
2371 2370
 	if (!defined('_DIR_LIB')) {
2372
-		define('_DIR_LIB', _DIR_RACINE . 'lib/');
2371
+		define('_DIR_LIB', _DIR_RACINE.'lib/');
2373 2372
 	}
2374 2373
 
2375 2374
 	if (!defined('_DIR_IMG')) {
@@ -2379,29 +2378,29 @@  discard block
 block discarded – undo
2379 2378
 		define('_DIR_LOGOS', $pa);
2380 2379
 	}
2381 2380
 	if (!defined('_DIR_IMG_ICONES')) {
2382
-		define('_DIR_IMG_ICONES', _DIR_LOGOS . 'icones/');
2381
+		define('_DIR_IMG_ICONES', _DIR_LOGOS.'icones/');
2383 2382
 	}
2384 2383
 
2385 2384
 	if (!defined('_DIR_DUMP')) {
2386
-		define('_DIR_DUMP', $ti . 'dump/');
2385
+		define('_DIR_DUMP', $ti.'dump/');
2387 2386
 	}
2388 2387
 	if (!defined('_DIR_SESSIONS')) {
2389
-		define('_DIR_SESSIONS', $ti . 'sessions/');
2388
+		define('_DIR_SESSIONS', $ti.'sessions/');
2390 2389
 	}
2391 2390
 	if (!defined('_DIR_TRANSFERT')) {
2392
-		define('_DIR_TRANSFERT', $ti . 'upload/');
2391
+		define('_DIR_TRANSFERT', $ti.'upload/');
2393 2392
 	}
2394 2393
 	if (!defined('_DIR_CACHE')) {
2395
-		define('_DIR_CACHE', $ti . 'cache/');
2394
+		define('_DIR_CACHE', $ti.'cache/');
2396 2395
 	}
2397 2396
 	if (!defined('_DIR_CACHE_XML')) {
2398
-		define('_DIR_CACHE_XML', _DIR_CACHE . 'xml/');
2397
+		define('_DIR_CACHE_XML', _DIR_CACHE.'xml/');
2399 2398
 	}
2400 2399
 	if (!defined('_DIR_SKELS')) {
2401
-		define('_DIR_SKELS', _DIR_CACHE . 'skel/');
2400
+		define('_DIR_SKELS', _DIR_CACHE.'skel/');
2402 2401
 	}
2403 2402
 	if (!defined('_DIR_AIDE')) {
2404
-		define('_DIR_AIDE', _DIR_CACHE . 'aide/');
2403
+		define('_DIR_AIDE', _DIR_CACHE.'aide/');
2405 2404
 	}
2406 2405
 	if (!defined('_DIR_TMP')) {
2407 2406
 		define('_DIR_TMP', $ti);
@@ -2430,27 +2429,27 @@  discard block
 block discarded – undo
2430 2429
 	// Declaration des fichiers
2431 2430
 
2432 2431
 	if (!defined('_CACHE_PLUGINS_PATH')) {
2433
-		define('_CACHE_PLUGINS_PATH', _DIR_CACHE . 'charger_plugins_chemins.php');
2432
+		define('_CACHE_PLUGINS_PATH', _DIR_CACHE.'charger_plugins_chemins.php');
2434 2433
 	}
2435 2434
 	if (!defined('_CACHE_PLUGINS_OPT')) {
2436
-		define('_CACHE_PLUGINS_OPT', _DIR_CACHE . 'charger_plugins_options.php');
2435
+		define('_CACHE_PLUGINS_OPT', _DIR_CACHE.'charger_plugins_options.php');
2437 2436
 	}
2438 2437
 	if (!defined('_CACHE_PLUGINS_FCT')) {
2439
-		define('_CACHE_PLUGINS_FCT', _DIR_CACHE . 'charger_plugins_fonctions.php');
2438
+		define('_CACHE_PLUGINS_FCT', _DIR_CACHE.'charger_plugins_fonctions.php');
2440 2439
 	}
2441 2440
 	if (!defined('_CACHE_PIPELINES')) {
2442
-		define('_CACHE_PIPELINES', _DIR_CACHE . 'charger_pipelines.php');
2441
+		define('_CACHE_PIPELINES', _DIR_CACHE.'charger_pipelines.php');
2443 2442
 	}
2444 2443
 	if (!defined('_CACHE_CHEMIN')) {
2445
-		define('_CACHE_CHEMIN', _DIR_CACHE . 'chemin.txt');
2444
+		define('_CACHE_CHEMIN', _DIR_CACHE.'chemin.txt');
2446 2445
 	}
2447 2446
 
2448 2447
 	# attention .php obligatoire pour ecrire_fichier_securise
2449 2448
 	if (!defined('_FILE_META')) {
2450
-		define('_FILE_META', $ti . 'meta_cache.php');
2449
+		define('_FILE_META', $ti.'meta_cache.php');
2451 2450
 	}
2452 2451
 	if (!defined('_DIR_LOG')) {
2453
-		define('_DIR_LOG', _DIR_TMP . 'log/');
2452
+		define('_DIR_LOG', _DIR_TMP.'log/');
2454 2453
 	}
2455 2454
 	if (!defined('_FILE_LOG')) {
2456 2455
 		define('_FILE_LOG', 'spip');
@@ -2467,8 +2466,8 @@  discard block
 block discarded – undo
2467 2466
 	if (!defined('_FILE_CONNECT')) {
2468 2467
 		define(
2469 2468
 			'_FILE_CONNECT',
2470
-			(@is_readable($f = _DIR_CONNECT . _FILE_CONNECT_INS . '.php') ? $f
2471
-			: (@is_readable($f = _DIR_RESTREINT . 'inc_connect.php') ? $f
2469
+			(@is_readable($f = _DIR_CONNECT._FILE_CONNECT_INS.'.php') ? $f
2470
+			: (@is_readable($f = _DIR_RESTREINT.'inc_connect.php') ? $f
2472 2471
 			: false))
2473 2472
 		);
2474 2473
 	}
@@ -2480,7 +2479,7 @@  discard block
 block discarded – undo
2480 2479
 	if (!defined('_FILE_CHMOD')) {
2481 2480
 		define(
2482 2481
 			'_FILE_CHMOD',
2483
-			(@is_readable($f = _DIR_CHMOD . _FILE_CHMOD_INS . '.php') ? $f
2482
+			(@is_readable($f = _DIR_CHMOD._FILE_CHMOD_INS.'.php') ? $f
2484 2483
 			: false)
2485 2484
 		);
2486 2485
 	}
@@ -2493,10 +2492,10 @@  discard block
 block discarded – undo
2493 2492
 		define('_FILE_TMP_SUFFIX', '.tmp.php');
2494 2493
 	}
2495 2494
 	if (!defined('_FILE_CONNECT_TMP')) {
2496
-		define('_FILE_CONNECT_TMP', _DIR_CONNECT . _FILE_CONNECT_INS . _FILE_TMP_SUFFIX);
2495
+		define('_FILE_CONNECT_TMP', _DIR_CONNECT._FILE_CONNECT_INS._FILE_TMP_SUFFIX);
2497 2496
 	}
2498 2497
 	if (!defined('_FILE_CHMOD_TMP')) {
2499
-		define('_FILE_CHMOD_TMP', _DIR_CHMOD . _FILE_CHMOD_INS . _FILE_TMP_SUFFIX);
2498
+		define('_FILE_CHMOD_TMP', _DIR_CHMOD._FILE_CHMOD_INS._FILE_TMP_SUFFIX);
2500 2499
 	}
2501 2500
 
2502 2501
 	// Definition des droits d'acces en ecriture
@@ -2514,13 +2513,13 @@  discard block
 block discarded – undo
2514 2513
 		define('_DEFAULT_CHARSET', 'utf-8');
2515 2514
 	}
2516 2515
 	if (!defined('_ROOT_PLUGINS')) {
2517
-		define('_ROOT_PLUGINS', _ROOT_RACINE . 'plugins/');
2516
+		define('_ROOT_PLUGINS', _ROOT_RACINE.'plugins/');
2518 2517
 	}
2519 2518
 	if (!defined('_ROOT_PLUGINS_DIST')) {
2520
-		define('_ROOT_PLUGINS_DIST', _ROOT_RACINE . 'plugins-dist/');
2519
+		define('_ROOT_PLUGINS_DIST', _ROOT_RACINE.'plugins-dist/');
2521 2520
 	}
2522 2521
 	if (!defined('_ROOT_PLUGINS_SUPPL') && defined('_DIR_PLUGINS_SUPPL') && _DIR_PLUGINS_SUPPL) {
2523
-		define('_ROOT_PLUGINS_SUPPL', _ROOT_RACINE . str_replace(_DIR_RACINE, '', _DIR_PLUGINS_SUPPL));
2522
+		define('_ROOT_PLUGINS_SUPPL', _ROOT_RACINE.str_replace(_DIR_RACINE, '', _DIR_PLUGINS_SUPPL));
2524 2523
 	}
2525 2524
 
2526 2525
 	// La taille des Log
@@ -2557,7 +2556,7 @@  discard block
 block discarded – undo
2557 2556
 	// (non surchargeable en l'etat ; attention si on utilise include_spip()
2558 2557
 	// pour le rendre surchargeable, on va provoquer un reecriture
2559 2558
 	// systematique du noyau ou une baisse de perfs => a etudier)
2560
-	include_once _ROOT_RESTREINT . 'inc/flock.php';
2559
+	include_once _ROOT_RESTREINT.'inc/flock.php';
2561 2560
 
2562 2561
 	// charger tout de suite le path et son cache
2563 2562
 	load_path_cache();
@@ -2605,7 +2604,7 @@  discard block
 block discarded – undo
2605 2604
 			!empty($_SERVER['QUERY_STRING'])
2606 2605
 			and !strpos($_SERVER['REQUEST_URI'], '?')
2607 2606
 		) {
2608
-			$GLOBALS['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
2607
+			$GLOBALS['REQUEST_URI'] .= '?'.$_SERVER['QUERY_STRING'];
2609 2608
 		}
2610 2609
 	}
2611 2610
 
@@ -2641,7 +2640,7 @@  discard block
 block discarded – undo
2641 2640
 		) {
2642 2641
 			if (isset($GLOBALS['meta']['adresse_site'])) {
2643 2642
 				$uri_ref = parse_url($GLOBALS['meta']['adresse_site']);
2644
-				$uri_ref = ($uri_ref['path'] ?? '') . '/';
2643
+				$uri_ref = ($uri_ref['path'] ?? '').'/';
2645 2644
 			} else {
2646 2645
 				$uri_ref = '';
2647 2646
 			}
@@ -2735,7 +2734,7 @@  discard block
 block discarded – undo
2735 2734
 	}
2736 2735
 	if (!defined('_CACHE_RUBRIQUES')) {
2737 2736
 		/** Fichier cache pour le navigateur de rubrique du bandeau */
2738
-		define('_CACHE_RUBRIQUES', _DIR_TMP . 'menu-rubriques-cache.txt');
2737
+		define('_CACHE_RUBRIQUES', _DIR_TMP.'menu-rubriques-cache.txt');
2739 2738
 	}
2740 2739
 	if (!defined('_CACHE_RUBRIQUES_MAX')) {
2741 2740
 		/** Nombre maxi de rubriques enfants affichées pour chaque rubrique du navigateur de rubrique du bandeau */
@@ -2839,7 +2838,7 @@  discard block
 block discarded – undo
2839 2838
 					$memory *= 1024;
2840 2839
 			}
2841 2840
 			if ($memory < _MEMORY_LIMIT_MIN * 1024 * 1024) {
2842
-				@ini_set('memory_limit', $m = _MEMORY_LIMIT_MIN . 'M');
2841
+				@ini_set('memory_limit', $m = _MEMORY_LIMIT_MIN.'M');
2843 2842
 				if (trim(ini_get('memory_limit')) != $m) {
2844 2843
 					if (!defined('_INTERDIRE_COMPACTE_HEAD_ECRIRE')) {
2845 2844
 						define('_INTERDIRE_COMPACTE_HEAD_ECRIRE', true);
@@ -2990,7 +2989,7 @@  discard block
 block discarded – undo
2990 2989
 					}
2991 2990
 					if (isset($GLOBALS['visiteur_session']['nom'])) {
2992 2991
 						spip_log($GLOBALS['visiteur_session']['nom']
2993
-							. ' ' . _VAR_MODE);
2992
+							. ' '._VAR_MODE);
2994 2993
 					}
2995 2994
 				} // pas autorise ?
2996 2995
 				else {
@@ -3005,7 +3004,7 @@  discard block
 block discarded – undo
3005 3004
 						if (strpos($self, 'page=login') === false) {
3006 3005
 							include_spip('inc/headers');
3007 3006
 							$redirect = parametre_url(self('&', true), 'var_mode', $_GET['var_mode'], '&');
3008
-							redirige_par_entete(generer_url_public('login', 'url=' . rawurlencode($redirect), true));
3007
+							redirige_par_entete(generer_url_public('login', 'url='.rawurlencode($redirect), true));
3009 3008
 						}
3010 3009
 					}
3011 3010
 					// sinon tant pis
@@ -3049,10 +3048,10 @@  discard block
 block discarded – undo
3049 3048
 	// mais on risque de perturber des plugins en initialisant trop tot
3050 3049
 	// certaines constantes
3051 3050
 	@spip_initialisation_core(
3052
-		(_DIR_RACINE . _NOM_PERMANENTS_INACCESSIBLES),
3053
-		(_DIR_RACINE . _NOM_PERMANENTS_ACCESSIBLES),
3054
-		(_DIR_RACINE . _NOM_TEMPORAIRES_INACCESSIBLES),
3055
-		(_DIR_RACINE . _NOM_TEMPORAIRES_ACCESSIBLES)
3051
+		(_DIR_RACINE._NOM_PERMANENTS_INACCESSIBLES),
3052
+		(_DIR_RACINE._NOM_PERMANENTS_ACCESSIBLES),
3053
+		(_DIR_RACINE._NOM_TEMPORAIRES_INACCESSIBLES),
3054
+		(_DIR_RACINE._NOM_TEMPORAIRES_ACCESSIBLES)
3056 3055
 	);
3057 3056
 
3058 3057
 	// Demarrer une session NON AUTHENTIFIEE si on donne son nom
@@ -3085,7 +3084,7 @@  discard block
 block discarded – undo
3085 3084
 	}
3086 3085
 
3087 3086
 	$h = (isset($_SERVER['PHP_AUTH_USER']) and !$GLOBALS['ignore_auth_http']);
3088
-	if ($h or isset($_COOKIE['spip_session']) or isset($_COOKIE[$GLOBALS['cookie_prefix'] . '_session'])) {
3087
+	if ($h or isset($_COOKIE['spip_session']) or isset($_COOKIE[$GLOBALS['cookie_prefix'].'_session'])) {
3089 3088
 		$session = charger_fonction('session', 'inc');
3090 3089
 		if ($session()) {
3091 3090
 			return $GLOBALS['visiteur_session']['statut'];
@@ -3165,7 +3164,7 @@  discard block
 block discarded – undo
3165 3164
 			'definir_session',
3166 3165
 			$GLOBALS['visiteur_session']
3167 3166
 				? serialize($GLOBALS['visiteur_session'])
3168
-				. '_' . @$_COOKIE['spip_session']
3167
+				. '_'.@$_COOKIE['spip_session']
3169 3168
 				: ''
3170 3169
 		);
3171 3170
 		$session = $s ? substr(md5($s), 0, 8) : '';
@@ -3321,11 +3320,11 @@  discard block
 block discarded – undo
3321 3320
 	$GLOBALS['_INC_PUBLIC']++;
3322 3321
 
3323 3322
 	// fix #4235
3324
-	$cache_utilise_session_appelant	= ($GLOBALS['cache_utilise_session'] ?? null);
3323
+	$cache_utilise_session_appelant = ($GLOBALS['cache_utilise_session'] ?? null);
3325 3324
 
3326 3325
 
3327 3326
 	foreach (is_array($fond) ? $fond : [$fond] as $f) {
3328
-		unset($GLOBALS['cache_utilise_session']);	// fix #4235
3327
+		unset($GLOBALS['cache_utilise_session']); // fix #4235
3329 3328
 
3330 3329
 		$page = evaluer_fond($f, $contexte, $connect);
3331 3330
 		if ($page === '') {
@@ -3410,7 +3409,7 @@  discard block
 block discarded – undo
3410 3409
  * @return array|string
3411 3410
  */
3412 3411
 function trouver_fond($nom, $dir = '', $pathinfo = false) {
3413
-	$f = find_in_path($nom . '.' . _EXTENSION_SQUELETTES, $dir ? rtrim($dir, '/') . '/' : '');
3412
+	$f = find_in_path($nom.'.'._EXTENSION_SQUELETTES, $dir ? rtrim($dir, '/').'/' : '');
3414 3413
 	if (!$pathinfo) {
3415 3414
 		return $f;
3416 3415
 	}
Please login to merge, or discard this patch.
ecrire/inc/charsets.php 1 patch
Spacing   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 		}
74 74
 	}
75 75
 
76
-	if (find_in_path($charset . '.php', 'charsets/', true)) {
76
+	if (find_in_path($charset.'.php', 'charsets/', true)) {
77 77
 		return $charset;
78 78
 	} else {
79 79
 		spip_log("Erreur: pas de fichier de conversion 'charsets/$charset'");
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	static $pcre_ok = 0;
161 161
 
162 162
 	if (!$pcre_ok) {
163
-		$s = ' ' . chr(195) . chr(169) . 't' . chr(195) . chr(169) . ' ';
163
+		$s = ' '.chr(195).chr(169).'t'.chr(195).chr(169).' ';
164 164
 		if (preg_match(',\W...\W,u', $s)) {
165 165
 			$pcre_ok = 1;
166 166
 		} else {
@@ -261,38 +261,38 @@  discard block
 block discarded – undo
261 261
 
262 262
 	if (!isset($trans[$charset][$charset_cible])) {
263 263
 		$trans[$charset][$charset_cible] = [
264
-			$p . chr(128) => '&#8364;',
265
-			$p . chr(129) => ' ', # pas affecte
266
-			$p . chr(130) => '&#8218;',
267
-			$p . chr(131) => '&#402;',
268
-			$p . chr(132) => '&#8222;',
269
-			$p . chr(133) => '&#8230;',
270
-			$p . chr(134) => '&#8224;',
271
-			$p . chr(135) => '&#8225;',
272
-			$p . chr(136) => '&#710;',
273
-			$p . chr(137) => '&#8240;',
274
-			$p . chr(138) => '&#352;',
275
-			$p . chr(139) => '&#8249;',
276
-			$p . chr(140) => '&#338;',
277
-			$p . chr(141) => ' ', # pas affecte
278
-			$p . chr(142) => '&#381;',
279
-			$p . chr(143) => ' ', # pas affecte
280
-			$p . chr(144) => ' ', # pas affecte
281
-			$p . chr(145) => '&#8216;',
282
-			$p . chr(146) => '&#8217;',
283
-			$p . chr(147) => '&#8220;',
284
-			$p . chr(148) => '&#8221;',
285
-			$p . chr(149) => '&#8226;',
286
-			$p . chr(150) => '&#8211;',
287
-			$p . chr(151) => '&#8212;',
288
-			$p . chr(152) => '&#732;',
289
-			$p . chr(153) => '&#8482;',
290
-			$p . chr(154) => '&#353;',
291
-			$p . chr(155) => '&#8250;',
292
-			$p . chr(156) => '&#339;',
293
-			$p . chr(157) => ' ', # pas affecte
294
-			$p . chr(158) => '&#382;',
295
-			$p . chr(159) => '&#376;',
264
+			$p.chr(128) => '&#8364;',
265
+			$p.chr(129) => ' ', # pas affecte
266
+			$p.chr(130) => '&#8218;',
267
+			$p.chr(131) => '&#402;',
268
+			$p.chr(132) => '&#8222;',
269
+			$p.chr(133) => '&#8230;',
270
+			$p.chr(134) => '&#8224;',
271
+			$p.chr(135) => '&#8225;',
272
+			$p.chr(136) => '&#710;',
273
+			$p.chr(137) => '&#8240;',
274
+			$p.chr(138) => '&#352;',
275
+			$p.chr(139) => '&#8249;',
276
+			$p.chr(140) => '&#338;',
277
+			$p.chr(141) => ' ', # pas affecte
278
+			$p.chr(142) => '&#381;',
279
+			$p.chr(143) => ' ', # pas affecte
280
+			$p.chr(144) => ' ', # pas affecte
281
+			$p.chr(145) => '&#8216;',
282
+			$p.chr(146) => '&#8217;',
283
+			$p.chr(147) => '&#8220;',
284
+			$p.chr(148) => '&#8221;',
285
+			$p.chr(149) => '&#8226;',
286
+			$p.chr(150) => '&#8211;',
287
+			$p.chr(151) => '&#8212;',
288
+			$p.chr(152) => '&#732;',
289
+			$p.chr(153) => '&#8482;',
290
+			$p.chr(154) => '&#353;',
291
+			$p.chr(155) => '&#8250;',
292
+			$p.chr(156) => '&#339;',
293
+			$p.chr(157) => ' ', # pas affecte
294
+			$p.chr(158) => '&#382;',
295
+			$p.chr(159) => '&#376;',
296 296
 		];
297 297
 		if ($charset_cible != 'unicode') {
298 298
 			foreach ($trans[$charset][$charset_cible] as $k => $c) {
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 					and is_array($GLOBALS['CHARSET'][$cset])
434 434
 				) {
435 435
 					foreach ($GLOBALS['CHARSET'][$cset] as $key => $val) {
436
-						$trans[$charset][chr($key)] = '&#' . $val . ';';
436
+						$trans[$charset][chr($key)] = '&#'.$val.';';
437 437
 					}
438 438
 				}
439 439
 			}
@@ -500,11 +500,11 @@  discard block
 block discarded – undo
500 500
 					$h = dechex($e);
501 501
 					if ($s = isset($CHARSET_REVERSE[$charset][$e])) {
502 502
 						$s = $CHARSET_REVERSE[$charset][$e];
503
-						$t['&#' . $e . ';'] = $t['&#0' . $e . ';'] = $t['&#00' . $e . ';'] = chr($s);
504
-						$t['&#x' . $h . ';'] = $t['&#x0' . $h . ';'] = $t['&#x00' . $h . ';'] = chr($s);
503
+						$t['&#'.$e.';'] = $t['&#0'.$e.';'] = $t['&#00'.$e.';'] = chr($s);
504
+						$t['&#x'.$h.';'] = $t['&#x0'.$h.';'] = $t['&#x00'.$h.';'] = chr($s);
505 505
 					} else {
506
-						$t['&#' . $e . ';'] = $t['&#0' . $e . ';'] = $t['&#00' . $e . ';'] = chr($e);
507
-						$t['&#x' . $h . ';'] = $t['&#x0' . $h . ';'] = $t['&#x00' . $h . ';'] = chr($e);
506
+						$t['&#'.$e.';'] = $t['&#0'.$e.';'] = $t['&#00'.$e.';'] = chr($e);
507
+						$t['&#x'.$h.';'] = $t['&#x0'.$h.';'] = $t['&#x00'.$h.';'] = chr($e);
508 508
 					}
509 509
 				}
510 510
 			}
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 				and is_array($GLOBALS['CHARSET'][$cset])
552 552
 			) {
553 553
 				foreach ($GLOBALS['CHARSET'][$cset] as $key => $val) {
554
-					$trans[$charset][chr($key)] = unicode2charset('&#' . $val . ';');
554
+					$trans[$charset][chr($key)] = unicode2charset('&#'.$val.';');
555 555
 				}
556 556
 			}
557 557
 		}
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 				}
659 659
 				$thisPos++;
660 660
 			}
661
-			$encodedLetter = '&#' . preg_replace('/^0+/', '', $decimalCode) . ';';
661
+			$encodedLetter = '&#'.preg_replace('/^0+/', '', $decimalCode).';';
662 662
 			$encodedString .= $encodedLetter;
663 663
 		}
664 664
 	}
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 			} // ignorer le BOM - http://www.unicode.org/faq/utf_bom.html
702 702
 			else {
703 703
 				if ($word != 65279) {
704
-					$texte .= '&#' . $word . ';';
704
+					$texte .= '&#'.$word.';';
705 705
 				}
706 706
 			}
707 707
 		}
@@ -729,13 +729,13 @@  discard block
 block discarded – undo
729 729
 		return chr($num);
730 730
 	}
731 731
 	if ($num < 2048) {
732
-		return chr(($num >> 6) + 192) . chr(($num & 63) + 128);
732
+		return chr(($num >> 6) + 192).chr(($num & 63) + 128);
733 733
 	}
734 734
 	if ($num < 65536) {
735
-		return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
735
+		return chr(($num >> 12) + 224).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128);
736 736
 	}
737 737
 	if ($num < 1_114_112) {
738
-		return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128);
738
+		return chr(($num >> 18) + 240).chr((($num >> 12) & 63) + 128).chr((($num >> 6) & 63) + 128).chr(($num & 63) + 128);
739 739
 	}
740 740
 
741 741
 	return '';
@@ -802,7 +802,7 @@  discard block
 block discarded – undo
802 802
 	while (preg_match(',&#0*([0-9]+);,S', $texte, $regs) and !isset($vu[$regs[1]])) {
803 803
 		$num = $regs[1];
804 804
 		$vu[$num] = true;
805
-		$s = '\u' . sprintf('%04x', $num);
805
+		$s = '\u'.sprintf('%04x', $num);
806 806
 		$texte = str_replace($regs[0], $s, $texte);
807 807
 	}
808 808
 
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
  **/
820 820
 function javascript_to_unicode($texte) {
821 821
 	while (preg_match(',%u([0-9A-F][0-9A-F][0-9A-F][0-9A-F]),', $texte, $regs)) {
822
-		$texte = str_replace($regs[0], '&#' . hexdec($regs[1]) . ';', $texte);
822
+		$texte = str_replace($regs[0], '&#'.hexdec($regs[1]).';', $texte);
823 823
 	}
824 824
 
825 825
 	return $texte;
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
 		return $texte;
865 865
 	}
866 866
 
867
-	$table_translit = 'translit' . $complexe;
867
+	$table_translit = 'translit'.$complexe;
868 868
 
869 869
 	// 2. Translitterer grace a la table predefinie
870 870
 	if (!isset($trans[$complexe])) {
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
  *    true s'il a un BOM
956 956
  **/
957 957
 function bom_utf8($texte) {
958
-	return (substr($texte, 0, 3) == chr(0xEF) . chr(0xBB) . chr(0xBF));
958
+	return (substr($texte, 0, 3) == chr(0xEF).chr(0xBB).chr(0xBF));
959 959
 }
960 960
 
961 961
 /**
@@ -1151,7 +1151,7 @@  discard block
 block discarded – undo
1151 1151
 		// on prend n fois la longueur desiree, pour etre surs d'avoir tout
1152 1152
 		// (un caractere utf-8 prenant au maximum n bytes)
1153 1153
 		$n = 0;
1154
-		while (preg_match(',[\x80-\xBF]{' . (++$n) . '},', $c)) {
1154
+		while (preg_match(',[\x80-\xBF]{'.(++$n).'},', $c)) {
1155 1155
 			;
1156 1156
 		}
1157 1157
 		$c = substr($c, 0, $n * $length);
@@ -1185,7 +1185,7 @@  discard block
 block discarded – undo
1185 1185
 
1186 1186
 	$lettre1 = mb_strtoupper(spip_substr($c, 0, 1));
1187 1187
 
1188
-	return $lettre1 . spip_substr($c, 1);
1188
+	return $lettre1.spip_substr($c, 1);
1189 1189
 }
1190 1190
 
1191 1191
 /**
Please login to merge, or discard this patch.
ecrire/inc/plonger.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	$res = sql_select(
36 36
 		'rub1.id_rubrique, rub1.titre, rub1.id_parent, rub1.lang, rub1.langue_choisie, rub2.id_rubrique AS id_enfant',
37 37
 		'spip_rubriques AS rub1 LEFT JOIN spip_rubriques AS rub2 ON (rub1.id_rubrique = rub2.id_parent)',
38
-		'rub1.id_parent = ' . sql_quote($id_rubrique) . '
39
-			AND rub1.id_rubrique!=' . sql_quote($exclu) . '
40
-			AND (rub2.id_rubrique IS NULL OR rub2.id_rubrique!=' . sql_quote($exclu) . ')',
38
+		'rub1.id_parent = '.sql_quote($id_rubrique).'
39
+			AND rub1.id_rubrique!=' . sql_quote($exclu).'
40
+			AND (rub2.id_rubrique IS NULL OR rub2.id_rubrique!=' . sql_quote($exclu).')',
41 41
 		'',
42 42
 		'0+rub1.titre,rub1.titre'
43 43
 	);
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 				if ($row['langue_choisie'] != 'oui') {
51 51
 					$t .= ' <small title="'
52 52
 						. traduire_nom_langue($row['lang'])
53
-						. '">[' . $row['lang'] . ']</small>';
53
+						. '">['.$row['lang'].']</small>';
54 54
 				}
55 55
 				$ordre[$row['id_rubrique']] = $t;
56 56
 			}
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
 	}
59 59
 	$next = $list[$col] ?? 0;
60 60
 	if ($ordre) {
61
-		$rec = generer_url_ecrire('plonger', "rac=$idom&exclus=$exclu&do=$do&col=" . ($col + 1));
61
+		$rec = generer_url_ecrire('plonger', "rac=$idom&exclus=$exclu&do=$do&col=".($col + 1));
62 62
 		$info = generer_url_ecrire('informer', "type=rubrique&rac=$idom&do=$do&id=");
63
-		$args = "'$idom',this,$col,'" . $GLOBALS['spip_lang_left'] . "','$info',event";
63
+		$args = "'$idom',this,$col,'".$GLOBALS['spip_lang_left']."','$info',event";
64 64
 
65 65
 		foreach ($ordre as $id => $titrebrut) {
66 66
 			$titre = supprimer_numero($titrebrut);
67 67
 
68
-			$classe1 = 'petit-item ' . ($id_rubrique ? 'petite-rubrique' : 'petit-secteur');
68
+			$classe1 = 'petit-item '.($id_rubrique ? 'petite-rubrique' : 'petit-secteur');
69 69
 			if (isset($rub[$id]['enfants'])) {
70 70
 				$classe2 = " class='rub-ouverte'";
71 71
 				$url = "\nhref='$rec&amp;id=$id'";
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 				$url = "\nhref='javascript:void(0)'";
75 75
 			}
76 76
 
77
-			$js_func = $do . '_selection_titre';
77
+			$js_func = $do.'_selection_titre';
78 78
 			$click = "\nonclick=\"changerhighlight(this.parentNode.parentNode.parentNode);\nreturn "
79 79
 				. (!is_array($list) ? ' false'
80 80
 					: "aff_selection_provisoire($id,$args)")
@@ -101,17 +101,17 @@  discard block
 block discarded – undo
101 101
 		}
102 102
 	}
103 103
 
104
-	$idom2 = $idom . '_col_' . ($col + 1);
104
+	$idom2 = $idom.'_col_'.($col + 1);
105 105
 	$left = ($col * 250);
106 106
 
107 107
 	return http_img_pack(
108 108
 		'loader.svg',
109 109
 		'',
110
-		"class='loader' style='visibility: hidden; position: absolute; " . $GLOBALS['spip_lang_left'] . ': '
110
+		"class='loader' style='visibility: hidden; position: absolute; ".$GLOBALS['spip_lang_left'].': '
111 111
 		. ($left - 30)
112 112
 		. "px; top: 2px; z-index: 2;' id='img_$idom2'"
113 113
 	)
114
-	. "<div style='width: 250px; height: 100%; overflow: auto; position: absolute; top: 0px; " . $GLOBALS['spip_lang_left'] . ': '
114
+	. "<div style='width: 250px; height: 100%; overflow: auto; position: absolute; top: 0px; ".$GLOBALS['spip_lang_left'].': '
115 115
 	. ($left - 250)
116 116
 	. "px;'>"
117 117
 	. $ret
Please login to merge, or discard this patch.
ecrire/inc/texte.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -105,12 +105,12 @@  discard block
 block discarded – undo
105 105
 	foreach (['script', 'iframe'] as $tag) {
106 106
 		if (
107 107
 			stripos($t, (string) "<$tag") !== false
108
-			and preg_match_all(',<' . $tag . '.*?($|</' . $tag . '.),isS', $t, $r, PREG_SET_ORDER)
108
+			and preg_match_all(',<'.$tag.'.*?($|</'.$tag.'.),isS', $t, $r, PREG_SET_ORDER)
109 109
 		) {
110 110
 			foreach ($r as $regs) {
111 111
 				$t = str_replace(
112 112
 					$regs[0],
113
-					"<code$class>" . nl2br(spip_htmlspecialchars($regs[0])) . '</code>',
113
+					"<code$class>".nl2br(spip_htmlspecialchars($regs[0])).'</code>',
114 114
 					$t
115 115
 				);
116 116
 			}
@@ -163,10 +163,10 @@  discard block
 block discarded – undo
163 163
 	}
164 164
 
165 165
 	// echapper les tags asp/php
166
-	$t = str_replace('<' . '%', '&lt;%', $arg);
166
+	$t = str_replace('<'.'%', '&lt;%', $arg);
167 167
 
168 168
 	// echapper le php
169
-	$t = str_replace('<' . '?', '&lt;?', $t);
169
+	$t = str_replace('<'.'?', '&lt;?', $t);
170 170
 
171 171
 	// echapper le < script language=php >
172 172
 	$t = preg_replace(',<(script\b[^>]+\blanguage\b[^\w>]+php\b),UimsS', '&lt;\1', $t);
@@ -188,10 +188,10 @@  discard block
 block discarded – undo
188 188
 
189 189
 	// Reinserer les echappements des modeles
190 190
 	if (defined('_PROTEGE_JS_MODELES')) {
191
-		$t = echappe_retour($t, 'javascript' . _PROTEGE_JS_MODELES);
191
+		$t = echappe_retour($t, 'javascript'._PROTEGE_JS_MODELES);
192 192
 	}
193 193
 	if (defined('_PROTEGE_PHP_MODELES')) {
194
-		$t = echappe_retour($t, 'php' . _PROTEGE_PHP_MODELES);
194
+		$t = echappe_retour($t, 'php'._PROTEGE_PHP_MODELES);
195 195
 	}
196 196
 
197 197
 	return $dejavu[$mode_filtre][$arg] = $t;
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 define('_TYPO_PROTEGER', "!':;?~%-");
290 290
 define('_TYPO_PROTECTEUR', "\x1\x2\x3\x4\x5\x6\x7\x8");
291 291
 
292
-define('_TYPO_BALISE', ',</?[a-z!][^<>]*[' . preg_quote(_TYPO_PROTEGER) . '][^<>]*>,imsS');
292
+define('_TYPO_BALISE', ',</?[a-z!][^<>]*['.preg_quote(_TYPO_PROTEGER).'][^<>]*>,imsS');
293 293
 
294 294
 /**
295 295
  * Corrige la typographie
Please login to merge, or discard this patch.
ecrire/inc/queue.php 1 patch
Spacing   +38 added lines, -40 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	$md5args = md5($arguments);
71 71
 
72 72
 	// si pas de date programee, des que possible
73
-	$duplicate_where = 'status=' . intval(_JQ_SCHEDULED) . ' AND ';
73
+	$duplicate_where = 'status='.intval(_JQ_SCHEDULED).' AND ';
74 74
 	if (!$time) {
75 75
 		$time = time();
76 76
 		$duplicate_where = ''; // ne pas dupliquer si deja le meme job en cours d'execution
@@ -96,9 +96,8 @@  discard block
 block discarded – undo
96 96
 			'id_job',
97 97
 			'spip_jobs',
98 98
 			$duplicate_where =
99
-				$duplicate_where . 'fonction=' . sql_quote($function)
100
-				. (($no_duplicate === 'function_only') ? '' :
101
-			' AND md5args=' . sql_quote($md5args) . ' AND inclure=' . sql_quote($file))
99
+				$duplicate_where.'fonction='.sql_quote($function)
100
+				. (($no_duplicate === 'function_only') ? '' : ' AND md5args='.sql_quote($md5args).' AND inclure='.sql_quote($file))
102 101
 		)
103 102
 	) {
104 103
 		return $id_job;
@@ -111,9 +110,9 @@  discard block
 block discarded – undo
111 110
 	if (
112 111
 		$no_duplicate
113 112
 		and
114
-		$id_prev = sql_getfetsel('id_job', 'spip_jobs', 'id_job<' . intval($id_job) . " AND $duplicate_where")
113
+		$id_prev = sql_getfetsel('id_job', 'spip_jobs', 'id_job<'.intval($id_job)." AND $duplicate_where")
115 114
 	) {
116
-		sql_delete('spip_jobs', 'id_job=' . intval($id_job));
115
+		sql_delete('spip_jobs', 'id_job='.intval($id_job));
117 116
 
118 117
 		return $id_prev;
119 118
 	}
@@ -125,9 +124,9 @@  discard block
 block discarded – undo
125 124
 	// ie cas d'un char non acceptables sur certains type de champs
126 125
 	// qui coupe la valeur
127 126
 	if (defined('_JQ_INSERT_CHECK_ARGS') and $id_job) {
128
-		$args = sql_getfetsel('args', 'spip_jobs', 'id_job=' . intval($id_job));
127
+		$args = sql_getfetsel('args', 'spip_jobs', 'id_job='.intval($id_job));
129 128
 		if ($args !== $arguments) {
130
-			spip_log('arguments job errones / longueur ' . strlen($args) . ' vs ' . strlen($arguments) . ' / valeur : ' . var_export(
129
+			spip_log('arguments job errones / longueur '.strlen($args).' vs '.strlen($arguments).' / valeur : '.var_export(
131 130
 				$arguments,
132 131
 				true
133 132
 			), 'queue');
@@ -157,7 +156,7 @@  discard block
 block discarded – undo
157 156
 function queue_purger() {
158 157
 	include_spip('base/abstract_sql');
159 158
 	sql_delete('spip_jobs');
160
-	sql_delete('spip_jobs_liens', 'id_job NOT IN (' . sql_get_select('id_job', 'spip_jobs') . ')');
159
+	sql_delete('spip_jobs_liens', 'id_job NOT IN ('.sql_get_select('id_job', 'spip_jobs').')');
161 160
 	include_spip('inc/genie');
162 161
 	genie_queue_watch_dist();
163 162
 }
@@ -173,8 +172,8 @@  discard block
 block discarded – undo
173 172
 	include_spip('base/abstract_sql');
174 173
 
175 174
 	if (
176
-		$row = sql_fetsel('fonction,inclure,date', 'spip_jobs', 'id_job=' . intval($id_job))
177
-		and $res = sql_delete('spip_jobs', 'id_job=' . intval($id_job))
175
+		$row = sql_fetsel('fonction,inclure,date', 'spip_jobs', 'id_job='.intval($id_job))
176
+		and $res = sql_delete('spip_jobs', 'id_job='.intval($id_job))
178 177
 	) {
179 178
 		queue_unlink_job($id_job);
180 179
 		// est-ce une tache cron qu'il faut relancer ?
@@ -224,7 +223,7 @@  discard block
 block discarded – undo
224 223
  *  resultat du sql_delete
225 224
  */
226 225
 function queue_unlink_job($id_job) {
227
-	return sql_delete('spip_jobs_liens', 'id_job=' . intval($id_job));
226
+	return sql_delete('spip_jobs_liens', 'id_job='.intval($id_job));
228 227
 }
229 228
 
230 229
 /**
@@ -240,7 +239,7 @@  discard block
 block discarded – undo
240 239
 	// deserialiser les arguments
241 240
 	$args = unserialize($row['args']);
242 241
 	if ($args === false) {
243
-		spip_log('arguments job errones ' . var_export($row, true), 'queue');
242
+		spip_log('arguments job errones '.var_export($row, true), 'queue');
244 243
 		$args = [];
245 244
 	}
246 245
 
@@ -257,15 +256,14 @@  discard block
 block discarded – undo
257 256
 	}
258 257
 
259 258
 	if (!function_exists($fonction)) {
260
-		spip_log("fonction $fonction ($inclure) inexistante " . var_export($row, true), 'queue');
259
+		spip_log("fonction $fonction ($inclure) inexistante ".var_export($row, true), 'queue');
261 260
 
262 261
 		return false;
263 262
 	}
264 263
 
265
-	spip_log('queue [' . $row['id_job'] . "]: $fonction() start", 'queue');
264
+	spip_log('queue ['.$row['id_job']."]: $fonction() start", 'queue');
266 265
 	switch (is_countable($args) ? count($args) : 0) {
267
-		case 0:
268
-			$res = $fonction();
266
+		case 0 : $res = $fonction();
269 267
 			break;
270 268
 		case 1:
271 269
 			$res = $fonction($args[0]);
@@ -312,7 +310,7 @@  discard block
 block discarded – undo
312 310
 			# plus lent mais completement generique
313 311
 			$res = call_user_func_array($fonction, $args);
314 312
 	}
315
-	spip_log('queue [' . $row['id_job'] . "]: $fonction() end", 'queue');
313
+	spip_log('queue ['.$row['id_job']."]: $fonction() end", 'queue');
316 314
 
317 315
 	return $res;
318 316
 }
@@ -343,14 +341,14 @@  discard block
 block discarded – undo
343 341
 function queue_schedule($force_jobs = null) {
344 342
 	$time = time();
345 343
 	if (defined('_DEBUG_BLOCK_QUEUE')) {
346
-		spip_log('_DEBUG_BLOCK_QUEUE : schedule stop', 'jq' . _LOG_DEBUG);
344
+		spip_log('_DEBUG_BLOCK_QUEUE : schedule stop', 'jq'._LOG_DEBUG);
347 345
 
348 346
 		return;
349 347
 	}
350 348
 
351 349
 	// rien a faire si le prochain job est encore dans le futur
352 350
 	if (queue_sleep_time_to_next_job() > 0 and (!$force_jobs or !count($force_jobs))) {
353
-		spip_log('queue_sleep_time_to_next_job', 'jq' . _LOG_DEBUG);
351
+		spip_log('queue_sleep_time_to_next_job', 'jq'._LOG_DEBUG);
354 352
 
355 353
 		return;
356 354
 	}
@@ -371,7 +369,7 @@  discard block
 block discarded – undo
371 369
 	}
372 370
 	$end_time = $time + _JQ_MAX_JOBS_TIME_TO_EXECUTE;
373 371
 
374
-	spip_log("JQ schedule $time / $end_time", 'jq' . _LOG_DEBUG);
372
+	spip_log("JQ schedule $time / $end_time", 'jq'._LOG_DEBUG);
375 373
 
376 374
 	if (!defined('_JQ_MAX_JOBS_EXECUTE')) {
377 375
 		define('_JQ_MAX_JOBS_EXECUTE', 200);
@@ -385,19 +383,19 @@  discard block
 block discarded – undo
385 383
 	// lorsqu'un job cron n'a pas fini, sa priorite est descendue
386 384
 	// pour qu'il ne bloque pas les autres jobs en attente
387 385
 	if (is_array($force_jobs) and count($force_jobs)) {
388
-		$cond = 'status=' . intval(_JQ_SCHEDULED) . ' AND ' . sql_in('id_job', $force_jobs);
386
+		$cond = 'status='.intval(_JQ_SCHEDULED).' AND '.sql_in('id_job', $force_jobs);
389 387
 	} else {
390 388
 		$now = date('Y-m-d H:i:s', $time);
391
-		$cond = 'status=' . intval(_JQ_SCHEDULED) . ' AND date<=' . sql_quote($now);
389
+		$cond = 'status='.intval(_JQ_SCHEDULED).' AND date<='.sql_quote($now);
392 390
 	}
393 391
 
394 392
 	register_shutdown_function('queue_error_handler'); // recuperer les erreurs auant que possible
395
-	$res = sql_allfetsel('*', 'spip_jobs', $cond, '', 'priorite DESC,date', '0,' . (_JQ_MAX_JOBS_EXECUTE + 1));
393
+	$res = sql_allfetsel('*', 'spip_jobs', $cond, '', 'priorite DESC,date', '0,'.(_JQ_MAX_JOBS_EXECUTE + 1));
396 394
 	do {
397 395
 		if ($row = array_shift($res)) {
398 396
 			$nbj++;
399 397
 			// il faut un verrou, a base de sql_delete
400
-			if (sql_delete('spip_jobs', 'id_job=' . intval($row['id_job']) . ' AND status=' . intval(_JQ_SCHEDULED))) {
398
+			if (sql_delete('spip_jobs', 'id_job='.intval($row['id_job']).' AND status='.intval(_JQ_SCHEDULED))) {
401 399
 				#spip_log("JQ schedule job ".$nbj." OK",'jq');
402 400
 				// on reinsert dans la base aussitot avec un status=_JQ_PENDING
403 401
 				$row['status'] = _JQ_PENDING;
@@ -412,13 +410,13 @@  discard block
 block discarded – undo
412 410
 				queue_close_job($row, $time, $result);
413 411
 			}
414 412
 		}
415
-		spip_log('JQ schedule job end time ' . $time, 'jq' . _LOG_DEBUG);
413
+		spip_log('JQ schedule job end time '.$time, 'jq'._LOG_DEBUG);
416 414
 	} while ($nbj < _JQ_MAX_JOBS_EXECUTE and $row and $time < $end_time);
417
-	spip_log('JQ schedule end time ' . time(), 'jq' . _LOG_DEBUG);
415
+	spip_log('JQ schedule end time '.time(), 'jq'._LOG_DEBUG);
418 416
 
419 417
 	if ($row = array_shift($res)) {
420 418
 		queue_update_next_job_time(0); // on sait qu'il y a encore des jobs a lancer ASAP
421
-		spip_log('JQ encore !', 'jq' . _LOG_DEBUG);
419
+		spip_log('JQ encore !', 'jq'._LOG_DEBUG);
422 420
 	} else {
423 421
 		queue_update_next_job_time();
424 422
 	}
@@ -453,9 +451,9 @@  discard block
 block discarded – undo
453 451
 		}
454 452
 	}
455 453
 	// purger ses liens eventuels avec des objets
456
-	sql_delete('spip_jobs_liens', 'id_job=' . intval($row['id_job']));
454
+	sql_delete('spip_jobs_liens', 'id_job='.intval($row['id_job']));
457 455
 	// supprimer le job fini
458
-	sql_delete('spip_jobs', 'id_job=' . intval($row['id_job']));
456
+	sql_delete('spip_jobs', 'id_job='.intval($row['id_job']));
459 457
 }
460 458
 
461 459
 /**
@@ -528,18 +526,18 @@  discard block
 block discarded – undo
528 526
 	$res = sql_allfetsel(
529 527
 		'*',
530 528
 		'spip_jobs',
531
-		'status=' . intval(_JQ_PENDING) . ' AND date<' . sql_quote(date('Y-m-d H:i:s', $time - 180))
529
+		'status='.intval(_JQ_PENDING).' AND date<'.sql_quote(date('Y-m-d H:i:s', $time - 180))
532 530
 	);
533 531
 	if (is_array($res)) {
534 532
 		foreach ($res as $row) {
535 533
 			queue_close_job($row, $time);
536
-			spip_log('queue_close_job car _JQ_PENDING depuis +180s : ' . print_r($row, 1), 'job_mort' . _LOG_ERREUR);
534
+			spip_log('queue_close_job car _JQ_PENDING depuis +180s : '.print_r($row, 1), 'job_mort'._LOG_ERREUR);
537 535
 		}
538 536
 	}
539 537
 
540 538
 	// chercher la date du prochain job si pas connu
541 539
 	if (is_null($next) or is_null(queue_sleep_time_to_next_job())) {
542
-		$date = sql_getfetsel('date', 'spip_jobs', 'status=' . intval(_JQ_SCHEDULED), '', 'date', '0,1');
540
+		$date = sql_getfetsel('date', 'spip_jobs', 'status='.intval(_JQ_SCHEDULED), '', 'date', '0,1');
543 541
 		$next = strtotime($date);
544 542
 	}
545 543
 	if (!is_null($next_time)) {
@@ -552,7 +550,7 @@  discard block
 block discarded – undo
552 550
 		if (is_null($nb_jobs_scheduled)) {
553 551
 			$nb_jobs_scheduled = sql_countsel(
554 552
 				'spip_jobs',
555
-				'status=' . intval(_JQ_SCHEDULED) . ' AND date<' . sql_quote(date('Y-m-d H:i:s', $time))
553
+				'status='.intval(_JQ_SCHEDULED).' AND date<'.sql_quote(date('Y-m-d H:i:s', $time))
556 554
 			);
557 555
 		} elseif ($next <= $time) {
558 556
 			$nb_jobs_scheduled++;
@@ -621,7 +619,7 @@  discard block
 block discarded – undo
621 619
 	}
622 620
 
623 621
 	// ne pas relancer si on vient de lancer dans la meme seconde par un hit concurent
624
-	if (file_exists($lock = _DIR_TMP . 'cron.lock') and !(@filemtime($lock) < $_SERVER['REQUEST_TIME'])) {
622
+	if (file_exists($lock = _DIR_TMP.'cron.lock') and !(@filemtime($lock) < $_SERVER['REQUEST_TIME'])) {
625 623
 		return $texte;
626 624
 	}
627 625
 
@@ -693,7 +691,7 @@  discard block
 block discarded – undo
693 691
 				$port = 80;
694 692
 		}
695 693
 		$fp = @fsockopen(
696
-			$scheme . $parts['host'],
694
+			$scheme.$parts['host'],
697 695
 			$parts['port'] ?? $port,
698 696
 			$errno,
699 697
 			$errstr,
@@ -703,13 +701,13 @@  discard block
 block discarded – undo
703 701
 		if ($fp) {
704 702
 			$host_sent = $parts['host'];
705 703
 			if (isset($parts['port']) and $parts['port'] !== $port) {
706
-				$host_sent .= ':' . $parts['port'];
704
+				$host_sent .= ':'.$parts['port'];
707 705
 			}
708 706
 			$timeout = 200; // ms
709 707
 			stream_set_timeout($fp, 0, $timeout * 1000);
710
-			$query = $parts['path'] . ($parts['query'] ? '?' . $parts['query'] : '');
711
-			$out = 'GET ' . $query . " HTTP/1.1\r\n";
712
-			$out .= 'Host: ' . $host_sent . "\r\n";
708
+			$query = $parts['path'].($parts['query'] ? '?'.$parts['query'] : '');
709
+			$out = 'GET '.$query." HTTP/1.1\r\n";
710
+			$out .= 'Host: '.$host_sent."\r\n";
713 711
 			$out .= "Connection: Close\r\n\r\n";
714 712
 			fwrite($fp, $out);
715 713
 			spip_timer('read');
Please login to merge, or discard this patch.
ecrire/inc/filtres_alertes.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 	$_texte = ($_texte ?: "''");
52 52
 	$_titre = ($_titre ? ", $_titre" : ', null');
53 53
 	$_class = ($_class ? ", $_class" : ', null');
54
-	$_role  = ($_role  ? ", $_role"  : ', null');
55
-	$_id    = ($_id    ? ", $_id"    : ', null');
54
+	$_role  = ($_role ? ", $_role" : ', null');
55
+	$_id    = ($_id ? ", $_id" : ', null');
56 56
 
57 57
 	$f = chercher_filtre('message_alerte');
58 58
 	$p->code = "$f($_texte$_titre$_class$_role$_id)";
@@ -90,10 +90,10 @@  discard block
 block discarded – undo
90 90
 	$_class = interprete_argument_balise(2, $p);
91 91
 	$_role  = interprete_argument_balise(3, $p);
92 92
 	$_id    = interprete_argument_balise(4, $p);
93
-	$_titre = ($_titre ? "$_titre"   : 'null');
93
+	$_titre = ($_titre ? "$_titre" : 'null');
94 94
 	$_class = ($_class ? ", $_class" : ', null');
95
-	$_role  = ($_role  ? ", $_role"  : ', null');
96
-	$_id    = ($_id    ? ", $_id"    : ', null');
95
+	$_role  = ($_role ? ", $_role" : ', null');
96
+	$_id    = ($_id ? ", $_id" : ', null');
97 97
 
98 98
 	$f = chercher_filtre('message_alerte_ouvrir');
99 99
 	$p->code = "$f($_titre$_class$_role$_id)";
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
 	$message_alerte_ouvrir = chercher_filtre('message_alerte_ouvrir');
164 164
 	$message_alerte_fermer = chercher_filtre('message_alerte_fermer');
165 165
 	$message =
166
-		$message_alerte_ouvrir($titre, $class, $role, $id) .
167
-		$texte .
166
+		$message_alerte_ouvrir($titre, $class, $role, $id).
167
+		$texte.
168 168
 		$message_alerte_fermer();
169 169
 
170 170
 	return $message;
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	];
214 214
 	$type  = array_intersect(explode(' ', $class), $types);
215 215
 	$type  = reset($type);
216
-	$class = trim(str_replace($types, '', $class) . " $type");
216
+	$class = trim(str_replace($types, '', $class)." $type");
217 217
 
218 218
 	// Classes
219 219
 	$class_racine = 'msg-alert';
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 
239 239
 	// Attributs
240 240
 	$attr_role = ($role ? "role=\"$role\"" : '');
241
-	$attr_id   = ($id   ? "id=\"$id\"" : '');
241
+	$attr_id   = ($id ? "id=\"$id\"" : '');
242 242
 	$attr_data = ($type ? "data-alert=\"$type\"" : '');
243 243
 
244 244
 	$message =
Please login to merge, or discard this patch.
ecrire/inc/cvt_configurer.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	) {
39 39
 		// Pour tous les formulaires CONFIGURER, ayant une fonction charger ou pas, on teste si autorisé
40 40
 		include_spip('inc/autoriser');
41
-		if (!autoriser('configurer', '_' . substr($form, 11))) {
41
+		if (!autoriser('configurer', '_'.substr($form, 11))) {
42 42
 			return false;
43 43
 		}
44 44
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 		and !charger_fonction('traiter', "formulaires/$form/", true) // sans fonction traiter()
73 73
 	) {
74 74
 		$trace = cvtconf_formulaires_configurer_enregistre($form, $flux['args']['args']);
75
-		$flux['data'] = ['message_ok' => _T('config_info_enregistree') . $trace, 'editable' => true];
75
+		$flux['data'] = ['message_ok' => _T('config_info_enregistree').$trace, 'editable' => true];
76 76
 	}
77 77
 
78 78
 	return $flux;
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 		$prefixe = $valeurs['_meta_prefixe'];
147 147
 	}
148 148
 	if (isset($valeurs['_meta_stockage'])) {
149
-		$stockage = $valeurs['_meta_stockage'] . '::';
149
+		$stockage = $valeurs['_meta_stockage'].'::';
150 150
 	}
151 151
 
152 152
 	// si on indique juste une table, il faut vider les autres proprietes
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 
172 172
 	// sinon cas analyse du squelette
173 173
 	if (
174
-		$f = find_in_path($form . '.' . _EXTENSION_SQUELETTES, 'formulaires/')
174
+		$f = find_in_path($form.'.'._EXTENSION_SQUELETTES, 'formulaires/')
175 175
 		and lire_fichier($f, $contenu)
176 176
 	) {
177 177
 		for ($i = 0; $i < 2; $i++) {
@@ -228,14 +228,14 @@  discard block
 block discarded – undo
228 228
 		lire_metas($table);
229 229
 	}
230 230
 
231
-	$prefixe = ($prefixe ? $prefixe . '_' : '');
231
+	$prefixe = ($prefixe ? $prefixe.'_' : '');
232 232
 	$table = ($table) ? "/$table/" : '';
233
-	$casier = ($casier) ? rtrim($casier, '/') . '/' : ''; // slash final, sinon rien
233
+	$casier = ($casier) ? rtrim($casier, '/').'/' : ''; // slash final, sinon rien
234 234
 
235 235
 	foreach ($store as $k => $v) {
236 236
 		ecrire_config("$stockage$table$prefixe$casier$k", $v);
237 237
 		if (_request('var_mode') == 'configurer' and autoriser('webmestre')) {
238
-			$trace .= "<br />table $table : " . $prefixe . $k . " = $v;";
238
+			$trace .= "<br />table $table : ".$prefixe.$k." = $v;";
239 239
 		}
240 240
 	}
241 241
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	[$table, $casier, $prefixe, $stockage] = cvtconf_definir_configurer_conteneur($form, $valeurs);
253 253
 
254 254
 	$table = ($table) ? "/$table/" : '';
255
-	$prefixe = ($prefixe ? $prefixe . '_' : '');
255
+	$prefixe = ($prefixe ? $prefixe.'_' : '');
256 256
 	if ($casier) {
257 257
 		$meta = lire_config("$stockage$table$prefixe$casier");
258 258
 		$prefixe = '';
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 
264 264
 	foreach ($valeurs as $k => $v) {
265 265
 		if (substr($k, 0, 1) !== '_') {
266
-			$valeurs[$k] = ($meta[$prefixe . $k] ?? null);
266
+			$valeurs[$k] = ($meta[$prefixe.$k] ?? null);
267 267
 		}
268 268
 	}
269 269
 }
Please login to merge, or discard this patch.
ecrire/inc/distant.php 1 patch
Spacing   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	define('_INC_DISTANT_CONTENT_ENCODING', 'gzip');
27 27
 }
28 28
 if (!defined('_INC_DISTANT_USER_AGENT')) {
29
-	define('_INC_DISTANT_USER_AGENT', 'SPIP-' . $GLOBALS['spip_version_affichee'] . ' (' . $GLOBALS['home_server'] . ')');
29
+	define('_INC_DISTANT_USER_AGENT', 'SPIP-'.$GLOBALS['spip_version_affichee'].' ('.$GLOBALS['home_server'].')');
30 30
 }
31 31
 if (!defined('_INC_DISTANT_MAX_SIZE')) {
32 32
 	define('_INC_DISTANT_MAX_SIZE', 2_097_152);
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	define('_INC_DISTANT_CONNECT_TIMEOUT', 10);
36 36
 }
37 37
 
38
-define('_REGEXP_COPIE_LOCALE', ',' 	.
38
+define('_REGEXP_COPIE_LOCALE', ','.
39 39
 	preg_replace(
40 40
 		'@^https?:@',
41 41
 		'https?:',
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
 	// si c'est la protection de soi-meme, retourner le path
72 72
 	if ($mode !== 'force' and preg_match(_REGEXP_COPIE_LOCALE, $source, $match)) {
73
-		$source = substr(_DIR_IMG, strlen(_DIR_RACINE)) . urldecode($match[1]);
73
+		$source = substr(_DIR_IMG, strlen(_DIR_RACINE)).urldecode($match[1]);
74 74
 
75 75
 		return @file_exists($source) ? $source : false;
76 76
 	}
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 		return false;
91 91
 	}
92 92
 
93
-	$localrac = _DIR_RACINE . $local;
93
+	$localrac = _DIR_RACINE.$local;
94 94
 	$t = ($mode === 'force') ? false : @file_exists($localrac);
95 95
 
96 96
 	// test d'existence du fichier
@@ -115,10 +115,10 @@  discard block
 block discarded – undo
115 115
 			['file' => $localrac, 'taille_max' => $taille_max, 'if_modified_since' => $t ? filemtime($localrac) : '']
116 116
 		);
117 117
 		if (!$res or (!$res['length'] and $res['status'] != 304)) {
118
-			spip_log("copie_locale : Echec recuperation $source sur $localrac status : " . ($res ? $res['status'] : '-'), 'distant' . _LOG_INFO_IMPORTANTE);
118
+			spip_log("copie_locale : Echec recuperation $source sur $localrac status : ".($res ? $res['status'] : '-'), 'distant'._LOG_INFO_IMPORTANTE);
119 119
 		}
120 120
 		else {
121
-			spip_log("copie_locale : recuperation $source sur $localrac OK | taille " . $res['length'] . ' status ' . $res['status'], 'distant');
121
+			spip_log("copie_locale : recuperation $source sur $localrac OK | taille ".$res['length'].' status '.$res['status'], 'distant');
122 122
 		}
123 123
 		if (!$res or !$res['length']) {
124 124
 			// si $t c'est sans doute juste un not-modified-since
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 
208 208
 	if (!$is_known_host) {
209 209
 		$host = trim($parsed_url['host'], '.');
210
-		if (! $ip = filter_var($host, FILTER_VALIDATE_IP)) {
210
+		if (!$ip = filter_var($host, FILTER_VALIDATE_IP)) {
211 211
 			$ip = gethostbyname($host);
212 212
 			if ($ip === $host) {
213 213
 				// Error condition for gethostbyname()
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 			}
229 229
 		}
230 230
 		if ($ip) {
231
-			if (! filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
231
+			if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
232 232
 				return false;
233 233
 			}
234 234
 		}
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	}
240 240
 
241 241
 	$port = $parsed_url['port'];
242
-	if ($port === 80  or $port === 443  or $port === 8080) {
242
+	if ($port === 80 or $port === 443 or $port === 8080) {
243 243
 		return $url;
244 244
 	}
245 245
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 				}
310 310
 			}
311 311
 			if ($taille > 500) {
312
-				$boundary = substr(md5(random_int(0, mt_getrandmax()) . 'spip'), 0, 8);
312
+				$boundary = substr(md5(random_int(0, mt_getrandmax()).'spip'), 0, 8);
313 313
 			}
314 314
 		}
315 315
 
@@ -337,16 +337,16 @@  discard block
 block discarded – undo
337 337
 			}
338 338
 		} else {
339 339
 			// fabrique une chaine HTTP simple pour un POST
340
-			$entete = 'Content-Type: application/x-www-form-urlencoded' . "\r\n";
340
+			$entete = 'Content-Type: application/x-www-form-urlencoded'."\r\n";
341 341
 			$chaine = [];
342 342
 			if (is_array($donnees)) {
343 343
 				foreach ($donnees as $cle => $valeur) {
344 344
 					if (is_array($valeur)) {
345 345
 						foreach ($valeur as $val2) {
346
-							$chaine[] = rawurlencode($cle) . '[]=' . rawurlencode($val2);
346
+							$chaine[] = rawurlencode($cle).'[]='.rawurlencode($val2);
347 347
 						}
348 348
 					} else {
349
-						$chaine[] = rawurlencode($cle) . '=' . rawurlencode($valeur);
349
+						$chaine[] = rawurlencode($cle).'='.rawurlencode($valeur);
350 350
 					}
351 351
 				}
352 352
 				$chaine = implode('&', $chaine);
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 	$head_add = '';
457 457
 	if (!empty($options['headers'])) {
458 458
 		foreach ($options['headers'] as $champ => $valeur) {
459
-			$head_add .= $champ . ': ' . $valeur . "\r\n";
459
+			$head_add .= $champ.': '.$valeur."\r\n";
460 460
 		}
461 461
 		// ne pas le repasser a recuperer_url si on follow un location, car ils seront dans datas
462 462
 		unset($options['headers']);
@@ -466,9 +466,9 @@  discard block
 block discarded – undo
466 466
 		[$head, $postdata] = prepare_donnees_post($options['datas'], $options['boundary']);
467 467
 		$head .= $head_add;
468 468
 		if (stripos($head, 'Content-Length:') === false) {
469
-			$head .= 'Content-Length: ' . strlen($postdata) . "\r\n";
469
+			$head .= 'Content-Length: '.strlen($postdata)."\r\n";
470 470
 		}
471
-		$options['datas'] = $head . "\r\n" . $postdata;
471
+		$options['datas'] = $head."\r\n".$postdata;
472 472
 		if (
473 473
 			strlen($postdata)
474 474
 			and !$methode_demandee
@@ -476,15 +476,15 @@  discard block
 block discarded – undo
476 476
 			$options['methode'] = 'POST';
477 477
 		}
478 478
 	} elseif ($head_add) {
479
-		$options['datas'] = $head_add . "\r\n";
479
+		$options['datas'] = $head_add."\r\n";
480 480
 	}
481 481
 
482 482
 	// Accepter les URLs au format feed:// ou qui ont oublie le http:// ou les urls relatives au protocole
483 483
 	$url = preg_replace(',^feed://,i', 'http://', $url);
484 484
 	if (!tester_url_absolue($url)) {
485
-		$url = 'http://' . $url;
485
+		$url = 'http://'.$url;
486 486
 	} elseif (strncmp($url, '//', 2) == 0) {
487
-		$url = 'http:' . $url;
487
+		$url = 'http:'.$url;
488 488
 	}
489 489
 
490 490
 	$url = url_to_ascii($url);
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 		$options['if_modified_since']
514 514
 	);
515 515
 	if (!$handle) {
516
-		spip_log("ECHEC init_http $url", 'distant' . _LOG_ERREUR);
516
+		spip_log("ECHEC init_http $url", 'distant'._LOG_ERREUR);
517 517
 
518 518
 		return false;
519 519
 	}
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
 					'status' => 200,
544 544
 				];
545 545
 			} else {
546
-				spip_log("ECHEC chinoiserie $url", 'distant' . _LOG_ERREUR);
546
+				spip_log("ECHEC chinoiserie $url", 'distant'._LOG_ERREUR);
547 547
 				return false;
548 548
 			}
549 549
 		} elseif ($res['location'] and $options['follow_location']) {
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 
556 556
 			return recuperer_url($url, $options);
557 557
 		} elseif ($res['status'] !== 200) {
558
-			spip_log('HTTP status ' . $res['status'] . " pour $url", 'distant');
558
+			spip_log('HTTP status '.$res['status']." pour $url", 'distant');
559 559
 		}
560 560
 		$result['status'] = $res['status'];
561 561
 		if (isset($res['headers'])) {
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 
581 581
 	$gz = false;
582 582
 	if (preg_match(",\bContent-Encoding: .*gzip,is", $result['headers'])) {
583
-		$gz = (_DIR_TMP . md5(uniqid(random_int(0, mt_getrandmax()))) . '.tmp.gz');
583
+		$gz = (_DIR_TMP.md5(uniqid(random_int(0, mt_getrandmax()))).'.tmp.gz');
584 584
 	}
585 585
 
586 586
 	// si on a pas deja recuperer le contenu par une methode detournee
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 	$sig['url'] = $url;
667 667
 
668 668
 	$dir = sous_repertoire(_DIR_CACHE, 'curl');
669
-	$cache = md5(serialize($sig)) . '-' . substr(preg_replace(',\W+,', '_', $url), 0, 80);
669
+	$cache = md5(serialize($sig)).'-'.substr(preg_replace(',\W+,', '_', $url), 0, 80);
670 670
 	$sub = sous_repertoire($dir, substr($cache, 0, 2));
671 671
 	$cache = "$sub$cache";
672 672
 
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
 	$fp = false;
721 721
 	if ($fichier) {
722 722
 		include_spip('inc/acces');
723
-		$tmpfile = "$fichier." . creer_uniqid() . '.tmp';
723
+		$tmpfile = "$fichier.".creer_uniqid().'.tmp';
724 724
 		$fp = spip_fopen_lock($tmpfile, 'w', LOCK_EX);
725 725
 		if (!$fp and file_exists($fichier)) {
726 726
 			return filesize($fichier);
@@ -779,7 +779,7 @@  discard block
 block discarded – undo
779 779
 	}
780 780
 	$result['status'] = intval($r[1]);
781 781
 	while ($s = trim(fgets($handle, 16384))) {
782
-		$result['headers'][] = $s . "\n";
782
+		$result['headers'][] = $s."\n";
783 783
 		preg_match(',^([^:]*): *(.*)$,i', $s, $r);
784 784
 		[, $d, $v] = $r;
785 785
 		if (strtolower(trim($d)) == 'location' and $result['status'] >= 300 and $result['status'] < 400) {
@@ -828,13 +828,13 @@  discard block
 block discarded – undo
828 828
 
829 829
 	// on se place tout le temps comme si on etait a la racine
830 830
 	if (_DIR_RACINE) {
831
-		$d = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $d);
831
+		$d = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $d);
832 832
 	}
833 833
 
834 834
 	$m = md5($source);
835 835
 
836 836
 	return $d
837
-	. substr(preg_replace(',[^\w-],', '', basename($source)) . '-' . $m, 0, 12)
837
+	. substr(preg_replace(',[^\w-],', '', basename($source)).'-'.$m, 0, 12)
838 838
 	. substr($m, 0, 4)
839 839
 	. ".$extension";
840 840
 }
@@ -857,7 +857,7 @@  discard block
 block discarded – undo
857 857
 	// Si c'est deja local pas de souci
858 858
 	if (!tester_url_absolue($source)) {
859 859
 		if (_DIR_RACINE) {
860
-			$source = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $source);
860
+			$source = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $source);
861 861
 		}
862 862
 
863 863
 		return $source;
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
 		$ext
876 876
 		and preg_match(',^\w+$,', $ext) // pas de php?truc=1&...
877 877
 		and $f = nom_fichier_copie_locale($source, $ext)
878
-		and file_exists(_DIR_RACINE . $f)
878
+		and file_exists(_DIR_RACINE.$f)
879 879
 	) {
880 880
 		return $f;
881 881
 	}
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
 
884 884
 	// Si c'est deja dans la table des documents,
885 885
 	// ramener le nom de sa copie potentielle
886
-	$ext = sql_getfetsel('extension', 'spip_documents', 'fichier=' . sql_quote($source) . " AND distant='oui' AND extension <> ''");
886
+	$ext = sql_getfetsel('extension', 'spip_documents', 'fichier='.sql_quote($source)." AND distant='oui' AND extension <> ''");
887 887
 
888 888
 	if ($ext) {
889 889
 		return nom_fichier_copie_locale($source, $ext);
@@ -894,9 +894,9 @@  discard block
 block discarded – undo
894 894
 
895 895
 	$ext = $path_parts ? $path_parts['extension'] : '';
896 896
 
897
-	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) {
897
+	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) {
898 898
 		$f = nom_fichier_copie_locale($source, $ext);
899
-		if (file_exists(_DIR_RACINE . $f)) {
899
+		if (file_exists(_DIR_RACINE.$f)) {
900 900
 			return $f;
901 901
 		}
902 902
 	}
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
 	// Ping  pour voir si son extension est connue et autorisee
905 905
 	// avec mise en cache du resultat du ping
906 906
 
907
-	$cache = sous_repertoire(_DIR_CACHE, 'rid') . md5($source);
907
+	$cache = sous_repertoire(_DIR_CACHE, 'rid').md5($source);
908 908
 	if (
909 909
 		!@file_exists($cache)
910 910
 		or !$path_parts = @unserialize(spip_file_get_contents($cache))
@@ -914,10 +914,10 @@  discard block
 block discarded – undo
914 914
 		ecrire_fichier($cache, serialize($path_parts));
915 915
 	}
916 916
 	$ext = !empty($path_parts['extension']) ? $path_parts['extension'] : '';
917
-	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) {
917
+	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) {
918 918
 		return nom_fichier_copie_locale($source, $ext);
919 919
 	}
920
-	spip_log("pas de copie locale pour $source", 'distant' . _LOG_ERREUR);
920
+	spip_log("pas de copie locale pour $source", 'distant'._LOG_ERREUR);
921 921
 }
922 922
 
923 923
 
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
 		} else {
1002 1002
 			if ($a['body']) {
1003 1003
 				$a['extension'] = $extension;
1004
-				$a['fichier'] = _DIR_RACINE . nom_fichier_copie_locale($source, $extension);
1004
+				$a['fichier'] = _DIR_RACINE.nom_fichier_copie_locale($source, $extension);
1005 1005
 				ecrire_fichier($a['fichier'], $a['body']);
1006 1006
 				$size_image = @spip_getimagesize($a['fichier']);
1007 1007
 				$a['largeur'] = intval($size_image[0]);
@@ -1069,20 +1069,20 @@  discard block
 block discarded – undo
1069 1069
 			!$t
1070 1070
 			and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext)
1071 1071
 		) {
1072
-			$t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text'));
1072
+			$t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text'));
1073 1073
 		}
1074 1074
 		if (
1075 1075
 			!$t
1076 1076
 			and preg_match(',^Content-Disposition:\s*attachment;\s*filename=(.*)$,Uims', $headers, $m)
1077 1077
 			and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $m[1], $rext)
1078 1078
 		) {
1079
-			$t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text'));
1079
+			$t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text'));
1080 1080
 		}
1081 1081
 	}
1082 1082
 
1083 1083
 	// Autre mime/type (ou text/plain avec fichier d'extension inconnue)
1084 1084
 	if (!$t) {
1085
-		$t = sql_fetsel('extension', 'spip_types_documents', 'mime_type=' . sql_quote($mime_type));
1085
+		$t = sql_fetsel('extension', 'spip_types_documents', 'mime_type='.sql_quote($mime_type));
1086 1086
 	}
1087 1087
 
1088 1088
 	// Toujours rien ? (ex: audio/x-ogg au lieu de application/ogg)
@@ -1093,11 +1093,11 @@  discard block
 block discarded – undo
1093 1093
 		and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext)
1094 1094
 	) {
1095 1095
 		# eviter xxx.3 => 3gp (> SPIP 3)
1096
-		$t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text'));
1096
+		$t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text'));
1097 1097
 	}
1098 1098
 
1099 1099
 	if ($t) {
1100
-		spip_log("mime-type $mime_type ok, extension " . $t['extension'], 'distant');
1100
+		spip_log("mime-type $mime_type ok, extension ".$t['extension'], 'distant');
1101 1101
 		return $t['extension'];
1102 1102
 	} else {
1103 1103
 		# par defaut on retombe sur '.bin' si c'est autorise
@@ -1200,7 +1200,7 @@  discard block
 block discarded – undo
1200 1200
 		}
1201 1201
 	} else {
1202 1202
 		$scheme = $t['scheme'];
1203
-		$noproxy = $scheme . '://';
1203
+		$noproxy = $scheme.'://';
1204 1204
 	}
1205 1205
 	if (isset($t['user'])) {
1206 1206
 		$user = [$t['user'], $t['pass']];
@@ -1214,7 +1214,7 @@  discard block
 block discarded – undo
1214 1214
 	}
1215 1215
 
1216 1216
 	if (!empty($t['query'])) {
1217
-		$path .= '?' . $t['query'];
1217
+		$path .= '?'.$t['query'];
1218 1218
 	}
1219 1219
 
1220 1220
 	$f = lance_requete($method, $scheme, $user, $host, $path, $port, $noproxy, $refuse_gz, $referer, $datas, $vers, $date);
@@ -1288,20 +1288,20 @@  discard block
 block discarded – undo
1288 1288
 	$proxy_user = '';
1289 1289
 	$http_proxy = need_proxy($host);
1290 1290
 	if ($user) {
1291
-		$user = urlencode($user[0]) . ':' . urlencode($user[1]);
1291
+		$user = urlencode($user[0]).':'.urlencode($user[1]);
1292 1292
 	}
1293 1293
 
1294 1294
 	$connect = '';
1295 1295
 	if ($http_proxy) {
1296
-		if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, ['tls','ssl'])) {
1297
-			$path_host = (!$user ? '' : "$user@") . $host . (($port != 80) ? ":$port" : '');
1298
-			$connect = 'CONNECT ' . $path_host . " $vers\r\n"
1296
+		if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, ['tls', 'ssl'])) {
1297
+			$path_host = (!$user ? '' : "$user@").$host.(($port != 80) ? ":$port" : '');
1298
+			$connect = 'CONNECT '.$path_host." $vers\r\n"
1299 1299
 				. "Host: $path_host\r\n"
1300 1300
 				. "Proxy-Connection: Keep-Alive\r\n";
1301 1301
 		} else {
1302
-			$path = (in_array($scheme, ['tls','ssl']) ? 'https://' : "$scheme://")
1302
+			$path = (in_array($scheme, ['tls', 'ssl']) ? 'https://' : "$scheme://")
1303 1303
 				. (!$user ? '' : "$user@")
1304
-				. "$host" . (($port != 80) ? ":$port" : '') . $path;
1304
+				. "$host".(($port != 80) ? ":$port" : '').$path;
1305 1305
 		}
1306 1306
 		$t2 = @parse_url($http_proxy);
1307 1307
 		$first_host = $t2['host'];
@@ -1309,10 +1309,10 @@  discard block
 block discarded – undo
1309 1309
 			$port = 80;
1310 1310
 		}
1311 1311
 		if ($t2['user']) {
1312
-			$proxy_user = base64_encode($t2['user'] . ':' . $t2['pass']);
1312
+			$proxy_user = base64_encode($t2['user'].':'.$t2['pass']);
1313 1313
 		}
1314 1314
 	} else {
1315
-		$first_host = $noproxy . $host;
1315
+		$first_host = $noproxy.$host;
1316 1316
 	}
1317 1317
 
1318 1318
 	if ($connect) {
@@ -1334,7 +1334,7 @@  discard block
 block discarded – undo
1334 1334
 		);
1335 1335
 		spip_log("Recuperer $path sur $first_host:$port par $f (via CONNECT)", 'connect');
1336 1336
 		if (!$f) {
1337
-			spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR);
1337
+			spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR);
1338 1338
 			return $errno;
1339 1339
 		}
1340 1340
 		stream_set_timeout($f, _INC_DISTANT_CONNECT_TIMEOUT);
@@ -1347,7 +1347,7 @@  discard block
 block discarded – undo
1347 1347
 			or !count($res = explode(' ', $res))
1348 1348
 			or $res[1] !== '200'
1349 1349
 		) {
1350
-			spip_log("Echec CONNECT sur $first_host:$port", 'connect' . _LOG_INFO_IMPORTANTE);
1350
+			spip_log("Echec CONNECT sur $first_host:$port", 'connect'._LOG_INFO_IMPORTANTE);
1351 1351
 			fclose($f);
1352 1352
 
1353 1353
 			return false;
@@ -1364,7 +1364,7 @@  discard block
 block discarded – undo
1364 1364
 		} while (!$f and $ntry-- and $errno !== 110 and sleep(1));
1365 1365
 		spip_log("Recuperer $path sur $first_host:$port par $f");
1366 1366
 		if (!$f) {
1367
-			spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR);
1367
+			spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR);
1368 1368
 
1369 1369
 			return $errno;
1370 1370
 		}
@@ -1374,16 +1374,16 @@  discard block
 block discarded – undo
1374 1374
 	$site = $GLOBALS['meta']['adresse_site'] ?? '';
1375 1375
 
1376 1376
 	$host_port = $host;
1377
-	if ($port != (in_array($scheme, ['tls','ssl']) ? 443 : 80)) {
1377
+	if ($port != (in_array($scheme, ['tls', 'ssl']) ? 443 : 80)) {
1378 1378
 		$host_port .= ":$port";
1379 1379
 	}
1380 1380
 	$req = "$method $path $vers\r\n"
1381 1381
 		. "Host: $host_port\r\n"
1382
-		. 'User-Agent: ' . _INC_DISTANT_USER_AGENT . "\r\n"
1383
-		. ($refuse_gz ? '' : ('Accept-Encoding: ' . _INC_DISTANT_CONTENT_ENCODING . "\r\n"))
1382
+		. 'User-Agent: '._INC_DISTANT_USER_AGENT."\r\n"
1383
+		. ($refuse_gz ? '' : ('Accept-Encoding: '._INC_DISTANT_CONTENT_ENCODING."\r\n"))
1384 1384
 		. (!$site ? '' : "Referer: $site/$referer\r\n")
1385
-		. (!$date ? '' : 'If-Modified-Since: ' . (gmdate('D, d M Y H:i:s', $date) . " GMT\r\n"))
1386
-		. (!$user ? '' : ('Authorization: Basic ' . base64_encode($user) . "\r\n"))
1385
+		. (!$date ? '' : 'If-Modified-Since: '.(gmdate('D, d M Y H:i:s', $date)." GMT\r\n"))
1386
+		. (!$user ? '' : ('Authorization: Basic '.base64_encode($user)."\r\n"))
1387 1387
 		. (!$proxy_user ? '' : "Proxy-Authorization: Basic $proxy_user\r\n")
1388 1388
 		. (!strpos($vers, '1.1') ? '' : "Keep-Alive: 300\r\nConnection: keep-alive\r\n");
1389 1389
 
Please login to merge, or discard this patch.