Completed
Push — master ( 1e6dd3...980817 )
by cam
01:15
created
ecrire/base/upgrade.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	if ($GLOBALS['spip_version_base'] != $GLOBALS['meta']['version_installee']) {
57 57
 		if (!is_numeric(_request('reinstall'))) {
58 58
 			include_spip('base/create');
59
-			spip_log('recree les tables eventuellement disparues', 'maj.' . _LOG_INFO_IMPORTANTE);
59
+			spip_log('recree les tables eventuellement disparues', 'maj.'._LOG_INFO_IMPORTANTE);
60 60
 			creer_base();
61 61
 		}
62 62
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 			exit;
70 70
 		}
71 71
 	}
72
-	spip_log('Fin de mise a jour SQL. Debut m-a-j acces et config', 'maj.' . _LOG_INFO_IMPORTANTE);
72
+	spip_log('Fin de mise a jour SQL. Debut m-a-j acces et config', 'maj.'._LOG_INFO_IMPORTANTE);
73 73
 
74 74
 	// supprimer quelques fichiers temporaires qui peuvent se retrouver invalides
75 75
 	@spip_unlink(_CACHE_RUBRIQUES);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	@spip_unlink(_CACHE_PLUGINS_OPT);
79 79
 	@spip_unlink(_CACHE_PLUGINS_FCT);
80 80
 	@spip_unlink(_CACHE_CHEMIN);
81
-	@spip_unlink(_DIR_TMP . 'plugin_xml_cache.gz');
81
+	@spip_unlink(_DIR_TMP.'plugin_xml_cache.gz');
82 82
 
83 83
 	include_spip('inc/auth');
84 84
 	auth_synchroniser_distant();
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 	$version_installee = $GLOBALS['meta']['version_installee'] ?? null;
118 118
 
119 119
 	spip_log(
120
-		"Version anterieure: $version_installee. Courante: " . $GLOBALS['spip_version_base'],
121
-		'maj.' . _LOG_INFO_IMPORTANTE
120
+		"Version anterieure: $version_installee. Courante: ".$GLOBALS['spip_version_base'],
121
+		'maj.'._LOG_INFO_IMPORTANTE
122 122
 	);
123 123
 	if (!$version_installee or ($GLOBALS['spip_version_base'] < $version_installee)) {
124 124
 		sql_replace(
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
 	$res = maj_while($version_installee, $cible, $GLOBALS['maj'], 'version_installee', 'meta', $redirect, $debut_page);
152 152
 	if ($res) {
153 153
 		if (!is_array($res)) {
154
-			spip_log("Pb d'acces SQL a la mise a jour", 'maj.' . _LOG_ERREUR);
154
+			spip_log("Pb d'acces SQL a la mise a jour", 'maj.'._LOG_ERREUR);
155 155
 		} else {
156
-			echo _T('avis_operation_echec') . ' ' . join(' ', $res);
156
+			echo _T('avis_operation_echec').' '.join(' ', $res);
157 157
 			echo install_fin_html();
158 158
 		}
159 159
 	}
@@ -241,9 +241,9 @@  discard block
 block discarded – undo
241 241
 		$res = maj_while($current_version, $version_cible, $maj, $nom_meta_base_version, $table_meta, $redirect);
242 242
 		if ($res) {
243 243
 			if (!is_array($res)) {
244
-				spip_log("Pb d'acces SQL a la mise a jour", 'maj.' . _LOG_ERREUR);
244
+				spip_log("Pb d'acces SQL a la mise a jour", 'maj.'._LOG_ERREUR);
245 245
 			} else {
246
-				echo '<p>' . _T('avis_operation_echec') . ' ' . join(' ', $res) . '</p>';
246
+				echo '<p>'._T('avis_operation_echec').' '.join(' ', $res).'</p>';
247 247
 			}
248 248
 		}
249 249
 	}
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	echo(install_debut_html($titre));
300 300
 	// script de rechargement auto sur timeout
301 301
 	$redirect = generer_url_ecrire('upgrade', "reinstall=$installee&meta=$meta&table=$table", true);
302
-	echo http_script("window.setTimeout('location.href=\"" . $redirect . "\";'," . ($timeout * 1000) . ')');
302
+	echo http_script("window.setTimeout('location.href=\"".$redirect."\";',".($timeout * 1000).')');
303 303
 	echo "<div style='text-align: left'>\n";
304 304
 	if (ob_get_level()) {
305 305
 		ob_flush();
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 				return [$v, $etape];
389 389
 			}
390 390
 			$n = time() - $time;
391
-			spip_log("$table $meta: $v en $n secondes", 'maj.' . _LOG_INFO_IMPORTANTE);
391
+			spip_log("$table $meta: $v en $n secondes", 'maj.'._LOG_INFO_IMPORTANTE);
392 392
 			if ($meta) {
393 393
 				ecrire_meta($meta, $installee = $v, 'oui', $table);
394 394
 			}
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 	if ($meta) {
405 405
 		ecrire_meta($meta, $cible, 'oui', $table);
406 406
 	}
407
-	spip_log("MAJ terminee. $meta: $installee", 'maj.' . _LOG_INFO_IMPORTANTE);
407
+	spip_log("MAJ terminee. $meta: $installee", 'maj.'._LOG_INFO_IMPORTANTE);
408 408
 
409 409
 	return [];
410 410
 }
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
  * @return int
430 430
  */
431 431
 function serie_alter($serie, $q = [], $meta = '', $table = 'meta', $redirect = '') {
432
-	$meta2 = $meta . '_maj_' . $serie;
432
+	$meta2 = $meta.'_maj_'.$serie;
433 433
 	$etape = 0;
434 434
 	if (isset($GLOBALS[$table][$meta2])) {
435 435
 		$etape = intval($GLOBALS[$table][$meta2]);
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 				and function_exists($f = array_shift($r))
443 443
 			) {
444 444
 				// note: $r (arguments de la fonction $f) peut avoir des données tabulaires
445
-				spip_log("$msg: $f " . @join(',', $r), 'maj.' . _LOG_INFO_IMPORTANTE);
445
+				spip_log("$msg: $f ".@join(',', $r), 'maj.'._LOG_INFO_IMPORTANTE);
446 446
 				// pour les fonctions atomiques sql_xx
447 447
 				// on enregistre le meta avant de lancer la fonction,
448 448
 				// de maniere a eviter de boucler sur timeout
@@ -460,12 +460,12 @@  discard block
 block discarded – undo
460 460
 					relance_maj($meta, $table, $redirect);
461 461
 				}
462 462
 				ecrire_meta($meta2, $i + 1, 'non', $table);
463
-				spip_log("$meta2: ok", 'maj.' . _LOG_INFO_IMPORTANTE);
463
+				spip_log("$meta2: ok", 'maj.'._LOG_INFO_IMPORTANTE);
464 464
 			} else {
465 465
 				if (!is_array($r)) {
466
-					spip_log("maj $i format incorrect", 'maj.' . _LOG_ERREUR);
466
+					spip_log("maj $i format incorrect", 'maj.'._LOG_ERREUR);
467 467
 				} else {
468
-					spip_log("maj $i fonction $f non definie", 'maj.' . _LOG_ERREUR);
468
+					spip_log("maj $i fonction $f non definie", 'maj.'._LOG_ERREUR);
469 469
 				}
470 470
 				// en cas d'erreur serieuse, on s'arrete
471 471
 				// mais on permet de passer par dessus en rechargeant la page.
Please login to merge, or discard this patch.
ecrire/balise/menu_lang_ecrire.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
 	include_spip('inc/lang');
100 100
 
101 101
 	if ($GLOBALS['spip_lang'] <> $default) {
102
-		$opt = lang_select($default);  # et remplace
102
+		$opt = lang_select($default); # et remplace
103 103
 		if ($GLOBALS['spip_lang'] <> $default) {
104
-			$default = '';  # annule tout choix par defaut
104
+			$default = ''; # annule tout choix par defaut
105 105
 			if ($opt) {
106 106
 				lang_select();
107 107
 			}
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
 	# lien a partir de /
112 112
 	$cible = parametre_url(self(), 'lang', '', '&');
113
-	$post = generer_url_action('converser', 'redirect=' . rawurlencode($cible), true);
113
+	$post = generer_url_action('converser', 'redirect='.rawurlencode($cible), true);
114 114
 
115 115
 	return [
116 116
 		'formulaires/menu_lang',
Please login to merge, or discard this patch.
ecrire/inc/filtres_mime.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	static $t1 = ['&', '<', '>'];
121 121
 	static $t2 = ['&amp;', '&lt;', '&gt;'];
122 122
 
123
-	return '<pre>' . str_replace($t1, $t2, (string) $t) . '</pre>';
123
+	return '<pre>'.str_replace($t1, $t2, (string) $t).'</pre>';
124 124
 }
125 125
 
126 126
 /**
@@ -140,12 +140,12 @@  discard block
 block discarded – undo
140 140
 	foreach ($lignes as &$l) {
141 141
 		$l = join('|', $l);
142 142
 	}
143
-	$corps = join("\n", $lignes) . "\n";
144
-	$corps = $caption .
145
-		"\n|{{" .
146
-		join('}}|{{', $entete) .
147
-		'}}|' .
148
-		"\n|" .
143
+	$corps = join("\n", $lignes)."\n";
144
+	$corps = $caption.
145
+		"\n|{{".
146
+		join('}}|{{', $entete).
147
+		'}}|'.
148
+		"\n|".
149 149
 		str_replace("\n", "|\n|", $corps);
150 150
 	include_spip('inc/texte');
151 151
 
@@ -187,9 +187,9 @@  discard block
 block discarded – undo
187 187
 		}
188 188
 	}
189 189
 	// Pourquoi SafeHtml transforme-t-il en texte les scripts dans Body ?
190
-	$t = safehtml(preg_replace(',<script' . '.*?</script>,is', '', $t));
190
+	$t = safehtml(preg_replace(',<script'.'.*?</script>,is', '', $t));
191 191
 
192
-	return (!$style ? '' : "\n<style>" . $style . '</style>') . $t;
192
+	return (!$style ? '' : "\n<style>".$style.'</style>').$t;
193 193
 }
194 194
 
195 195
 /**
Please login to merge, or discard this patch.
ecrire/inc/autoriser.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 // mais apres la fonction autoriser()
123 123
 if ($f = find_in_path('mes_fonctions.php')) {
124 124
 	global $dossier_squelettes;
125
-	include_once(_ROOT_CWD . $f);
125
+	include_once(_ROOT_CWD.$f);
126 126
 }
127 127
 
128 128
 
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 		$qui = $GLOBALS['visiteur_session'] ?: [];
165 165
 		$qui = array_merge(['statut' => '', 'id_auteur' => 0, 'webmestre' => 'non'], $qui);
166 166
 	} elseif (is_numeric($qui)) {
167
-		$qui = sql_fetsel('*', 'spip_auteurs', 'id_auteur=' . $qui);
167
+		$qui = sql_fetsel('*', 'spip_auteurs', 'id_auteur='.$qui);
168 168
 	}
169 169
 
170 170
 	// Admins restreints, on construit ici (pas generique mais...)
@@ -174,8 +174,8 @@  discard block
 block discarded – undo
174 174
 	}
175 175
 
176 176
 	spip_log(
177
-		"autoriser $faire $type $id (" . ($qui['nom'] ?? '') . ') ?',
178
-		'autoriser' . _LOG_DEBUG
177
+		"autoriser $faire $type $id (".($qui['nom'] ?? '').') ?',
178
+		'autoriser'._LOG_DEBUG
179 179
 	);
180 180
 
181 181
 	// passer par objet_type pour avoir les alias
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 		(isset($GLOBALS['autoriser_exception'][$faire][$type][$id]) and autoriser_exception($faire, $type, $id, 'verifier'))
192 192
 		or (isset($GLOBALS['autoriser_exception'][$faire][$type]['*']) and autoriser_exception($faire, $type, '*', 'verifier'))
193 193
 	) {
194
-		spip_log("autoriser ($faire, $type, $id, " . ($qui['nom'] ?? '') . ') : OK Exception', 'autoriser' . _LOG_DEBUG);
194
+		spip_log("autoriser ($faire, $type, $id, ".($qui['nom'] ?? '').') : OK Exception', 'autoriser'._LOG_DEBUG);
195 195
 		return true;
196 196
 	}
197 197
 
@@ -200,18 +200,18 @@  discard block
 block discarded – undo
200 200
 	// autoriser_faire[_dist], autoriser_defaut[_dist]
201 201
 	$fonctions = $type
202 202
 		? [
203
-			'autoriser_' . $type . '_' . $faire,
204
-			'autoriser_' . $type . '_' . $faire . '_dist',
205
-			'autoriser_' . $type,
206
-			'autoriser_' . $type . '_dist',
207
-			'autoriser_' . $faire,
208
-			'autoriser_' . $faire . '_dist',
203
+			'autoriser_'.$type.'_'.$faire,
204
+			'autoriser_'.$type.'_'.$faire.'_dist',
205
+			'autoriser_'.$type,
206
+			'autoriser_'.$type.'_dist',
207
+			'autoriser_'.$faire,
208
+			'autoriser_'.$faire.'_dist',
209 209
 			'autoriser_defaut',
210 210
 			'autoriser_defaut_dist'
211 211
 		]
212 212
 		: [
213
-			'autoriser_' . $faire,
214
-			'autoriser_' . $faire . '_dist',
213
+			'autoriser_'.$faire,
214
+			'autoriser_'.$faire.'_dist',
215 215
 			'autoriser_defaut',
216 216
 			'autoriser_defaut_dist'
217 217
 		];
@@ -224,8 +224,8 @@  discard block
 block discarded – undo
224 224
 	}
225 225
 
226 226
 	spip_log(
227
-		"$f($faire, $type, $id, " . ($qui['nom'] ?? '') . ') : ' . ($a ? 'OK' : 'niet'),
228
-		'autoriser' . _LOG_DEBUG
227
+		"$f($faire, $type, $id, ".($qui['nom'] ?? '').') : '.($a ? 'OK' : 'niet'),
228
+		'autoriser'._LOG_DEBUG
229 229
 	);
230 230
 
231 231
 	return $a;
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 function autoriser_previsualiser_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
375 375
 
376 376
 	// Le visiteur a-t-il un statut prevu par la config ?
377
-	if (strpos($GLOBALS['meta']['preview'], ',' . $qui['statut'] . ',') !== false) {
377
+	if (strpos($GLOBALS['meta']['preview'], ','.$qui['statut'].',') !== false) {
378 378
 		return test_previsualiser_objet_champ($type, $id, $qui, $opt);
379 379
 	}
380 380
 
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 				} // pas de champ passe a la demande => NIET
433 433
 				$previsu = explode(',', $c['previsu']);
434 434
 				// regarder si ce statut est autorise pour l'auteur
435
-				if (in_array($opt[$champ] . '/auteur', $previsu)) {
435
+				if (in_array($opt[$champ].'/auteur', $previsu)) {
436 436
 					// retrouver l’id_auteur qui a filé un lien de prévisu éventuellement,
437 437
 					// sinon l’auteur en session
438 438
 					include_spip('inc/securiser_action');
@@ -446,12 +446,12 @@  discard block
 block discarded – undo
446 446
 
447 447
 					if (!$id_auteur) {
448 448
 						return false;
449
-					} elseif (autoriser('previsualiser' . $opt[$champ], $type, 0, $id_auteur)) {
449
+					} elseif (autoriser('previsualiser'.$opt[$champ], $type, 0, $id_auteur)) {
450 450
 						// dans ce cas (admin en general), pas de filtrage sur ce statut
451 451
 					} elseif (
452 452
 						!sql_countsel(
453 453
 							'spip_auteurs_liens',
454
-							'id_auteur=' . intval($id_auteur) . ' AND objet=' . sql_quote($type) . ' AND id_objet=' . intval($id)
454
+							'id_auteur='.intval($id_auteur).' AND objet='.sql_quote($type).' AND id_objet='.intval($id)
455 455
 						)
456 456
 					) {
457 457
 						return false;
@@ -496,16 +496,16 @@  discard block
 block discarded – undo
496 496
 			// multilinguisme par secteur et objet rattaché à une rubrique
497 497
 			$primary = id_table_objet($type);
498 498
 			if ($table != 'spip_rubriques') {
499
-				$id_rubrique = sql_getfetsel('id_rubrique', "$table", "$primary=" . intval($id));
499
+				$id_rubrique = sql_getfetsel('id_rubrique', "$table", "$primary=".intval($id));
500 500
 			} else {
501 501
 				$id_rubrique = $id;
502 502
 			}
503
-			$id_secteur = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique));
503
+			$id_secteur = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique='.intval($id_rubrique));
504 504
 			if (!$id_secteur > 0) {
505 505
 				$id_secteur = $id_rubrique;
506 506
 			}
507
-			$langue_secteur = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique=' . intval($id_secteur));
508
-			$langue_objet = sql_getfetsel('lang', "$table", "$primary=" . intval($id));
507
+			$langue_secteur = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique='.intval($id_secteur));
508
+			$langue_objet = sql_getfetsel('lang', "$table", "$primary=".intval($id));
509 509
 			if ($langue_secteur != $langue_objet) {
510 510
 				// configuration incohérente, on laisse l'utilisateur corriger la situation
511 511
 				return true;
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 			if ($table != 'spip_rubriques') { // le choix de la langue se fait seulement sur les rubriques
514 514
 				return false;
515 515
 			} else {
516
-				$id_parent = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique=' . intval($id));
516
+				$id_parent = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique='.intval($id));
517 517
 				if ($id_parent != 0) {
518 518
 					// sous-rubriques : pas de choix de langue
519 519
 					return false;
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
 
566 566
 	if (!isset($opt['statut'])) {
567 567
 		if (isset($desc['field']['statut'])) {
568
-			$statut = sql_getfetsel('statut', $desc['table'], id_table_objet($type) . '=' . intval($id));
568
+			$statut = sql_getfetsel('statut', $desc['table'], id_table_objet($type).'='.intval($id));
569 569
 		} else {
570 570
 			$statut = 'publie';
571 571
 		} // pas de statut => publie
@@ -739,11 +739,11 @@  discard block
 block discarded – undo
739 739
 		return false;
740 740
 	}
741 741
 
742
-	if (sql_countsel('spip_rubriques', 'id_parent=' . intval($id))) {
742
+	if (sql_countsel('spip_rubriques', 'id_parent='.intval($id))) {
743 743
 		return false;
744 744
 	}
745 745
 
746
-	if (sql_countsel('spip_articles', 'id_rubrique=' . intval($id) . " AND (statut<>'poubelle')")) {
746
+	if (sql_countsel('spip_articles', 'id_rubrique='.intval($id)." AND (statut<>'poubelle')")) {
747 747
 		return false;
748 748
 	}
749 749
 
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 	if (!$id) {
781 781
 		return false;
782 782
 	}
783
-	$r = sql_fetsel('id_rubrique,statut', 'spip_articles', 'id_article=' . sql_quote($id));
783
+	$r = sql_fetsel('id_rubrique,statut', 'spip_articles', 'id_article='.sql_quote($id));
784 784
 
785 785
 	return
786 786
 		$r
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 				(!isset($opt['statut']) or $opt['statut'] !== 'publie')
792 792
 				and in_array($qui['statut'], ['0minirezo', '1comite'])
793 793
 				and in_array($r['statut'], ['prop', 'prepa', 'poubelle'])
794
-				and auteurs_objet('article', $id, 'id_auteur=' . $qui['id_auteur'])
794
+				and auteurs_objet('article', $id, 'id_auteur='.$qui['id_auteur'])
795 795
 			)
796 796
 		);
797 797
 }
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
 		if (!$id) {
850 850
 			return false;
851 851
 		}
852
-		$statut = sql_getfetsel('statut', 'spip_articles', 'id_article=' . intval($id));
852
+		$statut = sql_getfetsel('statut', 'spip_articles', 'id_article='.intval($id));
853 853
 	}
854 854
 
855 855
 	return
@@ -860,7 +860,7 @@  discard block
 block discarded – undo
860 860
 		or
861 861
 		($id
862 862
 			and $qui['id_auteur']
863
-			and auteurs_objet('article', $id, 'id_auteur=' . $qui['id_auteur']));
863
+			and auteurs_objet('article', $id, 'id_auteur='.$qui['id_auteur']));
864 864
 }
865 865
 
866 866
 
@@ -881,8 +881,8 @@  discard block
 block discarded – undo
881 881
 function autoriser_voir_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
882 882
 	# securite, mais on aurait pas du arriver ici !
883 883
 	if (
884
-		function_exists($f = 'autoriser_' . $type . '_voir')
885
-		or function_exists($f = 'autoriser_' . $type . '_voir_dist')
884
+		function_exists($f = 'autoriser_'.$type.'_voir')
885
+		or function_exists($f = 'autoriser_'.$type.'_voir_dist')
886 886
 	) {
887 887
 		return $f($faire, $type, $id, $qui, $opt);
888 888
 	}
@@ -1013,7 +1013,7 @@  discard block
 block discarded – undo
1013 1013
 	$n = sql_fetsel(
1014 1014
 		'A.id_article',
1015 1015
 		'spip_auteurs_liens AS L LEFT JOIN spip_articles AS A ON (L.objet=\'article\' AND L.id_objet=A.id_article)',
1016
-		"A.statut='publie' AND L.id_auteur=" . sql_quote($id)
1016
+		"A.statut='publie' AND L.id_auteur=".sql_quote($id)
1017 1017
 	);
1018 1018
 
1019 1019
 	return $n ? true : false;
@@ -1225,7 +1225,7 @@  discard block
 block discarded – undo
1225 1225
 		and $r = sql_allfetsel(
1226 1226
 			'id_objet',
1227 1227
 			'spip_auteurs_liens',
1228
-			'id_auteur=' . intval($id_auteur) . " AND objet='rubrique' AND id_objet!=0"
1228
+			'id_auteur='.intval($id_auteur)." AND objet='rubrique' AND id_objet!=0"
1229 1229
 		)
1230 1230
 		and is_countable($r) ? count($r) : 0
1231 1231
 	) {
@@ -1910,8 +1910,8 @@  discard block
 block discarded – undo
1910 1910
 function auteurs_objet($objet, $id_objet, $cond = '') {
1911 1911
 	$objet = objet_type($objet);
1912 1912
 	$where = [
1913
-		'objet=' . sql_quote($objet),
1914
-		'id_objet=' . intval($id_objet)
1913
+		'objet='.sql_quote($objet),
1914
+		'id_objet='.intval($id_objet)
1915 1915
 	];
1916 1916
 	if (!empty($cond)) {
1917 1917
 		if (is_array($cond)) {
@@ -1946,7 +1946,7 @@  discard block
 block discarded – undo
1946 1946
 	return sql_allfetsel(
1947 1947
 		'id_auteur',
1948 1948
 		'spip_auteurs_liens',
1949
-		"objet='article' AND id_objet=" . intval($id_article) . ($cond ? " AND $cond" : '')
1949
+		"objet='article' AND id_objet=".intval($id_article).($cond ? " AND $cond" : '')
1950 1950
 	);
1951 1951
 }
1952 1952
 
Please login to merge, or discard this patch.
ecrire/inc/editer.php 1 patch
Spacing   +24 added lines, -25 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 		$res['message_ok'] = _T('info_modification_enregistree');
101 101
 		if ($retour) {
102 102
 			if (strncmp($retour, 'javascript:', 11) == 0) {
103
-				$res['message_ok'] .= '<script type="text/javascript">/*<![CDATA[*/' . substr($retour, 11) . '/*]]>*/</script>';
103
+				$res['message_ok'] .= '<script type="text/javascript">/*<![CDATA[*/'.substr($retour, 11).'/*]]>*/</script>';
104 104
 				$res['editable'] = true;
105 105
 			} else {
106 106
 				$res['redirect'] = parametre_url($retour, $id_table_objet, $id);
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 				if (!isset($erreurs[$champ])) {
141 141
 					$erreurs[$champ] = '';
142 142
 				}
143
-				$erreurs[$champ] .= _T('alerte_modif_info_concourante') . "<br /><textarea readonly='readonly' class='forml'>" . entites_html($conflit['base']) . '</textarea>';
143
+				$erreurs[$champ] .= _T('alerte_modif_info_concourante')."<br /><textarea readonly='readonly' class='forml'>".entites_html($conflit['base']).'</textarea>';
144 144
 			}
145 145
 		}
146 146
 	}
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	if (
222 222
 		$config_fonc
223 223
 		and !in_array($config_fonc, ['articles_edit_config', 'rubriques_edit_config', 'auteurs_edit_config'])
224
-		and $config_fonc !== $table_objet . '_edit_config'
224
+		and $config_fonc !== $table_objet.'_edit_config'
225 225
 	) {
226 226
 		if (
227 227
 			$args = test_formulaire_inclus_par_modele()
@@ -236,12 +236,12 @@  discard block
 block discarded – undo
236 236
 	// Appel direct dans un squelette
237 237
 	if (!$row) {
238 238
 		if (!$new or $lier_trad) {
239
-			if ($select = charger_fonction('precharger_' . $type, 'inc', true)) {
239
+			if ($select = charger_fonction('precharger_'.$type, 'inc', true)) {
240 240
 				$row = $select($id, $id_parent, $lier_trad);
241 241
 				// si on a une fonction precharger, elle pu faire un reglage de langue
242 242
 				$lang_default = (!empty($row['lang']) ? $row['lang'] : null);
243 243
 			} else {
244
-				$row = sql_fetsel('*', $table_objet_sql, $id_table_objet . '=' . intval($id));
244
+				$row = sql_fetsel('*', $table_objet_sql, $id_table_objet.'='.intval($id));
245 245
 			}
246 246
 			if (!$new) {
247 247
 				$md5 = controles_md5($row ?? []);
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 	if ($config_fonc) {
292 292
 		$contexte['config'] = $config = $config_fonc($contexte);
293 293
 		if (!$lang_default) {
294
-			$lang_default = $config['langue'] ?? session_get('lang') ;
294
+			$lang_default = $config['langue'] ?? session_get('lang');
295 295
 		}
296 296
 	}
297 297
 	$config = $config + [
@@ -315,13 +315,12 @@  discard block
 block discarded – undo
315 315
 		unset($contexte['lang']);
316 316
 	}
317 317
 
318
-	$contexte['_hidden'] = "<input type='hidden' name='editer_$type' value='oui' />\n" .
319
-		(!$lier_trad ? '' :
320
-			("\n<input type='hidden' name='lier_trad' value='" .
321
-				$lier_trad .
322
-				"' />" .
323
-				"\n<input type='hidden' name='changer_lang' value='" .
324
-				$lang_default .
318
+	$contexte['_hidden'] = "<input type='hidden' name='editer_$type' value='oui' />\n".
319
+		(!$lier_trad ? '' : ("\n<input type='hidden' name='lier_trad' value='".
320
+				$lier_trad.
321
+				"' />".
322
+				"\n<input type='hidden' name='changer_lang' value='".
323
+				$lang_default.
325 324
 				"' />"))
326 325
 		. $hidden
327 326
 		. ($md5 ?? '');
@@ -361,14 +360,14 @@  discard block
 block discarded – undo
361 360
 	$aider = charger_fonction('aider', 'inc');
362 361
 	if (strlen($texte) > 28 * 1024) {
363 362
 		$texte = str_replace("\r\n", "\n", $texte);
364
-		$pos = strpos($texte, "\n\n", 28 * 1024);  // coupe para > 28 ko
363
+		$pos = strpos($texte, "\n\n", 28 * 1024); // coupe para > 28 ko
365 364
 		if ($pos > 0 and $pos < 32 * 1024) {
366
-			$debut = substr($texte, 0, $pos) . "\n\n<!--SPIP-->\n";
365
+			$debut = substr($texte, 0, $pos)."\n\n<!--SPIP-->\n";
367 366
 			$suite = substr($texte, $pos + 2);
368 367
 		} else {
369
-			$pos = strpos($texte, ' ', 28 * 1024);  // sinon coupe espace
368
+			$pos = strpos($texte, ' ', 28 * 1024); // sinon coupe espace
370 369
 			if (!($pos > 0 and $pos < 32 * 1024)) {
371
-				$pos = 28 * 1024;  // au pire (pas d'espace trouv'e)
370
+				$pos = 28 * 1024; // au pire (pas d'espace trouv'e)
372 371
 				$decalage = 0; // si y'a pas d'espace, il ne faut pas perdre le caract`ere
373 372
 			} else {
374 373
 				$decalage = 1;
@@ -399,13 +398,13 @@  discard block
 block discarded – undo
399 398
 	}
400 399
 
401 400
 	include_spip('inc/barre');
402
-	$textes_supplement = "<br /><span style='color: red'>" . _T('info_texte_long') . "</span>\n";
401
+	$textes_supplement = "<br /><span style='color: red'>"._T('info_texte_long')."</span>\n";
403 402
 	$nombre = 0;
404 403
 
405 404
 	while (strlen($texte) > 29 * 1024) {
406 405
 		$nombre++;
407 406
 		[$texte1, $texte] = coupe_trop_long($texte);
408
-		$textes_supplement .= '<br />' .
407
+		$textes_supplement .= '<br />'.
409 408
 			"<textarea id='texte$nombre' name='texte_plus[$nombre]'$att_text>$texte1</textarea>\n";
410 409
 	}
411 410
 
@@ -488,7 +487,7 @@  discard block
 block discarded – undo
488 487
 	$ctr = [];
489 488
 	foreach ($data as $key => $val) {
490 489
 		$m = md5($val ?? '');
491
-		$k = $prefixe . $key;
490
+		$k = $prefixe.$key;
492 491
 
493 492
 		switch ($format) {
494 493
 			case 'html':
@@ -501,7 +500,7 @@  discard block
 block discarded – undo
501 500
 	}
502 501
 
503 502
 	if ($format === 'html') {
504
-		return "\n\n<!-- controles md5 -->\n" . join("\n", $ctr) . "\n\n";
503
+		return "\n\n<!-- controles md5 -->\n".join("\n", $ctr)."\n\n";
505 504
 	} else {
506 505
 		return $ctr;
507 506
 	}
@@ -653,7 +652,7 @@  discard block
 block discarded – undo
653 652
 	// On elimine les donnees non modifiees par le formulaire (mais
654 653
 	// potentiellement modifiees entre temps par un autre utilisateur)
655 654
 	foreach ($champs as $key => $val) {
656
-		if (isset($ctr[$prefix . $key]) and $m = $ctr[$prefix . $key]) {
655
+		if (isset($ctr[$prefix.$key]) and $m = $ctr[$prefix.$key]) {
657 656
 			if (is_scalar($val) and $m == md5($val)) {
658 657
 				unset($champs[$key]);
659 658
 			}
@@ -682,7 +681,7 @@  discard block
 block discarded – undo
682 681
 	// de conflit.
683 682
 	$ctrh = $ctrq = $conflits = [];
684 683
 	foreach (array_keys($champs) as $key) {
685
-		if (isset($ctr[$prefix . $key]) and $m = $ctr[$prefix . $key]) {
684
+		if (isset($ctr[$prefix.$key]) and $m = $ctr[$prefix.$key]) {
686 685
 			$ctrh[$key] = $m;
687 686
 			$ctrq[] = $key;
688 687
 		}
@@ -716,8 +715,8 @@  discard block
 block discarded – undo
716 715
  */
717 716
 function display_conflit_champ($x) {
718 717
 	if (strstr($x, "\n") or strlen($x) > 80) {
719
-		return "<textarea style='width:99%; height:10em;'>" . entites_html($x) . "</textarea>\n";
718
+		return "<textarea style='width:99%; height:10em;'>".entites_html($x)."</textarea>\n";
720 719
 	} else {
721
-		return "<input type='text' size='40' style='width:99%' value=\"" . entites_html($x) . "\" />\n";
720
+		return "<input type='text' size='40' style='width:99%' value=\"".entites_html($x)."\" />\n";
722 721
 	}
723 722
 }
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 = $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/exporter_csv.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	$champ = preg_replace(',[\s]+,ms', ' ', $champ);
39 39
 	$champ = str_replace('"', '""', $champ);
40 40
 
41
-	return '"' . $champ . '"';
41
+	return '"'.$champ.'"';
42 42
 }
43 43
 
44 44
 /**
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	if ($callback) {
59 59
 		$ligne = $callback($nb, $ligne, $delim, $importer_charset);
60 60
 	}
61
-	$output = join($delim, array_map('exporter_csv_champ', $ligne)) . "\r\n";
61
+	$output = join($delim, array_map('exporter_csv_champ', $ligne))."\r\n";
62 62
 	if ($importer_charset) {
63 63
 		$output = str_replace('’', '\'', $output);
64 64
 		$output = unicode2charset(html2unicode(charset2unicode($output)), $importer_charset);
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 		$fichier = 'php://output';
176 176
 	}
177 177
 	else {
178
-	$fichier = sous_repertoire(_DIR_CACHE, 'export') . $filename;
178
+	$fichier = sous_repertoire(_DIR_CACHE, 'export').$filename;
179 179
 	}
180 180
 
181 181
 	$fp = fopen($fichier, 'w');
Please login to merge, or discard this patch.
ecrire/action/api_transmettre.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@
 block discarded – undo
93 93
 
94 94
 	$res = ltrim($res['texte']);
95 95
 	if (empty($res)) {
96
-		spip_log("$arg $qs resultat vide", 'transmettre' . _LOG_INFO_IMPORTANTE);
96
+		spip_log("$arg $qs resultat vide", 'transmettre'._LOG_INFO_IMPORTANTE);
97 97
 	}
98 98
 
99 99
 	echo $res;
Please login to merge, or discard this patch.
ecrire/inc/distant.php 1 patch
Spacing   +63 added lines, -63 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);
@@ -451,13 +451,13 @@  discard block
 block discarded – undo
451 451
 		$options['taille_max'] = $copy ? _COPIE_LOCALE_MAX_SIZE : _INC_DISTANT_MAX_SIZE;
452 452
 	}
453 453
 
454
-	spip_log('recuperer_url ' . $options['methode'] . " sur $url", 'distant' . _LOG_DEBUG);
454
+	spip_log('recuperer_url '.$options['methode']." sur $url", 'distant'._LOG_DEBUG);
455 455
 
456 456
 	// Ajout des en-têtes spécifiques si besoin
457 457
 	$formatted_data = '';
458 458
 	if (!empty($options['headers'])) {
459 459
 		foreach ($options['headers'] as $champ => $valeur) {
460
-			$formatted_data .= $champ . ': ' . $valeur . "\r\n";
460
+			$formatted_data .= $champ.': '.$valeur."\r\n";
461 461
 		}
462 462
 	}
463 463
 
@@ -465,9 +465,9 @@  discard block
 block discarded – undo
465 465
 		[$head, $postdata] = prepare_donnees_post($options['datas'], $options['boundary']);
466 466
 		$head .= $formatted_data;
467 467
 		if (stripos($head, 'Content-Length:') === false) {
468
-			$head .= 'Content-Length: ' . strlen($postdata) . "\r\n";
468
+			$head .= 'Content-Length: '.strlen($postdata)."\r\n";
469 469
 		}
470
-		$formatted_data = $head . "\r\n" . $postdata;
470
+		$formatted_data = $head."\r\n".$postdata;
471 471
 		if (
472 472
 			strlen($postdata)
473 473
 			and !$methode_demandee
@@ -481,9 +481,9 @@  discard block
 block discarded – undo
481 481
 	// Accepter les URLs au format feed:// ou qui ont oublie le http:// ou les urls relatives au protocole
482 482
 	$url = preg_replace(',^feed://,i', 'http://', $url);
483 483
 	if (!tester_url_absolue($url)) {
484
-		$url = 'http://' . $url;
484
+		$url = 'http://'.$url;
485 485
 	} elseif (strncmp($url, '//', 2) == 0) {
486
-		$url = 'http:' . $url;
486
+		$url = 'http:'.$url;
487 487
 	}
488 488
 
489 489
 	$url = url_to_ascii($url);
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 		$options['if_modified_since']
513 513
 	);
514 514
 	if (!$handle) {
515
-		spip_log("ECHEC init_http $url", 'distant' . _LOG_ERREUR);
515
+		spip_log("ECHEC init_http $url", 'distant'._LOG_ERREUR);
516 516
 
517 517
 		return false;
518 518
 	}
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
 					'status' => 200,
543 543
 				];
544 544
 			} else {
545
-				spip_log("ECHEC chinoiserie $url", 'distant' . _LOG_ERREUR);
545
+				spip_log("ECHEC chinoiserie $url", 'distant'._LOG_ERREUR);
546 546
 				return false;
547 547
 			}
548 548
 		} elseif ($res['location'] and $options['follow_location']) {
@@ -558,11 +558,11 @@  discard block
 block discarded – undo
558 558
 					$options['datas'] = '';
559 559
 				}
560 560
 			}
561
-			spip_log('recuperer_url recommence ' . $options['methode'] . " sur $url", 'distant' . _LOG_DEBUG);
561
+			spip_log('recuperer_url recommence '.$options['methode']." sur $url", 'distant'._LOG_DEBUG);
562 562
 
563 563
 			return recuperer_url($url, $options);
564 564
 		} elseif ($res['status'] !== 200) {
565
-			spip_log('HTTP status ' . $res['status'] . " pour $url", 'distant');
565
+			spip_log('HTTP status '.$res['status']." pour $url", 'distant');
566 566
 		}
567 567
 		$result['status'] = $res['status'];
568 568
 		if (isset($res['headers'])) {
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
 
579 579
 	// on ne veut que les entetes
580 580
 	if (!$options['taille_max'] or $options['methode'] == 'HEAD' or $result['status'] == '304') {
581
-		spip_log('RESULTAT recuperer_url ' . $options['methode'] . " sur $url : " . json_encode($result), 'distant' . _LOG_DEBUG);
581
+		spip_log('RESULTAT recuperer_url '.$options['methode']." sur $url : ".json_encode($result), 'distant'._LOG_DEBUG);
582 582
 		return $result;
583 583
 	}
584 584
 
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 
589 589
 	$gz = false;
590 590
 	if (preg_match(",\bContent-Encoding: .*gzip,is", $result['headers'])) {
591
-		$gz = (_DIR_TMP . md5(uniqid(random_int(0, mt_getrandmax()))) . '.tmp.gz');
591
+		$gz = (_DIR_TMP.md5(uniqid(random_int(0, mt_getrandmax()))).'.tmp.gz');
592 592
 	}
593 593
 
594 594
 	// si on a pas deja recuperer le contenu par une methode detournee
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 
625 625
 	$trace = json_decode(json_encode($result), true);
626 626
 	$trace['page'] = '...';
627
-	spip_log('RESULTAT recuperer_url ' . $options['methode'] . " sur $url : " . json_encode($trace), 'distant' . _LOG_DEBUG);
627
+	spip_log('RESULTAT recuperer_url '.$options['methode']." sur $url : ".json_encode($trace), 'distant'._LOG_DEBUG);
628 628
 
629 629
 	return $result;
630 630
 }
@@ -678,7 +678,7 @@  discard block
 block discarded – undo
678 678
 	$sig['url'] = $url;
679 679
 
680 680
 	$dir = sous_repertoire(_DIR_CACHE, 'curl');
681
-	$cache = md5(serialize($sig)) . '-' . substr(preg_replace(',\W+,', '_', $url), 0, 80);
681
+	$cache = md5(serialize($sig)).'-'.substr(preg_replace(',\W+,', '_', $url), 0, 80);
682 682
 	$sub = sous_repertoire($dir, substr($cache, 0, 2));
683 683
 	$cache = "$sub$cache";
684 684
 
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 	$fp = false;
733 733
 	if ($fichier) {
734 734
 		include_spip('inc/acces');
735
-		$tmpfile = "$fichier." . creer_uniqid() . '.tmp';
735
+		$tmpfile = "$fichier.".creer_uniqid().'.tmp';
736 736
 		$fp = spip_fopen_lock($tmpfile, 'w', LOCK_EX);
737 737
 		if (!$fp and file_exists($fichier)) {
738 738
 			return filesize($fichier);
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 	}
792 792
 	$result['status'] = intval($r[1]);
793 793
 	while ($s = trim(fgets($handle, 16384))) {
794
-		$result['headers'][] = $s . "\n";
794
+		$result['headers'][] = $s."\n";
795 795
 		preg_match(',^([^:]*): *(.*)$,i', $s, $r);
796 796
 		[, $d, $v] = $r;
797 797
 		if (strtolower(trim($d)) == 'location' and $result['status'] >= 300 and $result['status'] < 400) {
@@ -840,13 +840,13 @@  discard block
 block discarded – undo
840 840
 
841 841
 	// on se place tout le temps comme si on etait a la racine
842 842
 	if (_DIR_RACINE) {
843
-		$d = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $d);
843
+		$d = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $d);
844 844
 	}
845 845
 
846 846
 	$m = md5($source);
847 847
 
848 848
 	return $d
849
-	. substr(preg_replace(',[^\w-],', '', basename($source)) . '-' . $m, 0, 12)
849
+	. substr(preg_replace(',[^\w-],', '', basename($source)).'-'.$m, 0, 12)
850 850
 	. substr($m, 0, 4)
851 851
 	. ".$extension";
852 852
 }
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
 	// Si c'est deja local pas de souci
870 870
 	if (!tester_url_absolue($source)) {
871 871
 		if (_DIR_RACINE) {
872
-			$source = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $source);
872
+			$source = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $source);
873 873
 		}
874 874
 
875 875
 		return $source;
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
 		$ext
888 888
 		and preg_match(',^\w+$,', $ext) // pas de php?truc=1&...
889 889
 		and $f = nom_fichier_copie_locale($source, $ext)
890
-		and file_exists(_DIR_RACINE . $f)
890
+		and file_exists(_DIR_RACINE.$f)
891 891
 	) {
892 892
 		return $f;
893 893
 	}
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
 
896 896
 	// Si c'est deja dans la table des documents,
897 897
 	// ramener le nom de sa copie potentielle
898
-	$ext = sql_getfetsel('extension', 'spip_documents', 'fichier=' . sql_quote($source) . " AND distant='oui' AND extension <> ''");
898
+	$ext = sql_getfetsel('extension', 'spip_documents', 'fichier='.sql_quote($source)." AND distant='oui' AND extension <> ''");
899 899
 
900 900
 	if ($ext) {
901 901
 		return nom_fichier_copie_locale($source, $ext);
@@ -906,9 +906,9 @@  discard block
 block discarded – undo
906 906
 
907 907
 	$ext = $path_parts ? $path_parts['extension'] : '';
908 908
 
909
-	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) {
909
+	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) {
910 910
 		$f = nom_fichier_copie_locale($source, $ext);
911
-		if (file_exists(_DIR_RACINE . $f)) {
911
+		if (file_exists(_DIR_RACINE.$f)) {
912 912
 			return $f;
913 913
 		}
914 914
 	}
@@ -916,7 +916,7 @@  discard block
 block discarded – undo
916 916
 	// Ping  pour voir si son extension est connue et autorisee
917 917
 	// avec mise en cache du resultat du ping
918 918
 
919
-	$cache = sous_repertoire(_DIR_CACHE, 'rid') . md5($source);
919
+	$cache = sous_repertoire(_DIR_CACHE, 'rid').md5($source);
920 920
 	if (
921 921
 		!@file_exists($cache)
922 922
 		or !$path_parts = @unserialize(spip_file_get_contents($cache))
@@ -926,10 +926,10 @@  discard block
 block discarded – undo
926 926
 		ecrire_fichier($cache, serialize($path_parts));
927 927
 	}
928 928
 	$ext = !empty($path_parts['extension']) ? $path_parts['extension'] : '';
929
-	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) {
929
+	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) {
930 930
 		return nom_fichier_copie_locale($source, $ext);
931 931
 	}
932
-	spip_log("pas de copie locale pour $source", 'distant' . _LOG_ERREUR);
932
+	spip_log("pas de copie locale pour $source", 'distant'._LOG_ERREUR);
933 933
 }
934 934
 
935 935
 
@@ -1013,7 +1013,7 @@  discard block
 block discarded – undo
1013 1013
 		} else {
1014 1014
 			if ($a['body']) {
1015 1015
 				$a['extension'] = $extension;
1016
-				$a['fichier'] = _DIR_RACINE . nom_fichier_copie_locale($source, $extension);
1016
+				$a['fichier'] = _DIR_RACINE.nom_fichier_copie_locale($source, $extension);
1017 1017
 				ecrire_fichier($a['fichier'], $a['body']);
1018 1018
 				$size_image = @spip_getimagesize($a['fichier']);
1019 1019
 				$a['largeur'] = intval($size_image[0]);
@@ -1081,20 +1081,20 @@  discard block
 block discarded – undo
1081 1081
 			!$t
1082 1082
 			and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext)
1083 1083
 		) {
1084
-			$t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text'));
1084
+			$t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text'));
1085 1085
 		}
1086 1086
 		if (
1087 1087
 			!$t
1088 1088
 			and preg_match(',^Content-Disposition:\s*attachment;\s*filename=(.*)$,Uims', $headers, $m)
1089 1089
 			and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $m[1], $rext)
1090 1090
 		) {
1091
-			$t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text'));
1091
+			$t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text'));
1092 1092
 		}
1093 1093
 	}
1094 1094
 
1095 1095
 	// Autre mime/type (ou text/plain avec fichier d'extension inconnue)
1096 1096
 	if (!$t) {
1097
-		$t = sql_fetsel('extension', 'spip_types_documents', 'mime_type=' . sql_quote($mime_type));
1097
+		$t = sql_fetsel('extension', 'spip_types_documents', 'mime_type='.sql_quote($mime_type));
1098 1098
 	}
1099 1099
 
1100 1100
 	// Toujours rien ? (ex: audio/x-ogg au lieu de application/ogg)
@@ -1105,11 +1105,11 @@  discard block
 block discarded – undo
1105 1105
 		and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext)
1106 1106
 	) {
1107 1107
 		# eviter xxx.3 => 3gp (> SPIP 3)
1108
-		$t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text'));
1108
+		$t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text'));
1109 1109
 	}
1110 1110
 
1111 1111
 	if ($t) {
1112
-		spip_log("mime-type $mime_type ok, extension " . $t['extension'], 'distant');
1112
+		spip_log("mime-type $mime_type ok, extension ".$t['extension'], 'distant');
1113 1113
 		return $t['extension'];
1114 1114
 	} else {
1115 1115
 		# par defaut on retombe sur '.bin' si c'est autorise
@@ -1212,7 +1212,7 @@  discard block
 block discarded – undo
1212 1212
 		}
1213 1213
 	} else {
1214 1214
 		$scheme = $t['scheme'];
1215
-		$noproxy = $scheme . '://';
1215
+		$noproxy = $scheme.'://';
1216 1216
 	}
1217 1217
 	if (isset($t['user'])) {
1218 1218
 		$user = [$t['user'], $t['pass']];
@@ -1226,7 +1226,7 @@  discard block
 block discarded – undo
1226 1226
 	}
1227 1227
 
1228 1228
 	if (!empty($t['query'])) {
1229
-		$path .= '?' . $t['query'];
1229
+		$path .= '?'.$t['query'];
1230 1230
 	}
1231 1231
 
1232 1232
 	$f = lance_requete($method, $scheme, $user, $host, $path, $port, $noproxy, $refuse_gz, $referer, $datas, $vers, $date);
@@ -1300,29 +1300,29 @@  discard block
 block discarded – undo
1300 1300
 	$proxy_user = '';
1301 1301
 	$http_proxy = need_proxy($host);
1302 1302
 	if ($user) {
1303
-		$user = urlencode($user[0]) . ':' . urlencode($user[1]);
1303
+		$user = urlencode($user[0]).':'.urlencode($user[1]);
1304 1304
 	}
1305 1305
 
1306 1306
 	$connect = '';
1307 1307
 	if ($http_proxy) {
1308
-		if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, ['tls','ssl'])) {
1309
-			$path_host = (!$user ? '' : "$user@") . $host . (($port != 80) ? ":$port" : '');
1310
-			$connect = 'CONNECT ' . $path_host . " $vers\r\n"
1308
+		if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, ['tls', 'ssl'])) {
1309
+			$path_host = (!$user ? '' : "$user@").$host.(($port != 80) ? ":$port" : '');
1310
+			$connect = 'CONNECT '.$path_host." $vers\r\n"
1311 1311
 				. "Host: $path_host\r\n"
1312 1312
 				. "Proxy-Connection: Keep-Alive\r\n";
1313 1313
 		} else {
1314
-			$path = (in_array($scheme, ['tls','ssl']) ? 'https://' : "$scheme://")
1314
+			$path = (in_array($scheme, ['tls', 'ssl']) ? 'https://' : "$scheme://")
1315 1315
 				. (!$user ? '' : "$user@")
1316
-				. "$host" . (($port != 80) ? ":$port" : '') . $path;
1316
+				. "$host".(($port != 80) ? ":$port" : '').$path;
1317 1317
 		}
1318 1318
 		$t2 = @parse_url($http_proxy);
1319 1319
 		$first_host = $t2['host'];
1320 1320
 		$port = ($t2['port'] ?? null) ?: 80;
1321 1321
 		if ($t2['user'] ?? null) {
1322
-			$proxy_user = base64_encode($t2['user'] . ':' . $t2['pass']);
1322
+			$proxy_user = base64_encode($t2['user'].':'.$t2['pass']);
1323 1323
 		}
1324 1324
 	} else {
1325
-		$first_host = $noproxy . $host;
1325
+		$first_host = $noproxy.$host;
1326 1326
 	}
1327 1327
 
1328 1328
 	if ($connect) {
@@ -1344,7 +1344,7 @@  discard block
 block discarded – undo
1344 1344
 		);
1345 1345
 		spip_log("Recuperer $path sur $first_host:$port par $f (via CONNECT)", 'connect');
1346 1346
 		if (!$f) {
1347
-			spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR);
1347
+			spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR);
1348 1348
 			return $errno;
1349 1349
 		}
1350 1350
 		stream_set_timeout($f, _INC_DISTANT_CONNECT_TIMEOUT);
@@ -1357,7 +1357,7 @@  discard block
 block discarded – undo
1357 1357
 			or !count($res = explode(' ', $res))
1358 1358
 			or $res[1] !== '200'
1359 1359
 		) {
1360
-			spip_log("Echec CONNECT sur $first_host:$port", 'connect' . _LOG_INFO_IMPORTANTE);
1360
+			spip_log("Echec CONNECT sur $first_host:$port", 'connect'._LOG_INFO_IMPORTANTE);
1361 1361
 			fclose($f);
1362 1362
 
1363 1363
 			return false;
@@ -1374,7 +1374,7 @@  discard block
 block discarded – undo
1374 1374
 		} while (!$f and $ntry-- and $errno !== 110 and sleep(1));
1375 1375
 		spip_log("Recuperer $path sur $first_host:$port par $f");
1376 1376
 		if (!$f) {
1377
-			spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR);
1377
+			spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR);
1378 1378
 
1379 1379
 			return $errno;
1380 1380
 		}
@@ -1384,16 +1384,16 @@  discard block
 block discarded – undo
1384 1384
 	$site = $GLOBALS['meta']['adresse_site'] ?? '';
1385 1385
 
1386 1386
 	$host_port = $host;
1387
-	if ($port != (in_array($scheme, ['tls','ssl']) ? 443 : 80)) {
1387
+	if ($port != (in_array($scheme, ['tls', 'ssl']) ? 443 : 80)) {
1388 1388
 		$host_port .= ":$port";
1389 1389
 	}
1390 1390
 	$req = "$method $path $vers\r\n"
1391 1391
 		. "Host: $host_port\r\n"
1392
-		. 'User-Agent: ' . _INC_DISTANT_USER_AGENT . "\r\n"
1393
-		. ($refuse_gz ? '' : ('Accept-Encoding: ' . _INC_DISTANT_CONTENT_ENCODING . "\r\n"))
1392
+		. 'User-Agent: '._INC_DISTANT_USER_AGENT."\r\n"
1393
+		. ($refuse_gz ? '' : ('Accept-Encoding: '._INC_DISTANT_CONTENT_ENCODING."\r\n"))
1394 1394
 		. (!$site ? '' : "Referer: $site/$referer\r\n")
1395
-		. (!$date ? '' : 'If-Modified-Since: ' . (gmdate('D, d M Y H:i:s', $date) . " GMT\r\n"))
1396
-		. (!$user ? '' : ('Authorization: Basic ' . base64_encode($user) . "\r\n"))
1395
+		. (!$date ? '' : 'If-Modified-Since: '.(gmdate('D, d M Y H:i:s', $date)." GMT\r\n"))
1396
+		. (!$user ? '' : ('Authorization: Basic '.base64_encode($user)."\r\n"))
1397 1397
 		. (!$proxy_user ? '' : "Proxy-Authorization: Basic $proxy_user\r\n")
1398 1398
 		. (!strpos($vers, '1.1') ? '' : "Keep-Alive: 300\r\nConnection: keep-alive\r\n");
1399 1399
 
Please login to merge, or discard this patch.