Completed
Push — master ( dd2fb4...c380f1 )
by cam
01:09
created
ecrire/inc/distant.php 1 patch
Spacing   +65 added lines, -65 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?:',
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 
73 73
 	// si c'est la protection de soi-meme, retourner le path
74 74
 	if ($mode !== 'force' and preg_match(_REGEXP_COPIE_LOCALE, $source, $match)) {
75
-		$source = substr(_DIR_IMG, strlen(_DIR_RACINE)) . urldecode($match[1]);
75
+		$source = substr(_DIR_IMG, strlen(_DIR_RACINE)).urldecode($match[1]);
76 76
 
77 77
 		return @file_exists($source) ? $source : false;
78 78
 	}
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 		return false;
93 93
 	}
94 94
 
95
-	$localrac = _DIR_RACINE . $local;
95
+	$localrac = _DIR_RACINE.$local;
96 96
 	$t = ($mode === 'force') ? false : @file_exists($localrac);
97 97
 
98 98
 	// test d'existence du fichier
@@ -112,18 +112,18 @@  discard block
 block discarded – undo
112 112
 		if (!$taille_max) {
113 113
 			$taille_max = _COPIE_LOCALE_MAX_SIZE;
114 114
 		}
115
-		$localrac_tmp = $localrac . '.tmp';
115
+		$localrac_tmp = $localrac.'.tmp';
116 116
 		$res = recuperer_url(
117 117
 			$source,
118 118
 			['file' => $localrac_tmp, 'taille_max' => $taille_max, 'if_modified_since' => $t ? filemtime($localrac) : '']
119 119
 		);
120 120
 
121 121
 		if (!$res or (!$res['length'] and $res['status'] != 304)) {
122
-			spip_log("copie_locale : Echec recuperation $source sur $localrac_tmp status : " . ($res ? $res['status'] : '-'), 'distant' . _LOG_INFO_IMPORTANTE);
122
+			spip_log("copie_locale : Echec recuperation $source sur $localrac_tmp status : ".($res ? $res['status'] : '-'), 'distant'._LOG_INFO_IMPORTANTE);
123 123
 			@unlink($localrac_tmp);
124 124
 		}
125 125
 		else {
126
-			spip_log("copie_locale : recuperation $source sur $localrac_tmp OK | taille " . $res['length'] . ' status ' . $res['status'], 'distant');
126
+			spip_log("copie_locale : recuperation $source sur $localrac_tmp OK | taille ".$res['length'].' status '.$res['status'], 'distant');
127 127
 		}
128 128
 		if (!$res or !$res['length']) {
129 129
 			// si $t c'est sans doute juste un not-modified-since
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 			and is_callable($callback_valider_url)
137 137
 			and !$callback_valider_url($res['url'])
138 138
 		) {
139
-			spip_log('copie_locale : url finale ' . $res['url'] . " non valide, on refuse le fichier $localrac_tmp", 'distant' . _LOG_INFO_IMPORTANTE);
139
+			spip_log('copie_locale : url finale '.$res['url']." non valide, on refuse le fichier $localrac_tmp", 'distant'._LOG_INFO_IMPORTANTE);
140 140
 			@unlink($localrac_tmp);
141 141
 			return $t ? $local : false;
142 142
 		}
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
 	if (!$is_known_host) {
229 229
 		$host = trim($parsed_url['host'], '.');
230
-		if (! $ip = filter_var($host, FILTER_VALIDATE_IP)) {
230
+		if (!$ip = filter_var($host, FILTER_VALIDATE_IP)) {
231 231
 			$ip = gethostbyname($host);
232 232
 			if ($ip === $host) {
233 233
 				// Error condition for gethostbyname()
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 			}
249 249
 		}
250 250
 		if ($ip) {
251
-			if (! filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
251
+			if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
252 252
 				return false;
253 253
 			}
254 254
 		}
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	}
260 260
 
261 261
 	$port = $parsed_url['port'];
262
-	if ($port === 80  or $port === 443  or $port === 8080) {
262
+	if ($port === 80 or $port === 443 or $port === 8080) {
263 263
 		return $url;
264 264
 	}
265 265
 
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 				}
330 330
 			}
331 331
 			if ($taille > 500) {
332
-				$boundary = substr(md5(random_int(0, mt_getrandmax()) . 'spip'), 0, 8);
332
+				$boundary = substr(md5(random_int(0, mt_getrandmax()).'spip'), 0, 8);
333 333
 			}
334 334
 		}
335 335
 
@@ -357,16 +357,16 @@  discard block
 block discarded – undo
357 357
 			}
358 358
 		} else {
359 359
 			// fabrique une chaine HTTP simple pour un POST
360
-			$entete = 'Content-Type: application/x-www-form-urlencoded' . "\r\n";
360
+			$entete = 'Content-Type: application/x-www-form-urlencoded'."\r\n";
361 361
 			$chaine = [];
362 362
 			if (is_array($donnees)) {
363 363
 				foreach ($donnees as $cle => $valeur) {
364 364
 					if (is_array($valeur)) {
365 365
 						foreach ($valeur as $val2) {
366
-							$chaine[] = rawurlencode($cle) . '[]=' . rawurlencode($val2);
366
+							$chaine[] = rawurlencode($cle).'[]='.rawurlencode($val2);
367 367
 						}
368 368
 					} else {
369
-						$chaine[] = rawurlencode($cle) . '=' . rawurlencode($valeur);
369
+						$chaine[] = rawurlencode($cle).'='.rawurlencode($valeur);
370 370
 					}
371 371
 				}
372 372
 				$chaine = implode('&', $chaine);
@@ -471,13 +471,13 @@  discard block
 block discarded – undo
471 471
 		$options['taille_max'] = $copy ? _COPIE_LOCALE_MAX_SIZE : _INC_DISTANT_MAX_SIZE;
472 472
 	}
473 473
 
474
-	spip_log('recuperer_url ' . $options['methode'] . " sur $url", 'distant' . _LOG_DEBUG);
474
+	spip_log('recuperer_url '.$options['methode']." sur $url", 'distant'._LOG_DEBUG);
475 475
 
476 476
 	// Ajout des en-têtes spécifiques si besoin
477 477
 	$formatted_data = '';
478 478
 	if (!empty($options['headers'])) {
479 479
 		foreach ($options['headers'] as $champ => $valeur) {
480
-			$formatted_data .= $champ . ': ' . $valeur . "\r\n";
480
+			$formatted_data .= $champ.': '.$valeur."\r\n";
481 481
 		}
482 482
 	}
483 483
 
@@ -485,9 +485,9 @@  discard block
 block discarded – undo
485 485
 		[$head, $postdata] = prepare_donnees_post($options['datas'], $options['boundary']);
486 486
 		$head .= $formatted_data;
487 487
 		if (stripos($head, 'Content-Length:') === false) {
488
-			$head .= 'Content-Length: ' . strlen($postdata) . "\r\n";
488
+			$head .= 'Content-Length: '.strlen($postdata)."\r\n";
489 489
 		}
490
-		$formatted_data = $head . "\r\n" . $postdata;
490
+		$formatted_data = $head."\r\n".$postdata;
491 491
 		if (
492 492
 			strlen($postdata)
493 493
 			and !$methode_demandee
@@ -501,9 +501,9 @@  discard block
 block discarded – undo
501 501
 	// Accepter les URLs au format feed:// ou qui ont oublie le http:// ou les urls relatives au protocole
502 502
 	$url = preg_replace(',^feed://,i', 'http://', $url);
503 503
 	if (!tester_url_absolue($url)) {
504
-		$url = 'http://' . $url;
504
+		$url = 'http://'.$url;
505 505
 	} elseif (strncmp($url, '//', 2) == 0) {
506
-		$url = 'http:' . $url;
506
+		$url = 'http:'.$url;
507 507
 	}
508 508
 
509 509
 	$url = url_to_ascii($url);
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 		$options['if_modified_since']
533 533
 	);
534 534
 	if (!$handle) {
535
-		spip_log("ECHEC init_http $url", 'distant' . _LOG_ERREUR);
535
+		spip_log("ECHEC init_http $url", 'distant'._LOG_ERREUR);
536 536
 
537 537
 		return false;
538 538
 	}
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 					'status' => 200,
563 563
 				];
564 564
 			} else {
565
-				spip_log("ECHEC chinoiserie $url", 'distant' . _LOG_ERREUR);
565
+				spip_log("ECHEC chinoiserie $url", 'distant'._LOG_ERREUR);
566 566
 				return false;
567 567
 			}
568 568
 		} elseif ($res['location'] and $options['follow_location']) {
@@ -578,11 +578,11 @@  discard block
 block discarded – undo
578 578
 					$options['datas'] = '';
579 579
 				}
580 580
 			}
581
-			spip_log('recuperer_url recommence ' . $options['methode'] . " sur $url", 'distant' . _LOG_DEBUG);
581
+			spip_log('recuperer_url recommence '.$options['methode']." sur $url", 'distant'._LOG_DEBUG);
582 582
 
583 583
 			return recuperer_url($url, $options);
584 584
 		} elseif ($res['status'] !== 200) {
585
-			spip_log('HTTP status ' . $res['status'] . " pour $url", 'distant');
585
+			spip_log('HTTP status '.$res['status']." pour $url", 'distant');
586 586
 		}
587 587
 		$result['status'] = $res['status'];
588 588
 		if (isset($res['headers'])) {
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
 
599 599
 	// on ne veut que les entetes
600 600
 	if (!$options['taille_max'] or $options['methode'] == 'HEAD' or $result['status'] == '304') {
601
-		spip_log('RESULTAT recuperer_url ' . $options['methode'] . " sur $url : " . json_encode($result), 'distant' . _LOG_DEBUG);
601
+		spip_log('RESULTAT recuperer_url '.$options['methode']." sur $url : ".json_encode($result), 'distant'._LOG_DEBUG);
602 602
 		return $result;
603 603
 	}
604 604
 
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 
609 609
 	$gz = false;
610 610
 	if (preg_match(",\bContent-Encoding: .*gzip,is", $result['headers'])) {
611
-		$gz = (_DIR_TMP . md5(uniqid(random_int(0, mt_getrandmax()))) . '.tmp.gz');
611
+		$gz = (_DIR_TMP.md5(uniqid(random_int(0, mt_getrandmax()))).'.tmp.gz');
612 612
 	}
613 613
 
614 614
 	// si on a pas deja recuperer le contenu par une methode detournee
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
 
645 645
 	$trace = json_decode(json_encode($result), true);
646 646
 	$trace['page'] = '...';
647
-	spip_log('RESULTAT recuperer_url ' . $options['methode'] . " sur $url : " . json_encode($trace), 'distant' . _LOG_DEBUG);
647
+	spip_log('RESULTAT recuperer_url '.$options['methode']." sur $url : ".json_encode($trace), 'distant'._LOG_DEBUG);
648 648
 
649 649
 	return $result;
650 650
 }
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
 	$sig['url'] = $url;
699 699
 
700 700
 	$dir = sous_repertoire(_DIR_CACHE, 'curl');
701
-	$cache = md5(serialize($sig)) . '-' . substr(preg_replace(',\W+,', '_', $url), 0, 80);
701
+	$cache = md5(serialize($sig)).'-'.substr(preg_replace(',\W+,', '_', $url), 0, 80);
702 702
 	$sub = sous_repertoire($dir, substr($cache, 0, 2));
703 703
 	$cache = "$sub$cache";
704 704
 
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
 	$fp = false;
753 753
 	if ($fichier) {
754 754
 		include_spip('inc/acces');
755
-		$tmpfile = "$fichier." . creer_uniqid() . '.tmp';
755
+		$tmpfile = "$fichier.".creer_uniqid().'.tmp';
756 756
 		$fp = spip_fopen_lock($tmpfile, 'w', LOCK_EX);
757 757
 		if (!$fp and file_exists($fichier)) {
758 758
 			return filesize($fichier);
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
 	}
812 812
 	$result['status'] = intval($r[1]);
813 813
 	while ($s = trim(fgets($handle, 16384))) {
814
-		$result['headers'][] = $s . "\n";
814
+		$result['headers'][] = $s."\n";
815 815
 		preg_match(',^([^:]*): *(.*)$,i', $s, $r);
816 816
 		[, $d, $v] = $r;
817 817
 		if (strtolower(trim($d)) == 'location' and $result['status'] >= 300 and $result['status'] < 400) {
@@ -860,13 +860,13 @@  discard block
 block discarded – undo
860 860
 
861 861
 	// on se place tout le temps comme si on etait a la racine
862 862
 	if (_DIR_RACINE) {
863
-		$d = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $d);
863
+		$d = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $d);
864 864
 	}
865 865
 
866 866
 	$m = md5($source);
867 867
 
868 868
 	return $d
869
-	. substr(preg_replace(',[^\w-],', '', basename($source)) . '-' . $m, 0, 12)
869
+	. substr(preg_replace(',[^\w-],', '', basename($source)).'-'.$m, 0, 12)
870 870
 	. substr($m, 0, 4)
871 871
 	. ".$extension";
872 872
 }
@@ -889,7 +889,7 @@  discard block
 block discarded – undo
889 889
 	// Si c'est deja local pas de souci
890 890
 	if (!tester_url_absolue($source)) {
891 891
 		if (_DIR_RACINE) {
892
-			$source = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $source);
892
+			$source = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $source);
893 893
 		}
894 894
 
895 895
 		return $source;
@@ -907,7 +907,7 @@  discard block
 block discarded – undo
907 907
 		$ext
908 908
 		and preg_match(',^\w+$,', $ext) // pas de php?truc=1&...
909 909
 		and $f = nom_fichier_copie_locale($source, $ext)
910
-		and file_exists(_DIR_RACINE . $f)
910
+		and file_exists(_DIR_RACINE.$f)
911 911
 	) {
912 912
 		return $f;
913 913
 	}
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
 
916 916
 	// Si c'est deja dans la table des documents,
917 917
 	// ramener le nom de sa copie potentielle
918
-	$ext = sql_getfetsel('extension', 'spip_documents', 'fichier=' . sql_quote($source) . " AND distant='oui' AND extension <> ''");
918
+	$ext = sql_getfetsel('extension', 'spip_documents', 'fichier='.sql_quote($source)." AND distant='oui' AND extension <> ''");
919 919
 
920 920
 	if ($ext) {
921 921
 		return nom_fichier_copie_locale($source, $ext);
@@ -926,9 +926,9 @@  discard block
 block discarded – undo
926 926
 
927 927
 	$ext = $path_parts ? $path_parts['extension'] : '';
928 928
 
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
 		$f = nom_fichier_copie_locale($source, $ext);
931
-		if (file_exists(_DIR_RACINE . $f)) {
931
+		if (file_exists(_DIR_RACINE.$f)) {
932 932
 			return $f;
933 933
 		}
934 934
 	}
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
 	// Ping  pour voir si son extension est connue et autorisee
937 937
 	// avec mise en cache du resultat du ping
938 938
 
939
-	$cache = sous_repertoire(_DIR_CACHE, 'rid') . md5($source);
939
+	$cache = sous_repertoire(_DIR_CACHE, 'rid').md5($source);
940 940
 	if (
941 941
 		!@file_exists($cache)
942 942
 		or !$path_parts = @unserialize(spip_file_get_contents($cache))
@@ -946,10 +946,10 @@  discard block
 block discarded – undo
946 946
 		ecrire_fichier($cache, serialize($path_parts));
947 947
 	}
948 948
 	$ext = !empty($path_parts['extension']) ? $path_parts['extension'] : '';
949
-	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) {
949
+	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) {
950 950
 		return nom_fichier_copie_locale($source, $ext);
951 951
 	}
952
-	spip_log("pas de copie locale pour $source", 'distant' . _LOG_ERREUR);
952
+	spip_log("pas de copie locale pour $source", 'distant'._LOG_ERREUR);
953 953
 }
954 954
 
955 955
 
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
 		} else {
1048 1048
 			if ($a['body']) {
1049 1049
 				$a['extension'] = $extension;
1050
-				$a['fichier'] = _DIR_RACINE . nom_fichier_copie_locale($source, $extension);
1050
+				$a['fichier'] = _DIR_RACINE.nom_fichier_copie_locale($source, $extension);
1051 1051
 				ecrire_fichier($a['fichier'], $a['body']);
1052 1052
 				$size_image = @spip_getimagesize($a['fichier']);
1053 1053
 				$a['largeur'] = intval($size_image[0]);
@@ -1115,20 +1115,20 @@  discard block
 block discarded – undo
1115 1115
 			!$t
1116 1116
 			and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext)
1117 1117
 		) {
1118
-			$t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text'));
1118
+			$t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text'));
1119 1119
 		}
1120 1120
 		if (
1121 1121
 			!$t
1122 1122
 			and preg_match(',^Content-Disposition:\s*attachment;\s*filename=(.*)$,Uims', $headers, $m)
1123 1123
 			and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $m[1], $rext)
1124 1124
 		) {
1125
-			$t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text'));
1125
+			$t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text'));
1126 1126
 		}
1127 1127
 	}
1128 1128
 
1129 1129
 	// Autre mime/type (ou text/plain avec fichier d'extension inconnue)
1130 1130
 	if (!$t) {
1131
-		$t = sql_fetsel('extension', 'spip_types_documents', 'mime_type=' . sql_quote($mime_type));
1131
+		$t = sql_fetsel('extension', 'spip_types_documents', 'mime_type='.sql_quote($mime_type));
1132 1132
 	}
1133 1133
 
1134 1134
 	// Toujours rien ? (ex: audio/x-ogg au lieu de application/ogg)
@@ -1139,11 +1139,11 @@  discard block
 block discarded – undo
1139 1139
 		and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext)
1140 1140
 	) {
1141 1141
 		# eviter xxx.3 => 3gp (> SPIP 3)
1142
-		$t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text'));
1142
+		$t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text'));
1143 1143
 	}
1144 1144
 
1145 1145
 	if ($t) {
1146
-		spip_log("mime-type $mime_type ok, extension " . $t['extension'], 'distant');
1146
+		spip_log("mime-type $mime_type ok, extension ".$t['extension'], 'distant');
1147 1147
 		return $t['extension'];
1148 1148
 	} else {
1149 1149
 		# par defaut on retombe sur '.bin' si c'est autorise
@@ -1246,7 +1246,7 @@  discard block
 block discarded – undo
1246 1246
 		}
1247 1247
 	} else {
1248 1248
 		$scheme = $t['scheme'];
1249
-		$noproxy = $scheme . '://';
1249
+		$noproxy = $scheme.'://';
1250 1250
 	}
1251 1251
 	if (isset($t['user'])) {
1252 1252
 		$user = [$t['user'], $t['pass']];
@@ -1260,7 +1260,7 @@  discard block
 block discarded – undo
1260 1260
 	}
1261 1261
 
1262 1262
 	if (!empty($t['query'])) {
1263
-		$path .= '?' . $t['query'];
1263
+		$path .= '?'.$t['query'];
1264 1264
 	}
1265 1265
 
1266 1266
 	$f = lance_requete($method, $scheme, $user, $host, $path, $port, $noproxy, $refuse_gz, $referer, $datas, $vers, $date);
@@ -1334,29 +1334,29 @@  discard block
 block discarded – undo
1334 1334
 	$proxy_user = '';
1335 1335
 	$http_proxy = need_proxy($host);
1336 1336
 	if ($user) {
1337
-		$user = urlencode($user[0]) . ':' . urlencode($user[1]);
1337
+		$user = urlencode($user[0]).':'.urlencode($user[1]);
1338 1338
 	}
1339 1339
 
1340 1340
 	$connect = '';
1341 1341
 	if ($http_proxy) {
1342
-		if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, ['tls','ssl'])) {
1343
-			$path_host = (!$user ? '' : "$user@") . $host . (($port != 80) ? ":$port" : '');
1344
-			$connect = 'CONNECT ' . $path_host . " $vers\r\n"
1342
+		if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, ['tls', 'ssl'])) {
1343
+			$path_host = (!$user ? '' : "$user@").$host.(($port != 80) ? ":$port" : '');
1344
+			$connect = 'CONNECT '.$path_host." $vers\r\n"
1345 1345
 				. "Host: $path_host\r\n"
1346 1346
 				. "Proxy-Connection: Keep-Alive\r\n";
1347 1347
 		} else {
1348
-			$path = (in_array($scheme, ['tls','ssl']) ? 'https://' : "$scheme://")
1348
+			$path = (in_array($scheme, ['tls', 'ssl']) ? 'https://' : "$scheme://")
1349 1349
 				. (!$user ? '' : "$user@")
1350
-				. "$host" . (($port != 80) ? ":$port" : '') . $path;
1350
+				. "$host".(($port != 80) ? ":$port" : '').$path;
1351 1351
 		}
1352 1352
 		$t2 = @parse_url($http_proxy);
1353 1353
 		$first_host = $t2['host'];
1354 1354
 		$port = ($t2['port'] ?? null) ?: 80;
1355 1355
 		if ($t2['user'] ?? null) {
1356
-			$proxy_user = base64_encode($t2['user'] . ':' . $t2['pass']);
1356
+			$proxy_user = base64_encode($t2['user'].':'.$t2['pass']);
1357 1357
 		}
1358 1358
 	} else {
1359
-		$first_host = $noproxy . $host;
1359
+		$first_host = $noproxy.$host;
1360 1360
 	}
1361 1361
 
1362 1362
 	if ($connect) {
@@ -1378,7 +1378,7 @@  discard block
 block discarded – undo
1378 1378
 		);
1379 1379
 		spip_log("Recuperer $path sur $first_host:$port par $f (via CONNECT)", 'connect');
1380 1380
 		if (!$f) {
1381
-			spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR);
1381
+			spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR);
1382 1382
 			return $errno;
1383 1383
 		}
1384 1384
 		stream_set_timeout($f, _INC_DISTANT_CONNECT_TIMEOUT);
@@ -1391,7 +1391,7 @@  discard block
 block discarded – undo
1391 1391
 			or !count($res = explode(' ', $res))
1392 1392
 			or $res[1] !== '200'
1393 1393
 		) {
1394
-			spip_log("Echec CONNECT sur $first_host:$port", 'connect' . _LOG_INFO_IMPORTANTE);
1394
+			spip_log("Echec CONNECT sur $first_host:$port", 'connect'._LOG_INFO_IMPORTANTE);
1395 1395
 			fclose($f);
1396 1396
 
1397 1397
 			return false;
@@ -1408,7 +1408,7 @@  discard block
 block discarded – undo
1408 1408
 		} while (!$f and $ntry-- and $errno !== 110 and sleep(1));
1409 1409
 		spip_log("Recuperer $path sur $first_host:$port par $f");
1410 1410
 		if (!$f) {
1411
-			spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR);
1411
+			spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR);
1412 1412
 
1413 1413
 			return $errno;
1414 1414
 		}
@@ -1418,16 +1418,16 @@  discard block
 block discarded – undo
1418 1418
 	$site = $GLOBALS['meta']['adresse_site'] ?? '';
1419 1419
 
1420 1420
 	$host_port = $host;
1421
-	if ($port != (in_array($scheme, ['tls','ssl']) ? 443 : 80)) {
1421
+	if ($port != (in_array($scheme, ['tls', 'ssl']) ? 443 : 80)) {
1422 1422
 		$host_port .= ":$port";
1423 1423
 	}
1424 1424
 	$req = "$method $path $vers\r\n"
1425 1425
 		. "Host: $host_port\r\n"
1426
-		. 'User-Agent: ' . _INC_DISTANT_USER_AGENT . "\r\n"
1427
-		. ($refuse_gz ? '' : ('Accept-Encoding: ' . _INC_DISTANT_CONTENT_ENCODING . "\r\n"))
1426
+		. 'User-Agent: '._INC_DISTANT_USER_AGENT."\r\n"
1427
+		. ($refuse_gz ? '' : ('Accept-Encoding: '._INC_DISTANT_CONTENT_ENCODING."\r\n"))
1428 1428
 		. (!$site ? '' : "Referer: $site/$referer\r\n")
1429
-		. (!$date ? '' : 'If-Modified-Since: ' . (gmdate('D, d M Y H:i:s', $date) . " GMT\r\n"))
1430
-		. (!$user ? '' : ('Authorization: Basic ' . base64_encode($user) . "\r\n"))
1429
+		. (!$date ? '' : 'If-Modified-Since: '.(gmdate('D, d M Y H:i:s', $date)." GMT\r\n"))
1430
+		. (!$user ? '' : ('Authorization: Basic '.base64_encode($user)."\r\n"))
1431 1431
 		. (!$proxy_user ? '' : "Proxy-Authorization: Basic $proxy_user\r\n")
1432 1432
 		. (!strpos($vers, '1.1') ? '' : "Keep-Alive: 300\r\nConnection: keep-alive\r\n");
1433 1433
 
Please login to merge, or discard this patch.
ecrire/install/etape_ldap2.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	$adresse_ldap = filter_var($adresse_ldap, FILTER_SANITIZE_URL) ?: '';
49 49
 
50 50
 	$ldap_link = ldap_connect($adresse_ldap, $port_ldap);
51
-	$erreur = 'ldap_connect(' . spip_htmlspecialchars($adresse_ldap) . ', ' . spip_htmlspecialchars($port_ldap) . ')';
51
+	$erreur = 'ldap_connect('.spip_htmlspecialchars($adresse_ldap).', '.spip_htmlspecialchars($port_ldap).')';
52 52
 
53 53
 	if ($ldap_link) {
54 54
 		if (!ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap)) {
@@ -57,19 +57,19 @@  discard block
 block discarded – undo
57 57
 		}
58 58
 		if ($tls === true) {
59 59
 			if (!ldap_start_tls($ldap_link)) {
60
-				$erreur = 'ldap_start_tls(' . spip_htmlspecialchars($ldap_link)
61
-					. ' ' . spip_htmlspecialchars($adresse_ldap)
62
-					. ', ' . spip_htmlspecialchars($port_ldap) . ')';
60
+				$erreur = 'ldap_start_tls('.spip_htmlspecialchars($ldap_link)
61
+					. ' '.spip_htmlspecialchars($adresse_ldap)
62
+					. ', '.spip_htmlspecialchars($port_ldap).')';
63 63
 				$ldap_link = false;
64 64
 			}
65 65
 		}
66 66
 		if ($ldap_link) {
67 67
 			$ldap_link = ldap_bind($ldap_link, $login_ldap, $pass_ldap);
68
-			$erreur = "ldap_bind('" . spip_htmlspecialchars($ldap_link)
69
-				. "', '" . spip_htmlspecialchars($login_ldap)
70
-				. "', '" . spip_htmlspecialchars($pass_ldap)
71
-				. "'): " . spip_htmlspecialchars($adresse_ldap)
72
-				. ', ' . spip_htmlspecialchars($port_ldap);
68
+			$erreur = "ldap_bind('".spip_htmlspecialchars($ldap_link)
69
+				. "', '".spip_htmlspecialchars($login_ldap)
70
+				. "', '".spip_htmlspecialchars($pass_ldap)
71
+				. "'): ".spip_htmlspecialchars($adresse_ldap)
72
+				. ', '.spip_htmlspecialchars($port_ldap);
73 73
 		}
74 74
 	}
75 75
 
@@ -77,22 +77,22 @@  discard block
 block discarded – undo
77 77
 		echo info_etape(
78 78
 			_T('titre_connexion_ldap'),
79 79
 			info_progression_etape(2, 'etape_ldap', 'install/')
80
-		),  _T('info_connexion_ldap_ok');
80
+		), _T('info_connexion_ldap_ok');
81 81
 		echo generer_form_ecrire('install', (
82 82
 			"\n<input type='hidden' name='etape' value='ldap3' />"
83
-			. "\n<input type='hidden' name='adresse_ldap' value=\"" . spip_htmlspecialchars($adresse_ldap) . '" />'
84
-			. "\n<input type='hidden' name='port_ldap' value=\"" . spip_htmlspecialchars($port_ldap) . '" />'
85
-			. "\n<input type='hidden' name='login_ldap' value=\"" . spip_htmlspecialchars($login_ldap) . '" />'
86
-			. "\n<input type='hidden' name='pass_ldap' value=\"" . spip_htmlspecialchars($pass_ldap) . '" />'
87
-			. "\n<input type='hidden' name='protocole_ldap' value=\"" . spip_htmlspecialchars($protocole_ldap) . '" />'
88
-			. "\n<input type='hidden' name='tls_ldap' value=\"" . spip_htmlspecialchars($tls_ldap) . '" />'
83
+			. "\n<input type='hidden' name='adresse_ldap' value=\"".spip_htmlspecialchars($adresse_ldap).'" />'
84
+			. "\n<input type='hidden' name='port_ldap' value=\"".spip_htmlspecialchars($port_ldap).'" />'
85
+			. "\n<input type='hidden' name='login_ldap' value=\"".spip_htmlspecialchars($login_ldap).'" />'
86
+			. "\n<input type='hidden' name='pass_ldap' value=\"".spip_htmlspecialchars($pass_ldap).'" />'
87
+			. "\n<input type='hidden' name='protocole_ldap' value=\"".spip_htmlspecialchars($protocole_ldap).'" />'
88
+			. "\n<input type='hidden' name='tls_ldap' value=\"".spip_htmlspecialchars($tls_ldap).'" />'
89 89
 			. bouton_suivant()));
90 90
 	} else {
91 91
 		echo info_etape(_T('titre_connexion_ldap')), info_progression_etape(1, 'etape_ldap', 'install/', true),
92
-			"<div class='error'><p>" . _T('avis_connexion_ldap_echec_1') . '</p>',
93
-			'<p>' . _T('avis_connexion_ldap_echec_2') .
94
-			"<br />\n" . _T('avis_connexion_ldap_echec_3') .
95
-			'<br /><br />' . $erreur . '<b> ?</b></p></div>';
92
+			"<div class='error'><p>"._T('avis_connexion_ldap_echec_1').'</p>',
93
+			'<p>'._T('avis_connexion_ldap_echec_2').
94
+			"<br />\n"._T('avis_connexion_ldap_echec_3').
95
+			'<br /><br />'.$erreur.'<b> ?</b></p></div>';
96 96
 	}
97 97
 
98 98
 	echo install_fin_html();
Please login to merge, or discard this patch.
ecrire/install/etape_3.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		= spip_connect_db($adresse_db, $port, $login_db, $pass_db, '', $server_db);
45 45
 
46 46
 	$GLOBALS['connexions'][$server_db][$GLOBALS['spip_sql_version']]
47
-		= $GLOBALS['spip_' . $server_db . '_functions_' . $GLOBALS['spip_sql_version']];
47
+		= $GLOBALS['spip_'.$server_db.'_functions_'.$GLOBALS['spip_sql_version']];
48 48
 
49 49
 	$fquery = sql_serveur('query', $server_db);
50 50
 	if ($choix_db == 'new_spip') {
@@ -54,13 +54,13 @@  discard block
 block discarded – undo
54 54
 			if (!$ok) {
55 55
 				$re = "Impossible de creer la base $re";
56 56
 				spip_log($re);
57
-				return '<p>' . _T('avis_connexion_erreur_creer_base') . "</p><!--\n$re\n-->";
57
+				return '<p>'._T('avis_connexion_erreur_creer_base')."</p><!--\n$re\n-->";
58 58
 			}
59 59
 		} else {
60 60
 			$re = "Le nom de la base doit correspondre a $re";
61 61
 			spip_log($re);
62 62
 
63
-			return '<p>' . _T('avis_connexion_erreur_nom_base') . "</p><!--\n$re\n-->";
63
+			return '<p>'._T('avis_connexion_erreur_nom_base')."</p><!--\n$re\n-->";
64 64
 		}
65 65
 	}
66 66
 
@@ -71,14 +71,14 @@  discard block
 block discarded – undo
71 71
 		= spip_connect_db($adresse_db, $port, $login_db, $pass_db, $sel_db, $server_db);
72 72
 
73 73
 	$GLOBALS['connexions'][$server_db][$GLOBALS['spip_sql_version']]
74
-		= $GLOBALS['spip_' . $server_db . '_functions_' . $GLOBALS['spip_sql_version']];
74
+		= $GLOBALS['spip_'.$server_db.'_functions_'.$GLOBALS['spip_sql_version']];
75 75
 
76 76
 	// Completer le tableau decrivant la connexion
77 77
 
78 78
 	$GLOBALS['connexions'][$server_db]['prefixe'] = $table_prefix;
79 79
 	$GLOBALS['connexions'][$server_db]['db'] = $sel_db;
80 80
 
81
-	$old = sql_showbase($table_prefix . '_meta', $server_db);
81
+	$old = sql_showbase($table_prefix.'_meta', $server_db);
82 82
 	if ($old) {
83 83
 		$old = sql_fetch($old, $server_db);
84 84
 	}
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 				$charset['charset'];
98 98
 			$charsetbase = $charset['charset'];
99 99
 		} else {
100
-			spip_log(_DEFAULT_CHARSET . ' inconnu du serveur SQL');
100
+			spip_log(_DEFAULT_CHARSET.' inconnu du serveur SQL');
101 101
 			$charsetbase = 'standard';
102 102
 		}
103 103
 		spip_log("Creation des tables. Codage $charsetbase");
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 		if ($r) {
148 148
 			$r = sql_fetch($r, $server_db);
149 149
 		}
150
-		$version_installee = !$r ? 0 : (double)$r['valeur'];
150
+		$version_installee = !$r ? 0 : (double) $r['valeur'];
151 151
 		if (!$version_installee or ($GLOBALS['spip_version_base'] < $version_installee)) {
152 152
 			$fupdateq(
153 153
 				'spip_meta',
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 				'',
157 157
 				$server_db
158 158
 			);
159
-			spip_log('nouvelle version installee: ' . $GLOBALS['spip_version_base']);
159
+			spip_log('nouvelle version installee: '.$GLOBALS['spip_version_base']);
160 160
 		}
161 161
 		// eliminer la derniere operation d'admin mal terminee
162 162
 		// notamment la mise a jour
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	if ($chmod_db) {
184 184
 		install_fichier_connexion(
185 185
 			_FILE_CHMOD_TMP,
186
-			"if (!defined('_SPIP_CHMOD')) define('_SPIP_CHMOD', " . sprintf('0%3o', $chmod_db) . ");\n"
186
+			"if (!defined('_SPIP_CHMOD')) define('_SPIP_CHMOD', ".sprintf('0%3o', $chmod_db).");\n"
187 187
 		);
188 188
 	}
189 189
 
@@ -246,16 +246,16 @@  discard block
 block discarded – undo
246 246
 
247 247
 
248 248
 function install_premier_auteur($email, $login, $nom, $pass, $hidden, $auteur_obligatoire) {
249
-	return info_progression_etape(3, 'etape_', 'install/') .
249
+	return info_progression_etape(3, 'etape_', 'install/').
250 250
 	info_etape(
251 251
 		_T('info_informations_personnelles'),
252
-		'<b>' . _T('texte_informations_personnelles_1') . '</b>' .
253
-		aider('install5', true) .
254
-		'<p>' .
252
+		'<b>'._T('texte_informations_personnelles_1').'</b>'.
253
+		aider('install5', true).
254
+		'<p>'.
255 255
 		($auteur_obligatoire ?
256 256
 			''
257 257
 			:
258
-			_T('texte_informations_personnelles_2') . ' ' . _T('info_laisser_champs_vides')
258
+			_T('texte_informations_personnelles_2').' '._T('info_laisser_champs_vides')
259 259
 		)
260 260
 	)
261 261
 	. generer_form_ecrire('install', (
@@ -265,12 +265,12 @@  discard block
 block discarded – undo
265 265
 			_T('info_identification_publique'),
266 266
 			[
267 267
 				'nom' => [
268
-					'label' => '<b>' . _T('entree_signature') . "</b><br />\n" . _T('entree_nom_pseudo_1') . "\n",
268
+					'label' => '<b>'._T('entree_signature')."</b><br />\n"._T('entree_nom_pseudo_1')."\n",
269 269
 					'valeur' => $nom,
270 270
 					'required' => $auteur_obligatoire,
271 271
 				],
272 272
 				'email' => [
273
-					'label' => '<b>' . _T('entree_adresse_email') . "</b>\n",
273
+					'label' => '<b>'._T('entree_adresse_email')."</b>\n",
274 274
 					'valeur' => $email,
275 275
 				]
276 276
 			]
@@ -280,23 +280,23 @@  discard block
 block discarded – undo
280 280
 			_T('entree_identifiants_connexion'),
281 281
 			[
282 282
 				'login' => [
283
-					'label' => '<b>' . _T('entree_login') . "</b><br />\n" . _T(
283
+					'label' => '<b>'._T('entree_login')."</b><br />\n"._T(
284 284
 						'info_login_trop_court_car_pluriel',
285 285
 						['nb' => _LOGIN_TROP_COURT]
286
-					) . "\n",
286
+					)."\n",
287 287
 					'valeur' => $login,
288 288
 					'required' => $auteur_obligatoire,
289 289
 				],
290 290
 				'pass' => [
291
-					'label' => '<b>' . _T('entree_mot_passe') . "</b><br />\n" . _T(
291
+					'label' => '<b>'._T('entree_mot_passe')."</b><br />\n"._T(
292 292
 						'info_passe_trop_court_car_pluriel',
293 293
 						['nb' => _PASS_LONGUEUR_MINI]
294
-					) . "\n",
294
+					)."\n",
295 295
 					'valeur' => $pass,
296 296
 					'required' => $auteur_obligatoire,
297 297
 				],
298 298
 				'pass_verif' => [
299
-					'label' => '<b>' . _T('info_confirmer_passe') . "</b><br />\n",
299
+					'label' => '<b>'._T('info_confirmer_passe')."</b><br />\n",
300 300
 					'valeur' => $pass,
301 301
 					'required' => $auteur_obligatoire,
302 302
 				]
@@ -340,9 +340,9 @@  discard block
 block discarded – undo
340 340
 
341 341
 		if ($res) {
342 342
 			$res = info_progression_etape(2, 'etape_', 'install/', true)
343
-				. "<div class='error'><h3>" . _T('avis_operation_echec') . '</h3>'
343
+				. "<div class='error'><h3>"._T('avis_operation_echec').'</h3>'
344 344
 				. $res
345
-				. '<p>' . _T('texte_operation_echec') . '</p>'
345
+				. '<p>'._T('texte_operation_echec').'</p>'
346 346
 				. '</div>';
347 347
 		}
348 348
 	} else {
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 
367 367
 		$hidden = predef_ou_cache($adresse_db, $login_db, $pass_db, $server_db)
368 368
 			. (defined('_INSTALL_NAME_DB') ? ''
369
-				: "\n<input type='hidden' name='sel_db' value=\"" . spip_htmlspecialchars($sel_db) . '" />');
369
+				: "\n<input type='hidden' name='sel_db' value=\"".spip_htmlspecialchars($sel_db).'" />');
370 370
 
371 371
 		$auteur_obligatoire = ($ldap_present ? 0 : !sql_countsel('spip_auteurs', '', '', '', $server_db));
372 372
 
Please login to merge, or discard this patch.
ecrire/auth/spip.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 		$row = sql_fetsel(
50 50
 			'*',
51 51
 			'spip_auteurs',
52
-			'login=' . sql_quote($login, $serveur, 'text') . " AND statut<>'5poubelle'",
52
+			'login='.sql_quote($login, $serveur, 'text')." AND statut<>'5poubelle'",
53 53
 			'',
54 54
 			'',
55 55
 			'',
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	switch (strlen($row['pass'])) {
76 76
 		case 32:
77 77
 			// tres anciens mots de passe encodes en md5(alea.pass)
78
-			$md5pass = md5($row['alea_actuel'] . $pass);
78
+			$md5pass = md5($row['alea_actuel'].$pass);
79 79
 			if ($row['pass'] !== $md5pass) {
80 80
 				unset($row);
81 81
 			}
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 		case 64:
84 84
 			// anciens mots de passe encodes en sha256(alea.pass)
85 85
 			include_spip('auth/sha256.inc');
86
-			$shapass = spip_sha256($row['alea_actuel'] . $pass);
86
+			$shapass = spip_sha256($row['alea_actuel'].$pass);
87 87
 			if ($row['pass'] !== $shapass) {
88 88
 				unset($row);
89 89
 			}
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
 				and !empty($row['backup_cles'])
100 100
 			) {
101 101
 				if ($cles->restore($row['backup_cles'], $pass, $row['pass'], $row['id_auteur'])) {
102
-					spip_log('Les cles secretes ont ete restaurées avec le backup du webmestre #' . $row['id_auteur'], 'auth' . _LOG_INFO_IMPORTANTE);
102
+					spip_log('Les cles secretes ont ete restaurées avec le backup du webmestre #'.$row['id_auteur'], 'auth'._LOG_INFO_IMPORTANTE);
103 103
 					$cles->save();
104 104
 					$secret = $cles->getSecretAuth();
105 105
 				}
106 106
 				else {
107
-					spip_log('Pas de cle secrete disponible (fichier config/cle.php absent ?) mais le backup du webmestre #' . $row['id_auteur'] . " n'est pas valide", 'auth' . _LOG_ERREUR);
108
-					sql_updateq('spip_auteurs', ['backup_cles' => ''], 'id_auteur=' . intval($row['id_auteur']));
107
+					spip_log('Pas de cle secrete disponible (fichier config/cle.php absent ?) mais le backup du webmestre #'.$row['id_auteur']." n'est pas valide", 'auth'._LOG_ERREUR);
108
+					sql_updateq('spip_auteurs', ['backup_cles' => ''], 'id_auteur='.intval($row['id_auteur']));
109 109
 				}
110 110
 			}
111 111
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 			@sql_update(
158 158
 				'spip_auteurs',
159 159
 				$set,
160
-				'id_auteur=' . intval($row['id_auteur']) . ' AND pass=' . sql_quote(
160
+				'id_auteur='.intval($row['id_auteur']).' AND pass='.sql_quote(
161 161
 					$row['pass'],
162 162
 					$serveur,
163 163
 					'text'
@@ -205,20 +205,20 @@  discard block
 block discarded – undo
205 205
 
206 206
 	// si force, on ne verifie pas la presence d'un backup chez un webmestre
207 207
 	if ($force) {
208
-		spip_log('Pas de cle secrete disponible, on regenere une nouvelle cle forcee - tous les mots de passe sont invalides', 'auth' . _LOG_INFO_IMPORTANTE);
208
+		spip_log('Pas de cle secrete disponible, on regenere une nouvelle cle forcee - tous les mots de passe sont invalides', 'auth'._LOG_INFO_IMPORTANTE);
209 209
 		$secret = $cles->getSecretAuth(true);
210 210
 		return true;
211 211
 	}
212 212
 
213
-	$has_backup = sql_allfetsel('id_auteur', 'spip_auteurs', 'statut=' . sql_quote('0minirezo') . ' AND webmestre=' . sql_quote('oui') . " AND backup_cles!=''");
213
+	$has_backup = sql_allfetsel('id_auteur', 'spip_auteurs', 'statut='.sql_quote('0minirezo').' AND webmestre='.sql_quote('oui')." AND backup_cles!=''");
214 214
 	$has_backup = array_column($has_backup, 'id_auteur');
215 215
 	if (empty($has_backup)) {
216
-		spip_log("Pas de cle secrete disponible, et aucun webmestre n'a de backup, on regenere une nouvelle cle - tous les mots de passe sont invalides", 'auth' . _LOG_INFO_IMPORTANTE);
216
+		spip_log("Pas de cle secrete disponible, et aucun webmestre n'a de backup, on regenere une nouvelle cle - tous les mots de passe sont invalides", 'auth'._LOG_INFO_IMPORTANTE);
217 217
 		$secret = $cles->getSecretAuth(true);
218 218
 		return true;
219 219
 	}
220 220
 	else {
221
-		spip_log('Pas de cle secrete disponible (fichier config/cle.php absent ?) un des webmestres #' . implode(', #', $has_backup) . ' doit se connecter pour restaurer son backup des cles', 'auth' . _LOG_ERREUR);
221
+		spip_log('Pas de cle secrete disponible (fichier config/cle.php absent ?) un des webmestres #'.implode(', #', $has_backup).' doit se connecter pour restaurer son backup des cles', 'auth'._LOG_ERREUR);
222 222
 		return false;
223 223
 	}
224 224
 }
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
 	$flux['data'] .=
236 236
 		  '<script type="text/javascript">/*<![CDATA[*/'
237 237
 		. "$js\n"
238
-		. "var login_info={'login':'" . $flux['args']['contexte']['var_login'] . "',"
239
-		. "'page_auteur': '" . generer_url_public('informer_auteur') . "',"
238
+		. "var login_info={'login':'".$flux['args']['contexte']['var_login']."',"
239
+		. "'page_auteur': '".generer_url_public('informer_auteur')."',"
240 240
 		. "'informe_auteur_en_cours':false,"
241 241
 		. "'attente_informe':0};"
242 242
 		. "jQuery(function(){jQuery('#var_login').change(actualise_auteur);});"
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 		} else {
280 280
 			$n = sql_countsel(
281 281
 				'spip_auteurs',
282
-				'login=' . sql_quote($new_login) . ' AND id_auteur!=' . intval($id_auteur) . " AND statut!='5poubelle'",
282
+				'login='.sql_quote($new_login).' AND id_auteur!='.intval($id_auteur)." AND statut!='5poubelle'",
283 283
 				'',
284 284
 				'',
285 285
 				$serveur
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	}
308 308
 	if (
309 309
 		!$id_auteur = intval($id_auteur)
310
-		or !$auteur = sql_fetsel('login', 'spip_auteurs', 'id_auteur=' . intval($id_auteur), '', '', '', '', $serveur)
310
+		or !$auteur = sql_fetsel('login', 'spip_auteurs', 'id_auteur='.intval($id_auteur), '', '', '', '', $serveur)
311 311
 	) {
312 312
 		return false;
313 313
 	}
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 		$anciens = sql_allfetsel(
323 323
 			'id_auteur',
324 324
 			'spip_auteurs',
325
-			'login=' . sql_quote($new_login, $serveur, 'text') . " AND statut='5poubelle'",
325
+			'login='.sql_quote($new_login, $serveur, 'text')." AND statut='5poubelle'",
326 326
 			'',
327 327
 			'',
328 328
 			'',
@@ -356,8 +356,8 @@  discard block
 block discarded – undo
356 356
 		$r = sql_getfetsel(
357 357
 			'login',
358 358
 			'spip_auteurs',
359
-			"statut<>'5poubelle'" .
360
-			' AND (length(pass)>0)' .
359
+			"statut<>'5poubelle'".
360
+			' AND (length(pass)>0)'.
361 361
 			" AND (login=$l)",
362 362
 			'',
363 363
 			'',
@@ -376,8 +376,8 @@  discard block
 block discarded – undo
376 376
 		return sql_getfetsel(
377 377
 			'login',
378 378
 			'spip_auteurs',
379
-			"statut<>'5poubelle'" .
380
-			' AND (length(pass)>0)' .
379
+			"statut<>'5poubelle'".
380
+			' AND (length(pass)>0)'.
381 381
 			" AND (login<>'' AND (nom=$l OR email=$l))",
382 382
 			'',
383 383
 			'',
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 
447 447
 	if (
448 448
 		!$id_auteur = intval($id_auteur)
449
-		or !$auteur = sql_fetsel('login, statut, webmestre', 'spip_auteurs', 'id_auteur=' . intval($id_auteur), '', '', '', '', $serveur)
449
+		or !$auteur = sql_fetsel('login, statut, webmestre', 'spip_auteurs', 'id_auteur='.intval($id_auteur), '', '', '', '', $serveur)
450 450
 	) {
451 451
 		return false;
452 452
 	}
@@ -507,8 +507,8 @@  discard block
 block discarded – undo
507 507
 		or isset($champs['statut'])
508 508
 		or (isset($options['all']) and $options['all'])
509 509
 	) {
510
-		$htaccess = _DIR_RESTREINT . _ACCESS_FILE_NAME;
511
-		$htpasswd = _DIR_TMP . _AUTH_USER_FILE;
510
+		$htaccess = _DIR_RESTREINT._ACCESS_FILE_NAME;
511
+		$htpasswd = _DIR_TMP._AUTH_USER_FILE;
512 512
 
513 513
 		// Cette variable de configuration peut etre posee par un plugin
514 514
 		// par exemple acces_restreint ;
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 			and !@file_exists($htaccess)
519 519
 		) {
520 520
 			spip_unlink($htpasswd);
521
-			spip_unlink($htpasswd . '-admin');
521
+			spip_unlink($htpasswd.'-admin');
522 522
 
523 523
 			return;
524 524
 		}
@@ -536,16 +536,16 @@  discard block
 block discarded – undo
536 536
 		);
537 537
 		while ($t = sql_fetch($s)) {
538 538
 			if (strlen($t['login']) and strlen($t['htpass'])) {
539
-				$p1 .= $t['login'] . ':' . $t['htpass'] . "\n";
539
+				$p1 .= $t['login'].':'.$t['htpass']."\n";
540 540
 				if ($t['statut'] == '0minirezo') {
541
-					$p2 .= $t['login'] . ':' . $t['htpass'] . "\n";
541
+					$p2 .= $t['login'].':'.$t['htpass']."\n";
542 542
 				}
543 543
 			}
544 544
 		}
545 545
 		sql_free($s);
546 546
 		if ($p1) {
547 547
 			ecrire_fichier($htpasswd, $p1);
548
-			ecrire_fichier($htpasswd . '-admin', $p2);
548
+			ecrire_fichier($htpasswd.'-admin', $p2);
549 549
 			spip_log("Ecriture de $htpasswd et $htpasswd-admin");
550 550
 		}
551 551
 	}
Please login to merge, or discard this patch.