Completed
Push — master ( c2652d...a4fa78 )
by cam
01:40
created
ecrire/bootstrap/inc/initialization.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -39,22 +39,22 @@  discard block
 block discarded – undo
39 39
 
40 40
 	// le nom du repertoire plugins/ activables/desactivables
41 41
 	if (!defined('_DIR_PLUGINS')) {
42
-		define('_DIR_PLUGINS', _DIR_RACINE . 'plugins/');
42
+		define('_DIR_PLUGINS', _DIR_RACINE.'plugins/');
43 43
 	}
44 44
 
45 45
 	// le nom du repertoire des extensions/ permanentes du core, toujours actives
46 46
 	if (!defined('_DIR_PLUGINS_DIST')) {
47
-		define('_DIR_PLUGINS_DIST', _DIR_RACINE . 'plugins-dist/');
47
+		define('_DIR_PLUGINS_DIST', _DIR_RACINE.'plugins-dist/');
48 48
 	}
49 49
 
50 50
 	// le nom du repertoire des librairies
51 51
 	if (!defined('_DIR_LIB')) {
52
-		define('_DIR_LIB', _DIR_RACINE . 'lib/');
52
+		define('_DIR_LIB', _DIR_RACINE.'lib/');
53 53
 	}
54 54
 
55 55
 	// répertoire des libs via Composer
56 56
 	if (!defined('_DIR_VENDOR')) {
57
-		define('_DIR_VENDOR', _DIR_RACINE . 'vendor/');
57
+		define('_DIR_VENDOR', _DIR_RACINE.'vendor/');
58 58
 	}
59 59
 
60 60
 	if (!defined('_DIR_IMG')) {
@@ -64,29 +64,29 @@  discard block
 block discarded – undo
64 64
 		define('_DIR_LOGOS', $pa);
65 65
 	}
66 66
 	if (!defined('_DIR_IMG_ICONES')) {
67
-		define('_DIR_IMG_ICONES', _DIR_LOGOS . 'icones/');
67
+		define('_DIR_IMG_ICONES', _DIR_LOGOS.'icones/');
68 68
 	}
69 69
 
70 70
 	if (!defined('_DIR_DUMP')) {
71
-		define('_DIR_DUMP', $ti . 'dump/');
71
+		define('_DIR_DUMP', $ti.'dump/');
72 72
 	}
73 73
 	if (!defined('_DIR_SESSIONS')) {
74
-		define('_DIR_SESSIONS', $ti . 'sessions/');
74
+		define('_DIR_SESSIONS', $ti.'sessions/');
75 75
 	}
76 76
 	if (!defined('_DIR_TRANSFERT')) {
77
-		define('_DIR_TRANSFERT', $ti . 'upload/');
77
+		define('_DIR_TRANSFERT', $ti.'upload/');
78 78
 	}
79 79
 	if (!defined('_DIR_CACHE')) {
80
-		define('_DIR_CACHE', $ti . 'cache/');
80
+		define('_DIR_CACHE', $ti.'cache/');
81 81
 	}
82 82
 	if (!defined('_DIR_CACHE_XML')) {
83
-		define('_DIR_CACHE_XML', _DIR_CACHE . 'xml/');
83
+		define('_DIR_CACHE_XML', _DIR_CACHE.'xml/');
84 84
 	}
85 85
 	if (!defined('_DIR_SKELS')) {
86
-		define('_DIR_SKELS', _DIR_CACHE . 'skel/');
86
+		define('_DIR_SKELS', _DIR_CACHE.'skel/');
87 87
 	}
88 88
 	if (!defined('_DIR_AIDE')) {
89
-		define('_DIR_AIDE', _DIR_CACHE . 'aide/');
89
+		define('_DIR_AIDE', _DIR_CACHE.'aide/');
90 90
 	}
91 91
 	if (!defined('_DIR_TMP')) {
92 92
 		define('_DIR_TMP', $ti);
@@ -115,27 +115,27 @@  discard block
 block discarded – undo
115 115
 	// Declaration des fichiers
116 116
 
117 117
 	if (!defined('_CACHE_PLUGINS_PATH')) {
118
-		define('_CACHE_PLUGINS_PATH', _DIR_CACHE . 'charger_plugins_chemins.php');
118
+		define('_CACHE_PLUGINS_PATH', _DIR_CACHE.'charger_plugins_chemins.php');
119 119
 	}
120 120
 	if (!defined('_CACHE_PLUGINS_OPT')) {
121
-		define('_CACHE_PLUGINS_OPT', _DIR_CACHE . 'charger_plugins_options.php');
121
+		define('_CACHE_PLUGINS_OPT', _DIR_CACHE.'charger_plugins_options.php');
122 122
 	}
123 123
 	if (!defined('_CACHE_PLUGINS_FCT')) {
124
-		define('_CACHE_PLUGINS_FCT', _DIR_CACHE . 'charger_plugins_fonctions.php');
124
+		define('_CACHE_PLUGINS_FCT', _DIR_CACHE.'charger_plugins_fonctions.php');
125 125
 	}
126 126
 	if (!defined('_CACHE_PIPELINES')) {
127
-		define('_CACHE_PIPELINES', _DIR_CACHE . 'charger_pipelines.php');
127
+		define('_CACHE_PIPELINES', _DIR_CACHE.'charger_pipelines.php');
128 128
 	}
129 129
 	if (!defined('_CACHE_CHEMIN')) {
130
-		define('_CACHE_CHEMIN', _DIR_CACHE . 'chemin.txt');
130
+		define('_CACHE_CHEMIN', _DIR_CACHE.'chemin.txt');
131 131
 	}
132 132
 
133 133
 	# attention .php obligatoire pour ecrire_fichier_securise
134 134
 	if (!defined('_FILE_META')) {
135
-		define('_FILE_META', $ti . 'meta_cache.php');
135
+		define('_FILE_META', $ti.'meta_cache.php');
136 136
 	}
137 137
 	if (!defined('_DIR_LOG')) {
138
-		define('_DIR_LOG', _DIR_TMP . 'log/');
138
+		define('_DIR_LOG', _DIR_TMP.'log/');
139 139
 	}
140 140
 	if (!defined('_FILE_LOG')) {
141 141
 		define('_FILE_LOG', 'spip');
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	if (!defined('_FILE_CONNECT')) {
152 152
 		define(
153 153
 			'_FILE_CONNECT',
154
-			@is_readable($f = _DIR_CONNECT . _FILE_CONNECT_INS . '.php') ? $f : false
154
+			@is_readable($f = _DIR_CONNECT._FILE_CONNECT_INS.'.php') ? $f : false
155 155
 		);
156 156
 	}
157 157
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	if (!defined('_FILE_CHMOD')) {
163 163
 		define(
164 164
 			'_FILE_CHMOD',
165
-			@is_readable($f = _DIR_CHMOD . _FILE_CHMOD_INS . '.php') ? $f : false
165
+			@is_readable($f = _DIR_CHMOD._FILE_CHMOD_INS.'.php') ? $f : false
166 166
 		);
167 167
 	}
168 168
 
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
 		define('_FILE_TMP_SUFFIX', '.tmp.php');
175 175
 	}
176 176
 	if (!defined('_FILE_CONNECT_TMP')) {
177
-		define('_FILE_CONNECT_TMP', _DIR_CONNECT . _FILE_CONNECT_INS . _FILE_TMP_SUFFIX);
177
+		define('_FILE_CONNECT_TMP', _DIR_CONNECT._FILE_CONNECT_INS._FILE_TMP_SUFFIX);
178 178
 	}
179 179
 	if (!defined('_FILE_CHMOD_TMP')) {
180
-		define('_FILE_CHMOD_TMP', _DIR_CHMOD . _FILE_CHMOD_INS . _FILE_TMP_SUFFIX);
180
+		define('_FILE_CHMOD_TMP', _DIR_CHMOD._FILE_CHMOD_INS._FILE_TMP_SUFFIX);
181 181
 	}
182 182
 
183 183
 	// Definition des droits d'acces en ecriture
@@ -195,13 +195,13 @@  discard block
 block discarded – undo
195 195
 		define('_DEFAULT_CHARSET', 'utf-8');
196 196
 	}
197 197
 	if (!defined('_ROOT_PLUGINS')) {
198
-		define('_ROOT_PLUGINS', _ROOT_RACINE . 'plugins' . DIRECTORY_SEPARATOR);
198
+		define('_ROOT_PLUGINS', _ROOT_RACINE.'plugins'.DIRECTORY_SEPARATOR);
199 199
 	}
200 200
 	if (!defined('_ROOT_PLUGINS_DIST')) {
201
-		define('_ROOT_PLUGINS_DIST', _ROOT_RACINE . 'plugins-dist' . DIRECTORY_SEPARATOR);
201
+		define('_ROOT_PLUGINS_DIST', _ROOT_RACINE.'plugins-dist'.DIRECTORY_SEPARATOR);
202 202
 	}
203 203
 	if (!defined('_ROOT_PLUGINS_SUPPL') && defined('_DIR_PLUGINS_SUPPL') && _DIR_PLUGINS_SUPPL) {
204
-		define('_ROOT_PLUGINS_SUPPL', _ROOT_RACINE . str_replace(_DIR_RACINE, '', _DIR_PLUGINS_SUPPL));
204
+		define('_ROOT_PLUGINS_SUPPL', _ROOT_RACINE.str_replace(_DIR_RACINE, '', _DIR_PLUGINS_SUPPL));
205 205
 	}
206 206
 
207 207
 	// La taille des Log
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	// (non surchargeable en l'etat ; attention si on utilise include_spip()
239 239
 	// pour le rendre surchargeable, on va provoquer un reecriture
240 240
 	// systematique du noyau ou une baisse de perfs => a etudier)
241
-	include_once _ROOT_RESTREINT . 'inc/flock.php';
241
+	include_once _ROOT_RESTREINT.'inc/flock.php';
242 242
 
243 243
 	// charger le path des plugins
244 244
 	if (@is_readable(_CACHE_PLUGINS_PATH)) {
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 			!empty($_SERVER['QUERY_STRING'])
277 277
 			&& !strpos($_SERVER['REQUEST_URI'], '?')
278 278
 		) {
279
-			$GLOBALS['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
279
+			$GLOBALS['REQUEST_URI'] .= '?'.$_SERVER['QUERY_STRING'];
280 280
 		}
281 281
 	}
282 282
 
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 		) {
313 313
 			if (isset($GLOBALS['meta']['adresse_site'])) {
314 314
 				$uri_ref = parse_url($GLOBALS['meta']['adresse_site']);
315
-				$uri_ref = ($uri_ref['path'] ?? '') . '/';
315
+				$uri_ref = ($uri_ref['path'] ?? '').'/';
316 316
 			} else {
317 317
 				$uri_ref = '';
318 318
 			}
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 	}
407 407
 	if (!defined('_CACHE_RUBRIQUES')) {
408 408
 		/** Fichier cache pour le navigateur de rubrique du bandeau */
409
-		define('_CACHE_RUBRIQUES', _DIR_TMP . 'menu-rubriques-cache.txt');
409
+		define('_CACHE_RUBRIQUES', _DIR_TMP.'menu-rubriques-cache.txt');
410 410
 	}
411 411
 	if (!defined('_CACHE_RUBRIQUES_MAX')) {
412 412
 		/** Nombre maxi de rubriques enfants affichées pour chaque rubrique du navigateur de rubrique du bandeau */
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
 					}
630 630
 					if (isset($GLOBALS['visiteur_session']['nom'])) {
631 631
 						spip_log($GLOBALS['visiteur_session']['nom']
632
-							. ' ' . _VAR_MODE);
632
+							. ' '._VAR_MODE);
633 633
 					}
634 634
 				} // pas autorise ?
635 635
 				else {
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
 						if (!str_contains($self, 'page=login')) {
645 645
 							include_spip('inc/headers');
646 646
 							$redirect = parametre_url(self('&', true), 'var_mode', $_GET['var_mode'], '&');
647
-							redirige_par_entete(generer_url_public('login', 'url=' . rawurlencode($redirect), true));
647
+							redirige_par_entete(generer_url_public('login', 'url='.rawurlencode($redirect), true));
648 648
 						}
649 649
 					}
650 650
 					// sinon tant pis
Please login to merge, or discard this patch.
ecrire/inc/invalideur.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	$n = 0;
45 45
 	$time = $GLOBALS['meta']['cache_mark'] ?? 0;
46 46
 	for ($i = 0; $i < 256; $i++) {
47
-		$dir = _DIR_CACHE . sprintf('%02s', dechex($i));
47
+		$dir = _DIR_CACHE.sprintf('%02s', dechex($i));
48 48
 		if (@is_dir($dir) && is_readable($dir) && ($d = opendir($dir))) {
49 49
 			while (($f = readdir($d)) !== false) {
50 50
 				if (preg_match(',^[[0-9a-f]+\.cache$,S', $f) && ($a = stat("$dir/$f"))) {
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 
102 102
 	// stocker la date_modif_$objet (ne sert a rien pour le moment)
103 103
 	if (isset($objet)) {
104
-		ecrire_meta('derniere_modif_' . $objet, time());
104
+		ecrire_meta('derniere_modif_'.$objet, time());
105 105
 	}
106 106
 
107 107
 	// si $derniere_modif_invalide est un array('article', 'rubrique')
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 
145 145
 	// sur certains sites on veut absolument garder certains caches référencés dans un CDN
146 146
 	// on peut donc inhiber la purge de ces répertoires pour eviter tout probleme
147
-	if (file_exists(rtrim($dir, '/') . '/inhib_purger_repertoire.txt')) {
147
+	if (file_exists(rtrim($dir, '/').'/inhib_purger_repertoire.txt')) {
148 148
 		return 0;
149 149
 	}
150 150
 
Please login to merge, or discard this patch.
ecrire/public/cacher.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 function cache_key(array $contexte, array $page): string {
34 34
 	static $hasher = null;
35 35
 	$hasher ??= new Hash32();
36
-	return $hasher->hash([$contexte, $page]) . '.cache';
36
+	return $hasher->hash([$contexte, $page]).'.cache';
37 37
 }
38 38
 
39 39
 /**
@@ -62,12 +62,12 @@  discard block
 block discarded – undo
62 62
 		include_spip('inc/acces');
63 63
 		ecrire_meta(
64 64
 			'cache_signature',
65
-			hash('sha256', $_SERVER['DOCUMENT_ROOT'] . ($_SERVER['SERVER_SIGNATURE'] ?? '') . creer_uniqid()),
65
+			hash('sha256', $_SERVER['DOCUMENT_ROOT'].($_SERVER['SERVER_SIGNATURE'] ?? '').creer_uniqid()),
66 66
 			'non'
67 67
 		);
68 68
 	}
69 69
 
70
-	return (new Hash32())->hash($GLOBALS['meta']['cache_signature'] . $page['texte']);
70
+	return (new Hash32())->hash($GLOBALS['meta']['cache_signature'].$page['texte']);
71 71
 }
72 72
 
73 73
 /**
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 		// "cache sessionne" ; sa date indique la date de validite
214 214
 		// des caches sessionnes
215 215
 		if (!$tmp = lire_cache($cache_key)) {
216
-			spip_log('Creation cache sessionne ' . $cache_key);
216
+			spip_log('Creation cache sessionne '.$cache_key);
217 217
 			$tmp = [
218 218
 				'invalideurs' => ['session' => ''],
219 219
 				'lastmodified' => $_SERVER['REQUEST_TIME']
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
 	// l'enregistrer, compresse ou non...
240 240
 	$ok = ecrire_cache($cache_key, $pagez);
241 241
 
242
-	spip_log((_IS_BOT ? 'Bot:' : '') . "Creation du cache $cache_key pour "
243
-		. $page['entetes']['X-Spip-Cache'] . ' secondes' . ($ok ? '' : ' (erreur!)'), _LOG_INFO);
242
+	spip_log((_IS_BOT ? 'Bot:' : '')."Creation du cache $cache_key pour "
243
+		. $page['entetes']['X-Spip-Cache'].' secondes'.($ok ? '' : ' (erreur!)'), _LOG_INFO);
244 244
 
245 245
 	// Inserer ses invalideurs
246 246
 	include_spip('inc/invalideur');
Please login to merge, or discard this patch.
ecrire/bootstrap/inc/path.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  * @param null|array $add List of «plugins» directories to add
14 14
  */
15 15
 function spip_paths(
16
-	null|array $add = null,
16
+	null | array $add = null,
17 17
 ): AggregatorInterface {
18 18
 	static $paths = null;
19 19
 	static $last_dossier_squelettes = null;
@@ -24,13 +24,13 @@  discard block
 block discarded – undo
24 24
 		$paths = new GroupAggregator(Group::cases(), _ROOT_CWD);
25 25
 		$paths = $paths->with(Group::App, [
26 26
 			_DIR_RACINE,
27
-			_DIR_RACINE . 'squelettes-dist/',
28
-			_DIR_RACINE . 'prive/',
27
+			_DIR_RACINE.'squelettes-dist/',
28
+			_DIR_RACINE.'prive/',
29 29
 			_DIR_RESTREINT,
30 30
 		]);
31 31
 
32
-		if (@is_dir(_DIR_RACINE . 'squelettes')) {
33
-			$paths = $paths->with(Group::Templates, [_DIR_RACINE . 'squelettes']);
32
+		if (@is_dir(_DIR_RACINE.'squelettes')) {
33
+			$paths = $paths->with(Group::Templates, [_DIR_RACINE.'squelettes']);
34 34
 		}
35 35
 	}
36 36
 
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 			$ds = explode(':', $dossier_squelettes);
45 45
 			foreach ($ds as $key => $directory) {
46 46
 				if (!str_starts_with($directory, '/')) {
47
-					$ds[$key] = _DIR_RACINE . $directory;
47
+					$ds[$key] = _DIR_RACINE.$directory;
48 48
 				}
49 49
 			}
50 50
 			$paths = $paths->with(Group::ExtraTemplates, $ds);
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
  * @return array
102 102
  *     Liste des chemins, par ordre de priorité.
103 103
  **/
104
-function _chemin(string|array|null $dir_path = null): array {
104
+function _chemin(string | array | null $dir_path = null): array {
105 105
 	if (is_array($dir_path) || (is_string($dir_path) && strlen($dir_path))) {
106 106
 		spip_paths(add: is_array($dir_path) ? $dir_path : explode(':', $dir_path));
107 107
 	}
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 function creer_chemin(): array {
118 118
 	$dirs = spip_paths()->getDirectories();
119 119
 	// canal historique: avec / sauf si ''
120
-	return array_map(fn ($dir) => $dir === '' ? $dir : $dir . DIRECTORY_SEPARATOR, $dirs);
120
+	return array_map(fn ($dir) => $dir === '' ? $dir : $dir.DIRECTORY_SEPARATOR, $dirs);
121 121
 }
122 122
 
123 123
 /**
@@ -163,14 +163,14 @@  discard block
 block discarded – undo
163 163
 	// si il y a un .svg a la bonne taille (-16.svg) a cote, on l'utilise en remplacement du -16.png
164 164
 	if (
165 165
 		preg_match(',-(\d+)[.](png|gif|svg)$,', $file, $m)
166
-		&& ($file_svg_generique = substr($file, 0, -strlen($m[0])) . '-xx.svg')
166
+		&& ($file_svg_generique = substr($file, 0, -strlen($m[0])).'-xx.svg')
167 167
 		&& ($f = find_in_theme("$file_svg_generique"))
168 168
 	) {
169
-		if (($fsize = substr($f, 0, -6) . $m[1] . '.svg') && file_exists($fsize)) {
169
+		if (($fsize = substr($f, 0, -6).$m[1].'.svg') && file_exists($fsize)) {
170 170
 			return $themefiles["$subdir$file"] = $fsize;
171 171
 		}
172 172
 		else {
173
-			return $themefiles["$subdir$file"] = "$f?" . $m[1] . 'px';
173
+			return $themefiles["$subdir$file"] = "$f?".$m[1].'px';
174 174
 		}
175 175
 	}
176 176
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
 			return $themefiles["$subdir$file"] = $f;
181 181
 		}
182 182
 	}
183
-	spip_log("$file introuvable dans le theme prive " . reset($themes), 'theme');
183
+	spip_log("$file introuvable dans le theme prive ".reset($themes), 'theme');
184 184
 
185 185
 	return $themefiles["$subdir$file"] = '';
186 186
 }
@@ -260,18 +260,18 @@  discard block
 block discarded – undo
260 260
  *     - string : chemin du fichier trouvé
261 261
  *     - false : fichier introuvable
262 262
  **/
263
-function find_in_path(string $file, string $dirname = '', bool|string $include = false): ?string {
263
+function find_in_path(string $file, string $dirname = '', bool | string $include = false): ?string {
264 264
 
265 265
 	$loader = spip_paths_loader();
266 266
 
267 267
 	if ($dirname) {
268
-		$file = rtrim($dirname, '/') . '/' . $file;
268
+		$file = rtrim($dirname, '/').'/'.$file;
269 269
 	}
270 270
 
271 271
 	$path = $loader->get($file);
272 272
 	// find in path retourne des chemins relatif, si possible
273 273
 	if ($path !== null && str_starts_with($path, _ROOT_RACINE)) {
274
-		$path = _DIR_RACINE . substr($path, strlen(_ROOT_RACINE));
274
+		$path = _DIR_RACINE.substr($path, strlen(_ROOT_RACINE));
275 275
 	}
276 276
 
277 277
 	if ($include === false) {
@@ -326,12 +326,12 @@  discard block
 block discarded – undo
326 326
 	// cas borderline si dans mes_options on appelle redirige_par_entete qui utilise _T et charge un fichier de langue
327 327
 	// on a pas encore inclus flock.php
328 328
 	if (!function_exists('preg_files')) {
329
-		include_once _ROOT_RESTREINT . 'inc/flock.php';
329
+		include_once _ROOT_RESTREINT.'inc/flock.php';
330 330
 	}
331 331
 
332 332
 	// Parcourir le chemin
333 333
 	foreach (creer_chemin() as $d) {
334
-		$f = $d . $dir;
334
+		$f = $d.$dir;
335 335
 		if (@is_dir($f)) {
336 336
 			$liste = preg_files($f, $pattern, $maxfiles - count($liste_fichiers), $recurs === true ? [] : $recurs);
337 337
 			foreach ($liste as $chemin) {
Please login to merge, or discard this patch.