Completed
Push — master ( aa8f4f...e4c4a7 )
by cam
05:04
created
ecrire/inc/acces.php 1 patch
Indentation   +235 added lines, -235 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  **/
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 
23 23
 /**
@@ -31,47 +31,47 @@  discard block
 block discarded – undo
31 31
  *     Mot de passe
32 32
  **/
33 33
 function creer_pass_aleatoire($longueur = 16, $sel = '') {
34
-	$seed = (int)round(((float)microtime() + 1) * time());
35
-
36
-	mt_srand($seed);
37
-	srand($seed);
38
-	$s = '';
39
-	$pass = '';
40
-	for ($i = 0; $i < $longueur; $i++) {
41
-		if (!$s) {
42
-			$s = mt_rand();
43
-			if (!$s) {
44
-				$s = rand();
45
-			}
46
-			$s = substr(md5(uniqid($s) . $sel), 0, 16);
47
-		}
48
-		$r = unpack('Cr', pack('H2', $s . $s));
49
-		$x = $r['r'] & 63;
50
-		if ($x < 10) {
51
-			$x = chr($x + 48);
52
-		} else {
53
-			if ($x < 36) {
54
-				$x = chr($x + 55);
55
-			} else {
56
-				if ($x < 62) {
57
-					$x = chr($x + 61);
58
-				} else {
59
-					if ($x == 63) {
60
-						$x = '/';
61
-					} else {
62
-						$x = '.';
63
-					}
64
-				}
65
-			}
66
-		}
67
-		$pass .= $x;
68
-		$s = substr($s, 2);
69
-	}
70
-	$pass = preg_replace('@[./]@', 'a', $pass);
71
-	$pass = preg_replace('@[I1l]@', 'L', $pass);
72
-	$pass = preg_replace('@[0O]@', 'o', $pass);
73
-
74
-	return $pass;
34
+    $seed = (int)round(((float)microtime() + 1) * time());
35
+
36
+    mt_srand($seed);
37
+    srand($seed);
38
+    $s = '';
39
+    $pass = '';
40
+    for ($i = 0; $i < $longueur; $i++) {
41
+        if (!$s) {
42
+            $s = mt_rand();
43
+            if (!$s) {
44
+                $s = rand();
45
+            }
46
+            $s = substr(md5(uniqid($s) . $sel), 0, 16);
47
+        }
48
+        $r = unpack('Cr', pack('H2', $s . $s));
49
+        $x = $r['r'] & 63;
50
+        if ($x < 10) {
51
+            $x = chr($x + 48);
52
+        } else {
53
+            if ($x < 36) {
54
+                $x = chr($x + 55);
55
+            } else {
56
+                if ($x < 62) {
57
+                    $x = chr($x + 61);
58
+                } else {
59
+                    if ($x == 63) {
60
+                        $x = '/';
61
+                    } else {
62
+                        $x = '.';
63
+                    }
64
+                }
65
+            }
66
+        }
67
+        $pass .= $x;
68
+        $s = substr($s, 2);
69
+    }
70
+    $pass = preg_replace('@[./]@', 'a', $pass);
71
+    $pass = preg_replace('@[I1l]@', 'L', $pass);
72
+    $pass = preg_replace('@[0O]@', 'o', $pass);
73
+
74
+    return $pass;
75 75
 }
76 76
 
77 77
 /**
@@ -80,21 +80,21 @@  discard block
 block discarded – undo
80 80
  * @return string Identifiant
81 81
  */
82 82
 function creer_uniqid() {
83
-	static $seeded;
83
+    static $seeded;
84 84
 
85
-	if (!$seeded) {
86
-		$seed = (int)round(((float)microtime() + 1) * time());
87
-		mt_srand($seed);
88
-		srand($seed);
89
-		$seeded = true;
90
-	}
85
+    if (!$seeded) {
86
+        $seed = (int)round(((float)microtime() + 1) * time());
87
+        mt_srand($seed);
88
+        srand($seed);
89
+        $seeded = true;
90
+    }
91 91
 
92
-	$s = mt_rand();
93
-	if (!$s) {
94
-		$s = rand();
95
-	}
92
+    $s = mt_rand();
93
+    if (!$s) {
94
+        $s = rand();
95
+    }
96 96
 
97
-	return uniqid($s, 1);
97
+    return uniqid($s, 1);
98 98
 }
99 99
 
100 100
 /**
@@ -108,38 +108,38 @@  discard block
 block discarded – undo
108 108
  * @return string Retourne l'alea éphemère actuel au passage
109 109
  */
110 110
 function charger_aleas() {
111
-	if (!isset($GLOBALS['meta']['alea_ephemere'])) {
112
-		include_spip('base/abstract_sql');
113
-		$aleas = sql_allfetsel(
114
-			array('nom', 'valeur'),
115
-			'spip_meta',
116
-			sql_in("nom", array('alea_ephemere', 'alea_ephemere_ancien')),
117
-			'', '', '', '', '',
118
-			'continue'
119
-		);
120
-		if ($aleas) {
121
-			foreach ($aleas as $a) {
122
-				$GLOBALS['meta'][$a['nom']] = $a['valeur'];
123
-			}
124
-			return $GLOBALS['meta']['alea_ephemere'];
125
-		} else {
126
-			spip_log("aleas indisponibles", "session");
127
-			return "";
128
-		}
129
-	}
130
-	return $GLOBALS['meta']['alea_ephemere'];
111
+    if (!isset($GLOBALS['meta']['alea_ephemere'])) {
112
+        include_spip('base/abstract_sql');
113
+        $aleas = sql_allfetsel(
114
+            array('nom', 'valeur'),
115
+            'spip_meta',
116
+            sql_in("nom", array('alea_ephemere', 'alea_ephemere_ancien')),
117
+            '', '', '', '', '',
118
+            'continue'
119
+        );
120
+        if ($aleas) {
121
+            foreach ($aleas as $a) {
122
+                $GLOBALS['meta'][$a['nom']] = $a['valeur'];
123
+            }
124
+            return $GLOBALS['meta']['alea_ephemere'];
125
+        } else {
126
+            spip_log("aleas indisponibles", "session");
127
+            return "";
128
+        }
129
+    }
130
+    return $GLOBALS['meta']['alea_ephemere'];
131 131
 }
132 132
 
133 133
 /**
134 134
  * Renouveller l'alea (utilisé pour sécuriser les scripts du répertoire `action/`)
135 135
  **/
136 136
 function renouvelle_alea() {
137
-	charger_aleas();
138
-	ecrire_meta('alea_ephemere_ancien', @$GLOBALS['meta']['alea_ephemere'], 'non');
139
-	$GLOBALS['meta']['alea_ephemere'] = md5(creer_uniqid());
140
-	ecrire_meta('alea_ephemere', $GLOBALS['meta']['alea_ephemere'], 'non');
141
-	ecrire_meta('alea_ephemere_date', time(), 'non');
142
-	spip_log("renouvellement de l'alea_ephemere");
137
+    charger_aleas();
138
+    ecrire_meta('alea_ephemere_ancien', @$GLOBALS['meta']['alea_ephemere'], 'non');
139
+    $GLOBALS['meta']['alea_ephemere'] = md5(creer_uniqid());
140
+    ecrire_meta('alea_ephemere', $GLOBALS['meta']['alea_ephemere'], 'non');
141
+    ecrire_meta('alea_ephemere_date', time(), 'non');
142
+    spip_log("renouvellement de l'alea_ephemere");
143 143
 }
144 144
 
145 145
 
@@ -159,21 +159,21 @@  discard block
 block discarded – undo
159 159
  *     Clé de sécurité.
160 160
  **/
161 161
 function low_sec($id_auteur) {
162
-	// Pas d'id_auteur : low_sec
163
-	if (!$id_auteur = intval($id_auteur)) {
164
-		include_spip('inc/config');
165
-		if (!$low_sec = lire_config('low_sec')) {
166
-			ecrire_meta('low_sec', $low_sec = creer_pass_aleatoire());
167
-		}
168
-	} else {
169
-		$low_sec = sql_getfetsel('low_sec', 'spip_auteurs', 'id_auteur = '.intval($id_auteur));
170
-		if (!$low_sec) {
171
-			$low_sec = creer_pass_aleatoire();
172
-			sql_updateq('spip_auteurs', array('low_sec' => $low_sec), 'id_auteur = '.intval($id_auteur));
173
-		}
174
-	}
175
-
176
-	return $low_sec;
162
+    // Pas d'id_auteur : low_sec
163
+    if (!$id_auteur = intval($id_auteur)) {
164
+        include_spip('inc/config');
165
+        if (!$low_sec = lire_config('low_sec')) {
166
+            ecrire_meta('low_sec', $low_sec = creer_pass_aleatoire());
167
+        }
168
+    } else {
169
+        $low_sec = sql_getfetsel('low_sec', 'spip_auteurs', 'id_auteur = '.intval($id_auteur));
170
+        if (!$low_sec) {
171
+            $low_sec = creer_pass_aleatoire();
172
+            sql_updateq('spip_auteurs', array('low_sec' => $low_sec), 'id_auteur = '.intval($id_auteur));
173
+        }
174
+    }
175
+
176
+    return $low_sec;
177 177
 }
178 178
 
179 179
 /**
@@ -189,27 +189,27 @@  discard block
 block discarded – undo
189 189
  * @return string
190 190
  */
191 191
 function param_low_sec($op, $args = array(), $lang = '', $mime = 'rss') {
192
-	$a = $b = '';
193
-	foreach ($args as $val => $var) {
194
-		if ($var) {
195
-			if ($val <> 'statut') {
196
-				$a .= ':' . $val . '-' . $var;
197
-			}
198
-			$b .= $val . '=' . $var . '&';
199
-		}
200
-	}
201
-	$a = substr($a, 1);
202
-	$id = intval(@$GLOBALS['connect_id_auteur']);
203
-
204
-	return $b
205
-	. 'op='
206
-	. $op
207
-	. '&id='
208
-	. $id
209
-	. '&cle='
210
-	. afficher_low_sec($id, "$mime $op $a")
211
-	. (!$a ? '' : "&args=$a")
212
-	. (!$lang ? '' : "&lang=$lang");
192
+    $a = $b = '';
193
+    foreach ($args as $val => $var) {
194
+        if ($var) {
195
+            if ($val <> 'statut') {
196
+                $a .= ':' . $val . '-' . $var;
197
+            }
198
+            $b .= $val . '=' . $var . '&';
199
+        }
200
+    }
201
+    $a = substr($a, 1);
202
+    $id = intval(@$GLOBALS['connect_id_auteur']);
203
+
204
+    return $b
205
+    . 'op='
206
+    . $op
207
+    . '&id='
208
+    . $id
209
+    . '&cle='
210
+    . afficher_low_sec($id, "$mime $op $a")
211
+    . (!$a ? '' : "&args=$a")
212
+    . (!$lang ? '' : "&lang=$lang");
213 213
 }
214 214
 
215 215
 /**
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
  *     Clé
226 226
  **/
227 227
 function afficher_low_sec($id_auteur, $action = '') {
228
-	return substr(md5($action . low_sec($id_auteur)), 0, 8);
228
+    return substr(md5($action . low_sec($id_auteur)), 0, 8);
229 229
 }
230 230
 
231 231
 /**
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
  *     true si les clés corresponde, false sinon
244 244
  **/
245 245
 function verifier_low_sec($id_auteur, $cle, $action = '') {
246
-	return ($cle == afficher_low_sec($id_auteur, $action));
246
+    return ($cle == afficher_low_sec($id_auteur, $action));
247 247
 }
248 248
 
249 249
 /**
@@ -253,10 +253,10 @@  discard block
 block discarded – undo
253 253
  *     Identifiant de l'auteur
254 254
  **/
255 255
 function effacer_low_sec($id_auteur) {
256
-	if (!$id_auteur = intval($id_auteur)) {
257
-		return;
258
-	} // jamais trop prudent ;)
259
-	sql_updateq('spip_auteurs', array('low_sec' => ''), 'id_auteur = '.intval($id_auteur));
256
+    if (!$id_auteur = intval($id_auteur)) {
257
+        return;
258
+    } // jamais trop prudent ;)
259
+    sql_updateq('spip_auteurs', array('low_sec' => ''), 'id_auteur = '.intval($id_auteur));
260 260
 }
261 261
 
262 262
 /**
@@ -265,14 +265,14 @@  discard block
 block discarded – undo
265 265
  * @return void|bool
266 266
  */
267 267
 function initialiser_sel() {
268
-	if (!isset($GLOBALS['htsalt'])) {
269
-		if (CRYPT_MD5) {
270
-			$GLOBALS['htsalt'] = '$1$' . creer_pass_aleatoire();
271
-		} else {
272
-			$GLOBALS['htsalt'] = '';
273
-		}
274
-	}
275
-	return $GLOBALS['htsalt'];
268
+    if (!isset($GLOBALS['htsalt'])) {
269
+        if (CRYPT_MD5) {
270
+            $GLOBALS['htsalt'] = '$1$' . creer_pass_aleatoire();
271
+        } else {
272
+            $GLOBALS['htsalt'] = '';
273
+        }
274
+    }
275
+    return $GLOBALS['htsalt'];
276 276
 }
277 277
 
278 278
 /**
@@ -289,31 +289,31 @@  discard block
 block discarded – undo
289 289
  *     - void sinon.
290 290
  **/
291 291
 function ecrire_acces() {
292
-	$htaccess = _DIR_RESTREINT . _ACCESS_FILE_NAME;
293
-	$htpasswd = _DIR_TMP . _AUTH_USER_FILE;
294
-
295
-	// Cette variable de configuration peut etre posee par un plugin
296
-	// par exemple acces_restreint ;
297
-	// si .htaccess existe, outrepasser spip_meta
298
-	if ((!isset($GLOBALS['meta']['creer_htpasswd'])
299
-			or ($GLOBALS['meta']['creer_htpasswd'] != 'oui'))
300
-		and !@file_exists($htaccess)
301
-	) {
302
-		spip_unlink($htpasswd);
303
-		spip_unlink($htpasswd . '-admin');
304
-		return;
305
-	}
306
-
307
-	# remarque : ici on laisse passer les "nouveau" de maniere a leur permettre
308
-	# de devenir redacteur le cas echeant (auth http)... a nettoyer
309
-	// attention, il faut au prealable se connecter a la base (necessaire car utilise par install)
310
-	// TODO: factoriser avec auth/spip qui fait deja ce job et generaliser le test spip_connect_ldap()
311
-
312
-	if (spip_connect_ldap()) {
313
-		return;
314
-	}
315
-
316
-	generer_htpasswd_files($htpasswd, "$htpasswd-admin");
292
+    $htaccess = _DIR_RESTREINT . _ACCESS_FILE_NAME;
293
+    $htpasswd = _DIR_TMP . _AUTH_USER_FILE;
294
+
295
+    // Cette variable de configuration peut etre posee par un plugin
296
+    // par exemple acces_restreint ;
297
+    // si .htaccess existe, outrepasser spip_meta
298
+    if ((!isset($GLOBALS['meta']['creer_htpasswd'])
299
+            or ($GLOBALS['meta']['creer_htpasswd'] != 'oui'))
300
+        and !@file_exists($htaccess)
301
+    ) {
302
+        spip_unlink($htpasswd);
303
+        spip_unlink($htpasswd . '-admin');
304
+        return;
305
+    }
306
+
307
+    # remarque : ici on laisse passer les "nouveau" de maniere a leur permettre
308
+    # de devenir redacteur le cas echeant (auth http)... a nettoyer
309
+    // attention, il faut au prealable se connecter a la base (necessaire car utilise par install)
310
+    // TODO: factoriser avec auth/spip qui fait deja ce job et generaliser le test spip_connect_ldap()
311
+
312
+    if (spip_connect_ldap()) {
313
+        return;
314
+    }
315
+
316
+    generer_htpasswd_files($htpasswd, "$htpasswd-admin");
317 317
 }
318 318
 
319 319
 /**
@@ -322,29 +322,29 @@  discard block
 block discarded – undo
322 322
  * @param $htpasswd_admin
323 323
  */
324 324
 function generer_htpasswd_files($htpasswd, $htpasswd_admin) {
325
-	if ($generer_htpasswd = charger_fonction('generer_htpasswd_files', 'inc', true)) {
326
-		$generer_htpasswd($htpasswd, $htpasswd_admin);
327
-	}
328
-
329
-	$pwd_all = ''; // login:htpass pour tous
330
-	$pwd_admin = ''; // login:htpass pour les admins
331
-
332
-	$res = sql_select('login, htpass, statut', 'spip_auteurs', "htpass!='' AND login!='' AND ".sql_in('statut', ['1comite', '0minirezo', 'nouveau']));
333
-	while ($row = sql_fetch($res)) {
334
-		if (strlen($row['login']) and strlen($row['htpass'])) {
335
-			$ligne = $row['login'] . ':' . $row['htpass'] . "\n";
336
-			$pwd_all .= $ligne;
337
-			if ($row['statut'] == '0minirezo') {
338
-				$pwd_admin .= $ligne;
339
-			}
340
-		}
341
-	}
342
-
343
-	if ($pwd_all) {
344
-		ecrire_fichier($htpasswd, $pwd_all);
345
-		ecrire_fichier($htpasswd_admin, $pwd_admin);
346
-		spip_log("Ecriture de $htpasswd et $htpasswd_admin", 'htpass');
347
-	}
325
+    if ($generer_htpasswd = charger_fonction('generer_htpasswd_files', 'inc', true)) {
326
+        $generer_htpasswd($htpasswd, $htpasswd_admin);
327
+    }
328
+
329
+    $pwd_all = ''; // login:htpass pour tous
330
+    $pwd_admin = ''; // login:htpass pour les admins
331
+
332
+    $res = sql_select('login, htpass, statut', 'spip_auteurs', "htpass!='' AND login!='' AND ".sql_in('statut', ['1comite', '0minirezo', 'nouveau']));
333
+    while ($row = sql_fetch($res)) {
334
+        if (strlen($row['login']) and strlen($row['htpass'])) {
335
+            $ligne = $row['login'] . ':' . $row['htpass'] . "\n";
336
+            $pwd_all .= $ligne;
337
+            if ($row['statut'] == '0minirezo') {
338
+                $pwd_admin .= $ligne;
339
+            }
340
+        }
341
+    }
342
+
343
+    if ($pwd_all) {
344
+        ecrire_fichier($htpasswd, $pwd_all);
345
+        ecrire_fichier($htpasswd_admin, $pwd_admin);
346
+        spip_log("Ecriture de $htpasswd et $htpasswd_admin", 'htpass');
347
+    }
348 348
 }
349 349
 
350 350
 /**
@@ -358,13 +358,13 @@  discard block
 block discarded – undo
358 358
  *  La chaîne hachée si fonction crypt présente, rien sinon.
359 359
  */
360 360
 function generer_htpass($pass) {
361
-	if ($generer_htpass = charger_fonction('generer_htpass', 'inc', true)) {
362
-		return $generer_htpass($pass);
363
-	}
364
-	elseif (function_exists('crypt')) {
365
-		return crypt($pass, initialiser_sel());
366
-	}
367
-	return '';
361
+    if ($generer_htpass = charger_fonction('generer_htpass', 'inc', true)) {
362
+        return $generer_htpass($pass);
363
+    }
364
+    elseif (function_exists('crypt')) {
365
+        return crypt($pass, initialiser_sel());
366
+    }
367
+    return '';
368 368
 }
369 369
 
370 370
 /**
@@ -377,14 +377,14 @@  discard block
 block discarded – undo
377 377
  * @return boolean
378 378
  */
379 379
 function verifier_htaccess($rep, $force = false) {
380
-	$htaccess = rtrim($rep, '/') . '/' . _ACCESS_FILE_NAME;
381
-	if (((@file_exists($htaccess)) or defined('_TEST_DIRS')) and !$force) {
382
-		return true;
383
-	}
384
-
385
-	// directive deny compatible Apache 2.0+
386
-	$deny =
387
-		'# Deny all requests from Apache 2.4+.
380
+    $htaccess = rtrim($rep, '/') . '/' . _ACCESS_FILE_NAME;
381
+    if (((@file_exists($htaccess)) or defined('_TEST_DIRS')) and !$force) {
382
+        return true;
383
+    }
384
+
385
+    // directive deny compatible Apache 2.0+
386
+    $deny =
387
+        '# Deny all requests from Apache 2.4+.
388 388
 <IfModule mod_authz_core.c>
389 389
   Require all denied
390 390
 </IfModule>
@@ -393,32 +393,32 @@  discard block
 block discarded – undo
393 393
   Deny from all
394 394
 </IfModule>
395 395
 ';
396
-	// support des vieilles versions Apache 1.x mais uniquement si elles l'annoncent (pas en mode PROD)
397
-	if (function_exists('apache_get_version')
398
-		and $v = apache_get_version()
399
-		and strncmp($v, 'Apache/1.', 9) == 0) {
400
-		$deny = "deny from all\n";
401
-	}
402
-
403
-	if ($ht = @fopen($htaccess, 'w')) {
404
-		fputs($ht, $deny);
405
-		fclose($ht);
406
-		@chmod($htaccess, _SPIP_CHMOD & 0666);
407
-		$t = rtrim($rep, '/') . '/.ok';
408
-		if ($ht = @fopen($t, 'w')) {
409
-			@fclose($ht);
410
-			include_spip('inc/distant');
411
-			$t = substr($t, strlen(_DIR_RACINE));
412
-			$t = url_de_base() . $t;
413
-			$ht = recuperer_url($t, ['methode' => 'HEAD', 'taille_max' => 0, 'follow_location' => false]);
414
-			// htaccess inoperant si on a recupere des entetes HTTP
415
-			// (ignorer la reussite si connexion par fopen)
416
-			$ht = !(isset($ht['headers']) and $ht['headers']);
417
-		}
418
-	}
419
-	spip_log("Creation de $htaccess " . ($ht ? ' reussie' : ' manquee'));
420
-
421
-	return $ht;
396
+    // support des vieilles versions Apache 1.x mais uniquement si elles l'annoncent (pas en mode PROD)
397
+    if (function_exists('apache_get_version')
398
+        and $v = apache_get_version()
399
+        and strncmp($v, 'Apache/1.', 9) == 0) {
400
+        $deny = "deny from all\n";
401
+    }
402
+
403
+    if ($ht = @fopen($htaccess, 'w')) {
404
+        fputs($ht, $deny);
405
+        fclose($ht);
406
+        @chmod($htaccess, _SPIP_CHMOD & 0666);
407
+        $t = rtrim($rep, '/') . '/.ok';
408
+        if ($ht = @fopen($t, 'w')) {
409
+            @fclose($ht);
410
+            include_spip('inc/distant');
411
+            $t = substr($t, strlen(_DIR_RACINE));
412
+            $t = url_de_base() . $t;
413
+            $ht = recuperer_url($t, ['methode' => 'HEAD', 'taille_max' => 0, 'follow_location' => false]);
414
+            // htaccess inoperant si on a recupere des entetes HTTP
415
+            // (ignorer la reussite si connexion par fopen)
416
+            $ht = !(isset($ht['headers']) and $ht['headers']);
417
+        }
418
+    }
419
+    spip_log("Creation de $htaccess " . ($ht ? ' reussie' : ' manquee'));
420
+
421
+    return $ht;
422 422
 }
423 423
 
424 424
 /**
@@ -436,21 +436,21 @@  discard block
 block discarded – undo
436 436
  *         Valeur de la configuration `creer_htaccess`
437 437
  */
438 438
 function gerer_htaccess() {
439
-	// Cette variable de configuration peut etre posee par un plugin
440
-	// par exemple acces_restreint
441
-	$f = (isset($GLOBALS['meta']['creer_htaccess']) and ($GLOBALS['meta']['creer_htaccess'] === 'oui'));
442
-	$dirs = sql_allfetsel('extension', 'spip_types_documents');
443
-	$dirs[] = array('extension' => 'distant');
444
-	foreach ($dirs as $e) {
445
-		if (is_dir($dir = _DIR_IMG . $e['extension'])) {
446
-			if ($f) {
447
-				verifier_htaccess($dir);
448
-			} else {
449
-				spip_unlink($dir . '/' . _ACCESS_FILE_NAME);
450
-			}
451
-		}
452
-	}
453
-
454
-	return isset($GLOBALS['meta']['creer_htaccess']) ? $GLOBALS['meta']['creer_htaccess'] : '';
439
+    // Cette variable de configuration peut etre posee par un plugin
440
+    // par exemple acces_restreint
441
+    $f = (isset($GLOBALS['meta']['creer_htaccess']) and ($GLOBALS['meta']['creer_htaccess'] === 'oui'));
442
+    $dirs = sql_allfetsel('extension', 'spip_types_documents');
443
+    $dirs[] = array('extension' => 'distant');
444
+    foreach ($dirs as $e) {
445
+        if (is_dir($dir = _DIR_IMG . $e['extension'])) {
446
+            if ($f) {
447
+                verifier_htaccess($dir);
448
+            } else {
449
+                spip_unlink($dir . '/' . _ACCESS_FILE_NAME);
450
+            }
451
+        }
452
+    }
453
+
454
+    return isset($GLOBALS['meta']['creer_htaccess']) ? $GLOBALS['meta']['creer_htaccess'] : '';
455 455
 }
456 456
 
Please login to merge, or discard this patch.