Completed
Push — master ( 4ccf90...a418a7 )
by cam
01:11
created
ecrire/inc/distant.php 1 patch
Spacing   +61 added lines, -61 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 (!empty($res['headers'])
@@ -216,8 +216,8 @@  discard block
 block discarded – undo
216 216
 			$parts = array_map('intval', explode('.', $ip));
217 217
 			if (
218 218
 				127 === $parts[0] or 10 === $parts[0] or 0 === $parts[0]
219
-				or ( 172 === $parts[0] and 16 <= $parts[1] and 31 >= $parts[1] )
220
-				or ( 192 === $parts[0] && 168 === $parts[1] )
219
+				or (172 === $parts[0] and 16 <= $parts[1] and 31 >= $parts[1])
220
+				or (192 === $parts[0] && 168 === $parts[1])
221 221
 			) {
222 222
 				return false;
223 223
 			}
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	}
230 230
 
231 231
 	$port = $parsed_url['port'];
232
-	if ($port === 80  or $port === 443  or $port === 8080) {
232
+	if ($port === 80 or $port === 443 or $port === 8080) {
233 233
 		return $url;
234 234
 	}
235 235
 
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 				}
300 300
 			}
301 301
 			if ($taille > 500) {
302
-				$boundary = substr(md5(rand() . 'spip'), 0, 8);
302
+				$boundary = substr(md5(rand().'spip'), 0, 8);
303 303
 			}
304 304
 		}
305 305
 
@@ -327,16 +327,16 @@  discard block
 block discarded – undo
327 327
 			}
328 328
 		} else {
329 329
 			// fabrique une chaine HTTP simple pour un POST
330
-			$entete = 'Content-Type: application/x-www-form-urlencoded' . "\r\n";
330
+			$entete = 'Content-Type: application/x-www-form-urlencoded'."\r\n";
331 331
 			$chaine = [];
332 332
 			if (is_array($donnees)) {
333 333
 				foreach ($donnees as $cle => $valeur) {
334 334
 					if (is_array($valeur)) {
335 335
 						foreach ($valeur as $val2) {
336
-							$chaine[] = rawurlencode($cle) . '[]=' . rawurlencode($val2);
336
+							$chaine[] = rawurlencode($cle).'[]='.rawurlencode($val2);
337 337
 						}
338 338
 					} else {
339
-						$chaine[] = rawurlencode($cle) . '=' . rawurlencode($valeur);
339
+						$chaine[] = rawurlencode($cle).'='.rawurlencode($valeur);
340 340
 					}
341 341
 				}
342 342
 				$chaine = implode('&', $chaine);
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 			$url_idn = implode($host_ascii, $url_idn);
371 371
 		}
372 372
 		// et on urlencode les char utf si besoin dans le path
373
-		$url_idn = preg_replace_callback('/[^\x20-\x7f]/', function ($match) {
373
+		$url_idn = preg_replace_callback('/[^\x20-\x7f]/', function($match) {
374 374
  return urlencode($match[0]);
375 375
 		}, $url_idn);
376 376
 	}
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 	$head_add = '';
449 449
 	if (!empty($options['headers'])) {
450 450
 		foreach ($options['headers'] as $champ => $valeur) {
451
-			$head_add .= $champ . ': ' . $valeur . "\r\n";
451
+			$head_add .= $champ.': '.$valeur."\r\n";
452 452
 		}
453 453
 		// ne pas le repasser a recuperer_url si on follow un location, car ils seront dans datas
454 454
 		unset($options['headers']);
@@ -458,9 +458,9 @@  discard block
 block discarded – undo
458 458
 		list($head, $postdata) = prepare_donnees_post($options['datas'], $options['boundary']);
459 459
 		$head .= $head_add;
460 460
 		if (stripos($head, 'Content-Length:') === false) {
461
-			$head .= 'Content-Length: ' . strlen($postdata) . "\r\n";
461
+			$head .= 'Content-Length: '.strlen($postdata)."\r\n";
462 462
 		}
463
-		$options['datas'] = $head . "\r\n" . $postdata;
463
+		$options['datas'] = $head."\r\n".$postdata;
464 464
 		if (
465 465
 			strlen($postdata)
466 466
 			and !$methode_demandee
@@ -468,15 +468,15 @@  discard block
 block discarded – undo
468 468
 			$options['methode'] = 'POST';
469 469
 		}
470 470
 	} elseif ($head_add) {
471
-		$options['datas'] = $head_add . "\r\n";
471
+		$options['datas'] = $head_add."\r\n";
472 472
 	}
473 473
 
474 474
 	// Accepter les URLs au format feed:// ou qui ont oublie le http:// ou les urls relatives au protocole
475 475
 	$url = preg_replace(',^feed://,i', 'http://', $url);
476 476
 	if (!tester_url_absolue($url)) {
477
-		$url = 'http://' . $url;
477
+		$url = 'http://'.$url;
478 478
 	} elseif (strncmp($url, '//', 2) == 0) {
479
-		$url = 'http:' . $url;
479
+		$url = 'http:'.$url;
480 480
 	}
481 481
 
482 482
 	$url = url_to_ascii($url);
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 		$options['if_modified_since']
506 506
 	);
507 507
 	if (!$handle) {
508
-		spip_log("ECHEC init_http $url", 'distant' . _LOG_ERREUR);
508
+		spip_log("ECHEC init_http $url", 'distant'._LOG_ERREUR);
509 509
 
510 510
 		return false;
511 511
 	}
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 					'status' => 200,
536 536
 				];
537 537
 			} else {
538
-				spip_log("ECHEC chinoiserie $url", 'distant' . _LOG_ERREUR);
538
+				spip_log("ECHEC chinoiserie $url", 'distant'._LOG_ERREUR);
539 539
 				return false;
540 540
 			}
541 541
 		} elseif ($res['location'] and $options['follow_location']) {
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 
548 548
 			return recuperer_url($url, $options);
549 549
 		} elseif ($res['status'] !== 200) {
550
-			spip_log('HTTP status ' . $res['status'] . " pour $url", 'distant');
550
+			spip_log('HTTP status '.$res['status']." pour $url", 'distant');
551 551
 		}
552 552
 		$result['status'] = $res['status'];
553 553
 		if (isset($res['headers'])) {
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
 
573 573
 	$gz = false;
574 574
 	if (preg_match(",\bContent-Encoding: .*gzip,is", $result['headers'])) {
575
-		$gz = (_DIR_TMP . md5(uniqid(mt_rand())) . '.tmp.gz');
575
+		$gz = (_DIR_TMP.md5(uniqid(mt_rand())).'.tmp.gz');
576 576
 	}
577 577
 
578 578
 	// si on a pas deja recuperer le contenu par une methode detournee
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 	$sig['url'] = $url;
659 659
 
660 660
 	$dir = sous_repertoire(_DIR_CACHE, 'curl');
661
-	$cache = md5(serialize($sig)) . '-' . substr(preg_replace(',\W+,', '_', $url), 0, 80);
661
+	$cache = md5(serialize($sig)).'-'.substr(preg_replace(',\W+,', '_', $url), 0, 80);
662 662
 	$sub = sous_repertoire($dir, substr($cache, 0, 2));
663 663
 	$cache = "$sub$cache";
664 664
 
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
 	$fp = false;
712 712
 	if ($fichier) {
713 713
 		include_spip('inc/acces');
714
-		$tmpfile = "$fichier." . creer_uniqid() . '.tmp';
714
+		$tmpfile = "$fichier.".creer_uniqid().'.tmp';
715 715
 		$fp = spip_fopen_lock($tmpfile, 'w', LOCK_EX);
716 716
 		if (!$fp and file_exists($fichier)) {
717 717
 			return filesize($fichier);
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
 	}
771 771
 	$result['status'] = intval($r[1]);
772 772
 	while ($s = trim(fgets($handle, 16384))) {
773
-		$result['headers'][] = $s . "\n";
773
+		$result['headers'][] = $s."\n";
774 774
 		preg_match(',^([^:]*): *(.*)$,i', $s, $r);
775 775
 		list(, $d, $v) = $r;
776 776
 		if (strtolower(trim($d)) == 'location' and $result['status'] >= 300 and $result['status'] < 400) {
@@ -819,13 +819,13 @@  discard block
 block discarded – undo
819 819
 
820 820
 	// on se place tout le temps comme si on etait a la racine
821 821
 	if (_DIR_RACINE) {
822
-		$d = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $d);
822
+		$d = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $d);
823 823
 	}
824 824
 
825 825
 	$m = md5($source);
826 826
 
827 827
 	return $d
828
-	. substr(preg_replace(',[^\w-],', '', basename($source)) . '-' . $m, 0, 12)
828
+	. substr(preg_replace(',[^\w-],', '', basename($source)).'-'.$m, 0, 12)
829 829
 	. substr($m, 0, 4)
830 830
 	. ".$extension";
831 831
 }
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
 	// Si c'est deja local pas de souci
849 849
 	if (!tester_url_absolue($source)) {
850 850
 		if (_DIR_RACINE) {
851
-			$source = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $source);
851
+			$source = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $source);
852 852
 		}
853 853
 
854 854
 		return $source;
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
 		$ext
867 867
 		and preg_match(',^\w+$,', $ext) // pas de php?truc=1&...
868 868
 		and $f = nom_fichier_copie_locale($source, $ext)
869
-		and file_exists(_DIR_RACINE . $f)
869
+		and file_exists(_DIR_RACINE.$f)
870 870
 	) {
871 871
 		return $f;
872 872
 	}
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
 
875 875
 	// Si c'est deja dans la table des documents,
876 876
 	// ramener le nom de sa copie potentielle
877
-	$ext = sql_getfetsel('extension', 'spip_documents', 'fichier=' . sql_quote($source) . " AND distant='oui' AND extension <> ''");
877
+	$ext = sql_getfetsel('extension', 'spip_documents', 'fichier='.sql_quote($source)." AND distant='oui' AND extension <> ''");
878 878
 
879 879
 	if ($ext) {
880 880
 		return nom_fichier_copie_locale($source, $ext);
@@ -885,9 +885,9 @@  discard block
 block discarded – undo
885 885
 
886 886
 	$ext = $path_parts ? $path_parts['extension'] : '';
887 887
 
888
-	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) {
888
+	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) {
889 889
 		$f = nom_fichier_copie_locale($source, $ext);
890
-		if (file_exists(_DIR_RACINE . $f)) {
890
+		if (file_exists(_DIR_RACINE.$f)) {
891 891
 			return $f;
892 892
 		}
893 893
 	}
@@ -895,7 +895,7 @@  discard block
 block discarded – undo
895 895
 	// Ping  pour voir si son extension est connue et autorisee
896 896
 	// avec mise en cache du resultat du ping
897 897
 
898
-	$cache = sous_repertoire(_DIR_CACHE, 'rid') . md5($source);
898
+	$cache = sous_repertoire(_DIR_CACHE, 'rid').md5($source);
899 899
 	if (
900 900
 		!@file_exists($cache)
901 901
 		or !$path_parts = @unserialize(spip_file_get_contents($cache))
@@ -905,10 +905,10 @@  discard block
 block discarded – undo
905 905
 		ecrire_fichier($cache, serialize($path_parts));
906 906
 	}
907 907
 	$ext = !empty($path_parts['extension']) ? $path_parts['extension'] : '';
908
-	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) {
908
+	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) {
909 909
 		return nom_fichier_copie_locale($source, $ext);
910 910
 	}
911
-	spip_log("pas de copie locale pour $source", 'distant' . _LOG_ERREUR);
911
+	spip_log("pas de copie locale pour $source", 'distant'._LOG_ERREUR);
912 912
 }
913 913
 
914 914
 
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
 		} else {
993 993
 			if ($a['body']) {
994 994
 				$a['extension'] = $extension;
995
-				$a['fichier'] = _DIR_RACINE . nom_fichier_copie_locale($source, $extension);
995
+				$a['fichier'] = _DIR_RACINE.nom_fichier_copie_locale($source, $extension);
996 996
 				ecrire_fichier($a['fichier'], $a['body']);
997 997
 				$size_image = @spip_getimagesize($a['fichier']);
998 998
 				$a['largeur'] = intval($size_image[0]);
@@ -1057,20 +1057,20 @@  discard block
 block discarded – undo
1057 1057
 			!$t
1058 1058
 			and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext)
1059 1059
 		) {
1060
-			$t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($rext[1], '', 'text'));
1060
+			$t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote($rext[1], '', 'text'));
1061 1061
 		}
1062 1062
 		if (
1063 1063
 			!$t
1064 1064
 			and preg_match(',^Content-Disposition:\s*attachment;\s*filename=(.*)$,Uims', $headers, $m)
1065 1065
 			and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $m[1], $rext)
1066 1066
 		) {
1067
-			$t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($rext[1], '', 'text'));
1067
+			$t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote($rext[1], '', 'text'));
1068 1068
 		}
1069 1069
 	}
1070 1070
 
1071 1071
 	// Autre mime/type (ou text/plain avec fichier d'extension inconnue)
1072 1072
 	if (!$t) {
1073
-		$t = sql_fetsel('extension', 'spip_types_documents', 'mime_type=' . sql_quote($mime_type));
1073
+		$t = sql_fetsel('extension', 'spip_types_documents', 'mime_type='.sql_quote($mime_type));
1074 1074
 	}
1075 1075
 
1076 1076
 	// Toujours rien ? (ex: audio/x-ogg au lieu de application/ogg)
@@ -1081,11 +1081,11 @@  discard block
 block discarded – undo
1081 1081
 		and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext)
1082 1082
 	) {
1083 1083
 		# eviter xxx.3 => 3gp (> SPIP 3)
1084
-		$t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($rext[1], '', 'text'));
1084
+		$t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote($rext[1], '', 'text'));
1085 1085
 	}
1086 1086
 
1087 1087
 	if ($t) {
1088
-		spip_log("mime-type $mime_type ok, extension " . $t['extension'], 'distant');
1088
+		spip_log("mime-type $mime_type ok, extension ".$t['extension'], 'distant');
1089 1089
 		return $t['extension'];
1090 1090
 	} else {
1091 1091
 		# par defaut on retombe sur '.bin' si c'est autorise
@@ -1188,7 +1188,7 @@  discard block
 block discarded – undo
1188 1188
 		}
1189 1189
 	} else {
1190 1190
 		$scheme = $t['scheme'];
1191
-		$noproxy = $scheme . '://';
1191
+		$noproxy = $scheme.'://';
1192 1192
 	}
1193 1193
 	if (isset($t['user'])) {
1194 1194
 		$user = [$t['user'], $t['pass']];
@@ -1202,7 +1202,7 @@  discard block
 block discarded – undo
1202 1202
 	}
1203 1203
 
1204 1204
 	if (!empty($t['query'])) {
1205
-		$path .= '?' . $t['query'];
1205
+		$path .= '?'.$t['query'];
1206 1206
 	}
1207 1207
 
1208 1208
 	$f = lance_requete($method, $scheme, $user, $host, $path, $port, $noproxy, $refuse_gz, $referer, $datas, $vers, $date);
@@ -1276,20 +1276,20 @@  discard block
 block discarded – undo
1276 1276
 	$proxy_user = '';
1277 1277
 	$http_proxy = need_proxy($host);
1278 1278
 	if ($user) {
1279
-		$user = urlencode($user[0]) . ':' . urlencode($user[1]);
1279
+		$user = urlencode($user[0]).':'.urlencode($user[1]);
1280 1280
 	}
1281 1281
 
1282 1282
 	$connect = '';
1283 1283
 	if ($http_proxy) {
1284
-		if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, ['tls','ssl'])) {
1285
-			$path_host = (!$user ? '' : "$user@") . $host . (($port != 80) ? ":$port" : '');
1286
-			$connect = 'CONNECT ' . $path_host . " $vers\r\n"
1284
+		if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, ['tls', 'ssl'])) {
1285
+			$path_host = (!$user ? '' : "$user@").$host.(($port != 80) ? ":$port" : '');
1286
+			$connect = 'CONNECT '.$path_host." $vers\r\n"
1287 1287
 				. "Host: $path_host\r\n"
1288 1288
 				. "Proxy-Connection: Keep-Alive\r\n";
1289 1289
 		} else {
1290
-			$path = (in_array($scheme, ['tls','ssl']) ? 'https://' : "$scheme://")
1290
+			$path = (in_array($scheme, ['tls', 'ssl']) ? 'https://' : "$scheme://")
1291 1291
 				. (!$user ? '' : "$user@")
1292
-				. "$host" . (($port != 80) ? ":$port" : '') . $path;
1292
+				. "$host".(($port != 80) ? ":$port" : '').$path;
1293 1293
 		}
1294 1294
 		$t2 = @parse_url($http_proxy);
1295 1295
 		$first_host = $t2['host'];
@@ -1297,10 +1297,10 @@  discard block
 block discarded – undo
1297 1297
 			$port = 80;
1298 1298
 		}
1299 1299
 		if ($t2['user']) {
1300
-			$proxy_user = base64_encode($t2['user'] . ':' . $t2['pass']);
1300
+			$proxy_user = base64_encode($t2['user'].':'.$t2['pass']);
1301 1301
 		}
1302 1302
 	} else {
1303
-		$first_host = $noproxy . $host;
1303
+		$first_host = $noproxy.$host;
1304 1304
 	}
1305 1305
 
1306 1306
 	if ($connect) {
@@ -1322,7 +1322,7 @@  discard block
 block discarded – undo
1322 1322
 		);
1323 1323
 		spip_log("Recuperer $path sur $first_host:$port par $f (via CONNECT)", 'connect');
1324 1324
 		if (!$f) {
1325
-			spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR);
1325
+			spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR);
1326 1326
 			return $errno;
1327 1327
 		}
1328 1328
 		stream_set_timeout($f, _INC_DISTANT_CONNECT_TIMEOUT);
@@ -1335,7 +1335,7 @@  discard block
 block discarded – undo
1335 1335
 			or !count($res = explode(' ', $res))
1336 1336
 			or $res[1] !== '200'
1337 1337
 		) {
1338
-			spip_log("Echec CONNECT sur $first_host:$port", 'connect' . _LOG_INFO_IMPORTANTE);
1338
+			spip_log("Echec CONNECT sur $first_host:$port", 'connect'._LOG_INFO_IMPORTANTE);
1339 1339
 			fclose($f);
1340 1340
 
1341 1341
 			return false;
@@ -1352,7 +1352,7 @@  discard block
 block discarded – undo
1352 1352
 		} while (!$f and $ntry-- and $errno !== 110 and sleep(1));
1353 1353
 		spip_log("Recuperer $path sur $first_host:$port par $f");
1354 1354
 		if (!$f) {
1355
-			spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR);
1355
+			spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR);
1356 1356
 
1357 1357
 			return $errno;
1358 1358
 		}
@@ -1362,16 +1362,16 @@  discard block
 block discarded – undo
1362 1362
 	$site = isset($GLOBALS['meta']['adresse_site']) ? $GLOBALS['meta']['adresse_site'] : '';
1363 1363
 
1364 1364
 	$host_port = $host;
1365
-	if ($port != (in_array($scheme, ['tls','ssl']) ? 443 : 80)) {
1365
+	if ($port != (in_array($scheme, ['tls', 'ssl']) ? 443 : 80)) {
1366 1366
 		$host_port .= ":$port";
1367 1367
 	}
1368 1368
 	$req = "$method $path $vers\r\n"
1369 1369
 		. "Host: $host_port\r\n"
1370
-		. 'User-Agent: ' . _INC_DISTANT_USER_AGENT . "\r\n"
1371
-		. ($refuse_gz ? '' : ('Accept-Encoding: ' . _INC_DISTANT_CONTENT_ENCODING . "\r\n"))
1370
+		. 'User-Agent: '._INC_DISTANT_USER_AGENT."\r\n"
1371
+		. ($refuse_gz ? '' : ('Accept-Encoding: '._INC_DISTANT_CONTENT_ENCODING."\r\n"))
1372 1372
 		. (!$site ? '' : "Referer: $site/$referer\r\n")
1373
-		. (!$date ? '' : 'If-Modified-Since: ' . (gmdate('D, d M Y H:i:s', $date) . " GMT\r\n"))
1374
-		. (!$user ? '' : ('Authorization: Basic ' . base64_encode($user) . "\r\n"))
1373
+		. (!$date ? '' : 'If-Modified-Since: '.(gmdate('D, d M Y H:i:s', $date)." GMT\r\n"))
1374
+		. (!$user ? '' : ('Authorization: Basic '.base64_encode($user)."\r\n"))
1375 1375
 		. (!$proxy_user ? '' : "Proxy-Authorization: Basic $proxy_user\r\n")
1376 1376
 		. (!strpos($vers, '1.1') ? '' : "Keep-Alive: 300\r\nConnection: keep-alive\r\n");
1377 1377
 
Please login to merge, or discard this patch.