Completed
Push — master ( 545544...680418 )
by cam
01:50
created
ecrire/inc/distant.php 1 patch
Spacing   +62 added lines, -62 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', 2097152);
@@ -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,13 +115,13 @@  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['status'], 'distant' . _LOG_INFO_IMPORTANTE);
118
+			spip_log("copie_locale : Echec recuperation $source sur $localrac status : ".$res['status'], 'distant'._LOG_INFO_IMPORTANTE);
119 119
 		}
120 120
 		if (!$res['length']) {
121 121
 			// si $t c'est sans doute juste un not-modified-since
122 122
 			return $t ? $local : false;
123 123
 		}
124
-		spip_log("copie_locale : recuperation $source sur $localrac taille " . $res['length'] . ' OK', 'distant');
124
+		spip_log("copie_locale : recuperation $source sur $localrac taille ".$res['length'].' OK', 'distant');
125 125
 
126 126
 		// si on retrouve l'extension
127 127
 		if (
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 
206 206
 	if (!$is_known_host) {
207 207
 		$host = trim($parsed_url['host'], '.');
208
-		if (! $ip = filter_var($host, FILTER_VALIDATE_IP)) {
208
+		if (!$ip = filter_var($host, FILTER_VALIDATE_IP)) {
209 209
 			$ip = gethostbyname($host);
210 210
 			if ($ip === $host) {
211 211
 				// Error condition for gethostbyname()
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 				foreach ($records as $record) {
216 216
 					// il faut que le TTL soit suffisant afin d'etre certain que le copie_locale eventuel qui suit
217 217
 					// se fasse sur la meme IP
218
-					if ($record['ttl']<10) {
218
+					if ($record['ttl'] < 10) {
219 219
 						$ip = false;
220 220
 						break;
221 221
 					}
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 			}
227 227
 		}
228 228
 		if ($ip) {
229
-			if (! filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
229
+			if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
230 230
 				return false;
231 231
 			}
232 232
 		}
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 	}
238 238
 
239 239
 	$port = $parsed_url['port'];
240
-	if ($port === 80  or $port === 443  or $port === 8080) {
240
+	if ($port === 80 or $port === 443 or $port === 8080) {
241 241
 		return $url;
242 242
 	}
243 243
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 				}
308 308
 			}
309 309
 			if ($taille > 500) {
310
-				$boundary = substr(md5(rand() . 'spip'), 0, 8);
310
+				$boundary = substr(md5(rand().'spip'), 0, 8);
311 311
 			}
312 312
 		}
313 313
 
@@ -335,16 +335,16 @@  discard block
 block discarded – undo
335 335
 			}
336 336
 		} else {
337 337
 			// fabrique une chaine HTTP simple pour un POST
338
-			$entete = 'Content-Type: application/x-www-form-urlencoded' . "\r\n";
338
+			$entete = 'Content-Type: application/x-www-form-urlencoded'."\r\n";
339 339
 			$chaine = [];
340 340
 			if (is_array($donnees)) {
341 341
 				foreach ($donnees as $cle => $valeur) {
342 342
 					if (is_array($valeur)) {
343 343
 						foreach ($valeur as $val2) {
344
-							$chaine[] = rawurlencode($cle) . '[]=' . rawurlencode($val2);
344
+							$chaine[] = rawurlencode($cle).'[]='.rawurlencode($val2);
345 345
 						}
346 346
 					} else {
347
-						$chaine[] = rawurlencode($cle) . '=' . rawurlencode($valeur);
347
+						$chaine[] = rawurlencode($cle).'='.rawurlencode($valeur);
348 348
 					}
349 349
 				}
350 350
 				$chaine = implode('&', $chaine);
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 			$url_idn = implode($host_ascii, $url_idn);
379 379
 		}
380 380
 		// et on urlencode les char utf si besoin dans le path
381
-		$url_idn = preg_replace_callback('/[^\x20-\x7f]/', function ($match) {
381
+		$url_idn = preg_replace_callback('/[^\x20-\x7f]/', function($match) {
382 382
  return urlencode($match[0]);
383 383
 		}, $url_idn);
384 384
 	}
@@ -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
 		list($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(mt_rand())) . '.tmp.gz');
583
+		$gz = (_DIR_TMP.md5(uniqid(mt_rand())).'.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
 
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
 	$fp = false;
720 720
 	if ($fichier) {
721 721
 		include_spip('inc/acces');
722
-		$tmpfile = "$fichier." . creer_uniqid() . '.tmp';
722
+		$tmpfile = "$fichier.".creer_uniqid().'.tmp';
723 723
 		$fp = spip_fopen_lock($tmpfile, 'w', LOCK_EX);
724 724
 		if (!$fp and file_exists($fichier)) {
725 725
 			return filesize($fichier);
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
 	}
779 779
 	$result['status'] = intval($r[1]);
780 780
 	while ($s = trim(fgets($handle, 16384))) {
781
-		$result['headers'][] = $s . "\n";
781
+		$result['headers'][] = $s."\n";
782 782
 		preg_match(',^([^:]*): *(.*)$,i', $s, $r);
783 783
 		list(, $d, $v) = $r;
784 784
 		if (strtolower(trim($d)) == 'location' and $result['status'] >= 300 and $result['status'] < 400) {
@@ -827,13 +827,13 @@  discard block
 block discarded – undo
827 827
 
828 828
 	// on se place tout le temps comme si on etait a la racine
829 829
 	if (_DIR_RACINE) {
830
-		$d = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $d);
830
+		$d = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $d);
831 831
 	}
832 832
 
833 833
 	$m = md5($source);
834 834
 
835 835
 	return $d
836
-	. substr(preg_replace(',[^\w-],', '', basename($source)) . '-' . $m, 0, 12)
836
+	. substr(preg_replace(',[^\w-],', '', basename($source)).'-'.$m, 0, 12)
837 837
 	. substr($m, 0, 4)
838 838
 	. ".$extension";
839 839
 }
@@ -856,7 +856,7 @@  discard block
 block discarded – undo
856 856
 	// Si c'est deja local pas de souci
857 857
 	if (!tester_url_absolue($source)) {
858 858
 		if (_DIR_RACINE) {
859
-			$source = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $source);
859
+			$source = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $source);
860 860
 		}
861 861
 
862 862
 		return $source;
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
 		$ext
875 875
 		and preg_match(',^\w+$,', $ext) // pas de php?truc=1&...
876 876
 		and $f = nom_fichier_copie_locale($source, $ext)
877
-		and file_exists(_DIR_RACINE . $f)
877
+		and file_exists(_DIR_RACINE.$f)
878 878
 	) {
879 879
 		return $f;
880 880
 	}
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
 
883 883
 	// Si c'est deja dans la table des documents,
884 884
 	// ramener le nom de sa copie potentielle
885
-	$ext = sql_getfetsel('extension', 'spip_documents', 'fichier=' . sql_quote($source) . " AND distant='oui' AND extension <> ''");
885
+	$ext = sql_getfetsel('extension', 'spip_documents', 'fichier='.sql_quote($source)." AND distant='oui' AND extension <> ''");
886 886
 
887 887
 	if ($ext) {
888 888
 		return nom_fichier_copie_locale($source, $ext);
@@ -893,9 +893,9 @@  discard block
 block discarded – undo
893 893
 
894 894
 	$ext = $path_parts ? $path_parts['extension'] : '';
895 895
 
896
-	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) {
896
+	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) {
897 897
 		$f = nom_fichier_copie_locale($source, $ext);
898
-		if (file_exists(_DIR_RACINE . $f)) {
898
+		if (file_exists(_DIR_RACINE.$f)) {
899 899
 			return $f;
900 900
 		}
901 901
 	}
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
 	// Ping  pour voir si son extension est connue et autorisee
904 904
 	// avec mise en cache du resultat du ping
905 905
 
906
-	$cache = sous_repertoire(_DIR_CACHE, 'rid') . md5($source);
906
+	$cache = sous_repertoire(_DIR_CACHE, 'rid').md5($source);
907 907
 	if (
908 908
 		!@file_exists($cache)
909 909
 		or !$path_parts = @unserialize(spip_file_get_contents($cache))
@@ -913,10 +913,10 @@  discard block
 block discarded – undo
913 913
 		ecrire_fichier($cache, serialize($path_parts));
914 914
 	}
915 915
 	$ext = !empty($path_parts['extension']) ? $path_parts['extension'] : '';
916
-	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) {
916
+	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) {
917 917
 		return nom_fichier_copie_locale($source, $ext);
918 918
 	}
919
-	spip_log("pas de copie locale pour $source", 'distant' . _LOG_ERREUR);
919
+	spip_log("pas de copie locale pour $source", 'distant'._LOG_ERREUR);
920 920
 }
921 921
 
922 922
 
@@ -1000,7 +1000,7 @@  discard block
 block discarded – undo
1000 1000
 		} else {
1001 1001
 			if ($a['body']) {
1002 1002
 				$a['extension'] = $extension;
1003
-				$a['fichier'] = _DIR_RACINE . nom_fichier_copie_locale($source, $extension);
1003
+				$a['fichier'] = _DIR_RACINE.nom_fichier_copie_locale($source, $extension);
1004 1004
 				ecrire_fichier($a['fichier'], $a['body']);
1005 1005
 				$size_image = @spip_getimagesize($a['fichier']);
1006 1006
 				$a['largeur'] = intval($size_image[0]);
@@ -1068,20 +1068,20 @@  discard block
 block discarded – undo
1068 1068
 			!$t
1069 1069
 			and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext)
1070 1070
 		) {
1071
-			$t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text'));
1071
+			$t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text'));
1072 1072
 		}
1073 1073
 		if (
1074 1074
 			!$t
1075 1075
 			and preg_match(',^Content-Disposition:\s*attachment;\s*filename=(.*)$,Uims', $headers, $m)
1076 1076
 			and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $m[1], $rext)
1077 1077
 		) {
1078
-			$t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text'));
1078
+			$t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text'));
1079 1079
 		}
1080 1080
 	}
1081 1081
 
1082 1082
 	// Autre mime/type (ou text/plain avec fichier d'extension inconnue)
1083 1083
 	if (!$t) {
1084
-		$t = sql_fetsel('extension', 'spip_types_documents', 'mime_type=' . sql_quote($mime_type));
1084
+		$t = sql_fetsel('extension', 'spip_types_documents', 'mime_type='.sql_quote($mime_type));
1085 1085
 	}
1086 1086
 
1087 1087
 	// Toujours rien ? (ex: audio/x-ogg au lieu de application/ogg)
@@ -1092,11 +1092,11 @@  discard block
 block discarded – undo
1092 1092
 		and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext)
1093 1093
 	) {
1094 1094
 		# eviter xxx.3 => 3gp (> SPIP 3)
1095
-		$t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text'));
1095
+		$t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text'));
1096 1096
 	}
1097 1097
 
1098 1098
 	if ($t) {
1099
-		spip_log("mime-type $mime_type ok, extension " . $t['extension'], 'distant');
1099
+		spip_log("mime-type $mime_type ok, extension ".$t['extension'], 'distant');
1100 1100
 		return $t['extension'];
1101 1101
 	} else {
1102 1102
 		# par defaut on retombe sur '.bin' si c'est autorise
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
 		}
1200 1200
 	} else {
1201 1201
 		$scheme = $t['scheme'];
1202
-		$noproxy = $scheme . '://';
1202
+		$noproxy = $scheme.'://';
1203 1203
 	}
1204 1204
 	if (isset($t['user'])) {
1205 1205
 		$user = [$t['user'], $t['pass']];
@@ -1213,7 +1213,7 @@  discard block
 block discarded – undo
1213 1213
 	}
1214 1214
 
1215 1215
 	if (!empty($t['query'])) {
1216
-		$path .= '?' . $t['query'];
1216
+		$path .= '?'.$t['query'];
1217 1217
 	}
1218 1218
 
1219 1219
 	$f = lance_requete($method, $scheme, $user, $host, $path, $port, $noproxy, $refuse_gz, $referer, $datas, $vers, $date);
@@ -1287,20 +1287,20 @@  discard block
 block discarded – undo
1287 1287
 	$proxy_user = '';
1288 1288
 	$http_proxy = need_proxy($host);
1289 1289
 	if ($user) {
1290
-		$user = urlencode($user[0]) . ':' . urlencode($user[1]);
1290
+		$user = urlencode($user[0]).':'.urlencode($user[1]);
1291 1291
 	}
1292 1292
 
1293 1293
 	$connect = '';
1294 1294
 	if ($http_proxy) {
1295
-		if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, ['tls','ssl'])) {
1296
-			$path_host = (!$user ? '' : "$user@") . $host . (($port != 80) ? ":$port" : '');
1297
-			$connect = 'CONNECT ' . $path_host . " $vers\r\n"
1295
+		if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, ['tls', 'ssl'])) {
1296
+			$path_host = (!$user ? '' : "$user@").$host.(($port != 80) ? ":$port" : '');
1297
+			$connect = 'CONNECT '.$path_host." $vers\r\n"
1298 1298
 				. "Host: $path_host\r\n"
1299 1299
 				. "Proxy-Connection: Keep-Alive\r\n";
1300 1300
 		} else {
1301
-			$path = (in_array($scheme, ['tls','ssl']) ? 'https://' : "$scheme://")
1301
+			$path = (in_array($scheme, ['tls', 'ssl']) ? 'https://' : "$scheme://")
1302 1302
 				. (!$user ? '' : "$user@")
1303
-				. "$host" . (($port != 80) ? ":$port" : '') . $path;
1303
+				. "$host".(($port != 80) ? ":$port" : '').$path;
1304 1304
 		}
1305 1305
 		$t2 = @parse_url($http_proxy);
1306 1306
 		$first_host = $t2['host'];
@@ -1308,10 +1308,10 @@  discard block
 block discarded – undo
1308 1308
 			$port = 80;
1309 1309
 		}
1310 1310
 		if ($t2['user']) {
1311
-			$proxy_user = base64_encode($t2['user'] . ':' . $t2['pass']);
1311
+			$proxy_user = base64_encode($t2['user'].':'.$t2['pass']);
1312 1312
 		}
1313 1313
 	} else {
1314
-		$first_host = $noproxy . $host;
1314
+		$first_host = $noproxy.$host;
1315 1315
 	}
1316 1316
 
1317 1317
 	if ($connect) {
@@ -1333,7 +1333,7 @@  discard block
 block discarded – undo
1333 1333
 		);
1334 1334
 		spip_log("Recuperer $path sur $first_host:$port par $f (via CONNECT)", 'connect');
1335 1335
 		if (!$f) {
1336
-			spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR);
1336
+			spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR);
1337 1337
 			return $errno;
1338 1338
 		}
1339 1339
 		stream_set_timeout($f, _INC_DISTANT_CONNECT_TIMEOUT);
@@ -1346,7 +1346,7 @@  discard block
 block discarded – undo
1346 1346
 			or !count($res = explode(' ', $res))
1347 1347
 			or $res[1] !== '200'
1348 1348
 		) {
1349
-			spip_log("Echec CONNECT sur $first_host:$port", 'connect' . _LOG_INFO_IMPORTANTE);
1349
+			spip_log("Echec CONNECT sur $first_host:$port", 'connect'._LOG_INFO_IMPORTANTE);
1350 1350
 			fclose($f);
1351 1351
 
1352 1352
 			return false;
@@ -1363,7 +1363,7 @@  discard block
 block discarded – undo
1363 1363
 		} while (!$f and $ntry-- and $errno !== 110 and sleep(1));
1364 1364
 		spip_log("Recuperer $path sur $first_host:$port par $f");
1365 1365
 		if (!$f) {
1366
-			spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR);
1366
+			spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR);
1367 1367
 
1368 1368
 			return $errno;
1369 1369
 		}
@@ -1373,16 +1373,16 @@  discard block
 block discarded – undo
1373 1373
 	$site = isset($GLOBALS['meta']['adresse_site']) ? $GLOBALS['meta']['adresse_site'] : '';
1374 1374
 
1375 1375
 	$host_port = $host;
1376
-	if ($port != (in_array($scheme, ['tls','ssl']) ? 443 : 80)) {
1376
+	if ($port != (in_array($scheme, ['tls', 'ssl']) ? 443 : 80)) {
1377 1377
 		$host_port .= ":$port";
1378 1378
 	}
1379 1379
 	$req = "$method $path $vers\r\n"
1380 1380
 		. "Host: $host_port\r\n"
1381
-		. 'User-Agent: ' . _INC_DISTANT_USER_AGENT . "\r\n"
1382
-		. ($refuse_gz ? '' : ('Accept-Encoding: ' . _INC_DISTANT_CONTENT_ENCODING . "\r\n"))
1381
+		. 'User-Agent: '._INC_DISTANT_USER_AGENT."\r\n"
1382
+		. ($refuse_gz ? '' : ('Accept-Encoding: '._INC_DISTANT_CONTENT_ENCODING."\r\n"))
1383 1383
 		. (!$site ? '' : "Referer: $site/$referer\r\n")
1384
-		. (!$date ? '' : 'If-Modified-Since: ' . (gmdate('D, d M Y H:i:s', $date) . " GMT\r\n"))
1385
-		. (!$user ? '' : ('Authorization: Basic ' . base64_encode($user) . "\r\n"))
1384
+		. (!$date ? '' : 'If-Modified-Since: '.(gmdate('D, d M Y H:i:s', $date)." GMT\r\n"))
1385
+		. (!$user ? '' : ('Authorization: Basic '.base64_encode($user)."\r\n"))
1386 1386
 		. (!$proxy_user ? '' : "Proxy-Authorization: Basic $proxy_user\r\n")
1387 1387
 		. (!strpos($vers, '1.1') ? '' : "Keep-Alive: 300\r\nConnection: keep-alive\r\n");
1388 1388
 
Please login to merge, or discard this patch.