Completed
Push — master ( 039abd...2056af )
by cam
01:08
created
ecrire/balise/formulaire_.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 		// donc si on est dans le public avec un cache on va perdre le dynamisme
148 148
 		// et on risque de mettre en cache les valeurs pre-remplies du formulaire
149 149
 		// on injecte donc le PHP qui va appeler la fonction pour generer le formulaire au lieu de directement la fonction
150
-		$p->code = "'<'.'?php echo (" . texte_script($p->code) . "); ?'.'>'";
150
+		$p->code = "'<'.'?php echo (".texte_script($p->code)."); ?'.'>'";
151 151
 		// dans l'espace prive on a pas de cache, donc pas de soucis (et un leak serait moins grave)
152 152
 	}
153 153
 	return $p;
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 			foreach ($erreurs as $k => $v) {
328 328
 				if (is_string($v) and strlen(trim($v)) and strpos($k, '_') !== 0) {
329 329
 					// on encapsule dans un span car ces messages sont en general simple, juste du texte, et deja dans un span dans le form
330
-					$valeurs['erreurs'][$k] = "<span role='alert'>" . $erreurs[$k] . '</span>';
330
+					$valeurs['erreurs'][$k] = "<span role='alert'>".$erreurs[$k].'</span>';
331 331
 				}
332 332
 			}
333 333
 		}
Please login to merge, or discard this patch.
ecrire/public/interfaces.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -975,9 +975,9 @@
 block discarded – undo
975 975
 	if (!defined('_TRAITEMENT_TYPO_SANS_NUMERO')) {
976 976
 		define('_TRAITEMENT_TYPO_SANS_NUMERO', 'supprimer_numero(typo(%s, "TYPO", $connect, $Pile[0]))');
977 977
 	}
978
-	$GLOBALS['table_des_traitements']['BIO'][] = 'safehtml(' . _TRAITEMENT_RACCOURCIS . ')';
978
+	$GLOBALS['table_des_traitements']['BIO'][] = 'safehtml('._TRAITEMENT_RACCOURCIS.')';
979 979
 	$GLOBALS['table_des_traitements']['NOM_SITE']['spip_auteurs'] = 'entites_html(%s)';
980
-	$GLOBALS['table_des_traitements']['NOM']['spip_auteurs'] = 'safehtml(' . _TRAITEMENT_TYPO_SANS_NUMERO . ')';
980
+	$GLOBALS['table_des_traitements']['NOM']['spip_auteurs'] = 'safehtml('._TRAITEMENT_TYPO_SANS_NUMERO.')';
981 981
 	$GLOBALS['table_des_traitements']['CHAPO'][] = _TRAITEMENT_RACCOURCIS;
982 982
 	$GLOBALS['table_des_traitements']['DATE'][] = 'normaliser_date(%s)';
983 983
 	$GLOBALS['table_des_traitements']['DATE_REDAC'][] = 'normaliser_date(%s)';
Please login to merge, or discard this patch.
ecrire/public/iterateur.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
 			// chercher la classe d'iterateur
79 79
 			// IterateurXXX
80 80
 			// definie dans le fichier iterateurs/xxx.php
81
-			$class = 'Iterateur' . $iterateur;
81
+			$class = 'Iterateur'.$iterateur;
82 82
 			if (!class_exists($class)) {
83 83
 				if (
84
-					!include_spip('iterateur/' . strtolower($iterateur))
84
+					!include_spip('iterateur/'.strtolower($iterateur))
85 85
 					or !class_exists($class)
86 86
 				) {
87 87
 					die("Iterateur $iterateur non trouv&#233;");
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 				return $this->iter->$nom();
210 210
 			} catch (Exception $e) {
211 211
 				// #GETCHILDREN sur un fichier de DirectoryIterator ...
212
-				spip_log("Methode $nom en echec sur " . get_class($this->iter));
212
+				spip_log("Methode $nom en echec sur ".get_class($this->iter));
213 213
 				spip_log("Cela peut être normal : retour d'une ligne de resultat ne pouvant pas calculer cette methode");
214 214
 
215 215
 				return '';
@@ -258,8 +258,8 @@  discard block
 block discarded – undo
258 258
 		// Creer la fonction de filtrage sur $this
259 259
 		if ($this->filtre) {
260 260
 			if ($filtres = $this->assembler_filtres($this->filtre)) {
261
-				$filtres = 'return ' . $filtres . ';';
262
-				$this->func_filtre = function () use ($filtres) {
261
+				$filtres = 'return '.$filtres.';';
262
+				$this->func_filtre = function() use ($filtres) {
263 263
 					return eval($filtres);
264 264
 				};
265 265
 			}
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 			return null;
296 296
 		}
297 297
 
298
-		return '(' . implode(") $operateur (", $filtres_string) . ')';
298
+		return '('.implode(") $operateur (", $filtres_string).')';
299 299
 	}
300 300
 
301 301
 	/**
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 			return $this->composer_filtre($v[1], $v[0], $v[2]);
377 377
 		}
378 378
 
379
-		return null;  // sera ignore
379
+		return null; // sera ignore
380 380
 	}
381 381
 
382 382
 	/**
@@ -402,28 +402,28 @@  discard block
 block discarded – undo
402 402
 		# if (!in_array($cle, array('cle', 'valeur')))
403 403
 		#	return;
404 404
 
405
-		$a = '$this->get_select(\'' . $cle . '\')';
405
+		$a = '$this->get_select(\''.$cle.'\')';
406 406
 
407 407
 		$filtre = '';
408 408
 
409 409
 		if ($op == 'REGEXP') {
410
-			$filtre = 'filtrer("match", ' . $a . ', ' . str_replace('\"', '"', $valeur) . ')';
410
+			$filtre = 'filtrer("match", '.$a.', '.str_replace('\"', '"', $valeur).')';
411 411
 			$op = '';
412 412
 		} else {
413 413
 			if ($op == 'LIKE') {
414 414
 				$valeur = str_replace(['\"', '_', '%'], ['"', '.', '.*'], preg_quote($valeur));
415
-				$filtre = 'filtrer("match", ' . $a . ', ' . $valeur . ')';
415
+				$filtre = 'filtrer("match", '.$a.', '.$valeur.')';
416 416
 				$op = '';
417 417
 			} else {
418 418
 				if ($op == '=') {
419 419
 					$op = '==';
420 420
 				} else {
421 421
 					if ($op == 'IN') {
422
-						$filtre = 'in_array(' . $a . ', array' . $valeur . ')';
422
+						$filtre = 'in_array('.$a.', array'.$valeur.')';
423 423
 						$op = '';
424 424
 					} else {
425 425
 						if (!in_array($op, ['<', '<=', '>', '>='])) {
426
-							spip_log('operateur non reconnu ' . $op); // [todo] mettre une erreur de squelette
426
+							spip_log('operateur non reconnu '.$op); // [todo] mettre une erreur de squelette
427 427
 							$op = '';
428 428
 						}
429 429
 					}
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 		}
433 433
 
434 434
 		if ($op) {
435
-			$filtre = $a . $op . str_replace('\"', '"', $valeur);
435
+			$filtre = $a.$op.str_replace('\"', '"', $valeur);
436 436
 		}
437 437
 
438 438
 		if ($not) {
Please login to merge, or discard this patch.
ecrire/inc/invalideur.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	$n = 0;
46 46
 	$time = isset($GLOBALS['meta']['cache_mark']) ? $GLOBALS['meta']['cache_mark'] : 0;
47 47
 	for ($i = 0; $i < 256; $i++) {
48
-		$dir = _DIR_CACHE . sprintf('%02s', dechex($i));
48
+		$dir = _DIR_CACHE.sprintf('%02s', dechex($i));
49 49
 		if (@is_dir($dir) and is_readable($dir) and $d = opendir($dir)) {
50 50
 			while (($f = readdir($d)) !== false) {
51 51
 				if (preg_match(',^[[0-9a-f]+\.cache$,S', $f) and $a = stat("$dir/$f")) {
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
 	// stocker la date_modif_$objet (ne sert a rien pour le moment)
104 104
 	if (isset($objet)) {
105
-		ecrire_meta('derniere_modif_' . $objet, time());
105
+		ecrire_meta('derniere_modif_'.$objet, time());
106 106
 	}
107 107
 
108 108
 	// si $derniere_modif_invalide est un array('article', 'rubrique')
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 
146 146
 	// sur certains sites on veut absolument garder certains caches référencés dans un CDN
147 147
 	// on peut donc inhiber la purge de ces répertoires pour eviter tout probleme
148
-	if (file_exists(rtrim($dir, '/') . '/inhib_purger_repertoire.txt')) {
148
+	if (file_exists(rtrim($dir, '/').'/inhib_purger_repertoire.txt')) {
149 149
 		return 0;
150 150
 	}
151 151
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 		)
209 209
 	) {
210 210
 		// supprimer le fichier (de facon propre)
211
-		supprimer_fichier(_DIR_CACHE . $cache);
211
+		supprimer_fichier(_DIR_CACHE.$cache);
212 212
 	} else {
213 213
 		spip_log("Nom de fichier cache incorrect : $cache");
214 214
 	}
Please login to merge, or discard this patch.
ecrire/inc/distant.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	define('_INC_DISTANT_CONTENT_ENCODING', 'gzip');
27 27
 }
28 28
 if (!defined('_INC_DISTANT_USER_AGENT')) {
29
-	define('_INC_DISTANT_USER_AGENT', 'SPIP-' . $GLOBALS['spip_version_affichee'] . ' (' . $GLOBALS['home_server'] . ')');
29
+	define('_INC_DISTANT_USER_AGENT', 'SPIP-'.$GLOBALS['spip_version_affichee'].' ('.$GLOBALS['home_server'].')');
30 30
 }
31 31
 if (!defined('_INC_DISTANT_MAX_SIZE')) {
32 32
 	define('_INC_DISTANT_MAX_SIZE', 2097152);
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	define('_INC_DISTANT_CONNECT_TIMEOUT', 10);
36 36
 }
37 37
 
38
-define('_REGEXP_COPIE_LOCALE', ',' 	.
38
+define('_REGEXP_COPIE_LOCALE', ','.
39 39
 	preg_replace(
40 40
 		'@^https?:@',
41 41
 		'https?:',
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
 	// si c'est la protection de soi-meme, retourner le path
72 72
 	if ($mode !== 'force' and preg_match(_REGEXP_COPIE_LOCALE, $source, $match)) {
73
-		$source = substr(_DIR_IMG, strlen(_DIR_RACINE)) . urldecode($match[1]);
73
+		$source = substr(_DIR_IMG, strlen(_DIR_RACINE)).urldecode($match[1]);
74 74
 
75 75
 		return @file_exists($source) ? $source : false;
76 76
 	}
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 		return false;
91 91
 	}
92 92
 
93
-	$localrac = _DIR_RACINE . $local;
93
+	$localrac = _DIR_RACINE.$local;
94 94
 	$t = ($mode === 'force') ? false : @file_exists($localrac);
95 95
 
96 96
 	// test d'existence du fichier
@@ -115,10 +115,10 @@  discard block
 block discarded – undo
115 115
 			['file' => $localrac, 'taille_max' => $taille_max, 'if_modified_since' => $t ? filemtime($localrac) : '']
116 116
 		);
117 117
 		if (!$res or (!$res['length'] and $res['status'] != 304)) {
118
-			spip_log("copie_locale : Echec recuperation $source sur $localrac status : " . ($res ? $res['status'] : '-'), 'distant' . _LOG_INFO_IMPORTANTE);
118
+			spip_log("copie_locale : Echec recuperation $source sur $localrac status : ".($res ? $res['status'] : '-'), 'distant'._LOG_INFO_IMPORTANTE);
119 119
 		}
120 120
 		else {
121
-			spip_log("copie_locale : recuperation $source sur $localrac OK | taille " . $res['length'] . ' status ' . $res['status'], 'distant');
121
+			spip_log("copie_locale : recuperation $source sur $localrac OK | taille ".$res['length'].' status '.$res['status'], 'distant');
122 122
 		}
123 123
 		if (!$res or !$res['length']) {
124 124
 			// si $t c'est sans doute juste un not-modified-since
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 
208 208
 	if (!$is_known_host) {
209 209
 		$host = trim($parsed_url['host'], '.');
210
-		if (! $ip = filter_var($host, FILTER_VALIDATE_IP)) {
210
+		if (!$ip = filter_var($host, FILTER_VALIDATE_IP)) {
211 211
 			$ip = gethostbyname($host);
212 212
 			if ($ip === $host) {
213 213
 				// Error condition for gethostbyname()
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 			}
229 229
 		}
230 230
 		if ($ip) {
231
-			if (! filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
231
+			if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
232 232
 				return false;
233 233
 			}
234 234
 		}
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	}
240 240
 
241 241
 	$port = $parsed_url['port'];
242
-	if ($port === 80  or $port === 443  or $port === 8080) {
242
+	if ($port === 80 or $port === 443 or $port === 8080) {
243 243
 		return $url;
244 244
 	}
245 245
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 				}
310 310
 			}
311 311
 			if ($taille > 500) {
312
-				$boundary = substr(md5(rand() . 'spip'), 0, 8);
312
+				$boundary = substr(md5(rand().'spip'), 0, 8);
313 313
 			}
314 314
 		}
315 315
 
@@ -337,16 +337,16 @@  discard block
 block discarded – undo
337 337
 			}
338 338
 		} else {
339 339
 			// fabrique une chaine HTTP simple pour un POST
340
-			$entete = 'Content-Type: application/x-www-form-urlencoded' . "\r\n";
340
+			$entete = 'Content-Type: application/x-www-form-urlencoded'."\r\n";
341 341
 			$chaine = [];
342 342
 			if (is_array($donnees)) {
343 343
 				foreach ($donnees as $cle => $valeur) {
344 344
 					if (is_array($valeur)) {
345 345
 						foreach ($valeur as $val2) {
346
-							$chaine[] = rawurlencode($cle) . '[]=' . rawurlencode($val2);
346
+							$chaine[] = rawurlencode($cle).'[]='.rawurlencode($val2);
347 347
 						}
348 348
 					} else {
349
-						$chaine[] = rawurlencode($cle) . '=' . rawurlencode($valeur);
349
+						$chaine[] = rawurlencode($cle).'='.rawurlencode($valeur);
350 350
 					}
351 351
 				}
352 352
 				$chaine = implode('&', $chaine);
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 			$url_idn = implode($host_ascii, $url_idn);
381 381
 		}
382 382
 		// et on urlencode les char utf si besoin dans le path
383
-		$url_idn = preg_replace_callback('/[^\x20-\x7f]/', function ($match) {
383
+		$url_idn = preg_replace_callback('/[^\x20-\x7f]/', function($match) {
384 384
  return urlencode($match[0]);
385 385
 		}, $url_idn);
386 386
 	}
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
 	$head_add = '';
459 459
 	if (!empty($options['headers'])) {
460 460
 		foreach ($options['headers'] as $champ => $valeur) {
461
-			$head_add .= $champ . ': ' . $valeur . "\r\n";
461
+			$head_add .= $champ.': '.$valeur."\r\n";
462 462
 		}
463 463
 		// ne pas le repasser a recuperer_url si on follow un location, car ils seront dans datas
464 464
 		unset($options['headers']);
@@ -468,9 +468,9 @@  discard block
 block discarded – undo
468 468
 		list($head, $postdata) = prepare_donnees_post($options['datas'], $options['boundary']);
469 469
 		$head .= $head_add;
470 470
 		if (stripos($head, 'Content-Length:') === false) {
471
-			$head .= 'Content-Length: ' . strlen($postdata) . "\r\n";
471
+			$head .= 'Content-Length: '.strlen($postdata)."\r\n";
472 472
 		}
473
-		$options['datas'] = $head . "\r\n" . $postdata;
473
+		$options['datas'] = $head."\r\n".$postdata;
474 474
 		if (
475 475
 			strlen($postdata)
476 476
 			and !$methode_demandee
@@ -478,15 +478,15 @@  discard block
 block discarded – undo
478 478
 			$options['methode'] = 'POST';
479 479
 		}
480 480
 	} elseif ($head_add) {
481
-		$options['datas'] = $head_add . "\r\n";
481
+		$options['datas'] = $head_add."\r\n";
482 482
 	}
483 483
 
484 484
 	// Accepter les URLs au format feed:// ou qui ont oublie le http:// ou les urls relatives au protocole
485 485
 	$url = preg_replace(',^feed://,i', 'http://', $url);
486 486
 	if (!tester_url_absolue($url)) {
487
-		$url = 'http://' . $url;
487
+		$url = 'http://'.$url;
488 488
 	} elseif (strncmp($url, '//', 2) == 0) {
489
-		$url = 'http:' . $url;
489
+		$url = 'http:'.$url;
490 490
 	}
491 491
 
492 492
 	$url = url_to_ascii($url);
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 		$options['if_modified_since']
516 516
 	);
517 517
 	if (!$handle) {
518
-		spip_log("ECHEC init_http $url", 'distant' . _LOG_ERREUR);
518
+		spip_log("ECHEC init_http $url", 'distant'._LOG_ERREUR);
519 519
 
520 520
 		return false;
521 521
 	}
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 					'status' => 200,
546 546
 				];
547 547
 			} else {
548
-				spip_log("ECHEC chinoiserie $url", 'distant' . _LOG_ERREUR);
548
+				spip_log("ECHEC chinoiserie $url", 'distant'._LOG_ERREUR);
549 549
 				return false;
550 550
 			}
551 551
 		} elseif ($res['location'] and $options['follow_location']) {
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 
558 558
 			return recuperer_url($url, $options);
559 559
 		} elseif ($res['status'] !== 200) {
560
-			spip_log('HTTP status ' . $res['status'] . " pour $url", 'distant');
560
+			spip_log('HTTP status '.$res['status']." pour $url", 'distant');
561 561
 		}
562 562
 		$result['status'] = $res['status'];
563 563
 		if (isset($res['headers'])) {
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 
583 583
 	$gz = false;
584 584
 	if (preg_match(",\bContent-Encoding: .*gzip,is", $result['headers'])) {
585
-		$gz = (_DIR_TMP . md5(uniqid(mt_rand())) . '.tmp.gz');
585
+		$gz = (_DIR_TMP.md5(uniqid(mt_rand())).'.tmp.gz');
586 586
 	}
587 587
 
588 588
 	// si on a pas deja recuperer le contenu par une methode detournee
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
 	$sig['url'] = $url;
669 669
 
670 670
 	$dir = sous_repertoire(_DIR_CACHE, 'curl');
671
-	$cache = md5(serialize($sig)) . '-' . substr(preg_replace(',\W+,', '_', $url), 0, 80);
671
+	$cache = md5(serialize($sig)).'-'.substr(preg_replace(',\W+,', '_', $url), 0, 80);
672 672
 	$sub = sous_repertoire($dir, substr($cache, 0, 2));
673 673
 	$cache = "$sub$cache";
674 674
 
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
 	$fp = false;
722 722
 	if ($fichier) {
723 723
 		include_spip('inc/acces');
724
-		$tmpfile = "$fichier." . creer_uniqid() . '.tmp';
724
+		$tmpfile = "$fichier.".creer_uniqid().'.tmp';
725 725
 		$fp = spip_fopen_lock($tmpfile, 'w', LOCK_EX);
726 726
 		if (!$fp and file_exists($fichier)) {
727 727
 			return filesize($fichier);
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 	}
781 781
 	$result['status'] = intval($r[1]);
782 782
 	while ($s = trim(fgets($handle, 16384))) {
783
-		$result['headers'][] = $s . "\n";
783
+		$result['headers'][] = $s."\n";
784 784
 		preg_match(',^([^:]*): *(.*)$,i', $s, $r);
785 785
 		list(, $d, $v) = $r;
786 786
 		if (strtolower(trim($d)) == 'location' and $result['status'] >= 300 and $result['status'] < 400) {
@@ -829,13 +829,13 @@  discard block
 block discarded – undo
829 829
 
830 830
 	// on se place tout le temps comme si on etait a la racine
831 831
 	if (_DIR_RACINE) {
832
-		$d = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $d);
832
+		$d = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $d);
833 833
 	}
834 834
 
835 835
 	$m = md5($source);
836 836
 
837 837
 	return $d
838
-	. substr(preg_replace(',[^\w-],', '', basename($source)) . '-' . $m, 0, 12)
838
+	. substr(preg_replace(',[^\w-],', '', basename($source)).'-'.$m, 0, 12)
839 839
 	. substr($m, 0, 4)
840 840
 	. ".$extension";
841 841
 }
@@ -858,7 +858,7 @@  discard block
 block discarded – undo
858 858
 	// Si c'est deja local pas de souci
859 859
 	if (!tester_url_absolue($source)) {
860 860
 		if (_DIR_RACINE) {
861
-			$source = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $source);
861
+			$source = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $source);
862 862
 		}
863 863
 
864 864
 		return $source;
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
 		$ext
877 877
 		and preg_match(',^\w+$,', $ext) // pas de php?truc=1&...
878 878
 		and $f = nom_fichier_copie_locale($source, $ext)
879
-		and file_exists(_DIR_RACINE . $f)
879
+		and file_exists(_DIR_RACINE.$f)
880 880
 	) {
881 881
 		return $f;
882 882
 	}
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
 
885 885
 	// Si c'est deja dans la table des documents,
886 886
 	// ramener le nom de sa copie potentielle
887
-	$ext = sql_getfetsel('extension', 'spip_documents', 'fichier=' . sql_quote($source) . " AND distant='oui' AND extension <> ''");
887
+	$ext = sql_getfetsel('extension', 'spip_documents', 'fichier='.sql_quote($source)." AND distant='oui' AND extension <> ''");
888 888
 
889 889
 	if ($ext) {
890 890
 		return nom_fichier_copie_locale($source, $ext);
@@ -895,9 +895,9 @@  discard block
 block discarded – undo
895 895
 
896 896
 	$ext = $path_parts ? $path_parts['extension'] : '';
897 897
 
898
-	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) {
898
+	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) {
899 899
 		$f = nom_fichier_copie_locale($source, $ext);
900
-		if (file_exists(_DIR_RACINE . $f)) {
900
+		if (file_exists(_DIR_RACINE.$f)) {
901 901
 			return $f;
902 902
 		}
903 903
 	}
@@ -905,7 +905,7 @@  discard block
 block discarded – undo
905 905
 	// Ping  pour voir si son extension est connue et autorisee
906 906
 	// avec mise en cache du resultat du ping
907 907
 
908
-	$cache = sous_repertoire(_DIR_CACHE, 'rid') . md5($source);
908
+	$cache = sous_repertoire(_DIR_CACHE, 'rid').md5($source);
909 909
 	if (
910 910
 		!@file_exists($cache)
911 911
 		or !$path_parts = @unserialize(spip_file_get_contents($cache))
@@ -915,10 +915,10 @@  discard block
 block discarded – undo
915 915
 		ecrire_fichier($cache, serialize($path_parts));
916 916
 	}
917 917
 	$ext = !empty($path_parts['extension']) ? $path_parts['extension'] : '';
918
-	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) {
918
+	if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) {
919 919
 		return nom_fichier_copie_locale($source, $ext);
920 920
 	}
921
-	spip_log("pas de copie locale pour $source", 'distant' . _LOG_ERREUR);
921
+	spip_log("pas de copie locale pour $source", 'distant'._LOG_ERREUR);
922 922
 }
923 923
 
924 924
 
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
 		} else {
1003 1003
 			if ($a['body']) {
1004 1004
 				$a['extension'] = $extension;
1005
-				$a['fichier'] = _DIR_RACINE . nom_fichier_copie_locale($source, $extension);
1005
+				$a['fichier'] = _DIR_RACINE.nom_fichier_copie_locale($source, $extension);
1006 1006
 				ecrire_fichier($a['fichier'], $a['body']);
1007 1007
 				$size_image = @spip_getimagesize($a['fichier']);
1008 1008
 				$a['largeur'] = intval($size_image[0]);
@@ -1070,20 +1070,20 @@  discard block
 block discarded – undo
1070 1070
 			!$t
1071 1071
 			and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext)
1072 1072
 		) {
1073
-			$t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text'));
1073
+			$t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text'));
1074 1074
 		}
1075 1075
 		if (
1076 1076
 			!$t
1077 1077
 			and preg_match(',^Content-Disposition:\s*attachment;\s*filename=(.*)$,Uims', $headers, $m)
1078 1078
 			and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $m[1], $rext)
1079 1079
 		) {
1080
-			$t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text'));
1080
+			$t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text'));
1081 1081
 		}
1082 1082
 	}
1083 1083
 
1084 1084
 	// Autre mime/type (ou text/plain avec fichier d'extension inconnue)
1085 1085
 	if (!$t) {
1086
-		$t = sql_fetsel('extension', 'spip_types_documents', 'mime_type=' . sql_quote($mime_type));
1086
+		$t = sql_fetsel('extension', 'spip_types_documents', 'mime_type='.sql_quote($mime_type));
1087 1087
 	}
1088 1088
 
1089 1089
 	// Toujours rien ? (ex: audio/x-ogg au lieu de application/ogg)
@@ -1094,11 +1094,11 @@  discard block
 block discarded – undo
1094 1094
 		and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext)
1095 1095
 	) {
1096 1096
 		# eviter xxx.3 => 3gp (> SPIP 3)
1097
-		$t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote(corriger_extension($rext[1]), '', 'text'));
1097
+		$t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote(corriger_extension($rext[1]), '', 'text'));
1098 1098
 	}
1099 1099
 
1100 1100
 	if ($t) {
1101
-		spip_log("mime-type $mime_type ok, extension " . $t['extension'], 'distant');
1101
+		spip_log("mime-type $mime_type ok, extension ".$t['extension'], 'distant');
1102 1102
 		return $t['extension'];
1103 1103
 	} else {
1104 1104
 		# par defaut on retombe sur '.bin' si c'est autorise
@@ -1201,7 +1201,7 @@  discard block
 block discarded – undo
1201 1201
 		}
1202 1202
 	} else {
1203 1203
 		$scheme = $t['scheme'];
1204
-		$noproxy = $scheme . '://';
1204
+		$noproxy = $scheme.'://';
1205 1205
 	}
1206 1206
 	if (isset($t['user'])) {
1207 1207
 		$user = [$t['user'], $t['pass']];
@@ -1215,7 +1215,7 @@  discard block
 block discarded – undo
1215 1215
 	}
1216 1216
 
1217 1217
 	if (!empty($t['query'])) {
1218
-		$path .= '?' . $t['query'];
1218
+		$path .= '?'.$t['query'];
1219 1219
 	}
1220 1220
 
1221 1221
 	$f = lance_requete($method, $scheme, $user, $host, $path, $port, $noproxy, $refuse_gz, $referer, $datas, $vers, $date);
@@ -1289,20 +1289,20 @@  discard block
 block discarded – undo
1289 1289
 	$proxy_user = '';
1290 1290
 	$http_proxy = need_proxy($host);
1291 1291
 	if ($user) {
1292
-		$user = urlencode($user[0]) . ':' . urlencode($user[1]);
1292
+		$user = urlencode($user[0]).':'.urlencode($user[1]);
1293 1293
 	}
1294 1294
 
1295 1295
 	$connect = '';
1296 1296
 	if ($http_proxy) {
1297
-		if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, ['tls','ssl'])) {
1298
-			$path_host = (!$user ? '' : "$user@") . $host . (($port != 80) ? ":$port" : '');
1299
-			$connect = 'CONNECT ' . $path_host . " $vers\r\n"
1297
+		if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, ['tls', 'ssl'])) {
1298
+			$path_host = (!$user ? '' : "$user@").$host.(($port != 80) ? ":$port" : '');
1299
+			$connect = 'CONNECT '.$path_host." $vers\r\n"
1300 1300
 				. "Host: $path_host\r\n"
1301 1301
 				. "Proxy-Connection: Keep-Alive\r\n";
1302 1302
 		} else {
1303
-			$path = (in_array($scheme, ['tls','ssl']) ? 'https://' : "$scheme://")
1303
+			$path = (in_array($scheme, ['tls', 'ssl']) ? 'https://' : "$scheme://")
1304 1304
 				. (!$user ? '' : "$user@")
1305
-				. "$host" . (($port != 80) ? ":$port" : '') . $path;
1305
+				. "$host".(($port != 80) ? ":$port" : '').$path;
1306 1306
 		}
1307 1307
 		$t2 = @parse_url($http_proxy);
1308 1308
 		$first_host = $t2['host'];
@@ -1310,10 +1310,10 @@  discard block
 block discarded – undo
1310 1310
 			$port = 80;
1311 1311
 		}
1312 1312
 		if ($t2['user']) {
1313
-			$proxy_user = base64_encode($t2['user'] . ':' . $t2['pass']);
1313
+			$proxy_user = base64_encode($t2['user'].':'.$t2['pass']);
1314 1314
 		}
1315 1315
 	} else {
1316
-		$first_host = $noproxy . $host;
1316
+		$first_host = $noproxy.$host;
1317 1317
 	}
1318 1318
 
1319 1319
 	if ($connect) {
@@ -1335,7 +1335,7 @@  discard block
 block discarded – undo
1335 1335
 		);
1336 1336
 		spip_log("Recuperer $path sur $first_host:$port par $f (via CONNECT)", 'connect');
1337 1337
 		if (!$f) {
1338
-			spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR);
1338
+			spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR);
1339 1339
 			return $errno;
1340 1340
 		}
1341 1341
 		stream_set_timeout($f, _INC_DISTANT_CONNECT_TIMEOUT);
@@ -1348,7 +1348,7 @@  discard block
 block discarded – undo
1348 1348
 			or !count($res = explode(' ', $res))
1349 1349
 			or $res[1] !== '200'
1350 1350
 		) {
1351
-			spip_log("Echec CONNECT sur $first_host:$port", 'connect' . _LOG_INFO_IMPORTANTE);
1351
+			spip_log("Echec CONNECT sur $first_host:$port", 'connect'._LOG_INFO_IMPORTANTE);
1352 1352
 			fclose($f);
1353 1353
 
1354 1354
 			return false;
@@ -1365,7 +1365,7 @@  discard block
 block discarded – undo
1365 1365
 		} while (!$f and $ntry-- and $errno !== 110 and sleep(1));
1366 1366
 		spip_log("Recuperer $path sur $first_host:$port par $f");
1367 1367
 		if (!$f) {
1368
-			spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR);
1368
+			spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR);
1369 1369
 
1370 1370
 			return $errno;
1371 1371
 		}
@@ -1375,16 +1375,16 @@  discard block
 block discarded – undo
1375 1375
 	$site = isset($GLOBALS['meta']['adresse_site']) ? $GLOBALS['meta']['adresse_site'] : '';
1376 1376
 
1377 1377
 	$host_port = $host;
1378
-	if ($port != (in_array($scheme, ['tls','ssl']) ? 443 : 80)) {
1378
+	if ($port != (in_array($scheme, ['tls', 'ssl']) ? 443 : 80)) {
1379 1379
 		$host_port .= ":$port";
1380 1380
 	}
1381 1381
 	$req = "$method $path $vers\r\n"
1382 1382
 		. "Host: $host_port\r\n"
1383
-		. 'User-Agent: ' . _INC_DISTANT_USER_AGENT . "\r\n"
1384
-		. ($refuse_gz ? '' : ('Accept-Encoding: ' . _INC_DISTANT_CONTENT_ENCODING . "\r\n"))
1383
+		. 'User-Agent: '._INC_DISTANT_USER_AGENT."\r\n"
1384
+		. ($refuse_gz ? '' : ('Accept-Encoding: '._INC_DISTANT_CONTENT_ENCODING."\r\n"))
1385 1385
 		. (!$site ? '' : "Referer: $site/$referer\r\n")
1386
-		. (!$date ? '' : 'If-Modified-Since: ' . (gmdate('D, d M Y H:i:s', $date) . " GMT\r\n"))
1387
-		. (!$user ? '' : ('Authorization: Basic ' . base64_encode($user) . "\r\n"))
1386
+		. (!$date ? '' : 'If-Modified-Since: '.(gmdate('D, d M Y H:i:s', $date)." GMT\r\n"))
1387
+		. (!$user ? '' : ('Authorization: Basic '.base64_encode($user)."\r\n"))
1388 1388
 		. (!$proxy_user ? '' : "Proxy-Authorization: Basic $proxy_user\r\n")
1389 1389
 		. (!strpos($vers, '1.1') ? '' : "Keep-Alive: 300\r\nConnection: keep-alive\r\n");
1390 1390
 
Please login to merge, or discard this patch.
ecrire/action/editer_logo.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 		return $erreur;
90 90
 	}
91 91
 	// chercher dans la base
92
-	$mode_document = 'logo' . $mode;
92
+	$mode_document = 'logo'.$mode;
93 93
 
94 94
 	include_spip('inc/documents');
95 95
 	$erreur = '';
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 		$tmp_name = false;
107 107
 		if (file_exists($source)) {
108 108
 			$tmp_name = $source;
109
-		} elseif (file_exists($f = determine_upload() . $source)) {
109
+		} elseif (file_exists($f = determine_upload().$source)) {
110 110
 			$tmp_name = $f;
111 111
 		}
112 112
 		if (!$tmp_name) {
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
 
141 141
 	if (!is_numeric($id_document)) {
142 142
 		$erreur = ($id_document ? $id_document : 'Erreur inconnue');
143
-		spip_log("Erreur ajout logo : $erreur pour source=" . json_encode($source), 'logo');
143
+		spip_log("Erreur ajout logo : $erreur pour source=".json_encode($source), 'logo');
144 144
 		return $erreur;
145 145
 	}
146 146
 
@@ -166,23 +166,23 @@  discard block
 block discarded – undo
166 166
 	$desc = $trouver_table($table);
167 167
 
168 168
 	foreach (['on', 'off'] as $mode) {
169
-		$nom_base = $type . $mode;
169
+		$nom_base = $type.$mode;
170 170
 		$dir = (defined('_DIR_LOGOS') ? _DIR_LOGOS : _DIR_IMG);
171 171
 
172
-		$files = glob($dir . $nom_base . '*');
172
+		$files = glob($dir.$nom_base.'*');
173 173
 		// est-ce que c'est une nouvelle tentative de migration ?
174 174
 		// dans ce cas les logos sont deja dans IMG/logo/
175 175
 		if (!count($files)) {
176
-			$files = glob($dir_logos . $nom_base . '*');
176
+			$files = glob($dir_logos.$nom_base.'*');
177 177
 			if (count($files)) {
178 178
 				// mais il faut verifier si ils ont pas deja ete migres pour tout ou partie
179 179
 				$filescheck = [];
180 180
 				foreach ($files as $file) {
181
-					$short = basename(dirname($file)) . DIRECTORY_SEPARATOR . basename($file);
181
+					$short = basename(dirname($file)).DIRECTORY_SEPARATOR.basename($file);
182 182
 					$filescheck[$short] = $file;
183 183
 				}
184 184
 				// trouver ceux deja migres
185
-				$deja = sql_allfetsel('fichier', 'spip_documents', sql_in('fichier', array_keys($filescheck)) . " AND mode LIKE 'logo%'");
185
+				$deja = sql_allfetsel('fichier', 'spip_documents', sql_in('fichier', array_keys($filescheck))." AND mode LIKE 'logo%'");
186 186
 				if (count($deja)) {
187 187
 					$deja = array_column($deja, 'fichier');
188 188
 					$restant = array_diff(array_keys($filescheck), $deja);
@@ -201,11 +201,11 @@  discard block
 block discarded – undo
201 201
 			}
202 202
 		}
203 203
 
204
-		spip_log("logo_migrer_en_base $objet $mode : " . count($files) . ' logos restant', 'maj' . _LOG_INFO_IMPORTANTE);
204
+		spip_log("logo_migrer_en_base $objet $mode : ".count($files).' logos restant', 'maj'._LOG_INFO_IMPORTANTE);
205 205
 
206 206
 		$deja = [];
207 207
 		foreach ($files as $file) {
208
-			$logo = substr($file, strlen($dir . $nom_base));
208
+			$logo = substr($file, strlen($dir.$nom_base));
209 209
 			$logo = explode('.', $logo);
210 210
 			if (
211 211
 				is_numeric($logo[0])
@@ -216,16 +216,16 @@  discard block
 block discarded – undo
216 216
 					// if no logo in base
217 217
 					if (!$logo or count($logo) < 6) {
218 218
 						foreach ($formats_logos as $format) {
219
-							if (@file_exists($d = ($dir . ($nom = $nom_base . intval($id_objet) . '.' . $format)))) {
219
+							if (@file_exists($d = ($dir.($nom = $nom_base.intval($id_objet).'.'.$format)))) {
220 220
 								if (isset($desc['field']['date_modif'])) {
221 221
 									$date_modif = sql_getfetsel('date_modif', $table, "$_id_objet=$id_objet");
222 222
 								} else {
223 223
 									$date_modif = null;
224 224
 								}
225 225
 								// logo_modifier commence par supprimer le logo existant, donc on le deplace pour pas le perdre
226
-								@rename($d, $dir_logos . $nom);
226
+								@rename($d, $dir_logos.$nom);
227 227
 								// et on le declare comme nouveau logo
228
-								logo_modifier($objet, $id_objet, $mode, $dir_logos . $nom);
228
+								logo_modifier($objet, $id_objet, $mode, $dir_logos.$nom);
229 229
 								if ($date_modif) {
230 230
 									sql_updateq($table, ['date_modif' => $date_modif], "$_id_objet=$id_objet");
231 231
 								}
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 			// si le fichier est encore la on le move : rien a faire ici
240 240
 			// (sauf si c'est une re-migration : il est deja dans logo/ donc il bouge pas)
241 241
 			if ($dir !== $dir_logos and file_exists($file)) {
242
-				@rename($file, $dir_logos_erreurs . basename($file));
242
+				@rename($file, $dir_logos_erreurs.basename($file));
243 243
 			}
244 244
 
245 245
 			if ($time_limit and time() > $time_limit) {
Please login to merge, or discard this patch.
ecrire/req/sqlite_generique.php 1 patch
Spacing   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -64,27 +64,27 @@  discard block
 block discarded – undo
64 64
 	// determiner le dossier de la base : $addr ou _DIR_DB
65 65
 	$f = _DIR_DB;
66 66
 	if ($addr and strpos($addr, '/') !== false) {
67
-		$f = rtrim($addr, '/') . '/';
67
+		$f = rtrim($addr, '/').'/';
68 68
 	}
69 69
 
70 70
 	// un nom de base demande et impossible d'obtenir la base, on s'en va :
71 71
 	// il faut que la base existe ou que le repertoire parent soit writable
72
-	if ($db and !is_file($f .= $db . '.sqlite') and !is_writable(dirname($f))) {
73
-		spip_log("base $f non trouvee ou droits en ecriture manquants", 'sqlite.' . _LOG_HS);
72
+	if ($db and !is_file($f .= $db.'.sqlite') and !is_writable(dirname($f))) {
73
+		spip_log("base $f non trouvee ou droits en ecriture manquants", 'sqlite.'._LOG_HS);
74 74
 
75 75
 		return false;
76 76
 	}
77 77
 
78 78
 	// charger les modules sqlite au besoin
79 79
 	if (!_sqlite_charger_version($sqlite_version)) {
80
-		spip_log("Impossible de trouver/charger le module SQLite ($sqlite_version)!", 'sqlite.' . _LOG_HS);
80
+		spip_log("Impossible de trouver/charger le module SQLite ($sqlite_version)!", 'sqlite.'._LOG_HS);
81 81
 
82 82
 		return false;
83 83
 	}
84 84
 
85 85
 	// chargement des constantes
86 86
 	// il ne faut pas definir les constantes avant d'avoir charge les modules sqlite
87
-	$define = 'spip_sqlite' . $sqlite_version . '_constantes';
87
+	$define = 'spip_sqlite'.$sqlite_version.'_constantes';
88 88
 	$define();
89 89
 
90 90
 	$ok = false;
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 		// si pas de db ->
93 93
 		// base temporaire tant qu'on ne connait pas son vrai nom
94 94
 		// pour tester la connexion
95
-		$db = '_sqlite' . $sqlite_version . '_install';
96
-		$tmp = _DIR_DB . $db . '.sqlite';
95
+		$db = '_sqlite'.$sqlite_version.'_install';
96
+		$tmp = _DIR_DB.$db.'.sqlite';
97 97
 		$ok = $link = new \PDO("sqlite:$tmp");
98 98
 	} else {
99 99
 		// Ouvrir (eventuellement creer la base)
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
 	if (!$ok) {
104 104
 		$e = _sqlite_last_error_from_link($link);
105
-		spip_log("Impossible d'ouvrir la base SQLite($sqlite_version) $f : $e", 'sqlite.' . _LOG_HS);
105
+		spip_log("Impossible d'ouvrir la base SQLite($sqlite_version) $f : $e", 'sqlite.'._LOG_HS);
106 106
 
107 107
 		return false;
108 108
 	}
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		$table = $regs[3];
189 189
 		$suite = $regs[4];
190 190
 	} else {
191
-		spip_log("SQLite : Probleme de ALTER TABLE mal forme dans $query", 'sqlite.' . _LOG_ERREUR);
191
+		spip_log("SQLite : Probleme de ALTER TABLE mal forme dans $query", 'sqlite.'._LOG_ERREUR);
192 192
 
193 193
 		return false;
194 194
 	}
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 	$i = 0;
206 206
 	$ouverte = false;
207 207
 	while ($do = array_shift($todo)) {
208
-		$todo2[$i] = isset($todo2[$i]) ? $todo2[$i] . ',' . $do : $do;
208
+		$todo2[$i] = isset($todo2[$i]) ? $todo2[$i].','.$do : $do;
209 209
 		$o = (false !== strpos($do, '('));
210 210
 		$f = (false !== strpos($do, ')'));
211 211
 		if ($o and !$f) {
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 		) {
232 232
 			spip_log(
233 233
 				"SQLite : Probleme de ALTER TABLE, utilisation non reconnue dans : $do \n(requete d'origine : $query)",
234
-				'sqlite.' . _LOG_ERREUR
234
+				'sqlite.'._LOG_ERREUR
235 235
 			);
236 236
 
237 237
 			return false;
@@ -327,10 +327,10 @@  discard block
 block discarded – undo
327 327
 
328 328
 			// pas geres en sqlite2
329 329
 			case 'RENAME':
330
-				$do = 'RENAME TO' . substr($do, 6);
330
+				$do = 'RENAME TO'.substr($do, 6);
331 331
 			case 'RENAME TO':
332 332
 				if (!spip_sqlite::executer_requete("$debut $do", $serveur)) {
333
-					spip_log("SQLite : Erreur ALTER TABLE / RENAME : $query", 'sqlite.' . _LOG_ERREUR);
333
+					spip_log("SQLite : Erreur ALTER TABLE / RENAME : $query", 'sqlite.'._LOG_ERREUR);
334 334
 
335 335
 					return false;
336 336
 				}
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 						$colonnes = substr($colonne_origine, 1, -1);
374 374
 						if (false !== strpos(',', $colonnes)) {
375 375
 							spip_log('SQLite : Erreur, impossible de creer un index sur plusieurs colonnes'
376
-								. " sans qu'il ait de nom ($table, ($colonnes))", 'sqlite.' . _LOG_ERREUR);
376
+								. " sans qu'il ait de nom ($table, ($colonnes))", 'sqlite.'._LOG_ERREUR);
377 377
 							break;
378 378
 						} else {
379 379
 							$nom_index = $colonnes;
@@ -388,12 +388,12 @@  discard block
 block discarded – undo
388 388
 
389 389
 			// pas geres en sqlite2
390 390
 			case 'ADD COLUMN':
391
-				$do = 'ADD' . substr($do, 10);
391
+				$do = 'ADD'.substr($do, 10);
392 392
 			case 'ADD':
393 393
 			default:
394 394
 				if (!preg_match(',primary\s+key,i', $do)) {
395 395
 					if (!spip_sqlite::executer_requete("$debut $do", $serveur)) {
396
-						spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.' . _LOG_ERREUR);
396
+						spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.'._LOG_ERREUR);
397 397
 
398 398
 						return false;
399 399
 					}
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 					}
414 414
 					$opts['field'] = [$colonne_ajoutee => $def];
415 415
 					if (!_sqlite_modifier_table($table, [$colonne_ajoutee], $opts, $serveur)) {
416
-						spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.' . _LOG_ERREUR);
416
+						spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.'._LOG_ERREUR);
417 417
 
418 418
 						return false;
419 419
 					}
@@ -421,10 +421,10 @@  discard block
 block discarded – undo
421 421
 				break;
422 422
 		}
423 423
 		// tout est bon, ouf !
424
-		spip_log("SQLite ($serveur) : Changements OK : $debut $do", 'sqlite.' . _LOG_INFO);
424
+		spip_log("SQLite ($serveur) : Changements OK : $debut $do", 'sqlite.'._LOG_INFO);
425 425
 	}
426 426
 
427
-	spip_log("SQLite ($serveur) : fin ALTER TABLE OK !", 'sqlite.' . _LOG_INFO);
427
+	spip_log("SQLite ($serveur) : fin ALTER TABLE OK !", 'sqlite.'._LOG_INFO);
428 428
 
429 429
 	return true;
430 430
 }
@@ -493,9 +493,9 @@  discard block
 block discarded – undo
493 493
  * @return bool true si la base est créee.
494 494
  **/
495 495
 function spip_sqlite_create_base($nom, $serveur = '', $option = true) {
496
-	$f = $nom . '.sqlite';
496
+	$f = $nom.'.sqlite';
497 497
 	if (strpos($nom, '/') === false) {
498
-		$f = _DIR_DB . $f;
498
+		$f = _DIR_DB.$f;
499 499
 	}
500 500
 
501 501
 	$ok = new \PDO("sqlite:$f");
@@ -535,13 +535,13 @@  discard block
 block discarded – undo
535 535
 	if (sql_showtable($nom, false, $serveur)) {
536 536
 		spip_log(
537 537
 			"Echec creation d'une vue sql ($nom) car celle-ci existe deja (serveur:$serveur)",
538
-			'sqlite.' . _LOG_ERREUR
538
+			'sqlite.'._LOG_ERREUR
539 539
 		);
540 540
 
541 541
 		return false;
542 542
 	}
543 543
 
544
-	$query = "CREATE VIEW $nom AS " . $query_select;
544
+	$query = "CREATE VIEW $nom AS ".$query_select;
545 545
 
546 546
 	return spip_sqlite_query($query, $serveur, $requeter);
547 547
 }
@@ -567,8 +567,8 @@  discard block
 block discarded – undo
567 567
 function spip_sqlite_create_index($nom, $table, $champs, $unique = '', $serveur = '', $requeter = true) {
568 568
 	if (!($nom or $table or $champs)) {
569 569
 		spip_log(
570
-			"Champ manquant pour creer un index sqlite ($nom, $table, (" . join(',', $champs) . '))',
571
-			'sqlite.' . _LOG_ERREUR
570
+			"Champ manquant pour creer un index sqlite ($nom, $table, (".join(',', $champs).'))',
571
+			'sqlite.'._LOG_ERREUR
572 572
 		);
573 573
 
574 574
 		return false;
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 
577 577
 	// SQLite ne differentie pas noms des index en fonction des tables
578 578
 	// il faut donc creer des noms uniques d'index pour une base sqlite
579
-	$nom = $table . '_' . $nom;
579
+	$nom = $table.'_'.$nom;
580 580
 	// enlever d'eventuelles parentheses deja presentes sur champs
581 581
 	if (!is_array($champs)) {
582 582
 		if ($champs[0] == '(') {
@@ -598,12 +598,12 @@  discard block
 block discarded – undo
598 598
 	} else {
599 599
 		/* simuler le IF EXISTS - version 2 et sqlite < 3.3a */
600 600
 		$a = spip_sqlite_showtable($table, $serveur);
601
-		if (isset($a['key']['KEY ' . $nom])) {
601
+		if (isset($a['key']['KEY '.$nom])) {
602 602
 			return true;
603 603
 		}
604 604
 	}
605 605
 
606
-	$query = 'CREATE ' . ($unique ? 'UNIQUE ' : '') . "INDEX$ifnotexists $nom ON $table (" . join(',', $champs) . ')';
606
+	$query = 'CREATE '.($unique ? 'UNIQUE ' : '')."INDEX$ifnotexists $nom ON $table (".join(',', $champs).')';
607 607
 	$res = spip_sqlite_query($query, $serveur, $requeter);
608 608
 	if (!$requeter) {
609 609
 		return $res;
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
 	$serveur = '',
680 680
 	$requeter = true
681 681
 ) {
682
-	$c = !$groupby ? '*' : ('DISTINCT ' . (is_string($groupby) ? $groupby : join(',', $groupby)));
682
+	$c = !$groupby ? '*' : ('DISTINCT '.(is_string($groupby) ? $groupby : join(',', $groupby)));
683 683
 	$r = spip_sqlite_select(
684 684
 		"COUNT($c)",
685 685
 		$from,
@@ -788,14 +788,14 @@  discard block
 block discarded – undo
788 788
  */
789 789
 function spip_sqlite_drop_index($nom, $table, $serveur = '', $requeter = true) {
790 790
 	if (!($nom or $table)) {
791
-		spip_log("Champ manquant pour supprimer un index sqlite ($nom, $table)", 'sqlite.' . _LOG_ERREUR);
791
+		spip_log("Champ manquant pour supprimer un index sqlite ($nom, $table)", 'sqlite.'._LOG_ERREUR);
792 792
 
793 793
 		return false;
794 794
 	}
795 795
 
796 796
 	// SQLite ne differentie pas noms des index en fonction des tables
797 797
 	// il faut donc creer des noms uniques d'index pour une base sqlite
798
-	$index = $table . '_' . $nom;
798
+	$index = $table.'_'.$nom;
799 799
 	$exist = ' IF EXISTS';
800 800
 
801 801
 	$query = "DROP INDEX$exist $index";
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 	if ($s) {
828 828
 		$trace = debug_backtrace();
829 829
 		if ($trace[0]['function'] != 'spip_sqlite_error') {
830
-			spip_log("$s - $query - " . sql_error_backtrace(), 'sqlite.' . _LOG_ERREUR);
830
+			spip_log("$s - $query - ".sql_error_backtrace(), 'sqlite.'._LOG_ERREUR);
831 831
 		}
832 832
 	}
833 833
 
@@ -874,14 +874,14 @@  discard block
 block discarded – undo
874 874
 		$t = $link->errorInfo();
875 875
 		$s = ltrim($t[0], '0'); // 00000 si pas d'erreur
876 876
 		if ($s) {
877
-			$s .= ' / ' . $t[1];
877
+			$s .= ' / '.$t[1];
878 878
 		} // ajoute l'erreur du moteur SQLite
879 879
 	} else {
880 880
 		$s = ': aucune ressource sqlite (link)';
881 881
 	}
882 882
 
883 883
 	if ($s) {
884
-		spip_log("Erreur sqlite $s", 'sqlite.' . _LOG_ERREUR);
884
+		spip_log("Erreur sqlite $s", 'sqlite.'._LOG_ERREUR);
885 885
 	}
886 886
 
887 887
 	return $s ? $s : 0;
@@ -905,7 +905,7 @@  discard block
 block discarded – undo
905 905
 	}
906 906
 
907 907
 	$query = spip_sqlite::traduire_requete($query, $serveur);
908
-	$query = 'EXPLAIN ' . $query;
908
+	$query = 'EXPLAIN '.$query;
909 909
 	if (!$requeter) {
910 910
 		return $query;
911 911
 	}
@@ -1066,7 +1066,7 @@  discard block
 block discarded – undo
1066 1066
  **/
1067 1067
 function spip_sqlite_insert($table, $champs, $valeurs, $desc = [], $serveur = '', $requeter = true) {
1068 1068
 
1069
-	$query = "INSERT INTO $table " . ($champs ? "$champs VALUES $valeurs" : 'DEFAULT VALUES');
1069
+	$query = "INSERT INTO $table ".($champs ? "$champs VALUES $valeurs" : 'DEFAULT VALUES');
1070 1070
 	if ($r = spip_sqlite_query($query, $serveur, $requeter)) {
1071 1071
 		if (!$requeter) {
1072 1072
 			return $r;
@@ -1121,8 +1121,8 @@  discard block
 block discarded – undo
1121 1121
 
1122 1122
 	$cles = $valeurs = '';
1123 1123
 	if (count($couples)) {
1124
-		$cles = '(' . join(',', array_keys($couples)) . ')';
1125
-		$valeurs = '(' . join(',', $couples) . ')';
1124
+		$cles = '('.join(',', array_keys($couples)).')';
1125
+		$valeurs = '('.join(',', $couples).')';
1126 1126
 	}
1127 1127
 
1128 1128
 	return spip_sqlite_insert($table, $cles, $valeurs, $desc, $serveur, $requeter);
@@ -1182,11 +1182,11 @@  discard block
 block discarded – undo
1182 1182
 
1183 1183
 		$champs = $valeurs = '';
1184 1184
 		if (count($couples)) {
1185
-			$champs = '(' . join(',', array_keys($couples)) . ')';
1186
-			$valeurs = '(' . join(',', $couples) . ')';
1187
-			$query = $query_start . "$champs VALUES $valeurs";
1185
+			$champs = '('.join(',', array_keys($couples)).')';
1186
+			$valeurs = '('.join(',', $couples).')';
1187
+			$query = $query_start."$champs VALUES $valeurs";
1188 1188
 		} else {
1189
-			$query = $query_start . 'DEFAULT VALUES';
1189
+			$query = $query_start.'DEFAULT VALUES';
1190 1190
 		}
1191 1191
 
1192 1192
 		if ($requeter) {
@@ -1318,7 +1318,7 @@  discard block
 block discarded – undo
1318 1318
  * @return string       Texte de sélection pour la requête
1319 1319
  */
1320 1320
 function spip_sqlite_multi($objet, $lang) {
1321
-	$r = 'EXTRAIRE_MULTI(' . $objet . ", '" . $lang . "') AS multi";
1321
+	$r = 'EXTRAIRE_MULTI('.$objet.", '".$lang."') AS multi";
1322 1322
 
1323 1323
 	return $r;
1324 1324
 }
@@ -1389,7 +1389,7 @@  discard block
 block discarded – undo
1389 1389
 function spip_sqlite_date_proche($champ, $interval, $unite) {
1390 1390
 	$op = (($interval <= 0) ? '>' : '<');
1391 1391
 
1392
-	return "($champ $op datetime('" . date('Y-m-d H:i:s') . "', '$interval $unite'))";
1392
+	return "($champ $op datetime('".date('Y-m-d H:i:s')."', '$interval $unite'))";
1393 1393
 }
1394 1394
 
1395 1395
 
@@ -1421,7 +1421,7 @@  discard block
 block discarded – undo
1421 1421
 				and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c)
1422 1422
 			) {
1423 1423
 				spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT ''", $serveur);
1424
-				spip_log("ALTER $q", 'repair' . _LOG_INFO_IMPORTANTE);
1424
+				spip_log("ALTER $q", 'repair'._LOG_INFO_IMPORTANTE);
1425 1425
 			}
1426 1426
 			if (
1427 1427
 				preg_match(',^(INTEGER),i', $d)
@@ -1431,7 +1431,7 @@  discard block
 block discarded – undo
1431 1431
 				and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c)
1432 1432
 			) {
1433 1433
 				spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT '0'", $serveur);
1434
-				spip_log("ALTER $q", 'repair' . _LOG_INFO_IMPORTANTE);
1434
+				spip_log("ALTER $q", 'repair'._LOG_INFO_IMPORTANTE);
1435 1435
 			}
1436 1436
 			if (
1437 1437
 				preg_match(',^(datetime),i', $d)
@@ -1441,7 +1441,7 @@  discard block
 block discarded – undo
1441 1441
 				and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c)
1442 1442
 			) {
1443 1443
 				spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT '0000-00-00 00:00:00'", $serveur);
1444
-				spip_log("ALTER $q", 'repair' . _LOG_INFO_IMPORTANTE);
1444
+				spip_log("ALTER $q", 'repair'._LOG_INFO_IMPORTANTE);
1445 1445
 			}
1446 1446
 		}
1447 1447
 
@@ -1492,10 +1492,10 @@  discard block
 block discarded – undo
1492 1492
 	// recherche de champs 'timestamp' pour mise a jour auto de ceux-ci
1493 1493
 	$couples = _sqlite_ajouter_champs_timestamp($table, $couples, $desc, $serveur);
1494 1494
 
1495
-	return spip_sqlite_query("REPLACE INTO $table (" . join(',', array_keys($couples)) . ') VALUES (' . join(
1495
+	return spip_sqlite_query("REPLACE INTO $table (".join(',', array_keys($couples)).') VALUES ('.join(
1496 1496
 		',',
1497 1497
 		$couples
1498
-	) . ')', $serveur);
1498
+	).')', $serveur);
1499 1499
 }
1500 1500
 
1501 1501
 
@@ -1581,7 +1581,7 @@  discard block
 block discarded – undo
1581 1581
 		. _sqlite_calculer_expression('WHERE', $where)
1582 1582
 		. _sqlite_calculer_expression('GROUP BY', $groupby, ',')
1583 1583
 		. _sqlite_calculer_expression('HAVING', $having)
1584
-		. ($orderby ? ("\nORDER BY " . _sqlite_calculer_order($orderby)) : '')
1584
+		. ($orderby ? ("\nORDER BY "._sqlite_calculer_order($orderby)) : '')
1585 1585
 		. ($limit ? "\nLIMIT $limit" : '');
1586 1586
 
1587 1587
 	// dans un select, on doit renvoyer la requête en cas d'erreur
@@ -1619,10 +1619,10 @@  discard block
 block discarded – undo
1619 1619
 	// interdire la creation d'une nouvelle base,
1620 1620
 	// sauf si on est dans l'installation
1621 1621
 	if (
1622
-		!is_file($f = _DIR_DB . $db . '.sqlite')
1622
+		!is_file($f = _DIR_DB.$db.'.sqlite')
1623 1623
 		&& (!defined('_ECRIRE_INSTALL') || !_ECRIRE_INSTALL)
1624 1624
 	) {
1625
-		spip_log("Il est interdit de creer la base $db", 'sqlite.' . _LOG_HS);
1625
+		spip_log("Il est interdit de creer la base $db", 'sqlite.'._LOG_HS);
1626 1626
 
1627 1627
 		return false;
1628 1628
 	}
@@ -1631,12 +1631,12 @@  discard block
 block discarded – undo
1631 1631
 	// avec les identifiants connus
1632 1632
 	$index = $serveur ? $serveur : 0;
1633 1633
 
1634
-	if ($link = spip_connect_db('', '', '', '', '@selectdb@' . $db, $serveur, '', '')) {
1634
+	if ($link = spip_connect_db('', '', '', '', '@selectdb@'.$db, $serveur, '', '')) {
1635 1635
 		if (($db == $link['db']) && $GLOBALS['connexions'][$index] = $link) {
1636 1636
 			return $db;
1637 1637
 		}
1638 1638
 	} else {
1639
-		spip_log("Impossible de selectionner la base $db", 'sqlite.' . _LOG_HS);
1639
+		spip_log("Impossible de selectionner la base $db", 'sqlite.'._LOG_HS);
1640 1640
 
1641 1641
 		return false;
1642 1642
 	}
@@ -1687,7 +1687,7 @@  discard block
 block discarded – undo
1687 1687
 	$match = "^$match$";
1688 1688
 
1689 1689
 	return spip_sqlite_query(
1690
-		"SELECT name FROM sqlite_master WHERE type='table' AND tbl_name REGEXP " . _q($match),
1690
+		"SELECT name FROM sqlite_master WHERE type='table' AND tbl_name REGEXP "._q($match),
1691 1691
 		$serveur,
1692 1692
 		$requeter
1693 1693
 	);
@@ -1710,7 +1710,7 @@  discard block
 block discarded – undo
1710 1710
 	$r = spip_sqlite_query(
1711 1711
 		'SELECT name FROM sqlite_master WHERE'
1712 1712
 		. ' type=\'table\''
1713
-		. ' AND name=' . spip_sqlite_quote($table, 'string')
1713
+		. ' AND name='.spip_sqlite_quote($table, 'string')
1714 1714
 		. ' AND name NOT LIKE \'sqlite_%\'',
1715 1715
 		$serveur,
1716 1716
 		$requeter
@@ -1807,7 +1807,7 @@  discard block
 block discarded – undo
1807 1807
 				// s'il y a une parenthèse fermante dans la clé
1808 1808
 				// ou dans la définition sans qu'il n'y ait une ouverture avant
1809 1809
 				if (false !== strpos($k, ')') or preg_match('/^[^\(]*\)/', $def)) {
1810
-					$fields[$k_precedent] .= ',' . $k . ' ' . $def;
1810
+					$fields[$k_precedent] .= ','.$k.' '.$def;
1811 1811
 					continue;
1812 1812
 				}
1813 1813
 
@@ -1842,13 +1842,13 @@  discard block
 block discarded – undo
1842 1842
 				. 'ORDER BY substr(type,2,1), name';
1843 1843
 			$a = spip_sqlite_query($query, $serveur, $requeter);
1844 1844
 			while ($r = spip_sqlite_fetch($a, null, $serveur)) {
1845
-				$key = str_replace($nom_table . '_', '', $r['name']); // enlever le nom de la table ajoute a l'index
1845
+				$key = str_replace($nom_table.'_', '', $r['name']); // enlever le nom de la table ajoute a l'index
1846 1846
 				$keytype = 'KEY';
1847 1847
 				if (strpos($r['sql'], 'UNIQUE INDEX') !== false) {
1848 1848
 					$keytype = 'UNIQUE KEY';
1849 1849
 				}
1850 1850
 				$colonnes = preg_replace(',.*\((.*)\).*,', '$1', $r['sql']);
1851
-				$keys[$keytype . ' ' . $key] = $colonnes;
1851
+				$keys[$keytype.' '.$key] = $colonnes;
1852 1852
 			}
1853 1853
 		}
1854 1854
 	} // c'est une vue, on liste les champs disponibles simplement
@@ -1895,7 +1895,7 @@  discard block
 block discarded – undo
1895 1895
 
1896 1896
 	$set = [];
1897 1897
 	foreach ($champs as $champ => $val) {
1898
-		$set[] = $champ . "=$val";
1898
+		$set[] = $champ."=$val";
1899 1899
 	}
1900 1900
 	if (!empty($set)) {
1901 1901
 		return spip_sqlite_query(
@@ -1948,7 +1948,7 @@  discard block
 block discarded – undo
1948 1948
 
1949 1949
 	$set = [];
1950 1950
 	foreach ($champs as $champ => $val) {
1951
-		$set[$champ] = $champ . '=' . _sqlite_calculer_cite($val, isset($fields[$champ]) ? $fields[$champ] : '');
1951
+		$set[$champ] = $champ.'='._sqlite_calculer_cite($val, isset($fields[$champ]) ? $fields[$champ] : '');
1952 1952
 	}
1953 1953
 
1954 1954
 	// recherche de champs 'timestamp' pour mise a jour auto de ceux-ci
@@ -1956,7 +1956,7 @@  discard block
 block discarded – undo
1956 1956
 	$maj = _sqlite_ajouter_champs_timestamp($table, [], $desc, $serveur);
1957 1957
 	foreach ($maj as $champ => $val) {
1958 1958
 		if (!isset($set[$champ])) {
1959
-			$set[$champ] = $champ . '=' . $val;
1959
+			$set[$champ] = $champ.'='.$val;
1960 1960
 		}
1961 1961
 	}
1962 1962
 
@@ -1985,7 +1985,7 @@  discard block
 block discarded – undo
1985 1985
  */
1986 1986
 function _sqlite_init() {
1987 1987
 	if (!defined('_DIR_DB')) {
1988
-		define('_DIR_DB', _DIR_ETC . 'bases/');
1988
+		define('_DIR_DB', _DIR_ETC.'bases/');
1989 1989
 	}
1990 1990
 	if (!defined('_SQLITE_CHMOD')) {
1991 1991
 		define('_SQLITE_CHMOD', _SPIP_CHMOD);
@@ -2092,9 +2092,9 @@  discard block
 block discarded – undo
2092 2092
 	}
2093 2093
 
2094 2094
 	// echapper les ' en ''
2095
-	spip_log('Pas de methode ->quote pour echapper', 'sqlite.' . _LOG_INFO_IMPORTANTE);
2095
+	spip_log('Pas de methode ->quote pour echapper', 'sqlite.'._LOG_INFO_IMPORTANTE);
2096 2096
 
2097
-	return ("'" . str_replace("'", "''", $v) . "'");
2097
+	return ("'".str_replace("'", "''", $v)."'");
2098 2098
 }
2099 2099
 
2100 2100
 
@@ -2117,12 +2117,12 @@  discard block
 block discarded – undo
2117 2117
 	$exp = "\n$expression ";
2118 2118
 
2119 2119
 	if (!is_array($v)) {
2120
-		return $exp . $v;
2120
+		return $exp.$v;
2121 2121
 	} else {
2122 2122
 		if (strtoupper($join) === 'AND') {
2123
-			return $exp . join("\n\t$join ", array_map('_sqlite_calculer_where', $v));
2123
+			return $exp.join("\n\t$join ", array_map('_sqlite_calculer_where', $v));
2124 2124
 		} else {
2125
-			return $exp . join($join, $v);
2125
+			return $exp.join($join, $v);
2126 2126
 		}
2127 2127
 	}
2128 2128
 }
@@ -2156,17 +2156,17 @@  discard block
 block discarded – undo
2156 2156
 		if (substr($k, -1) == '@') {
2157 2157
 			// c'est une jointure qui se refere au from precedent
2158 2158
 			// pas de virgule
2159
-			$res .= '  ' . $v;
2159
+			$res .= '  '.$v;
2160 2160
 		} else {
2161 2161
 			if (!is_numeric($k)) {
2162 2162
 				$p = strpos($v, ' ');
2163 2163
 				if ($p) {
2164
-					$v = substr($v, 0, $p) . " AS '$k'" . substr($v, $p);
2164
+					$v = substr($v, 0, $p)." AS '$k'".substr($v, $p);
2165 2165
 				} else {
2166 2166
 					$v .= " AS '$k'";
2167 2167
 				}
2168 2168
 			}
2169
-			$res .= ', ' . $v;
2169
+			$res .= ', '.$v;
2170 2170
 		}
2171 2171
 	}
2172 2172
 
@@ -2304,13 +2304,13 @@  discard block
 block discarded – undo
2304 2304
 
2305 2305
 	$def_origine = sql_showtable($table_origine, false, $serveur);
2306 2306
 	if (!$def_origine or !isset($def_origine['field'])) {
2307
-		spip_log("Alter table impossible sur $table_origine : table non trouvee", 'sqlite' . _LOG_ERREUR);
2307
+		spip_log("Alter table impossible sur $table_origine : table non trouvee", 'sqlite'._LOG_ERREUR);
2308 2308
 
2309 2309
 		return false;
2310 2310
 	}
2311 2311
 
2312 2312
 
2313
-	$table_tmp = $table_origine . '_tmp';
2313
+	$table_tmp = $table_origine.'_tmp';
2314 2314
 
2315 2315
 	// 1) creer une table temporaire avec les modifications
2316 2316
 	// - DROP : suppression de la colonne
@@ -2397,7 +2397,7 @@  discard block
 block discarded – undo
2397 2397
 		} else {
2398 2398
 			// enlever KEY
2399 2399
 			$k = substr($k, 4);
2400
-			$queries[] = "CREATE INDEX $table_destination" . "_$k ON $table_destination ($v)";
2400
+			$queries[] = "CREATE INDEX $table_destination"."_$k ON $table_destination ($v)";
2401 2401
 		}
2402 2402
 	}
2403 2403
 
@@ -2408,7 +2408,7 @@  discard block
 block discarded – undo
2408 2408
 		foreach ($queries as $q) {
2409 2409
 			if (!spip_sqlite::executer_requete($q, $serveur)) {
2410 2410
 				spip_log('SQLite : ALTER TABLE table :'
2411
-					. " Erreur a l'execution de la requete : $q", 'sqlite.' . _LOG_ERREUR);
2411
+					. " Erreur a l'execution de la requete : $q", 'sqlite.'._LOG_ERREUR);
2412 2412
 				spip_sqlite::annuler_transaction($serveur);
2413 2413
 
2414 2414
 				return false;
@@ -2498,27 +2498,27 @@  discard block
 block discarded – undo
2498 2498
 	$enum = '(\s*\([^\)]*\))?';
2499 2499
 
2500 2500
 	$remplace = [
2501
-		'/enum' . $enum . '/is' => 'VARCHAR(255)',
2501
+		'/enum'.$enum.'/is' => 'VARCHAR(255)',
2502 2502
 		'/COLLATE \w+_bin/is' => 'COLLATE BINARY',
2503 2503
 		'/COLLATE \w+_ci/is' => 'COLLATE NOCASE',
2504 2504
 		'/auto_increment/is' => '',
2505 2505
 		'/current_timestamp\(\)/is' => 'CURRENT_TIMESTAMP', // Fix export depuis mariaDB #4374
2506 2506
 		'/(timestamp .* )ON .*$/is' => '\\1',
2507 2507
 		'/character set \w+/is' => '',
2508
-		'/((big|small|medium|tiny)?int(eger)?)' . $num . '\s*unsigned/is' => '\\1 UNSIGNED',
2508
+		'/((big|small|medium|tiny)?int(eger)?)'.$num.'\s*unsigned/is' => '\\1 UNSIGNED',
2509 2509
 		'/(text\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''",
2510
-		'/((char|varchar)' . $num . '\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''",
2510
+		'/((char|varchar)'.$num.'\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''",
2511 2511
 		'/(datetime\s+not\s+null)\s*$/is' => "\\1 DEFAULT '0000-00-00 00:00:00'",
2512 2512
 		'/(date\s+not\s+null)\s*$/is' => "\\1 DEFAULT '0000-00-00'",
2513 2513
 	];
2514 2514
 
2515 2515
 	// pour l'autoincrement, il faut des INTEGER NOT NULL PRIMARY KEY
2516 2516
 	$remplace_autocinc = [
2517
-		'/(big|small|medium|tiny)?int(eger)?' . $num . '/is' => 'INTEGER'
2517
+		'/(big|small|medium|tiny)?int(eger)?'.$num.'/is' => 'INTEGER'
2518 2518
 	];
2519 2519
 	// pour les int non autoincrement, il faut un DEFAULT
2520 2520
 	$remplace_nonautocinc = [
2521
-		'/((big|small|medium|tiny)?int(eger)?' . $num . '\s+not\s+null)\s*$/is' => "\\1 DEFAULT 0",
2521
+		'/((big|small|medium|tiny)?int(eger)?'.$num.'\s+not\s+null)\s*$/is' => "\\1 DEFAULT 0",
2522 2522
 	];
2523 2523
 
2524 2524
 	if (is_string($query)) {
@@ -2560,7 +2560,7 @@  discard block
 block discarded – undo
2560 2560
 		return str_ireplace('BINARY', 'COLLATE BINARY', $champ);
2561 2561
 	}
2562 2562
 	if (preg_match(',^(char|varchar|(long|small|medium|tiny)?text),i', $champ)) {
2563
-		return $champ . ' COLLATE NOCASE';
2563
+		return $champ.' COLLATE NOCASE';
2564 2564
 	}
2565 2565
 
2566 2566
 	return $champ;
@@ -2650,14 +2650,14 @@  discard block
 block discarded – undo
2650 2650
 		} else {
2651 2651
 			/* simuler le IF EXISTS - version 2 et sqlite < 3.3a */
2652 2652
 			$a = spip_sqlite_showtable($nom, $serveur);
2653
-			if (isset($a['key']['KEY ' . $nom])) {
2653
+			if (isset($a['key']['KEY '.$nom])) {
2654 2654
 				return true;
2655 2655
 			}
2656 2656
 		}
2657 2657
 	}
2658 2658
 
2659 2659
 	$temporary = $temporary ? ' TEMPORARY' : '';
2660
-	$q = "CREATE$temporary TABLE$ifnotexists $nom ($query" . ($keys ? ",$keys" : '') . ")\n";
2660
+	$q = "CREATE$temporary TABLE$ifnotexists $nom ($query".($keys ? ",$keys" : '').")\n";
2661 2661
 
2662 2662
 	return $q;
2663 2663
 }
@@ -2878,7 +2878,7 @@  discard block
 block discarded – undo
2878 2878
 		$this->serveur = strtolower($serveur);
2879 2879
 
2880 2880
 		if (!($this->link = _sqlite_link($this->serveur)) && (!defined('_ECRIRE_INSTALL') || !_ECRIRE_INSTALL)) {
2881
-			spip_log('Aucune connexion sqlite (link)', 'sqlite.' . _LOG_ERREUR);
2881
+			spip_log('Aucune connexion sqlite (link)', 'sqlite.'._LOG_ERREUR);
2882 2882
 
2883 2883
 			return false;
2884 2884
 		}
@@ -2924,7 +2924,7 @@  discard block
 block discarded – undo
2924 2924
 			try {
2925 2925
 				$r = $this->link->query($query);
2926 2926
 			} catch (\PDOException $e) {
2927
-				spip_log('PDOException: ' . $e->getMessage(), 'sqlite.' . _LOG_DEBUG);
2927
+				spip_log('PDOException: '.$e->getMessage(), 'sqlite.'._LOG_DEBUG);
2928 2928
 				$r = false;
2929 2929
 			}
2930 2930
 			// sauvegarde de la requete (elle y est deja dans $r->queryString)
@@ -2945,11 +2945,11 @@  discard block
 block discarded – undo
2945 2945
 
2946 2946
 			// loger les warnings/erreurs eventuels de sqlite remontant dans PHP
2947 2947
 			if ($e and $e instanceof \PDOException) {
2948
-				$err = strip_tags($e->getMessage()) . ' in ' . $e->getFile() . ' line ' . $e->getLine();
2949
-				spip_log("$err - " . $query, 'sqlite.' . _LOG_ERREUR);
2948
+				$err = strip_tags($e->getMessage()).' in '.$e->getFile().' line '.$e->getLine();
2949
+				spip_log("$err - ".$query, 'sqlite.'._LOG_ERREUR);
2950 2950
 			} elseif ($err = (function_exists('error_get_last') ? error_get_last() : '') and $err != $last_error) {
2951
-				$err = strip_tags($err['message']) . ' in ' . $err['file'] . ' line ' . $err['line'];
2952
-				spip_log("$err - " . $query, 'sqlite.' . _LOG_ERREUR);
2951
+				$err = strip_tags($err['message']).' in '.$err['file'].' line '.$err['line'];
2952
+				spip_log("$err - ".$query, 'sqlite.'._LOG_ERREUR);
2953 2953
 			} else {
2954 2954
 				$err = '';
2955 2955
 			}
@@ -3027,15 +3027,15 @@  discard block
 block discarded – undo
3027 3027
 		// Correction Create Database
3028 3028
 		// Create Database -> requete ignoree
3029 3029
 		if (strpos($this->query, 'CREATE DATABASE') === 0) {
3030
-			spip_log("Sqlite : requete non executee -> $this->query", 'sqlite.' . _LOG_AVERTISSEMENT);
3030
+			spip_log("Sqlite : requete non executee -> $this->query", 'sqlite.'._LOG_AVERTISSEMENT);
3031 3031
 			$this->query = 'SELECT 1';
3032 3032
 		}
3033 3033
 
3034 3034
 		// Correction Insert Ignore
3035 3035
 		// INSERT IGNORE -> insert (tout court et pas 'insert or replace')
3036 3036
 		if (strpos($this->query, 'INSERT IGNORE') === 0) {
3037
-			spip_log("Sqlite : requete transformee -> $this->query", 'sqlite.' . _LOG_DEBUG);
3038
-			$this->query = 'INSERT ' . substr($this->query, '13');
3037
+			spip_log("Sqlite : requete transformee -> $this->query", 'sqlite.'._LOG_DEBUG);
3038
+			$this->query = 'INSERT '.substr($this->query, '13');
3039 3039
 		}
3040 3040
 
3041 3041
 		// Correction des dates avec INTERVAL
@@ -3063,7 +3063,7 @@  discard block
 block discarded – undo
3063 3063
 		if (($this->sqlite_version == 2) && (strpos($this->query, 'USING') !== false)) {
3064 3064
 			spip_log(
3065 3065
 				"'USING (champ)' n'est pas reconnu en SQLite 2. Utilisez 'ON table1.champ = table2.champ'",
3066
-				'sqlite.' . _LOG_ERREUR
3066
+				'sqlite.'._LOG_ERREUR
3067 3067
 			);
3068 3068
 			$this->query = preg_replace('/USING\s*\([^\)]*\)/', '', $this->query);
3069 3069
 		}
@@ -3086,8 +3086,8 @@  discard block
 block discarded – undo
3086 3086
 		} else {
3087 3087
 			$suite = '';
3088 3088
 		}
3089
-		$pref = ($this->prefixe) ? $this->prefixe . '_' : '';
3090
-		$this->query = preg_replace('/([,\s])spip_/S', '\1' . $pref, $this->query) . $suite;
3089
+		$pref = ($this->prefixe) ? $this->prefixe.'_' : '';
3090
+		$this->query = preg_replace('/([,\s])spip_/S', '\1'.$pref, $this->query).$suite;
3091 3091
 
3092 3092
 		// Correction zero AS x
3093 3093
 		// pg n'aime pas 0+x AS alias, sqlite, dans le meme style,
Please login to merge, or discard this patch.