Completed
Push — master ( 4fa0dc...b74578 )
by cam
01:19
created
ecrire/prive.php 2 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -19,18 +19,18 @@
 block discarded – undo
19 19
 $var_auth = $auth();
20 20
 
21 21
 if ($var_auth !== '' && !is_int($var_auth)) {
22
-	// si l'authentifie' n'a pas acces a l'espace de redac
23
-	// c'est qu'on voulait forcer sa reconnaissance en tant que visiteur.
24
-	// On reexecute pour deboucher sur le include public.
25
-	// autrement on insiste
26
-	if (is_array($var_auth)) {
27
-			$var_auth = '../?' . $_SERVER['QUERY_STRING'];
28
-			spip_setcookie('spip_session', $_COOKIE['spip_session'], [
29
-				'expires' => time() + 3600 * 24 * 14
30
-			]);
31
-	}
32
-	include_spip('inc/headers');
33
-	redirige_formulaire($var_auth);
22
+    // si l'authentifie' n'a pas acces a l'espace de redac
23
+    // c'est qu'on voulait forcer sa reconnaissance en tant que visiteur.
24
+    // On reexecute pour deboucher sur le include public.
25
+    // autrement on insiste
26
+    if (is_array($var_auth)) {
27
+            $var_auth = '../?' . $_SERVER['QUERY_STRING'];
28
+            spip_setcookie('spip_session', $_COOKIE['spip_session'], [
29
+                'expires' => time() + 3600 * 24 * 14
30
+            ]);
31
+    }
32
+    include_spip('inc/headers');
33
+    redirige_formulaire($var_auth);
34 34
 }
35 35
 
36 36
 // En somme, est prive' ce qui est publiquement nomme'...
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
 // Script pour appeler un squelette apres s'etre authentifie
13 13
 
14
-include_once __DIR__ . '/inc_version.php';
14
+include_once __DIR__.'/inc_version.php';
15 15
 
16 16
 include_spip('inc/cookie');
17 17
 
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	// On reexecute pour deboucher sur le include public.
25 25
 	// autrement on insiste
26 26
 	if (is_array($var_auth)) {
27
-			$var_auth = '../?' . $_SERVER['QUERY_STRING'];
27
+			$var_auth = '../?'.$_SERVER['QUERY_STRING'];
28 28
 			spip_setcookie('spip_session', $_COOKIE['spip_session'], [
29 29
 				'expires' => time() + 3600 * 24 * 14
30 30
 			]);
@@ -34,4 +34,4 @@  discard block
 block discarded – undo
34 34
 }
35 35
 
36 36
 // En somme, est prive' ce qui est publiquement nomme'...
37
-include __DIR__ . '/public.php';
37
+include __DIR__.'/public.php';
Please login to merge, or discard this patch.
ecrire/base/connect_sql.php 3 patches
Indentation   +321 added lines, -321 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  * @package SPIP\Core\SQL
16 16
  **/
17 17
 if (!defined('_ECRIRE_INC_VERSION')) {
18
-	return;
18
+    return;
19 19
 }
20 20
 require_once _ROOT_RESTREINT . 'base/objets.php';
21 21
 
@@ -41,125 +41,125 @@  discard block
 block discarded – undo
41 41
  **/
42 42
 function spip_connect($serveur = '', $version = '') {
43 43
 
44
-	$serveur = is_string($serveur) ? strtolower($serveur) : '';
45
-	$index = $serveur ?: 0;
46
-	if (!$version) {
47
-		$version = $GLOBALS['spip_sql_version'];
48
-	}
49
-	if (isset($GLOBALS['connexions'][$index][$version])) {
50
-		return $GLOBALS['connexions'][$index];
51
-	}
52
-
53
-	include_spip('base/abstract_sql');
54
-	$install = (_request('exec') == 'install');
55
-
56
-	// Premiere connexion ?
57
-	if (!($old = isset($GLOBALS['connexions'][$index]))) {
58
-		$f = '';
59
-		if ($serveur) {
60
-			// serveur externe et nom de serveur bien ecrit ?
61
-			if (
62
-				defined('_DIR_CONNECT')
63
-				&& preg_match('/^[\w\.]*$/', $serveur)
64
-			) {
65
-				$f = _DIR_CONNECT . $serveur . '.php';
66
-				if (!is_readable($f) && !$install) {
67
-					// chercher une declaration de serveur dans le path
68
-					// qui peut servir à des plugins à declarer des connexions à une base sqlite
69
-					// Ex: sert aux boucles POUR et au plugin-dist dump pour se connecter sur le sqlite du dump
70
-					$f = find_in_path("$serveur.php", 'connect/');
71
-				}
72
-			}
73
-		} else {
74
-			if (defined('_FILE_CONNECT') && _FILE_CONNECT) {
75
-				// init du serveur principal
76
-				$f = _FILE_CONNECT;
77
-			} elseif ($install && defined('_FILE_CONNECT_TMP')) {
78
-				// installation en cours
79
-				$f = _FILE_CONNECT_TMP;
80
-			}
81
-		}
82
-
83
-		unset($GLOBALS['db_ok']);
84
-		unset($GLOBALS['spip_connect_version']);
85
-		if ($f && is_readable($f)) {
86
-			include($f);
87
-			if (!isset($GLOBALS['db_ok'])) {
88
-				spip_log("spip_connect: fichier de connexion '$f' OK mais echec connexion au serveur", _LOG_HS);
89
-			}
90
-		}
91
-		else {
92
-			spip_log("spip_connect: fichier de connexion '$f' non trouve, pas de connexion serveur", _LOG_HS);
93
-		}
94
-		if (!isset($GLOBALS['db_ok'])) {
95
-			// fera mieux la prochaine fois
96
-			if ($install) {
97
-				return false;
98
-			}
99
-			// ne plus reessayer si ce n'est pas l'install
100
-			return $GLOBALS['connexions'][$index] = false;
101
-		}
102
-		$GLOBALS['connexions'][$index] = $GLOBALS['db_ok'];
103
-	}
104
-	// si la connexion a deja ete tentee mais a echoue, le dire!
105
-	if (!$GLOBALS['connexions'][$index]) {
106
-		return false;
107
-	}
108
-
109
-	// la connexion a reussi ou etait deja faite.
110
-	// chargement de la version du jeu de fonctions
111
-	// si pas dans le fichier par defaut
112
-	$type = $GLOBALS['db_ok']['type'];
113
-	$jeu = 'spip_' . $type . '_functions_' . $version;
114
-	if (!isset($GLOBALS[$jeu]) && !find_in_path($type . '_' . $version . '.php', 'req/', true)) {
115
-		spip_log("spip_connect: serveur $index version '$version' non defini pour '$type'", _LOG_HS);
116
-		// ne plus reessayer
117
-		return $GLOBALS['connexions'][$index][$version] = [];
118
-	}
119
-	$GLOBALS['connexions'][$index][$version] = $GLOBALS[$jeu];
120
-	if ($old) {
121
-		return $GLOBALS['connexions'][$index];
122
-	}
123
-
124
-	$GLOBALS['connexions'][$index]['spip_connect_version'] = $GLOBALS['spip_connect_version'] ?? 0;
125
-
126
-	// initialisation de l'alphabet utilise dans les connexions SQL
127
-	// si l'installation l'a determine.
128
-	// Celui du serveur principal l'impose aux serveurs secondaires
129
-	// s'ils le connaissent
130
-
131
-	if (!$serveur) {
132
-		$charset = spip_connect_main($GLOBALS[$jeu], $GLOBALS['db_ok']['charset']);
133
-		if (!$charset) {
134
-			unset($GLOBALS['connexions'][$index]);
135
-			spip_log('spip_connect: absence de charset', _LOG_AVERTISSEMENT);
136
-
137
-			return false;
138
-		}
139
-	} else {
140
-		if ($GLOBALS['db_ok']['charset']) {
141
-			$charset = $GLOBALS['db_ok']['charset'];
142
-		}
143
-		// spip_meta n'existe pas toujours dans la base
144
-		// C'est le cas d'un dump sqlite par exemple
145
-		elseif (
146
-			$GLOBALS['connexions'][$index]['spip_connect_version']
147
-			&& sql_showtable('spip_meta', true, $serveur)
148
-			&& ($r = sql_getfetsel('valeur', 'spip_meta', "nom='charset_sql_connexion'", '', '', '', '', $serveur))
149
-		) {
150
-			$charset = $r;
151
-		} else {
152
-			$charset = -1;
153
-		}
154
-	}
155
-	if ($charset != -1) {
156
-		$f = $GLOBALS[$jeu]['set_charset'];
157
-		if (function_exists($f)) {
158
-			$f($charset, $serveur);
159
-		}
160
-	}
161
-
162
-	return $GLOBALS['connexions'][$index];
44
+    $serveur = is_string($serveur) ? strtolower($serveur) : '';
45
+    $index = $serveur ?: 0;
46
+    if (!$version) {
47
+        $version = $GLOBALS['spip_sql_version'];
48
+    }
49
+    if (isset($GLOBALS['connexions'][$index][$version])) {
50
+        return $GLOBALS['connexions'][$index];
51
+    }
52
+
53
+    include_spip('base/abstract_sql');
54
+    $install = (_request('exec') == 'install');
55
+
56
+    // Premiere connexion ?
57
+    if (!($old = isset($GLOBALS['connexions'][$index]))) {
58
+        $f = '';
59
+        if ($serveur) {
60
+            // serveur externe et nom de serveur bien ecrit ?
61
+            if (
62
+                defined('_DIR_CONNECT')
63
+                && preg_match('/^[\w\.]*$/', $serveur)
64
+            ) {
65
+                $f = _DIR_CONNECT . $serveur . '.php';
66
+                if (!is_readable($f) && !$install) {
67
+                    // chercher une declaration de serveur dans le path
68
+                    // qui peut servir à des plugins à declarer des connexions à une base sqlite
69
+                    // Ex: sert aux boucles POUR et au plugin-dist dump pour se connecter sur le sqlite du dump
70
+                    $f = find_in_path("$serveur.php", 'connect/');
71
+                }
72
+            }
73
+        } else {
74
+            if (defined('_FILE_CONNECT') && _FILE_CONNECT) {
75
+                // init du serveur principal
76
+                $f = _FILE_CONNECT;
77
+            } elseif ($install && defined('_FILE_CONNECT_TMP')) {
78
+                // installation en cours
79
+                $f = _FILE_CONNECT_TMP;
80
+            }
81
+        }
82
+
83
+        unset($GLOBALS['db_ok']);
84
+        unset($GLOBALS['spip_connect_version']);
85
+        if ($f && is_readable($f)) {
86
+            include($f);
87
+            if (!isset($GLOBALS['db_ok'])) {
88
+                spip_log("spip_connect: fichier de connexion '$f' OK mais echec connexion au serveur", _LOG_HS);
89
+            }
90
+        }
91
+        else {
92
+            spip_log("spip_connect: fichier de connexion '$f' non trouve, pas de connexion serveur", _LOG_HS);
93
+        }
94
+        if (!isset($GLOBALS['db_ok'])) {
95
+            // fera mieux la prochaine fois
96
+            if ($install) {
97
+                return false;
98
+            }
99
+            // ne plus reessayer si ce n'est pas l'install
100
+            return $GLOBALS['connexions'][$index] = false;
101
+        }
102
+        $GLOBALS['connexions'][$index] = $GLOBALS['db_ok'];
103
+    }
104
+    // si la connexion a deja ete tentee mais a echoue, le dire!
105
+    if (!$GLOBALS['connexions'][$index]) {
106
+        return false;
107
+    }
108
+
109
+    // la connexion a reussi ou etait deja faite.
110
+    // chargement de la version du jeu de fonctions
111
+    // si pas dans le fichier par defaut
112
+    $type = $GLOBALS['db_ok']['type'];
113
+    $jeu = 'spip_' . $type . '_functions_' . $version;
114
+    if (!isset($GLOBALS[$jeu]) && !find_in_path($type . '_' . $version . '.php', 'req/', true)) {
115
+        spip_log("spip_connect: serveur $index version '$version' non defini pour '$type'", _LOG_HS);
116
+        // ne plus reessayer
117
+        return $GLOBALS['connexions'][$index][$version] = [];
118
+    }
119
+    $GLOBALS['connexions'][$index][$version] = $GLOBALS[$jeu];
120
+    if ($old) {
121
+        return $GLOBALS['connexions'][$index];
122
+    }
123
+
124
+    $GLOBALS['connexions'][$index]['spip_connect_version'] = $GLOBALS['spip_connect_version'] ?? 0;
125
+
126
+    // initialisation de l'alphabet utilise dans les connexions SQL
127
+    // si l'installation l'a determine.
128
+    // Celui du serveur principal l'impose aux serveurs secondaires
129
+    // s'ils le connaissent
130
+
131
+    if (!$serveur) {
132
+        $charset = spip_connect_main($GLOBALS[$jeu], $GLOBALS['db_ok']['charset']);
133
+        if (!$charset) {
134
+            unset($GLOBALS['connexions'][$index]);
135
+            spip_log('spip_connect: absence de charset', _LOG_AVERTISSEMENT);
136
+
137
+            return false;
138
+        }
139
+    } else {
140
+        if ($GLOBALS['db_ok']['charset']) {
141
+            $charset = $GLOBALS['db_ok']['charset'];
142
+        }
143
+        // spip_meta n'existe pas toujours dans la base
144
+        // C'est le cas d'un dump sqlite par exemple
145
+        elseif (
146
+            $GLOBALS['connexions'][$index]['spip_connect_version']
147
+            && sql_showtable('spip_meta', true, $serveur)
148
+            && ($r = sql_getfetsel('valeur', 'spip_meta', "nom='charset_sql_connexion'", '', '', '', '', $serveur))
149
+        ) {
150
+            $charset = $r;
151
+        } else {
152
+            $charset = -1;
153
+        }
154
+    }
155
+    if ($charset != -1) {
156
+        $f = $GLOBALS[$jeu]['set_charset'];
157
+        if (function_exists($f)) {
158
+            $f($charset, $serveur);
159
+        }
160
+    }
161
+
162
+    return $GLOBALS['connexions'][$index];
163 163
 }
164 164
 
165 165
 /**
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
  * @param string $serveur Nom du connecteur de bdd utilisé
169 169
  **/
170 170
 function spip_sql_erreur($serveur = '') {
171
-	$connexion = spip_connect($serveur);
172
-	$e = sql_errno($serveur);
173
-	$t = ($connexion['type'] ?? 'sql');
174
-	$m = "Erreur $e de $t: " . sql_error($serveur) . "\nin " . sql_error_backtrace() . "\n" . trim($connexion['last']);
175
-	$f = $t . $serveur;
176
-	spip_log($m, $f . '.' . _LOG_ERREUR);
171
+    $connexion = spip_connect($serveur);
172
+    $e = sql_errno($serveur);
173
+    $t = ($connexion['type'] ?? 'sql');
174
+    $m = "Erreur $e de $t: " . sql_error($serveur) . "\nin " . sql_error_backtrace() . "\n" . trim($connexion['last']);
175
+    $f = $t . $serveur;
176
+    spip_log($m, $f . '.' . _LOG_ERREUR);
177 177
 }
178 178
 
179 179
 /**
@@ -195,23 +195,23 @@  discard block
 block discarded – undo
195 195
  *     - array : description de la connexion, si l'instruction sql est indisponible pour cette connexion
196 196
  **/
197 197
 function spip_connect_sql($version, $ins = '', $serveur = '', $continue = false) {
198
-	$desc = spip_connect($serveur, $version);
199
-	if (
200
-		$desc
201
-		&& ($f = ($desc[$version][$ins] ?? ''))
202
-		&& function_exists($f)
203
-	) {
204
-		return $f;
205
-	}
206
-	if ($continue) {
207
-		return $desc;
208
-	}
209
-	if ($ins) {
210
-		spip_log("Le serveur '$serveur' version $version n'a pas '$ins'", _LOG_ERREUR);
211
-	}
212
-	include_spip('inc/minipres');
213
-	echo minipres(_T('info_travaux_titre'), _T('titre_probleme_technique'), ['status' => 503]);
214
-	exit;
198
+    $desc = spip_connect($serveur, $version);
199
+    if (
200
+        $desc
201
+        && ($f = ($desc[$version][$ins] ?? ''))
202
+        && function_exists($f)
203
+    ) {
204
+        return $f;
205
+    }
206
+    if ($continue) {
207
+        return $desc;
208
+    }
209
+    if ($ins) {
210
+        spip_log("Le serveur '$serveur' version $version n'a pas '$ins'", _LOG_ERREUR);
211
+    }
212
+    include_spip('inc/minipres');
213
+    echo minipres(_T('info_travaux_titre'), _T('titre_probleme_technique'), ['status' => 503]);
214
+    exit;
215 215
 }
216 216
 
217 217
 /**
@@ -237,70 +237,70 @@  discard block
 block discarded – undo
237 237
  * @return array|null Description de la connexion
238 238
  */
239 239
 function spip_connect_db(
240
-	$host,
241
-	$port,
242
-	$login,
243
-	#[\SensitiveParameter] $pass,
244
-	$db = '',
245
-	$type = 'mysql',
246
-	$prefixe = '',
247
-	$auth = '',
248
-	$charset = ''
240
+    $host,
241
+    $port,
242
+    $login,
243
+    #[\SensitiveParameter] $pass,
244
+    $db = '',
245
+    $type = 'mysql',
246
+    $prefixe = '',
247
+    $auth = '',
248
+    $charset = ''
249 249
 ) {
250
-	// temps avant nouvelle tentative de connexion
251
-	// suite a une connection echouee
252
-	if (!defined('_CONNECT_RETRY_DELAY')) {
253
-		define('_CONNECT_RETRY_DELAY', 30);
254
-	}
255
-
256
-	$f = '';
257
-	// un fichier de identifiant par combinaison (type,host,port,db)
258
-	// pour ne pas declarer tout indisponible d'un coup
259
-	// si en cours d'installation ou si db=@test@ on ne pose rien
260
-	// car c'est un test de connexion
261
-	if (!defined('_ECRIRE_INSTALL') && $db !== '@test@') {
262
-		$f = _DIR_TMP . $type . '.' . substr(md5($host . $port . $db), 0, 8) . '.out';
263
-	} elseif ($db == '@test@') {
264
-		$db = '';
265
-	}
266
-
267
-	if (
268
-		$f
269
-		&& @file_exists($f)
270
-		&& (time() - @filemtime($f) < _CONNECT_RETRY_DELAY)
271
-	) {
272
-		spip_log("Echec : $f recent. Pas de tentative de connexion", _LOG_HS);
273
-
274
-		return null;
275
-	}
276
-
277
-	if (!$prefixe) {
278
-		$prefixe = $GLOBALS['table_prefix'] ?? $db;
279
-	}
280
-	$h = charger_fonction($type, 'req', true);
281
-	if (!$h) {
282
-		spip_log("les requetes $type ne sont pas fournies", _LOG_HS);
283
-
284
-		return null;
285
-	}
286
-	if ($g = $h($host, $port, $login, $pass, $db, $prefixe)) {
287
-		if (!is_array($auth)) {
288
-			// compatibilite version 0.7 initiale
289
-			$g['ldap'] = $auth;
290
-			$auth = ['ldap' => $auth];
291
-		}
292
-		$g['authentification'] = $auth;
293
-		$g['type'] = $type;
294
-		$g['charset'] = $charset;
295
-
296
-		return $GLOBALS['db_ok'] = $g;
297
-	}
298
-	// En cas d'indisponibilite du serveur, eviter de le bombarder
299
-	if ($f) {
300
-		@touch($f);
301
-		spip_log("Echec connexion serveur $type : host[$host] port[$port] login[$login] base[$db]", $type . '.' . _LOG_HS);
302
-	}
303
-	return null;
250
+    // temps avant nouvelle tentative de connexion
251
+    // suite a une connection echouee
252
+    if (!defined('_CONNECT_RETRY_DELAY')) {
253
+        define('_CONNECT_RETRY_DELAY', 30);
254
+    }
255
+
256
+    $f = '';
257
+    // un fichier de identifiant par combinaison (type,host,port,db)
258
+    // pour ne pas declarer tout indisponible d'un coup
259
+    // si en cours d'installation ou si db=@test@ on ne pose rien
260
+    // car c'est un test de connexion
261
+    if (!defined('_ECRIRE_INSTALL') && $db !== '@test@') {
262
+        $f = _DIR_TMP . $type . '.' . substr(md5($host . $port . $db), 0, 8) . '.out';
263
+    } elseif ($db == '@test@') {
264
+        $db = '';
265
+    }
266
+
267
+    if (
268
+        $f
269
+        && @file_exists($f)
270
+        && (time() - @filemtime($f) < _CONNECT_RETRY_DELAY)
271
+    ) {
272
+        spip_log("Echec : $f recent. Pas de tentative de connexion", _LOG_HS);
273
+
274
+        return null;
275
+    }
276
+
277
+    if (!$prefixe) {
278
+        $prefixe = $GLOBALS['table_prefix'] ?? $db;
279
+    }
280
+    $h = charger_fonction($type, 'req', true);
281
+    if (!$h) {
282
+        spip_log("les requetes $type ne sont pas fournies", _LOG_HS);
283
+
284
+        return null;
285
+    }
286
+    if ($g = $h($host, $port, $login, $pass, $db, $prefixe)) {
287
+        if (!is_array($auth)) {
288
+            // compatibilite version 0.7 initiale
289
+            $g['ldap'] = $auth;
290
+            $auth = ['ldap' => $auth];
291
+        }
292
+        $g['authentification'] = $auth;
293
+        $g['type'] = $type;
294
+        $g['charset'] = $charset;
295
+
296
+        return $GLOBALS['db_ok'] = $g;
297
+    }
298
+    // En cas d'indisponibilite du serveur, eviter de le bombarder
299
+    if ($f) {
300
+        @touch($f);
301
+        spip_log("Echec connexion serveur $type : host[$host] port[$port] login[$login] base[$db]", $type . '.' . _LOG_HS);
302
+    }
303
+    return null;
304 304
 }
305 305
 
306 306
 
@@ -332,32 +332,32 @@  discard block
 block discarded – undo
332 332
  *     - nom du charset sinon
333 333
  **/
334 334
 function spip_connect_main($connexion, $charset_sql_connexion = '') {
335
-	if ($GLOBALS['spip_connect_version'] < 0.1 && _DIR_RESTREINT) {
336
-		include_spip('inc/headers');
337
-		redirige_url_ecrire('upgrade', 'reinstall=oui');
338
-	}
339
-
340
-	if (!($f = $connexion['select'])) {
341
-		return false;
342
-	}
343
-	// si le charset est fourni, l'utiliser
344
-	if ($charset_sql_connexion) {
345
-		return $charset_sql_connexion;
346
-	}
347
-	// sinon on regarde la table spip_meta
348
-	// en cas d'erreur select retourne la requette (is_string=true donc)
349
-	if (
350
-		!($r = $f('valeur', 'spip_meta', "nom='charset_sql_connexion'"))
351
-		|| is_string($r)
352
-	) {
353
-		return false;
354
-	}
355
-	if (!($f = $connexion['fetch'])) {
356
-		return false;
357
-	}
358
-	$r = $f($r);
359
-
360
-	return (isset($r['valeur']) && $r['valeur']) ? $r['valeur'] : -1;
335
+    if ($GLOBALS['spip_connect_version'] < 0.1 && _DIR_RESTREINT) {
336
+        include_spip('inc/headers');
337
+        redirige_url_ecrire('upgrade', 'reinstall=oui');
338
+    }
339
+
340
+    if (!($f = $connexion['select'])) {
341
+        return false;
342
+    }
343
+    // si le charset est fourni, l'utiliser
344
+    if ($charset_sql_connexion) {
345
+        return $charset_sql_connexion;
346
+    }
347
+    // sinon on regarde la table spip_meta
348
+    // en cas d'erreur select retourne la requette (is_string=true donc)
349
+    if (
350
+        !($r = $f('valeur', 'spip_meta', "nom='charset_sql_connexion'"))
351
+        || is_string($r)
352
+    ) {
353
+        return false;
354
+    }
355
+    if (!($f = $connexion['fetch'])) {
356
+        return false;
357
+    }
358
+    $r = $f($r);
359
+
360
+    return (isset($r['valeur']) && $r['valeur']) ? $r['valeur'] : -1;
361 361
 }
362 362
 
363 363
 /**
@@ -373,8 +373,8 @@  discard block
 block discarded – undo
373 373
  * @return array
374 374
  */
375 375
 function spip_connect_ldap($serveur = '') {
376
-	include_spip('auth/ldap');
377
-	return auth_ldap_connect($serveur);
376
+    include_spip('auth/ldap');
377
+    return auth_ldap_connect($serveur);
378 378
 }
379 379
 
380 380
 /**
@@ -390,16 +390,16 @@  discard block
 block discarded – undo
390 390
  * @return string Valeur échappée.
391 391
  **/
392 392
 function _q($a): string {
393
-	if (is_numeric($a)) {
394
-		return (string) $a;
395
-	} elseif (is_array($a)) {
396
-		return implode(',', array_map('_q', $a));
397
-	} elseif (is_scalar($a)) {
398
-		return ("'" . addslashes($a) . "'");
399
-	} elseif ($a === null) {
400
-		return "''";
401
-	}
402
-	throw new \RuntimeException('Can’t use _q with ' . gettype($a));
393
+    if (is_numeric($a)) {
394
+        return (string) $a;
395
+    } elseif (is_array($a)) {
396
+        return implode(',', array_map('_q', $a));
397
+    } elseif (is_scalar($a)) {
398
+        return ("'" . addslashes($a) . "'");
399
+    } elseif ($a === null) {
400
+        return "''";
401
+    }
402
+    throw new \RuntimeException('Can’t use _q with ' . gettype($a));
403 403
 }
404 404
 
405 405
 /**
@@ -415,75 +415,75 @@  discard block
 block discarded – undo
415 415
  * @return array
416 416
  */
417 417
 function query_echappe_textes($query, $uniqid = null) {
418
-	static $codeEchappements = null;
419
-	if (is_null($codeEchappements) || $uniqid) {
420
-		if (is_null($uniqid)) {
421
-			$uniqid = uniqid();
422
-		}
423
-		$uniqid = substr(md5($uniqid), 0, 4);
424
-		$codeEchappements = ['\\\\' => "\x1@#{$uniqid}#@\x1", "\\'" => "\x2@#{$uniqid}#@\x2", '\\"' => "\x3@#{$uniqid}#@\x3", '%' => "\x4@#{$uniqid}#@\x4"];
425
-	}
426
-	if ($query === null) {
427
-		return $codeEchappements;
428
-	}
429
-
430
-	// si la query contient deja des codes d'echappement on va s'emmeler les pinceaux et donc on ne touche a rien
431
-	// ce n'est pas un cas legitime
432
-	foreach ($codeEchappements as $codeEchappement) {
433
-		if (str_contains($query, (string) $codeEchappement)) {
434
-			return [$query, []];
435
-		}
436
-	}
437
-
438
-	$query_echappees = str_replace(array_keys($codeEchappements), array_values($codeEchappements), $query);
439
-	if (preg_match_all("/('[^']*')|(\"[^\"]*\")/S", $query_echappees, $textes)) {
440
-		$textes = reset($textes);
441
-
442
-		$parts = [];
443
-		$currentpos = 0;
444
-		$k = 0;
445
-		while (count($textes)) {
446
-			$part = array_shift($textes);
447
-			$nextpos = strpos($query_echappees, (string) $part, $currentpos);
448
-			// si besoin recoller ensemble les doubles '' de sqlite (echappement des ')
449
-			while (count($textes) && str_ends_with($part, "'")) {
450
-				$next = reset($textes);
451
-				if (
452
-					str_starts_with($next, "'")
453
-					&& strpos($query_echappees, $part . $next, $currentpos) === $nextpos
454
-				) {
455
-					$part .= array_shift($textes);
456
-				}
457
-				else {
458
-					break;
459
-				}
460
-			}
461
-			$k++;
462
-			$parts[$k] = [
463
-				'texte' => $part,
464
-				'position' => $nextpos,
465
-				'placeholder' => '%' . $k . '$s',
466
-			];
467
-			$currentpos = $nextpos + strlen($part);
468
-		}
469
-
470
-		// et on replace les parts une par une en commencant par la fin
471
-		while ($k > 0) {
472
-			$query_echappees = substr_replace($query_echappees, $parts[$k]['placeholder'], $parts[$k]['position'], strlen($parts[$k]['texte']));
473
-			$k--;
474
-		}
475
-		$textes = array_column($parts, 'texte');
476
-	} else {
477
-		$textes = [];
478
-	}
479
-
480
-	// si il reste des quotes simples ou doubles, c'est qu'on s'est emmelle les pinceaux
481
-	// dans le doute on ne touche a rien
482
-	if (strpbrk($query_echappees, "'\"") !== false) {
483
-		return [$query, []];
484
-	}
485
-
486
-	return [$query_echappees, $textes];
418
+    static $codeEchappements = null;
419
+    if (is_null($codeEchappements) || $uniqid) {
420
+        if (is_null($uniqid)) {
421
+            $uniqid = uniqid();
422
+        }
423
+        $uniqid = substr(md5($uniqid), 0, 4);
424
+        $codeEchappements = ['\\\\' => "\x1@#{$uniqid}#@\x1", "\\'" => "\x2@#{$uniqid}#@\x2", '\\"' => "\x3@#{$uniqid}#@\x3", '%' => "\x4@#{$uniqid}#@\x4"];
425
+    }
426
+    if ($query === null) {
427
+        return $codeEchappements;
428
+    }
429
+
430
+    // si la query contient deja des codes d'echappement on va s'emmeler les pinceaux et donc on ne touche a rien
431
+    // ce n'est pas un cas legitime
432
+    foreach ($codeEchappements as $codeEchappement) {
433
+        if (str_contains($query, (string) $codeEchappement)) {
434
+            return [$query, []];
435
+        }
436
+    }
437
+
438
+    $query_echappees = str_replace(array_keys($codeEchappements), array_values($codeEchappements), $query);
439
+    if (preg_match_all("/('[^']*')|(\"[^\"]*\")/S", $query_echappees, $textes)) {
440
+        $textes = reset($textes);
441
+
442
+        $parts = [];
443
+        $currentpos = 0;
444
+        $k = 0;
445
+        while (count($textes)) {
446
+            $part = array_shift($textes);
447
+            $nextpos = strpos($query_echappees, (string) $part, $currentpos);
448
+            // si besoin recoller ensemble les doubles '' de sqlite (echappement des ')
449
+            while (count($textes) && str_ends_with($part, "'")) {
450
+                $next = reset($textes);
451
+                if (
452
+                    str_starts_with($next, "'")
453
+                    && strpos($query_echappees, $part . $next, $currentpos) === $nextpos
454
+                ) {
455
+                    $part .= array_shift($textes);
456
+                }
457
+                else {
458
+                    break;
459
+                }
460
+            }
461
+            $k++;
462
+            $parts[$k] = [
463
+                'texte' => $part,
464
+                'position' => $nextpos,
465
+                'placeholder' => '%' . $k . '$s',
466
+            ];
467
+            $currentpos = $nextpos + strlen($part);
468
+        }
469
+
470
+        // et on replace les parts une par une en commencant par la fin
471
+        while ($k > 0) {
472
+            $query_echappees = substr_replace($query_echappees, $parts[$k]['placeholder'], $parts[$k]['position'], strlen($parts[$k]['texte']));
473
+            $k--;
474
+        }
475
+        $textes = array_column($parts, 'texte');
476
+    } else {
477
+        $textes = [];
478
+    }
479
+
480
+    // si il reste des quotes simples ou doubles, c'est qu'on s'est emmelle les pinceaux
481
+    // dans le doute on ne touche a rien
482
+    if (strpbrk($query_echappees, "'\"") !== false) {
483
+        return [$query, []];
484
+    }
485
+
486
+    return [$query_echappees, $textes];
487 487
 }
488 488
 
489 489
 /**
@@ -497,14 +497,14 @@  discard block
 block discarded – undo
497 497
  * @return string
498 498
  */
499 499
 function query_reinjecte_textes($query, $textes) {
500
-	// recuperer les codes echappements
501
-	$codeEchappements = query_echappe_textes(null);
500
+    // recuperer les codes echappements
501
+    $codeEchappements = query_echappe_textes(null);
502 502
 
503
-	if (!empty($textes)) {
504
-		$query = sprintf($query, ...$textes);
505
-	}
503
+    if (!empty($textes)) {
504
+        $query = sprintf($query, ...$textes);
505
+    }
506 506
 
507
-	return str_replace(array_values($codeEchappements), array_keys($codeEchappements), $query);
507
+    return str_replace(array_values($codeEchappements), array_keys($codeEchappements), $query);
508 508
 }
509 509
 
510 510
 
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
  **/
524 524
 function spip_query($query, $serveur = '') {
525 525
 
526
-	$f = spip_connect_sql($GLOBALS['spip_sql_version'], 'query', $serveur, true);
526
+    $f = spip_connect_sql($GLOBALS['spip_sql_version'], 'query', $serveur, true);
527 527
 
528
-	return function_exists($f) ? $f($query, $serveur) : false;
528
+    return function_exists($f) ? $f($query, $serveur) : false;
529 529
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 if (!defined('_ECRIRE_INC_VERSION')) {
18 18
 	return;
19 19
 }
20
-require_once _ROOT_RESTREINT . 'base/objets.php';
20
+require_once _ROOT_RESTREINT.'base/objets.php';
21 21
 
22 22
 
23 23
 /**
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 				defined('_DIR_CONNECT')
63 63
 				&& preg_match('/^[\w\.]*$/', $serveur)
64 64
 			) {
65
-				$f = _DIR_CONNECT . $serveur . '.php';
65
+				$f = _DIR_CONNECT.$serveur.'.php';
66 66
 				if (!is_readable($f) && !$install) {
67 67
 					// chercher une declaration de serveur dans le path
68 68
 					// qui peut servir à des plugins à declarer des connexions à une base sqlite
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
 	// chargement de la version du jeu de fonctions
111 111
 	// si pas dans le fichier par defaut
112 112
 	$type = $GLOBALS['db_ok']['type'];
113
-	$jeu = 'spip_' . $type . '_functions_' . $version;
114
-	if (!isset($GLOBALS[$jeu]) && !find_in_path($type . '_' . $version . '.php', 'req/', true)) {
113
+	$jeu = 'spip_'.$type.'_functions_'.$version;
114
+	if (!isset($GLOBALS[$jeu]) && !find_in_path($type.'_'.$version.'.php', 'req/', true)) {
115 115
 		spip_log("spip_connect: serveur $index version '$version' non defini pour '$type'", _LOG_HS);
116 116
 		// ne plus reessayer
117 117
 		return $GLOBALS['connexions'][$index][$version] = [];
@@ -171,9 +171,9 @@  discard block
 block discarded – undo
171 171
 	$connexion = spip_connect($serveur);
172 172
 	$e = sql_errno($serveur);
173 173
 	$t = ($connexion['type'] ?? 'sql');
174
-	$m = "Erreur $e de $t: " . sql_error($serveur) . "\nin " . sql_error_backtrace() . "\n" . trim($connexion['last']);
175
-	$f = $t . $serveur;
176
-	spip_log($m, $f . '.' . _LOG_ERREUR);
174
+	$m = "Erreur $e de $t: ".sql_error($serveur)."\nin ".sql_error_backtrace()."\n".trim($connexion['last']);
175
+	$f = $t.$serveur;
176
+	spip_log($m, $f.'.'._LOG_ERREUR);
177 177
 }
178 178
 
179 179
 /**
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	// si en cours d'installation ou si db=@test@ on ne pose rien
260 260
 	// car c'est un test de connexion
261 261
 	if (!defined('_ECRIRE_INSTALL') && $db !== '@test@') {
262
-		$f = _DIR_TMP . $type . '.' . substr(md5($host . $port . $db), 0, 8) . '.out';
262
+		$f = _DIR_TMP.$type.'.'.substr(md5($host.$port.$db), 0, 8).'.out';
263 263
 	} elseif ($db == '@test@') {
264 264
 		$db = '';
265 265
 	}
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 	// En cas d'indisponibilite du serveur, eviter de le bombarder
299 299
 	if ($f) {
300 300
 		@touch($f);
301
-		spip_log("Echec connexion serveur $type : host[$host] port[$port] login[$login] base[$db]", $type . '.' . _LOG_HS);
301
+		spip_log("Echec connexion serveur $type : host[$host] port[$port] login[$login] base[$db]", $type.'.'._LOG_HS);
302 302
 	}
303 303
 	return null;
304 304
 }
@@ -395,11 +395,11 @@  discard block
 block discarded – undo
395 395
 	} elseif (is_array($a)) {
396 396
 		return implode(',', array_map('_q', $a));
397 397
 	} elseif (is_scalar($a)) {
398
-		return ("'" . addslashes($a) . "'");
398
+		return ("'".addslashes($a)."'");
399 399
 	} elseif ($a === null) {
400 400
 		return "''";
401 401
 	}
402
-	throw new \RuntimeException('Can’t use _q with ' . gettype($a));
402
+	throw new \RuntimeException('Can’t use _q with '.gettype($a));
403 403
 }
404 404
 
405 405
 /**
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 				$next = reset($textes);
451 451
 				if (
452 452
 					str_starts_with($next, "'")
453
-					&& strpos($query_echappees, $part . $next, $currentpos) === $nextpos
453
+					&& strpos($query_echappees, $part.$next, $currentpos) === $nextpos
454 454
 				) {
455 455
 					$part .= array_shift($textes);
456 456
 				}
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 			$parts[$k] = [
463 463
 				'texte' => $part,
464 464
 				'position' => $nextpos,
465
-				'placeholder' => '%' . $k . '$s',
465
+				'placeholder' => '%'.$k.'$s',
466 466
 			];
467 467
 			$currentpos = $nextpos + strlen($part);
468 468
 		}
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -87,8 +87,7 @@  discard block
 block discarded – undo
87 87
 			if (!isset($GLOBALS['db_ok'])) {
88 88
 				spip_log("spip_connect: fichier de connexion '$f' OK mais echec connexion au serveur", _LOG_HS);
89 89
 			}
90
-		}
91
-		else {
90
+		} else {
92 91
 			spip_log("spip_connect: fichier de connexion '$f' non trouve, pas de connexion serveur", _LOG_HS);
93 92
 		}
94 93
 		if (!isset($GLOBALS['db_ok'])) {
@@ -453,8 +452,7 @@  discard block
 block discarded – undo
453 452
 					&& strpos($query_echappees, $part . $next, $currentpos) === $nextpos
454 453
 				) {
455 454
 					$part .= array_shift($textes);
456
-				}
457
-				else {
455
+				} else {
458 456
 					break;
459 457
 				}
460 458
 			}
Please login to merge, or discard this patch.
ecrire/balise/formulaire_ecrire_auteur.php 1 patch
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  **/
17 17
 
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 include_spip('base/abstract_sql');
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
  *     Pile complétée du code compilé
41 41
  **/
42 42
 function balise_FORMULAIRE_ECRIRE_AUTEUR($p) {
43
-	return calculer_balise_dynamique($p, 'FORMULAIRE_ECRIRE_AUTEUR', ['id_auteur', 'id_article', 'email']);
43
+    return calculer_balise_dynamique($p, 'FORMULAIRE_ECRIRE_AUTEUR', ['id_auteur', 'id_article', 'email']);
44 44
 }
45 45
 
46 46
 /**
@@ -58,44 +58,44 @@  discard block
 block discarded – undo
58 58
  *   - chaîne vide sinon (erreur ou non affichage).
59 59
  */
60 60
 function balise_FORMULAIRE_ECRIRE_AUTEUR_stat($args, $context_compil) {
61
-	include_spip('inc/filtres');
62
-	// Pas d'id_auteur ni d'id_article ? Erreur de contexte
63
-	$id = (int) $args[1];
64
-	if (!$args[0] && !$id) {
65
-		$msg = [
66
-			'zbug_champ_hors_motif',
67
-			[
68
-				'champ' => 'FORMULAIRE_ECRIRE_AUTEUR',
69
-				'motif' => 'AUTEURS/ARTICLES'
70
-			]
71
-		];
61
+    include_spip('inc/filtres');
62
+    // Pas d'id_auteur ni d'id_article ? Erreur de contexte
63
+    $id = (int) $args[1];
64
+    if (!$args[0] && !$id) {
65
+        $msg = [
66
+            'zbug_champ_hors_motif',
67
+            [
68
+                'champ' => 'FORMULAIRE_ECRIRE_AUTEUR',
69
+                'motif' => 'AUTEURS/ARTICLES'
70
+            ]
71
+        ];
72 72
 
73
-		erreur_squelette($msg, $context_compil);
73
+        erreur_squelette($msg, $context_compil);
74 74
 
75
-		return '';
76
-	}
77
-	// Si on est dans un contexte article,
78
-	// sortir tous les mails des auteurs de l'article
79
-	if (!$args[0] && $id) {
80
-		$r = '';
81
-		$s = sql_allfetsel(
82
-			'email',
83
-			'spip_auteurs AS A LEFT JOIN spip_auteurs_liens AS L ON (A.id_auteur=L.id_auteur AND L.objet=\'article\')',
84
-			"A.email != '' AND L.id_objet=$id"
85
-		);
86
-		foreach ($s as $row) {
87
-			if (email_valide($row['email'])) {
88
-				$r .= ', ' . $row['email'];
89
-			}
90
-		}
91
-		$args[2] = substr($r, 2);
92
-	}
75
+        return '';
76
+    }
77
+    // Si on est dans un contexte article,
78
+    // sortir tous les mails des auteurs de l'article
79
+    if (!$args[0] && $id) {
80
+        $r = '';
81
+        $s = sql_allfetsel(
82
+            'email',
83
+            'spip_auteurs AS A LEFT JOIN spip_auteurs_liens AS L ON (A.id_auteur=L.id_auteur AND L.objet=\'article\')',
84
+            "A.email != '' AND L.id_objet=$id"
85
+        );
86
+        foreach ($s as $row) {
87
+            if (email_valide($row['email'])) {
88
+                $r .= ', ' . $row['email'];
89
+            }
90
+        }
91
+        $args[2] = substr($r, 2);
92
+    }
93 93
 
94
-	// On ne peut pas ecrire a un auteur dont le mail n'est pas valide
95
-	if (!$args[2] || !email_valide($args[2])) {
96
-		return '';
97
-	}
94
+    // On ne peut pas ecrire a un auteur dont le mail n'est pas valide
95
+    if (!$args[2] || !email_valide($args[2])) {
96
+        return '';
97
+    }
98 98
 
99
-	// OK
100
-	return $args;
99
+    // OK
100
+    return $args;
101 101
 }
Please login to merge, or discard this patch.
ecrire/balise/info_.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  **/
17 17
 
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 /**
@@ -39,29 +39,29 @@  discard block
 block discarded – undo
39 39
  *     Pile complétée par le code à générer
40 40
  */
41 41
 function balise_INFO__dist($p) {
42
-	$info = $p->nom_champ;
43
-	$type_objet = interprete_argument_balise(1, $p);
44
-	$id_objet = interprete_argument_balise(2, $p);
45
-	if ($info === 'INFO_' || !$type_objet || !$id_objet) {
46
-		$msg = _T('zbug_balise_sans_argument', ['balise' => ' INFO_']);
47
-		erreur_squelette($msg, $p);
48
-		$p->interdire_scripts = true;
42
+    $info = $p->nom_champ;
43
+    $type_objet = interprete_argument_balise(1, $p);
44
+    $id_objet = interprete_argument_balise(2, $p);
45
+    if ($info === 'INFO_' || !$type_objet || !$id_objet) {
46
+        $msg = _T('zbug_balise_sans_argument', ['balise' => ' INFO_']);
47
+        erreur_squelette($msg, $p);
48
+        $p->interdire_scripts = true;
49 49
 
50
-		return $p;
51
-	} else {
52
-		// Récupérer tous les params à la suite de objet et id_objet
53
-		$_params = '[';
54
-		$nb_params = is_countable($p->param[0]) ? count($p->param[0]) : 0; // 1ère valeur vide donc 1 en plus
55
-		for ($i = 3; $i < $nb_params; $i++) {
56
-			$_params .= interprete_argument_balise($i, $p) . ',';
57
-		}
58
-		$_params .= ']';
50
+        return $p;
51
+    } else {
52
+        // Récupérer tous les params à la suite de objet et id_objet
53
+        $_params = '[';
54
+        $nb_params = is_countable($p->param[0]) ? count($p->param[0]) : 0; // 1ère valeur vide donc 1 en plus
55
+        for ($i = 3; $i < $nb_params; $i++) {
56
+            $_params .= interprete_argument_balise($i, $p) . ',';
57
+        }
58
+        $_params .= ']';
59 59
 
60
-		$info_sql = strtolower(substr($info, 5));
61
-		$code = "generer_objet_info($id_objet, $type_objet, '$info_sql', " . ($p->etoile ? _q($p->etoile) : "''") . ", $_params)";
62
-		$p->code = champ_sql($info, $p, $code);
63
-		$p->interdire_scripts = true;
60
+        $info_sql = strtolower(substr($info, 5));
61
+        $code = "generer_objet_info($id_objet, $type_objet, '$info_sql', " . ($p->etoile ? _q($p->etoile) : "''") . ", $_params)";
62
+        $p->code = champ_sql($info, $p, $code);
63
+        $p->interdire_scripts = true;
64 64
 
65
-		return $p;
66
-	}
65
+        return $p;
66
+    }
67 67
 }
Please login to merge, or discard this patch.
ecrire/balise/id_logo_.php 2 patches
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  **/
17 17
 
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 
@@ -48,38 +48,38 @@  discard block
 block discarded – undo
48 48
  */
49 49
 function balise_ID_LOGO__dist($p) {
50 50
 
51
-	preg_match(',^ID_LOGO_([A-Z_]+?)(|_NORMAL|_SURVOL|_RUBRIQUE)$,i', $p->nom_champ, $regs);
52
-	$type = strtolower($regs[1]);
53
-	$suite_logo = $regs[2];
54
-
55
-	// cas de #ID_LOGO_SITE_SPIP
56
-	if ($type == 'site_spip') {
57
-		$type = 'site';
58
-		$_id_objet = "\"'0'\"";
59
-	}
60
-
61
-	$id_objet = id_table_objet($type);
62
-	if (!isset($_id_objet)) {
63
-		$_id_objet = champ_sql($id_objet, $p);
64
-	}
65
-
66
-	$connect = $p->id_boucle ? $p->boucles[$p->id_boucle]->sql_serveur : '';
67
-	if ($type == 'document') {
68
-		$qconnect = _q($connect);
69
-		$doc = "quete_document($_id_objet, $qconnect)";
70
-		$code = "table_valeur($doc, 'id_vignette')";
71
-	} elseif ($connect) {
72
-		$code = "''";
73
-		spip_log('Les logos distants ne sont pas prevus');
74
-	} else {
75
-		$champ_logo = 'id';
76
-		$code = generer_code_logo($id_objet, $_id_objet, $type, '', "''", $p, $suite_logo, $champ_logo);
77
-	}
78
-
79
-	$p->code = $code;
80
-	$p->interdire_scripts = false;
81
-
82
-	return $p;
51
+    preg_match(',^ID_LOGO_([A-Z_]+?)(|_NORMAL|_SURVOL|_RUBRIQUE)$,i', $p->nom_champ, $regs);
52
+    $type = strtolower($regs[1]);
53
+    $suite_logo = $regs[2];
54
+
55
+    // cas de #ID_LOGO_SITE_SPIP
56
+    if ($type == 'site_spip') {
57
+        $type = 'site';
58
+        $_id_objet = "\"'0'\"";
59
+    }
60
+
61
+    $id_objet = id_table_objet($type);
62
+    if (!isset($_id_objet)) {
63
+        $_id_objet = champ_sql($id_objet, $p);
64
+    }
65
+
66
+    $connect = $p->id_boucle ? $p->boucles[$p->id_boucle]->sql_serveur : '';
67
+    if ($type == 'document') {
68
+        $qconnect = _q($connect);
69
+        $doc = "quete_document($_id_objet, $qconnect)";
70
+        $code = "table_valeur($doc, 'id_vignette')";
71
+    } elseif ($connect) {
72
+        $code = "''";
73
+        spip_log('Les logos distants ne sont pas prevus');
74
+    } else {
75
+        $champ_logo = 'id';
76
+        $code = generer_code_logo($id_objet, $_id_objet, $type, '', "''", $p, $suite_logo, $champ_logo);
77
+    }
78
+
79
+    $p->code = $code;
80
+    $p->interdire_scripts = false;
81
+
82
+    return $p;
83 83
 }
84 84
 
85 85
 /**
@@ -108,28 +108,28 @@  discard block
 block discarded – undo
108 108
  *     Code compilé retournant le chemin du logo ou le code HTML du logo.
109 109
  **/
110 110
 function generer_code_logo($id_objet, $_id_objet, $type, $align, $_lien, $p, $suite, string $champ = ''): string {
111
-	$onoff = 'ON';
112
-	$_id_rubrique = "''";
111
+    $onoff = 'ON';
112
+    $_id_rubrique = "''";
113 113
 
114
-	if ($type === 'rubrique') {
115
-		$_id_rubrique = "quete_parent($_id_objet)";
116
-	}
114
+    if ($type === 'rubrique') {
115
+        $_id_rubrique = "quete_parent($_id_objet)";
116
+    }
117 117
 
118
-	if ($suite === '_SURVOL') {
119
-		$onoff = 'off';
120
-	} elseif ($suite === '_NORMAL') {
121
-		$onoff = 'on';
122
-	} elseif ($suite === '_RUBRIQUE') {
123
-		$_id_rubrique = champ_sql('id_rubrique', $p);
124
-	}
118
+    if ($suite === '_SURVOL') {
119
+        $onoff = 'off';
120
+    } elseif ($suite === '_NORMAL') {
121
+        $onoff = 'on';
122
+    } elseif ($suite === '_RUBRIQUE') {
123
+        $_id_rubrique = champ_sql('id_rubrique', $p);
124
+    }
125 125
 
126
-	$code = "quete_logo('$id_objet', '$onoff', $_id_objet, $_id_rubrique)";
126
+    $code = "quete_logo('$id_objet', '$onoff', $_id_objet, $_id_rubrique)";
127 127
 
128
-	if ($champ) {
129
-		return "table_valeur($code, '" . addslashes($champ) . "')";
130
-	}
128
+    if ($champ) {
129
+        return "table_valeur($code, '" . addslashes($champ) . "')";
130
+    }
131 131
 
132
-	$align = preg_replace(',\W,', '', $align);
132
+    $align = preg_replace(',\W,', '', $align);
133 133
 
134
-	return "quete_html_logo($code, '$align', " . ($_lien ?: "''") . ')';
134
+    return "quete_html_logo($code, '$align', " . ($_lien ?: "''") . ')';
135 135
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -126,10 +126,10 @@
 block discarded – undo
126 126
 	$code = "quete_logo('$id_objet', '$onoff', $_id_objet, $_id_rubrique)";
127 127
 
128 128
 	if ($champ) {
129
-		return "table_valeur($code, '" . addslashes($champ) . "')";
129
+		return "table_valeur($code, '".addslashes($champ)."')";
130 130
 	}
131 131
 
132 132
 	$align = preg_replace(',\W,', '', $align);
133 133
 
134
-	return "quete_html_logo($code, '$align', " . ($_lien ?: "''") . ')';
134
+	return "quete_html_logo($code, '$align', ".($_lien ?: "''").')';
135 135
 }
Please login to merge, or discard this patch.
ecrire/balise/formulaire_inscription.php 3 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  **/
17 17
 
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 include_spip('base/abstract_sql');
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
  *     Pile complétée du code compilé
44 44
  **/
45 45
 function balise_FORMULAIRE_INSCRIPTION($p) {
46
-	return calculer_balise_dynamique($p, 'FORMULAIRE_INSCRIPTION', []);
46
+    return calculer_balise_dynamique($p, 'FORMULAIRE_INSCRIPTION', []);
47 47
 }
48 48
 
49 49
 /**
@@ -73,19 +73,19 @@  discard block
 block discarded – undo
73 73
  *   - chaîne vide sinon.
74 74
  */
75 75
 function balise_FORMULAIRE_INSCRIPTION_stat($args, $context_compil) {
76
-	[$mode, $id_ou_options, $retour] = array_pad($args, 3, null);
76
+    [$mode, $id_ou_options, $retour] = array_pad($args, 3, null);
77 77
 
78
-	// Compatibilité avec l'ancien param "id" dans les deux sens
79
-	if (!is_array($id_ou_options)) {
80
-		$options = ['id' => (int) $id_ou_options];
81
-		$id = $options['id'];
82
-	}else {
83
-		$options = $id_ou_options;
84
-		$id = (int) ($id_ou_options['id'] ?? 0);
85
-	}
78
+    // Compatibilité avec l'ancien param "id" dans les deux sens
79
+    if (!is_array($id_ou_options)) {
80
+        $options = ['id' => (int) $id_ou_options];
81
+        $id = $options['id'];
82
+    }else {
83
+        $options = $id_ou_options;
84
+        $id = (int) ($id_ou_options['id'] ?? 0);
85
+    }
86 86
 
87
-	include_spip('action/inscrire_auteur');
88
-	$mode = tester_statut_inscription($mode, $id);
87
+    include_spip('action/inscrire_auteur');
88
+    $mode = tester_statut_inscription($mode, $id);
89 89
 
90
-	return $mode ? [$mode, $options, $retour] : '';
90
+    return $mode ? [$mode, $options, $retour] : '';
91 91
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@
 block discarded – undo
79 79
 	if (!is_array($id_ou_options)) {
80 80
 		$options = ['id' => (int) $id_ou_options];
81 81
 		$id = $options['id'];
82
-	}else {
82
+	} else {
83 83
 		$options = $id_ou_options;
84 84
 		$id = (int) ($id_ou_options['id'] ?? 0);
85 85
 	}
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@
 block discarded – undo
79 79
 	if (!is_array($id_ou_options)) {
80 80
 		$options = ['id' => (int) $id_ou_options];
81 81
 		$id = $options['id'];
82
-	}else {
82
+	} else {
83 83
 		$options = $id_ou_options;
84 84
 		$id = (int) ($id_ou_options['id'] ?? 0);
85 85
 	}
Please login to merge, or discard this patch.
ecrire/maj/legacy/v40.php 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  * @package SPIP\Core\SQL\Upgrade
20 20
  **/
21 21
 if (!defined('_ECRIRE_INC_VERSION')) {
22
-	return;
22
+    return;
23 23
 }
24 24
 
25 25
 
@@ -34,49 +34,49 @@  discard block
 block discarded – undo
34 34
  **/
35 35
 function maj_timestamp_mysql($tables = null) {
36 36
 
37
-	include_spip('base/dump');
38
-	if (is_null($tables)) {
39
-		$tables = base_lister_toutes_tables();
40
-	} elseif (is_string($tables)) {
41
-		$tables = [$tables];
42
-	} elseif (!is_array($tables)) {
43
-		return;
44
-	}
37
+    include_spip('base/dump');
38
+    if (is_null($tables)) {
39
+        $tables = base_lister_toutes_tables();
40
+    } elseif (is_string($tables)) {
41
+        $tables = [$tables];
42
+    } elseif (!is_array($tables)) {
43
+        return;
44
+    }
45 45
 
46
-	// rien a faire si base non mysql
47
-	if (!str_starts_with($GLOBALS['connexions'][0]['type'], 'mysql')) {
48
-		return;
49
-	}
46
+    // rien a faire si base non mysql
47
+    if (!str_starts_with($GLOBALS['connexions'][0]['type'], 'mysql')) {
48
+        return;
49
+    }
50 50
 
51
-	$trouver_table = charger_fonction('trouver_table', 'base');
52
-	// forcer le vidage de cache
53
-	$trouver_table('');
51
+    $trouver_table = charger_fonction('trouver_table', 'base');
52
+    // forcer le vidage de cache
53
+    $trouver_table('');
54 54
 
55
-	foreach ($tables as $table) {
56
-		if (time() >= _TIME_OUT) {
57
-			return;
58
-		}
59
-		if ($desc = $trouver_table($table)) {
60
-			$fields_corrected = _mysql_remplacements_definitions_table($desc['field']);
61
-			$d = array_diff($desc['field'], $fields_corrected);
62
-			if ($d) {
63
-				spip_log("Table $table TIMESTAMP incorrect", 'maj');
64
-				foreach ($desc['field'] as $field => $type) {
65
-					if ($desc['field'][$field] !== $fields_corrected[$field]) {
66
-						spip_log("Adaptation TIMESTAMP table $table", 'maj.' . _LOG_INFO_IMPORTANTE);
67
-						sql_alter("table $table change $field $field " . $fields_corrected[$field]);
68
-						$trouver_table('');
69
-						$new_desc = $trouver_table($table);
70
-						spip_log(
71
-							"Apres conversion $table : " . var_export($new_desc['field'], true),
72
-							'maj.' . _LOG_INFO_IMPORTANTE
73
-						);
74
-					}
75
-				}
76
-			}
77
-		}
78
-	}
55
+    foreach ($tables as $table) {
56
+        if (time() >= _TIME_OUT) {
57
+            return;
58
+        }
59
+        if ($desc = $trouver_table($table)) {
60
+            $fields_corrected = _mysql_remplacements_definitions_table($desc['field']);
61
+            $d = array_diff($desc['field'], $fields_corrected);
62
+            if ($d) {
63
+                spip_log("Table $table TIMESTAMP incorrect", 'maj');
64
+                foreach ($desc['field'] as $field => $type) {
65
+                    if ($desc['field'][$field] !== $fields_corrected[$field]) {
66
+                        spip_log("Adaptation TIMESTAMP table $table", 'maj.' . _LOG_INFO_IMPORTANTE);
67
+                        sql_alter("table $table change $field $field " . $fields_corrected[$field]);
68
+                        $trouver_table('');
69
+                        $new_desc = $trouver_table($table);
70
+                        spip_log(
71
+                            "Apres conversion $table : " . var_export($new_desc['field'], true),
72
+                            'maj.' . _LOG_INFO_IMPORTANTE
73
+                        );
74
+                    }
75
+                }
76
+            }
77
+        }
78
+    }
79 79
 
80
-	// forcer le vidage de cache
81
-	$trouver_table('');
80
+    // forcer le vidage de cache
81
+    $trouver_table('');
82 82
 }
Please login to merge, or discard this patch.
ecrire/maj/legacy/v30.php 2 patches
Indentation   +230 added lines, -230 removed lines patch added patch discarded remove patch
@@ -17,18 +17,18 @@  discard block
 block discarded – undo
17 17
  * @package SPIP\Core\SQL\Upgrade
18 18
  **/
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 
23 23
 
24 24
 $GLOBALS['maj'][16428] = [
25
-	['maj_liens', 'auteur'], // creer la table liens
26
-	['maj_liens', 'auteur', 'article'],
27
-	['sql_drop_table', 'spip_auteurs_articles'],
28
-	['maj_liens', 'auteur', 'rubrique'],
29
-	['sql_drop_table', 'spip_auteurs_rubriques'],
30
-	['maj_liens', 'auteur', 'message'],
31
-	['sql_drop_table', 'spip_auteurs_messages'],
25
+    ['maj_liens', 'auteur'], // creer la table liens
26
+    ['maj_liens', 'auteur', 'article'],
27
+    ['sql_drop_table', 'spip_auteurs_articles'],
28
+    ['maj_liens', 'auteur', 'rubrique'],
29
+    ['sql_drop_table', 'spip_auteurs_rubriques'],
30
+    ['maj_liens', 'auteur', 'message'],
31
+    ['sql_drop_table', 'spip_auteurs_messages'],
32 32
 ];
33 33
 
34 34
 /**
@@ -54,89 +54,89 @@  discard block
 block discarded – undo
54 54
  */
55 55
 function maj_liens($pivot, $l = '') {
56 56
 
57
-	@define('_LOG_FILTRE_GRAVITE', 8);
58
-
59
-	$exceptions_pluriel = ['forum' => 'forum', 'syndic' => 'syndic'];
60
-
61
-	$pivot = preg_replace(',[^\w],', '', $pivot); // securite
62
-	$pivots = ($exceptions_pluriel[$pivot] ?? $pivot . 's');
63
-	$liens = 'spip_' . $pivots . '_liens';
64
-	$id_pivot = 'id_' . $pivot;
65
-	// Creer spip_auteurs_liens
66
-	global $tables_auxiliaires;
67
-	if (!$l) {
68
-		include_spip('base/auxiliaires');
69
-		include_spip('base/create');
70
-		creer_ou_upgrader_table($liens, $tables_auxiliaires[$liens], false);
71
-	} else {
72
-		// Preparer
73
-		$l = preg_replace(',[^\w],', '', $l); // securite
74
-		$primary = "id_$l";
75
-		$objet = ($l == 'syndic' ? 'site' : $l);
76
-		$ls = ($exceptions_pluriel[$l] ?? $l . 's');
77
-		$ancienne_table = 'spip_' . $pivots . '_' . $ls;
78
-		$pool = 400;
79
-
80
-		$trouver_table = charger_fonction('trouver_table', 'base');
81
-		if (!$desc = $trouver_table($ancienne_table)) {
82
-			return;
83
-		}
84
-
85
-		// securite pour ne pas perdre de donnees
86
-		if (!$trouver_table($liens)) {
87
-			return;
88
-		}
89
-
90
-		$champs = $desc['field'];
91
-		if (isset($champs['maj'])) {
92
-			unset($champs['maj']);
93
-		}
94
-		if (isset($champs[$primary])) {
95
-			unset($champs[$primary]);
96
-		}
97
-
98
-		$champs = array_keys($champs);
99
-		// ne garder que les champs qui existent sur la table destination
100
-		if ($desc_cible = $trouver_table($liens)) {
101
-			$champs = array_intersect($champs, array_keys($desc_cible['field']));
102
-		}
103
-
104
-		$champs[] = "$primary as id_objet";
105
-		$champs[] = "'$objet' as objet";
106
-		$champs = implode(', ', $champs);
107
-
108
-		// Recopier les donnees
109
-		$sub_pool = 100;
110
-		while ($ids = array_map('reset', sql_allfetsel("$primary", $ancienne_table, '', '', '', "0,$sub_pool"))) {
111
-			$insert = [];
112
-			foreach ($ids as $id) {
113
-				$n = sql_countsel($liens, "objet='$objet' AND id_objet=" . (int) $id);
114
-				while ($t = sql_allfetsel($champs, $ancienne_table, "$primary=" . (int) $id, '', $id_pivot, "$n,$pool")) {
115
-					$n += is_countable($t) ? count($t) : 0;
116
-					// empiler en s'assurant a minima de l'unicite
117
-					while ($r = array_shift($t)) {
118
-						$insert[$r[$id_pivot] . ':' . $r['id_objet']] = $r;
119
-					}
120
-					if (count($insert) >= $sub_pool) {
121
-						maj_liens_insertq_multi_check($liens, $insert, $tables_auxiliaires[$liens]);
122
-						$insert = [];
123
-					}
124
-					// si timeout, sortir, la relance nous ramenera dans cette fonction
125
-					// et on verifiera/repartira de la
126
-					if (time() >= _TIME_OUT) {
127
-						return;
128
-					}
129
-				}
130
-				if (time() >= _TIME_OUT) {
131
-					return;
132
-				}
133
-			}
134
-			if ($insert !== []) {
135
-				maj_liens_insertq_multi_check($liens, $insert, $tables_auxiliaires[$liens]);
136
-			}
137
-			sql_delete($ancienne_table, sql_in($primary, $ids));
138
-		}
139
-	}
57
+    @define('_LOG_FILTRE_GRAVITE', 8);
58
+
59
+    $exceptions_pluriel = ['forum' => 'forum', 'syndic' => 'syndic'];
60
+
61
+    $pivot = preg_replace(',[^\w],', '', $pivot); // securite
62
+    $pivots = ($exceptions_pluriel[$pivot] ?? $pivot . 's');
63
+    $liens = 'spip_' . $pivots . '_liens';
64
+    $id_pivot = 'id_' . $pivot;
65
+    // Creer spip_auteurs_liens
66
+    global $tables_auxiliaires;
67
+    if (!$l) {
68
+        include_spip('base/auxiliaires');
69
+        include_spip('base/create');
70
+        creer_ou_upgrader_table($liens, $tables_auxiliaires[$liens], false);
71
+    } else {
72
+        // Preparer
73
+        $l = preg_replace(',[^\w],', '', $l); // securite
74
+        $primary = "id_$l";
75
+        $objet = ($l == 'syndic' ? 'site' : $l);
76
+        $ls = ($exceptions_pluriel[$l] ?? $l . 's');
77
+        $ancienne_table = 'spip_' . $pivots . '_' . $ls;
78
+        $pool = 400;
79
+
80
+        $trouver_table = charger_fonction('trouver_table', 'base');
81
+        if (!$desc = $trouver_table($ancienne_table)) {
82
+            return;
83
+        }
84
+
85
+        // securite pour ne pas perdre de donnees
86
+        if (!$trouver_table($liens)) {
87
+            return;
88
+        }
89
+
90
+        $champs = $desc['field'];
91
+        if (isset($champs['maj'])) {
92
+            unset($champs['maj']);
93
+        }
94
+        if (isset($champs[$primary])) {
95
+            unset($champs[$primary]);
96
+        }
97
+
98
+        $champs = array_keys($champs);
99
+        // ne garder que les champs qui existent sur la table destination
100
+        if ($desc_cible = $trouver_table($liens)) {
101
+            $champs = array_intersect($champs, array_keys($desc_cible['field']));
102
+        }
103
+
104
+        $champs[] = "$primary as id_objet";
105
+        $champs[] = "'$objet' as objet";
106
+        $champs = implode(', ', $champs);
107
+
108
+        // Recopier les donnees
109
+        $sub_pool = 100;
110
+        while ($ids = array_map('reset', sql_allfetsel("$primary", $ancienne_table, '', '', '', "0,$sub_pool"))) {
111
+            $insert = [];
112
+            foreach ($ids as $id) {
113
+                $n = sql_countsel($liens, "objet='$objet' AND id_objet=" . (int) $id);
114
+                while ($t = sql_allfetsel($champs, $ancienne_table, "$primary=" . (int) $id, '', $id_pivot, "$n,$pool")) {
115
+                    $n += is_countable($t) ? count($t) : 0;
116
+                    // empiler en s'assurant a minima de l'unicite
117
+                    while ($r = array_shift($t)) {
118
+                        $insert[$r[$id_pivot] . ':' . $r['id_objet']] = $r;
119
+                    }
120
+                    if (count($insert) >= $sub_pool) {
121
+                        maj_liens_insertq_multi_check($liens, $insert, $tables_auxiliaires[$liens]);
122
+                        $insert = [];
123
+                    }
124
+                    // si timeout, sortir, la relance nous ramenera dans cette fonction
125
+                    // et on verifiera/repartira de la
126
+                    if (time() >= _TIME_OUT) {
127
+                        return;
128
+                    }
129
+                }
130
+                if (time() >= _TIME_OUT) {
131
+                    return;
132
+                }
133
+            }
134
+            if ($insert !== []) {
135
+                maj_liens_insertq_multi_check($liens, $insert, $tables_auxiliaires[$liens]);
136
+            }
137
+            sql_delete($ancienne_table, sql_in($primary, $ids));
138
+        }
139
+    }
140 140
 }
141 141
 
142 142
 /**
@@ -150,86 +150,86 @@  discard block
 block discarded – undo
150 150
  * @return void
151 151
  **/
152 152
 function maj_liens_insertq_multi_check($table, $couples, $desc = []) {
153
-	$n_before = sql_countsel($table);
154
-	sql_insertq_multi($table, $couples, $desc);
155
-	$n_after = sql_countsel($table);
156
-	if (($n_after - $n_before) == count($couples)) {
157
-		return;
158
-	}
159
-	// si ecart, on recommence l'insertion ligne par ligne...
160
-	// moins rapide mais secure : seul le couple en doublon echouera, et non toute la serie
161
-	foreach ($couples as $c) {
162
-		sql_insertq($table, $c, $desc);
163
-	}
153
+    $n_before = sql_countsel($table);
154
+    sql_insertq_multi($table, $couples, $desc);
155
+    $n_after = sql_countsel($table);
156
+    if (($n_after - $n_before) == count($couples)) {
157
+        return;
158
+    }
159
+    // si ecart, on recommence l'insertion ligne par ligne...
160
+    // moins rapide mais secure : seul le couple en doublon echouera, et non toute la serie
161
+    foreach ($couples as $c) {
162
+        sql_insertq($table, $c, $desc);
163
+    }
164 164
 }
165 165
 
166 166
 $GLOBALS['maj'][17311] = [
167
-	[
168
-		'ecrire_meta',
169
-		'multi_objets',
170
-		implode(
171
-			',',
172
-			array_diff(
173
-				[
174
-					(isset($GLOBALS['meta']['multi_rubriques']) && $GLOBALS['meta']['multi_rubriques'] == 'oui')
175
-						? 'spip_rubriques' : '',
176
-					(isset($GLOBALS['meta']['multi_articles']) && $GLOBALS['meta']['multi_articles'] == 'oui')
177
-						? 'spip_articles' : ''
178
-				],
179
-				['']
180
-			)
181
-		)
182
-	],
183
-	[
184
-		'ecrire_meta',
185
-		'gerer_trad_objets',
186
-		implode(
187
-			',',
188
-			array_diff(
189
-				[
190
-					(isset($GLOBALS['meta']['gerer_trad']) && $GLOBALS['meta']['gerer_trad'] == 'oui')
191
-						? 'spip_articles' : ''
192
-				],
193
-				['']
194
-			)
195
-		)
196
-	],
167
+    [
168
+        'ecrire_meta',
169
+        'multi_objets',
170
+        implode(
171
+            ',',
172
+            array_diff(
173
+                [
174
+                    (isset($GLOBALS['meta']['multi_rubriques']) && $GLOBALS['meta']['multi_rubriques'] == 'oui')
175
+                        ? 'spip_rubriques' : '',
176
+                    (isset($GLOBALS['meta']['multi_articles']) && $GLOBALS['meta']['multi_articles'] == 'oui')
177
+                        ? 'spip_articles' : ''
178
+                ],
179
+                ['']
180
+            )
181
+        )
182
+    ],
183
+    [
184
+        'ecrire_meta',
185
+        'gerer_trad_objets',
186
+        implode(
187
+            ',',
188
+            array_diff(
189
+                [
190
+                    (isset($GLOBALS['meta']['gerer_trad']) && $GLOBALS['meta']['gerer_trad'] == 'oui')
191
+                        ? 'spip_articles' : ''
192
+                ],
193
+                ['']
194
+            )
195
+        )
196
+    ],
197 197
 ];
198 198
 $GLOBALS['maj'][17555] = [
199
-	['sql_alter', "TABLE spip_resultats ADD table_objet varchar(30) DEFAULT '' NOT NULL"],
200
-	['sql_alter', "TABLE spip_resultats ADD serveur char(16) DEFAULT '' NOT NULL"],
199
+    ['sql_alter', "TABLE spip_resultats ADD table_objet varchar(30) DEFAULT '' NOT NULL"],
200
+    ['sql_alter', "TABLE spip_resultats ADD serveur char(16) DEFAULT '' NOT NULL"],
201 201
 ];
202 202
 
203 203
 $GLOBALS['maj'][17563] = [
204
-	['sql_alter', "TABLE spip_articles ADD virtuel VARCHAR(255) DEFAULT '' NOT NULL"],
205
-	['sql_update', 'spip_articles', ['virtuel' => 'SUBSTRING(chapo,2)', 'chapo' => "''"], "chapo LIKE '=_%'"],
204
+    ['sql_alter', "TABLE spip_articles ADD virtuel VARCHAR(255) DEFAULT '' NOT NULL"],
205
+    ['sql_update', 'spip_articles', ['virtuel' => 'SUBSTRING(chapo,2)', 'chapo' => "''"], "chapo LIKE '=_%'"],
206 206
 ];
207 207
 
208 208
 $GLOBALS['maj'][17577] = [
209
-	['maj_tables', ['spip_jobs', 'spip_jobs_liens']],
209
+    ['maj_tables', ['spip_jobs', 'spip_jobs_liens']],
210 210
 ];
211 211
 
212 212
 $GLOBALS['maj'][17743] = [
213
-	['sql_update', 'spip_auteurs', ['prefs' => 'bio', 'bio' => "''"], "statut='nouveau' AND bio<>''"],
213
+    ['sql_update', 'spip_auteurs', ['prefs' => 'bio', 'bio' => "''"], "statut='nouveau' AND bio<>''"],
214 214
 ];
215 215
 
216 216
 $GLOBALS['maj'][18219] = [
217
-	['sql_alter', 'TABLE spip_rubriques DROP id_import'],
218
-	['sql_alter', 'TABLE spip_rubriques DROP export'],
217
+    ['sql_alter', 'TABLE spip_rubriques DROP id_import'],
218
+    ['sql_alter', 'TABLE spip_rubriques DROP export'],
219 219
 ];
220 220
 
221 221
 $GLOBALS['maj'][18310] = [
222
-	['sql_alter', "TABLE spip_auteurs_liens CHANGE vu vu VARCHAR(6) DEFAULT 'non' NOT NULL"],
222
+    ['sql_alter', "TABLE spip_auteurs_liens CHANGE vu vu VARCHAR(6) DEFAULT 'non' NOT NULL"],
223 223
 ];
224 224
 
225 225
 $GLOBALS['maj'][18597] = [
226
-	['sql_alter', "TABLE spip_rubriques ADD profondeur smallint(5) DEFAULT '0' NOT NULL"],
227
-	['maj_propager_les_secteurs'],
226
+    ['sql_alter', "TABLE spip_rubriques ADD profondeur smallint(5) DEFAULT '0' NOT NULL"],
227
+    ['maj_propager_les_secteurs'],
228 228
 ];
229 229
 
230 230
 $GLOBALS['maj'][18955] = [
231
-	['sql_alter', 'TABLE spip_auteurs_liens ADD INDEX id_objet (id_objet)'],
232
-	['sql_alter', 'TABLE spip_auteurs_liens ADD INDEX objet (objet)'],
231
+    ['sql_alter', 'TABLE spip_auteurs_liens ADD INDEX id_objet (id_objet)'],
232
+    ['sql_alter', 'TABLE spip_auteurs_liens ADD INDEX objet (objet)'],
233 233
 ];
234 234
 
235 235
 /**
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
  * @uses propager_les_secteurs()
239 239
  **/
240 240
 function maj_propager_les_secteurs() {
241
-	include_spip('inc/rubriques');
242
-	propager_les_secteurs();
241
+    include_spip('inc/rubriques');
242
+    propager_les_secteurs();
243 243
 }
244 244
 
245 245
 /**
@@ -252,87 +252,87 @@  discard block
 block discarded – undo
252 252
 function maj_collation_sqlite() {
253 253
 
254 254
 
255
-	include_spip('base/dump');
256
-	$tables = base_lister_toutes_tables();
257
-
258
-	// rien a faire si base non sqlite
259
-	if (!str_starts_with($GLOBALS['connexions'][0]['type'], 'sqlite')) {
260
-		return;
261
-	}
262
-
263
-	$trouver_table = charger_fonction('trouver_table', 'base');
264
-	// forcer le vidage de cache
265
-	$trouver_table('');
266
-
267
-	// cas particulier spip_auteurs : retablir le collate binary sur le login
268
-	$desc = $trouver_table('spip_auteurs');
269
-	spip_log('spip_auteurs : ' . var_export($desc['field'], true), 'maj.' . _LOG_INFO_IMPORTANTE);
270
-	if (stripos($desc['field']['login'], 'BINARY') === false) {
271
-		spip_log('Retablir champ login BINARY sur table spip_auteurs', 'maj');
272
-		sql_alter('table spip_auteurs change login login VARCHAR(255) BINARY');
273
-		$trouver_table('');
274
-		$new_desc = $trouver_table('spip_auteurs');
275
-		spip_log('Apres conversion spip_auteurs : ' . var_export($new_desc['field'], true), 'maj.' . _LOG_INFO_IMPORTANTE);
276
-	}
277
-
278
-	foreach ($tables as $table) {
279
-		if (time() >= _TIME_OUT) {
280
-			return;
281
-		}
282
-		if ($desc = $trouver_table($table)) {
283
-			$desc_collate = _sqlite_remplacements_definitions_table($desc['field']);
284
-			if ($d = array_diff($desc['field'], $desc_collate)) {
285
-				spip_log("Table $table COLLATE incorrects", 'maj');
286
-
287
-				// cas particulier spip_urls :
288
-				// supprimer les doublons avant conversion sinon echec (on garde les urls les plus recentes)
289
-				if ($table == 'spip_urls') {
290
-					// par date DESC pour conserver les urls les plus recentes
291
-					$data = sql_allfetsel('*', 'spip_urls', '', '', 'date DESC');
292
-					$urls = [];
293
-					foreach ($data as $d) {
294
-						$key = $d['id_parent'] . '::' . strtolower($d['url']);
295
-						if (!isset($urls[$key])) {
296
-							$urls[$key] = true;
297
-						} else {
298
-							spip_log(
299
-								'Suppression doublon dans spip_urls avant conversion : ' . serialize($d),
300
-								'maj.' . _LOG_INFO_IMPORTANTE
301
-							);
302
-							sql_delete('spip_urls', 'id_parent=' . sql_quote($d['id_parent']) . ' AND url=' . sql_quote($d['url']));
303
-						}
304
-					}
305
-				}
306
-				foreach ($desc['field'] as $field => $type) {
307
-					if ($desc['field'][$field] !== $desc_collate[$field]) {
308
-						spip_log("Conversion COLLATE table $table", 'maj.' . _LOG_INFO_IMPORTANTE);
309
-						sql_alter("table $table change $field $field " . $desc_collate[$field]);
310
-						$trouver_table('');
311
-						$new_desc = $trouver_table($table);
312
-						spip_log(
313
-							"Apres conversion $table : " . var_export($new_desc['field'], true),
314
-							'maj.' . _LOG_INFO_IMPORTANTE
315
-						);
316
-						continue 2; // inutile de continuer pour cette table : un seul alter remet tout a jour en sqlite
317
-					}
318
-				}
319
-			}
320
-		}
321
-	}
322
-
323
-	// forcer le vidage de cache
324
-	$trouver_table('');
255
+    include_spip('base/dump');
256
+    $tables = base_lister_toutes_tables();
257
+
258
+    // rien a faire si base non sqlite
259
+    if (!str_starts_with($GLOBALS['connexions'][0]['type'], 'sqlite')) {
260
+        return;
261
+    }
262
+
263
+    $trouver_table = charger_fonction('trouver_table', 'base');
264
+    // forcer le vidage de cache
265
+    $trouver_table('');
266
+
267
+    // cas particulier spip_auteurs : retablir le collate binary sur le login
268
+    $desc = $trouver_table('spip_auteurs');
269
+    spip_log('spip_auteurs : ' . var_export($desc['field'], true), 'maj.' . _LOG_INFO_IMPORTANTE);
270
+    if (stripos($desc['field']['login'], 'BINARY') === false) {
271
+        spip_log('Retablir champ login BINARY sur table spip_auteurs', 'maj');
272
+        sql_alter('table spip_auteurs change login login VARCHAR(255) BINARY');
273
+        $trouver_table('');
274
+        $new_desc = $trouver_table('spip_auteurs');
275
+        spip_log('Apres conversion spip_auteurs : ' . var_export($new_desc['field'], true), 'maj.' . _LOG_INFO_IMPORTANTE);
276
+    }
277
+
278
+    foreach ($tables as $table) {
279
+        if (time() >= _TIME_OUT) {
280
+            return;
281
+        }
282
+        if ($desc = $trouver_table($table)) {
283
+            $desc_collate = _sqlite_remplacements_definitions_table($desc['field']);
284
+            if ($d = array_diff($desc['field'], $desc_collate)) {
285
+                spip_log("Table $table COLLATE incorrects", 'maj');
286
+
287
+                // cas particulier spip_urls :
288
+                // supprimer les doublons avant conversion sinon echec (on garde les urls les plus recentes)
289
+                if ($table == 'spip_urls') {
290
+                    // par date DESC pour conserver les urls les plus recentes
291
+                    $data = sql_allfetsel('*', 'spip_urls', '', '', 'date DESC');
292
+                    $urls = [];
293
+                    foreach ($data as $d) {
294
+                        $key = $d['id_parent'] . '::' . strtolower($d['url']);
295
+                        if (!isset($urls[$key])) {
296
+                            $urls[$key] = true;
297
+                        } else {
298
+                            spip_log(
299
+                                'Suppression doublon dans spip_urls avant conversion : ' . serialize($d),
300
+                                'maj.' . _LOG_INFO_IMPORTANTE
301
+                            );
302
+                            sql_delete('spip_urls', 'id_parent=' . sql_quote($d['id_parent']) . ' AND url=' . sql_quote($d['url']));
303
+                        }
304
+                    }
305
+                }
306
+                foreach ($desc['field'] as $field => $type) {
307
+                    if ($desc['field'][$field] !== $desc_collate[$field]) {
308
+                        spip_log("Conversion COLLATE table $table", 'maj.' . _LOG_INFO_IMPORTANTE);
309
+                        sql_alter("table $table change $field $field " . $desc_collate[$field]);
310
+                        $trouver_table('');
311
+                        $new_desc = $trouver_table($table);
312
+                        spip_log(
313
+                            "Apres conversion $table : " . var_export($new_desc['field'], true),
314
+                            'maj.' . _LOG_INFO_IMPORTANTE
315
+                        );
316
+                        continue 2; // inutile de continuer pour cette table : un seul alter remet tout a jour en sqlite
317
+                    }
318
+                }
319
+            }
320
+        }
321
+    }
322
+
323
+    // forcer le vidage de cache
324
+    $trouver_table('');
325 325
 }
326 326
 
327 327
 
328 328
 $GLOBALS['maj'][19236] = [
329
-	['sql_updateq', 'spip_meta', ['impt' => 'oui'], "nom='version_installee'"], // version base principale
330
-	['sql_updateq', 'spip_meta', ['impt' => 'oui'], "nom LIKE '%_base_version'"],  // version base plugins
331
-	['maj_collation_sqlite'],
329
+    ['sql_updateq', 'spip_meta', ['impt' => 'oui'], "nom='version_installee'"], // version base principale
330
+    ['sql_updateq', 'spip_meta', ['impt' => 'oui'], "nom LIKE '%_base_version'"],  // version base plugins
331
+    ['maj_collation_sqlite'],
332 332
 ];
333 333
 
334 334
 $GLOBALS['maj'][19268] = [
335
-	['supprimer_toutes_sessions'],
335
+    ['supprimer_toutes_sessions'],
336 336
 ];
337 337
 
338 338
 /**
@@ -341,13 +341,13 @@  discard block
 block discarded – undo
341 341
  * Obligera tous les auteurs à se reconnecter !
342 342
  **/
343 343
 function supprimer_toutes_sessions() {
344
-	spip_log('supprimer sessions auteur');
345
-	if ($dir = opendir(_DIR_SESSIONS)) {
346
-		while (($f = readdir($dir)) !== false) {
347
-			spip_unlink(_DIR_SESSIONS . $f);
348
-			if (time() >= _TIME_OUT) {
349
-				return;
350
-			}
351
-		}
352
-	}
344
+    spip_log('supprimer sessions auteur');
345
+    if ($dir = opendir(_DIR_SESSIONS)) {
346
+        while (($f = readdir($dir)) !== false) {
347
+            spip_unlink(_DIR_SESSIONS . $f);
348
+            if (time() >= _TIME_OUT) {
349
+                return;
350
+            }
351
+        }
352
+    }
353 353
 }
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
 	$exceptions_pluriel = ['forum' => 'forum', 'syndic' => 'syndic'];
60 60
 
61 61
 	$pivot = preg_replace(',[^\w],', '', $pivot); // securite
62
-	$pivots = ($exceptions_pluriel[$pivot] ?? $pivot . 's');
63
-	$liens = 'spip_' . $pivots . '_liens';
64
-	$id_pivot = 'id_' . $pivot;
62
+	$pivots = ($exceptions_pluriel[$pivot] ?? $pivot.'s');
63
+	$liens = 'spip_'.$pivots.'_liens';
64
+	$id_pivot = 'id_'.$pivot;
65 65
 	// Creer spip_auteurs_liens
66 66
 	global $tables_auxiliaires;
67 67
 	if (!$l) {
@@ -73,8 +73,8 @@  discard block
 block discarded – undo
73 73
 		$l = preg_replace(',[^\w],', '', $l); // securite
74 74
 		$primary = "id_$l";
75 75
 		$objet = ($l == 'syndic' ? 'site' : $l);
76
-		$ls = ($exceptions_pluriel[$l] ?? $l . 's');
77
-		$ancienne_table = 'spip_' . $pivots . '_' . $ls;
76
+		$ls = ($exceptions_pluriel[$l] ?? $l.'s');
77
+		$ancienne_table = 'spip_'.$pivots.'_'.$ls;
78 78
 		$pool = 400;
79 79
 
80 80
 		$trouver_table = charger_fonction('trouver_table', 'base');
@@ -110,12 +110,12 @@  discard block
 block discarded – undo
110 110
 		while ($ids = array_map('reset', sql_allfetsel("$primary", $ancienne_table, '', '', '', "0,$sub_pool"))) {
111 111
 			$insert = [];
112 112
 			foreach ($ids as $id) {
113
-				$n = sql_countsel($liens, "objet='$objet' AND id_objet=" . (int) $id);
114
-				while ($t = sql_allfetsel($champs, $ancienne_table, "$primary=" . (int) $id, '', $id_pivot, "$n,$pool")) {
113
+				$n = sql_countsel($liens, "objet='$objet' AND id_objet=".(int) $id);
114
+				while ($t = sql_allfetsel($champs, $ancienne_table, "$primary=".(int) $id, '', $id_pivot, "$n,$pool")) {
115 115
 					$n += is_countable($t) ? count($t) : 0;
116 116
 					// empiler en s'assurant a minima de l'unicite
117 117
 					while ($r = array_shift($t)) {
118
-						$insert[$r[$id_pivot] . ':' . $r['id_objet']] = $r;
118
+						$insert[$r[$id_pivot].':'.$r['id_objet']] = $r;
119 119
 					}
120 120
 					if (count($insert) >= $sub_pool) {
121 121
 						maj_liens_insertq_multi_check($liens, $insert, $tables_auxiliaires[$liens]);
@@ -266,13 +266,13 @@  discard block
 block discarded – undo
266 266
 
267 267
 	// cas particulier spip_auteurs : retablir le collate binary sur le login
268 268
 	$desc = $trouver_table('spip_auteurs');
269
-	spip_log('spip_auteurs : ' . var_export($desc['field'], true), 'maj.' . _LOG_INFO_IMPORTANTE);
269
+	spip_log('spip_auteurs : '.var_export($desc['field'], true), 'maj.'._LOG_INFO_IMPORTANTE);
270 270
 	if (stripos($desc['field']['login'], 'BINARY') === false) {
271 271
 		spip_log('Retablir champ login BINARY sur table spip_auteurs', 'maj');
272 272
 		sql_alter('table spip_auteurs change login login VARCHAR(255) BINARY');
273 273
 		$trouver_table('');
274 274
 		$new_desc = $trouver_table('spip_auteurs');
275
-		spip_log('Apres conversion spip_auteurs : ' . var_export($new_desc['field'], true), 'maj.' . _LOG_INFO_IMPORTANTE);
275
+		spip_log('Apres conversion spip_auteurs : '.var_export($new_desc['field'], true), 'maj.'._LOG_INFO_IMPORTANTE);
276 276
 	}
277 277
 
278 278
 	foreach ($tables as $table) {
@@ -291,27 +291,27 @@  discard block
 block discarded – undo
291 291
 					$data = sql_allfetsel('*', 'spip_urls', '', '', 'date DESC');
292 292
 					$urls = [];
293 293
 					foreach ($data as $d) {
294
-						$key = $d['id_parent'] . '::' . strtolower($d['url']);
294
+						$key = $d['id_parent'].'::'.strtolower($d['url']);
295 295
 						if (!isset($urls[$key])) {
296 296
 							$urls[$key] = true;
297 297
 						} else {
298 298
 							spip_log(
299
-								'Suppression doublon dans spip_urls avant conversion : ' . serialize($d),
300
-								'maj.' . _LOG_INFO_IMPORTANTE
299
+								'Suppression doublon dans spip_urls avant conversion : '.serialize($d),
300
+								'maj.'._LOG_INFO_IMPORTANTE
301 301
 							);
302
-							sql_delete('spip_urls', 'id_parent=' . sql_quote($d['id_parent']) . ' AND url=' . sql_quote($d['url']));
302
+							sql_delete('spip_urls', 'id_parent='.sql_quote($d['id_parent']).' AND url='.sql_quote($d['url']));
303 303
 						}
304 304
 					}
305 305
 				}
306 306
 				foreach ($desc['field'] as $field => $type) {
307 307
 					if ($desc['field'][$field] !== $desc_collate[$field]) {
308
-						spip_log("Conversion COLLATE table $table", 'maj.' . _LOG_INFO_IMPORTANTE);
309
-						sql_alter("table $table change $field $field " . $desc_collate[$field]);
308
+						spip_log("Conversion COLLATE table $table", 'maj.'._LOG_INFO_IMPORTANTE);
309
+						sql_alter("table $table change $field $field ".$desc_collate[$field]);
310 310
 						$trouver_table('');
311 311
 						$new_desc = $trouver_table($table);
312 312
 						spip_log(
313
-							"Apres conversion $table : " . var_export($new_desc['field'], true),
314
-							'maj.' . _LOG_INFO_IMPORTANTE
313
+							"Apres conversion $table : ".var_export($new_desc['field'], true),
314
+							'maj.'._LOG_INFO_IMPORTANTE
315 315
 						);
316 316
 						continue 2; // inutile de continuer pour cette table : un seul alter remet tout a jour en sqlite
317 317
 					}
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 
328 328
 $GLOBALS['maj'][19236] = [
329 329
 	['sql_updateq', 'spip_meta', ['impt' => 'oui'], "nom='version_installee'"], // version base principale
330
-	['sql_updateq', 'spip_meta', ['impt' => 'oui'], "nom LIKE '%_base_version'"],  // version base plugins
330
+	['sql_updateq', 'spip_meta', ['impt' => 'oui'], "nom LIKE '%_base_version'"], // version base plugins
331 331
 	['maj_collation_sqlite'],
332 332
 ];
333 333
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 	spip_log('supprimer sessions auteur');
345 345
 	if ($dir = opendir(_DIR_SESSIONS)) {
346 346
 		while (($f = readdir($dir)) !== false) {
347
-			spip_unlink(_DIR_SESSIONS . $f);
347
+			spip_unlink(_DIR_SESSIONS.$f);
348 348
 			if (time() >= _TIME_OUT) {
349 349
 				return;
350 350
 			}
Please login to merge, or discard this patch.
ecrire/maj/legacy/v31.php 2 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -17,12 +17,12 @@  discard block
 block discarded – undo
17 17
  * @package SPIP\Core\SQL\Upgrade
18 18
  **/
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 
23 23
 
24 24
 $GLOBALS['maj'][21676] = [
25
-	['ranger_cache_gd2'],
25
+    ['ranger_cache_gd2'],
26 26
 ];
27 27
 
28 28
 /**
@@ -31,29 +31,29 @@  discard block
 block discarded – undo
31 31
  * https://core.spip.net/issues/3277
32 32
  */
33 33
 function ranger_cache_gd2() {
34
-	spip_log('ranger_cache_gd2');
35
-	$base = _DIR_VAR . 'cache-gd2/';
36
-	if (is_dir($base) && is_readable($base) && ($dir = opendir($base))) {
37
-		while (($f = readdir($dir)) !== false) {
38
-			if (
39
-				!is_dir($base . $f)
40
-				&& !str_starts_with($f, '.')
41
-				&& preg_match(',[0-9a-f]{32}\.\w+,', $f)
42
-			) {
43
-				$sub = substr($f, 0, 2);
44
-				$sub = sous_repertoire($base, $sub);
45
-				@rename($base . $f, $sub . substr($f, 2));
46
-				@unlink($base . $f); // au cas ou le rename a foire (collision)
47
-			}
48
-			if (time() >= _TIME_OUT) {
49
-				return;
50
-			}
51
-		}
52
-	}
34
+    spip_log('ranger_cache_gd2');
35
+    $base = _DIR_VAR . 'cache-gd2/';
36
+    if (is_dir($base) && is_readable($base) && ($dir = opendir($base))) {
37
+        while (($f = readdir($dir)) !== false) {
38
+            if (
39
+                !is_dir($base . $f)
40
+                && !str_starts_with($f, '.')
41
+                && preg_match(',[0-9a-f]{32}\.\w+,', $f)
42
+            ) {
43
+                $sub = substr($f, 0, 2);
44
+                $sub = sous_repertoire($base, $sub);
45
+                @rename($base . $f, $sub . substr($f, 2));
46
+                @unlink($base . $f); // au cas ou le rename a foire (collision)
47
+            }
48
+            if (time() >= _TIME_OUT) {
49
+                return;
50
+            }
51
+        }
52
+    }
53 53
 }
54 54
 
55 55
 
56 56
 $GLOBALS['maj'][21742] = [
57
-	['sql_alter', "TABLE spip_articles CHANGE url_site url_site text DEFAULT '' NOT NULL"],
58
-	['sql_alter', "TABLE spip_articles CHANGE virtuel virtuel text DEFAULT '' NOT NULL"],
57
+    ['sql_alter', "TABLE spip_articles CHANGE url_site url_site text DEFAULT '' NOT NULL"],
58
+    ['sql_alter', "TABLE spip_articles CHANGE virtuel virtuel text DEFAULT '' NOT NULL"],
59 59
 ];
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,18 +32,18 @@
 block discarded – undo
32 32
  */
33 33
 function ranger_cache_gd2() {
34 34
 	spip_log('ranger_cache_gd2');
35
-	$base = _DIR_VAR . 'cache-gd2/';
35
+	$base = _DIR_VAR.'cache-gd2/';
36 36
 	if (is_dir($base) && is_readable($base) && ($dir = opendir($base))) {
37 37
 		while (($f = readdir($dir)) !== false) {
38 38
 			if (
39
-				!is_dir($base . $f)
39
+				!is_dir($base.$f)
40 40
 				&& !str_starts_with($f, '.')
41 41
 				&& preg_match(',[0-9a-f]{32}\.\w+,', $f)
42 42
 			) {
43 43
 				$sub = substr($f, 0, 2);
44 44
 				$sub = sous_repertoire($base, $sub);
45
-				@rename($base . $f, $sub . substr($f, 2));
46
-				@unlink($base . $f); // au cas ou le rename a foire (collision)
45
+				@rename($base.$f, $sub.substr($f, 2));
46
+				@unlink($base.$f); // au cas ou le rename a foire (collision)
47 47
 			}
48 48
 			if (time() >= _TIME_OUT) {
49 49
 				return;
Please login to merge, or discard this patch.