Completed
Push — master ( fb0017...92433c )
by cam
01:14
created
ecrire/genie/mise_a_jour.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
 function genie_mise_a_jour_dist($t) {
29 29
 	include_spip('inc/meta');
30 30
 	$maj = info_maj($GLOBALS['spip_version_branche']);
31
-	ecrire_meta('info_maj_spip', $maj ? ($GLOBALS['spip_version_branche'] . "|$maj") : '', 'non');
31
+	ecrire_meta('info_maj_spip', $maj ? ($GLOBALS['spip_version_branche']."|$maj") : '', 'non');
32 32
 
33 33
 	mise_a_jour_ecran_securite();
34 34
 
35
-	spip_log('Verification version SPIP : ' . ($maj ?: 'version a jour'), 'verifie_maj');
35
+	spip_log('Verification version SPIP : '.($maj ?: 'version a jour'), 'verifie_maj');
36 36
 
37 37
 	return 1;
38 38
 }
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	// si l'ecran n'est pas deja present ou pas updatable, sortir
58 58
 	if (
59 59
 		!_URL_ECRAN_SECURITE
60
-		or !file_exists($filename = _DIR_ETC . 'ecran_securite.php')
60
+		or !file_exists($filename = _DIR_ETC.'ecran_securite.php')
61 61
 		or !is_writable($filename)
62 62
 		or !$last_modified = filemtime($filename)
63 63
 		or !$md5 = md5_file($filename)
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	}
67 67
 
68 68
 	include_spip('inc/distant');
69
-	$tmp_file = _DIR_TMP . 'ecran_securite.php';
69
+	$tmp_file = _DIR_TMP.'ecran_securite.php';
70 70
 	$url = parametre_url(_URL_ECRAN_SECURITE, 'md5', $md5);
71 71
 	$url = parametre_url($url, 'vspip', $GLOBALS['spip_version_branche']);
72 72
 	$res = recuperer_url($url, [
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 			include_once $tmp_file;
86 86
 			// ok, on le copie a la place de l'ecran existant
87 87
 			// en backupant l'ecran avant, au cas ou
88
-			@copy($filename, $filename . '-bck-' . date('Y-m-d-His', $last_modified));
88
+			@copy($filename, $filename.'-bck-'.date('Y-m-d-His', $last_modified));
89 89
 			@rename($tmp_file, $filename);
90 90
 		} else {
91 91
 			@unlink($tmp_file);
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 		$message[] = _T('nouvelle_version_spip_majeure', ['version' => $maj['majeure']]);
128 128
 	}
129 129
 
130
-	return '<a class="info_maj_spip" href="https://www.spip.net/fr_update" title="' . $maj['mineure'] . '">' . implode(' | ', $message) . '</a>';
130
+	return '<a class="info_maj_spip" href="https://www.spip.net/fr_update" title="'.$maj['mineure'].'">'.implode(' | ', $message).'</a>';
131 131
 }
132 132
 
133 133
 /**
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 function info_maj_cache(): ?array {
145 145
 	$contenu = '';
146 146
 	$options = [];
147
-	$nom = _DIR_CACHE . _VERSIONS_LISTE;
147
+	$nom = _DIR_CACHE._VERSIONS_LISTE;
148 148
 	if (file_exists($nom)) {
149 149
 		$contenu = file_get_contents($nom);
150 150
 		$options['if_modified_since'] = filemtime($nom);
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	try {
166 166
 		$json = json_decode($contenu, true, 512, JSON_THROW_ON_ERROR);
167 167
 	} catch (JsonException $e) {
168
-		spip_log('Failed to parse Json data : ' . $e->getMessage(), 'verifie_maj');
168
+		spip_log('Failed to parse Json data : '.$e->getMessage(), 'verifie_maj');
169 169
 		return null;
170 170
 	}
171 171
 
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
 
198 198
 	foreach ($versions as $v) {
199 199
 		[$maj2, $min2, $rev2] = explode('.', $v);
200
-		$branche_maj = $maj2 . '.' . $min2;
201
-		$version_maj = $maj2 . '.' . $min2 . '.' . $rev2;
200
+		$branche_maj = $maj2.'.'.$min2;
201
+		$version_maj = $maj2.'.'.$min2.'.'.$rev2;
202 202
 		$is_version_stable = is_numeric($rev2);
203 203
 		// d'abord les mises à jour de la même branche (version mineure)
204 204
 		if (
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
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	$champ = preg_replace(',[\s]+,ms', ' ', $champ);
38 38
 	$champ = str_replace('"', '""', $champ);
39 39
 
40
-	return '"' . $champ . '"';
40
+	return '"'.$champ.'"';
41 41
 }
42 42
 
43 43
 /**
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	if ($callback) {
58 58
 		$ligne = $callback($nb, $ligne, $delim, $importer_charset);
59 59
 	}
60
-	$output = join($delim, array_map('exporter_csv_champ', $ligne)) . "\r\n";
60
+	$output = join($delim, array_map('exporter_csv_champ', $ligne))."\r\n";
61 61
 	if ($importer_charset) {
62 62
 		$output = str_replace('’', '\'', $output);
63 63
 		$output = unicode2charset(html2unicode(charset2unicode($output)), $importer_charset);
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 		$fichier = 'php://output';
185 185
 	}
186 186
 	else {
187
-		$fichier = sous_repertoire(_DIR_CACHE, 'export') . $basename;
187
+		$fichier = sous_repertoire(_DIR_CACHE, 'export').$basename;
188 188
 	}
189 189
 
190 190
 	$fp = fopen($fichier, 'w');
Please login to merge, or discard this patch.
ecrire/inc/distant.php 1 patch
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	define('_INC_DISTANT_CONTENT_ENCODING', 'gzip');
28 28
 }
29 29
 if (!defined('_INC_DISTANT_USER_AGENT')) {
30
-	define('_INC_DISTANT_USER_AGENT', 'SPIP-' . $GLOBALS['spip_version_affichee'] . ' (' . $GLOBALS['home_server'] . ')');
30
+	define('_INC_DISTANT_USER_AGENT', 'SPIP-'.$GLOBALS['spip_version_affichee'].' ('.$GLOBALS['home_server'].')');
31 31
 }
32 32
 if (!defined('_INC_DISTANT_MAX_SIZE')) {
33 33
 	define('_INC_DISTANT_MAX_SIZE', 2_097_152);
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	define('_INC_DISTANT_CONNECT_TIMEOUT', 10);
37 37
 }
38 38
 
39
-define('_REGEXP_COPIE_LOCALE', ',' 	.
39
+define('_REGEXP_COPIE_LOCALE', ','.
40 40
 	preg_replace(
41 41
 		'@^https?:@',
42 42
 		'https?:',
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
 	// si c'est la protection de soi-meme, retourner le path
75 75
 	if ($mode !== 'force' and preg_match(_REGEXP_COPIE_LOCALE, $source, $match)) {
76
-		$source = substr(_DIR_IMG, strlen(_DIR_RACINE)) . urldecode($match[1]);
76
+		$source = substr(_DIR_IMG, strlen(_DIR_RACINE)).urldecode($match[1]);
77 77
 
78 78
 		return @file_exists($source) ? $source : false;
79 79
 	}
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 		return false;
94 94
 	}
95 95
 
96
-	$localrac = _DIR_RACINE . $local;
96
+	$localrac = _DIR_RACINE.$local;
97 97
 	$t = ($mode === 'force') ? false : @file_exists($localrac);
98 98
 
99 99
 	// test d'existence du fichier
@@ -113,18 +113,18 @@  discard block
 block discarded – undo
113 113
 		if (!$taille_max) {
114 114
 			$taille_max = _COPIE_LOCALE_MAX_SIZE;
115 115
 		}
116
-		$localrac_tmp = $localrac . '.tmp';
116
+		$localrac_tmp = $localrac.'.tmp';
117 117
 		$res = recuperer_url(
118 118
 			$source,
119 119
 			['file' => $localrac_tmp, 'taille_max' => $taille_max, 'if_modified_since' => $t ? filemtime($localrac) : '']
120 120
 		);
121 121
 
122 122
 		if (!$res or (!$res['length'] and $res['status'] != 304)) {
123
-			spip_log("copie_locale : Echec recuperation $source sur $localrac_tmp status : " . ($res ? $res['status'] : '-'), 'distant' . _LOG_INFO_IMPORTANTE);
123
+			spip_log("copie_locale : Echec recuperation $source sur $localrac_tmp status : ".($res ? $res['status'] : '-'), 'distant'._LOG_INFO_IMPORTANTE);
124 124
 			@unlink($localrac_tmp);
125 125
 		}
126 126
 		else {
127
-			spip_log("copie_locale : recuperation $source sur $localrac_tmp OK | taille " . $res['length'] . ' status ' . $res['status'], 'distant');
127
+			spip_log("copie_locale : recuperation $source sur $localrac_tmp OK | taille ".$res['length'].' status '.$res['status'], 'distant');
128 128
 		}
129 129
 		if (!$res or !$res['length']) {
130 130
 			// si $t c'est sans doute juste un not-modified-since
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 			and is_callable($callback_valider_url)
138 138
 			and !$callback_valider_url($res['url'])
139 139
 		) {
140
-			spip_log('copie_locale : url finale ' . $res['url'] . " non valide, on refuse le fichier $localrac_tmp", 'distant' . _LOG_INFO_IMPORTANTE);
140
+			spip_log('copie_locale : url finale '.$res['url']." non valide, on refuse le fichier $localrac_tmp", 'distant'._LOG_INFO_IMPORTANTE);
141 141
 			@unlink($localrac_tmp);
142 142
 			return $t ? $local : false;
143 143
 		}
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 
229 229
 	if (!$is_known_host) {
230 230
 		$host = trim($parsed_url['host'], '.');
231
-		if (! $ip = filter_var($host, FILTER_VALIDATE_IP)) {
231
+		if (!$ip = filter_var($host, FILTER_VALIDATE_IP)) {
232 232
 			$ip = gethostbyname($host);
233 233
 			if ($ip === $host) {
234 234
 				// Error condition for gethostbyname()
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 			}
250 250
 		}
251 251
 		if ($ip) {
252
-			if (! filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
252
+			if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
253 253
 				return false;
254 254
 			}
255 255
 		}
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	}
261 261
 
262 262
 	$port = $parsed_url['port'];
263
-	if ($port === 80  or $port === 443  or $port === 8080) {
263
+	if ($port === 80 or $port === 443 or $port === 8080) {
264 264
 		return $url;
265 265
 	}
266 266
 
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 				}
331 331
 			}
332 332
 			if ($taille > 500) {
333
-				$boundary = substr(md5(random_int(0, mt_getrandmax()) . 'spip'), 0, 8);
333
+				$boundary = substr(md5(random_int(0, mt_getrandmax()).'spip'), 0, 8);
334 334
 			}
335 335
 		}
336 336
 
@@ -358,16 +358,16 @@  discard block
 block discarded – undo
358 358
 			}
359 359
 		} else {
360 360
 			// fabrique une chaine HTTP simple pour un POST
361
-			$entete = 'Content-Type: application/x-www-form-urlencoded' . "\r\n";
361
+			$entete = 'Content-Type: application/x-www-form-urlencoded'."\r\n";
362 362
 			$chaine = [];
363 363
 			if (is_array($donnees)) {
364 364
 				foreach ($donnees as $cle => $valeur) {
365 365
 					if (is_array($valeur)) {
366 366
 						foreach ($valeur as $val2) {
367
-							$chaine[] = rawurlencode($cle) . '[]=' . rawurlencode($val2);
367
+							$chaine[] = rawurlencode($cle).'[]='.rawurlencode($val2);
368 368
 						}
369 369
 					} else {
370
-						$chaine[] = rawurlencode($cle) . '=' . rawurlencode($valeur);
370
+						$chaine[] = rawurlencode($cle).'='.rawurlencode($valeur);
371 371
 					}
372 372
 				}
373 373
 				$chaine = implode('&', $chaine);
@@ -468,13 +468,13 @@  discard block
 block discarded – undo
468 468
 		$options['taille_max'] = $copy ? _COPIE_LOCALE_MAX_SIZE : _INC_DISTANT_MAX_SIZE;
469 469
 	}
470 470
 
471
-	spip_log('recuperer_url ' . $options['methode'] . " sur $url", 'distant' . _LOG_DEBUG);
471
+	spip_log('recuperer_url '.$options['methode']." sur $url", 'distant'._LOG_DEBUG);
472 472
 
473 473
 	// Ajout des en-têtes spécifiques si besoin
474 474
 	$formatted_data = '';
475 475
 	if (!empty($options['headers'])) {
476 476
 		foreach ($options['headers'] as $champ => $valeur) {
477
-			$formatted_data .= $champ . ': ' . $valeur . "\r\n";
477
+			$formatted_data .= $champ.': '.$valeur."\r\n";
478 478
 		}
479 479
 	}
480 480
 
@@ -482,9 +482,9 @@  discard block
 block discarded – undo
482 482
 		[$head, $postdata] = prepare_donnees_post($options['datas'], $options['boundary']);
483 483
 		$head .= $formatted_data;
484 484
 		if (stripos($head, 'Content-Length:') === false) {
485
-			$head .= 'Content-Length: ' . strlen($postdata) . "\r\n";
485
+			$head .= 'Content-Length: '.strlen($postdata)."\r\n";
486 486
 		}
487
-		$formatted_data = $head . "\r\n" . $postdata;
487
+		$formatted_data = $head."\r\n".$postdata;
488 488
 		if (
489 489
 			strlen($postdata)
490 490
 			and !$methode_demandee
@@ -498,9 +498,9 @@  discard block
 block discarded – undo
498 498
 	// Accepter les URLs au format feed:// ou qui ont oublie le http:// ou les urls relatives au protocole
499 499
 	$url = preg_replace(',^feed://,i', 'http://', $url);
500 500
 	if (!tester_url_absolue($url)) {
501
-		$url = 'http://' . $url;
501
+		$url = 'http://'.$url;
502 502
 	} elseif (strncmp($url, '//', 2) == 0) {
503
-		$url = 'http:' . $url;
503
+		$url = 'http:'.$url;
504 504
 	}
505 505
 
506 506
 	$url = url_to_ascii($url);
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 		$options['if_modified_since']
530 530
 	);
531 531
 	if (!$handle) {
532
-		spip_log("ECHEC init_http $url", 'distant' . _LOG_ERREUR);
532
+		spip_log("ECHEC init_http $url", 'distant'._LOG_ERREUR);
533 533
 
534 534
 		return false;
535 535
 	}
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 					'status' => 200,
560 560
 				];
561 561
 			} else {
562
-				spip_log("ECHEC chinoiserie $url", 'distant' . _LOG_ERREUR);
562
+				spip_log("ECHEC chinoiserie $url", 'distant'._LOG_ERREUR);
563 563
 				return false;
564 564
 			}
565 565
 		} elseif ($res['location'] and $options['follow_location']) {
@@ -575,11 +575,11 @@  discard block
 block discarded – undo
575 575
 					$options['datas'] = '';
576 576
 				}
577 577
 			}
578
-			spip_log('recuperer_url recommence ' . $options['methode'] . " sur $url", 'distant' . _LOG_DEBUG);
578
+			spip_log('recuperer_url recommence '.$options['methode']." sur $url", 'distant'._LOG_DEBUG);
579 579
 
580 580
 			return recuperer_url($url, $options);
581 581
 		} elseif ($res['status'] !== 200) {
582
-			spip_log('HTTP status ' . $res['status'] . " pour $url", 'distant');
582
+			spip_log('HTTP status '.$res['status']." pour $url", 'distant');
583 583
 		}
584 584
 		$result['status'] = $res['status'];
585 585
 		if (isset($res['headers'])) {
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 
596 596
 	// on ne veut que les entetes
597 597
 	if (!$options['taille_max'] or $options['methode'] == 'HEAD' or $result['status'] == '304') {
598
-		spip_log('RESULTAT recuperer_url ' . $options['methode'] . " sur $url : " . json_encode($result), 'distant' . _LOG_DEBUG);
598
+		spip_log('RESULTAT recuperer_url '.$options['methode']." sur $url : ".json_encode($result), 'distant'._LOG_DEBUG);
599 599
 		return $result;
600 600
 	}
601 601
 
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
 
606 606
 	$gz = false;
607 607
 	if (preg_match(",\bContent-Encoding: .*gzip,is", $result['headers'])) {
608
-		$gz = (_DIR_TMP . md5(uniqid(random_int(0, mt_getrandmax()))) . '.tmp.gz');
608
+		$gz = (_DIR_TMP.md5(uniqid(random_int(0, mt_getrandmax()))).'.tmp.gz');
609 609
 	}
610 610
 
611 611
 	// si on a pas deja recuperer le contenu par une methode detournee
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
 
642 642
 	$trace = json_decode(json_encode($result), true);
643 643
 	$trace['page'] = '...';
644
-	spip_log('RESULTAT recuperer_url ' . $options['methode'] . " sur $url : " . json_encode($trace), 'distant' . _LOG_DEBUG);
644
+	spip_log('RESULTAT recuperer_url '.$options['methode']." sur $url : ".json_encode($trace), 'distant'._LOG_DEBUG);
645 645
 
646 646
 	return $result;
647 647
 }
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
 	$sig['url'] = $url;
696 696
 
697 697
 	$dir = sous_repertoire(_DIR_CACHE, 'curl');
698
-	$cache = md5(serialize($sig)) . '-' . substr(preg_replace(',\W+,', '_', $url), 0, 80);
698
+	$cache = md5(serialize($sig)).'-'.substr(preg_replace(',\W+,', '_', $url), 0, 80);
699 699
 	$sub = sous_repertoire($dir, substr($cache, 0, 2));
700 700
 	$cache = "$sub$cache";
701 701
 
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 	$fp = false;
750 750
 	if ($fichier) {
751 751
 		include_spip('inc/acces');
752
-		$tmpfile = "$fichier." . creer_uniqid() . '.tmp';
752
+		$tmpfile = "$fichier.".creer_uniqid().'.tmp';
753 753
 		$fp = spip_fopen_lock($tmpfile, 'w', LOCK_EX);
754 754
 		if (!$fp and file_exists($fichier)) {
755 755
 			return filesize($fichier);
@@ -808,7 +808,7 @@  discard block
 block discarded – undo
808 808
 	}
809 809
 	$result['status'] = intval($r[1]);
810 810
 	while ($s = trim(fgets($handle, 16384))) {
811
-		$result['headers'][] = $s . "\n";
811
+		$result['headers'][] = $s."\n";
812 812
 		preg_match(',^([^:]*): *(.*)$,i', $s, $r);
813 813
 		[, $d, $v] = $r;
814 814
 		if (strtolower(trim($d)) == 'location' and $result['status'] >= 300 and $result['status'] < 400) {
@@ -857,13 +857,13 @@  discard block
 block discarded – undo
857 857
 
858 858
 	// on se place tout le temps comme si on etait a la racine
859 859
 	if (_DIR_RACINE) {
860
-		$d = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $d);
860
+		$d = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $d);
861 861
 	}
862 862
 
863 863
 	$m = md5($source);
864 864
 
865 865
 	return $d
866
-	. substr(preg_replace(',[^\w-],', '', basename($source)) . '-' . $m, 0, 12)
866
+	. substr(preg_replace(',[^\w-],', '', basename($source)).'-'.$m, 0, 12)
867 867
 	. substr($m, 0, 4)
868 868
 	. ".$extension";
869 869
 }
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
 	// Si c'est deja local pas de souci
888 888
 	if (!tester_url_absolue($source)) {
889 889
 		if (_DIR_RACINE) {
890
-			$source = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $source);
890
+			$source = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $source);
891 891
 		}
892 892
 
893 893
 		return $source;
@@ -905,7 +905,7 @@  discard block
 block discarded – undo
905 905
 		$ext
906 906
 		and preg_match(',^\w+$,', $ext) // pas de php?truc=1&...
907 907
 		and $f = nom_fichier_copie_locale($source, $ext)
908
-		and file_exists(_DIR_RACINE . $f)
908
+		and file_exists(_DIR_RACINE.$f)
909 909
 	) {
910 910
 		return $f;
911 911
 	}
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
 
914 914
 	// Si c'est deja dans la table des documents,
915 915
 	// ramener le nom de sa copie potentielle
916
-	$ext = sql_getfetsel('extension', 'spip_documents', 'fichier=' . sql_quote($source) . " AND distant='oui' AND extension <> ''");
916
+	$ext = sql_getfetsel('extension', 'spip_documents', 'fichier='.sql_quote($source)." AND distant='oui' AND extension <> ''");
917 917
 
918 918
 	if ($ext) {
919 919
 		return nom_fichier_copie_locale($source, $ext);
@@ -924,9 +924,9 @@  discard block
 block discarded – undo
924 924
 
925 925
 	$ext = $path_parts ? $path_parts['extension'] : '';
926 926
 
927
-	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) {
927
+	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) {
928 928
 		$f = nom_fichier_copie_locale($source, $ext);
929
-		if (file_exists(_DIR_RACINE . $f)) {
929
+		if (file_exists(_DIR_RACINE.$f)) {
930 930
 			return $f;
931 931
 		}
932 932
 	}
@@ -934,7 +934,7 @@  discard block
 block discarded – undo
934 934
 	// Ping  pour voir si son extension est connue et autorisee
935 935
 	// avec mise en cache du resultat du ping
936 936
 
937
-	$cache = sous_repertoire(_DIR_CACHE, 'rid') . md5($source);
937
+	$cache = sous_repertoire(_DIR_CACHE, 'rid').md5($source);
938 938
 	if (
939 939
 		!@file_exists($cache)
940 940
 		or !$path_parts = @unserialize(spip_file_get_contents($cache))
@@ -944,11 +944,11 @@  discard block
 block discarded – undo
944 944
 		ecrire_fichier($cache, serialize($path_parts));
945 945
 	}
946 946
 	$ext = !empty($path_parts['extension']) ? $path_parts['extension'] : '';
947
-	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) {
947
+	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) {
948 948
 		return nom_fichier_copie_locale($source, $ext);
949 949
 	}
950 950
 
951
-	spip_log("pas de copie locale pour $source", 'distant' . _LOG_ERREUR);
951
+	spip_log("pas de copie locale pour $source", 'distant'._LOG_ERREUR);
952 952
 	return null;
953 953
 }
954 954
 
@@ -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
 		$first_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
 		$first_port = $port;
1361 1361
 	}
1362 1362
 
@@ -1379,7 +1379,7 @@  discard block
 block discarded – undo
1379 1379
 		);
1380 1380
 		spip_log("Recuperer $path sur $first_host:$first_port par $f (via CONNECT)", 'connect');
1381 1381
 		if (!$f) {
1382
-			spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR);
1382
+			spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR);
1383 1383
 			return $errno;
1384 1384
 		}
1385 1385
 		stream_set_timeout($f, _INC_DISTANT_CONNECT_TIMEOUT);
@@ -1392,7 +1392,7 @@  discard block
 block discarded – undo
1392 1392
 			or !count($res = explode(' ', $res))
1393 1393
 			or $res[1] !== '200'
1394 1394
 		) {
1395
-			spip_log("Echec CONNECT sur $first_host:$first_port", 'connect' . _LOG_INFO_IMPORTANTE);
1395
+			spip_log("Echec CONNECT sur $first_host:$first_port", 'connect'._LOG_INFO_IMPORTANTE);
1396 1396
 			fclose($f);
1397 1397
 
1398 1398
 			return false;
@@ -1409,7 +1409,7 @@  discard block
 block discarded – undo
1409 1409
 		} while (!$f and $ntry-- and $errno !== 110 and sleep(1));
1410 1410
 		spip_log("Recuperer $path sur $first_host:$first_port par $f");
1411 1411
 		if (!$f) {
1412
-			spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR);
1412
+			spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR);
1413 1413
 
1414 1414
 			return $errno;
1415 1415
 		}
@@ -1419,16 +1419,16 @@  discard block
 block discarded – undo
1419 1419
 	$site = $GLOBALS['meta']['adresse_site'] ?? '';
1420 1420
 
1421 1421
 	$host_port = $host;
1422
-	if ($port != (in_array($scheme, ['tls','ssl']) ? 443 : 80)) {
1422
+	if ($port != (in_array($scheme, ['tls', 'ssl']) ? 443 : 80)) {
1423 1423
 		$host_port .= ":$port";
1424 1424
 	}
1425 1425
 	$req = "$method $path $vers\r\n"
1426 1426
 		. "Host: $host_port\r\n"
1427
-		. 'User-Agent: ' . _INC_DISTANT_USER_AGENT . "\r\n"
1428
-		. ($refuse_gz ? '' : ('Accept-Encoding: ' . _INC_DISTANT_CONTENT_ENCODING . "\r\n"))
1427
+		. 'User-Agent: '._INC_DISTANT_USER_AGENT."\r\n"
1428
+		. ($refuse_gz ? '' : ('Accept-Encoding: '._INC_DISTANT_CONTENT_ENCODING."\r\n"))
1429 1429
 		. (!$site ? '' : "Referer: $site/$referer\r\n")
1430
-		. (!$date ? '' : 'If-Modified-Since: ' . (gmdate('D, d M Y H:i:s', $date) . " GMT\r\n"))
1431
-		. (!$user ? '' : ('Authorization: Basic ' . base64_encode($user) . "\r\n"))
1430
+		. (!$date ? '' : 'If-Modified-Since: '.(gmdate('D, d M Y H:i:s', $date)." GMT\r\n"))
1431
+		. (!$user ? '' : ('Authorization: Basic '.base64_encode($user)."\r\n"))
1432 1432
 		. (!$proxy_user ? '' : "Proxy-Authorization: Basic $proxy_user\r\n")
1433 1433
 		. (!strpos($vers, '1.1') ? '' : "Keep-Alive: 300\r\nConnection: keep-alive\r\n");
1434 1434
 
Please login to merge, or discard this patch.
ecrire/inc/texte_mini.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -43,13 +43,13 @@  discard block
 block discarded – undo
43 43
 	// celle du texte) et public (spip_lang est la langue du texte)
44 44
 	$dir = _DIR_RESTREINT ? lang_dir() : lang_dir($GLOBALS['spip_lang']);
45 45
 
46
-	$p = 'puce' . (test_espace_prive() ? '_prive' : '');
46
+	$p = 'puce'.(test_espace_prive() ? '_prive' : '');
47 47
 	if ($dir == 'rtl') {
48 48
 		$p .= '_rtl';
49 49
 	}
50 50
 
51 51
 	if (!isset($GLOBALS[$p])) {
52
-		$GLOBALS[$p] = '<span class="spip-puce ' . $dir . '"><b>–</b></span>';
52
+		$GLOBALS[$p] = '<span class="spip-puce '.$dir.'"><b>–</b></span>';
53 53
 	}
54 54
 
55 55
 	return $GLOBALS[$p];
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
 function spip_balisage_code(string $corps, bool $bloc = false, string $attributs = '', string $langage = '') {
68 68
 
69 69
 	$echap = spip_htmlspecialchars($corps); // il ne faut pas passer dans entites_html, ne pas transformer les &#xxx; du code !
70
-	$class = "spip_code " . ($bloc ? 'spip_code_block' : 'spip_code_inline');
70
+	$class = "spip_code ".($bloc ? 'spip_code_block' : 'spip_code_inline');
71 71
 	if ($attributs) {
72
-		$attributs = " " . trim($attributs);
72
+		$attributs = " ".trim($attributs);
73 73
 	}
74 74
 	if ($langage) {
75 75
 		$class .= " language-$langage";
76
-		$attributs .= ' data-language="'. $langage .'"';
76
+		$attributs .= ' data-language="'.$langage.'"';
77 77
 	}
78 78
 	if ($bloc) {
79 79
 		$html = "<div class=\"precode\">"
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	else {
88 88
 		$echap = str_replace("\t", "&nbsp; &nbsp; &nbsp; &nbsp; ", $echap);
89 89
 		$echap = str_replace("  ", " &nbsp;", $echap);
90
-		$html = "<code class=\"$class\" dir=\"ltr\"$attributs>" . $echap . '</code>';
90
+		$html = "<code class=\"$class\" dir=\"ltr\"$attributs>".$echap.'</code>';
91 91
 	}
92 92
 
93 93
 	return $html;
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 }
106 106
 
107 107
 if (!defined('_BALISES_BLOCS_REGEXP')) {
108
-	define('_BALISES_BLOCS_REGEXP', ',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS');
108
+	define('_BALISES_BLOCS_REGEXP', ',</?('._BALISES_BLOCS.')[>[:space:]],iS');
109 109
 }
110 110
 
111 111
 //
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 
123 123
 	// Tester si on echappe en span ou en div
124 124
 	if (is_null($mode) or !in_array($mode, ['div', 'span'])) {
125
-		$mode = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $rempl) ? 'div' : 'span';
125
+		$mode = preg_match(',</?('._BALISES_BLOCS.')[>[:space:]],iS', $rempl) ? 'div' : 'span';
126 126
 	}
127 127
 
128 128
 	// Decouper en morceaux, base64 a des probleme selon la taille de la pile
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	) {
158 158
 		foreach ($matches as $m) {
159 159
 			if ($m[1] === 'code') {
160
-				$code = '<code' . $m[2] . '>' . spip_htmlspecialchars($m[3]) . '</code>';
160
+				$code = '<code'.$m[2].'>'.spip_htmlspecialchars($m[3]).'</code>';
161 161
 				$pre = str_replace($m[0], $code, $pre);
162 162
 			}
163 163
 		}
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 
168 168
 // Echapper les <code>...</ code>
169 169
 function traiter_echap_code_dist($regs, $options = []) {
170
-	[, , $att, $corps] = $regs;
170
+	[,, $att, $corps] = $regs;
171 171
 
172 172
 	// ne pas mettre le <div...> s'il n'y a qu'une ligne
173 173
 	if (strpos($corps, "\n") !== false) {
@@ -252,11 +252,11 @@  discard block
 block discarded – undo
252 252
 				// sinon les traiter selon le cas
253 253
 				$callback_secure_prefix = ($callback_options['secure_prefix'] ?? '');
254 254
 				if (
255
-					function_exists($f = $callback_prefix . $callback_secure_prefix . 'traiter_echap_' . strtolower($regs[1]))
256
-					or function_exists($f = $f . '_dist')
255
+					function_exists($f = $callback_prefix.$callback_secure_prefix.'traiter_echap_'.strtolower($regs[1]))
256
+					or function_exists($f = $f.'_dist')
257 257
 					or ($callback_secure_prefix and (
258
-						function_exists($f = $callback_prefix . 'traiter_echap_' . strtolower($regs[1]))
259
-						or function_exists($f = $f . '_dist')
258
+						function_exists($f = $callback_prefix.'traiter_echap_'.strtolower($regs[1]))
259
+						or function_exists($f = $f.'_dist')
260 260
 					))
261 261
 				) {
262 262
 					$echap = $f($regs, $callback_options);
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	// dans une callback autonommee
279 279
 	if (strpos($preg ?: _PROTEGE_BLOCS, 'script') !== false) {
280 280
 		if (
281
-			strpos($letexte, '<' . '?') !== false and preg_match_all(
281
+			strpos($letexte, '<'.'?') !== false and preg_match_all(
282 282
 				',<[?].*($|[?]>),UisS',
283 283
 				$letexte,
284 284
 				$matches,
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 			strpos($letexte, '<') !== false
311 311
 			and
312 312
 			preg_match_all(
313
-				',<(span|div)\sclass=[\'"]base64' . $source . '[\'"]\s(.*)>\s*</\1>,UmsS',
313
+				',<(span|div)\sclass=[\'"]base64'.$source.'[\'"]\s(.*)>\s*</\1>,UmsS',
314 314
 				$letexte,
315 315
 				$regs,
316 316
 				PREG_SET_ORDER
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 					}
328 328
 				}
329 329
 				if ($at) {
330
-					$rempl = '<' . $reg[1] . '>' . $rempl . '</' . $reg[1] . '>';
330
+					$rempl = '<'.$reg[1].'>'.$rempl.'</'.$reg[1].'>';
331 331
 					foreach ($at as $attr => $a) {
332 332
 						$rempl = inserer_attribut($rempl, $attr, $a);
333 333
 					}
@@ -408,8 +408,8 @@  discard block
 block discarded – undo
408 408
 	$texte = nettoyer_raccourcis_typo($texte);
409 409
 
410 410
 	// balises de sauts de ligne et paragraphe
411
-	$texte = preg_replace('/<p( [^>]*)?' . '>/', "\r\r", $texte);
412
-	$texte = preg_replace('/<br( [^>]*)?' . '>/', "\n", $texte);
411
+	$texte = preg_replace('/<p( [^>]*)?'.'>/', "\r\r", $texte);
412
+	$texte = preg_replace('/<br( [^>]*)?'.'>/', "\n", $texte);
413 413
 
414 414
 	// on repasse les doubles \n en \r que nettoyer_raccourcis_typo() a pu modifier
415 415
 	$texte = str_replace("\n\n", "\r\r", $texte);
@@ -434,15 +434,15 @@  discard block
 block discarded – undo
434 434
 		// excédentaire est ensuite supprimé par l'appel à preg_replace()
435 435
 		$long = spip_substr($texte, 0, max($taille + 1 - $taille_suite, 1));
436 436
 		$u = $GLOBALS['meta']['pcre_u'];
437
-		$court = preg_replace('/(^|([^\s ])[\s ]+)([\s ]|[^\s ]+)?$/D' . $u, "\\2", $long);
437
+		$court = preg_replace('/(^|([^\s ])[\s ]+)([\s ]|[^\s ]+)?$/D'.$u, "\\2", $long);
438 438
 		$points = $suite;
439 439
 
440 440
 		// trop court ? ne pas faire de (...)
441 441
 		if (spip_strlen($court) < max(0.75 * $taille, 2)) {
442 442
 			$points = '';
443 443
 			$long = spip_substr($texte, 0, $taille + 1);
444
-			preg_match('/(^|([^\s ])[\s ]+)([\s ]|[^\s ]+)?$/D' . $u, $long, $m);
445
-			$texte = preg_replace('/(^|([^\s ])[\s ]+)([\s ]|[^\s ]+)?$/D' . $u, "\\2", $long);
444
+			preg_match('/(^|([^\s ])[\s ]+)([\s ]|[^\s ]+)?$/D'.$u, $long, $m);
445
+			$texte = preg_replace('/(^|([^\s ])[\s ]+)([\s ]|[^\s ]+)?$/D'.$u, "\\2", $long);
446 446
 			// encore trop court ? couper au caractere
447 447
 			if (spip_strlen($texte) < 0.75 * $taille) {
448 448
 				$texte = spip_substr($long, 0, $taille);
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 	// supprimer l'eventuelle entite finale mal coupee
459 459
 	$texte = preg_replace('/&#?[a-z0-9]*$/S', '', $texte);
460 460
 
461
-	return quote_amp(trim($texte)) . $points;
461
+	return quote_amp(trim($texte)).$points;
462 462
 }
463 463
 
464 464
 
@@ -470,16 +470,16 @@  discard block
 block discarded – undo
470 470
 				define('_PROTEGE_JS_MODELES', creer_uniqid());
471 471
 			}
472 472
 			foreach ($r as $regs) {
473
-				$t = str_replace($regs[0], code_echappement($regs[0], 'javascript' . _PROTEGE_JS_MODELES), $t);
473
+				$t = str_replace($regs[0], code_echappement($regs[0], 'javascript'._PROTEGE_JS_MODELES), $t);
474 474
 			}
475 475
 		}
476
-		if (preg_match_all(',<\?php.*?($|\?' . '>),isS', $t, $r, PREG_SET_ORDER)) {
476
+		if (preg_match_all(',<\?php.*?($|\?'.'>),isS', $t, $r, PREG_SET_ORDER)) {
477 477
 			if (!defined('_PROTEGE_PHP_MODELES')) {
478 478
 				include_spip('inc/acces');
479 479
 				define('_PROTEGE_PHP_MODELES', creer_uniqid());
480 480
 			}
481 481
 			foreach ($r as $regs) {
482
-				$t = str_replace($regs[0], code_echappement($regs[0], 'php' . _PROTEGE_PHP_MODELES), $t);
482
+				$t = str_replace($regs[0], code_echappement($regs[0], 'php'._PROTEGE_PHP_MODELES), $t);
483 483
 			}
484 484
 		}
485 485
 	}
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
 			if (!empty($options['wrap_suspect'])) {
598 598
 				$texte = wrap($texte, $options['wrap_suspect']);
599 599
 			}
600
-			$texte = "<mark class='danger-js' title='" . attribut_html(_T('erreur_contenu_suspect')) . "'>⚠️</mark> " . $texte;
600
+			$texte = "<mark class='danger-js' title='".attribut_html(_T('erreur_contenu_suspect'))."'>⚠️</mark> ".$texte;
601 601
 		}
602 602
 
603 603
 		$texte = $collecteurModeles->retablir($texte);
@@ -744,11 +744,11 @@  discard block
 block discarded – undo
744 744
  **/
745 745
 function supprime_img($letexte, $message = null) {
746 746
 	if ($message === null) {
747
-		$message = '(' . _T('img_indisponible') . ')';
747
+		$message = '('._T('img_indisponible').')';
748 748
 	}
749 749
 
750 750
 	return preg_replace(
751
-		',<(img|doc|emb)([0-9]+)(\|([^>]*))?' . '\s*/?' . '>,i',
751
+		',<(img|doc|emb)([0-9]+)(\|([^>]*))?'.'\s*/?'.'>,i',
752 752
 		$message,
753 753
 		$letexte
754 754
 	);
Please login to merge, or discard this patch.
config/ecran_securite.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@  discard block
 block discarded – undo
15 15
  * Test utilisateur
16 16
  */
17 17
 if (isset($_GET['test_ecran_securite'])) {
18
-	$ecran_securite_raison = 'test ' . _ECRAN_SECURITE;
18
+	$ecran_securite_raison = 'test '._ECRAN_SECURITE;
19 19
 }
20 20
 
21
-if (file_exists($f = __DIR__ . DIRECTORY_SEPARATOR  . 'ecran_securite_options.php')) {
21
+if (file_exists($f = __DIR__.DIRECTORY_SEPARATOR.'ecran_securite_options.php')) {
22 22
 	include ($f);
23 23
 }
24 24
 
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
 						'yats',
227 227
 						'yeti',
228 228
 						'zeerch'
229
-					)) . ',i',
230
-				(string)$_SERVER['HTTP_USER_AGENT']
229
+					)).',i',
230
+				(string) $_SERVER['HTTP_USER_AGENT']
231 231
 			)
232 232
 	);
233 233
 }
@@ -236,13 +236,13 @@  discard block
 block discarded – undo
236 236
 		'_IS_BOT_FRIEND',
237 237
 		isset($_SERVER['HTTP_USER_AGENT'])
238 238
 			and preg_match(
239
-				',' . implode('|', array(
239
+				','.implode('|', array(
240 240
 					'facebookexternalhit',
241 241
 					'twitterbot',
242 242
 					'flipboardproxy',
243 243
 					'wordpress'
244
-				)) . ',i',
245
-				(string)$_SERVER['HTTP_USER_AGENT']
244
+				)).',i',
245
+				(string) $_SERVER['HTTP_USER_AGENT']
246 246
 			)
247 247
 	);
248 248
 }
@@ -291,10 +291,10 @@  discard block
 block discarded – undo
291 291
  */
292 292
 foreach (array('lang', 'var_recherche', 'aide', 'var_lang_r', 'lang_r', 'var_ajax_ancre', 'nom_fichier') as $var) {
293 293
 	if (isset($_GET[$var])) {
294
-		$_REQUEST[$var] = $GLOBALS[$var] = $_GET[$var] = preg_replace(',[^\w\,/#&;-]+,', ' ', (string)$_GET[$var]);
294
+		$_REQUEST[$var] = $GLOBALS[$var] = $_GET[$var] = preg_replace(',[^\w\,/#&;-]+,', ' ', (string) $_GET[$var]);
295 295
 	}
296 296
 	if (isset($_POST[$var])) {
297
-		$_REQUEST[$var] = $GLOBALS[$var] = $_POST[$var] = preg_replace(',[^\w\,/#&;-]+,', ' ', (string)$_POST[$var]);
297
+		$_REQUEST[$var] = $GLOBALS[$var] = $_POST[$var] = preg_replace(',[^\w\,/#&;-]+,', ' ', (string) $_POST[$var]);
298 298
 	}
299 299
 }
300 300
 
@@ -302,8 +302,8 @@  discard block
 block discarded – undo
302 302
  * Filtre l'accès à spip_acces_doc (injection SQL en 1.8.2x)
303 303
  */
304 304
 if (isset($_SERVER['REQUEST_URI'])) {
305
-	if (preg_match(',^(.*/)?spip_acces_doc\.,', (string)$_SERVER['REQUEST_URI'])) {
306
-		$file = addslashes((string)$_GET['file']);
305
+	if (preg_match(',^(.*/)?spip_acces_doc\.,', (string) $_SERVER['REQUEST_URI'])) {
306
+		$file = addslashes((string) $_GET['file']);
307 307
 	}
308 308
 }
309 309
 
@@ -323,13 +323,13 @@  discard block
 block discarded – undo
323 323
  */
324 324
 if (
325 325
 	isset($_REQUEST['partie_cal'])
326
-	and $_REQUEST['partie_cal'] !== htmlentities((string)$_REQUEST['partie_cal'])
326
+	and $_REQUEST['partie_cal'] !== htmlentities((string) $_REQUEST['partie_cal'])
327 327
 ) {
328 328
 	$ecran_securite_raison = "partie_cal";
329 329
 }
330 330
 if (
331 331
 	isset($_REQUEST['echelle'])
332
-	and $_REQUEST['echelle'] !== htmlentities((string)$_REQUEST['echelle'])
332
+	and $_REQUEST['echelle'] !== htmlentities((string) $_REQUEST['echelle'])
333 333
 ) {
334 334
 	$ecran_securite_raison = "echelle";
335 335
 }
@@ -339,13 +339,13 @@  discard block
 block discarded – undo
339 339
  */
340 340
 if (
341 341
 	isset($_REQUEST['exec'])
342
-	and !preg_match(',^[\w-]+$,', (string)$_REQUEST['exec'])
342
+	and !preg_match(',^[\w-]+$,', (string) $_REQUEST['exec'])
343 343
 ) {
344 344
 	$ecran_securite_raison = "exec";
345 345
 }
346 346
 if (
347 347
 	isset($_REQUEST['cherche_auteur'])
348
-	and preg_match(',[<],', (string)$_REQUEST['cherche_auteur'])
348
+	and preg_match(',[<],', (string) $_REQUEST['cherche_auteur'])
349 349
 ) {
350 350
 	$ecran_securite_raison = "cherche_auteur";
351 351
 }
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 	isset($_REQUEST['exec'])
354 354
 	and $_REQUEST['exec'] == 'auteurs'
355 355
 	and isset($_REQUEST['recherche'])
356
-	and preg_match(',[<],', (string)$_REQUEST['recherche'])
356
+	and preg_match(',[<],', (string) $_REQUEST['recherche'])
357 357
 ) {
358 358
 	$ecran_securite_raison = "recherche";
359 359
 }
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 	isset($_REQUEST['exec'])
362 362
 	and $_REQUEST['exec'] == 'info_plugin'
363 363
 	and isset($_REQUEST['plugin'])
364
-	and preg_match(',[<],', (string)$_REQUEST['plugin'])
364
+	and preg_match(',[<],', (string) $_REQUEST['plugin'])
365 365
 ) {
366 366
 	$ecran_securite_raison = "plugin";
367 367
 }
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 				echo minipres(_T('info_acces_interdit'));
389 389
 				exit;
390 390
 			}
391
-			require _DIR_RESTREINT . 'action/configurer.php';
391
+			require _DIR_RESTREINT.'action/configurer.php';
392 392
 			action_configurer_dist();
393 393
 		}
394 394
 	}
@@ -440,9 +440,9 @@  discard block
 block discarded – undo
440 440
 if (_IS_BOT) {
441 441
 	if (
442 442
 		(isset($_REQUEST['echelle']) and isset($_REQUEST['partie_cal']) and isset($_REQUEST['type']))
443
-		or (strpos((string)$_SERVER['REQUEST_URI'], 'debut_') and preg_match(',[?&]debut_.*&debut_,', (string)$_SERVER['REQUEST_URI']))
444
-		or (isset($_REQUEST['calendrier_annee']) and strpos((string)$_SERVER['REQUEST_URI'], 'debut_'))
445
-		or (isset($_REQUEST['calendrier_annee']) and preg_match(',[?&]calendrier_annee=.*&calendrier_annee=,', (string)$_SERVER['REQUEST_URI']))
443
+		or (strpos((string) $_SERVER['REQUEST_URI'], 'debut_') and preg_match(',[?&]debut_.*&debut_,', (string) $_SERVER['REQUEST_URI']))
444
+		or (isset($_REQUEST['calendrier_annee']) and strpos((string) $_SERVER['REQUEST_URI'], 'debut_'))
445
+		or (isset($_REQUEST['calendrier_annee']) and preg_match(',[?&]calendrier_annee=.*&calendrier_annee=,', (string) $_SERVER['REQUEST_URI']))
446 446
 	) {
447 447
 		$ecran_securite_raison = "robot agenda/double pagination";
448 448
 	}
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 	if ($_REQUEST['page'] == 'test_cfg') {
457 457
 		$ecran_securite_raison = "test_cfg";
458 458
 	}
459
-	if ($_REQUEST['page'] !== htmlspecialchars((string)$_REQUEST['page'])) {
459
+	if ($_REQUEST['page'] !== htmlspecialchars((string) $_REQUEST['page'])) {
460 460
 		$ecran_securite_raison = "xsspage";
461 461
 	}
462 462
 	if (
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
  */
473 473
 foreach (array('var_login') as $var) {
474 474
 	if (isset($_REQUEST[$var]) and is_array($_REQUEST[$var])) {
475
-		$ecran_securite_raison = "xss " . $var;
475
+		$ecran_securite_raison = "xss ".$var;
476 476
 	}
477 477
 }
478 478
 
@@ -520,13 +520,13 @@  discard block
 block discarded – undo
520 520
  */
521 521
 if (
522 522
 	isset($_REQUEST['nom_sauvegarde'])
523
-	and strstr((string)$_REQUEST['nom_sauvegarde'], '/')
523
+	and strstr((string) $_REQUEST['nom_sauvegarde'], '/')
524 524
 ) {
525 525
 	$ecran_securite_raison = 'nom_sauvegarde manipulee';
526 526
 }
527 527
 if (
528 528
 	isset($_REQUEST['znom_sauvegarde'])
529
-	and strstr((string)$_REQUEST['znom_sauvegarde'], '/')
529
+	and strstr((string) $_REQUEST['znom_sauvegarde'], '/')
530 530
 ) {
531 531
 	$ecran_securite_raison = 'znom_sauvegarde manipulee';
532 532
 }
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 	foreach ($_REQUEST as $k => $v) {
656 656
 		if (is_string($v)
657 657
 		  and strpos($v, ':') !== false
658
-		  and strpos($v, '"') !==false
658
+		  and strpos($v, '"') !== false
659 659
 		  and preg_match(',[bidsaO]:,', $v)
660 660
 		  and @unserialize($v)) {
661 661
 			$_REQUEST[$k] = htmlentities($v);
Please login to merge, or discard this patch.
ecrire/inc/filtres_dates.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 function extraire_date($texte): string {
39 39
 	// format = 2001-08
40 40
 	if (preg_match(',([1-2][0-9]{3})[^0-9]*(1[0-2]|0?[1-9]),', $texte, $regs)) {
41
-		return $regs[1] . '-' . sprintf('%02d', $regs[2]) . '-01';
41
+		return $regs[1].'-'.sprintf('%02d', $regs[2]).'-01';
42 42
 	}
43 43
 	return '';
44 44
 }
@@ -69,11 +69,11 @@  discard block
 block discarded – undo
69 69
 		}
70 70
 		if (preg_match('#^([12][0-9]{3})([-/]00)?( [-0-9:]+)?$#', $date, $regs)) {
71 71
 			$regs = array_pad($regs, 4, null); // eviter notice php
72
-			$date = $regs[1] . '-00-00' . $regs[3];
72
+			$date = $regs[1].'-00-00'.$regs[3];
73 73
 		} else {
74 74
 			if (preg_match('#^([12][0-9]{3}[-/][01]?[0-9])([-/]00)?( [-0-9:]+)?$#', $date, $regs)) {
75 75
 				$regs = array_pad($regs, 4, null); // eviter notice php
76
-				$date = preg_replace('@/@', '-', $regs[1]) . '-00' . $regs[3];
76
+				$date = preg_replace('@/@', '-', $regs[1]).'-00'.$regs[3];
77 77
 			} else {
78 78
 				$date = date('Y-m-d H:i:s', strtotime($date));
79 79
 			}
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	$letexte ??= '';
101 101
 	if (
102 102
 		!$verif_format_date
103
-		or (in_array(strlen($letexte), [10,19]) and
103
+		or (in_array(strlen($letexte), [10, 19]) and
104 104
 			  preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}(\s[0-9]{2}:[0-9]{2}:[0-9]{2})?$/', $letexte))
105 105
 	) {
106 106
 		if (strncmp('0000-00-00', $letexte, 10) == 0) {
@@ -390,17 +390,17 @@  discard block
 block discarded – undo
390 390
 	if ($decal > 3600 * 24 * 30) {
391 391
 		$mois = floor($decal / (3600 * 24 * 30));
392 392
 		if ($mois < 2) {
393
-			$delai = "$mois " . _T('date_un_mois');
393
+			$delai = "$mois "._T('date_un_mois');
394 394
 		} else {
395
-			$delai = "$mois " . _T('date_mois');
395
+			$delai = "$mois "._T('date_mois');
396 396
 		}
397 397
 	} else {
398 398
 		if ($decal > 3600 * 24 * 7) {
399 399
 			$semaines = floor($decal / (3600 * 24 * 7));
400 400
 			if ($semaines < 2) {
401
-				$delai = "$semaines " . _T('date_une_semaine');
401
+				$delai = "$semaines "._T('date_une_semaine');
402 402
 			} else {
403
-				$delai = "$semaines " . _T('date_semaines');
403
+				$delai = "$semaines "._T('date_semaines');
404 404
 			}
405 405
 		} else {
406 406
 			if ($decal > 3600 * 24) {
@@ -408,30 +408,30 @@  discard block
 block discarded – undo
408 408
 				if ($jours < 2) {
409 409
 					return $il_y_a == 'date_dans' ? _T('date_demain') : _T('date_hier');
410 410
 				} else {
411
-					$delai = "$jours " . _T('date_jours');
411
+					$delai = "$jours "._T('date_jours');
412 412
 				}
413 413
 			} else {
414 414
 				if ($decal >= 3600) {
415 415
 					$heures = floor($decal / 3600);
416 416
 					if ($heures < 2) {
417
-						$delai = "$heures " . _T('date_une_heure');
417
+						$delai = "$heures "._T('date_une_heure');
418 418
 					} else {
419
-						$delai = "$heures " . _T('date_heures');
419
+						$delai = "$heures "._T('date_heures');
420 420
 					}
421 421
 				} else {
422 422
 					if ($decal >= 60) {
423 423
 						$minutes = floor($decal / 60);
424 424
 						if ($minutes < 2) {
425
-							$delai = "$minutes " . _T('date_une_minute');
425
+							$delai = "$minutes "._T('date_une_minute');
426 426
 						} else {
427
-							$delai = "$minutes " . _T('date_minutes');
427
+							$delai = "$minutes "._T('date_minutes');
428 428
 						}
429 429
 					} else {
430 430
 						$secondes = ceil($decal);
431 431
 						if ($secondes < 2) {
432
-							$delai = "$secondes " . _T('date_une_seconde');
432
+							$delai = "$secondes "._T('date_une_seconde');
433 433
 						} else {
434
-							$delai = "$secondes " . _T('date_secondes');
434
+							$delai = "$secondes "._T('date_secondes');
435 435
 						}
436 436
 					}
437 437
 				}
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 		$njour = 0;
525 525
 	} else {
526 526
 		$njour = intval($jour);
527
-		if ($jourth = _T('date_jnum' . $jour)) {
527
+		if ($jourth = _T('date_jnum'.$jour)) {
528 528
 			$jour = $jourth;
529 529
 		}
530 530
 	}
@@ -532,10 +532,10 @@  discard block
 block discarded – undo
532 532
 	$mois = intval($mois);
533 533
 	if ($mois > 0 and $mois < 13) {
534 534
 		/* Traiter le cas "abbr" pour les noms de mois */
535
-		$param = ((isset($options['param']) and $options['param'] === 'abbr') ? '_' . $options['param'] : '');
536
-		$nommois = _T('date_mois_' . $mois . $param);
535
+		$param = ((isset($options['param']) and $options['param'] === 'abbr') ? '_'.$options['param'] : '');
536
+		$nommois = _T('date_mois_'.$mois.$param);
537 537
 		if ($jour) {
538
-			$jourmois = _T('date_de_mois_' . $mois, ['j' => $jour, 'nommois' => $nommois]);
538
+			$jourmois = _T('date_de_mois_'.$mois, ['j' => $jour, 'nommois' => $nommois]);
539 539
 		} else {
540 540
 			$jourmois = $nommois;
541 541
 		}
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 	}
546 546
 
547 547
 	if ($annee < 0) {
548
-		$annee = -$annee . ' ' . _T('date_avant_jc');
548
+		$annee = -$annee.' '._T('date_avant_jc');
549 549
 		$avjc = true;
550 550
 	} else {
551 551
 		$avjc = false;
@@ -571,11 +571,11 @@  discard block
 block discarded – undo
571 571
 				}
572 572
 			}
573 573
 			if ($vue == 'saison') {
574
-				return $saison ? _T('date_saison_' . $saison) : '';
574
+				return $saison ? _T('date_saison_'.$saison) : '';
575 575
 			} else {
576 576
 				return $saison ? trim(_T(
577 577
 					'date_fmt_saison_annee',
578
-					['saison' => _T('date_saison_' . $saison), 'annee' => $annee]
578
+					['saison' => _T('date_saison_'.$saison), 'annee' => $annee]
579 579
 				)) : '';
580 580
 			}
581 581
 
@@ -652,9 +652,9 @@  discard block
 block discarded – undo
652 652
 			}
653 653
 			$nom = mktime(1, 1, 1, $mois, $njour, $annee);
654 654
 			$nom = 1 + (int) date('w', $nom);
655
-			$param = ((isset($options['param']) and $options['param']) ? '_' . $options['param'] : '');
655
+			$param = ((isset($options['param']) and $options['param']) ? '_'.$options['param'] : '');
656 656
 
657
-			return _T('date_jour_' . $nom . $param);
657
+			return _T('date_jour_'.$nom.$param);
658 658
 
659 659
 		case 'mois_annee':
660 660
 			if ($avjc) {
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
 		default:
672 672
 			[$annee, $mois, $jour, $heures, $minutes, $secondes] = $date_array;
673 673
 			// il faut envoyer jour = 1 si jour pas défini, c'est le comportement qu'on avait historiquement en envoyant ''
674
-			if (!$time = mktime($heures, $minutes, $secondes, $mois, is_numeric($jour) ? $jour : 1 , $annee)) {
674
+			if (!$time = mktime($heures, $minutes, $secondes, $mois, is_numeric($jour) ? $jour : 1, $annee)) {
675 675
 				$time = strtotime($numdate);
676 676
 			}
677 677
 			return date($vue, $time);
@@ -1050,8 +1050,8 @@  discard block
 block discarded – undo
1050 1050
 
1051 1051
 	$dtstart = $dtend = $dtabbr = '';
1052 1052
 	if (strpos($forme, 'hcal') !== false) {
1053
-		$dtstart = "<abbr class='dtstart' title='" . date_iso($date_debut) . "'>";
1054
-		$dtend = "<abbr class='dtend' title='" . date_iso($date_fin) . "'>";
1053
+		$dtstart = "<abbr class='dtstart' title='".date_iso($date_debut)."'>";
1054
+		$dtend = "<abbr class='dtend' title='".date_iso($date_fin)."'>";
1055 1055
 		$dtabbr = '</abbr>';
1056 1056
 	}
1057 1057
 
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
 			}
1100 1100
 		} else {
1101 1101
 			if ($dtabbr && $dtstart) {
1102
-				$s = $dtstart . spip_ucfirst($s) . $dtabbr;
1102
+				$s = $dtstart.spip_ucfirst($s).$dtabbr;
1103 1103
 			} else {
1104 1104
 				$s = spip_ucfirst($s);
1105 1105
 			}
@@ -1122,8 +1122,8 @@  discard block
 block discarded – undo
1122 1122
 				$date_debut = _T('date_fmt_jour_heure', ['jour' => $date_debut, 'heure' => $hd]);
1123 1123
 				$date_fin = _T('date_fmt_jour_heure', ['jour' => $date_fin, 'heure' => $hf]);
1124 1124
 			}
1125
-			$date_debut = $dtstart . $date_debut . $dtabbr;
1126
-			$date_fin = $dtend . $date_fin . $dtabbr;
1125
+			$date_debut = $dtstart.$date_debut.$dtabbr;
1126
+			$date_fin = $dtend.$date_fin.$dtabbr;
1127 1127
 
1128 1128
 			$s = _T('date_fmt_periode', ['date_debut' => $date_debut, 'date_fin' => $date_fin]);
1129 1129
 		} else {
@@ -1140,8 +1140,8 @@  discard block
 block discarded – undo
1140 1140
 				$date_fin = _T('date_fmt_jour_heure', ['jour' => $date_fin, 'heure' => $hf]);
1141 1141
 			}
1142 1142
 
1143
-			$date_debut = $dtstart . $date_debut . $dtabbr;
1144
-			$date_fin = $dtend . $date_fin . $dtabbr;
1143
+			$date_debut = $dtstart.$date_debut.$dtabbr;
1144
+			$date_fin = $dtend.$date_fin.$dtabbr;
1145 1145
 			$s = _T('date_fmt_periode', ['date_debut' => $date_debut, 'date_fin' => $date_fin]);
1146 1146
 		}
1147 1147
 	}
@@ -1248,7 +1248,7 @@  discard block
 block discarded – undo
1248 1248
 		$d = date('Y-m-d');
1249 1249
 	}
1250 1250
 
1251
-	return substr($d, 0, 4) . substr($d, 5, 2) . substr($d, 8, 2);
1251
+	return substr($d, 0, 4).substr($d, 5, 2).substr($d, 8, 2);
1252 1252
 }
1253 1253
 
1254 1254
 /**
@@ -1268,7 +1268,7 @@  discard block
 block discarded – undo
1268 1268
 		$d = date('Y-m-d');
1269 1269
 	}
1270 1270
 
1271
-	return substr($d, 0, 4) . substr($d, 5, 2);
1271
+	return substr($d, 0, 4).substr($d, 5, 2);
1272 1272
 }
1273 1273
 
1274 1274
 /**
Please login to merge, or discard this patch.
ecrire/inc/filtres_images_lib_mini.php 1 patch
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -42,13 +42,13 @@  discard block
 block discarded – undo
42 42
 	$blue = dechex($blue);
43 43
 
44 44
 	if (strlen($red) == 1) {
45
-		$red = '0' . $red;
45
+		$red = '0'.$red;
46 46
 	}
47 47
 	if (strlen($green) == 1) {
48
-		$green = '0' . $green;
48
+		$green = '0'.$green;
49 49
 	}
50 50
 	if (strlen($blue) == 1) {
51
-		$blue = '0' . $blue;
51
+		$blue = '0'.$blue;
52 52
 	}
53 53
 
54 54
 	return "$red$green$blue";
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	$couleur = couleur_html_to_hex($couleur);
68 68
 	$couleur = ltrim($couleur, '#');
69 69
 	if (strlen($couleur) === 3) {
70
-		$couleur = $couleur[0] . $couleur[0] . $couleur[1] . $couleur[1] . $couleur[2] . $couleur[2];
70
+		$couleur = $couleur[0].$couleur[0].$couleur[1].$couleur[1].$couleur[2].$couleur[2];
71 71
 	}
72 72
 	$retour = [];
73 73
 	$retour['red'] = hexdec(substr($couleur, 0, 2));
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
 	$var_G = ($G / 255);
126 126
 	$var_B = ($B / 255);
127 127
 
128
-	$var_Min = min($var_R, $var_G, $var_B);   //Min. value of RGB
129
-	$var_Max = max($var_R, $var_G, $var_B);   //Max. value of RGB
130
-	$del_Max = $var_Max - $var_Min;           //Delta RGB value
128
+	$var_Min = min($var_R, $var_G, $var_B); //Min. value of RGB
129
+	$var_Max = max($var_R, $var_G, $var_B); //Max. value of RGB
130
+	$del_Max = $var_Max - $var_Min; //Delta RGB value
131 131
 
132 132
 	$L = ($var_Max + $var_Min) / 2;
133 133
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
  */
190 190
 function _couleur_hsl_to_rgb($H, $S, $L) {
191 191
 	// helper
192
-	$hue_2_rgb = function ($v1, $v2, $vH) {
192
+	$hue_2_rgb = function($v1, $v2, $vH) {
193 193
 		if ($vH < 0) {
194 194
 			$vH += 1;
195 195
 		}
@@ -327,11 +327,11 @@  discard block
 block discarded – undo
327 327
 		}
328 328
 	} elseif (
329 329
 		preg_match('@^data:image/([^;]*);base64,(.*)$@isS', $source, $regs)
330
-		and $extension = _image_trouver_extension_depuis_mime('image/' . $regs[1])
330
+		and $extension = _image_trouver_extension_depuis_mime('image/'.$regs[1])
331 331
 		and in_array($extension, _image_extensions_acceptees_en_entree())
332 332
 	) {
333 333
 		# gerer img src="data:....base64"
334
-		$local = sous_repertoire(_DIR_VAR, 'image-data') . md5($regs[2]) . '.' . _image_extension_normalisee($extension);
334
+		$local = sous_repertoire(_DIR_VAR, 'image-data').md5($regs[2]).'.'._image_extension_normalisee($extension);
335 335
 		if (!file_exists($local)) {
336 336
 			ecrire_fichier($local, base64_decode($regs[2]));
337 337
 		}
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 	// les protocoles web prennent au moins 3 lettres
349 349
 	if (tester_url_absolue($source)) {
350 350
 		include_spip('inc/distant');
351
-		$fichier = _DIR_RACINE . copie_locale($source);
351
+		$fichier = _DIR_RACINE.copie_locale($source);
352 352
 		if (!$fichier) {
353 353
 			return '';
354 354
 		}
@@ -450,9 +450,9 @@  discard block
 block discarded – undo
450 450
 			// on garde la terminaison initiale car image simplement copiee
451 451
 			// et on postfixe son nom avec un md5 du path
452 452
 			$terminaison_dest = $terminaison;
453
-			$fichier_dest .= '-' . substr(md5("$identifiant"), 0, 5);
453
+			$fichier_dest .= '-'.substr(md5("$identifiant"), 0, 5);
454 454
 		} else {
455
-			$fichier_dest .= '-' . substr(md5("$identifiant-$effet"), 0, 5);
455
+			$fichier_dest .= '-'.substr(md5("$identifiant-$effet"), 0, 5);
456 456
 		}
457 457
 		$cache = sous_repertoire(_DIR_VAR, $cache);
458 458
 		$cache = sous_repertoire($cache, $effet);
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 		$fichier_dest = substr($fichier_dest, 2);
464 464
 	}
465 465
 
466
-	$fichier_dest = $cache . $fichier_dest . '.' . $terminaison_dest;
466
+	$fichier_dest = $cache.$fichier_dest.'.'.$terminaison_dest;
467 467
 
468 468
 	$GLOBALS['images_calculees'][] = $fichier_dest;
469 469
 
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 	if ($creer) {
491 491
 		if (!@file_exists($fichier)) {
492 492
 			if (!@file_exists("$fichier.src")) {
493
-				spip_log("Image absente : $fichier", 'images' . _LOG_ERREUR);
493
+				spip_log("Image absente : $fichier", 'images'._LOG_ERREUR);
494 494
 
495 495
 				return false;
496 496
 			}
@@ -501,15 +501,15 @@  discard block
 block discarded – undo
501 501
 
502 502
 	if ($creer) {
503 503
 		spip_log(
504
-			'filtre image ' . ($fonction_creation ? reset($fonction_creation) : '') . "[$effet] sur $fichier",
505
-			'images' . _LOG_DEBUG
504
+			'filtre image '.($fonction_creation ? reset($fonction_creation) : '')."[$effet] sur $fichier",
505
+			'images'._LOG_DEBUG
506 506
 		);
507 507
 	}
508 508
 
509 509
 	$term_fonction = _image_trouver_extension_pertinente($fichier);
510
-	$ret['fonction_imagecreatefrom'] = '_imagecreatefrom' . $term_fonction;
510
+	$ret['fonction_imagecreatefrom'] = '_imagecreatefrom'.$term_fonction;
511 511
 	$ret['fichier'] = $fichier;
512
-	$ret['fonction_image'] = '_image_image' . $terminaison_dest;
512
+	$ret['fonction_image'] = '_image_image'.$terminaison_dest;
513 513
 	$ret['fichier_dest'] = $fichier_dest;
514 514
 	$ret['format_source'] = _image_extension_normalisee($terminaison);
515 515
 	$ret['format_dest'] = $terminaison_dest;
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 
660 660
 	$_terminaison = _image_trouver_extension_depuis_mime($mime);
661 661
 	if ($_terminaison and $_terminaison !== $terminaison) {
662
-		spip_log("Mauvaise extension du fichier : $path . Son type mime est : $mime", 'images.' . _LOG_INFO_IMPORTANTE);
662
+		spip_log("Mauvaise extension du fichier : $path . Son type mime est : $mime", 'images.'._LOG_INFO_IMPORTANTE);
663 663
 		$terminaison = $_terminaison;
664 664
 	}
665 665
 	return $terminaison;
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
 	if (!function_exists('imagepng')) {
817 817
 		return false;
818 818
 	}
819
-	$tmp = $fichier . '.tmp';
819
+	$tmp = $fichier.'.tmp';
820 820
 	$ret = imagepng($img, $tmp);
821 821
 	if (file_exists($tmp)) {
822 822
 		$taille_test = @getimagesize($tmp);
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
 	if (!function_exists('imagegif')) {
852 852
 		return false;
853 853
 	}
854
-	$tmp = $fichier . '.tmp';
854
+	$tmp = $fichier.'.tmp';
855 855
 	$ret = imagegif($img, $tmp);
856 856
 	if (file_exists($tmp)) {
857 857
 		$taille_test = @getimagesize($tmp);
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
 	if (!function_exists('imagejpeg')) {
892 892
 		return false;
893 893
 	}
894
-	$tmp = $fichier . '.tmp';
894
+	$tmp = $fichier.'.tmp';
895 895
 
896 896
 	// Enable interlancing
897 897
 	imageinterlace($img, true);
@@ -952,7 +952,7 @@  discard block
 block discarded – undo
952 952
 	if (!function_exists('imagewebp')) {
953 953
 		return false;
954 954
 	}
955
-	$tmp = $fichier . '.tmp';
955
+	$tmp = $fichier.'.tmp';
956 956
 	$ret = imagewebp($img, $tmp, $qualite);
957 957
 	if (file_exists($tmp)) {
958 958
 		$taille_test = @getimagesize($tmp);
@@ -986,7 +986,7 @@  discard block
 block discarded – undo
986 986
  */
987 987
 function _image_imagesvg($img, $fichier) {
988 988
 
989
-	$tmp = $fichier . '.tmp';
989
+	$tmp = $fichier.'.tmp';
990 990
 	if (strpos($img, '<') === false) {
991 991
 		$img = supprimer_timestamp($img);
992 992
 		if (!file_exists($img)) {
@@ -1043,13 +1043,13 @@  discard block
 block discarded – undo
1043 1043
  */
1044 1044
 function _image_gd_output($img, $valeurs, $qualite = _IMG_GD_QUALITE, $fonction = null) {
1045 1045
 	if (is_null($fonction)) {
1046
-		$fonction = '_image_image' . $valeurs['format_dest'];
1046
+		$fonction = '_image_image'.$valeurs['format_dest'];
1047 1047
 	}
1048 1048
 	$ret = false;
1049 1049
 	#un flag pour reperer les images gravees
1050 1050
 	$lock = (
1051 1051
 		!statut_effacer_images_temporaires('get') // si la fonction n'a pas ete activee, on grave tout
1052
-		or (@file_exists($valeurs['fichier_dest']) and !@file_exists($valeurs['fichier_dest'] . '.src'))
1052
+		or (@file_exists($valeurs['fichier_dest']) and !@file_exists($valeurs['fichier_dest'].'.src'))
1053 1053
 	);
1054 1054
 	if (
1055 1055
 		function_exists($fonction)
@@ -1061,7 +1061,7 @@  discard block
 block discarded – undo
1061 1061
 			// dans tous les cas mettre a jour la taille de l'image finale
1062 1062
 			[$valeurs['hauteur_dest'], $valeurs['largeur_dest']] = taille_image($valeurs['fichier_dest']);
1063 1063
 			$valeurs['date'] = @filemtime($valeurs['fichier_dest']); // pour la retrouver apres disparition
1064
-			ecrire_fichier($valeurs['fichier_dest'] . '.src', serialize($valeurs), true);
1064
+			ecrire_fichier($valeurs['fichier_dest'].'.src', serialize($valeurs), true);
1065 1065
 		}
1066 1066
 	}
1067 1067
 
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
 
1241 1241
 	// attributs deprecies. Transformer en CSS
1242 1242
 	if ($espace = extraire_attribut($tag, 'hspace')) {
1243
-		$style = "margin:{$espace}px;" . $style;
1243
+		$style = "margin:{$espace}px;".$style;
1244 1244
 		$tag = inserer_attribut($tag, 'hspace', '');
1245 1245
 	}
1246 1246
 
@@ -1367,7 +1367,7 @@  discard block
 block discarded – undo
1367 1367
 	$image = $valeurs['fichier'];
1368 1368
 	$format = $valeurs['format_source'];
1369 1369
 	$destdir = dirname($valeurs['fichier_dest']);
1370
-	$destfile = basename($valeurs['fichier_dest'], '.' . $valeurs['format_dest']);
1370
+	$destfile = basename($valeurs['fichier_dest'], '.'.$valeurs['format_dest']);
1371 1371
 
1372 1372
 	$format_sortie = $valeurs['format_dest'];
1373 1373
 
@@ -1399,7 +1399,7 @@  discard block
 block discarded – undo
1399 1399
 
1400 1400
 	// Si l'image est de la taille demandee (ou plus petite), simplement la retourner
1401 1401
 	if ($srcWidth and $srcWidth <= $maxWidth and $srcHeight <= $maxHeight) {
1402
-		$vignette = $destination . '.' . $format;
1402
+		$vignette = $destination.'.'.$format;
1403 1403
 		@copy($image, $vignette);
1404 1404
 	}
1405 1405
 
@@ -1407,7 +1407,7 @@  discard block
 block discarded – undo
1407 1407
 		include_spip('inc/svg');
1408 1408
 		if ($svg = svg_redimensionner($valeurs['fichier'], $destWidth, $destHeight)) {
1409 1409
 			$format_sortie = 'svg';
1410
-			$vignette = $destination . '.' . $format_sortie;
1410
+			$vignette = $destination.'.'.$format_sortie;
1411 1411
 			$valeurs['fichier_dest'] = $vignette;
1412 1412
 			_image_gd_output($svg, $valeurs);
1413 1413
 		}
@@ -1419,9 +1419,9 @@  discard block
 block discarded – undo
1419 1419
 			define('_CONVERT_COMMAND', 'convert');
1420 1420
 		} // Securite : mes_options.php peut preciser le chemin absolu
1421 1421
 		if (!defined('_RESIZE_COMMAND')) {
1422
-			define('_RESIZE_COMMAND', _CONVERT_COMMAND . ' -quality ' . _IMG_CONVERT_QUALITE . ' -orient Undefined -resize %xx%y! %src %dest');
1422
+			define('_RESIZE_COMMAND', _CONVERT_COMMAND.' -quality '._IMG_CONVERT_QUALITE.' -orient Undefined -resize %xx%y! %src %dest');
1423 1423
 		}
1424
-		$vignette = $destination . '.' . $format_sortie;
1424
+		$vignette = $destination.'.'.$format_sortie;
1425 1425
 		$commande = str_replace(
1426 1426
 			['%x', '%y', '%src', '%dest'],
1427 1427
 			[
@@ -1437,7 +1437,7 @@  discard block
 block discarded – undo
1437 1437
 		if (!@file_exists($vignette)) {
1438 1438
 			spip_log("echec convert sur $vignette");
1439 1439
 
1440
-			return;  // echec commande
1440
+			return; // echec commande
1441 1441
 		}
1442 1442
 	}
1443 1443
 
@@ -1454,7 +1454,7 @@  discard block
 block discarded – undo
1454 1454
 		if (!$output) {
1455 1455
 			return;
1456 1456
 		}
1457
-		$vignette = $output . DIRECTORY_SEPARATOR . basename($destination) . '.' . $format_sortie;
1457
+		$vignette = $output.DIRECTORY_SEPARATOR.basename($destination).'.'.$format_sortie;
1458 1458
 
1459 1459
 		$imagick = new Imagick();
1460 1460
 		$imagick->readImage(realpath($image));
@@ -1463,7 +1463,7 @@  discard block
 block discarded – undo
1463 1463
 			$destHeight,
1464 1464
 			Imagick::FILTER_LANCZOS,
1465 1465
 			1
1466
-		);//, IMAGICK_FILTER_LANCZOS, _IMG_IMAGICK_QUALITE / 100);
1466
+		); //, IMAGICK_FILTER_LANCZOS, _IMG_IMAGICK_QUALITE / 100);
1467 1467
 		$imagick->writeImage($vignette);
1468 1468
 
1469 1469
 		if (!@file_exists($vignette)) {
@@ -1472,7 +1472,7 @@  discard block
 block discarded – undo
1472 1472
 			return;
1473 1473
 		}
1474 1474
 		// remettre le chemin relatif car c'est ce qu'attend SPIP pour la suite (en particlier action/tester)
1475
-		$vignette = $destination . '.' . $format_sortie;
1475
+		$vignette = $destination.'.'.$format_sortie;
1476 1476
 	}
1477 1477
 
1478 1478
 	// netpbm
@@ -1483,11 +1483,11 @@  discard block
 block discarded – undo
1483 1483
 		if (_PNMSCALE_COMMAND == '') {
1484 1484
 			return;
1485 1485
 		}
1486
-		$vignette = $destination . '.' . $format_sortie;
1486
+		$vignette = $destination.'.'.$format_sortie;
1487 1487
 		$pnmtojpeg_command = str_replace('pnmscale', 'pnmtojpeg', _PNMSCALE_COMMAND);
1488 1488
 		if ($format == 'jpg') {
1489 1489
 			$jpegtopnm_command = str_replace('pnmscale', 'jpegtopnm', _PNMSCALE_COMMAND);
1490
-			exec("$jpegtopnm_command $image | " . _PNMSCALE_COMMAND . " -width $destWidth | $pnmtojpeg_command > $vignette");
1490
+			exec("$jpegtopnm_command $image | "._PNMSCALE_COMMAND." -width $destWidth | $pnmtojpeg_command > $vignette");
1491 1491
 			if (!($s = @filesize($vignette))) {
1492 1492
 				spip_unlink($vignette);
1493 1493
 			}
@@ -1499,7 +1499,7 @@  discard block
 block discarded – undo
1499 1499
 		} else {
1500 1500
 			if ($format == 'gif') {
1501 1501
 				$giftopnm_command = str_replace('pnmscale', 'giftopnm', _PNMSCALE_COMMAND);
1502
-				exec("$giftopnm_command $image | " . _PNMSCALE_COMMAND . " -width $destWidth | $pnmtojpeg_command > $vignette");
1502
+				exec("$giftopnm_command $image | "._PNMSCALE_COMMAND." -width $destWidth | $pnmtojpeg_command > $vignette");
1503 1503
 				if (!($s = @filesize($vignette))) {
1504 1504
 					spip_unlink($vignette);
1505 1505
 				}
@@ -1511,7 +1511,7 @@  discard block
 block discarded – undo
1511 1511
 			} else {
1512 1512
 				if ($format == 'png') {
1513 1513
 					$pngtopnm_command = str_replace('pnmscale', 'pngtopnm', _PNMSCALE_COMMAND);
1514
-					exec("$pngtopnm_command $image | " . _PNMSCALE_COMMAND . " -width $destWidth | $pnmtojpeg_command > $vignette");
1514
+					exec("$pngtopnm_command $image | "._PNMSCALE_COMMAND." -width $destWidth | $pnmtojpeg_command > $vignette");
1515 1515
 					if (!($s = @filesize($vignette))) {
1516 1516
 						spip_unlink($vignette);
1517 1517
 					}
@@ -1533,7 +1533,7 @@  discard block
 block discarded – undo
1533 1533
 			return;
1534 1534
 		}
1535 1535
 		if (_IMG_GD_MAX_PIXELS && $srcWidth * $srcHeight > _IMG_GD_MAX_PIXELS) {
1536
-			spip_log('vignette gd1/gd2 impossible : ' . $srcWidth * $srcHeight . 'pixels');
1536
+			spip_log('vignette gd1/gd2 impossible : '.$srcWidth * $srcHeight.'pixels');
1537 1537
 
1538 1538
 			return;
1539 1539
 		}
@@ -1843,7 +1843,7 @@  discard block
 block discarded – undo
1843 1843
 		// de l'image, de facon a tromper le cache du navigateur
1844 1844
 		// quand on fait supprimer/reuploader un logo
1845 1845
 		// (pas de filemtime si SAFE MODE)
1846
-		$date = test_espace_prive() ? ('?' . $date) : '';
1846
+		$date = test_espace_prive() ? ('?'.$date) : '';
1847 1847
 
1848 1848
 		return _image_ecrire_tag($image, ['src' => "$logo$date", 'width' => $destWidth, 'height' => $destHeight]);
1849 1849
 	}
@@ -1889,7 +1889,7 @@  discard block
 block discarded – undo
1889 1889
 	public static function LittleEndian2String($number, $minbytes = 1) {
1890 1890
 		$intstring = '';
1891 1891
 		while ($number > 0) {
1892
-			$intstring = $intstring . chr($number & 255);
1892
+			$intstring = $intstring.chr($number & 255);
1893 1893
 			$number >>= 8;
1894 1894
 		}
1895 1895
 
@@ -1921,9 +1921,9 @@  discard block
 block discarded – undo
1921 1921
 					$b = $argb['blue'];
1922 1922
 
1923 1923
 					if ($bpp[$key] == 32) {
1924
-						$icXOR[$key] .= chr($b) . chr($g) . chr($r) . chr($a);
1924
+						$icXOR[$key] .= chr($b).chr($g).chr($r).chr($a);
1925 1925
 					} elseif ($bpp[$key] == 24) {
1926
-						$icXOR[$key] .= chr($b) . chr($g) . chr($r);
1926
+						$icXOR[$key] .= chr($b).chr($g).chr($r);
1927 1927
 					}
1928 1928
 
1929 1929
 					if ($a < 128) {
@@ -1950,48 +1950,48 @@  discard block
 block discarded – undo
1950 1950
 
1951 1951
 			// BITMAPINFOHEADER - 40 bytes
1952 1952
 			$BitmapInfoHeader[$key] = '';
1953
-			$BitmapInfoHeader[$key] .= "\x28\x00\x00\x00";                // DWORD  biSize;
1954
-			$BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageWidths[$key], 4);    // LONG   biWidth;
1953
+			$BitmapInfoHeader[$key] .= "\x28\x00\x00\x00"; // DWORD  biSize;
1954
+			$BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageWidths[$key], 4); // LONG   biWidth;
1955 1955
 			// The biHeight member specifies the combined
1956 1956
 			// height of the XOR and AND masks.
1957 1957
 			$BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageHeights[$key] * 2, 4); // LONG   biHeight;
1958
-			$BitmapInfoHeader[$key] .= "\x01\x00";                    // WORD   biPlanes;
1959
-			$BitmapInfoHeader[$key] .= chr($bpp[$key]) . "\x00";              // wBitCount;
1960
-			$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00";                // DWORD  biCompression;
1961
-			$BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($biSizeImage, 4);      // DWORD  biSizeImage;
1962
-			$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00";                // LONG   biXPelsPerMeter;
1963
-			$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00";                // LONG   biYPelsPerMeter;
1964
-			$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00";                // DWORD  biClrUsed;
1965
-			$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00";                // DWORD  biClrImportant;
1958
+			$BitmapInfoHeader[$key] .= "\x01\x00"; // WORD   biPlanes;
1959
+			$BitmapInfoHeader[$key] .= chr($bpp[$key])."\x00"; // wBitCount;
1960
+			$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD  biCompression;
1961
+			$BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($biSizeImage, 4); // DWORD  biSizeImage;
1962
+			$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG   biXPelsPerMeter;
1963
+			$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG   biYPelsPerMeter;
1964
+			$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD  biClrUsed;
1965
+			$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD  biClrImportant;
1966 1966
 		}
1967 1967
 
1968 1968
 
1969
-		$icondata = "\x00\x00";                    // idReserved;   // Reserved (must be 0)
1970
-		$icondata .= "\x01\x00";                    // idType;	   // Resource Type (1 for icons)
1971
-		$icondata .= phpthumb_functions::LittleEndian2String(count($gd_image_array), 2);  // idCount;	  // How many images?
1969
+		$icondata = "\x00\x00"; // idReserved;   // Reserved (must be 0)
1970
+		$icondata .= "\x01\x00"; // idType;	   // Resource Type (1 for icons)
1971
+		$icondata .= phpthumb_functions::LittleEndian2String(count($gd_image_array), 2); // idCount;	  // How many images?
1972 1972
 
1973 1973
 		$dwImageOffset = 6 + (count($gd_image_array) * 16);
1974 1974
 		foreach ($gd_image_array as $key => $gd_image) {
1975 1975
 			// ICONDIRENTRY   idEntries[1]; // An entry for each image (idCount of 'em)
1976 1976
 
1977
-			$icondata .= chr($ImageWidths[$key]);           // bWidth;		  // Width, in pixels, of the image
1978
-			$icondata .= chr($ImageHeights[$key]);          // bHeight;		 // Height, in pixels, of the image
1979
-			$icondata .= chr($totalcolors[$key]);           // bColorCount;	 // Number of colors in image (0 if >=8bpp)
1980
-			$icondata .= "\x00";                    // bReserved;	   // Reserved ( must be 0)
1977
+			$icondata .= chr($ImageWidths[$key]); // bWidth;		  // Width, in pixels, of the image
1978
+			$icondata .= chr($ImageHeights[$key]); // bHeight;		 // Height, in pixels, of the image
1979
+			$icondata .= chr($totalcolors[$key]); // bColorCount;	 // Number of colors in image (0 if >=8bpp)
1980
+			$icondata .= "\x00"; // bReserved;	   // Reserved ( must be 0)
1981 1981
 
1982
-			$icondata .= "\x01\x00";                  // wPlanes;		 // Color Planes
1983
-			$icondata .= chr($bpp[$key]) . "\x00";            // wBitCount;	   // Bits per pixel
1982
+			$icondata .= "\x01\x00"; // wPlanes;		 // Color Planes
1983
+			$icondata .= chr($bpp[$key])."\x00"; // wBitCount;	   // Bits per pixel
1984 1984
 
1985 1985
 			$dwBytesInRes = 40 + strlen($icXOR[$key]) + strlen($icAND[$key]);
1986 1986
 			$icondata .= phpthumb_functions::LittleEndian2String(
1987 1987
 				$dwBytesInRes,
1988 1988
 				4
1989
-			);     // dwBytesInRes;	// How many bytes in this resource?
1989
+			); // dwBytesInRes;	// How many bytes in this resource?
1990 1990
 
1991 1991
 			$icondata .= phpthumb_functions::LittleEndian2String(
1992 1992
 				$dwImageOffset,
1993 1993
 				4
1994
-			);    // dwImageOffset;   // Where in the file is this image?
1994
+			); // dwImageOffset;   // Where in the file is this image?
1995 1995
 			$dwImageOffset += strlen($BitmapInfoHeader[$key]);
1996 1996
 			$dwImageOffset += strlen($icXOR[$key]);
1997 1997
 			$dwImageOffset += strlen($icAND[$key]);
Please login to merge, or discard this patch.
ecrire/inc/livrer_fichier.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	];
43 43
 	$options = array_merge($defaut, $options);
44 44
 	if (is_numeric($options['expires']) and $options['expires'] > 0) {
45
-		$options['expires'] = gmdate('D, d M Y H:i:s', time() + $options['expires']) . ' GMT';
45
+		$options['expires'] = gmdate('D, d M Y H:i:s', time() + $options['expires']).' GMT';
46 46
 	}
47 47
 
48 48
 	if (is_null($options) and isset($_SERVER['HTTP_RANGE'])) {
@@ -71,12 +71,12 @@  discard block
 block discarded – undo
71 71
 function spip_livrer_fichier_entetes($fichier, $content_type = 'application/octet-stream', $attachment = false, $expires = 0) {
72 72
 	// toujours envoyer un content type, meme vide !
73 73
 	header('Accept-Ranges: bytes');
74
-	header('Content-Type: ' . $content_type);
74
+	header('Content-Type: '.$content_type);
75 75
 
76 76
 	if ($fs = stat($fichier)
77 77
 	  and !empty($fs['size'])
78 78
 	  and !empty($fs['mtime'])) {
79
-		header("Last-Modified: " . gmdate("D, d M Y H:i:s", $fs['mtime']) . " GMT");
79
+		header("Last-Modified: ".gmdate("D, d M Y H:i:s", $fs['mtime'])." GMT");
80 80
 		header(sprintf('Etag: "%x-%x"', $fs['size'], str_pad($fs['mtime'], 16, "0")));
81 81
 	}
82 82
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	else {
97 97
 		$f = (is_string($attachment) ? $attachment : basename($fichier));
98 98
 		header("Content-Disposition: inline; filename=\"$f\";");
99
-		header('Expires: ' . $expires); // set expiration time
99
+		header('Expires: '.$expires); // set expiration time
100 100
 	}
101 101
 }
102 102
 
@@ -148,12 +148,12 @@  discard block
 block discarded – undo
148 148
 	// Parse Content-Range header for byte offsets, looks like "bytes=11525-" OR "bytes=11525-12451"
149 149
 	if ($range and preg_match('%bytes=(\d+)-(\d+)?%i', $range, $match)) {
150 150
 		### Offset signifies where we should begin to read the file
151
-		$byteOffset = (int)$match[1];
151
+		$byteOffset = (int) $match[1];
152 152
 
153 153
 
154 154
 		### Length is for how long we should read the file according to the browser, and can never go beyond the file size
155 155
 		if (isset($match[2])) {
156
-			$finishBytes = (int)$match[2];
156
+			$finishBytes = (int) $match[2];
157 157
 			$byteLength = $finishBytes + 1;
158 158
 		} else {
159 159
 			$finishBytes = $fileSize - 1;
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 
175 175
 	// partial content
176 176
 	header('HTTP/1.1 206 Partial content');
177
-	header($cr_header);  ### Decrease by 1 on byte-length since this definition is zero-based index of bytes being sent
177
+	header($cr_header); ### Decrease by 1 on byte-length since this definition is zero-based index of bytes being sent
178 178
 
179 179
 
180 180
 	$byteRange = $byteLength - $byteOffset;
Please login to merge, or discard this patch.