Completed
Push — master ( 81a660...8ce9c8 )
by cam
01:32
created
ecrire/src/Sql/Sqlite/Traducteur.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -48,15 +48,15 @@  discard block
 block discarded – undo
48 48
 		// Correction Create Database
49 49
 		// Create Database -> requete ignoree
50 50
 		if (str_starts_with($this->query, 'CREATE DATABASE')) {
51
-			spip_log("Sqlite : requete non executee -> $this->query", 'sqlite.' . _LOG_AVERTISSEMENT);
51
+			spip_log("Sqlite : requete non executee -> $this->query", 'sqlite.'._LOG_AVERTISSEMENT);
52 52
 			$this->query = 'SELECT 1';
53 53
 		}
54 54
 
55 55
 		// Correction Insert Ignore
56 56
 		// INSERT IGNORE -> insert (tout court et pas 'insert or replace')
57 57
 		if (str_starts_with($this->query, 'INSERT IGNORE')) {
58
-			spip_log("Sqlite : requete transformee -> $this->query", 'sqlite.' . _LOG_DEBUG);
59
-			$this->query = 'INSERT ' . substr($this->query, '13');
58
+			spip_log("Sqlite : requete transformee -> $this->query", 'sqlite.'._LOG_DEBUG);
59
+			$this->query = 'INSERT '.substr($this->query, '13');
60 60
 		}
61 61
 
62 62
 		// Correction des dates avec INTERVAL
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 		if (($this->sqlite_version == 2) && (str_contains($this->query, 'USING'))) {
85 85
 			spip_log(
86 86
 				"'USING (champ)' n'est pas reconnu en SQLite 2. Utilisez 'ON table1.champ = table2.champ'",
87
-				'sqlite.' . _LOG_ERREUR
87
+				'sqlite.'._LOG_ERREUR
88 88
 			);
89 89
 			$this->query = preg_replace('/USING\s*\([^\)]*\)/', '', $this->query);
90 90
 		}
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
 		} else {
108 108
 			$suite = '';
109 109
 		}
110
-		$pref = ($this->prefixe) ? $this->prefixe . '_' : '';
111
-		$this->query = preg_replace('/([,\s])spip_/S', '\1' . $pref, $this->query) . $suite;
110
+		$pref = ($this->prefixe) ? $this->prefixe.'_' : '';
111
+		$this->query = preg_replace('/([,\s])spip_/S', '\1'.$pref, $this->query).$suite;
112 112
 
113 113
 		// Correction zero AS x
114 114
 		// pg n'aime pas 0+x AS alias, sqlite, dans le meme style,
Please login to merge, or discard this patch.
ecrire/src/Compilateur/Iterateur/Decorator.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 				return $this->iter->{$nom}();
136 136
 			} catch (Exception) {
137 137
 				// #GETCHILDREN sur un fichier de DirectoryIterator ...
138
-				spip_log("Methode {$nom} en echec sur " . $this->iter::class);
138
+				spip_log("Methode {$nom} en echec sur ".$this->iter::class);
139 139
 				spip_log("Cela peut être normal : retour d'une ligne de resultat ne pouvant pas calculer cette methode");
140 140
 
141 141
 				return '';
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 			return null;
357 357
 		}
358 358
 
359
-		return '(' . implode(") {$operateur} (", $filtres_string) . ')';
359
+		return '('.implode(") {$operateur} (", $filtres_string).')';
360 360
 	}
361 361
 
362 362
 	/**
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 			return $this->composer_filtre($v[1], $v[0], $v[2]);
440 440
 		}
441 441
 
442
-		return null;  // sera ignore
442
+		return null; // sera ignore
443 443
 	}
444 444
 
445 445
 	/**
@@ -468,28 +468,28 @@  discard block
 block discarded – undo
468 468
 		// if (!in_array($cle, array('cle', 'valeur')))
469 469
 		//	return;
470 470
 
471
-		$a = '$this->get_select(\'' . $cle . '\')';
471
+		$a = '$this->get_select(\''.$cle.'\')';
472 472
 
473 473
 		$filtre = '';
474 474
 
475 475
 		if ('REGEXP' == $op) {
476
-			$filtre = 'filtrer("match", ' . $a . ', ' . str_replace('\"', '"', $valeur) . ')';
476
+			$filtre = 'filtrer("match", '.$a.', '.str_replace('\"', '"', $valeur).')';
477 477
 			$op = '';
478 478
 		} else {
479 479
 			if ('LIKE' == $op) {
480 480
 				$valeur = str_replace(['\"', '_', '%'], ['"', '.', '.*'], preg_quote($valeur));
481
-				$filtre = 'filtrer("match", ' . $a . ', ' . $valeur . ')';
481
+				$filtre = 'filtrer("match", '.$a.', '.$valeur.')';
482 482
 				$op = '';
483 483
 			} else {
484 484
 				if ('=' == $op) {
485 485
 					$op = '==';
486 486
 				} else {
487 487
 					if ('IN' == $op) {
488
-						$filtre = 'in_array(' . $a . ', array' . $valeur . ')';
488
+						$filtre = 'in_array('.$a.', array'.$valeur.')';
489 489
 						$op = '';
490 490
 					} else {
491 491
 						if (!in_array($op, ['<', '<=', '>', '>='])) {
492
-							spip_log('operateur non reconnu ' . $op); // [todo] mettre une erreur de squelette
492
+							spip_log('operateur non reconnu '.$op); // [todo] mettre une erreur de squelette
493 493
 							$op = '';
494 494
 						}
495 495
 					}
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
 		}
499 499
 
500 500
 		if ($op) {
501
-			$filtre = $a . $op . str_replace('\"', '"', $valeur);
501
+			$filtre = $a.$op.str_replace('\"', '"', $valeur);
502 502
 		}
503 503
 
504 504
 		if ($not) {
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 		// Creer la fonction de filtrage sur $this
548 548
 		if ($this->filtre) {
549 549
 			if ($filtres = $this->assembler_filtres($this->filtre)) {
550
-				$filtres = 'return ' . $filtres . ';';
550
+				$filtres = 'return '.$filtres.';';
551 551
 				$this->func_filtre = fn () => eval($filtres);
552 552
 			} else {
553 553
 				$this->func_filtre = null;
Please login to merge, or discard this patch.
ecrire/src/Compilateur/Iterateur/Data.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 		// Si a ce stade on n'a pas de table, il y a un bug
164 164
 		if (!is_array($this->tableau)) {
165 165
 			$this->err = true;
166
-			spip_log('erreur datasource ' . var_export($command, true));
166
+			spip_log('erreur datasource '.var_export($command, true));
167 167
 		}
168 168
 
169 169
 		// {datapath query.results}
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 			isset($this->command['sourcemode'])
206 206
 			&& !in_array($this->command['sourcemode'], ['table', 'array', 'tableau'])
207 207
 		) {
208
-			charger_fonction($this->command['sourcemode'] . '_to_array', 'inc', true);
208
+			charger_fonction($this->command['sourcemode'].'_to_array', 'inc', true);
209 209
 		}
210 210
 
211 211
 		# le premier argument peut etre un array, une URL etc.
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 		# avons-nous un cache dispo ?
215 215
 		$cle = null;
216 216
 		if (is_string($src)) {
217
-			$cle = 'datasource_' . md5($this->command['sourcemode'] . ':' . var_export($this->command['source'], true));
217
+			$cle = 'datasource_'.md5($this->command['sourcemode'].':'.var_export($this->command['source'], true));
218 218
 		}
219 219
 
220 220
 		$cache = $this->cache_get($cle);
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 					}
267 267
 					if (
268 268
 						!$this->err
269
-						&& ($data_to_array = charger_fonction($this->command['sourcemode'] . '_to_array', 'inc', true))
269
+						&& ($data_to_array = charger_fonction($this->command['sourcemode'].'_to_array', 'inc', true))
270 270
 					) {
271 271
 						$args = $this->command['source'];
272 272
 						$args[0] = $data;
@@ -401,12 +401,12 @@  discard block
 block discarded – undo
401 401
 						$this->tableau = $v;
402 402
 					} else {
403 403
 						# {par valeur} ou {par valeur/xx/yy}
404
-						$tv = $r[1] == 'valeur' ? '%s' : 'table_valeur(%s, ' . var_export($r[1], true) . ')';
404
+						$tv = $r[1] == 'valeur' ? '%s' : 'table_valeur(%s, '.var_export($r[1], true).')';
405 405
 						$sortfunc .= '
406
-					$a = ' . sprintf($tv, '$aa') . ';
407
-					$b = ' . sprintf($tv, '$bb') . ';
406
+					$a = ' . sprintf($tv, '$aa').';
407
+					$b = ' . sprintf($tv, '$bb').';
408 408
 					if ($a <> $b)
409
-						return ($a ' . (empty($r[2]) ? '<' : '>') . ' $b) ? -1 : 1;';
409
+						return ($a ' . (empty($r[2]) ? '<' : '>').' $b) ? -1 : 1;';
410 410
 					}
411 411
 				}
412 412
 			}
Please login to merge, or discard this patch.
ecrire/src/Chiffrer/Chiffrement.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 		$nonce = random_bytes(\SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);
31 31
 		$padded_message = sodium_pad($message, 16);
32 32
 		$encrypted = sodium_crypto_secretbox($padded_message, $nonce, $key);
33
-		$encoded = base64_encode($salt . $nonce . $encrypted);
33
+		$encoded = base64_encode($salt.$nonce.$encrypted);
34 34
 		sodium_memzero($key);
35 35
 		sodium_memzero($nonce);
36 36
 		sodium_memzero($salt);
@@ -47,14 +47,14 @@  discard block
 block discarded – undo
47 47
 		$decoded = base64_decode($encoded);
48 48
 		$salt = substr($decoded, 0, \SODIUM_CRYPTO_PWHASH_SALTBYTES);
49 49
 		$nonce = substr($decoded, \SODIUM_CRYPTO_PWHASH_SALTBYTES, \SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);
50
-		$encrypted = substr($decoded, \SODIUM_CRYPTO_PWHASH_SALTBYTES + \SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);
50
+		$encrypted = substr($decoded, \SODIUM_CRYPTO_PWHASH_SALTBYTES +\SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);
51 51
 		$key = self::deriveKeyFromPassword($key, $salt);
52 52
 		$padded_message = sodium_crypto_secretbox_open($encrypted, $nonce, $key);
53 53
 		sodium_memzero($key);
54 54
 		sodium_memzero($nonce);
55 55
 		sodium_memzero($salt);
56 56
 		if ($padded_message === false) {
57
-			spip_log("dechiffrer() chiffre corrompu `$encoded`", 'chiffrer' . _LOG_DEBUG);
57
+			spip_log("dechiffrer() chiffre corrompu `$encoded`", 'chiffrer'._LOG_DEBUG);
58 58
 			return null;
59 59
 		}
60 60
 		return sodium_unpad($padded_message, 16);
Please login to merge, or discard this patch.
ecrire/src/Chiffrer/SpipCles.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 final class SpipCles {
16 16
 	private static array $instances = [];
17 17
 
18
-	private string $file = _DIR_ETC . 'cles.php';
18
+	private string $file = _DIR_ETC.'cles.php';
19 19
 	private Cles $cles;
20 20
 
21 21
 	public static function instance(string $file = ''): self {
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 			!empty($cles_potentielles['secret_des_auth'])
115 115
 			&& !Password::verifier($password_clair, $password_hash, $cles_potentielles['secret_des_auth'])
116 116
 		) {
117
-			spip_log("Restauration de la cle `secret_des_auth` par id_auteur $id_auteur erronnee, on ignore", 'chiffrer' . _LOG_INFO_IMPORTANTE);
117
+			spip_log("Restauration de la cle `secret_des_auth` par id_auteur $id_auteur erronnee, on ignore", 'chiffrer'._LOG_INFO_IMPORTANTE);
118 118
 			unset($cles_potentielles['secret_des_auth']);
119 119
 		}
120 120
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 		foreach ($cles_potentielles as $name => $key) {
124 124
 			if (!$this->cles->has($name)) {
125 125
 				$this->cles->set($name, $key);
126
-				spip_log("Restauration de la cle $name par id_auteur $id_auteur", 'chiffrer' . _LOG_INFO_IMPORTANTE);
126
+				spip_log("Restauration de la cle $name par id_auteur $id_auteur", 'chiffrer'._LOG_INFO_IMPORTANTE);
127 127
 				$restauration = true;
128 128
 			}
129 129
 		}
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 				return $this->cles->get($name);
142 142
 			}
143 143
 			// sinon loger et annule la cle generee car il ne faut pas l'utiliser
144
-			spip_log('Echec ecriture du fichier cle ' . $this->file . " ; impossible de generer une cle $name", 'chiffrer' . _LOG_ERREUR);
144
+			spip_log('Echec ecriture du fichier cle '.$this->file." ; impossible de generer une cle $name", 'chiffrer'._LOG_ERREUR);
145 145
 			$this->cles->delete($name);
146 146
 		}
147 147
 		return null;
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	private function getMetaKey(string $name, bool $autoInit = true): ?string {
151 151
 		if (!isset($GLOBALS['meta'][$name])) {
152 152
 			include_spip('base/abstract_sql');
153
-			$GLOBALS['meta'][$name] = sql_getfetsel('valeur', 'spip_meta', 'nom = ' . sql_quote($name, '', 'string'));
153
+			$GLOBALS['meta'][$name] = sql_getfetsel('valeur', 'spip_meta', 'nom = '.sql_quote($name, '', 'string'));
154 154
 		}
155 155
 		$key = base64_decode($GLOBALS['meta'][$name] ?? '');
156 156
 		if (strlen($key) === \SODIUM_CRYPTO_SECRETBOX_KEYBYTES) {
Please login to merge, or discard this patch.
ecrire/src/Admin/Bouton.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 		/** L'URL de la page (null => ?exec=nom) */
29 29
 		public ?string $url = null,
30 30
 		/** Arguments supplémentaires de l'URL */
31
-		public string|array|null $urlArg = null,
31
+		public string | array | null $urlArg = null,
32 32
 		/** URL du javascript */
33 33
 		public ?string $url2 = null,
34 34
 		/** Pour ouvrir une fenêtre à part */
Please login to merge, or discard this patch.
ecrire/plugins/afficher_repertoires.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
 				$id = substr(md5($plug), 0, 16);
59 59
 				$res .= $ligne_plug(
60 60
 					$url_page,
61
-					str_replace(_DIR_PLUGINS, '', _DIR_RACINE . $plug),
61
+					str_replace(_DIR_PLUGINS, '', _DIR_RACINE.$plug),
62 62
 					$actif,
63 63
 					'menu-entree'
64
-				) . "\n";
64
+				)."\n";
65 65
 				unset($liste_plugins[$key]);
66 66
 			}
67 67
 		}
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
 	}
102 102
 	$chemin = '';
103 103
 	if ($tcom !== []) {
104
-		$chemin .= implode('/', $tcom) . '/';
104
+		$chemin .= implode('/', $tcom).'/';
105 105
 	}
106 106
 	// ouvrir les repertoires jusqu'a la cible
107 107
 	while ($open = array_shift($ttarg)) {
108
-		$visible = @isset($deplie[$chemin . $open]);
109
-		$chemin .= $open . '/';
108
+		$visible = @isset($deplie[$chemin.$open]);
109
+		$chemin .= $open.'/';
110 110
 		$output .= '<li>';
111 111
 		$output .= bouton_block_depliable($chemin, $visible);
112 112
 		$output .= debut_block_depliable($visible);
Please login to merge, or discard this patch.
ecrire/plugins/get_infos.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	static $filecache = '';
39 39
 
40 40
 	if ($cache === '') {
41
-		$filecache = _DIR_TMP . 'plugin_xml_cache.gz';
41
+		$filecache = _DIR_TMP.'plugin_xml_cache.gz';
42 42
 		if (is_file($filecache)) {
43 43
 			lire_fichier($filecache, $contenu);
44 44
 			$cache = unserialize($contenu);
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	if (isset($ret['prefix']) && $ret['prefix'] == 'spip') {
128 128
 		$ret['procure']['php'] = ['nom' => 'php', 'version' => phpversion()];
129 129
 		foreach (get_loaded_extensions() as $ext) {
130
-			$ret['procure']['php:' . $ext] = ['nom' => 'php:' . $ext, 'version' => phpversion($ext)];
130
+			$ret['procure']['php:'.$ext] = ['nom' => 'php:'.$ext, 'version' => phpversion($ext)];
131 131
 		}
132 132
 	}
133 133
 	$diff = ($ret != $pcache);
Please login to merge, or discard this patch.
ecrire/plugins/installer.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	}
68 68
 	$dir = constant($dir);
69 69
 	foreach ($infos['install'] as $file) {
70
-		$file = $dir . $plug . '/' . trim($file);
70
+		$file = $dir.$plug.'/'.trim($file);
71 71
 		if (file_exists($file)) {
72 72
 			include_once($file);
73 73
 		}
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
 		// S'assurer que les metas de la table spécifique sont bien accessibles dans la globale
81 81
 		lire_metas($table);
82 82
 	}
83
-	$nom_meta = $infos['prefix'] . '_base_version';
83
+	$nom_meta = $infos['prefix'].'_base_version';
84 84
 
85 85
 	// Détermination de la fonction à appeler et de ses arguments
86
-	$f = $infos['prefix'] . '_install';
86
+	$f = $infos['prefix'].'_install';
87 87
 	if (!function_exists($f)) {
88 88
 		$f = isset($infos['schema']) ? 'spip_plugin_install' : '';
89 89
 		$arg = $infos;
@@ -162,12 +162,12 @@  discard block
 block discarded – undo
162 162
 				&& isset($GLOBALS[$table][$nom_meta])
163 163
 				&& spip_version_compare($GLOBALS[$table][$nom_meta], $version_cible, '>='));
164 164
 		case 'install':
165
-			if (function_exists($upgrade = $infos['prefix'] . '_upgrade')) {
165
+			if (function_exists($upgrade = $infos['prefix'].'_upgrade')) {
166 166
 				$upgrade($nom_meta, $version_cible, $table);
167 167
 			}
168 168
 			break;
169 169
 		case 'uninstall':
170
-			if (function_exists($vider_tables = $infos['prefix'] . '_vider_tables')) {
170
+			if (function_exists($vider_tables = $infos['prefix'].'_vider_tables')) {
171 171
 				$vider_tables($nom_meta, $table);
172 172
 			}
173 173
 			break;
Please login to merge, or discard this patch.