Completed
Push — master ( 7bbe03...8295ac )
by cam
01:11
created
ecrire/action/editer_objet.php 1 patch
Indentation   +513 added lines, -513 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
 /**
@@ -33,36 +33,36 @@  discard block
 block discarded – undo
33 33
  */
34 34
 function action_editer_objet_dist($id = null, $objet = null, $set = null) {
35 35
 
36
-	// appel direct depuis une url avec arg = "objet/id"
37
-	if (is_null($id) or is_null($objet)) {
38
-		$securiser_action = charger_fonction('securiser_action', 'inc');
39
-		$arg = $securiser_action();
40
-		[$objet, $id] = array_pad(explode('/', $arg, 2), 2, null);
41
-	}
42
-
43
-	// appel incorrect ou depuis une url erronnée interdit
44
-	if (is_null($id) or is_null($objet)) {
45
-		include_spip('inc/minipres');
46
-		echo minipres(_T('info_acces_interdit'));
47
-		die();
48
-	}
49
-
50
-	// si id n'est pas un nombre, c'est une creation
51
-	// mais on verifie qu'on a toutes les donnees qu'il faut.
52
-	if (!$id = intval($id)) {
53
-		// on ne sait pas si un parent existe mais on essaye
54
-		$id_parent = _request('id_parent');
55
-		$id = objet_inserer($objet, $id_parent);
56
-	}
57
-
58
-	if (!($id = intval($id)) > 0) {
59
-		return [$id, _L('echec enregistrement en base')];
60
-	}
61
-
62
-	// Enregistre l'envoi dans la BD
63
-	$err = objet_modifier($objet, $id, $set);
64
-
65
-	return [$id, $err];
36
+    // appel direct depuis une url avec arg = "objet/id"
37
+    if (is_null($id) or is_null($objet)) {
38
+        $securiser_action = charger_fonction('securiser_action', 'inc');
39
+        $arg = $securiser_action();
40
+        [$objet, $id] = array_pad(explode('/', $arg, 2), 2, null);
41
+    }
42
+
43
+    // appel incorrect ou depuis une url erronnée interdit
44
+    if (is_null($id) or is_null($objet)) {
45
+        include_spip('inc/minipres');
46
+        echo minipres(_T('info_acces_interdit'));
47
+        die();
48
+    }
49
+
50
+    // si id n'est pas un nombre, c'est une creation
51
+    // mais on verifie qu'on a toutes les donnees qu'il faut.
52
+    if (!$id = intval($id)) {
53
+        // on ne sait pas si un parent existe mais on essaye
54
+        $id_parent = _request('id_parent');
55
+        $id = objet_inserer($objet, $id_parent);
56
+    }
57
+
58
+    if (!($id = intval($id)) > 0) {
59
+        return [$id, _L('echec enregistrement en base')];
60
+    }
61
+
62
+    // Enregistre l'envoi dans la BD
63
+    $err = objet_modifier($objet, $id, $set);
64
+
65
+    return [$id, $err];
66 66
 }
67 67
 
68 68
 /**
@@ -75,85 +75,85 @@  discard block
 block discarded – undo
75 75
  * @return mixed|string
76 76
  */
77 77
 function objet_modifier($objet, $id, $set = null) {
78
-	if (($t = objet_type($objet)) !== $objet) {
79
-		spip_log("objet_modifier: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE);
80
-		$objet = $t;
81
-	}
82
-	if (
83
-		include_spip('action/editer_' . $objet)
84
-		and function_exists($modifier = $objet . '_modifier')
85
-	) {
86
-		return $modifier($id, $set);
87
-	}
88
-
89
-	$table_sql = table_objet_sql($objet);
90
-	$trouver_table = charger_fonction('trouver_table', 'base');
91
-	$desc = $trouver_table($table_sql);
92
-	if (!$desc or !isset($desc['field'])) {
93
-		spip_log("Objet $objet inconnu dans objet_modifier", 'editer' . _LOG_ERREUR);
94
-
95
-		return _L("Erreur objet $objet inconnu");
96
-	}
97
-	include_spip('inc/modifier');
98
-
99
-	$champ_date = '';
100
-	if (isset($desc['date']) and $desc['date']) {
101
-		$champ_date = $desc['date'];
102
-	} elseif (isset($desc['field']['date'])) {
103
-		$champ_date = 'date';
104
-	}
105
-
106
-	$include_list = array_keys($desc['field']);
107
-	// on ne traite pas la cle primaire par defaut, notamment car
108
-	// sur une creation, id_x vaut 'oui', et serait enregistre en id_x=0 dans la base
109
-	$include_list = array_diff($include_list, [$desc['key']['PRIMARY KEY']]);
110
-
111
-	if (isset($desc['champs_editables']) and is_array($desc['champs_editables'])) {
112
-		$include_list = $desc['champs_editables'];
113
-	}
114
-	$c = collecter_requests(
115
-		// include list
116
-		$include_list,
117
-		// exclude list
118
-		[$champ_date, 'statut', 'id_parent', 'id_secteur'],
119
-		// donnees eventuellement fournies
120
-		$set
121
-	);
122
-
123
-	// Si l'objet est publie, invalider les caches et demander sa reindexation
124
-	if (objet_test_si_publie($objet, $id)) {
125
-		$invalideur = "id='$objet/$id'";
126
-		$indexation = true;
127
-	} else {
128
-		$invalideur = '';
129
-		$indexation = false;
130
-	}
131
-
132
-	if (
133
-		$err = objet_modifier_champs(
134
-			$objet,
135
-			$id,
136
-			[
137
-			'data' => $set,
138
-			'nonvide' => '',
139
-			'invalideur' => $invalideur,
140
-			'indexation' => $indexation,
141
-			// champ a mettre a date('Y-m-d H:i:s') s'il y a modif
142
-			'date_modif' => (isset($desc['field']['date_modif']) ? 'date_modif' : '')
143
-			],
144
-			$c
145
-		)
146
-	) {
147
-		return $err;
148
-	}
149
-
150
-	// Modification de statut, changement de rubrique ?
151
-	// FIXME: Ici lorsqu'un $set est passé, la fonction collecter_requests() retourne tout
152
-	//         le tableau $set hors liste d’exclusion, mais du coup on a possiblement des champs en trop.
153
-	$c = collecter_requests([$champ_date, 'statut', 'id_parent'], [], $set);
154
-	$err = objet_instituer($objet, $id, $c);
155
-
156
-	return $err;
78
+    if (($t = objet_type($objet)) !== $objet) {
79
+        spip_log("objet_modifier: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE);
80
+        $objet = $t;
81
+    }
82
+    if (
83
+        include_spip('action/editer_' . $objet)
84
+        and function_exists($modifier = $objet . '_modifier')
85
+    ) {
86
+        return $modifier($id, $set);
87
+    }
88
+
89
+    $table_sql = table_objet_sql($objet);
90
+    $trouver_table = charger_fonction('trouver_table', 'base');
91
+    $desc = $trouver_table($table_sql);
92
+    if (!$desc or !isset($desc['field'])) {
93
+        spip_log("Objet $objet inconnu dans objet_modifier", 'editer' . _LOG_ERREUR);
94
+
95
+        return _L("Erreur objet $objet inconnu");
96
+    }
97
+    include_spip('inc/modifier');
98
+
99
+    $champ_date = '';
100
+    if (isset($desc['date']) and $desc['date']) {
101
+        $champ_date = $desc['date'];
102
+    } elseif (isset($desc['field']['date'])) {
103
+        $champ_date = 'date';
104
+    }
105
+
106
+    $include_list = array_keys($desc['field']);
107
+    // on ne traite pas la cle primaire par defaut, notamment car
108
+    // sur une creation, id_x vaut 'oui', et serait enregistre en id_x=0 dans la base
109
+    $include_list = array_diff($include_list, [$desc['key']['PRIMARY KEY']]);
110
+
111
+    if (isset($desc['champs_editables']) and is_array($desc['champs_editables'])) {
112
+        $include_list = $desc['champs_editables'];
113
+    }
114
+    $c = collecter_requests(
115
+        // include list
116
+        $include_list,
117
+        // exclude list
118
+        [$champ_date, 'statut', 'id_parent', 'id_secteur'],
119
+        // donnees eventuellement fournies
120
+        $set
121
+    );
122
+
123
+    // Si l'objet est publie, invalider les caches et demander sa reindexation
124
+    if (objet_test_si_publie($objet, $id)) {
125
+        $invalideur = "id='$objet/$id'";
126
+        $indexation = true;
127
+    } else {
128
+        $invalideur = '';
129
+        $indexation = false;
130
+    }
131
+
132
+    if (
133
+        $err = objet_modifier_champs(
134
+            $objet,
135
+            $id,
136
+            [
137
+            'data' => $set,
138
+            'nonvide' => '',
139
+            'invalideur' => $invalideur,
140
+            'indexation' => $indexation,
141
+            // champ a mettre a date('Y-m-d H:i:s') s'il y a modif
142
+            'date_modif' => (isset($desc['field']['date_modif']) ? 'date_modif' : '')
143
+            ],
144
+            $c
145
+        )
146
+    ) {
147
+        return $err;
148
+    }
149
+
150
+    // Modification de statut, changement de rubrique ?
151
+    // FIXME: Ici lorsqu'un $set est passé, la fonction collecter_requests() retourne tout
152
+    //         le tableau $set hors liste d’exclusion, mais du coup on a possiblement des champs en trop.
153
+    $c = collecter_requests([$champ_date, 'statut', 'id_parent'], [], $set);
154
+    $err = objet_instituer($objet, $id, $c);
155
+
156
+    return $err;
157 157
 }
158 158
 
159 159
 /**
@@ -168,135 +168,135 @@  discard block
 block discarded – undo
168 168
  * @return bool|int
169 169
  */
170 170
 function objet_inserer($objet, $id_parent = null, $set = null) {
171
-	$d = null;
172
-	if (($t = objet_type($objet)) !== $objet) {
173
-		spip_log("objet_inserer: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE);
174
-		$objet = $t;
175
-	}
176
-	if (
177
-		include_spip('action/editer_' . $objet)
178
-		and function_exists($inserer = $objet . '_inserer')
179
-	) {
180
-		return $inserer($id_parent, $set);
181
-	}
182
-
183
-	$table_sql = table_objet_sql($objet);
184
-	$trouver_table = charger_fonction('trouver_table', 'base');
185
-	$desc = $trouver_table($table_sql);
186
-	if (!$desc or !isset($desc['field'])) {
187
-		return 0;
188
-	}
189
-
190
-	$lang_rub = '';
191
-	$champs = [];
192
-	if (isset($desc['field']['id_rubrique'])) {
193
-		// Si id_rubrique vaut 0 ou n'est pas definie, creer l'objet
194
-		// dans la premiere rubrique racine
195
-		if (!$id_rubrique = intval($id_parent)) {
196
-			$row = sql_fetsel('id_rubrique, id_secteur, lang', 'spip_rubriques', 'id_parent=0', '', '0+titre,titre', '1');
197
-			$id_rubrique = $row['id_rubrique'];
198
-		} else {
199
-			$row = sql_fetsel('lang, id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique));
200
-		}
201
-
202
-		$champs['id_rubrique'] = $id_rubrique;
203
-		if (isset($desc['field']['id_secteur'])) {
204
-			$champs['id_secteur'] = $row['id_secteur'];
205
-		}
206
-		$lang_rub = $row['lang'];
207
-	}
208
-
209
-	// La langue a la creation : si les liens de traduction sont autorises
210
-	// dans les rubriques, on essaie avec la langue de l'auteur,
211
-	// ou a defaut celle de la rubrique
212
-	// Sinon c'est la langue de la rubrique qui est choisie + heritee
213
-	if (
214
-		isset($desc['field']['lang']) and !empty($GLOBALS['meta']['multi_objets']) and in_array(
215
-			$table_sql,
216
-			explode(',', $GLOBALS['meta']['multi_objets'])
217
-		)
218
-	) {
219
-		lang_select($GLOBALS['visiteur_session']['lang']);
220
-		if (
221
-			in_array(
222
-				$GLOBALS['spip_lang'],
223
-				explode(',', $GLOBALS['meta']['langues_multilingue'])
224
-			)
225
-		) {
226
-			$champs['lang'] = $GLOBALS['spip_lang'];
227
-			if (isset($desc['field']['langue_choisie'])) {
228
-				$champs['langue_choisie'] = 'oui';
229
-			}
230
-		}
231
-	} elseif (isset($desc['field']['lang']) and isset($desc['field']['langue_choisie'])) {
232
-		$champs['lang'] = ($lang_rub ?: $GLOBALS['meta']['langue_site']);
233
-		$champs['langue_choisie'] = 'non';
234
-	}
235
-
236
-	if (isset($desc['field']['statut'])) {
237
-		if (isset($desc['statut_textes_instituer'])) {
238
-			$cles_statut = array_keys($desc['statut_textes_instituer']);
239
-			$champs['statut'] = reset($cles_statut);
240
-		} else {
241
-			$champs['statut'] = 'prepa';
242
-		}
243
-	}
244
-
245
-
246
-	if ((isset($desc['date']) and $d = $desc['date']) or isset($desc['field'][$d = 'date'])) {
247
-		$champs[$d] = date('Y-m-d H:i:s');
248
-	}
249
-
250
-	if ($set) {
251
-		$champs = array_merge($champs, $set);
252
-	}
253
-
254
-	// Envoyer aux plugins
255
-	$champs = pipeline(
256
-		'pre_insertion',
257
-		[
258
-			'args' => [
259
-				'table' => $table_sql,
260
-				'id_parent' => $id_parent,
261
-			],
262
-			'data' => $champs
263
-		]
264
-	);
265
-
266
-	$id = sql_insertq($table_sql, $champs);
267
-
268
-	if ($id) {
269
-		// controler si le serveur n'a pas renvoye une erreur
270
-		// et associer l'auteur sinon
271
-		// si la table n'a pas deja un champ id_auteur
272
-		// et si le form n'a pas poste un id_auteur (meme vide, ce qui sert a annuler cette auto association)
273
-		if (
274
-			$id > 0
275
-			and !isset($desc['field']['id_auteur'])
276
-		) {
277
-			$id_auteur = ((is_null(_request('id_auteur')) and isset($GLOBALS['visiteur_session']['id_auteur'])) ?
278
-				$GLOBALS['visiteur_session']['id_auteur']
279
-				: _request('id_auteur'));
280
-			if ($id_auteur) {
281
-				include_spip('action/editer_auteur');
282
-				auteur_associer($id_auteur, [$objet => $id]);
283
-			}
284
-		}
285
-
286
-		pipeline(
287
-			'post_insertion',
288
-			[
289
-				'args' => [
290
-					'table' => $table_sql,
291
-					'id_parent' => $id_parent,
292
-					'id_objet' => $id,
293
-				],
294
-				'data' => $champs
295
-			]
296
-		);
297
-	}
298
-
299
-	return $id;
171
+    $d = null;
172
+    if (($t = objet_type($objet)) !== $objet) {
173
+        spip_log("objet_inserer: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE);
174
+        $objet = $t;
175
+    }
176
+    if (
177
+        include_spip('action/editer_' . $objet)
178
+        and function_exists($inserer = $objet . '_inserer')
179
+    ) {
180
+        return $inserer($id_parent, $set);
181
+    }
182
+
183
+    $table_sql = table_objet_sql($objet);
184
+    $trouver_table = charger_fonction('trouver_table', 'base');
185
+    $desc = $trouver_table($table_sql);
186
+    if (!$desc or !isset($desc['field'])) {
187
+        return 0;
188
+    }
189
+
190
+    $lang_rub = '';
191
+    $champs = [];
192
+    if (isset($desc['field']['id_rubrique'])) {
193
+        // Si id_rubrique vaut 0 ou n'est pas definie, creer l'objet
194
+        // dans la premiere rubrique racine
195
+        if (!$id_rubrique = intval($id_parent)) {
196
+            $row = sql_fetsel('id_rubrique, id_secteur, lang', 'spip_rubriques', 'id_parent=0', '', '0+titre,titre', '1');
197
+            $id_rubrique = $row['id_rubrique'];
198
+        } else {
199
+            $row = sql_fetsel('lang, id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique));
200
+        }
201
+
202
+        $champs['id_rubrique'] = $id_rubrique;
203
+        if (isset($desc['field']['id_secteur'])) {
204
+            $champs['id_secteur'] = $row['id_secteur'];
205
+        }
206
+        $lang_rub = $row['lang'];
207
+    }
208
+
209
+    // La langue a la creation : si les liens de traduction sont autorises
210
+    // dans les rubriques, on essaie avec la langue de l'auteur,
211
+    // ou a defaut celle de la rubrique
212
+    // Sinon c'est la langue de la rubrique qui est choisie + heritee
213
+    if (
214
+        isset($desc['field']['lang']) and !empty($GLOBALS['meta']['multi_objets']) and in_array(
215
+            $table_sql,
216
+            explode(',', $GLOBALS['meta']['multi_objets'])
217
+        )
218
+    ) {
219
+        lang_select($GLOBALS['visiteur_session']['lang']);
220
+        if (
221
+            in_array(
222
+                $GLOBALS['spip_lang'],
223
+                explode(',', $GLOBALS['meta']['langues_multilingue'])
224
+            )
225
+        ) {
226
+            $champs['lang'] = $GLOBALS['spip_lang'];
227
+            if (isset($desc['field']['langue_choisie'])) {
228
+                $champs['langue_choisie'] = 'oui';
229
+            }
230
+        }
231
+    } elseif (isset($desc['field']['lang']) and isset($desc['field']['langue_choisie'])) {
232
+        $champs['lang'] = ($lang_rub ?: $GLOBALS['meta']['langue_site']);
233
+        $champs['langue_choisie'] = 'non';
234
+    }
235
+
236
+    if (isset($desc['field']['statut'])) {
237
+        if (isset($desc['statut_textes_instituer'])) {
238
+            $cles_statut = array_keys($desc['statut_textes_instituer']);
239
+            $champs['statut'] = reset($cles_statut);
240
+        } else {
241
+            $champs['statut'] = 'prepa';
242
+        }
243
+    }
244
+
245
+
246
+    if ((isset($desc['date']) and $d = $desc['date']) or isset($desc['field'][$d = 'date'])) {
247
+        $champs[$d] = date('Y-m-d H:i:s');
248
+    }
249
+
250
+    if ($set) {
251
+        $champs = array_merge($champs, $set);
252
+    }
253
+
254
+    // Envoyer aux plugins
255
+    $champs = pipeline(
256
+        'pre_insertion',
257
+        [
258
+            'args' => [
259
+                'table' => $table_sql,
260
+                'id_parent' => $id_parent,
261
+            ],
262
+            'data' => $champs
263
+        ]
264
+    );
265
+
266
+    $id = sql_insertq($table_sql, $champs);
267
+
268
+    if ($id) {
269
+        // controler si le serveur n'a pas renvoye une erreur
270
+        // et associer l'auteur sinon
271
+        // si la table n'a pas deja un champ id_auteur
272
+        // et si le form n'a pas poste un id_auteur (meme vide, ce qui sert a annuler cette auto association)
273
+        if (
274
+            $id > 0
275
+            and !isset($desc['field']['id_auteur'])
276
+        ) {
277
+            $id_auteur = ((is_null(_request('id_auteur')) and isset($GLOBALS['visiteur_session']['id_auteur'])) ?
278
+                $GLOBALS['visiteur_session']['id_auteur']
279
+                : _request('id_auteur'));
280
+            if ($id_auteur) {
281
+                include_spip('action/editer_auteur');
282
+                auteur_associer($id_auteur, [$objet => $id]);
283
+            }
284
+        }
285
+
286
+        pipeline(
287
+            'post_insertion',
288
+            [
289
+                'args' => [
290
+                    'table' => $table_sql,
291
+                    'id_parent' => $id_parent,
292
+                    'id_objet' => $id,
293
+                ],
294
+                'data' => $champs
295
+            ]
296
+        );
297
+    }
298
+
299
+    return $id;
300 300
 }
301 301
 
302 302
 
@@ -313,138 +313,138 @@  discard block
 block discarded – undo
313 313
  * @return string
314 314
  */
315 315
 function objet_instituer($objet, $id, $c, $calcul_rub = true) {
316
-	if (($t = objet_type($objet)) !== $objet) {
317
-		spip_log("objet_instituer: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE);
318
-		$objet = $t;
319
-	}
320
-	if (
321
-		include_spip('action/editer_' . $objet)
322
-		and function_exists($instituer = $objet . '_instituer')
323
-	) {
324
-		return $instituer($id, $c, $calcul_rub);
325
-	}
326
-
327
-	$table_sql = table_objet_sql($objet);
328
-	$trouver_table = charger_fonction('trouver_table', 'base');
329
-	$desc = $trouver_table($table_sql);
330
-	if (!$desc or !isset($desc['field'])) {
331
-		return _L("Impossible d'instituer $objet : non connu en base");
332
-	}
333
-
334
-	include_spip('inc/autoriser');
335
-	include_spip('inc/rubriques');
336
-	include_spip('inc/modifier');
337
-
338
-	$sel = [];
339
-	$sel[] = (isset($desc['field']['statut']) ? 'statut' : "'' as statut");
340
-
341
-	$champ_date = '';
342
-	if (isset($desc['date']) and $desc['date']) {
343
-		$champ_date = $desc['date'];
344
-	} elseif (isset($desc['field']['date'])) {
345
-		$champ_date = 'date';
346
-	}
347
-
348
-	$sel[] = ($champ_date ? "$champ_date as date" : "'' as date");
349
-	$sel[] = (isset($desc['field']['id_rubrique']) ? 'id_rubrique' : '0 as id_rubrique');
350
-
351
-	$row = sql_fetsel($sel, $table_sql, id_table_objet($objet) . '=' . intval($id));
352
-
353
-	$id_rubrique = $row['id_rubrique'];
354
-	$statut_ancien = $statut = $row['statut'];
355
-	$date_ancienne = $date = $row['date'];
356
-	$champs = [];
357
-
358
-	$d = ($date and isset($c[$champ_date])) ? $c[$champ_date] : null;
359
-	$s = (isset($desc['field']['statut']) and isset($c['statut'])) ? $c['statut'] : $statut;
360
-
361
-	// cf autorisations dans inc/instituer_objet
362
-	if ($s != $statut or ($d and $d != $date)) {
363
-		if (
364
-			$id_rubrique ?
365
-			autoriser('publierdans', 'rubrique', $id_rubrique)
366
-			:
367
-			autoriser('instituer', $objet, $id, null, ['statut' => $s])
368
-		) {
369
-			$statut = $champs['statut'] = $s;
370
-		} else {
371
-			if ($s != 'publie' and autoriser('modifier', $objet, $id)) {
372
-				$statut = $champs['statut'] = $s;
373
-			} else {
374
-				spip_log("editer_objet $objet #$id refus " . json_encode($c, JSON_THROW_ON_ERROR), 'editer' . _LOG_INFO_IMPORTANTE);
375
-			}
376
-		}
377
-
378
-		// En cas de publication, fixer la date a "maintenant"
379
-		// sauf si $c commande autre chose
380
-		// ou si l'objet est deja date dans le futur
381
-		// En cas de proposition d'un objet (mais pas depublication), idem
382
-		if ($champ_date) {
383
-			if (
384
-				$champs['statut'] == 'publie'
385
-				or ($champs['statut'] == 'prop' and !in_array($statut_ancien, ['publie', 'prop']))
386
-				or $d
387
-			) {
388
-				if ($d or strtotime($d = $date) > time()) {
389
-					$champs[$champ_date] = $date = $d;
390
-				} else {
391
-					$champs[$champ_date] = $date = date('Y-m-d H:i:s');
392
-				}
393
-			}
394
-		}
395
-	}
396
-
397
-	// Verifier que la rubrique demandee existe et est differente
398
-	// de la rubrique actuelle
399
-	if (
400
-		$id_rubrique
401
-		and isset($c['id_parent'])
402
-		and $id_parent = $c['id_parent']
403
-		and $id_parent != $id_rubrique
404
-		and (sql_fetsel('1', 'spip_rubriques', 'id_rubrique=' . intval($id_parent)))
405
-	) {
406
-		$champs['id_rubrique'] = $id_parent;
407
-
408
-		// si l'objet etait publie
409
-		// et que le demandeur n'est pas admin de la rubrique
410
-		// repasser l'objet en statut 'propose'.
411
-		if (
412
-			$statut == 'publie'
413
-			and !autoriser('publierdans', 'rubrique', $id_rubrique)
414
-		) {
415
-			$champs['statut'] = 'prop';
416
-		}
417
-	}
418
-
419
-
420
-	// Envoyer aux plugins
421
-	$champs = pipeline(
422
-		'pre_edition',
423
-		[
424
-			'args' => [
425
-				'table' => $table_sql,
426
-				'id_objet' => $id,
427
-				'action' => 'instituer',
428
-				'statut_ancien' => $statut_ancien,
429
-				'date_ancienne' => $date_ancienne,
430
-				'id_parent_ancien' => $id_rubrique,
431
-			],
432
-			'data' => $champs
433
-		]
434
-	);
435
-
436
-	if (!(is_countable($champs) ? count($champs) : 0)) {
437
-		return '';
438
-	}
439
-
440
-	// Envoyer les modifs.
441
-	objet_editer_heritage($objet, $id, $id_rubrique, $statut_ancien, $champs, $calcul_rub);
442
-
443
-	// Invalider les caches
444
-	include_spip('inc/invalideur');
445
-	suivre_invalideur("id='$objet/$id'");
446
-
447
-	/*
316
+    if (($t = objet_type($objet)) !== $objet) {
317
+        spip_log("objet_instituer: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE);
318
+        $objet = $t;
319
+    }
320
+    if (
321
+        include_spip('action/editer_' . $objet)
322
+        and function_exists($instituer = $objet . '_instituer')
323
+    ) {
324
+        return $instituer($id, $c, $calcul_rub);
325
+    }
326
+
327
+    $table_sql = table_objet_sql($objet);
328
+    $trouver_table = charger_fonction('trouver_table', 'base');
329
+    $desc = $trouver_table($table_sql);
330
+    if (!$desc or !isset($desc['field'])) {
331
+        return _L("Impossible d'instituer $objet : non connu en base");
332
+    }
333
+
334
+    include_spip('inc/autoriser');
335
+    include_spip('inc/rubriques');
336
+    include_spip('inc/modifier');
337
+
338
+    $sel = [];
339
+    $sel[] = (isset($desc['field']['statut']) ? 'statut' : "'' as statut");
340
+
341
+    $champ_date = '';
342
+    if (isset($desc['date']) and $desc['date']) {
343
+        $champ_date = $desc['date'];
344
+    } elseif (isset($desc['field']['date'])) {
345
+        $champ_date = 'date';
346
+    }
347
+
348
+    $sel[] = ($champ_date ? "$champ_date as date" : "'' as date");
349
+    $sel[] = (isset($desc['field']['id_rubrique']) ? 'id_rubrique' : '0 as id_rubrique');
350
+
351
+    $row = sql_fetsel($sel, $table_sql, id_table_objet($objet) . '=' . intval($id));
352
+
353
+    $id_rubrique = $row['id_rubrique'];
354
+    $statut_ancien = $statut = $row['statut'];
355
+    $date_ancienne = $date = $row['date'];
356
+    $champs = [];
357
+
358
+    $d = ($date and isset($c[$champ_date])) ? $c[$champ_date] : null;
359
+    $s = (isset($desc['field']['statut']) and isset($c['statut'])) ? $c['statut'] : $statut;
360
+
361
+    // cf autorisations dans inc/instituer_objet
362
+    if ($s != $statut or ($d and $d != $date)) {
363
+        if (
364
+            $id_rubrique ?
365
+            autoriser('publierdans', 'rubrique', $id_rubrique)
366
+            :
367
+            autoriser('instituer', $objet, $id, null, ['statut' => $s])
368
+        ) {
369
+            $statut = $champs['statut'] = $s;
370
+        } else {
371
+            if ($s != 'publie' and autoriser('modifier', $objet, $id)) {
372
+                $statut = $champs['statut'] = $s;
373
+            } else {
374
+                spip_log("editer_objet $objet #$id refus " . json_encode($c, JSON_THROW_ON_ERROR), 'editer' . _LOG_INFO_IMPORTANTE);
375
+            }
376
+        }
377
+
378
+        // En cas de publication, fixer la date a "maintenant"
379
+        // sauf si $c commande autre chose
380
+        // ou si l'objet est deja date dans le futur
381
+        // En cas de proposition d'un objet (mais pas depublication), idem
382
+        if ($champ_date) {
383
+            if (
384
+                $champs['statut'] == 'publie'
385
+                or ($champs['statut'] == 'prop' and !in_array($statut_ancien, ['publie', 'prop']))
386
+                or $d
387
+            ) {
388
+                if ($d or strtotime($d = $date) > time()) {
389
+                    $champs[$champ_date] = $date = $d;
390
+                } else {
391
+                    $champs[$champ_date] = $date = date('Y-m-d H:i:s');
392
+                }
393
+            }
394
+        }
395
+    }
396
+
397
+    // Verifier que la rubrique demandee existe et est differente
398
+    // de la rubrique actuelle
399
+    if (
400
+        $id_rubrique
401
+        and isset($c['id_parent'])
402
+        and $id_parent = $c['id_parent']
403
+        and $id_parent != $id_rubrique
404
+        and (sql_fetsel('1', 'spip_rubriques', 'id_rubrique=' . intval($id_parent)))
405
+    ) {
406
+        $champs['id_rubrique'] = $id_parent;
407
+
408
+        // si l'objet etait publie
409
+        // et que le demandeur n'est pas admin de la rubrique
410
+        // repasser l'objet en statut 'propose'.
411
+        if (
412
+            $statut == 'publie'
413
+            and !autoriser('publierdans', 'rubrique', $id_rubrique)
414
+        ) {
415
+            $champs['statut'] = 'prop';
416
+        }
417
+    }
418
+
419
+
420
+    // Envoyer aux plugins
421
+    $champs = pipeline(
422
+        'pre_edition',
423
+        [
424
+            'args' => [
425
+                'table' => $table_sql,
426
+                'id_objet' => $id,
427
+                'action' => 'instituer',
428
+                'statut_ancien' => $statut_ancien,
429
+                'date_ancienne' => $date_ancienne,
430
+                'id_parent_ancien' => $id_rubrique,
431
+            ],
432
+            'data' => $champs
433
+        ]
434
+    );
435
+
436
+    if (!(is_countable($champs) ? count($champs) : 0)) {
437
+        return '';
438
+    }
439
+
440
+    // Envoyer les modifs.
441
+    objet_editer_heritage($objet, $id, $id_rubrique, $statut_ancien, $champs, $calcul_rub);
442
+
443
+    // Invalider les caches
444
+    include_spip('inc/invalideur');
445
+    suivre_invalideur("id='$objet/$id'");
446
+
447
+    /*
448 448
 	if ($date) {
449 449
 		$t = strtotime($date);
450 450
 		$p = @$GLOBALS['meta']['date_prochain_postdate'];
@@ -453,32 +453,32 @@  discard block
 block discarded – undo
453 453
 		}
454 454
 	}*/
455 455
 
456
-	// Pipeline
457
-	pipeline(
458
-		'post_edition',
459
-		[
460
-			'args' => [
461
-				'table' => $table_sql,
462
-				'id_objet' => $id,
463
-				'action' => 'instituer',
464
-				'statut_ancien' => $statut_ancien,
465
-				'date_ancienne' => $date_ancienne,
466
-				'id_parent_ancien' => $id_rubrique,
467
-			],
468
-			'data' => $champs
469
-		]
470
-	);
471
-
472
-	// Notifications
473
-	if ($notifications = charger_fonction('notifications', 'inc')) {
474
-		$notifications(
475
-			"instituer$objet",
476
-			$id,
477
-			['statut' => $statut, 'statut_ancien' => $statut_ancien, 'date' => $date, 'date_ancienne' => $date_ancienne]
478
-		);
479
-	}
480
-
481
-	return ''; // pas d'erreur
456
+    // Pipeline
457
+    pipeline(
458
+        'post_edition',
459
+        [
460
+            'args' => [
461
+                'table' => $table_sql,
462
+                'id_objet' => $id,
463
+                'action' => 'instituer',
464
+                'statut_ancien' => $statut_ancien,
465
+                'date_ancienne' => $date_ancienne,
466
+                'id_parent_ancien' => $id_rubrique,
467
+            ],
468
+            'data' => $champs
469
+        ]
470
+    );
471
+
472
+    // Notifications
473
+    if ($notifications = charger_fonction('notifications', 'inc')) {
474
+        $notifications(
475
+            "instituer$objet",
476
+            $id,
477
+            ['statut' => $statut, 'statut_ancien' => $statut_ancien, 'date' => $date, 'date_ancienne' => $date_ancienne]
478
+        );
479
+    }
480
+
481
+    return ''; // pas d'erreur
482 482
 }
483 483
 
484 484
 /**
@@ -493,51 +493,51 @@  discard block
 block discarded – undo
493 493
  * @return void
494 494
  */
495 495
 function objet_editer_heritage($objet, $id, $id_rubrique, $statut, $champs, $cond = true) {
496
-	$table_sql = table_objet_sql($objet);
497
-	$trouver_table = charger_fonction('trouver_table', 'base');
498
-	$desc = $trouver_table($table_sql);
499
-
500
-	// Si on deplace l'objet
501
-	// changer aussi son secteur et sa langue (si heritee)
502
-	if (isset($champs['id_rubrique'])) {
503
-		$row_rub = sql_fetsel('id_secteur, lang', 'spip_rubriques', 'id_rubrique=' . sql_quote($champs['id_rubrique']));
504
-		$langue = $row_rub['lang'];
505
-
506
-		if (isset($desc['field']['id_secteur'])) {
507
-			$champs['id_secteur'] = $row_rub['id_secteur'];
508
-		}
509
-
510
-		if (isset($desc['field']['lang']) and isset($desc['field']['langue_choisie'])) {
511
-			if (
512
-				sql_fetsel(
513
-					'1',
514
-					$table_sql,
515
-					id_table_objet($objet) . '=' . intval($id) . " AND langue_choisie<>'oui' AND lang<>" . sql_quote($langue)
516
-				)
517
-			) {
518
-				$champs['lang'] = $langue;
519
-			}
520
-		}
521
-	}
522
-
523
-	if (!$champs) {
524
-		return;
525
-	}
526
-	sql_updateq($table_sql, $champs, id_table_objet($objet) . '=' . intval($id));
527
-
528
-	// Changer le statut des rubriques concernees
529
-	if ($cond) {
530
-		include_spip('inc/rubriques');
531
-		//$postdate = ($GLOBALS['meta']["post_dates"] == "non" AND isset($champs['date']) AND (strtotime($champs['date']) < time()))?$champs['date']:false;
532
-		$postdate = false;
533
-		// On rajoute les infos de l'objet
534
-		$infos = [
535
-			'objet' => $objet,
536
-			'id_objet' => $id,
537
-			'statut_ancien' => $statut,
538
-		];
539
-		calculer_rubriques_if($id_rubrique, $champs, $infos, $postdate);
540
-	}
496
+    $table_sql = table_objet_sql($objet);
497
+    $trouver_table = charger_fonction('trouver_table', 'base');
498
+    $desc = $trouver_table($table_sql);
499
+
500
+    // Si on deplace l'objet
501
+    // changer aussi son secteur et sa langue (si heritee)
502
+    if (isset($champs['id_rubrique'])) {
503
+        $row_rub = sql_fetsel('id_secteur, lang', 'spip_rubriques', 'id_rubrique=' . sql_quote($champs['id_rubrique']));
504
+        $langue = $row_rub['lang'];
505
+
506
+        if (isset($desc['field']['id_secteur'])) {
507
+            $champs['id_secteur'] = $row_rub['id_secteur'];
508
+        }
509
+
510
+        if (isset($desc['field']['lang']) and isset($desc['field']['langue_choisie'])) {
511
+            if (
512
+                sql_fetsel(
513
+                    '1',
514
+                    $table_sql,
515
+                    id_table_objet($objet) . '=' . intval($id) . " AND langue_choisie<>'oui' AND lang<>" . sql_quote($langue)
516
+                )
517
+            ) {
518
+                $champs['lang'] = $langue;
519
+            }
520
+        }
521
+    }
522
+
523
+    if (!$champs) {
524
+        return;
525
+    }
526
+    sql_updateq($table_sql, $champs, id_table_objet($objet) . '=' . intval($id));
527
+
528
+    // Changer le statut des rubriques concernees
529
+    if ($cond) {
530
+        include_spip('inc/rubriques');
531
+        //$postdate = ($GLOBALS['meta']["post_dates"] == "non" AND isset($champs['date']) AND (strtotime($champs['date']) < time()))?$champs['date']:false;
532
+        $postdate = false;
533
+        // On rajoute les infos de l'objet
534
+        $infos = [
535
+            'objet' => $objet,
536
+            'id_objet' => $id,
537
+            'statut_ancien' => $statut,
538
+        ];
539
+        calculer_rubriques_if($id_rubrique, $champs, $infos, $postdate);
540
+    }
541 541
 }
542 542
 
543 543
 
@@ -566,75 +566,75 @@  discard block
 block discarded – undo
566 566
  *     string|int : valeur du champ demande pour l'objet demande
567 567
  */
568 568
 function objet_lire($objet, $valeur_id, $options = []) {
569
-	if (($t = objet_type($objet)) !== $objet) {
570
-		spip_log("objet_lire: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE);
571
-		$objet = $t;
572
-	}
573
-
574
-	// tableau du cache des descriptions et des id d'objet (au sens id_xxx).
575
-	// Les tableaux sont toujours indexés par le trio [objet][cle][valeur_cle]
576
-	static $descriptions = [];
577
-
578
-	// On détermine le nom du champ id de la table.
579
-	include_spip('base/objets');
580
-	$primary = id_table_objet($objet);
581
-
582
-	// On détermine l'id à utiliser.
583
-	$champ_id = (!empty($options['champ_id']) ? $options['champ_id'] : $primary);
584
-
585
-	// Si l'objet n'a pas encore été stocké, il faut récupérer sa description complète.
586
-	if (
587
-		!isset($descriptions[$objet][$champ_id][$valeur_id])
588
-		or (isset($options['force']) and $options['force'])
589
-	) {
590
-		// Il est possible pour un type d'objet de fournir une fonction de lecture de tous les champs d'un objet.
591
-		if (
592
-			include_spip('action/editer_' . $objet)
593
-			and function_exists($lire = "{$objet}_lire_champs")
594
-		) {
595
-			$valeurs = $lire($objet, $valeur_id, $champ_id);
596
-		} else {
597
-			// On récupère la table SQL à partir du type d'objet.
598
-			$table = table_objet_sql($objet);
599
-
600
-			// La condition est appliquée sur le champ désigné par l'utilisateur.
601
-			$where = [
602
-				$champ_id . '=' . sql_quote($valeur_id)
603
-			];
604
-
605
-			// Acquisition de tous les champs de l'objet : si l'accès SQL retourne une erreur on renvoie un tableau vide.
606
-			$valeurs = sql_fetsel('*', $table, $where);
607
-		}
608
-
609
-		if (!$valeurs) {
610
-			$valeurs = false;
611
-		}
612
-
613
-		$descriptions[$objet][$champ_id][$valeur_id] = $valeurs;
614
-
615
-		if ($champ_id !== $primary and isset($valeurs[$primary])) {
616
-			$descriptions[$objet][$primary][$valeurs[$primary]] = $valeurs;
617
-			$descriptions[$objet][$champ_id][$valeur_id] = &$descriptions[$objet][$primary][$valeurs[$primary]];
618
-		}
619
-	}
620
-
621
-	$retour = $descriptions[$objet][$champ_id][$valeur_id];
622
-
623
-	// On ne retourne maintenant que les champs demandés.
624
-	// - on détermine les informations à renvoyer.
625
-	if ($retour and !empty($options['champs'])) {
626
-		$champs = $options['champs'];
627
-		// Extraction des seules informations demandées.
628
-		// -- si on demande une information unique on renvoie la valeur simple, sinon on renvoie un tableau.
629
-		// -- si une information n'est pas un champ valide elle n'est pas renvoyée sans renvoyer d'erreur.
630
-		if (is_array($champs)) {
631
-			// Tableau des informations valides
632
-			$retour = array_intersect_key($retour, array_flip($champs));
633
-		} else {
634
-			// Valeur unique demandée.
635
-			$retour = ($retour[$champs] ?? false);
636
-		}
637
-	}
638
-
639
-	return $retour;
569
+    if (($t = objet_type($objet)) !== $objet) {
570
+        spip_log("objet_lire: appel avec type $objet invalide au lieu de $t", 'editer' . _LOG_INFO_IMPORTANTE);
571
+        $objet = $t;
572
+    }
573
+
574
+    // tableau du cache des descriptions et des id d'objet (au sens id_xxx).
575
+    // Les tableaux sont toujours indexés par le trio [objet][cle][valeur_cle]
576
+    static $descriptions = [];
577
+
578
+    // On détermine le nom du champ id de la table.
579
+    include_spip('base/objets');
580
+    $primary = id_table_objet($objet);
581
+
582
+    // On détermine l'id à utiliser.
583
+    $champ_id = (!empty($options['champ_id']) ? $options['champ_id'] : $primary);
584
+
585
+    // Si l'objet n'a pas encore été stocké, il faut récupérer sa description complète.
586
+    if (
587
+        !isset($descriptions[$objet][$champ_id][$valeur_id])
588
+        or (isset($options['force']) and $options['force'])
589
+    ) {
590
+        // Il est possible pour un type d'objet de fournir une fonction de lecture de tous les champs d'un objet.
591
+        if (
592
+            include_spip('action/editer_' . $objet)
593
+            and function_exists($lire = "{$objet}_lire_champs")
594
+        ) {
595
+            $valeurs = $lire($objet, $valeur_id, $champ_id);
596
+        } else {
597
+            // On récupère la table SQL à partir du type d'objet.
598
+            $table = table_objet_sql($objet);
599
+
600
+            // La condition est appliquée sur le champ désigné par l'utilisateur.
601
+            $where = [
602
+                $champ_id . '=' . sql_quote($valeur_id)
603
+            ];
604
+
605
+            // Acquisition de tous les champs de l'objet : si l'accès SQL retourne une erreur on renvoie un tableau vide.
606
+            $valeurs = sql_fetsel('*', $table, $where);
607
+        }
608
+
609
+        if (!$valeurs) {
610
+            $valeurs = false;
611
+        }
612
+
613
+        $descriptions[$objet][$champ_id][$valeur_id] = $valeurs;
614
+
615
+        if ($champ_id !== $primary and isset($valeurs[$primary])) {
616
+            $descriptions[$objet][$primary][$valeurs[$primary]] = $valeurs;
617
+            $descriptions[$objet][$champ_id][$valeur_id] = &$descriptions[$objet][$primary][$valeurs[$primary]];
618
+        }
619
+    }
620
+
621
+    $retour = $descriptions[$objet][$champ_id][$valeur_id];
622
+
623
+    // On ne retourne maintenant que les champs demandés.
624
+    // - on détermine les informations à renvoyer.
625
+    if ($retour and !empty($options['champs'])) {
626
+        $champs = $options['champs'];
627
+        // Extraction des seules informations demandées.
628
+        // -- si on demande une information unique on renvoie la valeur simple, sinon on renvoie un tableau.
629
+        // -- si une information n'est pas un champ valide elle n'est pas renvoyée sans renvoyer d'erreur.
630
+        if (is_array($champs)) {
631
+            // Tableau des informations valides
632
+            $retour = array_intersect_key($retour, array_flip($champs));
633
+        } else {
634
+            // Valeur unique demandée.
635
+            $retour = ($retour[$champs] ?? false);
636
+        }
637
+    }
638
+
639
+    return $retour;
640 640
 }
Please login to merge, or discard this patch.
ecrire/inc/flock.php 1 patch
Indentation   +407 added lines, -407 removed lines patch added patch discarded remove patch
@@ -17,12 +17,12 @@  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
 if (!defined('_TEST_FILE_EXISTS')) {
24
-	/** Permettre d'éviter des tests file_exists sur certains hébergeurs */
25
-	define('_TEST_FILE_EXISTS', preg_match(',(online|free)[.]fr$,', $_ENV['HTTP_HOST'] ?? ''));
24
+    /** Permettre d'éviter des tests file_exists sur certains hébergeurs */
25
+    define('_TEST_FILE_EXISTS', preg_match(',(online|free)[.]fr$,', $_ENV['HTTP_HOST'] ?? ''));
26 26
 }
27 27
 
28 28
 #define('_SPIP_LOCK_MODE',0); // ne pas utiliser de lock (deconseille)
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 #define('_SPIP_LOCK_MODE',2); // utiliser le nfslock de spip
31 31
 
32 32
 if (_SPIP_LOCK_MODE == 2) {
33
-	include_spip('inc/nfslock');
33
+    include_spip('inc/nfslock');
34 34
 }
35 35
 
36 36
 $GLOBALS['liste_verrous'] = [];
@@ -53,24 +53,24 @@  discard block
 block discarded – undo
53 53
  *     Ressource sur le fichier ouvert, sinon false.
54 54
  **/
55 55
 function spip_fopen_lock($fichier, $mode, $verrou) {
56
-	if (_SPIP_LOCK_MODE == 1) {
57
-		if ($fl = @fopen($fichier, $mode)) {
58
-			// verrou
59
-			@flock($fl, $verrou);
60
-		}
61
-
62
-		return $fl;
63
-	} elseif (_SPIP_LOCK_MODE == 2) {
64
-		if (($verrou = spip_nfslock($fichier)) && ($fl = @fopen($fichier, $mode))) {
65
-			$GLOBALS['liste_verrous'][$fl] = [$fichier, $verrou];
66
-
67
-			return $fl;
68
-		} else {
69
-			return false;
70
-		}
71
-	}
72
-
73
-	return @fopen($fichier, $mode);
56
+    if (_SPIP_LOCK_MODE == 1) {
57
+        if ($fl = @fopen($fichier, $mode)) {
58
+            // verrou
59
+            @flock($fl, $verrou);
60
+        }
61
+
62
+        return $fl;
63
+    } elseif (_SPIP_LOCK_MODE == 2) {
64
+        if (($verrou = spip_nfslock($fichier)) && ($fl = @fopen($fichier, $mode))) {
65
+            $GLOBALS['liste_verrous'][$fl] = [$fichier, $verrou];
66
+
67
+            return $fl;
68
+        } else {
69
+            return false;
70
+        }
71
+    }
72
+
73
+    return @fopen($fichier, $mode);
74 74
 }
75 75
 
76 76
 /**
@@ -85,14 +85,14 @@  discard block
 block discarded – undo
85 85
  *     true si succès, false sinon.
86 86
  **/
87 87
 function spip_fclose_unlock($handle) {
88
-	if (_SPIP_LOCK_MODE == 1) {
89
-		@flock($handle, LOCK_UN);
90
-	} elseif (_SPIP_LOCK_MODE == 2) {
91
-		spip_nfsunlock(reset($GLOBALS['liste_verrous'][$handle]), end($GLOBALS['liste_verrous'][$handle]));
92
-		unset($GLOBALS['liste_verrous'][$handle]);
93
-	}
94
-
95
-	return @fclose($handle);
88
+    if (_SPIP_LOCK_MODE == 1) {
89
+        @flock($handle, LOCK_UN);
90
+    } elseif (_SPIP_LOCK_MODE == 2) {
91
+        spip_nfsunlock(reset($GLOBALS['liste_verrous'][$handle]), end($GLOBALS['liste_verrous'][$handle]));
92
+        unset($GLOBALS['liste_verrous'][$handle]);
93
+    }
94
+
95
+    return @fclose($handle);
96 96
 }
97 97
 
98 98
 
@@ -106,23 +106,23 @@  discard block
 block discarded – undo
106 106
  *     Contenu du fichier
107 107
  **/
108 108
 function spip_file_get_contents($fichier) {
109
-	if (substr($fichier, -3) != '.gz') {
110
-		if (function_exists('file_get_contents')) {
111
-			// quand on est sous windows on ne sait pas si file_get_contents marche
112
-			// on essaye : si ca retourne du contenu alors c'est bon
113
-			// sinon on fait un file() pour avoir le coeur net
114
-			$contenu = @file_get_contents($fichier);
115
-			if (!$contenu and _OS_SERVEUR == 'windows') {
116
-				$contenu = @file($fichier);
117
-			}
118
-		} else {
119
-			$contenu = @file($fichier);
120
-		}
121
-	} else {
122
-		$contenu = @gzfile($fichier);
123
-	}
124
-
125
-	return is_array($contenu) ? join('', $contenu) : (string)$contenu;
109
+    if (substr($fichier, -3) != '.gz') {
110
+        if (function_exists('file_get_contents')) {
111
+            // quand on est sous windows on ne sait pas si file_get_contents marche
112
+            // on essaye : si ca retourne du contenu alors c'est bon
113
+            // sinon on fait un file() pour avoir le coeur net
114
+            $contenu = @file_get_contents($fichier);
115
+            if (!$contenu and _OS_SERVEUR == 'windows') {
116
+                $contenu = @file($fichier);
117
+            }
118
+        } else {
119
+            $contenu = @file($fichier);
120
+        }
121
+    } else {
122
+        $contenu = @gzfile($fichier);
123
+    }
124
+
125
+    return is_array($contenu) ? join('', $contenu) : (string)$contenu;
126 126
 }
127 127
 
128 128
 
@@ -147,48 +147,48 @@  discard block
 block discarded – undo
147 147
  *     true si l'opération a réussie, false sinon.
148 148
  **/
149 149
 function lire_fichier($fichier, &$contenu, $options = []) {
150
-	$contenu = '';
151
-	// inutile car si le fichier n'existe pas, le lock va renvoyer false juste apres
152
-	// economisons donc les acces disque, sauf chez free qui rale pour un rien
153
-	if (_TEST_FILE_EXISTS and !@file_exists($fichier)) {
154
-		return false;
155
-	}
156
-
157
-	#spip_timer('lire_fichier');
158
-
159
-	// pas de @ sur spip_fopen_lock qui est silencieux de toute facon
160
-	if ($fl = spip_fopen_lock($fichier, 'r', LOCK_SH)) {
161
-		// lire le fichier avant tout
162
-		$contenu = spip_file_get_contents($fichier);
163
-
164
-		// le fichier a-t-il ete supprime par le locker ?
165
-		// on ne verifie que si la tentative de lecture a echoue
166
-		// pour discriminer un contenu vide d'un fichier absent
167
-		// et eviter un acces disque
168
-		if (!$contenu and !@file_exists($fichier)) {
169
-			spip_fclose_unlock($fl);
170
-
171
-			return false;
172
-		}
173
-
174
-		// liberer le verrou
175
-		spip_fclose_unlock($fl);
176
-
177
-		// Verifications
178
-		$ok = true;
179
-		if (isset($options['phpcheck']) and $options['phpcheck'] == 'oui') {
180
-			$ok &= (preg_match(",[?]>\n?$,", $contenu));
181
-		}
182
-
183
-		#spip_log("$fread $fichier ".spip_timer('lire_fichier'));
184
-		if (!$ok) {
185
-			spip_log("echec lecture $fichier");
186
-		}
187
-
188
-		return $ok;
189
-	}
190
-
191
-	return false;
150
+    $contenu = '';
151
+    // inutile car si le fichier n'existe pas, le lock va renvoyer false juste apres
152
+    // economisons donc les acces disque, sauf chez free qui rale pour un rien
153
+    if (_TEST_FILE_EXISTS and !@file_exists($fichier)) {
154
+        return false;
155
+    }
156
+
157
+    #spip_timer('lire_fichier');
158
+
159
+    // pas de @ sur spip_fopen_lock qui est silencieux de toute facon
160
+    if ($fl = spip_fopen_lock($fichier, 'r', LOCK_SH)) {
161
+        // lire le fichier avant tout
162
+        $contenu = spip_file_get_contents($fichier);
163
+
164
+        // le fichier a-t-il ete supprime par le locker ?
165
+        // on ne verifie que si la tentative de lecture a echoue
166
+        // pour discriminer un contenu vide d'un fichier absent
167
+        // et eviter un acces disque
168
+        if (!$contenu and !@file_exists($fichier)) {
169
+            spip_fclose_unlock($fl);
170
+
171
+            return false;
172
+        }
173
+
174
+        // liberer le verrou
175
+        spip_fclose_unlock($fl);
176
+
177
+        // Verifications
178
+        $ok = true;
179
+        if (isset($options['phpcheck']) and $options['phpcheck'] == 'oui') {
180
+            $ok &= (preg_match(",[?]>\n?$,", $contenu));
181
+        }
182
+
183
+        #spip_log("$fread $fichier ".spip_timer('lire_fichier'));
184
+        if (!$ok) {
185
+            spip_log("echec lecture $fichier");
186
+        }
187
+
188
+        return $ok;
189
+    }
190
+
191
+    return false;
192 192
 }
193 193
 
194 194
 
@@ -216,85 +216,85 @@  discard block
 block discarded – undo
216 216
  **/
217 217
 function ecrire_fichier($fichier, $contenu, $ignorer_echec = false, $truncate = true) {
218 218
 
219
-	#spip_timer('ecrire_fichier');
220
-
221
-	// verrouiller le fichier destination
222
-	if ($fp = spip_fopen_lock($fichier, 'a', LOCK_EX)) {
223
-		// ecrire les donnees, compressees le cas echeant
224
-		// (on ouvre un nouveau pointeur sur le fichier, ce qui a l'avantage
225
-		// de le recreer si le locker qui nous precede l'avait supprime...)
226
-		if (substr($fichier, -3) == '.gz') {
227
-			$contenu = gzencode($contenu);
228
-		}
229
-		// si c'est une ecriture avec troncation , on fait plutot une ecriture complete a cote suivie unlink+rename
230
-		// pour etre sur d'avoir une operation atomique
231
-		// y compris en NFS : http://www.ietf.org/rfc/rfc1094.txt
232
-		// sauf sous wintruc ou ca ne marche pas
233
-		$ok = false;
234
-		if ($truncate and _OS_SERVEUR != 'windows') {
235
-			if (!function_exists('creer_uniqid')) {
236
-				include_spip('inc/acces');
237
-			}
238
-			$id = creer_uniqid();
239
-			// on ouvre un pointeur sur un fichier temporaire en ecriture +raz
240
-			if ($fp2 = spip_fopen_lock("$fichier.$id", 'w', LOCK_EX)) {
241
-				$s = @fputs($fp2, $contenu, $a = strlen($contenu));
242
-				$ok = ($s == $a);
243
-				spip_fclose_unlock($fp2);
244
-				spip_fclose_unlock($fp);
245
-				// unlink direct et pas spip_unlink car on avait deja le verrou
246
-				// a priori pas besoin car rename ecrase la cible
247
-				// @unlink($fichier);
248
-				// le rename aussitot, atomique quand on est pas sous windows
249
-				// au pire on arrive en second en cas de concourance, et le rename echoue
250
-				// --> on a la version de l'autre process qui doit etre identique
251
-				@rename("$fichier.$id", $fichier);
252
-				// precaution en cas d'echec du rename
253
-				if (!_TEST_FILE_EXISTS or @file_exists("$fichier.$id")) {
254
-					@unlink("$fichier.$id");
255
-				}
256
-				if ($ok) {
257
-					$ok = file_exists($fichier);
258
-				}
259
-			} else // echec mais penser a fermer ..
260
-			{
261
-				spip_fclose_unlock($fp);
262
-			}
263
-		}
264
-		// sinon ou si methode precedente a echoueee
265
-		// on se rabat sur la methode ancienne
266
-		if (!$ok) {
267
-			// ici on est en ajout ou sous windows, cas desespere
268
-			if ($truncate) {
269
-				@ftruncate($fp, 0);
270
-			}
271
-			$s = @fputs($fp, $contenu, $a = strlen($contenu));
272
-
273
-			$ok = ($s == $a);
274
-			spip_fclose_unlock($fp);
275
-		}
276
-
277
-		// liberer le verrou et fermer le fichier
278
-		@chmod($fichier, _SPIP_CHMOD & 0666);
279
-		if ($ok) {
280
-			if (strpos($fichier, '.php') !== false) {
281
-				spip_clear_opcode_cache(realpath($fichier));
282
-			}
283
-
284
-			return $ok;
285
-		}
286
-	}
287
-
288
-	if (!$ignorer_echec) {
289
-		include_spip('inc/autoriser');
290
-		if (autoriser('chargerftp')) {
291
-			raler_fichier($fichier);
292
-		}
293
-		spip_unlink($fichier);
294
-	}
295
-	spip_log("Ecriture fichier $fichier impossible", _LOG_INFO_IMPORTANTE);
296
-
297
-	return false;
219
+    #spip_timer('ecrire_fichier');
220
+
221
+    // verrouiller le fichier destination
222
+    if ($fp = spip_fopen_lock($fichier, 'a', LOCK_EX)) {
223
+        // ecrire les donnees, compressees le cas echeant
224
+        // (on ouvre un nouveau pointeur sur le fichier, ce qui a l'avantage
225
+        // de le recreer si le locker qui nous precede l'avait supprime...)
226
+        if (substr($fichier, -3) == '.gz') {
227
+            $contenu = gzencode($contenu);
228
+        }
229
+        // si c'est une ecriture avec troncation , on fait plutot une ecriture complete a cote suivie unlink+rename
230
+        // pour etre sur d'avoir une operation atomique
231
+        // y compris en NFS : http://www.ietf.org/rfc/rfc1094.txt
232
+        // sauf sous wintruc ou ca ne marche pas
233
+        $ok = false;
234
+        if ($truncate and _OS_SERVEUR != 'windows') {
235
+            if (!function_exists('creer_uniqid')) {
236
+                include_spip('inc/acces');
237
+            }
238
+            $id = creer_uniqid();
239
+            // on ouvre un pointeur sur un fichier temporaire en ecriture +raz
240
+            if ($fp2 = spip_fopen_lock("$fichier.$id", 'w', LOCK_EX)) {
241
+                $s = @fputs($fp2, $contenu, $a = strlen($contenu));
242
+                $ok = ($s == $a);
243
+                spip_fclose_unlock($fp2);
244
+                spip_fclose_unlock($fp);
245
+                // unlink direct et pas spip_unlink car on avait deja le verrou
246
+                // a priori pas besoin car rename ecrase la cible
247
+                // @unlink($fichier);
248
+                // le rename aussitot, atomique quand on est pas sous windows
249
+                // au pire on arrive en second en cas de concourance, et le rename echoue
250
+                // --> on a la version de l'autre process qui doit etre identique
251
+                @rename("$fichier.$id", $fichier);
252
+                // precaution en cas d'echec du rename
253
+                if (!_TEST_FILE_EXISTS or @file_exists("$fichier.$id")) {
254
+                    @unlink("$fichier.$id");
255
+                }
256
+                if ($ok) {
257
+                    $ok = file_exists($fichier);
258
+                }
259
+            } else // echec mais penser a fermer ..
260
+            {
261
+                spip_fclose_unlock($fp);
262
+            }
263
+        }
264
+        // sinon ou si methode precedente a echoueee
265
+        // on se rabat sur la methode ancienne
266
+        if (!$ok) {
267
+            // ici on est en ajout ou sous windows, cas desespere
268
+            if ($truncate) {
269
+                @ftruncate($fp, 0);
270
+            }
271
+            $s = @fputs($fp, $contenu, $a = strlen($contenu));
272
+
273
+            $ok = ($s == $a);
274
+            spip_fclose_unlock($fp);
275
+        }
276
+
277
+        // liberer le verrou et fermer le fichier
278
+        @chmod($fichier, _SPIP_CHMOD & 0666);
279
+        if ($ok) {
280
+            if (strpos($fichier, '.php') !== false) {
281
+                spip_clear_opcode_cache(realpath($fichier));
282
+            }
283
+
284
+            return $ok;
285
+        }
286
+    }
287
+
288
+    if (!$ignorer_echec) {
289
+        include_spip('inc/autoriser');
290
+        if (autoriser('chargerftp')) {
291
+            raler_fichier($fichier);
292
+        }
293
+        spip_unlink($fichier);
294
+    }
295
+    spip_log("Ecriture fichier $fichier impossible", _LOG_INFO_IMPORTANTE);
296
+
297
+    return false;
298 298
 }
299 299
 
300 300
 /**
@@ -314,12 +314,12 @@  discard block
 block discarded – undo
314 314
  *     Écriture avec troncation ?
315 315
  */
316 316
 function ecrire_fichier_securise($fichier, $contenu, $ecrire_quand_meme = false, $truncate = true) {
317
-	if (substr($fichier, -4) !== '.php') {
318
-		spip_log('Erreur de programmation: ' . $fichier . ' doit finir par .php');
319
-	}
320
-	$contenu = '<' . "?php die ('Acces interdit'); ?" . ">\n" . $contenu;
317
+    if (substr($fichier, -4) !== '.php') {
318
+        spip_log('Erreur de programmation: ' . $fichier . ' doit finir par .php');
319
+    }
320
+    $contenu = '<' . "?php die ('Acces interdit'); ?" . ">\n" . $contenu;
321 321
 
322
-	return ecrire_fichier($fichier, $contenu, $ecrire_quand_meme, $truncate);
322
+    return ecrire_fichier($fichier, $contenu, $ecrire_quand_meme, $truncate);
323 323
 }
324 324
 
325 325
 
@@ -330,25 +330,25 @@  discard block
 block discarded – undo
330 330
  * @return bool
331 331
  */
332 332
 function ecrire_fichier_calcule_si_modifie($fichier, $contenu, $force = false, $use_copy = false) {
333
-	$fichier_tmp = $fichier . '.last';
334
-	if (!ecrire_fichier($fichier_tmp, $contenu, true)) {
335
-		return false;
336
-	}
337
-	if (
338
-		$force
339
-		or !file_exists($fichier)
340
-		or md5_file($fichier) != md5_file($fichier_tmp)
341
-	) {
342
-		if ($use_copy) {
343
-			@copy($fichier_tmp, $fichier);
344
-		}
345
-		else {
346
-			@rename($fichier_tmp, $fichier);
347
-		}
348
-		// eviter que PHP ne reserve le vieux timestamp
349
-		clearstatcache(true, $fichier);
350
-	}
351
-	return true;
333
+    $fichier_tmp = $fichier . '.last';
334
+    if (!ecrire_fichier($fichier_tmp, $contenu, true)) {
335
+        return false;
336
+    }
337
+    if (
338
+        $force
339
+        or !file_exists($fichier)
340
+        or md5_file($fichier) != md5_file($fichier_tmp)
341
+    ) {
342
+        if ($use_copy) {
343
+            @copy($fichier_tmp, $fichier);
344
+        }
345
+        else {
346
+            @rename($fichier_tmp, $fichier);
347
+        }
348
+        // eviter que PHP ne reserve le vieux timestamp
349
+        clearstatcache(true, $fichier);
350
+    }
351
+    return true;
352 352
 }
353 353
 
354 354
 
@@ -369,11 +369,11 @@  discard block
 block discarded – undo
369 369
  *     true si l'opération a réussie, false sinon.
370 370
  */
371 371
 function lire_fichier_securise($fichier, &$contenu, $options = []) {
372
-	if ($res = lire_fichier($fichier, $contenu, $options)) {
373
-		$contenu = substr($contenu, strlen('<' . "?php die ('Acces interdit'); ?" . ">\n"));
374
-	}
372
+    if ($res = lire_fichier($fichier, $contenu, $options)) {
373
+        $contenu = substr($contenu, strlen('<' . "?php die ('Acces interdit'); ?" . ">\n"));
374
+    }
375 375
 
376
-	return $res;
376
+    return $res;
377 377
 }
378 378
 
379 379
 /**
@@ -388,25 +388,25 @@  discard block
 block discarded – undo
388 388
  *     Chemin du fichier
389 389
  **/
390 390
 function raler_fichier($fichier) {
391
-	if (!defined('_SPIP_ECRIRE_SCRIPT')) {
392
-		spip_initialisation_suite();
393
-	}
394
-	include_spip('inc/minipres');
395
-	$dir = dirname($fichier);
396
-	http_response_code(401);
397
-	echo minipres(_T('texte_inc_meta_2'), "<h4 style='color: red'>"
398
-		. _T('texte_inc_meta_1', ['fichier' => $fichier])
399
-		. " <a href='"
400
-		. generer_url_ecrire('install', "etape=chmod&test_dir=$dir")
401
-		. "'>"
402
-		. _T('texte_inc_meta_2')
403
-		. '</a> '
404
-		. _T(
405
-			'texte_inc_meta_3',
406
-			['repertoire' => joli_repertoire($dir)]
407
-		)
408
-		. "</h4>\n");
409
-	exit;
391
+    if (!defined('_SPIP_ECRIRE_SCRIPT')) {
392
+        spip_initialisation_suite();
393
+    }
394
+    include_spip('inc/minipres');
395
+    $dir = dirname($fichier);
396
+    http_response_code(401);
397
+    echo minipres(_T('texte_inc_meta_2'), "<h4 style='color: red'>"
398
+        . _T('texte_inc_meta_1', ['fichier' => $fichier])
399
+        . " <a href='"
400
+        . generer_url_ecrire('install', "etape=chmod&test_dir=$dir")
401
+        . "'>"
402
+        . _T('texte_inc_meta_2')
403
+        . '</a> '
404
+        . _T(
405
+            'texte_inc_meta_3',
406
+            ['repertoire' => joli_repertoire($dir)]
407
+        )
408
+        . "</h4>\n");
409
+    exit;
410 410
 }
411 411
 
412 412
 
@@ -421,14 +421,14 @@  discard block
 block discarded – undo
421 421
  *     - true si récent, false sinon
422 422
  */
423 423
 function jeune_fichier($fichier, $n) {
424
-	if (!file_exists($fichier)) {
425
-		return false;
426
-	}
427
-	if (!$c = @filemtime($fichier)) {
428
-		return false;
429
-	}
430
-
431
-	return (time() - $n <= $c);
424
+    if (!file_exists($fichier)) {
425
+        return false;
426
+    }
427
+    if (!$c = @filemtime($fichier)) {
428
+        return false;
429
+    }
430
+
431
+    return (time() - $n <= $c);
432 432
 }
433 433
 
434 434
 /**
@@ -443,22 +443,22 @@  discard block
 block discarded – undo
443 443
  *     - false si on n'arrive pas poser le verrou ou si la suppression échoue
444 444
  */
445 445
 function supprimer_fichier($fichier, $lock = true) {
446
-	if (!@file_exists($fichier)) {
447
-		return true;
448
-	}
449
-
450
-	if ($lock) {
451
-		// verrouiller le fichier destination
452
-		if (!$fp = spip_fopen_lock($fichier, 'a', LOCK_EX)) {
453
-			return false;
454
-		}
455
-
456
-		// liberer le verrou
457
-		spip_fclose_unlock($fp);
458
-	}
459
-
460
-	// supprimer
461
-	return @unlink($fichier);
446
+    if (!@file_exists($fichier)) {
447
+        return true;
448
+    }
449
+
450
+    if ($lock) {
451
+        // verrouiller le fichier destination
452
+        if (!$fp = spip_fopen_lock($fichier, 'a', LOCK_EX)) {
453
+            return false;
454
+        }
455
+
456
+        // liberer le verrou
457
+        spip_fclose_unlock($fp);
458
+    }
459
+
460
+    // supprimer
461
+    return @unlink($fichier);
462 462
 }
463 463
 
464 464
 /**
@@ -468,12 +468,12 @@  discard block
 block discarded – undo
468 468
  *     Chemin du fichier
469 469
  */
470 470
 function spip_unlink($f) {
471
-	if (!is_dir($f)) {
472
-		supprimer_fichier($f, false);
473
-	} else {
474
-		@unlink("$f/.ok");
475
-		@rmdir($f);
476
-	}
471
+    if (!is_dir($f)) {
472
+        supprimer_fichier($f, false);
473
+    } else {
474
+        @unlink("$f/.ok");
475
+        @rmdir($f);
476
+    }
477 477
 }
478 478
 
479 479
 /**
@@ -487,26 +487,26 @@  discard block
 block discarded – undo
487 487
  *   The absolute path of the PHP file to invalidate.
488 488
  */
489 489
 function spip_clear_opcode_cache($filepath) {
490
-	clearstatcache(true, $filepath);
491
-
492
-	// Zend OPcache
493
-	if (function_exists('opcache_invalidate')) {
494
-		$invalidate = @opcache_invalidate($filepath, true);
495
-		// si l'invalidation a echoue lever un flag
496
-		if (!$invalidate and !defined('_spip_attend_invalidation_opcode_cache')) {
497
-			define('_spip_attend_invalidation_opcode_cache', true);
498
-		}
499
-	} elseif (!defined('_spip_attend_invalidation_opcode_cache')) {
500
-		// n'agira que si opcache est effectivement actif (il semble qu'on a pas toujours la fonction opcache_invalidate)
501
-		define('_spip_attend_invalidation_opcode_cache', true);
502
-	}
503
-	// APC.
504
-	if (function_exists('apc_delete_file')) {
505
-		// apc_delete_file() throws a PHP warning in case the specified file was
506
-		// not compiled yet.
507
-		// @see http://php.net/apc-delete-file
508
-		@apc_delete_file($filepath);
509
-	}
490
+    clearstatcache(true, $filepath);
491
+
492
+    // Zend OPcache
493
+    if (function_exists('opcache_invalidate')) {
494
+        $invalidate = @opcache_invalidate($filepath, true);
495
+        // si l'invalidation a echoue lever un flag
496
+        if (!$invalidate and !defined('_spip_attend_invalidation_opcode_cache')) {
497
+            define('_spip_attend_invalidation_opcode_cache', true);
498
+        }
499
+    } elseif (!defined('_spip_attend_invalidation_opcode_cache')) {
500
+        // n'agira que si opcache est effectivement actif (il semble qu'on a pas toujours la fonction opcache_invalidate)
501
+        define('_spip_attend_invalidation_opcode_cache', true);
502
+    }
503
+    // APC.
504
+    if (function_exists('apc_delete_file')) {
505
+        // apc_delete_file() throws a PHP warning in case the specified file was
506
+        // not compiled yet.
507
+        // @see http://php.net/apc-delete-file
508
+        @apc_delete_file($filepath);
509
+    }
510 510
 }
511 511
 
512 512
 /**
@@ -529,25 +529,25 @@  discard block
 block discarded – undo
529 529
  *
530 530
  */
531 531
 function spip_attend_invalidation_opcode_cache($timestamp = null) {
532
-	if (
533
-		function_exists('opcache_get_configuration')
534
-		and @ini_get('opcache.enable')
535
-		and @ini_get('opcache.validate_timestamps')
536
-		and ($duree = intval(@ini_get('opcache.revalidate_freq')) or $duree = 2)
537
-		and defined('_spip_attend_invalidation_opcode_cache') // des invalidations ont echouees
538
-	) {
539
-		$wait = $duree + 1;
540
-		if ($timestamp) {
541
-			$wait -= (time() - $timestamp);
542
-			if ($wait < 0) {
543
-				$wait = 0;
544
-			}
545
-		}
546
-		spip_log('Probleme de configuration opcache.revalidate_freq ' . $duree . 's : on attend ' . $wait . 's', _LOG_INFO_IMPORTANTE);
547
-		if ($wait) {
548
-			sleep($duree + 1);
549
-		}
550
-	}
532
+    if (
533
+        function_exists('opcache_get_configuration')
534
+        and @ini_get('opcache.enable')
535
+        and @ini_get('opcache.validate_timestamps')
536
+        and ($duree = intval(@ini_get('opcache.revalidate_freq')) or $duree = 2)
537
+        and defined('_spip_attend_invalidation_opcode_cache') // des invalidations ont echouees
538
+    ) {
539
+        $wait = $duree + 1;
540
+        if ($timestamp) {
541
+            $wait -= (time() - $timestamp);
542
+            if ($wait < 0) {
543
+                $wait = 0;
544
+            }
545
+        }
546
+        spip_log('Probleme de configuration opcache.revalidate_freq ' . $duree . 's : on attend ' . $wait . 's', _LOG_INFO_IMPORTANTE);
547
+        if ($wait) {
548
+            sleep($duree + 1);
549
+        }
550
+    }
551 551
 }
552 552
 
553 553
 
@@ -560,26 +560,26 @@  discard block
 block discarded – undo
560 560
  * @return bool Suppression reussie.
561 561
  */
562 562
 function supprimer_repertoire($dir) {
563
-	if (!file_exists($dir)) {
564
-		return true;
565
-	}
566
-	if (!is_dir($dir) || is_link($dir)) {
567
-		return @unlink($dir);
568
-	}
569
-
570
-	foreach (scandir($dir) as $item) {
571
-		if ($item == '.' || $item == '..') {
572
-			continue;
573
-		}
574
-		if (!supprimer_repertoire($dir . '/' . $item)) {
575
-			@chmod($dir . '/' . $item, 0777);
576
-			if (!supprimer_repertoire($dir . '/' . $item)) {
577
-				return false;
578
-			}
579
-		};
580
-	}
581
-
582
-	return @rmdir($dir);
563
+    if (!file_exists($dir)) {
564
+        return true;
565
+    }
566
+    if (!is_dir($dir) || is_link($dir)) {
567
+        return @unlink($dir);
568
+    }
569
+
570
+    foreach (scandir($dir) as $item) {
571
+        if ($item == '.' || $item == '..') {
572
+            continue;
573
+        }
574
+        if (!supprimer_repertoire($dir . '/' . $item)) {
575
+            @chmod($dir . '/' . $item, 0777);
576
+            if (!supprimer_repertoire($dir . '/' . $item)) {
577
+                return false;
578
+            }
579
+        };
580
+    }
581
+
582
+    return @rmdir($dir);
583 583
 }
584 584
 
585 585
 
@@ -608,57 +608,57 @@  discard block
 block discarded – undo
608 608
  *     Chemin du répertoire créé.
609 609
  **/
610 610
 function sous_repertoire($base, $subdir = '', $nobase = false, $tantpis = false) {
611
-	static $dirs = [];
612
-
613
-	$base = str_replace('//', '/', $base);
614
-
615
-	# suppr le dernier caractere si c'est un /
616
-	$base = rtrim($base, '/');
617
-
618
-	if (!strlen($subdir)) {
619
-		$n = strrpos($base, '/');
620
-		if ($n === false) {
621
-			return $nobase ? '' : ($base . '/');
622
-		}
623
-		$subdir = substr($base, $n + 1);
624
-		$base = substr($base, 0, $n + 1);
625
-	} else {
626
-		$base .= '/';
627
-		$subdir = str_replace('/', '', $subdir);
628
-	}
629
-
630
-	$baseaff = $nobase ? '' : $base;
631
-	if (isset($dirs[$base . $subdir])) {
632
-		return $baseaff . $dirs[$base . $subdir];
633
-	}
634
-
635
-	$path = $base . $subdir; # $path = 'IMG/distant/pdf' ou 'IMG/distant_pdf'
636
-
637
-	if (file_exists("$path/.ok")) {
638
-		return $baseaff . ($dirs[$base . $subdir] = "$subdir/");
639
-	}
640
-
641
-	@mkdir($path, _SPIP_CHMOD);
642
-	@chmod($path, _SPIP_CHMOD);
643
-
644
-	if (is_dir($path) && is_writable($path)) {
645
-		@touch("$path/.ok");
646
-		spip_log("creation $base$subdir/");
647
-
648
-		return $baseaff . ($dirs[$base . $subdir] = "$subdir/");
649
-	}
650
-
651
-	// en cas d'echec c'est peut etre tout simplement que le disque est plein :
652
-	// l'inode du fichier dir_test existe, mais impossible d'y mettre du contenu
653
-	spip_log("echec creation $base{$subdir}");
654
-	if ($tantpis) {
655
-		return '';
656
-	}
657
-	if (!_DIR_RESTREINT) {
658
-		$base = preg_replace(',^' . _DIR_RACINE . ',', '', $base);
659
-	}
660
-	$base .= $subdir;
661
-	raler_fichier($base . '/.ok');
611
+    static $dirs = [];
612
+
613
+    $base = str_replace('//', '/', $base);
614
+
615
+    # suppr le dernier caractere si c'est un /
616
+    $base = rtrim($base, '/');
617
+
618
+    if (!strlen($subdir)) {
619
+        $n = strrpos($base, '/');
620
+        if ($n === false) {
621
+            return $nobase ? '' : ($base . '/');
622
+        }
623
+        $subdir = substr($base, $n + 1);
624
+        $base = substr($base, 0, $n + 1);
625
+    } else {
626
+        $base .= '/';
627
+        $subdir = str_replace('/', '', $subdir);
628
+    }
629
+
630
+    $baseaff = $nobase ? '' : $base;
631
+    if (isset($dirs[$base . $subdir])) {
632
+        return $baseaff . $dirs[$base . $subdir];
633
+    }
634
+
635
+    $path = $base . $subdir; # $path = 'IMG/distant/pdf' ou 'IMG/distant_pdf'
636
+
637
+    if (file_exists("$path/.ok")) {
638
+        return $baseaff . ($dirs[$base . $subdir] = "$subdir/");
639
+    }
640
+
641
+    @mkdir($path, _SPIP_CHMOD);
642
+    @chmod($path, _SPIP_CHMOD);
643
+
644
+    if (is_dir($path) && is_writable($path)) {
645
+        @touch("$path/.ok");
646
+        spip_log("creation $base$subdir/");
647
+
648
+        return $baseaff . ($dirs[$base . $subdir] = "$subdir/");
649
+    }
650
+
651
+    // en cas d'echec c'est peut etre tout simplement que le disque est plein :
652
+    // l'inode du fichier dir_test existe, mais impossible d'y mettre du contenu
653
+    spip_log("echec creation $base{$subdir}");
654
+    if ($tantpis) {
655
+        return '';
656
+    }
657
+    if (!_DIR_RESTREINT) {
658
+        $base = preg_replace(',^' . _DIR_RACINE . ',', '', $base);
659
+    }
660
+    $base .= $subdir;
661
+    raler_fichier($base . '/.ok');
662 662
 }
663 663
 
664 664
 
@@ -691,56 +691,56 @@  discard block
 block discarded – undo
691 691
  *     Chemins des fichiers trouvés.
692 692
  **/
693 693
 function preg_files($dir, $pattern = -1 /* AUTO */, $maxfiles = 10000, $recurs = []) {
694
-	$nbfiles = 0;
695
-	if ($pattern == -1) {
696
-		$pattern = '';
697
-	}
698
-	$fichiers = [];
699
-	// revenir au repertoire racine si on a recu dossier/truc
700
-	// pour regarder dossier/truc/ ne pas oublier le / final
701
-	$dir = preg_replace(',/[^/]*$,', '', $dir);
702
-	if ($dir == '') {
703
-		$dir = '.';
704
-	}
705
-
706
-	if (@is_dir($dir) and is_readable($dir) and $d = opendir($dir)) {
707
-		while (($f = readdir($d)) !== false && ($nbfiles < $maxfiles)) {
708
-			if (
709
-				$f[0] != '.' # ignorer . .. .svn etc
710
-				and $f != 'CVS'
711
-				and $f != 'remove.txt'
712
-				and is_readable($f = "$dir/$f")
713
-			) {
714
-				if (is_file($f)) {
715
-					if (!$pattern or preg_match(";$pattern;iS", $f)) {
716
-						$fichiers[] = $f;
717
-						$nbfiles++;
718
-					}
719
-				} else {
720
-					if (is_dir($f) and is_array($recurs)) {
721
-						$rp = @realpath($f);
722
-						if (!is_string($rp) or !strlen($rp)) {
723
-							$rp = $f;
724
-						} # realpath n'est peut etre pas autorise
725
-						if (!isset($recurs[$rp])) {
726
-							$recurs[$rp] = true;
727
-							$beginning = $fichiers;
728
-							$end = preg_files(
729
-								"$f/",
730
-								$pattern,
731
-								$maxfiles - $nbfiles,
732
-								$recurs
733
-							);
734
-							$fichiers = array_merge((array)$beginning, (array)$end);
735
-							$nbfiles = count($fichiers);
736
-						}
737
-					}
738
-				}
739
-			}
740
-		}
741
-		closedir($d);
742
-	}
743
-	sort($fichiers);
744
-
745
-	return $fichiers;
694
+    $nbfiles = 0;
695
+    if ($pattern == -1) {
696
+        $pattern = '';
697
+    }
698
+    $fichiers = [];
699
+    // revenir au repertoire racine si on a recu dossier/truc
700
+    // pour regarder dossier/truc/ ne pas oublier le / final
701
+    $dir = preg_replace(',/[^/]*$,', '', $dir);
702
+    if ($dir == '') {
703
+        $dir = '.';
704
+    }
705
+
706
+    if (@is_dir($dir) and is_readable($dir) and $d = opendir($dir)) {
707
+        while (($f = readdir($d)) !== false && ($nbfiles < $maxfiles)) {
708
+            if (
709
+                $f[0] != '.' # ignorer . .. .svn etc
710
+                and $f != 'CVS'
711
+                and $f != 'remove.txt'
712
+                and is_readable($f = "$dir/$f")
713
+            ) {
714
+                if (is_file($f)) {
715
+                    if (!$pattern or preg_match(";$pattern;iS", $f)) {
716
+                        $fichiers[] = $f;
717
+                        $nbfiles++;
718
+                    }
719
+                } else {
720
+                    if (is_dir($f) and is_array($recurs)) {
721
+                        $rp = @realpath($f);
722
+                        if (!is_string($rp) or !strlen($rp)) {
723
+                            $rp = $f;
724
+                        } # realpath n'est peut etre pas autorise
725
+                        if (!isset($recurs[$rp])) {
726
+                            $recurs[$rp] = true;
727
+                            $beginning = $fichiers;
728
+                            $end = preg_files(
729
+                                "$f/",
730
+                                $pattern,
731
+                                $maxfiles - $nbfiles,
732
+                                $recurs
733
+                            );
734
+                            $fichiers = array_merge((array)$beginning, (array)$end);
735
+                            $nbfiles = count($fichiers);
736
+                        }
737
+                    }
738
+                }
739
+            }
740
+        }
741
+        closedir($d);
742
+    }
743
+    sort($fichiers);
744
+
745
+    return $fichiers;
746 746
 }
Please login to merge, or discard this patch.
ecrire/inc/filtres_alertes.php 1 patch
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
  **/
19 19
 
20 20
 if (!defined('_ECRIRE_INC_VERSION')) {
21
-	return;
21
+    return;
22 22
 }
23 23
 
24 24
 /**
@@ -43,22 +43,22 @@  discard block
 block discarded – undo
43 43
  *     Pile complétée par le code à générer
44 44
  */
45 45
 function balise_ALERTE_MESSAGE_dist($p) {
46
-	$_texte = interprete_argument_balise(1, $p);
47
-	$_titre = interprete_argument_balise(2, $p);
48
-	$_class = interprete_argument_balise(3, $p);
49
-	$_role  = interprete_argument_balise(4, $p);
50
-	$_id    = interprete_argument_balise(5, $p);
51
-	$_texte = ($_texte ?: "''");
52
-	$_titre = ($_titre ? ", $_titre" : ', null');
53
-	$_class = ($_class ? ", $_class" : ', null');
54
-	$_role  = ($_role  ? ", $_role"  : ', null');
55
-	$_id    = ($_id    ? ", $_id"    : ', null');
46
+    $_texte = interprete_argument_balise(1, $p);
47
+    $_titre = interprete_argument_balise(2, $p);
48
+    $_class = interprete_argument_balise(3, $p);
49
+    $_role  = interprete_argument_balise(4, $p);
50
+    $_id    = interprete_argument_balise(5, $p);
51
+    $_texte = ($_texte ?: "''");
52
+    $_titre = ($_titre ? ", $_titre" : ', null');
53
+    $_class = ($_class ? ", $_class" : ', null');
54
+    $_role  = ($_role  ? ", $_role"  : ', null');
55
+    $_id    = ($_id    ? ", $_id"    : ', null');
56 56
 
57
-	$f = chercher_filtre('message_alerte');
58
-	$p->code = "$f($_texte$_titre$_class$_role$_id)";
59
-	$p->interdire_scripts = false;
57
+    $f = chercher_filtre('message_alerte');
58
+    $p->code = "$f($_texte$_titre$_class$_role$_id)";
59
+    $p->interdire_scripts = false;
60 60
 
61
-	return $p;
61
+    return $p;
62 62
 }
63 63
 
64 64
 /**
@@ -86,20 +86,20 @@  discard block
 block discarded – undo
86 86
  *     Pile complétée par le code à générer
87 87
  */
88 88
 function balise_ALERTE_OUVRIR_dist($p) {
89
-	$_titre = interprete_argument_balise(1, $p);
90
-	$_class = interprete_argument_balise(2, $p);
91
-	$_role  = interprete_argument_balise(3, $p);
92
-	$_id    = interprete_argument_balise(4, $p);
93
-	$_titre = ($_titre ? "$_titre"   : 'null');
94
-	$_class = ($_class ? ", $_class" : ', null');
95
-	$_role  = ($_role  ? ", $_role"  : ', null');
96
-	$_id    = ($_id    ? ", $_id"    : ', null');
89
+    $_titre = interprete_argument_balise(1, $p);
90
+    $_class = interprete_argument_balise(2, $p);
91
+    $_role  = interprete_argument_balise(3, $p);
92
+    $_id    = interprete_argument_balise(4, $p);
93
+    $_titre = ($_titre ? "$_titre"   : 'null');
94
+    $_class = ($_class ? ", $_class" : ', null');
95
+    $_role  = ($_role  ? ", $_role"  : ', null');
96
+    $_id    = ($_id    ? ", $_id"    : ', null');
97 97
 
98
-	$f = chercher_filtre('message_alerte_ouvrir');
99
-	$p->code = "$f($_titre$_class$_role$_id)";
100
-	$p->interdire_scripts = false;
98
+    $f = chercher_filtre('message_alerte_ouvrir');
99
+    $p->code = "$f($_titre$_class$_role$_id)";
100
+    $p->interdire_scripts = false;
101 101
 
102
-	return $p;
102
+    return $p;
103 103
 }
104 104
 
105 105
 /**
@@ -121,11 +121,11 @@  discard block
 block discarded – undo
121 121
  *     Pile complétée par le code à générer
122 122
  */
123 123
 function balise_ALERTE_FERMER_dist($p) {
124
-	$f = chercher_filtre('message_alerte_fermer');
125
-	$p->code = "$f()";
126
-	$p->interdire_scripts = false;
124
+    $f = chercher_filtre('message_alerte_fermer');
125
+    $p->code = "$f()";
126
+    $p->interdire_scripts = false;
127 127
 
128
-	return $p;
128
+    return $p;
129 129
 }
130 130
 
131 131
 /**
@@ -160,14 +160,14 @@  discard block
 block discarded – undo
160 160
  */
161 161
 function message_alerte(string $texte, ?string $titre = null, ?string $class = null, ?string $role = null, ?string $id = null): string {
162 162
 
163
-	$message_alerte_ouvrir = chercher_filtre('message_alerte_ouvrir');
164
-	$message_alerte_fermer = chercher_filtre('message_alerte_fermer');
165
-	$message =
166
-		$message_alerte_ouvrir($titre, $class, $role, $id) .
167
-		$texte .
168
-		$message_alerte_fermer();
163
+    $message_alerte_ouvrir = chercher_filtre('message_alerte_ouvrir');
164
+    $message_alerte_fermer = chercher_filtre('message_alerte_fermer');
165
+    $message =
166
+        $message_alerte_ouvrir($titre, $class, $role, $id) .
167
+        $texte .
168
+        $message_alerte_fermer();
169 169
 
170
-	return $message;
170
+    return $message;
171 171
 }
172 172
 
173 173
 /**
@@ -198,56 +198,56 @@  discard block
 block discarded – undo
198 198
  */
199 199
 function message_alerte_ouvrir(?string $titre = null, ?string $class = null, ?string $role = null, ?string $id = null): string {
200 200
 
201
-	$prive = test_espace_prive();
201
+    $prive = test_espace_prive();
202 202
 
203
-	// Valeurs par défaut
204
-	$titre = trim($titre ?? '');
205
-	$role ??= 'alert'; // fallback uniquement si null
206
-	$class ??= 'notice'; // fallback uniquement si null
203
+    // Valeurs par défaut
204
+    $titre = trim($titre ?? '');
205
+    $role ??= 'alert'; // fallback uniquement si null
206
+    $class ??= 'notice'; // fallback uniquement si null
207 207
 
208
-	// Type d'alerte : le chercher dans les classes, nettoyer celles-ci, puis le réinjecter
209
-	$types = [
210
-		'notice',
211
-		'error',
212
-		'success',
213
-		'info',
214
-	];
215
-	$type  = array_intersect(explode(' ', $class), $types);
216
-	$type  = reset($type);
217
-	$class = trim(str_replace($types, '', $class) . " $type");
208
+    // Type d'alerte : le chercher dans les classes, nettoyer celles-ci, puis le réinjecter
209
+    $types = [
210
+        'notice',
211
+        'error',
212
+        'success',
213
+        'info',
214
+    ];
215
+    $type  = array_intersect(explode(' ', $class), $types);
216
+    $type  = reset($type);
217
+    $class = trim(str_replace($types, '', $class) . " $type");
218 218
 
219
-	// Classes
220
-	$class_racine = 'msg-alert';
221
-	$clearfix     = ($prive ? 'clearfix' : '');
222
-	$class_alerte = "$class_racine $class";
223
-	$class_texte  = "{$class_racine}__text $clearfix";
224
-	$class_titre  = "{$class_racine}__heading";
219
+    // Classes
220
+    $class_racine = 'msg-alert';
221
+    $clearfix     = ($prive ? 'clearfix' : '');
222
+    $class_alerte = "$class_racine $class";
223
+    $class_texte  = "{$class_racine}__text $clearfix";
224
+    $class_titre  = "{$class_racine}__heading";
225 225
 
226
-	// Titre : markup
227
-	$titre = trim($titre);
228
-	if (strlen($titre)) {
229
-		include_spip('inc/filtres');
230
-		// Si besoin on encapsule le titre : un h3 dans le privé, un simple div sinon.
231
-		$cherche_tag = ($prive ? '<h' : '<');
232
-		$wrap_tag    = ($prive ? '<h3>' : '<div>');
233
-		if (strpos($titre, $cherche_tag) !== 0) {
234
-			$titre = wrap($titre, $wrap_tag);
235
-		}
236
-		// puis on ajoute la classe
237
-		$titre = ajouter_class($titre, $class_titre);
238
-	}
226
+    // Titre : markup
227
+    $titre = trim($titre);
228
+    if (strlen($titre)) {
229
+        include_spip('inc/filtres');
230
+        // Si besoin on encapsule le titre : un h3 dans le privé, un simple div sinon.
231
+        $cherche_tag = ($prive ? '<h' : '<');
232
+        $wrap_tag    = ($prive ? '<h3>' : '<div>');
233
+        if (strpos($titre, $cherche_tag) !== 0) {
234
+            $titre = wrap($titre, $wrap_tag);
235
+        }
236
+        // puis on ajoute la classe
237
+        $titre = ajouter_class($titre, $class_titre);
238
+    }
239 239
 
240
-	// Attributs
241
-	$attr_role = ($role ? "role=\"$role\"" : '');
242
-	$attr_id   = ($id   ? "id=\"$id\"" : '');
243
-	$attr_data = ($type ? "data-alert=\"$type\"" : '');
240
+    // Attributs
241
+    $attr_role = ($role ? "role=\"$role\"" : '');
242
+    $attr_id   = ($id   ? "id=\"$id\"" : '');
243
+    $attr_data = ($type ? "data-alert=\"$type\"" : '');
244 244
 
245
-	$message =
246
-		"<div class=\"$class_alerte\" $attr_role $attr_id $attr_data>"
247
-			. $titre
248
-			. "<div class=\"$class_texte\">";
245
+    $message =
246
+        "<div class=\"$class_alerte\" $attr_role $attr_id $attr_data>"
247
+            . $titre
248
+            . "<div class=\"$class_texte\">";
249 249
 
250
-	return $message;
250
+    return $message;
251 251
 }
252 252
 
253 253
 /**
@@ -261,5 +261,5 @@  discard block
 block discarded – undo
261 261
  *     HTML de fin de l'alerte
262 262
  */
263 263
 function message_alerte_fermer(): string {
264
-	return '</div></div>';
264
+    return '</div></div>';
265 265
 }
Please login to merge, or discard this patch.
ecrire/inc/recherche_to_array.php 1 patch
Indentation   +267 added lines, -267 removed lines patch added patch discarded remove patch
@@ -11,298 +11,298 @@
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 
18 18
 // methodes sql
19 19
 function inc_recherche_to_array_dist($recherche, $options = []) {
20 20
 
21
-	// options par defaut
22
-	$options = array_merge(
23
-		[
24
-			'score' => true,
25
-			'champs' => false,
26
-			'toutvoir' => false,
27
-			'matches' => false,
28
-			'jointures' => false
29
-		],
30
-		$options
31
-	);
21
+    // options par defaut
22
+    $options = array_merge(
23
+        [
24
+            'score' => true,
25
+            'champs' => false,
26
+            'toutvoir' => false,
27
+            'matches' => false,
28
+            'jointures' => false
29
+        ],
30
+        $options
31
+    );
32 32
 
33
-	include_spip('inc/rechercher');
34
-	include_spip('inc/autoriser');
33
+    include_spip('inc/rechercher');
34
+    include_spip('inc/autoriser');
35 35
 
36
-	$requete = [
37
-		'SELECT' => [],
38
-		'FROM' => [],
39
-		'WHERE' => [],
40
-		'GROUPBY' => [],
41
-		'ORDERBY' => [],
42
-		'LIMIT' => '',
43
-		'HAVING' => []
44
-	];
36
+    $requete = [
37
+        'SELECT' => [],
38
+        'FROM' => [],
39
+        'WHERE' => [],
40
+        'GROUPBY' => [],
41
+        'ORDERBY' => [],
42
+        'LIMIT' => '',
43
+        'HAVING' => []
44
+    ];
45 45
 
46
-	$table = sinon($options['table'], 'article');
47
-	if ($options['champs']) {
48
-		$champs = $options['champs'];
49
-	} else {
50
-		$l = liste_des_champs();
51
-		$champs = $l['article'];
52
-	}
53
-	$serveur = $options['serveur'];
46
+    $table = sinon($options['table'], 'article');
47
+    if ($options['champs']) {
48
+        $champs = $options['champs'];
49
+    } else {
50
+        $l = liste_des_champs();
51
+        $champs = $l['article'];
52
+    }
53
+    $serveur = $options['serveur'];
54 54
 
55
-	[$methode, $q, $preg] = expression_recherche($recherche, $options);
55
+    [$methode, $q, $preg] = expression_recherche($recherche, $options);
56 56
 
57
-	$jointures = $options['jointures']
58
-		? liste_des_jointures()
59
-		: [];
57
+    $jointures = $options['jointures']
58
+        ? liste_des_jointures()
59
+        : [];
60 60
 
61
-	$_id_table = id_table_objet($table);
61
+    $_id_table = id_table_objet($table);
62 62
 
63
-	// c'est un pis-aller : ca a peu de chance de marcher, mais mieux quand meme que en conservant la ','
64
-	// (aka ca marche au moins dans certains cas comme avec spip_formulaires_reponses_champs)
65
-	if (strpos($_id_table, ',') !== false) {
66
-		$_id_table = explode(',', $_id_table);
67
-		$_id_table = reset($_id_table);
68
-	}
63
+    // c'est un pis-aller : ca a peu de chance de marcher, mais mieux quand meme que en conservant la ','
64
+    // (aka ca marche au moins dans certains cas comme avec spip_formulaires_reponses_champs)
65
+    if (strpos($_id_table, ',') !== false) {
66
+        $_id_table = explode(',', $_id_table);
67
+        $_id_table = reset($_id_table);
68
+    }
69 69
 
70
-	$requete['SELECT'][] = 't.' . $_id_table;
71
-	$a = [];
72
-	// Recherche fulltext
73
-	foreach ($champs as $champ => $poids) {
74
-		if (is_array($champ)) {
75
-			spip_log('requetes imbriquees interdites');
76
-		} else {
77
-			if (strpos($champ, '.') === false) {
78
-				$champ = "t.$champ";
79
-			}
80
-			$requete['SELECT'][] = $champ;
81
-			$a[] = $champ . ' ' . $methode . ' ' . $q;
82
-		}
83
-	}
84
-	if ($a) {
85
-		$requete['WHERE'][] = join(' OR ', $a);
86
-	}
87
-	$requete['FROM'][] = table_objet_sql($table) . ' AS t';
70
+    $requete['SELECT'][] = 't.' . $_id_table;
71
+    $a = [];
72
+    // Recherche fulltext
73
+    foreach ($champs as $champ => $poids) {
74
+        if (is_array($champ)) {
75
+            spip_log('requetes imbriquees interdites');
76
+        } else {
77
+            if (strpos($champ, '.') === false) {
78
+                $champ = "t.$champ";
79
+            }
80
+            $requete['SELECT'][] = $champ;
81
+            $a[] = $champ . ' ' . $methode . ' ' . $q;
82
+        }
83
+    }
84
+    if ($a) {
85
+        $requete['WHERE'][] = join(' OR ', $a);
86
+    }
87
+    $requete['FROM'][] = table_objet_sql($table) . ' AS t';
88 88
 
89
-	$results = [];
89
+    $results = [];
90 90
 
91
-	$s = sql_select(
92
-		$requete['SELECT'],
93
-		$requete['FROM'],
94
-		$requete['WHERE'],
95
-		implode(' ', $requete['GROUPBY']),
96
-		$requete['ORDERBY'],
97
-		$requete['LIMIT'],
98
-		$requete['HAVING'],
99
-		$serveur
100
-	);
91
+    $s = sql_select(
92
+        $requete['SELECT'],
93
+        $requete['FROM'],
94
+        $requete['WHERE'],
95
+        implode(' ', $requete['GROUPBY']),
96
+        $requete['ORDERBY'],
97
+        $requete['LIMIT'],
98
+        $requete['HAVING'],
99
+        $serveur
100
+    );
101 101
 
102
-	while (
103
-		$t = sql_fetch($s, $serveur)
104
-		and (!isset($t['score']) or $t['score'] > 0)
105
-	) {
106
-		$id = intval($t[$_id_table]);
102
+    while (
103
+        $t = sql_fetch($s, $serveur)
104
+        and (!isset($t['score']) or $t['score'] > 0)
105
+    ) {
106
+        $id = intval($t[$_id_table]);
107 107
 
108
-		if (
109
-			$options['toutvoir']
110
-			or autoriser('voir', $table, $id)
111
-		) {
112
-			// indiquer les champs concernes
113
-			$champs_vus = [];
114
-			$score = 0;
115
-			$matches = [];
108
+        if (
109
+            $options['toutvoir']
110
+            or autoriser('voir', $table, $id)
111
+        ) {
112
+            // indiquer les champs concernes
113
+            $champs_vus = [];
114
+            $score = 0;
115
+            $matches = [];
116 116
 
117
-			$vu = false;
118
-			foreach ($champs as $champ => $poids) {
119
-				$champ = explode('.', $champ);
120
-				$champ = end($champ);
121
-				// translitteration_rapide uniquement si on est deja en utf-8
122
-				$value = ($GLOBALS['meta']['charset'] == 'utf-8' ? translitteration_rapide($t[$champ]) : translitteration($t[$champ]));
123
-				if (
124
-					$n =
125
-					($options['score'] || $options['matches'])
126
-						? preg_match_all($preg, $value, $regs, PREG_SET_ORDER)
127
-						: preg_match($preg, $value)
128
-				) {
129
-					$vu = true;
117
+            $vu = false;
118
+            foreach ($champs as $champ => $poids) {
119
+                $champ = explode('.', $champ);
120
+                $champ = end($champ);
121
+                // translitteration_rapide uniquement si on est deja en utf-8
122
+                $value = ($GLOBALS['meta']['charset'] == 'utf-8' ? translitteration_rapide($t[$champ]) : translitteration($t[$champ]));
123
+                if (
124
+                    $n =
125
+                    ($options['score'] || $options['matches'])
126
+                        ? preg_match_all($preg, $value, $regs, PREG_SET_ORDER)
127
+                        : preg_match($preg, $value)
128
+                ) {
129
+                    $vu = true;
130 130
 
131
-					if ($options['champs']) {
132
-						$champs_vus[$champ] = $t[$champ];
133
-					}
134
-					if ($options['score']) {
135
-						// compter les points avec un peu de discernement : on pondere par la longueur du match compte en chars
136
-						$score += $poids * strlen(implode('', array_column($regs, 0)));
137
-					}
131
+                    if ($options['champs']) {
132
+                        $champs_vus[$champ] = $t[$champ];
133
+                    }
134
+                    if ($options['score']) {
135
+                        // compter les points avec un peu de discernement : on pondere par la longueur du match compte en chars
136
+                        $score += $poids * strlen(implode('', array_column($regs, 0)));
137
+                    }
138 138
 
139
-					if ($options['matches']) {
140
-						$matches[$champ] = $regs;
141
-					}
139
+                    if ($options['matches']) {
140
+                        $matches[$champ] = $regs;
141
+                    }
142 142
 
143
-					if (
144
-						!$options['champs']
145
-						and !$options['score']
146
-						and !$options['matches']
147
-					) {
148
-						break;
149
-					}
150
-				}
151
-			}
143
+                    if (
144
+                        !$options['champs']
145
+                        and !$options['score']
146
+                        and !$options['matches']
147
+                    ) {
148
+                        break;
149
+                    }
150
+                }
151
+            }
152 152
 
153
-			if ($vu) {
154
-				if (!isset($results)) {
155
-					$results = [];
156
-				}
157
-				$results[$id] = [];
158
-				if ($champs_vus) {
159
-					$results[$id]['champs'] = $champs_vus;
160
-				}
161
-				if ($score) {
162
-					$results[$id]['score'] = $score;
163
-				}
164
-				if ($matches) {
165
-					$results[$id]['matches'] = $matches;
166
-				}
167
-			}
168
-		}
169
-	}
153
+            if ($vu) {
154
+                if (!isset($results)) {
155
+                    $results = [];
156
+                }
157
+                $results[$id] = [];
158
+                if ($champs_vus) {
159
+                    $results[$id]['champs'] = $champs_vus;
160
+                }
161
+                if ($score) {
162
+                    $results[$id]['score'] = $score;
163
+                }
164
+                if ($matches) {
165
+                    $results[$id]['matches'] = $matches;
166
+                }
167
+            }
168
+        }
169
+    }
170 170
 
171 171
 
172
-	// Gerer les donnees associees
173
-	// ici on est un peu naze : pas capables de reconstruire une jointure complexe
174
-	// on ne sait passer que par table de laison en 1 coup
175
-	if (
176
-		isset($jointures[$table])
177
-		and $joints = recherche_en_base(
178
-			$recherche,
179
-			$jointures[$table],
180
-			array_merge($options, ['jointures' => false])
181
-		)
182
-	) {
183
-		include_spip('action/editer_liens');
184
-		$trouver_table = charger_fonction('trouver_table', 'base');
185
-		$cle_depart = id_table_objet($table);
186
-		$table_depart = table_objet($table, $serveur);
187
-		$desc_depart = $trouver_table($table_depart, $serveur);
188
-		$depart_associable = objet_associable($table);
189
-		foreach ($joints as $table_liee => $ids_trouves) {
190
-			// on peut definir une fonction de recherche jointe pour regler les cas particuliers
191
-			if (
192
-				!(
193
-				$rechercher_joints = charger_fonction("rechercher_joints_{$table}_{$table_liee}", 'inc', true)
194
-				or $rechercher_joints = charger_fonction("rechercher_joints_objet_{$table_liee}", 'inc', true)
195
-				or $rechercher_joints = charger_fonction("rechercher_joints_{$table}_objet_lie", 'inc', true)
196
-				)
197
-			) {
198
-				$cle_arrivee = id_table_objet($table_liee);
199
-				$table_arrivee = table_objet($table_liee, $serveur);
200
-				$desc_arrivee = $trouver_table($table_arrivee, $serveur);
201
-				// cas simple : $cle_depart dans la table_liee
202
-				if (isset($desc_arrivee['field'][$cle_depart])) {
203
-					$s = sql_select(
204
-						"$cle_depart, $cle_arrivee",
205
-						$desc_arrivee['table_sql'],
206
-						sql_in($cle_arrivee, array_keys($ids_trouves)),
207
-						'',
208
-						'',
209
-						'',
210
-						'',
211
-						$serveur
212
-					);
213
-				} // cas simple : $cle_arrivee dans la table
214
-				elseif (isset($desc_depart['field'][$cle_arrivee])) {
215
-					$s = sql_select(
216
-						"$cle_depart, $cle_arrivee",
217
-						$desc_depart['table_sql'],
218
-						sql_in($cle_arrivee, array_keys($ids_trouves)),
219
-						'',
220
-						'',
221
-						'',
222
-						'',
223
-						$serveur
224
-					);
225
-				}
226
-				// sinon cherchons une table de liaison
227
-				// cas recherche principale article, objet lie document : passer par spip_documents_liens
228
-				elseif ($l = objet_associable($table_liee)) {
229
-					[$primary, $table_liens] = $l;
230
-					$s = sql_select(
231
-						"id_objet as $cle_depart, $primary as $cle_arrivee",
232
-						$table_liens,
233
-						["objet='$table'", sql_in($primary, array_keys($ids_trouves))],
234
-						'',
235
-						'',
236
-						'',
237
-						'',
238
-						$serveur
239
-					);
240
-				} // cas recherche principale auteur, objet lie article: passer par spip_auteurs_liens
241
-				elseif ($l = $depart_associable) {
242
-					[$primary, $table_liens] = $l;
243
-					$s = sql_select(
244
-						"$primary as $cle_depart, id_objet as $cle_arrivee",
245
-						$table_liens,
246
-						["objet='$table_liee'", sql_in('id_objet', array_keys($ids_trouves))],
247
-						'',
248
-						'',
249
-						'',
250
-						'',
251
-						$serveur
252
-					);
253
-				} // cas table de liaison generique spip_xxx_yyy
254
-				elseif (
255
-					$t = $trouver_table($table_arrivee . '_' . $table_depart, $serveur)
256
-					or $t = $trouver_table($table_depart . '_' . $table_arrivee, $serveur)
257
-				) {
258
-					$s = sql_select(
259
-						"$cle_depart,$cle_arrivee",
260
-						$t['table_sql'],
261
-						sql_in($cle_arrivee, array_keys($ids_trouves)),
262
-						'',
263
-						'',
264
-						'',
265
-						'',
266
-						$serveur
267
-					);
268
-				}
269
-			} else {
270
-				[$cle_depart, $cle_arrivee, $s] = $rechercher_joints(
271
-					$table,
272
-					$table_liee,
273
-					array_keys($ids_trouves),
274
-					$serveur
275
-				);
276
-			}
172
+    // Gerer les donnees associees
173
+    // ici on est un peu naze : pas capables de reconstruire une jointure complexe
174
+    // on ne sait passer que par table de laison en 1 coup
175
+    if (
176
+        isset($jointures[$table])
177
+        and $joints = recherche_en_base(
178
+            $recherche,
179
+            $jointures[$table],
180
+            array_merge($options, ['jointures' => false])
181
+        )
182
+    ) {
183
+        include_spip('action/editer_liens');
184
+        $trouver_table = charger_fonction('trouver_table', 'base');
185
+        $cle_depart = id_table_objet($table);
186
+        $table_depart = table_objet($table, $serveur);
187
+        $desc_depart = $trouver_table($table_depart, $serveur);
188
+        $depart_associable = objet_associable($table);
189
+        foreach ($joints as $table_liee => $ids_trouves) {
190
+            // on peut definir une fonction de recherche jointe pour regler les cas particuliers
191
+            if (
192
+                !(
193
+                $rechercher_joints = charger_fonction("rechercher_joints_{$table}_{$table_liee}", 'inc', true)
194
+                or $rechercher_joints = charger_fonction("rechercher_joints_objet_{$table_liee}", 'inc', true)
195
+                or $rechercher_joints = charger_fonction("rechercher_joints_{$table}_objet_lie", 'inc', true)
196
+                )
197
+            ) {
198
+                $cle_arrivee = id_table_objet($table_liee);
199
+                $table_arrivee = table_objet($table_liee, $serveur);
200
+                $desc_arrivee = $trouver_table($table_arrivee, $serveur);
201
+                // cas simple : $cle_depart dans la table_liee
202
+                if (isset($desc_arrivee['field'][$cle_depart])) {
203
+                    $s = sql_select(
204
+                        "$cle_depart, $cle_arrivee",
205
+                        $desc_arrivee['table_sql'],
206
+                        sql_in($cle_arrivee, array_keys($ids_trouves)),
207
+                        '',
208
+                        '',
209
+                        '',
210
+                        '',
211
+                        $serveur
212
+                    );
213
+                } // cas simple : $cle_arrivee dans la table
214
+                elseif (isset($desc_depart['field'][$cle_arrivee])) {
215
+                    $s = sql_select(
216
+                        "$cle_depart, $cle_arrivee",
217
+                        $desc_depart['table_sql'],
218
+                        sql_in($cle_arrivee, array_keys($ids_trouves)),
219
+                        '',
220
+                        '',
221
+                        '',
222
+                        '',
223
+                        $serveur
224
+                    );
225
+                }
226
+                // sinon cherchons une table de liaison
227
+                // cas recherche principale article, objet lie document : passer par spip_documents_liens
228
+                elseif ($l = objet_associable($table_liee)) {
229
+                    [$primary, $table_liens] = $l;
230
+                    $s = sql_select(
231
+                        "id_objet as $cle_depart, $primary as $cle_arrivee",
232
+                        $table_liens,
233
+                        ["objet='$table'", sql_in($primary, array_keys($ids_trouves))],
234
+                        '',
235
+                        '',
236
+                        '',
237
+                        '',
238
+                        $serveur
239
+                    );
240
+                } // cas recherche principale auteur, objet lie article: passer par spip_auteurs_liens
241
+                elseif ($l = $depart_associable) {
242
+                    [$primary, $table_liens] = $l;
243
+                    $s = sql_select(
244
+                        "$primary as $cle_depart, id_objet as $cle_arrivee",
245
+                        $table_liens,
246
+                        ["objet='$table_liee'", sql_in('id_objet', array_keys($ids_trouves))],
247
+                        '',
248
+                        '',
249
+                        '',
250
+                        '',
251
+                        $serveur
252
+                    );
253
+                } // cas table de liaison generique spip_xxx_yyy
254
+                elseif (
255
+                    $t = $trouver_table($table_arrivee . '_' . $table_depart, $serveur)
256
+                    or $t = $trouver_table($table_depart . '_' . $table_arrivee, $serveur)
257
+                ) {
258
+                    $s = sql_select(
259
+                        "$cle_depart,$cle_arrivee",
260
+                        $t['table_sql'],
261
+                        sql_in($cle_arrivee, array_keys($ids_trouves)),
262
+                        '',
263
+                        '',
264
+                        '',
265
+                        '',
266
+                        $serveur
267
+                    );
268
+                }
269
+            } else {
270
+                [$cle_depart, $cle_arrivee, $s] = $rechercher_joints(
271
+                    $table,
272
+                    $table_liee,
273
+                    array_keys($ids_trouves),
274
+                    $serveur
275
+                );
276
+            }
277 277
 
278
-			while ($t = is_array($s) ? array_shift($s) : sql_fetch($s)) {
279
-				$id = $t[$cle_depart];
280
-				$joint = $ids_trouves[$t[$cle_arrivee]];
281
-				if (!isset($results)) {
282
-					$results = [];
283
-				}
284
-				if (!isset($results[$id])) {
285
-					$results[$id] = [];
286
-				}
287
-				if (isset($joint['score']) and $joint['score']) {
288
-					if (!isset($results[$id]['score'])) {
289
-						$results[$id]['score'] = 0;
290
-					}
291
-					$results[$id]['score'] += $joint['score'];
292
-				}
293
-				if (isset($joint['champs']) and $joint['champs']) {
294
-					foreach ($joint['champs'] as $c => $val) {
295
-						$results[$id]['champs'][$table_liee . '.' . $c] = $val;
296
-					}
297
-				}
298
-				if (isset($joint['matches']) and $joint['matches']) {
299
-					foreach ($joint['matches'] as $c => $val) {
300
-						$results[$id]['matches'][$table_liee . '.' . $c] = $val;
301
-					}
302
-				}
303
-			}
304
-		}
305
-	}
278
+            while ($t = is_array($s) ? array_shift($s) : sql_fetch($s)) {
279
+                $id = $t[$cle_depart];
280
+                $joint = $ids_trouves[$t[$cle_arrivee]];
281
+                if (!isset($results)) {
282
+                    $results = [];
283
+                }
284
+                if (!isset($results[$id])) {
285
+                    $results[$id] = [];
286
+                }
287
+                if (isset($joint['score']) and $joint['score']) {
288
+                    if (!isset($results[$id]['score'])) {
289
+                        $results[$id]['score'] = 0;
290
+                    }
291
+                    $results[$id]['score'] += $joint['score'];
292
+                }
293
+                if (isset($joint['champs']) and $joint['champs']) {
294
+                    foreach ($joint['champs'] as $c => $val) {
295
+                        $results[$id]['champs'][$table_liee . '.' . $c] = $val;
296
+                    }
297
+                }
298
+                if (isset($joint['matches']) and $joint['matches']) {
299
+                    foreach ($joint['matches'] as $c => $val) {
300
+                        $results[$id]['matches'][$table_liee . '.' . $c] = $val;
301
+                    }
302
+                }
303
+            }
304
+        }
305
+    }
306 306
 
307
-	return $results;
307
+    return $results;
308 308
 }
Please login to merge, or discard this patch.
ecrire/public/balises.php 1 patch
Indentation   +941 added lines, -941 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  **/
27 27
 
28 28
 if (!defined('_ECRIRE_INC_VERSION')) {
29
-	return;
29
+    return;
30 30
 }
31 31
 
32 32
 /**
@@ -48,16 +48,16 @@  discard block
 block discarded – undo
48 48
  *     Code PHP si cet argument est présent, sinon null
49 49
  **/
50 50
 function interprete_argument_balise(int $n, Champ $p): ?string {
51
-	if (($p->param) && (!$p->param[0][0]) && ((is_countable($p->param[0]) ? count($p->param[0]) : 0) > $n)) {
52
-		return calculer_liste(
53
-			$p->param[0][$n],
54
-			$p->descr,
55
-			$p->boucles,
56
-			$p->id_boucle
57
-		);
58
-	} else {
59
-		return null;
60
-	}
51
+    if (($p->param) && (!$p->param[0][0]) && ((is_countable($p->param[0]) ? count($p->param[0]) : 0) > $n)) {
52
+        return calculer_liste(
53
+            $p->param[0][$n],
54
+            $p->descr,
55
+            $p->boucles,
56
+            $p->id_boucle
57
+        );
58
+    } else {
59
+        return null;
60
+    }
61 61
 }
62 62
 
63 63
 
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
  *     Pile complétée par le code à générer
78 78
  **/
79 79
 function balise_NOM_SITE_SPIP_dist($p) {
80
-	$p->code = "\$GLOBALS['meta']['nom_site']";
80
+    $p->code = "\$GLOBALS['meta']['nom_site']";
81 81
 
82
-	#$p->interdire_scripts = true;
83
-	return $p;
82
+    #$p->interdire_scripts = true;
83
+    return $p;
84 84
 }
85 85
 
86 86
 /**
@@ -96,10 +96,10 @@  discard block
 block discarded – undo
96 96
  *     Pile complétée par le code à générer
97 97
  **/
98 98
 function balise_EMAIL_WEBMASTER_dist($p) {
99
-	$p->code = "\$GLOBALS['meta']['email_webmaster']";
99
+    $p->code = "\$GLOBALS['meta']['email_webmaster']";
100 100
 
101
-	#$p->interdire_scripts = true;
102
-	return $p;
101
+    #$p->interdire_scripts = true;
102
+    return $p;
103 103
 }
104 104
 
105 105
 /**
@@ -115,10 +115,10 @@  discard block
 block discarded – undo
115 115
  *     Pile complétée par le code à générer
116 116
  **/
117 117
 function balise_DESCRIPTIF_SITE_SPIP_dist($p) {
118
-	$p->code = "\$GLOBALS['meta']['descriptif_site']";
118
+    $p->code = "\$GLOBALS['meta']['descriptif_site']";
119 119
 
120
-	#$p->interdire_scripts = true;
121
-	return $p;
120
+    #$p->interdire_scripts = true;
121
+    return $p;
122 122
 }
123 123
 
124 124
 
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
  *     Pile complétée par le code à générer
140 140
  **/
141 141
 function balise_CHARSET_dist($p) {
142
-	$p->code = "\$GLOBALS['meta']['charset']";
142
+    $p->code = "\$GLOBALS['meta']['charset']";
143 143
 
144
-	#$p->interdire_scripts = true;
145
-	return $p;
144
+    #$p->interdire_scripts = true;
145
+    return $p;
146 146
 }
147 147
 
148 148
 /**
@@ -167,11 +167,11 @@  discard block
 block discarded – undo
167 167
  *     Pile complétée par le code à générer
168 168
  **/
169 169
 function balise_LANG_LEFT_dist($p) {
170
-	$_lang = champ_sql('lang', $p);
171
-	$p->code = "lang_dir($_lang, 'left','right')";
172
-	$p->interdire_scripts = false;
170
+    $_lang = champ_sql('lang', $p);
171
+    $p->code = "lang_dir($_lang, 'left','right')";
172
+    $p->interdire_scripts = false;
173 173
 
174
-	return $p;
174
+    return $p;
175 175
 }
176 176
 
177 177
 /**
@@ -191,11 +191,11 @@  discard block
 block discarded – undo
191 191
  *     Pile complétée par le code à générer
192 192
  **/
193 193
 function balise_LANG_RIGHT_dist($p) {
194
-	$_lang = champ_sql('lang', $p);
195
-	$p->code = "lang_dir($_lang, 'right','left')";
196
-	$p->interdire_scripts = false;
194
+    $_lang = champ_sql('lang', $p);
195
+    $p->code = "lang_dir($_lang, 'right','left')";
196
+    $p->interdire_scripts = false;
197 197
 
198
-	return $p;
198
+    return $p;
199 199
 }
200 200
 
201 201
 /**
@@ -220,11 +220,11 @@  discard block
 block discarded – undo
220 220
  *     Pile complétée par le code à générer
221 221
  **/
222 222
 function balise_LANG_DIR_dist($p) {
223
-	$_lang = champ_sql('lang', $p);
224
-	$p->code = "lang_dir($_lang, 'ltr','rtl')";
225
-	$p->interdire_scripts = false;
223
+    $_lang = champ_sql('lang', $p);
224
+    $p->code = "lang_dir($_lang, 'ltr','rtl')";
225
+    $p->interdire_scripts = false;
226 226
 
227
-	return $p;
227
+    return $p;
228 228
 }
229 229
 
230 230
 
@@ -241,10 +241,10 @@  discard block
 block discarded – undo
241 241
  *     Pile complétée par le code à générer
242 242
  **/
243 243
 function balise_PUCE_dist($p) {
244
-	$p->code = 'definir_puce()';
245
-	$p->interdire_scripts = false;
244
+    $p->code = 'definir_puce()';
245
+    $p->interdire_scripts = false;
246 246
 
247
-	return $p;
247
+    return $p;
248 248
 }
249 249
 
250 250
 
@@ -268,9 +268,9 @@  discard block
 block discarded – undo
268 268
  *     Pile completée du code PHP d'exécution de la balise
269 269
  */
270 270
 function balise_DATE_dist($p) {
271
-	$p->code = champ_sql('date', $p);
271
+    $p->code = champ_sql('date', $p);
272 272
 
273
-	return $p;
273
+    return $p;
274 274
 }
275 275
 
276 276
 
@@ -290,10 +290,10 @@  discard block
 block discarded – undo
290 290
  *     Pile completée du code PHP d'exécution de la balise
291 291
  */
292 292
 function balise_DATE_REDAC_dist($p) {
293
-	$p->code = champ_sql('date_redac', $p);
294
-	$p->interdire_scripts = false;
293
+    $p->code = champ_sql('date_redac', $p);
294
+    $p->interdire_scripts = false;
295 295
 
296
-	return $p;
296
+    return $p;
297 297
 }
298 298
 
299 299
 /**
@@ -312,10 +312,10 @@  discard block
 block discarded – undo
312 312
  *     Pile completée du code PHP d'exécution de la balise
313 313
  */
314 314
 function balise_DATE_MODIF_dist($p) {
315
-	$p->code = champ_sql('date_modif', $p);
316
-	$p->interdire_scripts = false;
315
+    $p->code = champ_sql('date_modif', $p);
316
+    $p->interdire_scripts = false;
317 317
 
318
-	return $p;
318
+    return $p;
319 319
 }
320 320
 
321 321
 /**
@@ -333,13 +333,13 @@  discard block
 block discarded – undo
333 333
  *     Pile completée du code PHP d'exécution de la balise
334 334
  */
335 335
 function balise_DATE_NOUVEAUTES_dist($p) {
336
-	$p->code = "((\$GLOBALS['meta']['quoi_de_neuf'] == 'oui'
336
+    $p->code = "((\$GLOBALS['meta']['quoi_de_neuf'] == 'oui'
337 337
 	AND isset(\$GLOBALS['meta']['dernier_envoi_neuf'])) ?
338 338
 	\$GLOBALS['meta']['dernier_envoi_neuf'] :
339 339
 	\"'0000-00-00'\")";
340
-	$p->interdire_scripts = false;
340
+    $p->interdire_scripts = false;
341 341
 
342
-	return $p;
342
+    return $p;
343 343
 }
344 344
 
345 345
 
@@ -357,11 +357,11 @@  discard block
 block discarded – undo
357 357
  *     Pile completée du code PHP d'exécution de la balise
358 358
  */
359 359
 function balise_DOSSIER_SQUELETTE_dist($p) {
360
-	$code = substr(addslashes(dirname($p->descr['sourcefile'])), strlen(_DIR_RACINE));
361
-	$p->code = "_DIR_RACINE . '$code'" .
362
-		$p->interdire_scripts = false;
360
+    $code = substr(addslashes(dirname($p->descr['sourcefile'])), strlen(_DIR_RACINE));
361
+    $p->code = "_DIR_RACINE . '$code'" .
362
+        $p->interdire_scripts = false;
363 363
 
364
-	return $p;
364
+    return $p;
365 365
 }
366 366
 
367 367
 /**
@@ -376,11 +376,11 @@  discard block
 block discarded – undo
376 376
  *     Pile completée du code PHP d'exécution de la balise
377 377
  */
378 378
 function balise_SQUELETTE_dist($p) {
379
-	$code = addslashes($p->descr['sourcefile']);
380
-	$p->code = "'$code'" .
381
-		$p->interdire_scripts = false;
379
+    $code = addslashes($p->descr['sourcefile']);
380
+    $p->code = "'$code'" .
381
+        $p->interdire_scripts = false;
382 382
 
383
-	return $p;
383
+    return $p;
384 384
 }
385 385
 
386 386
 /**
@@ -399,10 +399,10 @@  discard block
 block discarded – undo
399 399
  *     Pile completée du code PHP d'exécution de la balise
400 400
  */
401 401
 function balise_SPIP_VERSION_dist($p) {
402
-	$p->code = 'spip_version()';
403
-	$p->interdire_scripts = false;
402
+    $p->code = 'spip_version()';
403
+    $p->interdire_scripts = false;
404 404
 
405
-	return $p;
405
+    return $p;
406 406
 }
407 407
 
408 408
 
@@ -428,18 +428,18 @@  discard block
 block discarded – undo
428 428
  *     Pile complétée par le code à générer
429 429
  **/
430 430
 function balise_NOM_SITE_dist($p) {
431
-	if (!$p->etoile) {
432
-		$p->code = 'supprimer_numero(calculer_url(' .
433
-			champ_sql('url_site', $p) . ',' .
434
-			champ_sql('nom_site', $p) .
435
-			", 'titre', \$connect, false))";
436
-	} else {
437
-		$p->code = champ_sql('nom_site', $p);
438
-	}
431
+    if (!$p->etoile) {
432
+        $p->code = 'supprimer_numero(calculer_url(' .
433
+            champ_sql('url_site', $p) . ',' .
434
+            champ_sql('nom_site', $p) .
435
+            ", 'titre', \$connect, false))";
436
+    } else {
437
+        $p->code = champ_sql('nom_site', $p);
438
+    }
439 439
 
440
-	$p->interdire_scripts = true;
440
+    $p->interdire_scripts = true;
441 441
 
442
-	return $p;
442
+    return $p;
443 443
 }
444 444
 
445 445
 
@@ -456,11 +456,11 @@  discard block
 block discarded – undo
456 456
  *     Pile complétée par le code à générer
457 457
  **/
458 458
 function balise_NOTES_dist($p) {
459
-	// Recuperer les notes
460
-	$p->code = 'calculer_notes()';
459
+    // Recuperer les notes
460
+    $p->code = 'calculer_notes()';
461 461
 
462
-	#$p->interdire_scripts = true;
463
-	return $p;
462
+    #$p->interdire_scripts = true;
463
+    return $p;
464 464
 }
465 465
 
466 466
 
@@ -482,10 +482,10 @@  discard block
 block discarded – undo
482 482
  *     Pile complétée par le code à générer
483 483
  **/
484 484
 function balise_RECHERCHE_dist($p) {
485
-	$p->code = 'entites_html(_request("recherche"))';
486
-	$p->interdire_scripts = false;
485
+    $p->code = 'entites_html(_request("recherche"))';
486
+    $p->interdire_scripts = false;
487 487
 
488
-	return $p;
488
+    return $p;
489 489
 }
490 490
 
491 491
 
@@ -503,17 +503,17 @@  discard block
 block discarded – undo
503 503
  *     Pile complétée par le code à générer
504 504
  **/
505 505
 function balise_COMPTEUR_BOUCLE_dist($p) {
506
-	$b = index_boucle_mere($p);
507
-	if ($b === '') {
508
-		$msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]];
509
-		erreur_squelette($msg, $p);
510
-	} else {
511
-		$p->code = "(\$Numrows['$b']['compteur_boucle'] ?? 0)";
512
-		$p->boucles[$b]->cptrows = true;
513
-		$p->interdire_scripts = false;
506
+    $b = index_boucle_mere($p);
507
+    if ($b === '') {
508
+        $msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]];
509
+        erreur_squelette($msg, $p);
510
+    } else {
511
+        $p->code = "(\$Numrows['$b']['compteur_boucle'] ?? 0)";
512
+        $p->boucles[$b]->cptrows = true;
513
+        $p->interdire_scripts = false;
514 514
 
515
-		return $p;
516
-	}
515
+        return $p;
516
+    }
517 517
 }
518 518
 
519 519
 /**
@@ -531,17 +531,17 @@  discard block
 block discarded – undo
531 531
  *     Pile complétée par le code à générer
532 532
  **/
533 533
 function balise_TOTAL_BOUCLE_dist($p) {
534
-	$b = index_boucle_mere($p);
535
-	if ($b === '') {
536
-		$msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]];
537
-		erreur_squelette($msg, $p);
538
-	} else {
539
-		$p->code = "(\$Numrows['$b']['total'] ?? 0)";
540
-		$p->boucles[$b]->numrows = true;
541
-		$p->interdire_scripts = false;
542
-	}
534
+    $b = index_boucle_mere($p);
535
+    if ($b === '') {
536
+        $msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]];
537
+        erreur_squelette($msg, $p);
538
+    } else {
539
+        $p->code = "(\$Numrows['$b']['total'] ?? 0)";
540
+        $p->boucles[$b]->numrows = true;
541
+        $p->interdire_scripts = false;
542
+    }
543 543
 
544
-	return $p;
544
+    return $p;
545 545
 }
546 546
 
547 547
 
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
  *     Pile complétée par le code à générer
562 562
  **/
563 563
 function balise_POINTS_dist($p) {
564
-	return rindex_pile($p, 'points', 'recherche');
564
+    return rindex_pile($p, 'points', 'recherche');
565 565
 }
566 566
 
567 567
 
@@ -582,12 +582,12 @@  discard block
 block discarded – undo
582 582
  *     Pile complétée par le code à générer
583 583
  **/
584 584
 function balise_POPULARITE_ABSOLUE_dist($p) {
585
-	$p->code = 'ceil(' .
586
-		champ_sql('popularite', $p) .
587
-		')';
588
-	$p->interdire_scripts = false;
585
+    $p->code = 'ceil(' .
586
+        champ_sql('popularite', $p) .
587
+        ')';
588
+    $p->interdire_scripts = false;
589 589
 
590
-	return $p;
590
+    return $p;
591 591
 }
592 592
 
593 593
 /**
@@ -607,10 +607,10 @@  discard block
 block discarded – undo
607 607
  *     Pile complétée par le code à générer
608 608
  **/
609 609
 function balise_POPULARITE_SITE_dist($p) {
610
-	$p->code = 'ceil($GLOBALS["meta"][\'popularite_total\'])';
611
-	$p->interdire_scripts = false;
610
+    $p->code = 'ceil($GLOBALS["meta"][\'popularite_total\'])';
611
+    $p->interdire_scripts = false;
612 612
 
613
-	return $p;
613
+    return $p;
614 614
 }
615 615
 
616 616
 /**
@@ -631,10 +631,10 @@  discard block
 block discarded – undo
631 631
  *     Pile complétée par le code à générer
632 632
  **/
633 633
 function balise_POPULARITE_MAX_dist($p) {
634
-	$p->code = 'ceil($GLOBALS["meta"][\'popularite_max\'])';
635
-	$p->interdire_scripts = false;
634
+    $p->code = 'ceil($GLOBALS["meta"][\'popularite_max\'])';
635
+    $p->interdire_scripts = false;
636 636
 
637
-	return $p;
637
+    return $p;
638 638
 }
639 639
 
640 640
 
@@ -660,15 +660,15 @@  discard block
 block discarded – undo
660 660
  *     Pile complétée par le code à générer
661 661
  **/
662 662
 function balise_VALEUR_dist($p) {
663
-	$b = $p->nom_boucle ?: $p->id_boucle;
664
-	$p->code = index_pile($p->id_boucle, 'valeur', $p->boucles, $b);
663
+    $b = $p->nom_boucle ?: $p->id_boucle;
664
+    $p->code = index_pile($p->id_boucle, 'valeur', $p->boucles, $b);
665 665
 ;
666
-	if (($v = interprete_argument_balise(1, $p)) !== null) {
667
-		$p->code = 'table_valeur(' . $p->code . ', ' . $v . ')';
668
-	}
669
-	$p->interdire_scripts = true;
666
+    if (($v = interprete_argument_balise(1, $p)) !== null) {
667
+        $p->code = 'table_valeur(' . $p->code . ', ' . $v . ')';
668
+    }
669
+    $p->interdire_scripts = true;
670 670
 
671
-	return $p;
671
+    return $p;
672 672
 }
673 673
 
674 674
 /**
@@ -697,16 +697,16 @@  discard block
 block discarded – undo
697 697
  *     Pile complétée par le code à générer
698 698
  **/
699 699
 function balise_EXPOSE_dist($p) {
700
-	$on = "'on'";
701
-	$off = "''";
702
-	if (($v = interprete_argument_balise(1, $p)) !== null) {
703
-		$on = $v;
704
-		if (($v = interprete_argument_balise(2, $p)) !== null) {
705
-			$off = $v;
706
-		}
707
-	}
700
+    $on = "'on'";
701
+    $off = "''";
702
+    if (($v = interprete_argument_balise(1, $p)) !== null) {
703
+        $on = $v;
704
+        if (($v = interprete_argument_balise(2, $p)) !== null) {
705
+            $off = $v;
706
+        }
707
+    }
708 708
 
709
-	return calculer_balise_expose($p, $on, $off);
709
+    return calculer_balise_expose($p, $on, $off);
710 710
 }
711 711
 
712 712
 /**
@@ -724,35 +724,35 @@  discard block
 block discarded – undo
724 724
  *     Pile complétée par le code à générer
725 725
  **/
726 726
 function calculer_balise_expose($p, $on, $off) {
727
-	$b = index_boucle($p);
728
-	if (empty($p->boucles[$b]->primary)) {
729
-		$msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]];
730
-		erreur_squelette($msg, $p);
731
-	} else {
732
-		$key = $p->boucles[$b]->primary;
733
-		$type = $p->boucles[$p->id_boucle]->primary;
734
-		$desc = $p->boucles[$b]->show;
735
-		$connect = sql_quote($p->boucles[$b]->sql_serveur);
727
+    $b = index_boucle($p);
728
+    if (empty($p->boucles[$b]->primary)) {
729
+        $msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]];
730
+        erreur_squelette($msg, $p);
731
+    } else {
732
+        $key = $p->boucles[$b]->primary;
733
+        $type = $p->boucles[$p->id_boucle]->primary;
734
+        $desc = $p->boucles[$b]->show;
735
+        $connect = sql_quote($p->boucles[$b]->sql_serveur);
736 736
 
737
-		// Ne pas utiliser champ_sql, on jongle avec le nom boucle explicite
738
-		$c = index_pile($p->id_boucle, $type, $p->boucles);
737
+        // Ne pas utiliser champ_sql, on jongle avec le nom boucle explicite
738
+        $c = index_pile($p->id_boucle, $type, $p->boucles);
739 739
 
740
-		if (isset($desc['field']['id_parent'])) {
741
-			$parent = 0; // pour if (!$parent) dans calculer_expose
742
-		} elseif (isset($desc['field']['id_rubrique'])) {
743
-			$parent = index_pile($p->id_boucle, 'id_rubrique', $p->boucles, $b);
744
-		} elseif (isset($desc['field']['id_groupe'])) {
745
-			$parent = index_pile($p->id_boucle, 'id_groupe', $p->boucles, $b);
746
-		} else {
747
-			$parent = "''";
748
-		}
740
+        if (isset($desc['field']['id_parent'])) {
741
+            $parent = 0; // pour if (!$parent) dans calculer_expose
742
+        } elseif (isset($desc['field']['id_rubrique'])) {
743
+            $parent = index_pile($p->id_boucle, 'id_rubrique', $p->boucles, $b);
744
+        } elseif (isset($desc['field']['id_groupe'])) {
745
+            $parent = index_pile($p->id_boucle, 'id_groupe', $p->boucles, $b);
746
+        } else {
747
+            $parent = "''";
748
+        }
749 749
 
750
-		$p->code = "(calcul_exposer($c, '$type', \$Pile[0], $parent, '$key', $connect) ? $on : $off)";
751
-	}
750
+        $p->code = "(calcul_exposer($c, '$type', \$Pile[0], $parent, '$key', $connect) ? $on : $off)";
751
+    }
752 752
 
753
-	$p->interdire_scripts = false;
753
+    $p->interdire_scripts = false;
754 754
 
755
-	return $p;
755
+    return $p;
756 756
 }
757 757
 
758 758
 
@@ -793,46 +793,46 @@  discard block
 block discarded – undo
793 793
  **/
794 794
 function balise_INTRODUCTION_dist($p) {
795 795
 
796
-	$type_objet = $p->type_requete;
797
-	$cle_objet = id_table_objet($type_objet);
798
-	$_id_objet = champ_sql($cle_objet, $p);
799
-
800
-	// Récupérer les valeurs sql nécessaires : descriptif, texte et chapo
801
-	// ainsi que le longueur d'introduction donnée dans la description de l'objet.
802
-	$_introduction_longueur = 'null';
803
-	$_ligne = 'array(';
804
-	$trouver_table = charger_fonction('trouver_table', 'base');
805
-	if ($desc = $trouver_table(table_objet_sql($type_objet))) {
806
-		if (isset($desc['field']['descriptif'])) {
807
-			$_ligne .= "'descriptif' => " . champ_sql('descriptif', $p) . ',';
808
-		}
809
-		if (isset($desc['field']['texte'])) {
810
-			$_ligne .= "'texte' => " . champ_sql('texte', $p) . ',';
811
-		}
812
-		if (isset($desc['field']['chapo'])) {
813
-			$_ligne .= "'chapo' => " . champ_sql('chapo', $p) . ',';
814
-		}
815
-		if (isset($desc['introduction_longueur'])) {
816
-			$_introduction_longueur = "'" . $desc['introduction_longueur'] . "'";
817
-		}
818
-	}
819
-	$_ligne .= ')';
820
-
821
-	// Récupérer la longueur et la suite passés en paramètres
822
-	$_longueur_ou_suite = 'null';
823
-	if (($v1 = interprete_argument_balise(1, $p)) !== null) {
824
-		$_longueur_ou_suite = $v1;
825
-	}
826
-	$_suite = 'null';
827
-	if (($v2 = interprete_argument_balise(2, $p)) !== null) {
828
-		$_suite = $v2;
829
-	}
830
-
831
-	$p->code = "generer_objet_introduction($_id_objet, '$type_objet', $_ligne, $_introduction_longueur, $_longueur_ou_suite, $_suite, \$connect)";
832
-
833
-	#$p->interdire_scripts = true;
834
-	$p->etoile = '*'; // propre est deja fait dans le calcul de l'intro
835
-	return $p;
796
+    $type_objet = $p->type_requete;
797
+    $cle_objet = id_table_objet($type_objet);
798
+    $_id_objet = champ_sql($cle_objet, $p);
799
+
800
+    // Récupérer les valeurs sql nécessaires : descriptif, texte et chapo
801
+    // ainsi que le longueur d'introduction donnée dans la description de l'objet.
802
+    $_introduction_longueur = 'null';
803
+    $_ligne = 'array(';
804
+    $trouver_table = charger_fonction('trouver_table', 'base');
805
+    if ($desc = $trouver_table(table_objet_sql($type_objet))) {
806
+        if (isset($desc['field']['descriptif'])) {
807
+            $_ligne .= "'descriptif' => " . champ_sql('descriptif', $p) . ',';
808
+        }
809
+        if (isset($desc['field']['texte'])) {
810
+            $_ligne .= "'texte' => " . champ_sql('texte', $p) . ',';
811
+        }
812
+        if (isset($desc['field']['chapo'])) {
813
+            $_ligne .= "'chapo' => " . champ_sql('chapo', $p) . ',';
814
+        }
815
+        if (isset($desc['introduction_longueur'])) {
816
+            $_introduction_longueur = "'" . $desc['introduction_longueur'] . "'";
817
+        }
818
+    }
819
+    $_ligne .= ')';
820
+
821
+    // Récupérer la longueur et la suite passés en paramètres
822
+    $_longueur_ou_suite = 'null';
823
+    if (($v1 = interprete_argument_balise(1, $p)) !== null) {
824
+        $_longueur_ou_suite = $v1;
825
+    }
826
+    $_suite = 'null';
827
+    if (($v2 = interprete_argument_balise(2, $p)) !== null) {
828
+        $_suite = $v2;
829
+    }
830
+
831
+    $p->code = "generer_objet_introduction($_id_objet, '$type_objet', $_ligne, $_introduction_longueur, $_longueur_ou_suite, $_suite, \$connect)";
832
+
833
+    #$p->interdire_scripts = true;
834
+    $p->etoile = '*'; // propre est deja fait dans le calcul de l'intro
835
+    return $p;
836 836
 }
837 837
 
838 838
 
@@ -852,15 +852,15 @@  discard block
 block discarded – undo
852 852
  *     Pile complétée par le code à générer
853 853
  **/
854 854
 function balise_LANG_dist($p) {
855
-	$_lang = champ_sql('lang', $p);
856
-	if (!$p->etoile) {
857
-		$p->code = "spip_htmlentities($_lang ? $_lang : \$GLOBALS['spip_lang'])";
858
-	} else {
859
-		$p->code = "spip_htmlentities($_lang)";
860
-	}
861
-	$p->interdire_scripts = false;
855
+    $_lang = champ_sql('lang', $p);
856
+    if (!$p->etoile) {
857
+        $p->code = "spip_htmlentities($_lang ? $_lang : \$GLOBALS['spip_lang'])";
858
+    } else {
859
+        $p->code = "spip_htmlentities($_lang)";
860
+    }
861
+    $p->interdire_scripts = false;
862 862
 
863
-	return $p;
863
+    return $p;
864 864
 }
865 865
 
866 866
 /**
@@ -882,45 +882,45 @@  discard block
 block discarded – undo
882 882
  *     Pile complétée par le code à générer
883 883
  */
884 884
 function balise_LESAUTEURS_dist($p) {
885
-	// Cherche le champ 'lesauteurs' dans la pile
886
-	$_lesauteurs = champ_sql('lesauteurs', $p, '');
887
-
888
-	// Si le champ n'existe pas (cas de spip_articles), on applique
889
-	// le modele lesauteurs.html en passant id_article dans le contexte;
890
-	// dans le cas contraire on prend le champ 'lesauteurs'
891
-	// (cf extension sites/)
892
-	if ($_lesauteurs) {
893
-		$p->code = "safehtml($_lesauteurs)";
894
-		// $p->interdire_scripts = true;
895
-	} else {
896
-		if (!$p->id_boucle) {
897
-			$connect = '';
898
-			$objet = 'article';
899
-			$id_table_objet = 'id_article';
900
-		} else {
901
-			$b = $p->nom_boucle ?: $p->id_boucle;
902
-			$connect = $p->boucles[$b]->sql_serveur;
903
-			$type_boucle = $p->boucles[$b]->type_requete;
904
-			$objet = objet_type($type_boucle);
905
-			$id_table_objet = id_table_objet($type_boucle);
906
-		}
907
-		$c = memoriser_contexte_compil($p);
908
-
909
-		$p->code = sprintf(
910
-			CODE_RECUPERER_FOND,
911
-			"'modeles/lesauteurs'",
912
-			"array('objet'=>'" . $objet .
913
-			"','id_objet' => " . champ_sql($id_table_objet, $p) .
914
-			",'$id_table_objet' => " . champ_sql($id_table_objet, $p) .
915
-			($objet == 'article' ? '' : ",'id_article' => " . champ_sql('id_article', $p)) .
916
-			')',
917
-			"'trim'=>true, 'compil'=>array($c)",
918
-			_q($connect)
919
-		);
920
-		$p->interdire_scripts = false; // securite apposee par recuperer_fond()
921
-	}
922
-
923
-	return $p;
885
+    // Cherche le champ 'lesauteurs' dans la pile
886
+    $_lesauteurs = champ_sql('lesauteurs', $p, '');
887
+
888
+    // Si le champ n'existe pas (cas de spip_articles), on applique
889
+    // le modele lesauteurs.html en passant id_article dans le contexte;
890
+    // dans le cas contraire on prend le champ 'lesauteurs'
891
+    // (cf extension sites/)
892
+    if ($_lesauteurs) {
893
+        $p->code = "safehtml($_lesauteurs)";
894
+        // $p->interdire_scripts = true;
895
+    } else {
896
+        if (!$p->id_boucle) {
897
+            $connect = '';
898
+            $objet = 'article';
899
+            $id_table_objet = 'id_article';
900
+        } else {
901
+            $b = $p->nom_boucle ?: $p->id_boucle;
902
+            $connect = $p->boucles[$b]->sql_serveur;
903
+            $type_boucle = $p->boucles[$b]->type_requete;
904
+            $objet = objet_type($type_boucle);
905
+            $id_table_objet = id_table_objet($type_boucle);
906
+        }
907
+        $c = memoriser_contexte_compil($p);
908
+
909
+        $p->code = sprintf(
910
+            CODE_RECUPERER_FOND,
911
+            "'modeles/lesauteurs'",
912
+            "array('objet'=>'" . $objet .
913
+            "','id_objet' => " . champ_sql($id_table_objet, $p) .
914
+            ",'$id_table_objet' => " . champ_sql($id_table_objet, $p) .
915
+            ($objet == 'article' ? '' : ",'id_article' => " . champ_sql('id_article', $p)) .
916
+            ')',
917
+            "'trim'=>true, 'compil'=>array($c)",
918
+            _q($connect)
919
+        );
920
+        $p->interdire_scripts = false; // securite apposee par recuperer_fond()
921
+    }
922
+
923
+    return $p;
924 924
 }
925 925
 
926 926
 
@@ -947,76 +947,76 @@  discard block
 block discarded – undo
947 947
  *     Pile complétée par le code à générer
948 948
  */
949 949
 function balise_RANG_dist($p) {
950
-	$b = index_boucle($p);
951
-	if ($b === '') {
952
-		$msg = [
953
-			'zbug_champ_hors_boucle',
954
-			['champ' => '#RANG']
955
-		];
956
-		erreur_squelette($msg, $p);
957
-	} else {
958
-		// chercher d'abord un champ sql rang (mais pas dans le env : defaut '' si on trouve pas de champ sql)
959
-		// dans la boucle immediatement englobante uniquement
960
-		// sinon on compose le champ calcule
961
-		$_rang = champ_sql('rang', $p, '', false);
962
-
963
-		// si pas trouve de champ sql rang :
964
-		if (!$_rang or $_rang == "''") {
965
-			$boucle = &$p->boucles[$b];
966
-
967
-			// on gere le cas ou #RANG est une extraction du numero dans le titre
968
-			$trouver_table = charger_fonction('trouver_table', 'base');
969
-			$desc = $trouver_table($boucle->id_table);
970
-			$_titre = ''; # où extraire le numero ?
971
-
972
-			if (isset($desc['titre'])) {
973
-				$t = $desc['titre'];
974
-				if (
975
-					// Soit on trouve avec la déclaration de la lang AVANT
976
-					preg_match(';(?:lang\s*,)\s*(.*?titre)\s*(,|$);', $t, $m)
977
-					// Soit on prend depuis le début
978
-					or preg_match(';^(.*?titre)\s*(,|$);', $t, $m)
979
-				) {
980
-					$m = preg_replace(',as\s+titre$,i', '', $m[1]);
981
-					$m = trim($m);
982
-					if ($m != "''") {
983
-						if (!preg_match(',\W,', $m)) {
984
-							$m = $boucle->id_table . ".$m";
985
-						}
986
-
987
-						$m .= ' AS titre_rang';
988
-
989
-						$boucle->select[] = $m;
990
-						$_titre = '$Pile[$SP][\'titre_rang\']';
991
-					}
992
-				}
993
-			}
994
-
995
-			// si on n'a rien trouvé, on utilise le champ titre classique
996
-			if (!$_titre) {
997
-				$_titre = champ_sql('titre', $p);
998
-			}
999
-
1000
-			// et on recupere aussi les infos de liaison si on est en train d'editer les liens justement
1001
-			// cas des formulaires xxx_lies utilises par #FORMULAIRE_EDITER_LIENS
1002
-			$type_boucle = $boucle->type_requete;
1003
-			$objet = objet_type($type_boucle);
1004
-			$id_table_objet = id_table_objet($type_boucle);
1005
-			$_primary = champ_sql($id_table_objet, $p, '', false);
1006
-			$_env = '$Pile[0]';
1007
-
1008
-			if (!$_titre) {$_titre = "''";
1009
-			}
1010
-			if (!$_primary) {$_primary = "''";
1011
-			}
1012
-			$_rang = "calculer_rang_smart($_titre, '$objet', $_primary, $_env)";
1013
-		}
1014
-
1015
-		$p->code = $_rang;
1016
-		$p->interdire_scripts = false;
1017
-	}
1018
-
1019
-	return $p;
950
+    $b = index_boucle($p);
951
+    if ($b === '') {
952
+        $msg = [
953
+            'zbug_champ_hors_boucle',
954
+            ['champ' => '#RANG']
955
+        ];
956
+        erreur_squelette($msg, $p);
957
+    } else {
958
+        // chercher d'abord un champ sql rang (mais pas dans le env : defaut '' si on trouve pas de champ sql)
959
+        // dans la boucle immediatement englobante uniquement
960
+        // sinon on compose le champ calcule
961
+        $_rang = champ_sql('rang', $p, '', false);
962
+
963
+        // si pas trouve de champ sql rang :
964
+        if (!$_rang or $_rang == "''") {
965
+            $boucle = &$p->boucles[$b];
966
+
967
+            // on gere le cas ou #RANG est une extraction du numero dans le titre
968
+            $trouver_table = charger_fonction('trouver_table', 'base');
969
+            $desc = $trouver_table($boucle->id_table);
970
+            $_titre = ''; # où extraire le numero ?
971
+
972
+            if (isset($desc['titre'])) {
973
+                $t = $desc['titre'];
974
+                if (
975
+                    // Soit on trouve avec la déclaration de la lang AVANT
976
+                    preg_match(';(?:lang\s*,)\s*(.*?titre)\s*(,|$);', $t, $m)
977
+                    // Soit on prend depuis le début
978
+                    or preg_match(';^(.*?titre)\s*(,|$);', $t, $m)
979
+                ) {
980
+                    $m = preg_replace(',as\s+titre$,i', '', $m[1]);
981
+                    $m = trim($m);
982
+                    if ($m != "''") {
983
+                        if (!preg_match(',\W,', $m)) {
984
+                            $m = $boucle->id_table . ".$m";
985
+                        }
986
+
987
+                        $m .= ' AS titre_rang';
988
+
989
+                        $boucle->select[] = $m;
990
+                        $_titre = '$Pile[$SP][\'titre_rang\']';
991
+                    }
992
+                }
993
+            }
994
+
995
+            // si on n'a rien trouvé, on utilise le champ titre classique
996
+            if (!$_titre) {
997
+                $_titre = champ_sql('titre', $p);
998
+            }
999
+
1000
+            // et on recupere aussi les infos de liaison si on est en train d'editer les liens justement
1001
+            // cas des formulaires xxx_lies utilises par #FORMULAIRE_EDITER_LIENS
1002
+            $type_boucle = $boucle->type_requete;
1003
+            $objet = objet_type($type_boucle);
1004
+            $id_table_objet = id_table_objet($type_boucle);
1005
+            $_primary = champ_sql($id_table_objet, $p, '', false);
1006
+            $_env = '$Pile[0]';
1007
+
1008
+            if (!$_titre) {$_titre = "''";
1009
+            }
1010
+            if (!$_primary) {$_primary = "''";
1011
+            }
1012
+            $_rang = "calculer_rang_smart($_titre, '$objet', $_primary, $_env)";
1013
+        }
1014
+
1015
+        $p->code = $_rang;
1016
+        $p->interdire_scripts = false;
1017
+    }
1018
+
1019
+    return $p;
1020 1020
 }
1021 1021
 
1022 1022
 
@@ -1038,12 +1038,12 @@  discard block
 block discarded – undo
1038 1038
  *     Pile complétée par le code à générer
1039 1039
  **/
1040 1040
 function balise_POPULARITE_dist($p) {
1041
-	$_popularite = champ_sql('popularite', $p);
1042
-	$p->code = "(ceil(min(100, 100 * $_popularite
1041
+    $_popularite = champ_sql('popularite', $p);
1042
+    $p->code = "(ceil(min(100, 100 * $_popularite
1043 1043
 	/ max(1 , 0 + \$GLOBALS['meta']['popularite_max']))))";
1044
-	$p->interdire_scripts = false;
1044
+    $p->interdire_scripts = false;
1045 1045
 
1046
-	return $p;
1046
+    return $p;
1047 1047
 }
1048 1048
 
1049 1049
 /**
@@ -1054,8 +1054,8 @@  discard block
 block discarded – undo
1054 1054
  * l'absence peut-être due à une faute de frappe dans le contexte inclus.
1055 1055
  */
1056 1056
 define(
1057
-	'CODE_PAGINATION',
1058
-	'%s($Numrows["%s"]["grand_total"],
1057
+    'CODE_PAGINATION',
1058
+    '%s($Numrows["%s"]["grand_total"],
1059 1059
  		%s,
1060 1060
 		isset($Pile[0][%4$s])?$Pile[0][%4$s]:intval(_request(%4$s)),
1061 1061
 		%5$s, %6$s, %7$s, %8$s, array(%9$s))'
@@ -1092,75 +1092,75 @@  discard block
 block discarded – undo
1092 1092
  *     Pile complétée par le code à générer
1093 1093
  */
1094 1094
 function balise_PAGINATION_dist($p, $liste = 'true') {
1095
-	$b = index_boucle_mere($p);
1096
-
1097
-	// s'il n'y a pas de nom de boucle, on ne peut pas paginer
1098
-	if ($b === '') {
1099
-		$msg = [
1100
-			'zbug_champ_hors_boucle',
1101
-			['champ' => $liste ? 'PAGINATION' : 'ANCRE_PAGINATION']
1102
-		];
1103
-		erreur_squelette($msg, $p);
1104
-
1105
-		return $p;
1106
-	}
1107
-
1108
-	// s'il n'y a pas de mode_partie, c'est qu'on se trouve
1109
-	// dans un boucle recursive ou qu'on a oublie le critere {pagination}
1110
-	if (!$p->boucles[$b]->mode_partie) {
1111
-		if (!$p->boucles[$b]->table_optionnelle) {
1112
-			$msg = [
1113
-				'zbug_pagination_sans_critere',
1114
-				['champ' => '#PAGINATION']
1115
-			];
1116
-			erreur_squelette($msg, $p);
1117
-		}
1118
-
1119
-		return $p;
1120
-	}
1121
-
1122
-	// a priori true
1123
-	// si false, le compilo va bloquer sur des syntaxes avec un filtre sans argument qui suit la balise
1124
-	// si true, les arguments simples (sans truc=chose) vont degager
1125
-	$_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $p->id_boucle, false, false);
1126
-	if (is_countable($_contexte) ? count($_contexte) : 0) {
1127
-		$key = key($_contexte);
1128
-		if (is_numeric($key)) {
1129
-			array_shift($_contexte);
1130
-			$__modele = interprete_argument_balise(1, $p);
1131
-		}
1132
-	}
1133
-
1134
-	if (is_countable($_contexte) ? count($_contexte) : 0) {
1135
-		$code_contexte = implode(',', $_contexte);
1136
-	} else {
1137
-		$code_contexte = '';
1138
-	}
1139
-
1140
-	$connect = $p->boucles[$b]->sql_serveur;
1141
-	$pas = $p->boucles[$b]->total_parties;
1142
-	$f_pagination = chercher_filtre('pagination');
1143
-	$type = $p->boucles[$b]->modificateur['debut_nom'];
1144
-	$modif = ($type[0] !== "'") ? "'debut'.$type"
1145
-		: ("'debut" . substr($type, 1));
1146
-
1147
-	$p->code = sprintf(
1148
-		CODE_PAGINATION,
1149
-		$f_pagination,
1150
-		$b,
1151
-		$type,
1152
-		$modif,
1153
-		$pas,
1154
-		$liste,
1155
-		((isset($__modele) and $__modele) ? $__modele : "''"),
1156
-		_q($connect),
1157
-		$code_contexte
1158
-	);
1159
-
1160
-	$p->boucles[$b]->numrows = true;
1161
-	$p->interdire_scripts = false;
1162
-
1163
-	return $p;
1095
+    $b = index_boucle_mere($p);
1096
+
1097
+    // s'il n'y a pas de nom de boucle, on ne peut pas paginer
1098
+    if ($b === '') {
1099
+        $msg = [
1100
+            'zbug_champ_hors_boucle',
1101
+            ['champ' => $liste ? 'PAGINATION' : 'ANCRE_PAGINATION']
1102
+        ];
1103
+        erreur_squelette($msg, $p);
1104
+
1105
+        return $p;
1106
+    }
1107
+
1108
+    // s'il n'y a pas de mode_partie, c'est qu'on se trouve
1109
+    // dans un boucle recursive ou qu'on a oublie le critere {pagination}
1110
+    if (!$p->boucles[$b]->mode_partie) {
1111
+        if (!$p->boucles[$b]->table_optionnelle) {
1112
+            $msg = [
1113
+                'zbug_pagination_sans_critere',
1114
+                ['champ' => '#PAGINATION']
1115
+            ];
1116
+            erreur_squelette($msg, $p);
1117
+        }
1118
+
1119
+        return $p;
1120
+    }
1121
+
1122
+    // a priori true
1123
+    // si false, le compilo va bloquer sur des syntaxes avec un filtre sans argument qui suit la balise
1124
+    // si true, les arguments simples (sans truc=chose) vont degager
1125
+    $_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $p->id_boucle, false, false);
1126
+    if (is_countable($_contexte) ? count($_contexte) : 0) {
1127
+        $key = key($_contexte);
1128
+        if (is_numeric($key)) {
1129
+            array_shift($_contexte);
1130
+            $__modele = interprete_argument_balise(1, $p);
1131
+        }
1132
+    }
1133
+
1134
+    if (is_countable($_contexte) ? count($_contexte) : 0) {
1135
+        $code_contexte = implode(',', $_contexte);
1136
+    } else {
1137
+        $code_contexte = '';
1138
+    }
1139
+
1140
+    $connect = $p->boucles[$b]->sql_serveur;
1141
+    $pas = $p->boucles[$b]->total_parties;
1142
+    $f_pagination = chercher_filtre('pagination');
1143
+    $type = $p->boucles[$b]->modificateur['debut_nom'];
1144
+    $modif = ($type[0] !== "'") ? "'debut'.$type"
1145
+        : ("'debut" . substr($type, 1));
1146
+
1147
+    $p->code = sprintf(
1148
+        CODE_PAGINATION,
1149
+        $f_pagination,
1150
+        $b,
1151
+        $type,
1152
+        $modif,
1153
+        $pas,
1154
+        $liste,
1155
+        ((isset($__modele) and $__modele) ? $__modele : "''"),
1156
+        _q($connect),
1157
+        $code_contexte
1158
+    );
1159
+
1160
+    $p->boucles[$b]->numrows = true;
1161
+    $p->interdire_scripts = false;
1162
+
1163
+    return $p;
1164 1164
 }
1165 1165
 
1166 1166
 
@@ -1187,11 +1187,11 @@  discard block
 block discarded – undo
1187 1187
  *     Pile complétée par le code à générer
1188 1188
  **/
1189 1189
 function balise_ANCRE_PAGINATION_dist($p) {
1190
-	if ($f = charger_fonction('PAGINATION', 'balise', true)) {
1191
-		return $f($p, $liste = 'false');
1192
-	} else {
1193
-		return null;
1194
-	} // ou une erreur ?
1190
+    if ($f = charger_fonction('PAGINATION', 'balise', true)) {
1191
+        return $f($p, $liste = 'false');
1192
+    } else {
1193
+        return null;
1194
+    } // ou une erreur ?
1195 1195
 }
1196 1196
 
1197 1197
 
@@ -1212,17 +1212,17 @@  discard block
 block discarded – undo
1212 1212
  *     Pile complétée par le code à générer
1213 1213
  **/
1214 1214
 function balise_GRAND_TOTAL_dist($p) {
1215
-	$b = index_boucle_mere($p);
1216
-	if ($b === '') {
1217
-		$msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]];
1218
-		erreur_squelette($msg, $p);
1219
-	} else {
1220
-		$p->code = "(\$Numrows['$b']['grand_total'] ?? \$Numrows['$b']['total'] ?? 0)";
1221
-		$p->boucles[$b]->numrows = true;
1222
-		$p->interdire_scripts = false;
1223
-	}
1215
+    $b = index_boucle_mere($p);
1216
+    if ($b === '') {
1217
+        $msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]];
1218
+        erreur_squelette($msg, $p);
1219
+    } else {
1220
+        $p->code = "(\$Numrows['$b']['grand_total'] ?? \$Numrows['$b']['total'] ?? 0)";
1221
+        $p->boucles[$b]->numrows = true;
1222
+        $p->interdire_scripts = false;
1223
+    }
1224 1224
 
1225
-	return $p;
1225
+    return $p;
1226 1226
 }
1227 1227
 
1228 1228
 
@@ -1250,10 +1250,10 @@  discard block
 block discarded – undo
1250 1250
  *     Pile complétée par le code à générer
1251 1251
  **/
1252 1252
 function balise_SELF_dist($p) {
1253
-	$p->code = 'self()';
1254
-	$p->interdire_scripts = false;
1253
+    $p->code = 'self()';
1254
+    $p->interdire_scripts = false;
1255 1255
 
1256
-	return $p;
1256
+    return $p;
1257 1257
 }
1258 1258
 
1259 1259
 
@@ -1280,17 +1280,17 @@  discard block
 block discarded – undo
1280 1280
  *     Pile complétée par le code à générer
1281 1281
  **/
1282 1282
 function balise_CHEMIN_dist($p) {
1283
-	$arg = interprete_argument_balise(1, $p);
1284
-	if (!$arg) {
1285
-		$msg = ['zbug_balise_sans_argument', ['balise' => ' CHEMIN']];
1286
-		erreur_squelette($msg, $p);
1287
-	} else {
1288
-		$p->code = 'find_in_path((string)' . $arg . ')';
1289
-	}
1283
+    $arg = interprete_argument_balise(1, $p);
1284
+    if (!$arg) {
1285
+        $msg = ['zbug_balise_sans_argument', ['balise' => ' CHEMIN']];
1286
+        erreur_squelette($msg, $p);
1287
+    } else {
1288
+        $p->code = 'find_in_path((string)' . $arg . ')';
1289
+    }
1290 1290
 
1291
-	$p->interdire_scripts = false;
1291
+    $p->interdire_scripts = false;
1292 1292
 
1293
-	return $p;
1293
+    return $p;
1294 1294
 }
1295 1295
 
1296 1296
 /**
@@ -1315,16 +1315,16 @@  discard block
 block discarded – undo
1315 1315
  *     Pile complétée par le code à générer
1316 1316
  **/
1317 1317
 function balise_CHEMIN_IMAGE_dist($p) {
1318
-	$arg = interprete_argument_balise(1, $p);
1319
-	if (!$arg) {
1320
-		$msg = ['zbug_balise_sans_argument', ['balise' => ' CHEMIN_IMAGE']];
1321
-		erreur_squelette($msg, $p);
1322
-	} else {
1323
-		$p->code = 'chemin_image((string)' . $arg . ')';
1324
-	}
1318
+    $arg = interprete_argument_balise(1, $p);
1319
+    if (!$arg) {
1320
+        $msg = ['zbug_balise_sans_argument', ['balise' => ' CHEMIN_IMAGE']];
1321
+        erreur_squelette($msg, $p);
1322
+    } else {
1323
+        $p->code = 'chemin_image((string)' . $arg . ')';
1324
+    }
1325 1325
 
1326
-	$p->interdire_scripts = false;
1327
-	return $p;
1326
+    $p->interdire_scripts = false;
1327
+    return $p;
1328 1328
 }
1329 1329
 
1330 1330
 
@@ -1362,36 +1362,36 @@  discard block
 block discarded – undo
1362 1362
  **/
1363 1363
 function balise_ENV_dist($p, $src = null) {
1364 1364
 
1365
-	// cle du tableau desiree
1366
-	$_nom = interprete_argument_balise(1, $p);
1367
-	// valeur par defaut
1368
-	$_sinon = interprete_argument_balise(2, $p);
1365
+    // cle du tableau desiree
1366
+    $_nom = interprete_argument_balise(1, $p);
1367
+    // valeur par defaut
1368
+    $_sinon = interprete_argument_balise(2, $p);
1369 1369
 
1370
-	// $src est un tableau de donnees sources eventuellement transmis
1371
-	// en absence, on utilise l'environnement du squelette $Pile[0]
1370
+    // $src est un tableau de donnees sources eventuellement transmis
1371
+    // en absence, on utilise l'environnement du squelette $Pile[0]
1372 1372
 
1373
-	if (!$_nom) {
1374
-		// cas de #ENV sans argument : on retourne le serialize() du tableau
1375
-		// une belle fonction [(#ENV|affiche_env)] serait pratique
1376
-		if ($src) {
1377
-			$p->code = '(is_array($a = (' . $src . ')) ? serialize($a) : "")';
1378
-		} else {
1379
-			$p->code = 'serialize($Pile[0]??[])';
1380
-		}
1381
-	} else {
1382
-		if (!$src) {
1383
-			$src = '$Pile[0]??[]';
1384
-		}
1385
-		if ($_sinon) {
1386
-			$p->code = "sinon(table_valeur($src, (string)$_nom, null), $_sinon)";
1387
-		} else {
1388
-			$p->code = "table_valeur($src, (string)$_nom, null)";
1389
-		}
1390
-	}
1373
+    if (!$_nom) {
1374
+        // cas de #ENV sans argument : on retourne le serialize() du tableau
1375
+        // une belle fonction [(#ENV|affiche_env)] serait pratique
1376
+        if ($src) {
1377
+            $p->code = '(is_array($a = (' . $src . ')) ? serialize($a) : "")';
1378
+        } else {
1379
+            $p->code = 'serialize($Pile[0]??[])';
1380
+        }
1381
+    } else {
1382
+        if (!$src) {
1383
+            $src = '$Pile[0]??[]';
1384
+        }
1385
+        if ($_sinon) {
1386
+            $p->code = "sinon(table_valeur($src, (string)$_nom, null), $_sinon)";
1387
+        } else {
1388
+            $p->code = "table_valeur($src, (string)$_nom, null)";
1389
+        }
1390
+    }
1391 1391
 
1392
-	#$p->interdire_scripts = true;
1392
+    #$p->interdire_scripts = true;
1393 1393
 
1394
-	return $p;
1394
+    return $p;
1395 1395
 }
1396 1396
 
1397 1397
 /**
@@ -1421,16 +1421,16 @@  discard block
 block discarded – undo
1421 1421
  *     Pile completée du code PHP d'exécution de la balise
1422 1422
  */
1423 1423
 function balise_CONFIG_dist($p) {
1424
-	if (!$arg = interprete_argument_balise(1, $p)) {
1425
-		$arg = "''";
1426
-	}
1427
-	$_sinon = interprete_argument_balise(2, $p);
1428
-	$_unserialize = sinon(interprete_argument_balise(3, $p), 'false');
1424
+    if (!$arg = interprete_argument_balise(1, $p)) {
1425
+        $arg = "''";
1426
+    }
1427
+    $_sinon = interprete_argument_balise(2, $p);
1428
+    $_unserialize = sinon(interprete_argument_balise(3, $p), 'false');
1429 1429
 
1430
-	$p->code = '(include_spip(\'inc/config\')?lire_config(' . $arg . ',' .
1431
-		($_sinon && $_sinon != "''" ? $_sinon : 'null') . ',' . $_unserialize . "):'')";
1430
+    $p->code = '(include_spip(\'inc/config\')?lire_config(' . $arg . ',' .
1431
+        ($_sinon && $_sinon != "''" ? $_sinon : 'null') . ',' . $_unserialize . "):'')";
1432 1432
 
1433
-	return $p;
1433
+    return $p;
1434 1434
 }
1435 1435
 
1436 1436
 
@@ -1453,10 +1453,10 @@  discard block
 block discarded – undo
1453 1453
  *     Pile completée du code PHP d'exécution de la balise
1454 1454
  */
1455 1455
 function balise_CONNECT_dist($p) {
1456
-	$p->code = '($connect ? $connect : NULL)';
1457
-	$p->interdire_scripts = false;
1456
+    $p->code = '($connect ? $connect : NULL)';
1457
+    $p->interdire_scripts = false;
1458 1458
 
1459
-	return $p;
1459
+    return $p;
1460 1460
 }
1461 1461
 
1462 1462
 
@@ -1484,15 +1484,15 @@  discard block
 block discarded – undo
1484 1484
  *     Pile completée du code PHP d'exécution de la balise
1485 1485
  **/
1486 1486
 function balise_SESSION_dist($p) {
1487
-	$p->descr['session'] = true;
1487
+    $p->descr['session'] = true;
1488 1488
 
1489
-	$f = function_exists('balise_ENV')
1490
-		? 'balise_ENV'
1491
-		: 'balise_ENV_dist';
1489
+    $f = function_exists('balise_ENV')
1490
+        ? 'balise_ENV'
1491
+        : 'balise_ENV_dist';
1492 1492
 
1493
-	$p = $f($p, '$GLOBALS["visiteur_session"]??[]');
1493
+    $p = $f($p, '$GLOBALS["visiteur_session"]??[]');
1494 1494
 
1495
-	return $p;
1495
+    return $p;
1496 1496
 }
1497 1497
 
1498 1498
 
@@ -1515,18 +1515,18 @@  discard block
 block discarded – undo
1515 1515
  *     Pile completée du code PHP d'exécution de la balise
1516 1516
  **/
1517 1517
 function balise_SESSION_SET_dist($p) {
1518
-	$_nom = interprete_argument_balise(1, $p);
1519
-	$_val = interprete_argument_balise(2, $p);
1520
-	if (!$_nom or !$_val) {
1521
-		$err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'SESSION_SET']];
1522
-		erreur_squelette($err_b_s_a, $p);
1523
-	} else {
1524
-		$p->code = '(include_spip("inc/session") AND session_set(' . $_nom . ',' . $_val . '))';
1525
-	}
1518
+    $_nom = interprete_argument_balise(1, $p);
1519
+    $_val = interprete_argument_balise(2, $p);
1520
+    if (!$_nom or !$_val) {
1521
+        $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'SESSION_SET']];
1522
+        erreur_squelette($err_b_s_a, $p);
1523
+    } else {
1524
+        $p->code = '(include_spip("inc/session") AND session_set(' . $_nom . ',' . $_val . '))';
1525
+    }
1526 1526
 
1527
-	$p->interdire_scripts = false;
1527
+    $p->interdire_scripts = false;
1528 1528
 
1529
-	return $p;
1529
+    return $p;
1530 1530
 }
1531 1531
 
1532 1532
 
@@ -1557,30 +1557,30 @@  discard block
 block discarded – undo
1557 1557
  *     Pile completée du code PHP d'exécution de la balise
1558 1558
  **/
1559 1559
 function balise_EVAL_dist($p) {
1560
-	$php = interprete_argument_balise(1, $p);
1561
-	if ($php) {
1562
-		# optimisation sur les #EVAL{une expression sans #BALISE}
1563
-		# attention au commentaire "// x signes" qui precede
1564
-		if (
1565
-			preg_match(
1566
-				",^([[:space:]]*//[^\n]*\n)'([^']+)'$,ms",
1567
-				$php,
1568
-				$r
1569
-			)
1570
-		) {
1571
-			$p->code = /* $r[1]. */
1572
-				'(' . $r[2] . ')';
1573
-		} else {
1574
-			$p->code = "eval('return '.$php.';')";
1575
-		}
1576
-	} else {
1577
-		$msg = ['zbug_balise_sans_argument', ['balise' => ' EVAL']];
1578
-		erreur_squelette($msg, $p);
1579
-	}
1580
-
1581
-	#$p->interdire_scripts = true;
1582
-
1583
-	return $p;
1560
+    $php = interprete_argument_balise(1, $p);
1561
+    if ($php) {
1562
+        # optimisation sur les #EVAL{une expression sans #BALISE}
1563
+        # attention au commentaire "// x signes" qui precede
1564
+        if (
1565
+            preg_match(
1566
+                ",^([[:space:]]*//[^\n]*\n)'([^']+)'$,ms",
1567
+                $php,
1568
+                $r
1569
+            )
1570
+        ) {
1571
+            $p->code = /* $r[1]. */
1572
+                '(' . $r[2] . ')';
1573
+        } else {
1574
+            $p->code = "eval('return '.$php.';')";
1575
+        }
1576
+    } else {
1577
+        $msg = ['zbug_balise_sans_argument', ['balise' => ' EVAL']];
1578
+        erreur_squelette($msg, $p);
1579
+    }
1580
+
1581
+    #$p->interdire_scripts = true;
1582
+
1583
+    return $p;
1584 1584
 }
1585 1585
 
1586 1586
 
@@ -1610,19 +1610,19 @@  discard block
 block discarded – undo
1610 1610
  **/
1611 1611
 function balise_CHAMP_SQL_dist($p) {
1612 1612
 
1613
-	if (
1614
-		$p->param
1615
-		and isset($p->param[0][1][0])
1616
-		and $champ = ($p->param[0][1][0]->texte)
1617
-	) {
1618
-		$p->code = champ_sql($champ, $p);
1619
-	} else {
1620
-		$err_b_s_a = ['zbug_balise_sans_argument', ['balise' => ' CHAMP_SQL']];
1621
-		erreur_squelette($err_b_s_a, $p);
1622
-	}
1613
+    if (
1614
+        $p->param
1615
+        and isset($p->param[0][1][0])
1616
+        and $champ = ($p->param[0][1][0]->texte)
1617
+    ) {
1618
+        $p->code = champ_sql($champ, $p);
1619
+    } else {
1620
+        $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => ' CHAMP_SQL']];
1621
+        erreur_squelette($err_b_s_a, $p);
1622
+    }
1623 1623
 
1624
-	#$p->interdire_scripts = true;
1625
-	return $p;
1624
+    #$p->interdire_scripts = true;
1625
+    return $p;
1626 1626
 }
1627 1627
 
1628 1628
 /**
@@ -1648,13 +1648,13 @@  discard block
 block discarded – undo
1648 1648
  *     Pile complétée par le code à générer
1649 1649
  **/
1650 1650
 function balise_VAL_dist($p) {
1651
-	$p->code = interprete_argument_balise(1, $p) ?? '';
1652
-	if (!strlen($p->code)) {
1653
-		$p->code = "''";
1654
-	}
1655
-	$p->interdire_scripts = false;
1651
+    $p->code = interprete_argument_balise(1, $p) ?? '';
1652
+    if (!strlen($p->code)) {
1653
+        $p->code = "''";
1654
+    }
1655
+    $p->interdire_scripts = false;
1656 1656
 
1657
-	return $p;
1657
+    return $p;
1658 1658
 }
1659 1659
 
1660 1660
 /**
@@ -1683,10 +1683,10 @@  discard block
 block discarded – undo
1683 1683
  *     Pile complétée par le code à générer
1684 1684
  **/
1685 1685
 function balise_REM_dist($p) {
1686
-	$p->code = "''";
1687
-	$p->interdire_scripts = false;
1686
+    $p->code = "''";
1687
+    $p->interdire_scripts = false;
1688 1688
 
1689
-	return $p;
1689
+    return $p;
1690 1690
 }
1691 1691
 
1692 1692
 /**
@@ -1696,10 +1696,10 @@  discard block
 block discarded – undo
1696 1696
  * @return mixed
1697 1697
  */
1698 1698
 function balise_NULL_dist($p) {
1699
-	$p->code = 'null';
1700
-	$p->interdire_scripts = false;
1699
+    $p->code = 'null';
1700
+    $p->interdire_scripts = false;
1701 1701
 
1702
-	return $p;
1702
+    return $p;
1703 1703
 }
1704 1704
 
1705 1705
 
@@ -1723,18 +1723,18 @@  discard block
 block discarded – undo
1723 1723
  **/
1724 1724
 function balise_HTTP_HEADER_dist($p) {
1725 1725
 
1726
-	$header = interprete_argument_balise(1, $p);
1727
-	if (!$header) {
1728
-		$err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'HTTP_HEADER']];
1729
-		erreur_squelette($err_b_s_a, $p);
1730
-	} else {
1731
-		$p->code = "'<'.'?php header(' . _q("
1732
-			. $header
1733
-			. ") . '); ?'.'>'";
1734
-	}
1735
-	$p->interdire_scripts = false;
1726
+    $header = interprete_argument_balise(1, $p);
1727
+    if (!$header) {
1728
+        $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'HTTP_HEADER']];
1729
+        erreur_squelette($err_b_s_a, $p);
1730
+    } else {
1731
+        $p->code = "'<'.'?php header(' . _q("
1732
+            . $header
1733
+            . ") . '); ?'.'>'";
1734
+    }
1735
+    $p->interdire_scripts = false;
1736 1736
 
1737
-	return $p;
1737
+    return $p;
1738 1738
 }
1739 1739
 
1740 1740
 
@@ -1759,20 +1759,20 @@  discard block
 block discarded – undo
1759 1759
  *     Pile complétée par le code à générer
1760 1760
  **/
1761 1761
 function balise_FILTRE_dist($p) {
1762
-	if ($p->param) {
1763
-		$args = [];
1764
-		foreach ($p->param as $i => $ignore) {
1765
-			$args[] = interprete_argument_balise($i + 1, $p);
1766
-		}
1767
-		$p->code = "'<' . '"
1768
-			. '?php header("X-Spip-Filtre: \'.'
1769
-			. join('.\'|\'.', $args)
1770
-			. " . '\"); ?'.'>'";
1762
+    if ($p->param) {
1763
+        $args = [];
1764
+        foreach ($p->param as $i => $ignore) {
1765
+            $args[] = interprete_argument_balise($i + 1, $p);
1766
+        }
1767
+        $p->code = "'<' . '"
1768
+            . '?php header("X-Spip-Filtre: \'.'
1769
+            . join('.\'|\'.', $args)
1770
+            . " . '\"); ?'.'>'";
1771 1771
 
1772
-		$p->interdire_scripts = false;
1772
+        $p->interdire_scripts = false;
1773 1773
 
1774
-		return $p;
1775
-	}
1774
+        return $p;
1775
+    }
1776 1776
 }
1777 1777
 
1778 1778
 
@@ -1808,55 +1808,55 @@  discard block
 block discarded – undo
1808 1808
  **/
1809 1809
 function balise_CACHE_dist($p) {
1810 1810
 
1811
-	if ($p->param) {
1812
-		$duree = valeur_numerique($p->param[0][1][0]->texte);
1813
-
1814
-		// noter la duree du cache dans un entete proprietaire
1815
-
1816
-		$code = "'<'.'" . '?php header("X-Spip-Cache: '
1817
-			. $duree
1818
-			. '"); ?' . "'.'>'";
1819
-
1820
-		// Remplir le header Cache-Control
1821
-		// cas #CACHE{0}
1822
-		if ($duree == 0) {
1823
-			$code .= ".'<'.'"
1824
-				. '?php header("Cache-Control: no-cache, must-revalidate"); ?'
1825
-				. "'.'><'.'"
1826
-				. '?php header("Pragma: no-cache"); ?'
1827
-				. "'.'>'";
1828
-		}
1829
-
1830
-		// recuperer les parametres suivants
1831
-		$i = 1;
1832
-		while (isset($p->param[0][++$i])) {
1833
-			$pa = ($p->param[0][$i][0]->texte);
1834
-
1835
-			if (
1836
-				$pa == 'cache-client'
1837
-				and $duree > 0
1838
-			) {
1839
-				$code .= ".'<'.'" . '?php header("Cache-Control: max-age='
1840
-					. $duree
1841
-					. '"); ?' . "'.'>'";
1842
-				// il semble logique, si on cache-client, de ne pas invalider
1843
-				$pa = 'statique';
1844
-			}
1845
-
1846
-			if (
1847
-				$pa == 'statique'
1848
-				and $duree > 0
1849
-			) {
1850
-				$code .= ".'<'.'" . '?php header("X-Spip-Statique: oui"); ?' . "'.'>'";
1851
-			}
1852
-		}
1853
-	} else {
1854
-		$code = "''";
1855
-	}
1856
-	$p->code = $code;
1857
-	$p->interdire_scripts = false;
1858
-
1859
-	return $p;
1811
+    if ($p->param) {
1812
+        $duree = valeur_numerique($p->param[0][1][0]->texte);
1813
+
1814
+        // noter la duree du cache dans un entete proprietaire
1815
+
1816
+        $code = "'<'.'" . '?php header("X-Spip-Cache: '
1817
+            . $duree
1818
+            . '"); ?' . "'.'>'";
1819
+
1820
+        // Remplir le header Cache-Control
1821
+        // cas #CACHE{0}
1822
+        if ($duree == 0) {
1823
+            $code .= ".'<'.'"
1824
+                . '?php header("Cache-Control: no-cache, must-revalidate"); ?'
1825
+                . "'.'><'.'"
1826
+                . '?php header("Pragma: no-cache"); ?'
1827
+                . "'.'>'";
1828
+        }
1829
+
1830
+        // recuperer les parametres suivants
1831
+        $i = 1;
1832
+        while (isset($p->param[0][++$i])) {
1833
+            $pa = ($p->param[0][$i][0]->texte);
1834
+
1835
+            if (
1836
+                $pa == 'cache-client'
1837
+                and $duree > 0
1838
+            ) {
1839
+                $code .= ".'<'.'" . '?php header("Cache-Control: max-age='
1840
+                    . $duree
1841
+                    . '"); ?' . "'.'>'";
1842
+                // il semble logique, si on cache-client, de ne pas invalider
1843
+                $pa = 'statique';
1844
+            }
1845
+
1846
+            if (
1847
+                $pa == 'statique'
1848
+                and $duree > 0
1849
+            ) {
1850
+                $code .= ".'<'.'" . '?php header("X-Spip-Statique: oui"); ?' . "'.'>'";
1851
+            }
1852
+        }
1853
+    } else {
1854
+        $code = "''";
1855
+    }
1856
+    $p->code = $code;
1857
+    $p->interdire_scripts = false;
1858
+
1859
+    return $p;
1860 1860
 }
1861 1861
 
1862 1862
 
@@ -1888,13 +1888,13 @@  discard block
 block discarded – undo
1888 1888
  *     Pile complétée par le code à générer
1889 1889
  */
1890 1890
 function balise_INSERT_HEAD_dist($p) {
1891
-	$p->code = "'<'.'"
1892
-		. '?php header("X-Spip-Filtre: insert_head_css_conditionnel"); ?'
1893
-		. "'.'>'";
1894
-	$p->code .= ". pipeline('insert_head','<!-- insert_head -->')";
1895
-	$p->interdire_scripts = false;
1891
+    $p->code = "'<'.'"
1892
+        . '?php header("X-Spip-Filtre: insert_head_css_conditionnel"); ?'
1893
+        . "'.'>'";
1894
+    $p->code .= ". pipeline('insert_head','<!-- insert_head -->')";
1895
+    $p->interdire_scripts = false;
1896 1896
 
1897
-	return $p;
1897
+    return $p;
1898 1898
 }
1899 1899
 
1900 1900
 /**
@@ -1912,10 +1912,10 @@  discard block
 block discarded – undo
1912 1912
  *     Pile complétée par le code à générer
1913 1913
  */
1914 1914
 function balise_INSERT_HEAD_CSS_dist($p) {
1915
-	$p->code = "pipeline('insert_head_css','<!-- insert_head_css -->')";
1916
-	$p->interdire_scripts = false;
1915
+    $p->code = "pipeline('insert_head_css','<!-- insert_head_css -->')";
1916
+    $p->interdire_scripts = false;
1917 1917
 
1918
-	return $p;
1918
+    return $p;
1919 1919
 }
1920 1920
 
1921 1921
 /**
@@ -1930,11 +1930,11 @@  discard block
 block discarded – undo
1930 1930
  *     Pile complétée par le code à générer
1931 1931
  **/
1932 1932
 function balise_INCLUDE_dist($p) {
1933
-	if (function_exists('balise_INCLURE')) {
1934
-		return balise_INCLURE($p);
1935
-	} else {
1936
-		return balise_INCLURE_dist($p);
1937
-	}
1933
+    if (function_exists('balise_INCLURE')) {
1934
+        return balise_INCLURE($p);
1935
+    } else {
1936
+        return balise_INCLURE_dist($p);
1937
+    }
1938 1938
 }
1939 1939
 
1940 1940
 /**
@@ -1968,66 +1968,66 @@  discard block
 block discarded – undo
1968 1968
  *     Pile complétée par le code à générer
1969 1969
  **/
1970 1970
 function balise_INCLURE_dist($p) {
1971
-	$id_boucle = $p->id_boucle;
1972
-	// la lang n'est pas passe de facon automatique par argumenter
1973
-	// mais le sera pas recuperer_fond, sauf si etoile=>true est passe
1974
-	// en option
1975
-
1976
-	$_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $id_boucle, false, false);
1977
-
1978
-	// erreur de syntaxe = fond absent
1979
-	// (2 messages d'erreur SPIP pour le prix d'un, mais pas d'erreur PHP
1980
-	if (!$_contexte) {
1981
-		$contexte = [];
1982
-	}
1983
-
1984
-	if (isset($_contexte['fond'])) {
1985
-		$f = $_contexte['fond'];
1986
-		// toujours vrai :
1987
-		if (preg_match('/^.fond.\s*=>(.*)$/s', $f, $r)) {
1988
-			$f = $r[1];
1989
-			unset($_contexte['fond']);
1990
-		} else {
1991
-			spip_log('compilation de #INCLURE a revoir');
1992
-		}
1993
-
1994
-		// #INCLURE{doublons}
1995
-		if (isset($_contexte['doublons'])) {
1996
-			$_contexte['doublons'] = "'doublons' => \$doublons";
1997
-		}
1998
-
1999
-		// Critere d'inclusion {env} (et {self} pour compatibilite ascendante)
2000
-		$flag_env = false;
2001
-		if (isset($_contexte['env']) or isset($_contexte['self'])) {
2002
-			$flag_env = true;
2003
-			unset($_contexte['env']);
2004
-		}
2005
-
2006
-		$_options = [];
2007
-		if (isset($_contexte['ajax'])) {
2008
-			$_options[] = preg_replace(',=>(.*)$,ims', '=> ($v=(\\1))?$v:true', $_contexte['ajax']);
2009
-			unset($_contexte['ajax']);
2010
-		}
2011
-		if ($p->etoile) {
2012
-			$_options[] = "'etoile'=>true";
2013
-		}
2014
-		$_options[] = "'compil'=>array(" . memoriser_contexte_compil($p) . ')';
2015
-
2016
-		$_l = 'array(' . join(",\n\t", $_contexte) . ')';
2017
-		if ($flag_env) {
2018
-			$_l = "array_merge(\$Pile[0],$_l)";
2019
-		}
2020
-
2021
-		$p->code = sprintf(CODE_RECUPERER_FOND, $f, $_l, join(',', $_options), "_request('connect') ?? ''");
2022
-	} elseif (!isset($_contexte[1])) {
2023
-		$msg = ['zbug_balise_sans_argument', ['balise' => ' INCLURE']];
2024
-		erreur_squelette($msg, $p);
2025
-	} else {
2026
-		$p->code = 'charge_scripts(' . $_contexte[1] . ',false)';
2027
-	}
2028
-
2029
-	$p->interdire_scripts = false; // la securite est assuree par recuperer_fond
2030
-	return $p;
1971
+    $id_boucle = $p->id_boucle;
1972
+    // la lang n'est pas passe de facon automatique par argumenter
1973
+    // mais le sera pas recuperer_fond, sauf si etoile=>true est passe
1974
+    // en option
1975
+
1976
+    $_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $id_boucle, false, false);
1977
+
1978
+    // erreur de syntaxe = fond absent
1979
+    // (2 messages d'erreur SPIP pour le prix d'un, mais pas d'erreur PHP
1980
+    if (!$_contexte) {
1981
+        $contexte = [];
1982
+    }
1983
+
1984
+    if (isset($_contexte['fond'])) {
1985
+        $f = $_contexte['fond'];
1986
+        // toujours vrai :
1987
+        if (preg_match('/^.fond.\s*=>(.*)$/s', $f, $r)) {
1988
+            $f = $r[1];
1989
+            unset($_contexte['fond']);
1990
+        } else {
1991
+            spip_log('compilation de #INCLURE a revoir');
1992
+        }
1993
+
1994
+        // #INCLURE{doublons}
1995
+        if (isset($_contexte['doublons'])) {
1996
+            $_contexte['doublons'] = "'doublons' => \$doublons";
1997
+        }
1998
+
1999
+        // Critere d'inclusion {env} (et {self} pour compatibilite ascendante)
2000
+        $flag_env = false;
2001
+        if (isset($_contexte['env']) or isset($_contexte['self'])) {
2002
+            $flag_env = true;
2003
+            unset($_contexte['env']);
2004
+        }
2005
+
2006
+        $_options = [];
2007
+        if (isset($_contexte['ajax'])) {
2008
+            $_options[] = preg_replace(',=>(.*)$,ims', '=> ($v=(\\1))?$v:true', $_contexte['ajax']);
2009
+            unset($_contexte['ajax']);
2010
+        }
2011
+        if ($p->etoile) {
2012
+            $_options[] = "'etoile'=>true";
2013
+        }
2014
+        $_options[] = "'compil'=>array(" . memoriser_contexte_compil($p) . ')';
2015
+
2016
+        $_l = 'array(' . join(",\n\t", $_contexte) . ')';
2017
+        if ($flag_env) {
2018
+            $_l = "array_merge(\$Pile[0],$_l)";
2019
+        }
2020
+
2021
+        $p->code = sprintf(CODE_RECUPERER_FOND, $f, $_l, join(',', $_options), "_request('connect') ?? ''");
2022
+    } elseif (!isset($_contexte[1])) {
2023
+        $msg = ['zbug_balise_sans_argument', ['balise' => ' INCLURE']];
2024
+        erreur_squelette($msg, $p);
2025
+    } else {
2026
+        $p->code = 'charge_scripts(' . $_contexte[1] . ',false)';
2027
+    }
2028
+
2029
+    $p->interdire_scripts = false; // la securite est assuree par recuperer_fond
2030
+    return $p;
2031 2031
 }
2032 2032
 
2033 2033
 
@@ -2055,69 +2055,69 @@  discard block
 block discarded – undo
2055 2055
  **/
2056 2056
 function balise_MODELE_dist($p) {
2057 2057
 
2058
-	$_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $p->id_boucle, false);
2059
-
2060
-	// erreur de syntaxe = fond absent
2061
-	// (2 messages d'erreur SPIP pour le prix d'un, mais pas d'erreur PHP
2062
-	if (!$_contexte) {
2063
-		$_contexte = [];
2064
-	}
2065
-
2066
-	if (!isset($_contexte[1])) {
2067
-		$msg = ['zbug_balise_sans_argument', ['balise' => ' MODELE']];
2068
-		erreur_squelette($msg, $p);
2069
-	} else {
2070
-		$nom = $_contexte[1];
2071
-		unset($_contexte[1]);
2072
-
2073
-		if (preg_match("/^\s*'[^']*'/s", $nom)) {
2074
-			$nom = "'modeles/" . substr($nom, 1);
2075
-		} else {
2076
-			$nom = "'modeles/' . $nom";
2077
-		}
2078
-
2079
-		$flag_env = false;
2080
-		if (isset($_contexte['env'])) {
2081
-			$flag_env = true;
2082
-			unset($_contexte['env']);
2083
-		}
2084
-
2085
-		// Incoherence dans la syntaxe du contexte. A revoir.
2086
-		// Reserver la cle primaire de la boucle courante si elle existe
2087
-		if (isset($p->boucles[$p->id_boucle]->primary)) {
2088
-			$primary = $p->boucles[$p->id_boucle]->primary;
2089
-			if (!strpos($primary, ',')) {
2090
-				$id = champ_sql($primary, $p);
2091
-				$_contexte[] = "'$primary'=>" . $id;
2092
-				$_contexte[] = "'id'=>" . $id;
2093
-			}
2094
-		}
2095
-		$_contexte[] = "'recurs'=>(++\$recurs)";
2096
-		$connect = '';
2097
-		if (isset($p->boucles[$p->id_boucle])) {
2098
-			$connect = $p->boucles[$p->id_boucle]->sql_serveur;
2099
-		}
2100
-
2101
-		$_options = memoriser_contexte_compil($p);
2102
-		$_options = "'compil'=>array($_options), 'trim'=>true";
2103
-		if (isset($_contexte['ajax'])) {
2104
-			$_options .= ', ' . preg_replace(',=>(.*)$,ims', '=> ($v=(\\1))?$v:true', $_contexte['ajax']);
2105
-			unset($_contexte['ajax']);
2106
-		}
2107
-
2108
-		$_l = 'array(' . join(",\n\t", $_contexte) . ')';
2109
-		if ($flag_env) {
2110
-			$_l = "array_merge(\$Pile[0],$_l)";
2111
-		}
2112
-
2113
-		$page = sprintf(CODE_RECUPERER_FOND, $nom, $_l, $_options, _q($connect));
2114
-
2115
-		$p->code = "\n\t(((\$recurs=(isset(\$Pile[0]['recurs'])?\$Pile[0]['recurs']:0))>=5)? '' :\n\t$page)\n";
2116
-
2117
-		$p->interdire_scripts = false; // securite assuree par le squelette
2118
-	}
2119
-
2120
-	return $p;
2058
+    $_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $p->id_boucle, false);
2059
+
2060
+    // erreur de syntaxe = fond absent
2061
+    // (2 messages d'erreur SPIP pour le prix d'un, mais pas d'erreur PHP
2062
+    if (!$_contexte) {
2063
+        $_contexte = [];
2064
+    }
2065
+
2066
+    if (!isset($_contexte[1])) {
2067
+        $msg = ['zbug_balise_sans_argument', ['balise' => ' MODELE']];
2068
+        erreur_squelette($msg, $p);
2069
+    } else {
2070
+        $nom = $_contexte[1];
2071
+        unset($_contexte[1]);
2072
+
2073
+        if (preg_match("/^\s*'[^']*'/s", $nom)) {
2074
+            $nom = "'modeles/" . substr($nom, 1);
2075
+        } else {
2076
+            $nom = "'modeles/' . $nom";
2077
+        }
2078
+
2079
+        $flag_env = false;
2080
+        if (isset($_contexte['env'])) {
2081
+            $flag_env = true;
2082
+            unset($_contexte['env']);
2083
+        }
2084
+
2085
+        // Incoherence dans la syntaxe du contexte. A revoir.
2086
+        // Reserver la cle primaire de la boucle courante si elle existe
2087
+        if (isset($p->boucles[$p->id_boucle]->primary)) {
2088
+            $primary = $p->boucles[$p->id_boucle]->primary;
2089
+            if (!strpos($primary, ',')) {
2090
+                $id = champ_sql($primary, $p);
2091
+                $_contexte[] = "'$primary'=>" . $id;
2092
+                $_contexte[] = "'id'=>" . $id;
2093
+            }
2094
+        }
2095
+        $_contexte[] = "'recurs'=>(++\$recurs)";
2096
+        $connect = '';
2097
+        if (isset($p->boucles[$p->id_boucle])) {
2098
+            $connect = $p->boucles[$p->id_boucle]->sql_serveur;
2099
+        }
2100
+
2101
+        $_options = memoriser_contexte_compil($p);
2102
+        $_options = "'compil'=>array($_options), 'trim'=>true";
2103
+        if (isset($_contexte['ajax'])) {
2104
+            $_options .= ', ' . preg_replace(',=>(.*)$,ims', '=> ($v=(\\1))?$v:true', $_contexte['ajax']);
2105
+            unset($_contexte['ajax']);
2106
+        }
2107
+
2108
+        $_l = 'array(' . join(",\n\t", $_contexte) . ')';
2109
+        if ($flag_env) {
2110
+            $_l = "array_merge(\$Pile[0],$_l)";
2111
+        }
2112
+
2113
+        $page = sprintf(CODE_RECUPERER_FOND, $nom, $_l, $_options, _q($connect));
2114
+
2115
+        $p->code = "\n\t(((\$recurs=(isset(\$Pile[0]['recurs'])?\$Pile[0]['recurs']:0))>=5)? '' :\n\t$page)\n";
2116
+
2117
+        $p->interdire_scripts = false; // securite assuree par le squelette
2118
+    }
2119
+
2120
+    return $p;
2121 2121
 }
2122 2122
 
2123 2123
 
@@ -2141,21 +2141,21 @@  discard block
 block discarded – undo
2141 2141
  *     Pile complétée par le code à générer
2142 2142
  **/
2143 2143
 function balise_SET_dist($p) {
2144
-	$_nom = interprete_argument_balise(1, $p);
2145
-	$_val = interprete_argument_balise(2, $p);
2144
+    $_nom = interprete_argument_balise(1, $p);
2145
+    $_val = interprete_argument_balise(2, $p);
2146 2146
 
2147
-	if (!$_nom or !$_val) {
2148
-		$err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'SET']];
2149
-		erreur_squelette($err_b_s_a, $p);
2150
-	}
2151
-	// affectation $_zzz inutile, mais permet de contourner un bug OpCode cache sous PHP 5.5.4
2152
-	// cf https://bugs.php.net/bug.php?id=65845
2153
-	else {
2154
-		$p->code = "vide(\$Pile['vars'][\$_zzz=(string)$_nom] = $_val)";
2155
-	}
2147
+    if (!$_nom or !$_val) {
2148
+        $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'SET']];
2149
+        erreur_squelette($err_b_s_a, $p);
2150
+    }
2151
+    // affectation $_zzz inutile, mais permet de contourner un bug OpCode cache sous PHP 5.5.4
2152
+    // cf https://bugs.php.net/bug.php?id=65845
2153
+    else {
2154
+        $p->code = "vide(\$Pile['vars'][\$_zzz=(string)$_nom] = $_val)";
2155
+    }
2156 2156
 
2157
-	$p->interdire_scripts = false; // la balise ne renvoie rien
2158
-	return $p;
2157
+    $p->interdire_scripts = false; // la balise ne renvoie rien
2158
+    return $p;
2159 2159
 }
2160 2160
 
2161 2161
 
@@ -2185,12 +2185,12 @@  discard block
 block discarded – undo
2185 2185
  *     Pile complétée par le code à générer
2186 2186
  **/
2187 2187
 function balise_GET_dist($p) {
2188
-	$p->interdire_scripts = false; // le contenu vient de #SET, donc il est de confiance
2189
-	if (function_exists('balise_ENV')) {
2190
-		return balise_ENV($p, '$Pile["vars"]??[]');
2191
-	} else {
2192
-		return balise_ENV_dist($p, '$Pile["vars"]??[]');
2193
-	}
2188
+    $p->interdire_scripts = false; // le contenu vient de #SET, donc il est de confiance
2189
+    if (function_exists('balise_ENV')) {
2190
+        return balise_ENV($p, '$Pile["vars"]??[]');
2191
+    } else {
2192
+        return balise_ENV_dist($p, '$Pile["vars"]??[]');
2193
+    }
2194 2194
 }
2195 2195
 
2196 2196
 
@@ -2213,22 +2213,22 @@  discard block
 block discarded – undo
2213 2213
  *     Pile complétée par le code à générer
2214 2214
  **/
2215 2215
 function balise_DOUBLONS_dist($p) {
2216
-	if ($type = interprete_argument_balise(1, $p)) {
2217
-		if ($famille = interprete_argument_balise(2, $p)) {
2218
-			$type .= '.' . $famille;
2219
-		}
2220
-		$p->code = '(isset($doublons[' . $type . ']) ? $doublons[' . $type . '] : "")';
2221
-		if (!$p->etoile) {
2222
-			$p->code = 'array_filter(array_map("intval",explode(",",'
2223
-				. $p->code . ')))';
2224
-		}
2225
-	} else {
2226
-		$p->code = '$doublons';
2227
-	}
2216
+    if ($type = interprete_argument_balise(1, $p)) {
2217
+        if ($famille = interprete_argument_balise(2, $p)) {
2218
+            $type .= '.' . $famille;
2219
+        }
2220
+        $p->code = '(isset($doublons[' . $type . ']) ? $doublons[' . $type . '] : "")';
2221
+        if (!$p->etoile) {
2222
+            $p->code = 'array_filter(array_map("intval",explode(",",'
2223
+                . $p->code . ')))';
2224
+        }
2225
+    } else {
2226
+        $p->code = '$doublons';
2227
+    }
2228 2228
 
2229
-	$p->interdire_scripts = false;
2229
+    $p->interdire_scripts = false;
2230 2230
 
2231
-	return $p;
2231
+    return $p;
2232 2232
 }
2233 2233
 
2234 2234
 
@@ -2251,18 +2251,18 @@  discard block
 block discarded – undo
2251 2251
  *     Pile complétée par le code à générer
2252 2252
  **/
2253 2253
 function balise_PIPELINE_dist($p) {
2254
-	$_pipe = interprete_argument_balise(1, $p);
2255
-	if (!$_pipe) {
2256
-		$err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'PIPELINE']];
2257
-		erreur_squelette($err_b_s_a, $p);
2258
-	} else {
2259
-		$_flux = interprete_argument_balise(2, $p);
2260
-		$_flux = $_flux ?: "''";
2261
-		$p->code = "pipeline( $_pipe , $_flux )";
2262
-		$p->interdire_scripts = false;
2263
-	}
2254
+    $_pipe = interprete_argument_balise(1, $p);
2255
+    if (!$_pipe) {
2256
+        $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'PIPELINE']];
2257
+        erreur_squelette($err_b_s_a, $p);
2258
+    } else {
2259
+        $_flux = interprete_argument_balise(2, $p);
2260
+        $_flux = $_flux ?: "''";
2261
+        $p->code = "pipeline( $_pipe , $_flux )";
2262
+        $p->interdire_scripts = false;
2263
+    }
2264 2264
 
2265
-	return $p;
2265
+    return $p;
2266 2266
 }
2267 2267
 
2268 2268
 
@@ -2287,10 +2287,10 @@  discard block
 block discarded – undo
2287 2287
  *     Pile complétée par le code à générer
2288 2288
  **/
2289 2289
 function balise_EDIT_dist($p) {
2290
-	$p->code = "''";
2291
-	$p->interdire_scripts = false;
2290
+    $p->code = "''";
2291
+    $p->interdire_scripts = false;
2292 2292
 
2293
-	return $p;
2293
+    return $p;
2294 2294
 }
2295 2295
 
2296 2296
 
@@ -2313,11 +2313,11 @@  discard block
 block discarded – undo
2313 2313
  *     Pile complétée par le code à générer
2314 2314
  **/
2315 2315
 function balise_TOTAL_UNIQUE_dist($p) {
2316
-	$_famille = interprete_argument_balise(1, $p);
2317
-	$_famille = $_famille ?: "''";
2318
-	$p->code = "unique('', $_famille, true)";
2316
+    $_famille = interprete_argument_balise(1, $p);
2317
+    $_famille = $_famille ?: "''";
2318
+    $p->code = "unique('', $_famille, true)";
2319 2319
 
2320
-	return $p;
2320
+    return $p;
2321 2321
 }
2322 2322
 
2323 2323
 /**
@@ -2340,19 +2340,19 @@  discard block
 block discarded – undo
2340 2340
  *     Pile complétée par le code à générer
2341 2341
  **/
2342 2342
 function balise_ARRAY_dist($p) {
2343
-	$_code = [];
2344
-	$n = 1;
2345
-	do {
2346
-		$_key = interprete_argument_balise($n++, $p);
2347
-		$_val = interprete_argument_balise($n++, $p);
2348
-		if ($_key and $_val) {
2349
-			$_code[] = "$_key => $_val";
2350
-		}
2351
-	} while ($_key && $_val);
2352
-	$p->code = 'array(' . join(', ', $_code) . ')';
2353
-	$p->interdire_scripts = false;
2343
+    $_code = [];
2344
+    $n = 1;
2345
+    do {
2346
+        $_key = interprete_argument_balise($n++, $p);
2347
+        $_val = interprete_argument_balise($n++, $p);
2348
+        if ($_key and $_val) {
2349
+            $_code[] = "$_key => $_val";
2350
+        }
2351
+    } while ($_key && $_val);
2352
+    $p->code = 'array(' . join(', ', $_code) . ')';
2353
+    $p->interdire_scripts = false;
2354 2354
 
2355
-	return $p;
2355
+    return $p;
2356 2356
 }
2357 2357
 
2358 2358
 /**
@@ -2371,15 +2371,15 @@  discard block
 block discarded – undo
2371 2371
  *     Pile complétée par le code à générer
2372 2372
  */
2373 2373
 function balise_LISTE_dist($p) {
2374
-	$_code = [];
2375
-	$n = 1;
2376
-	while ($_val = interprete_argument_balise($n++, $p)) {
2377
-		$_code[] = $_val;
2378
-	}
2379
-	$p->code = 'array(' . join(', ', $_code) . ')';
2380
-	$p->interdire_scripts = false;
2374
+    $_code = [];
2375
+    $n = 1;
2376
+    while ($_val = interprete_argument_balise($n++, $p)) {
2377
+        $_code[] = $_val;
2378
+    }
2379
+    $p->code = 'array(' . join(', ', $_code) . ')';
2380
+    $p->interdire_scripts = false;
2381 2381
 
2382
-	return $p;
2382
+    return $p;
2383 2383
 }
2384 2384
 
2385 2385
 
@@ -2413,21 +2413,21 @@  discard block
 block discarded – undo
2413 2413
  *     Pile complétée par le code à générer
2414 2414
  **/
2415 2415
 function balise_AUTORISER_dist($p) {
2416
-	$_code = [];
2417
-	$p->descr['session'] = true; // faire un cache par session
2416
+    $_code = [];
2417
+    $p->descr['session'] = true; // faire un cache par session
2418 2418
 
2419
-	$n = 1;
2420
-	while ($_v = interprete_argument_balise($n++, $p)) {
2421
-		$_code[] = $_v;
2422
-	}
2419
+    $n = 1;
2420
+    while ($_v = interprete_argument_balise($n++, $p)) {
2421
+        $_code[] = $_v;
2422
+    }
2423 2423
 
2424
-	$p->code = '((function_exists("autoriser")||include_spip("inc/autoriser"))&&autoriser(' . join(
2425
-		', ',
2426
-		$_code
2427
-	) . ')?" ":"")';
2428
-	$p->interdire_scripts = false;
2424
+    $p->code = '((function_exists("autoriser")||include_spip("inc/autoriser"))&&autoriser(' . join(
2425
+        ', ',
2426
+        $_code
2427
+    ) . ')?" ":"")';
2428
+    $p->interdire_scripts = false;
2429 2429
 
2430
-	return $p;
2430
+    return $p;
2431 2431
 }
2432 2432
 
2433 2433
 
@@ -2451,15 +2451,15 @@  discard block
 block discarded – undo
2451 2451
  *     Pile complétée par le code à générer
2452 2452
  **/
2453 2453
 function balise_PLUGIN_dist($p) {
2454
-	$plugin = interprete_argument_balise(1, $p);
2455
-	$plugin = isset($plugin) ? str_replace('\'', '"', $plugin) : '""';
2456
-	$type_info = interprete_argument_balise(2, $p);
2457
-	$type_info = isset($type_info) ? str_replace('\'', '"', $type_info) : '"est_actif"';
2454
+    $plugin = interprete_argument_balise(1, $p);
2455
+    $plugin = isset($plugin) ? str_replace('\'', '"', $plugin) : '""';
2456
+    $type_info = interprete_argument_balise(2, $p);
2457
+    $type_info = isset($type_info) ? str_replace('\'', '"', $type_info) : '"est_actif"';
2458 2458
 
2459
-	$f = chercher_filtre('info_plugin');
2460
-	$p->code = $f . '(' . $plugin . ', ' . $type_info . ')';
2459
+    $f = chercher_filtre('info_plugin');
2460
+    $p->code = $f . '(' . $plugin . ', ' . $type_info . ')';
2461 2461
 
2462
-	return $p;
2462
+    return $p;
2463 2463
 }
2464 2464
 
2465 2465
 /**
@@ -2480,9 +2480,9 @@  discard block
 block discarded – undo
2480 2480
  *     Pile complétée par le code à générer
2481 2481
  **/
2482 2482
 function balise_AIDER_dist($p) {
2483
-	$_motif = interprete_argument_balise(1, $p);
2484
-	$p->code = "((\$aider=charger_fonction('aide','inc',true))?\$aider($_motif):'')";
2485
-	return $p;
2483
+    $_motif = interprete_argument_balise(1, $p);
2484
+    $p->code = "((\$aider=charger_fonction('aide','inc',true))?\$aider($_motif):'')";
2485
+    return $p;
2486 2486
 }
2487 2487
 
2488 2488
 /**
@@ -2508,16 +2508,16 @@  discard block
 block discarded – undo
2508 2508
  *     Pile complétée par le code à générer
2509 2509
  **/
2510 2510
 function balise_ACTION_FORMULAIRE($p) {
2511
-	if (!$_url = interprete_argument_balise(1, $p)) {
2512
-		$_url = "(\$Pile[0]['action'] ?? '')";
2513
-	}
2514
-	if (!$_form = interprete_argument_balise(2, $p)) {
2515
-		$_form = "(\$Pile[0]['form'] ?? '')";
2516
-	}
2517
-
2518
-	// envoyer le nom du formulaire que l'on traite
2519
-	// transmettre les eventuels args de la balise formulaire
2520
-	$p->code = "	'<span class=\"form-hidden\">' .
2511
+    if (!$_url = interprete_argument_balise(1, $p)) {
2512
+        $_url = "(\$Pile[0]['action'] ?? '')";
2513
+    }
2514
+    if (!$_form = interprete_argument_balise(2, $p)) {
2515
+        $_form = "(\$Pile[0]['form'] ?? '')";
2516
+    }
2517
+
2518
+    // envoyer le nom du formulaire que l'on traite
2519
+    // transmettre les eventuels args de la balise formulaire
2520
+    $p->code = "	'<span class=\"form-hidden\">' .
2521 2521
 	form_hidden($_url) .
2522 2522
 	'<input name=\'formulaire_action\' type=\'hidden\'
2523 2523
 		value=\'' . $_form . '\' />' .
@@ -2528,9 +2528,9 @@  discard block
 block discarded – undo
2528 2528
 	(\$Pile[0]['_hidden'] ?? '') .
2529 2529
 	'</span>'";
2530 2530
 
2531
-	$p->interdire_scripts = false;
2531
+    $p->interdire_scripts = false;
2532 2532
 
2533
-	return $p;
2533
+    return $p;
2534 2534
 }
2535 2535
 
2536 2536
 
@@ -2571,25 +2571,25 @@  discard block
 block discarded – undo
2571 2571
  */
2572 2572
 function balise_BOUTON_ACTION_dist($p) {
2573 2573
 
2574
-	$args = [];
2575
-	for ($k = 1; $k <= 6; $k++) {
2576
-		$_a = interprete_argument_balise($k, $p);
2577
-		if (!$_a) {
2578
-			$_a = "''";
2579
-		}
2580
-		$args[] = $_a;
2581
-	}
2582
-	// supprimer les args vides
2583
-	while (end($args) == "''" and count($args) > 2) {
2584
-		array_pop($args);
2585
-	}
2586
-	$args = implode(',', $args);
2574
+    $args = [];
2575
+    for ($k = 1; $k <= 6; $k++) {
2576
+        $_a = interprete_argument_balise($k, $p);
2577
+        if (!$_a) {
2578
+            $_a = "''";
2579
+        }
2580
+        $args[] = $_a;
2581
+    }
2582
+    // supprimer les args vides
2583
+    while (end($args) == "''" and count($args) > 2) {
2584
+        array_pop($args);
2585
+    }
2586
+    $args = implode(',', $args);
2587 2587
 
2588
-	$bouton_action = chercher_filtre('bouton_action');
2589
-	$p->code = "$bouton_action($args)";
2590
-	$p->interdire_scripts = false;
2588
+    $bouton_action = chercher_filtre('bouton_action');
2589
+    $p->code = "$bouton_action($args)";
2590
+    $p->interdire_scripts = false;
2591 2591
 
2592
-	return $p;
2592
+    return $p;
2593 2593
 }
2594 2594
 
2595 2595
 
@@ -2608,10 +2608,10 @@  discard block
 block discarded – undo
2608 2608
  *     Pile complétée par le code à générer
2609 2609
  */
2610 2610
 function balise_SLOGAN_SITE_SPIP_dist($p) {
2611
-	$p->code = "\$GLOBALS['meta']['slogan_site']";
2611
+    $p->code = "\$GLOBALS['meta']['slogan_site']";
2612 2612
 
2613
-	#$p->interdire_scripts = true;
2614
-	return $p;
2613
+    #$p->interdire_scripts = true;
2614
+    return $p;
2615 2615
 }
2616 2616
 
2617 2617
 
@@ -2635,10 +2635,10 @@  discard block
 block discarded – undo
2635 2635
  *     Pile complétée par le code à générer
2636 2636
  */
2637 2637
 function balise_HTML5_dist($p) {
2638
-	$p->code = html5_permis() ? "' '" : "''";
2639
-	$p->interdire_scripts = false;
2638
+    $p->code = html5_permis() ? "' '" : "''";
2639
+    $p->interdire_scripts = false;
2640 2640
 
2641
-	return $p;
2641
+    return $p;
2642 2642
 }
2643 2643
 
2644 2644
 
@@ -2664,58 +2664,58 @@  discard block
 block discarded – undo
2664 2664
  *     Pile complétée par le code à générer
2665 2665
  */
2666 2666
 function balise_TRI_dist($p, $liste = 'true') {
2667
-	$b = index_boucle_mere($p);
2668
-	// s'il n'y a pas de nom de boucle, on ne peut pas trier
2669
-	if ($b === '') {
2670
-		$msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]];
2671
-		erreur_squelette($msg, $p);
2672
-		$p->code = "''";
2667
+    $b = index_boucle_mere($p);
2668
+    // s'il n'y a pas de nom de boucle, on ne peut pas trier
2669
+    if ($b === '') {
2670
+        $msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]];
2671
+        erreur_squelette($msg, $p);
2672
+        $p->code = "''";
2673 2673
 
2674
-		return $p;
2675
-	}
2676
-	$boucle = $p->boucles[$b];
2674
+        return $p;
2675
+    }
2676
+    $boucle = $p->boucles[$b];
2677 2677
 
2678
-	// s'il n'y a pas de tri_champ, c'est qu'on se trouve
2679
-	// dans un boucle recursive ou qu'on a oublie le critere {tri}
2680
-	if (!isset($boucle->modificateur['tri_champ'])) {
2681
-		$msg = ['zbug_champ_hors_critere', [
2682
-			'champ' => zbug_presenter_champ($p),
2683
-			'critere' => 'tri'
2684
-		]];
2685
-		erreur_squelette($msg, $p);
2686
-		$p->code = "''";
2678
+    // s'il n'y a pas de tri_champ, c'est qu'on se trouve
2679
+    // dans un boucle recursive ou qu'on a oublie le critere {tri}
2680
+    if (!isset($boucle->modificateur['tri_champ'])) {
2681
+        $msg = ['zbug_champ_hors_critere', [
2682
+            'champ' => zbug_presenter_champ($p),
2683
+            'critere' => 'tri'
2684
+        ]];
2685
+        erreur_squelette($msg, $p);
2686
+        $p->code = "''";
2687 2687
 
2688
-		return $p;
2689
-	}
2688
+        return $p;
2689
+    }
2690 2690
 
2691
-	// Différentes infos relatives au tri présentes dans les modificateurs
2692
-	$_tri_nom = $boucle->modificateur['tri_nom'] ; // nom du paramètre définissant le tri
2693
-	$_tri_champ = $boucle->modificateur['tri_champ']; // champ actuel utilisé le tri
2694
-	$_tri_sens = $boucle->modificateur['tri_sens']; // sens de tri actuel
2695
-	$_tri_liste_sens_defaut = $boucle->modificateur['tri_liste_sens_defaut']; // sens par défaut pour chaque champ
2691
+    // Différentes infos relatives au tri présentes dans les modificateurs
2692
+    $_tri_nom = $boucle->modificateur['tri_nom'] ; // nom du paramètre définissant le tri
2693
+    $_tri_champ = $boucle->modificateur['tri_champ']; // champ actuel utilisé le tri
2694
+    $_tri_sens = $boucle->modificateur['tri_sens']; // sens de tri actuel
2695
+    $_tri_liste_sens_defaut = $boucle->modificateur['tri_liste_sens_defaut']; // sens par défaut pour chaque champ
2696 2696
 
2697
-	$_champ_ou_sens = interprete_argument_balise(1, $p);
2698
-	// si pas de champ, renvoyer le critère de tri actuel
2699
-	if (!$_champ_ou_sens) {
2700
-		$p->code = $_tri_champ;
2697
+    $_champ_ou_sens = interprete_argument_balise(1, $p);
2698
+    // si pas de champ, renvoyer le critère de tri actuel
2699
+    if (!$_champ_ou_sens) {
2700
+        $p->code = $_tri_champ;
2701 2701
 
2702
-		return $p;
2703
-	}
2704
-	// forcer la jointure si besoin, et si le champ est statique
2705
-	if (preg_match(",^'([\w.]+)'$,i", $_champ_ou_sens, $m)) {
2706
-		index_pile($b, $m[1], $p->boucles, '', null, true, false);
2707
-	}
2702
+        return $p;
2703
+    }
2704
+    // forcer la jointure si besoin, et si le champ est statique
2705
+    if (preg_match(",^'([\w.]+)'$,i", $_champ_ou_sens, $m)) {
2706
+        index_pile($b, $m[1], $p->boucles, '', null, true, false);
2707
+    }
2708 2708
 
2709
-	$_libelle = interprete_argument_balise(2, $p);
2710
-	$_libelle = $_libelle ?: $_champ_ou_sens;
2709
+    $_libelle = interprete_argument_balise(2, $p);
2710
+    $_libelle = $_libelle ?: $_champ_ou_sens;
2711 2711
 
2712
-	$_class = interprete_argument_balise(3, $p) ?? "''";
2712
+    $_class = interprete_argument_balise(3, $p) ?? "''";
2713 2713
 
2714
-	$p->code = "calculer_balise_tri($_champ_ou_sens, $_libelle, $_class, $_tri_nom, $_tri_champ, $_tri_sens, $_tri_liste_sens_defaut)";
2714
+    $p->code = "calculer_balise_tri($_champ_ou_sens, $_libelle, $_class, $_tri_nom, $_tri_champ, $_tri_sens, $_tri_liste_sens_defaut)";
2715 2715
 
2716
-	$p->interdire_scripts = false;
2716
+    $p->interdire_scripts = false;
2717 2717
 
2718
-	return $p;
2718
+    return $p;
2719 2719
 }
2720 2720
 
2721 2721
 
@@ -2736,21 +2736,21 @@  discard block
 block discarded – undo
2736 2736
  *     Pile complétée par le code à générer
2737 2737
  */
2738 2738
 function balise_SAUTER_dist($p) {
2739
-	$id_boucle = $p->id_boucle;
2739
+    $id_boucle = $p->id_boucle;
2740 2740
 
2741
-	if (empty($p->boucles[$id_boucle])) {
2742
-		$msg = ['zbug_champ_hors_boucle', ['champ' => '#SAUTER']];
2743
-		erreur_squelette($msg, $p);
2744
-	} else {
2745
-		$_saut = interprete_argument_balise(1, $p);
2746
-		$_compteur = "\$Numrows['$id_boucle']['compteur_boucle']";
2747
-		$_total = "(\$Numrows['$id_boucle']['total'] ?? null)";
2741
+    if (empty($p->boucles[$id_boucle])) {
2742
+        $msg = ['zbug_champ_hors_boucle', ['champ' => '#SAUTER']];
2743
+        erreur_squelette($msg, $p);
2744
+    } else {
2745
+        $_saut = interprete_argument_balise(1, $p);
2746
+        $_compteur = "\$Numrows['$id_boucle']['compteur_boucle']";
2747
+        $_total = "(\$Numrows['$id_boucle']['total'] ?? null)";
2748 2748
 
2749
-		$p->code = "vide($_compteur=\$iter->skip($_saut,$_total))";
2750
-	}
2751
-	$p->interdire_scripts = false;
2749
+        $p->code = "vide($_compteur=\$iter->skip($_saut,$_total))";
2750
+    }
2751
+    $p->interdire_scripts = false;
2752 2752
 
2753
-	return $p;
2753
+    return $p;
2754 2754
 }
2755 2755
 
2756 2756
 
@@ -2772,22 +2772,22 @@  discard block
 block discarded – undo
2772 2772
  *     Pile complétée par le code à générer
2773 2773
  */
2774 2774
 function balise_PUBLIE_dist($p) {
2775
-	if (!$_type = interprete_argument_balise(1, $p)) {
2776
-		$_type = _q($p->type_requete);
2777
-		$_id = champ_sql($p->boucles[$p->id_boucle]->primary, $p);
2778
-	} else {
2779
-		$_id = interprete_argument_balise(2, $p);
2780
-	}
2775
+    if (!$_type = interprete_argument_balise(1, $p)) {
2776
+        $_type = _q($p->type_requete);
2777
+        $_id = champ_sql($p->boucles[$p->id_boucle]->primary, $p);
2778
+    } else {
2779
+        $_id = interprete_argument_balise(2, $p);
2780
+    }
2781 2781
 
2782
-	$connect = '';
2783
-	if (isset($p->boucles[$p->id_boucle])) {
2784
-		$connect = $p->boucles[$p->id_boucle]->sql_serveur;
2785
-	}
2782
+    $connect = '';
2783
+    if (isset($p->boucles[$p->id_boucle])) {
2784
+        $connect = $p->boucles[$p->id_boucle]->sql_serveur;
2785
+    }
2786 2786
 
2787
-	$p->code = '(objet_test_si_publie(' . $_type . ',intval(' . $_id . '),' . _q($connect) . ")?' ':'')";
2788
-	$p->interdire_scripts = false;
2787
+    $p->code = '(objet_test_si_publie(' . $_type . ',intval(' . $_id . '),' . _q($connect) . ")?' ':'')";
2788
+    $p->interdire_scripts = false;
2789 2789
 
2790
-	return $p;
2790
+    return $p;
2791 2791
 }
2792 2792
 
2793 2793
 /**
@@ -2816,12 +2816,12 @@  discard block
 block discarded – undo
2816 2816
  *     Pile complétée par le code à générer
2817 2817
  */
2818 2818
 function balise_PRODUIRE_dist($p) {
2819
-	$balise_inclure = charger_fonction('INCLURE', 'balise');
2820
-	$p = $balise_inclure($p);
2819
+    $balise_inclure = charger_fonction('INCLURE', 'balise');
2820
+    $p = $balise_inclure($p);
2821 2821
 
2822
-	$p->code = str_replace('recuperer_fond(', 'produire_fond_statique(', $p->code);
2822
+    $p->code = str_replace('recuperer_fond(', 'produire_fond_statique(', $p->code);
2823 2823
 
2824
-	return $p;
2824
+    return $p;
2825 2825
 }
2826 2826
 
2827 2827
 /**
@@ -2840,13 +2840,13 @@  discard block
 block discarded – undo
2840 2840
  *     Pile complétée par le code à générer
2841 2841
  */
2842 2842
 function balise_LARGEUR_ECRAN_dist($p) {
2843
-	$_class = interprete_argument_balise(1, $p);
2844
-	if (!$_class) {
2845
-		$_class = 'null';
2846
-	}
2847
-	$p->code = "(is_string($_class)?vide(\$GLOBALS['largeur_ecran']=$_class):(isset(\$GLOBALS['largeur_ecran'])?\$GLOBALS['largeur_ecran']:''))";
2843
+    $_class = interprete_argument_balise(1, $p);
2844
+    if (!$_class) {
2845
+        $_class = 'null';
2846
+    }
2847
+    $p->code = "(is_string($_class)?vide(\$GLOBALS['largeur_ecran']=$_class):(isset(\$GLOBALS['largeur_ecran'])?\$GLOBALS['largeur_ecran']:''))";
2848 2848
 
2849
-	return $p;
2849
+    return $p;
2850 2850
 }
2851 2851
 
2852 2852
 
@@ -2862,14 +2862,14 @@  discard block
 block discarded – undo
2862 2862
  *     Pile complétée par le code à générer
2863 2863
  **/
2864 2864
 function balise_CONST_dist($p) {
2865
-	$_const = interprete_argument_balise(1, $p);
2866
-	if (!strlen($_const ?? '')) {
2867
-		$p->code = "''";
2868
-	}
2869
-	else {
2870
-		$p->code = "(defined($_const)?constant($_const):'')";
2871
-	}
2872
-	$p->interdire_scripts = false;
2873
-
2874
-	return $p;
2865
+    $_const = interprete_argument_balise(1, $p);
2866
+    if (!strlen($_const ?? '')) {
2867
+        $p->code = "''";
2868
+    }
2869
+    else {
2870
+        $p->code = "(defined($_const)?constant($_const):'')";
2871
+    }
2872
+    $p->interdire_scripts = false;
2873
+
2874
+    return $p;
2875 2875
 }
Please login to merge, or discard this patch.
ecrire/balise/formulaire_.php 1 patch
Indentation   +251 added lines, -251 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @package SPIP\Core\Formulaires
17 17
  **/
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 include_spip('inc/filtres');
@@ -35,22 +35,22 @@  discard block
 block discarded – undo
35 35
  *     Saisie protégée
36 36
  **/
37 37
 function protege_champ($texte) {
38
-	if (is_array($texte)) {
39
-		return array_map('protege_champ', $texte);
40
-	} elseif ($texte === null) {
41
-		return $texte;
42
-	} elseif (is_bool($texte)) {
43
-		return $texte ? '1' : '';
44
-	} elseif (is_string($texte) and $texte) {
45
-		if (preg_match(',^[abis]:\d+[:;],', $texte) and @unserialize($texte) !== false) {
46
-			// ne pas corrompre une valeur serialize
47
-			return $texte;
48
-		} elseif (strpbrk($texte, "&\"'<>") !== false) {
49
-			return spip_htmlspecialchars($texte, ENT_QUOTES);
50
-		}
51
-	}
52
-
53
-	return $texte;
38
+    if (is_array($texte)) {
39
+        return array_map('protege_champ', $texte);
40
+    } elseif ($texte === null) {
41
+        return $texte;
42
+    } elseif (is_bool($texte)) {
43
+        return $texte ? '1' : '';
44
+    } elseif (is_string($texte) and $texte) {
45
+        if (preg_match(',^[abis]:\d+[:;],', $texte) and @unserialize($texte) !== false) {
46
+            // ne pas corrompre une valeur serialize
47
+            return $texte;
48
+        } elseif (strpbrk($texte, "&\"'<>") !== false) {
49
+            return spip_htmlspecialchars($texte, ENT_QUOTES);
50
+        }
51
+    }
52
+
53
+    return $texte;
54 54
 }
55 55
 
56 56
 /**
@@ -64,17 +64,17 @@  discard block
 block discarded – undo
64 64
  *     - false : pas de squelette trouvé
65 65
  **/
66 66
 function existe_formulaire($form) {
67
-	if (substr($form, 0, 11) == 'FORMULAIRE_') {
68
-		$form = strtolower(substr($form, 11));
69
-	} else {
70
-		$form = strtolower($form);
71
-	}
67
+    if (substr($form, 0, 11) == 'FORMULAIRE_') {
68
+        $form = strtolower(substr($form, 11));
69
+    } else {
70
+        $form = strtolower($form);
71
+    }
72 72
 
73
-	if (!$form) {
74
-		return '';
75
-	} // on ne sait pas, le nom du formulaire n'est pas fourni ici
73
+    if (!$form) {
74
+        return '';
75
+    } // on ne sait pas, le nom du formulaire n'est pas fourni ici
76 76
 
77
-	return trouver_fond($form, 'formulaires/') ? $form : false;
77
+    return trouver_fond($form, 'formulaires/') ? $form : false;
78 78
 }
79 79
 
80 80
 /**
@@ -83,31 +83,31 @@  discard block
 block discarded – undo
83 83
  * @return false|array
84 84
  */
85 85
 function test_formulaire_inclus_par_modele() {
86
-	$trace = debug_backtrace(0, 20);
87
-	$trace_fonctions = array_column($trace, 'function');
88
-	$trace_fonctions = array_map('strtolower', $trace_fonctions);
89
-
90
-	// regarder si un flag a ete leve juste avant l'appel de balise_FORMULAIRE_dyn
91
-	if (
92
-		function_exists('arguments_balise_dyn_depuis_modele')
93
-		and $form = arguments_balise_dyn_depuis_modele(null, 'read')
94
-	) {
95
-		if (in_array('balise_formulaire__dyn', $trace_fonctions)) {
96
-			$k = array_search('balise_formulaire__dyn', $trace_fonctions);
97
-			if ($trace[$k]['args'][0] === $form) {
98
-				return $trace[$k]['args'];
99
-			}
100
-		}
101
-	}
102
-
103
-	// fallback qui ne repose pas sur le flag lie a l'analyse de contexte_compil,
104
-	// mais ne marche pas si executer_balise_dynamique est appelee via du php dans le squelette
105
-	if (in_array('eval', $trace_fonctions) and in_array('inclure_modele', $trace_fonctions)) {
106
-		$k = array_search('inclure_modele', $trace_fonctions);
107
-		// les arguments de recuperer_fond() passes par inclure_modele()
108
-		return $trace[$k - 1]['args'][1]['args'];
109
-	}
110
-	return false;
86
+    $trace = debug_backtrace(0, 20);
87
+    $trace_fonctions = array_column($trace, 'function');
88
+    $trace_fonctions = array_map('strtolower', $trace_fonctions);
89
+
90
+    // regarder si un flag a ete leve juste avant l'appel de balise_FORMULAIRE_dyn
91
+    if (
92
+        function_exists('arguments_balise_dyn_depuis_modele')
93
+        and $form = arguments_balise_dyn_depuis_modele(null, 'read')
94
+    ) {
95
+        if (in_array('balise_formulaire__dyn', $trace_fonctions)) {
96
+            $k = array_search('balise_formulaire__dyn', $trace_fonctions);
97
+            if ($trace[$k]['args'][0] === $form) {
98
+                return $trace[$k]['args'];
99
+            }
100
+        }
101
+    }
102
+
103
+    // fallback qui ne repose pas sur le flag lie a l'analyse de contexte_compil,
104
+    // mais ne marche pas si executer_balise_dynamique est appelee via du php dans le squelette
105
+    if (in_array('eval', $trace_fonctions) and in_array('inclure_modele', $trace_fonctions)) {
106
+        $k = array_search('inclure_modele', $trace_fonctions);
107
+        // les arguments de recuperer_fond() passes par inclure_modele()
108
+        return $trace[$k - 1]['args'][1]['args'];
109
+    }
110
+    return false;
111 111
 }
112 112
 
113 113
 /**
@@ -122,19 +122,19 @@  discard block
 block discarded – undo
122 122
  **/
123 123
 function balise_FORMULAIRE__dist($p) {
124 124
 
125
-	// Cas d'un #FORMULAIRE_TOTO inexistant : renvoyer la chaine vide.
126
-	// mais si #FORMULAIRE_{toto} on ne peut pas savoir a la compilation, continuer
127
-	if (existe_formulaire($p->nom_champ) === false) {
128
-		$p->code = "''";
129
-		$p->interdire_scripts = false;
125
+    // Cas d'un #FORMULAIRE_TOTO inexistant : renvoyer la chaine vide.
126
+    // mais si #FORMULAIRE_{toto} on ne peut pas savoir a la compilation, continuer
127
+    if (existe_formulaire($p->nom_champ) === false) {
128
+        $p->code = "''";
129
+        $p->interdire_scripts = false;
130 130
 
131
-		return $p;
132
-	}
131
+        return $p;
132
+    }
133 133
 
134
-	// sinon renvoyer un code php dynamique
135
-	$p = calculer_balise_dynamique($p, $p->nom_champ, []);
134
+    // sinon renvoyer un code php dynamique
135
+    $p = calculer_balise_dynamique($p, $p->nom_champ, []);
136 136
 
137
-	return $p;
137
+    return $p;
138 138
 }
139 139
 
140 140
 /**
@@ -154,17 +154,17 @@  discard block
 block discarded – undo
154 154
  *     - string : texte à afficher directement
155 155
  */
156 156
 function balise_FORMULAIRE__dyn($form, ...$args) {
157
-	$form = existe_formulaire($form);
158
-	if (!$form) {
159
-		return '';
160
-	}
157
+    $form = existe_formulaire($form);
158
+    if (!$form) {
159
+        return '';
160
+    }
161 161
 
162
-	$contexte = balise_FORMULAIRE__contexte($form, $args);
163
-	if (!is_array($contexte)) {
164
-		return $contexte;
165
-	}
162
+    $contexte = balise_FORMULAIRE__contexte($form, $args);
163
+    if (!is_array($contexte)) {
164
+        return $contexte;
165
+    }
166 166
 
167
-	return ["formulaires/$form", 3600, $contexte];
167
+    return ["formulaires/$form", 3600, $contexte];
168 168
 }
169 169
 
170 170
 /**
@@ -179,85 +179,85 @@  discard block
 block discarded – undo
179 179
  *     string: Formulaire non applicable (message d’explication)
180 180
  **/
181 181
 function balise_FORMULAIRE__contexte($form, $args) {
182
-	// tester si ce formulaire vient d'etre poste (memes arguments)
183
-	// pour ne pas confondre 2 #FORMULAIRES_XX identiques sur une meme page
184
-	// si poste, on recupere les erreurs
185
-
186
-	$je_suis_poste = false;
187
-	if (
188
-		$post_form = _request('formulaire_action')
189
-		and $post_form == $form
190
-		and $p = _request('formulaire_action_args')
191
-		and is_array($p = decoder_contexte_ajax($p, $post_form))
192
-	) {
193
-		// enlever le faux attribut de langue masque
194
-		array_shift($p);
195
-		if (formulaire__identifier($form, $args, $p)) {
196
-			$je_suis_poste = true;
197
-		}
198
-	}
199
-
200
-	$editable = true;
201
-	$erreurs = $post = [];
202
-	if ($je_suis_poste) {
203
-		$post = traiter_formulaires_dynamiques(true);
204
-		$e = "erreurs_$form";
205
-		$erreurs = $post[$e] ?? [];
206
-		$editable = "editable_$form";
207
-		$editable = (!isset($post[$e]))
208
-			|| (is_countable($erreurs) ? count($erreurs) : 0)
209
-			|| (isset($post[$editable]) && $post[$editable]);
210
-	}
211
-
212
-	$valeurs = formulaire__charger($form, $args, $je_suis_poste);
213
-
214
-	// si $valeurs n'est pas un tableau, le formulaire n'est pas applicable
215
-	// C'est plus fort qu'editable qui est gere par le squelette
216
-	// Idealement $valeur doit etre alors un message explicatif.
217
-	if (!is_array($valeurs)) {
218
-		return is_string($valeurs) ? $valeurs : '';
219
-	}
220
-
221
-	// charger peut passer une action si le formulaire ne tourne pas sur self()
222
-	// ou une action vide si elle ne sert pas
223
-	$action = $valeurs['action'] ?? self('&amp;', true);
224
-	// bug IEx : si action finit par /
225
-	// IE croit que le <form ... action=../ > est autoferme
226
-	if (substr($action, -1) == '/') {
227
-		// on ajoute une ancre pour feinter IE, au pire ca tue l'ancre qui finit par un /
228
-		$action .= '#';
229
-	}
230
-
231
-	// recuperer la saisie en cours si erreurs
232
-	// seulement si c'est ce formulaire qui est poste
233
-	// ou si on le demande explicitement par le parametre _forcer_request = true
234
-	$dispo = ($je_suis_poste || (isset($valeurs['_forcer_request']) && $valeurs['_forcer_request']));
235
-	foreach (array_keys($valeurs) as $champ) {
236
-		if ($champ[0] !== '_' and !in_array($champ, ['message_ok', 'message_erreur', 'editable'])) {
237
-			if ($dispo and (($v = _request($champ)) !== null)) {
238
-				$valeurs[$champ] = $v;
239
-			}
240
-			// nettoyer l'url des champs qui vont etre saisis
241
-			if ($action) {
242
-				$action = parametre_url($action, $champ, '');
243
-			}
244
-			// proteger les ' et les " dans les champs que l'on va injecter
245
-			$valeurs[$champ] = protege_champ($valeurs[$champ]);
246
-		}
247
-	}
248
-
249
-	if ($action) {
250
-		// nettoyer l'url
251
-		$action = parametre_url($action, 'formulaire_action', '');
252
-		$action = parametre_url($action, 'formulaire_action_args', '');
253
-		$action = parametre_url($action, 'formulaire_action_sign', '');
254
-	}
255
-
256
-	/**
257
-	 * @deprecated 4.0
258
-	 * servait pour poster sur les actions de type editer_xxx() qui ne prenaient pas d'argument autrement que par _request('arg') et pour lesquelles il fallait donc passer un hash valide
259
-	 */
260
-	/*
182
+    // tester si ce formulaire vient d'etre poste (memes arguments)
183
+    // pour ne pas confondre 2 #FORMULAIRES_XX identiques sur une meme page
184
+    // si poste, on recupere les erreurs
185
+
186
+    $je_suis_poste = false;
187
+    if (
188
+        $post_form = _request('formulaire_action')
189
+        and $post_form == $form
190
+        and $p = _request('formulaire_action_args')
191
+        and is_array($p = decoder_contexte_ajax($p, $post_form))
192
+    ) {
193
+        // enlever le faux attribut de langue masque
194
+        array_shift($p);
195
+        if (formulaire__identifier($form, $args, $p)) {
196
+            $je_suis_poste = true;
197
+        }
198
+    }
199
+
200
+    $editable = true;
201
+    $erreurs = $post = [];
202
+    if ($je_suis_poste) {
203
+        $post = traiter_formulaires_dynamiques(true);
204
+        $e = "erreurs_$form";
205
+        $erreurs = $post[$e] ?? [];
206
+        $editable = "editable_$form";
207
+        $editable = (!isset($post[$e]))
208
+            || (is_countable($erreurs) ? count($erreurs) : 0)
209
+            || (isset($post[$editable]) && $post[$editable]);
210
+    }
211
+
212
+    $valeurs = formulaire__charger($form, $args, $je_suis_poste);
213
+
214
+    // si $valeurs n'est pas un tableau, le formulaire n'est pas applicable
215
+    // C'est plus fort qu'editable qui est gere par le squelette
216
+    // Idealement $valeur doit etre alors un message explicatif.
217
+    if (!is_array($valeurs)) {
218
+        return is_string($valeurs) ? $valeurs : '';
219
+    }
220
+
221
+    // charger peut passer une action si le formulaire ne tourne pas sur self()
222
+    // ou une action vide si elle ne sert pas
223
+    $action = $valeurs['action'] ?? self('&amp;', true);
224
+    // bug IEx : si action finit par /
225
+    // IE croit que le <form ... action=../ > est autoferme
226
+    if (substr($action, -1) == '/') {
227
+        // on ajoute une ancre pour feinter IE, au pire ca tue l'ancre qui finit par un /
228
+        $action .= '#';
229
+    }
230
+
231
+    // recuperer la saisie en cours si erreurs
232
+    // seulement si c'est ce formulaire qui est poste
233
+    // ou si on le demande explicitement par le parametre _forcer_request = true
234
+    $dispo = ($je_suis_poste || (isset($valeurs['_forcer_request']) && $valeurs['_forcer_request']));
235
+    foreach (array_keys($valeurs) as $champ) {
236
+        if ($champ[0] !== '_' and !in_array($champ, ['message_ok', 'message_erreur', 'editable'])) {
237
+            if ($dispo and (($v = _request($champ)) !== null)) {
238
+                $valeurs[$champ] = $v;
239
+            }
240
+            // nettoyer l'url des champs qui vont etre saisis
241
+            if ($action) {
242
+                $action = parametre_url($action, $champ, '');
243
+            }
244
+            // proteger les ' et les " dans les champs que l'on va injecter
245
+            $valeurs[$champ] = protege_champ($valeurs[$champ]);
246
+        }
247
+    }
248
+
249
+    if ($action) {
250
+        // nettoyer l'url
251
+        $action = parametre_url($action, 'formulaire_action', '');
252
+        $action = parametre_url($action, 'formulaire_action_args', '');
253
+        $action = parametre_url($action, 'formulaire_action_sign', '');
254
+    }
255
+
256
+    /**
257
+     * @deprecated 4.0
258
+     * servait pour poster sur les actions de type editer_xxx() qui ne prenaient pas d'argument autrement que par _request('arg') et pour lesquelles il fallait donc passer un hash valide
259
+     */
260
+    /*
261 261
 	if (isset($valeurs['_action'])) {
262 262
 		$securiser_action = charger_fonction('securiser_action', 'inc');
263 263
 		$secu = $securiser_action(reset($valeurs['_action']), end($valeurs['_action']), '', -1);
@@ -267,59 +267,59 @@  discard block
 block discarded – undo
267 267
 	}
268 268
 	*/
269 269
 
270
-	// empiler la lang en tant que premier argument implicite du CVT
271
-	// pour permettre de la restaurer au moment du Verifier et du Traiter
272
-	array_unshift($args, $GLOBALS['spip_lang']);
273
-
274
-	$valeurs['formulaire_args'] = encoder_contexte_ajax($args, $form);
275
-	$valeurs['erreurs'] = $erreurs;
276
-	$valeurs['action'] = $action;
277
-	$valeurs['form'] = $form;
278
-
279
-	$valeurs['formulaire_sign'] = '';
280
-	if (!empty($GLOBALS['visiteur_session']['id_auteur'])) {
281
-		$securiser_action = charger_fonction('securiser_action', 'inc');
282
-		$secu = $securiser_action($valeurs['form'], $valeurs['formulaire_args'], '', -1);
283
-		$valeurs['formulaire_sign'] = $secu['hash'];
284
-	}
285
-
286
-	if (!isset($valeurs['id'])) {
287
-		$valeurs['id'] = 'new';
288
-	}
289
-	// editable peut venir de charger() ou de traiter() sinon
290
-	if (!isset($valeurs['editable'])) {
291
-		$valeurs['editable'] = $editable;
292
-	}
293
-	// dans tous les cas, renvoyer un espace ou vide (et pas un booleen)
294
-	$valeurs['editable'] = ($valeurs['editable'] ? ' ' : '');
295
-
296
-	if ($je_suis_poste) {
297
-		$valeurs['message_erreur'] = '';
298
-		if (isset($erreurs['message_erreur'])) {
299
-			$valeurs['message_erreur'] = $erreurs['message_erreur'];
300
-		}
301
-
302
-		$valeurs['message_ok'] = '';
303
-		if (isset($post["message_ok_$form"])) {
304
-			$valeurs['message_ok'] = $post["message_ok_$form"];
305
-		} elseif (isset($erreurs['message_ok'])) {
306
-			$valeurs['message_ok'] = $erreurs['message_ok'];
307
-		}
308
-
309
-		// accessibilite : encapsuler toutes les erreurs dans un role='alert'
310
-		// uniquement si c'est une string et au premier niveau (on ne touche pas au tableaux)
311
-		// et si $k ne commence pas par un _ (c'est bien une vrai erreur sur un vrai champ)
312
-		if (html5_permis()) {
313
-			foreach ($erreurs as $k => $v) {
314
-				if (is_string($v) and strlen(trim($v)) and strpos($k, '_') !== 0) {
315
-					// on encapsule dans un span car ces messages sont en general simple, juste du texte, et deja dans un span dans le form
316
-					$valeurs['erreurs'][$k] = "<span role='alert'>" . $erreurs[$k] . '</span>';
317
-				}
318
-			}
319
-		}
320
-	}
321
-
322
-	return $valeurs;
270
+    // empiler la lang en tant que premier argument implicite du CVT
271
+    // pour permettre de la restaurer au moment du Verifier et du Traiter
272
+    array_unshift($args, $GLOBALS['spip_lang']);
273
+
274
+    $valeurs['formulaire_args'] = encoder_contexte_ajax($args, $form);
275
+    $valeurs['erreurs'] = $erreurs;
276
+    $valeurs['action'] = $action;
277
+    $valeurs['form'] = $form;
278
+
279
+    $valeurs['formulaire_sign'] = '';
280
+    if (!empty($GLOBALS['visiteur_session']['id_auteur'])) {
281
+        $securiser_action = charger_fonction('securiser_action', 'inc');
282
+        $secu = $securiser_action($valeurs['form'], $valeurs['formulaire_args'], '', -1);
283
+        $valeurs['formulaire_sign'] = $secu['hash'];
284
+    }
285
+
286
+    if (!isset($valeurs['id'])) {
287
+        $valeurs['id'] = 'new';
288
+    }
289
+    // editable peut venir de charger() ou de traiter() sinon
290
+    if (!isset($valeurs['editable'])) {
291
+        $valeurs['editable'] = $editable;
292
+    }
293
+    // dans tous les cas, renvoyer un espace ou vide (et pas un booleen)
294
+    $valeurs['editable'] = ($valeurs['editable'] ? ' ' : '');
295
+
296
+    if ($je_suis_poste) {
297
+        $valeurs['message_erreur'] = '';
298
+        if (isset($erreurs['message_erreur'])) {
299
+            $valeurs['message_erreur'] = $erreurs['message_erreur'];
300
+        }
301
+
302
+        $valeurs['message_ok'] = '';
303
+        if (isset($post["message_ok_$form"])) {
304
+            $valeurs['message_ok'] = $post["message_ok_$form"];
305
+        } elseif (isset($erreurs['message_ok'])) {
306
+            $valeurs['message_ok'] = $erreurs['message_ok'];
307
+        }
308
+
309
+        // accessibilite : encapsuler toutes les erreurs dans un role='alert'
310
+        // uniquement si c'est une string et au premier niveau (on ne touche pas au tableaux)
311
+        // et si $k ne commence pas par un _ (c'est bien une vrai erreur sur un vrai champ)
312
+        if (html5_permis()) {
313
+            foreach ($erreurs as $k => $v) {
314
+                if (is_string($v) and strlen(trim($v)) and strpos($k, '_') !== 0) {
315
+                    // on encapsule dans un span car ces messages sont en general simple, juste du texte, et deja dans un span dans le form
316
+                    $valeurs['erreurs'][$k] = "<span role='alert'>" . $erreurs[$k] . '</span>';
317
+                }
318
+            }
319
+        }
320
+    }
321
+
322
+    return $valeurs;
323 323
 }
324 324
 
325 325
 /**
@@ -331,51 +331,51 @@  discard block
 block discarded – undo
331 331
  * @return array
332 332
  */
333 333
 function formulaire__charger($form, $args, $poste) {
334
-	if ($charger_valeurs = charger_fonction('charger', "formulaires/$form", true)) {
335
-		$valeurs = $charger_valeurs(...$args);
336
-	} else {
337
-		$valeurs = [];
338
-	}
339
-
340
-	$valeurs = pipeline(
341
-		'formulaire_charger',
342
-		[
343
-			'args' => ['form' => $form, 'args' => $args, 'je_suis_poste' => $poste],
344
-			'data' => $valeurs
345
-		]
346
-	);
347
-
348
-	// prise en charge CVT multi etape
349
-	if (is_array($valeurs) and isset($valeurs['_etapes'])) {
350
-		include_spip('inc/cvt_multietapes');
351
-		$valeurs = cvtmulti_formulaire_charger_etapes(
352
-			['form' => $form, 'args' => $args, 'je_suis_poste' => $poste],
353
-			$valeurs
354
-		);
355
-	}
356
-
357
-	// si $valeurs et false ou une chaine, pas de formulaire, donc pas de pipeline !
358
-	if (is_array($valeurs)) {
359
-		if (!isset($valeurs['_pipelines'])) {
360
-			$valeurs['_pipelines'] = [];
361
-		}
362
-		// l'ancien argument _pipeline devient maintenant _pipelines
363
-		// reinjectons le vieux _pipeline au debut de _pipelines
364
-		if (isset($valeurs['_pipeline'])) {
365
-			$pipe = is_array($valeurs['_pipeline']) ? reset($valeurs['_pipeline']) : $valeurs['_pipeline'];
366
-			$args = is_array($valeurs['_pipeline']) ? end($valeurs['_pipeline']) : [];
367
-
368
-			$pipelines = [$pipe => $args];
369
-			$valeurs['_pipelines'] = array_merge($pipelines, $valeurs['_pipelines']);
370
-		}
371
-
372
-		// et enfin, ajoutons systematiquement un pipeline sur le squelette du formulaire
373
-		// qui constitue le cas le plus courant d'utilisation du pipeline recuperer_fond
374
-		// (performance, cela evite de s'injecter dans recuperer_fond utilise pour *tous* les squelettes)
375
-		$valeurs['_pipelines']['formulaire_fond'] = ['form' => $form, 'args' => $args, 'je_suis_poste' => $poste];
376
-	}
377
-
378
-	return $valeurs;
334
+    if ($charger_valeurs = charger_fonction('charger', "formulaires/$form", true)) {
335
+        $valeurs = $charger_valeurs(...$args);
336
+    } else {
337
+        $valeurs = [];
338
+    }
339
+
340
+    $valeurs = pipeline(
341
+        'formulaire_charger',
342
+        [
343
+            'args' => ['form' => $form, 'args' => $args, 'je_suis_poste' => $poste],
344
+            'data' => $valeurs
345
+        ]
346
+    );
347
+
348
+    // prise en charge CVT multi etape
349
+    if (is_array($valeurs) and isset($valeurs['_etapes'])) {
350
+        include_spip('inc/cvt_multietapes');
351
+        $valeurs = cvtmulti_formulaire_charger_etapes(
352
+            ['form' => $form, 'args' => $args, 'je_suis_poste' => $poste],
353
+            $valeurs
354
+        );
355
+    }
356
+
357
+    // si $valeurs et false ou une chaine, pas de formulaire, donc pas de pipeline !
358
+    if (is_array($valeurs)) {
359
+        if (!isset($valeurs['_pipelines'])) {
360
+            $valeurs['_pipelines'] = [];
361
+        }
362
+        // l'ancien argument _pipeline devient maintenant _pipelines
363
+        // reinjectons le vieux _pipeline au debut de _pipelines
364
+        if (isset($valeurs['_pipeline'])) {
365
+            $pipe = is_array($valeurs['_pipeline']) ? reset($valeurs['_pipeline']) : $valeurs['_pipeline'];
366
+            $args = is_array($valeurs['_pipeline']) ? end($valeurs['_pipeline']) : [];
367
+
368
+            $pipelines = [$pipe => $args];
369
+            $valeurs['_pipelines'] = array_merge($pipelines, $valeurs['_pipelines']);
370
+        }
371
+
372
+        // et enfin, ajoutons systematiquement un pipeline sur le squelette du formulaire
373
+        // qui constitue le cas le plus courant d'utilisation du pipeline recuperer_fond
374
+        // (performance, cela evite de s'injecter dans recuperer_fond utilise pour *tous* les squelettes)
375
+        $valeurs['_pipelines']['formulaire_fond'] = ['form' => $form, 'args' => $args, 'je_suis_poste' => $poste];
376
+    }
377
+
378
+    return $valeurs;
379 379
 }
380 380
 
381 381
 /**
@@ -394,9 +394,9 @@  discard block
 block discarded – undo
394 394
  * @return bool
395 395
  */
396 396
 function formulaire__identifier($form, $args, $p) {
397
-	if ($identifier_args = charger_fonction('identifier', "formulaires/$form", true)) {
398
-		return $identifier_args(...$args) === $identifier_args(...$p);
399
-	}
397
+    if ($identifier_args = charger_fonction('identifier', "formulaires/$form", true)) {
398
+        return $identifier_args(...$args) === $identifier_args(...$p);
399
+    }
400 400
 
401
-	return $args === $p;
401
+    return $args === $p;
402 402
 }
Please login to merge, or discard this patch.
ecrire/action/editer_logo.php 1 patch
Indentation   +223 added lines, -223 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
 
@@ -30,36 +30,36 @@  discard block
 block discarded – undo
30 30
  *     `on` ou `off`
31 31
  */
32 32
 function logo_supprimer($objet, $id_objet, $etat) {
33
-	$chercher_logo = charger_fonction('chercher_logo', 'inc');
34
-	$objet = objet_type($objet);
35
-	$primary = id_table_objet($objet);
36
-	include_spip('inc/chercher_logo');
37
-
38
-	// existe-t-il deja un logo ?
39
-	$logo = $chercher_logo($id_objet, $primary, $etat);
40
-	if ($logo) {
41
-		# TODO : deprecated, a supprimer -> anciens logos IMG/artonxx.png pas en base
42
-		if ((is_countable($logo) ? count($logo) : 0) < 6) {
43
-			spip_log('Supprimer ancien logo ' . json_encode($logo, JSON_THROW_ON_ERROR), 'logo');
44
-			spip_unlink($logo[0]);
45
-		}
46
-		elseif (
47
-			$doc = $logo[5]
48
-			and isset($doc['id_document'])
49
-			and $id_document = $doc['id_document']
50
-		) {
51
-			include_spip('action/editer_liens');
52
-			// supprimer le lien dans la base
53
-			objet_dissocier(['document' => $id_document], [$objet => $id_objet], ['role' => '*']);
54
-
55
-			// verifier si il reste des liens avec d'autres objets et sinon supprimer
56
-			$liens = objet_trouver_liens(['document' => $id_document], '*');
57
-			if (!count($liens)) {
58
-				$supprimer_document = charger_fonction('supprimer_document', 'action');
59
-				$supprimer_document($doc['id_document']);
60
-			}
61
-		}
62
-	}
33
+    $chercher_logo = charger_fonction('chercher_logo', 'inc');
34
+    $objet = objet_type($objet);
35
+    $primary = id_table_objet($objet);
36
+    include_spip('inc/chercher_logo');
37
+
38
+    // existe-t-il deja un logo ?
39
+    $logo = $chercher_logo($id_objet, $primary, $etat);
40
+    if ($logo) {
41
+        # TODO : deprecated, a supprimer -> anciens logos IMG/artonxx.png pas en base
42
+        if ((is_countable($logo) ? count($logo) : 0) < 6) {
43
+            spip_log('Supprimer ancien logo ' . json_encode($logo, JSON_THROW_ON_ERROR), 'logo');
44
+            spip_unlink($logo[0]);
45
+        }
46
+        elseif (
47
+            $doc = $logo[5]
48
+            and isset($doc['id_document'])
49
+            and $id_document = $doc['id_document']
50
+        ) {
51
+            include_spip('action/editer_liens');
52
+            // supprimer le lien dans la base
53
+            objet_dissocier(['document' => $id_document], [$objet => $id_objet], ['role' => '*']);
54
+
55
+            // verifier si il reste des liens avec d'autres objets et sinon supprimer
56
+            $liens = objet_trouver_liens(['document' => $id_document], '*');
57
+            if (!count($liens)) {
58
+                $supprimer_document = charger_fonction('supprimer_document', 'action');
59
+                $supprimer_document($doc['id_document']);
60
+            }
61
+        }
62
+    }
63 63
 }
64 64
 
65 65
 /**
@@ -76,200 +76,200 @@  discard block
 block discarded – undo
76 76
  *     Erreur, sinon ''
77 77
  */
78 78
 function logo_modifier($objet, $id_objet, $etat, $source) {
79
-	$chercher_logo = charger_fonction('chercher_logo', 'inc');
80
-	$objet = objet_type($objet);
81
-	$primary = id_table_objet($objet);
82
-	include_spip('inc/chercher_logo');
83
-
84
-	$mode = preg_replace(',\W,', '', $etat);
85
-	if (!$mode) {
86
-		spip_log("logo_modifier : etat $etat invalide", 'logo');
87
-		$erreur = 'etat invalide';
88
-
89
-		return $erreur;
90
-	}
91
-	// chercher dans la base
92
-	$mode_document = 'logo' . $mode;
93
-
94
-	include_spip('inc/documents');
95
-	$erreur = '';
96
-
97
-	if (!$source) {
98
-		spip_log('spip_image_ajouter : source inconnue', 'logo');
99
-		$erreur = 'source inconnue';
100
-
101
-		return $erreur;
102
-	}
103
-
104
-	// fichier dans upload/
105
-	if (is_string($source)) {
106
-		$tmp_name = false;
107
-		if (file_exists($source)) {
108
-			$tmp_name = $source;
109
-		} elseif (file_exists($f = determine_upload() . $source)) {
110
-			$tmp_name = $f;
111
-		}
112
-		if (!$tmp_name) {
113
-			spip_log('spip_image_ajouter : source inconnue', 'logo');
114
-			$erreur = 'source inconnue';
115
-
116
-			return $erreur;
117
-		}
118
-		$source = [
119
-			'tmp_name' => $tmp_name,
120
-			'name' => basename($tmp_name),
121
-		];
122
-	} elseif ($erreur = check_upload_error($source['error'], '', true)) {
123
-		return $erreur;
124
-	}
125
-
126
-	// supprimer le logo eventueel existant
127
-	// TODO : si un logo existe, le modifier plutot que supprimer + reinserer (mais il faut gerer le cas ou il est utilise par plusieurs objets, donc pas si simple)
128
-	// mais de toute facon l'interface actuelle oblige a supprimer + reinserer
129
-	if (empty($GLOBALS['logo_migrer_en_base'])) {
130
-		logo_supprimer($objet, $id_objet, $etat);
131
-	}
132
-
133
-
134
-	include_spip('inc/autoriser');
135
-	$source['mode'] = $mode_document;
136
-	$ajouter_documents = charger_fonction('ajouter_documents', 'action');
137
-	autoriser_exception('associerdocuments', $objet, $id_objet);
138
-	$ajoutes = $ajouter_documents('new', [$source], $objet, $id_objet, $mode_document);
139
-	autoriser_exception('associerdocuments', $objet, $id_objet, false);
140
-
141
-	$id_document = reset($ajoutes);
142
-
143
-	if (!is_numeric($id_document)) {
144
-		$erreur = ($id_document ?: 'Erreur inconnue');
145
-		spip_log("Erreur ajout logo : $erreur pour source=" . json_encode($source, JSON_THROW_ON_ERROR), 'logo');
146
-		return $erreur;
147
-	}
148
-
149
-	return ''; // tout est bon, pas d'erreur
79
+    $chercher_logo = charger_fonction('chercher_logo', 'inc');
80
+    $objet = objet_type($objet);
81
+    $primary = id_table_objet($objet);
82
+    include_spip('inc/chercher_logo');
83
+
84
+    $mode = preg_replace(',\W,', '', $etat);
85
+    if (!$mode) {
86
+        spip_log("logo_modifier : etat $etat invalide", 'logo');
87
+        $erreur = 'etat invalide';
88
+
89
+        return $erreur;
90
+    }
91
+    // chercher dans la base
92
+    $mode_document = 'logo' . $mode;
93
+
94
+    include_spip('inc/documents');
95
+    $erreur = '';
96
+
97
+    if (!$source) {
98
+        spip_log('spip_image_ajouter : source inconnue', 'logo');
99
+        $erreur = 'source inconnue';
100
+
101
+        return $erreur;
102
+    }
103
+
104
+    // fichier dans upload/
105
+    if (is_string($source)) {
106
+        $tmp_name = false;
107
+        if (file_exists($source)) {
108
+            $tmp_name = $source;
109
+        } elseif (file_exists($f = determine_upload() . $source)) {
110
+            $tmp_name = $f;
111
+        }
112
+        if (!$tmp_name) {
113
+            spip_log('spip_image_ajouter : source inconnue', 'logo');
114
+            $erreur = 'source inconnue';
115
+
116
+            return $erreur;
117
+        }
118
+        $source = [
119
+            'tmp_name' => $tmp_name,
120
+            'name' => basename($tmp_name),
121
+        ];
122
+    } elseif ($erreur = check_upload_error($source['error'], '', true)) {
123
+        return $erreur;
124
+    }
125
+
126
+    // supprimer le logo eventueel existant
127
+    // TODO : si un logo existe, le modifier plutot que supprimer + reinserer (mais il faut gerer le cas ou il est utilise par plusieurs objets, donc pas si simple)
128
+    // mais de toute facon l'interface actuelle oblige a supprimer + reinserer
129
+    if (empty($GLOBALS['logo_migrer_en_base'])) {
130
+        logo_supprimer($objet, $id_objet, $etat);
131
+    }
132
+
133
+
134
+    include_spip('inc/autoriser');
135
+    $source['mode'] = $mode_document;
136
+    $ajouter_documents = charger_fonction('ajouter_documents', 'action');
137
+    autoriser_exception('associerdocuments', $objet, $id_objet);
138
+    $ajoutes = $ajouter_documents('new', [$source], $objet, $id_objet, $mode_document);
139
+    autoriser_exception('associerdocuments', $objet, $id_objet, false);
140
+
141
+    $id_document = reset($ajoutes);
142
+
143
+    if (!is_numeric($id_document)) {
144
+        $erreur = ($id_document ?: 'Erreur inconnue');
145
+        spip_log("Erreur ajout logo : $erreur pour source=" . json_encode($source, JSON_THROW_ON_ERROR), 'logo');
146
+        return $erreur;
147
+    }
148
+
149
+    return ''; // tout est bon, pas d'erreur
150 150
 }
151 151
 
152 152
 function logo_migrer_en_base($objet, $time_limit) {
153 153
 
154
-	$dir_logos_erreurs = sous_repertoire(_DIR_IMG, 'logo_erreurs');
155
-	$dir_logos = sous_repertoire(_DIR_IMG, 'logo');
156
-	$formats_logos = ['jpg', 'png', 'svg', 'gif'];
157
-	if (isset($GLOBALS['formats_logos'])) {
158
-		$formats_logos = $GLOBALS['formats_logos'];
159
-	}
160
-
161
-
162
-	$trouver_table = charger_fonction('trouver_table', 'base');
163
-	$chercher_logo = charger_fonction('chercher_logo', 'inc');
164
-	include_spip('inc/chercher_logo');
165
-	$_id_objet = id_table_objet($objet);
166
-	$table = table_objet_sql($objet);
167
-	$type = type_du_logo($_id_objet);
168
-	$desc = $trouver_table($table);
169
-
170
-	// on desactive les revisions
171
-	$liste_objets_versionnes = $GLOBALS['meta']['objets_versions'] ?? '';
172
-	unset($GLOBALS['meta']['objets_versions']);
173
-	// et le signalement des editions
174
-	$articles_modif = $GLOBALS['meta']['articles_modif'] ?? '';
175
-	$GLOBALS['meta']['articles_modif'] = 'non';
176
-
177
-	foreach (['on', 'off'] as $mode) {
178
-		$nom_base = $type . $mode;
179
-		$dir = (defined('_DIR_LOGOS') ? _DIR_LOGOS : _DIR_IMG);
180
-
181
-		$files = glob($dir . $nom_base . '*');
182
-		// est-ce que c'est une nouvelle tentative de migration ?
183
-		// dans ce cas les logos sont deja dans IMG/logo/
184
-		if (!(is_countable($files) ? count($files) : 0)) {
185
-			$files = glob($dir_logos . $nom_base . '*');
186
-			if (is_countable($files) ? count($files) : 0) {
187
-				// mais il faut verifier si ils ont pas deja ete migres pour tout ou partie
188
-				$filescheck = [];
189
-				foreach ($files as $file) {
190
-					$short = basename(dirname($file)) . DIRECTORY_SEPARATOR . basename($file);
191
-					$filescheck[$short] = $file;
192
-				}
193
-				// trouver ceux deja migres
194
-				$deja = sql_allfetsel('fichier', 'spip_documents', sql_in('fichier', array_keys($filescheck)) . " AND mode LIKE 'logo%'");
195
-				if (is_countable($deja) ? count($deja) : 0) {
196
-					$deja = array_column($deja, 'fichier');
197
-					$restant = array_diff(array_keys($filescheck), $deja);
198
-					$files = [];
199
-					if (count($restant)) {
200
-						foreach ($restant as $r) {
201
-							$files[] = $filescheck[$r];
202
-						}
203
-					}
204
-				}
205
-				// et si il en reste on peut y aller...
206
-				// mais il faut modifier $dir qui sert de base dans la suite
207
-				if (is_countable($files) ? count($files) : 0) {
208
-					$dir = $dir_logos;
209
-				}
210
-			}
211
-		}
212
-
213
-		$count = (is_countable($files) ? count($files) : 0);
214
-		spip_log("logo_migrer_en_base $objet $mode : " . $count . ' logos restant', 'maj' . _LOG_INFO_IMPORTANTE);
215
-
216
-		$deja = [];
217
-		foreach ($files as $file) {
218
-			$logo = substr($file, strlen($dir . $nom_base));
219
-			$logo = explode('.', $logo);
220
-			if (
221
-				is_numeric($logo[0])
222
-				and ($id_objet = intval($logo[0]) or in_array($objet, ['site', 'rubrique']))
223
-			) {
224
-				if (!isset($deja[$id_objet])) {
225
-					$logo = $chercher_logo($id_objet, $_id_objet, $mode);
226
-					// if no logo in base
227
-					if (!$logo or (is_countable($logo) ? count($logo) : 0) < 6) {
228
-						foreach ($formats_logos as $format) {
229
-							if (@file_exists($d = ($dir . ($nom = $nom_base . intval($id_objet) . '.' . $format)))) {
230
-								if (isset($desc['field']['date_modif'])) {
231
-									$date_modif = sql_getfetsel('date_modif', $table, "$_id_objet=$id_objet");
232
-								} else {
233
-									$date_modif = null;
234
-								}
235
-								// s'assurer que le logo a les bon droits au passage (evite un echec en cas de sanitization d'un svg)
236
-								@chmod($d, _SPIP_CHMOD & 0666);
237
-								// logo_modifier commence par supprimer le logo existant, donc on le deplace pour pas le perdre
238
-								@rename($d, $dir_logos . $nom);
239
-								// et on le declare comme nouveau logo
240
-								logo_modifier($objet, $id_objet, $mode, $dir_logos . $nom);
241
-								if ($date_modif) {
242
-									sql_updateq($table, ['date_modif' => $date_modif], "$_id_objet=$id_objet");
243
-								}
244
-								break;
245
-							}
246
-						}
247
-					}
248
-					$deja[$id_objet] = true;
249
-				}
250
-			}
251
-			// si le fichier est encore la on le move : rien a faire ici
252
-			// (sauf si c'est une re-migration : il est deja dans logo/ donc il bouge pas)
253
-			if ($dir !== $dir_logos and file_exists($file)) {
254
-				@rename($file, $dir_logos_erreurs . basename($file));
255
-			}
256
-
257
-			$count--;
258
-			if ($count % 250 === 0) {
259
-				spip_log("logo_migrer_en_base $objet $mode : " . $count . ' logos restant', 'maj' . _LOG_INFO_IMPORTANTE);
260
-			}
261
-
262
-			if ($time_limit and time() > $time_limit) {
263
-				effacer_meta('drapeau_edition');
264
-				return;
265
-			}
266
-		}
267
-	}
268
-
269
-	if ($liste_objets_versionnes) {
270
-		$GLOBALS['meta']['objets_versions'] = $liste_objets_versionnes;
271
-	}
272
-	$GLOBALS['meta']['articles_modif'] = $articles_modif;
273
-
274
-	effacer_meta('drapeau_edition');
154
+    $dir_logos_erreurs = sous_repertoire(_DIR_IMG, 'logo_erreurs');
155
+    $dir_logos = sous_repertoire(_DIR_IMG, 'logo');
156
+    $formats_logos = ['jpg', 'png', 'svg', 'gif'];
157
+    if (isset($GLOBALS['formats_logos'])) {
158
+        $formats_logos = $GLOBALS['formats_logos'];
159
+    }
160
+
161
+
162
+    $trouver_table = charger_fonction('trouver_table', 'base');
163
+    $chercher_logo = charger_fonction('chercher_logo', 'inc');
164
+    include_spip('inc/chercher_logo');
165
+    $_id_objet = id_table_objet($objet);
166
+    $table = table_objet_sql($objet);
167
+    $type = type_du_logo($_id_objet);
168
+    $desc = $trouver_table($table);
169
+
170
+    // on desactive les revisions
171
+    $liste_objets_versionnes = $GLOBALS['meta']['objets_versions'] ?? '';
172
+    unset($GLOBALS['meta']['objets_versions']);
173
+    // et le signalement des editions
174
+    $articles_modif = $GLOBALS['meta']['articles_modif'] ?? '';
175
+    $GLOBALS['meta']['articles_modif'] = 'non';
176
+
177
+    foreach (['on', 'off'] as $mode) {
178
+        $nom_base = $type . $mode;
179
+        $dir = (defined('_DIR_LOGOS') ? _DIR_LOGOS : _DIR_IMG);
180
+
181
+        $files = glob($dir . $nom_base . '*');
182
+        // est-ce que c'est une nouvelle tentative de migration ?
183
+        // dans ce cas les logos sont deja dans IMG/logo/
184
+        if (!(is_countable($files) ? count($files) : 0)) {
185
+            $files = glob($dir_logos . $nom_base . '*');
186
+            if (is_countable($files) ? count($files) : 0) {
187
+                // mais il faut verifier si ils ont pas deja ete migres pour tout ou partie
188
+                $filescheck = [];
189
+                foreach ($files as $file) {
190
+                    $short = basename(dirname($file)) . DIRECTORY_SEPARATOR . basename($file);
191
+                    $filescheck[$short] = $file;
192
+                }
193
+                // trouver ceux deja migres
194
+                $deja = sql_allfetsel('fichier', 'spip_documents', sql_in('fichier', array_keys($filescheck)) . " AND mode LIKE 'logo%'");
195
+                if (is_countable($deja) ? count($deja) : 0) {
196
+                    $deja = array_column($deja, 'fichier');
197
+                    $restant = array_diff(array_keys($filescheck), $deja);
198
+                    $files = [];
199
+                    if (count($restant)) {
200
+                        foreach ($restant as $r) {
201
+                            $files[] = $filescheck[$r];
202
+                        }
203
+                    }
204
+                }
205
+                // et si il en reste on peut y aller...
206
+                // mais il faut modifier $dir qui sert de base dans la suite
207
+                if (is_countable($files) ? count($files) : 0) {
208
+                    $dir = $dir_logos;
209
+                }
210
+            }
211
+        }
212
+
213
+        $count = (is_countable($files) ? count($files) : 0);
214
+        spip_log("logo_migrer_en_base $objet $mode : " . $count . ' logos restant', 'maj' . _LOG_INFO_IMPORTANTE);
215
+
216
+        $deja = [];
217
+        foreach ($files as $file) {
218
+            $logo = substr($file, strlen($dir . $nom_base));
219
+            $logo = explode('.', $logo);
220
+            if (
221
+                is_numeric($logo[0])
222
+                and ($id_objet = intval($logo[0]) or in_array($objet, ['site', 'rubrique']))
223
+            ) {
224
+                if (!isset($deja[$id_objet])) {
225
+                    $logo = $chercher_logo($id_objet, $_id_objet, $mode);
226
+                    // if no logo in base
227
+                    if (!$logo or (is_countable($logo) ? count($logo) : 0) < 6) {
228
+                        foreach ($formats_logos as $format) {
229
+                            if (@file_exists($d = ($dir . ($nom = $nom_base . intval($id_objet) . '.' . $format)))) {
230
+                                if (isset($desc['field']['date_modif'])) {
231
+                                    $date_modif = sql_getfetsel('date_modif', $table, "$_id_objet=$id_objet");
232
+                                } else {
233
+                                    $date_modif = null;
234
+                                }
235
+                                // s'assurer que le logo a les bon droits au passage (evite un echec en cas de sanitization d'un svg)
236
+                                @chmod($d, _SPIP_CHMOD & 0666);
237
+                                // logo_modifier commence par supprimer le logo existant, donc on le deplace pour pas le perdre
238
+                                @rename($d, $dir_logos . $nom);
239
+                                // et on le declare comme nouveau logo
240
+                                logo_modifier($objet, $id_objet, $mode, $dir_logos . $nom);
241
+                                if ($date_modif) {
242
+                                    sql_updateq($table, ['date_modif' => $date_modif], "$_id_objet=$id_objet");
243
+                                }
244
+                                break;
245
+                            }
246
+                        }
247
+                    }
248
+                    $deja[$id_objet] = true;
249
+                }
250
+            }
251
+            // si le fichier est encore la on le move : rien a faire ici
252
+            // (sauf si c'est une re-migration : il est deja dans logo/ donc il bouge pas)
253
+            if ($dir !== $dir_logos and file_exists($file)) {
254
+                @rename($file, $dir_logos_erreurs . basename($file));
255
+            }
256
+
257
+            $count--;
258
+            if ($count % 250 === 0) {
259
+                spip_log("logo_migrer_en_base $objet $mode : " . $count . ' logos restant', 'maj' . _LOG_INFO_IMPORTANTE);
260
+            }
261
+
262
+            if ($time_limit and time() > $time_limit) {
263
+                effacer_meta('drapeau_edition');
264
+                return;
265
+            }
266
+        }
267
+    }
268
+
269
+    if ($liste_objets_versionnes) {
270
+        $GLOBALS['meta']['objets_versions'] = $liste_objets_versionnes;
271
+    }
272
+    $GLOBALS['meta']['articles_modif'] = $articles_modif;
273
+
274
+    effacer_meta('drapeau_edition');
275 275
 }
Please login to merge, or discard this patch.
ecrire/inc/autoriser.php 1 patch
Indentation   +683 added lines, -683 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @package SPIP\Core\Autorisations
17 17
  **/
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 include_spip('base/abstract_sql');
@@ -38,89 +38,89 @@  discard block
 block discarded – undo
38 38
 
39 39
 
40 40
 if (!function_exists('autoriser')) {
41
-	/**
42
-	 * Autoriser une action
43
-	 *
44
-	 * Teste si une personne (par défaut le visiteur en cours) peut effectuer
45
-	 * une certaine action. Cette fonction est le point d'entrée de toutes
46
-	 * les autorisations.
47
-	 *
48
-	 * La fonction se charge d'appeler des fonctions d'autorisations spécifiques
49
-	 * aux actions demandées si elles existent. Elle cherche donc les fonctions
50
-	 * dans cet ordre :
51
-	 *
52
-	 * - autoriser_{type}_{faire}, sinon avec _dist
53
-	 * - autoriser_{type}, sinon avec _dist
54
-	 * - autoriser_{faire}, sinon avec _dist
55
-	 * - autoriser_{defaut}, sinon avec _dist
56
-	 *
57
-	 * Seul le premier argument est obligatoire.
58
-	 *
59
-	 * @note
60
-	 *     Le paramètre `$type` attend par défaut un type d'objet éditorial, et à ce titre,
61
-	 *     la valeur transmise se verra appliquer la fonction 'objet_type' pour uniformiser
62
-	 *     cette valeur.
63
-	 *
64
-	 *     Si ce paramètre n'a rien n'a voir avec un objet éditorial, par exemple
65
-	 *     'statistiques', un souligné avant le terme est ajouté afin d'indiquer
66
-	 *     explicitement à la fonction autoriser de ne pas transformer la chaîne en type
67
-	 *     d'objet. Cela donne pour cet exemple : `autoriser('detruire', '_statistiques')`
68
-	 *
69
-	 * @note
70
-	 *     Le paramètre `$type`, en plus de l'uniformisation en type d'objet, se voit retirer
71
-	 *     tous les soulignés du terme. Ainsi le type d'objet `livre_art` deviendra `livreart`
72
-	 *     et SPIP cherchera une fonction `autoriser_livreart_{faire}`. Ceci permet
73
-	 *     d'éviter une possible confusion si une fonction `autoriser_livre_art` existait :
74
-	 *     quel serait le type, quel serait l'action ?
75
-	 *
76
-	 *     Pour résumer, si le type d'objet éditorial a un souligné, tel que 'livre_art',
77
-	 *     la fonction d'autorisation correspondante ne l'aura pas.
78
-	 *     Exemple : `function autoriser_livreart_modifier_dist(...){...}`
79
-	 *
80
-	 * @api
81
-	 * @see autoriser_dist()
82
-	 * @see objet_type()
83
-	 *
84
-	 * @param string $faire
85
-	 *   une action ('modifier', 'publier'...)
86
-	 * @param string|null $type
87
-	 *   Type d’objet ou élément sur lequel appliquer l’action.
88
-	 *   - null: indifférent à tout type d’élément ou objet éditorial
89
-	 *   - string: objet éditorial (objet_type() est appliqué pour homogénéiser l’entrée)
90
-	 *   - _string: autre élément (avec un souligné en premier caractère, désactive objet_type()).
91
-	 *   Les soulignés seront retirés (cf. la note).
92
-	 * @param string|int|null $id
93
-	 *   id de l'objet ou élément sur lequel on veut agir, si pertinent.
94
-	 *   - null: non utile pour l’autorisation
95
-	 *   - int: identifiant numérique (cas de tous les objets éditoriaux de SPIP)
96
-	 *   - string: identifiant textuel
97
-	 * @param null|int|array $qui
98
-	 *   - si null on prend alors visiteur_session
99
-	 *   - un id_auteur (on regarde dans la base)
100
-	 *   - un tableau auteur complet, y compris [restreint]
101
-	 * @param array $opt
102
-	 *   options sous forme de tableau associatif
103
-	 * @return bool
104
-	 *   true si la personne peut effectuer l'action
105
-	 */
106
-	function autoriser(string $faire, ?string $type = '', $id = null, $qui = null, array $opt = []): bool {
107
-		// Charger les fonctions d'autorisation supplementaires
108
-		static $pipe;
109
-		if (!isset($pipe)) {
110
-			$pipe = 1;
111
-			pipeline('autoriser');
112
-		}
113
-
114
-		return autoriser_dist($faire, $type, $id, $qui, $opt);
115
-	}
41
+    /**
42
+     * Autoriser une action
43
+     *
44
+     * Teste si une personne (par défaut le visiteur en cours) peut effectuer
45
+     * une certaine action. Cette fonction est le point d'entrée de toutes
46
+     * les autorisations.
47
+     *
48
+     * La fonction se charge d'appeler des fonctions d'autorisations spécifiques
49
+     * aux actions demandées si elles existent. Elle cherche donc les fonctions
50
+     * dans cet ordre :
51
+     *
52
+     * - autoriser_{type}_{faire}, sinon avec _dist
53
+     * - autoriser_{type}, sinon avec _dist
54
+     * - autoriser_{faire}, sinon avec _dist
55
+     * - autoriser_{defaut}, sinon avec _dist
56
+     *
57
+     * Seul le premier argument est obligatoire.
58
+     *
59
+     * @note
60
+     *     Le paramètre `$type` attend par défaut un type d'objet éditorial, et à ce titre,
61
+     *     la valeur transmise se verra appliquer la fonction 'objet_type' pour uniformiser
62
+     *     cette valeur.
63
+     *
64
+     *     Si ce paramètre n'a rien n'a voir avec un objet éditorial, par exemple
65
+     *     'statistiques', un souligné avant le terme est ajouté afin d'indiquer
66
+     *     explicitement à la fonction autoriser de ne pas transformer la chaîne en type
67
+     *     d'objet. Cela donne pour cet exemple : `autoriser('detruire', '_statistiques')`
68
+     *
69
+     * @note
70
+     *     Le paramètre `$type`, en plus de l'uniformisation en type d'objet, se voit retirer
71
+     *     tous les soulignés du terme. Ainsi le type d'objet `livre_art` deviendra `livreart`
72
+     *     et SPIP cherchera une fonction `autoriser_livreart_{faire}`. Ceci permet
73
+     *     d'éviter une possible confusion si une fonction `autoriser_livre_art` existait :
74
+     *     quel serait le type, quel serait l'action ?
75
+     *
76
+     *     Pour résumer, si le type d'objet éditorial a un souligné, tel que 'livre_art',
77
+     *     la fonction d'autorisation correspondante ne l'aura pas.
78
+     *     Exemple : `function autoriser_livreart_modifier_dist(...){...}`
79
+     *
80
+     * @api
81
+     * @see autoriser_dist()
82
+     * @see objet_type()
83
+     *
84
+     * @param string $faire
85
+     *   une action ('modifier', 'publier'...)
86
+     * @param string|null $type
87
+     *   Type d’objet ou élément sur lequel appliquer l’action.
88
+     *   - null: indifférent à tout type d’élément ou objet éditorial
89
+     *   - string: objet éditorial (objet_type() est appliqué pour homogénéiser l’entrée)
90
+     *   - _string: autre élément (avec un souligné en premier caractère, désactive objet_type()).
91
+     *   Les soulignés seront retirés (cf. la note).
92
+     * @param string|int|null $id
93
+     *   id de l'objet ou élément sur lequel on veut agir, si pertinent.
94
+     *   - null: non utile pour l’autorisation
95
+     *   - int: identifiant numérique (cas de tous les objets éditoriaux de SPIP)
96
+     *   - string: identifiant textuel
97
+     * @param null|int|array $qui
98
+     *   - si null on prend alors visiteur_session
99
+     *   - un id_auteur (on regarde dans la base)
100
+     *   - un tableau auteur complet, y compris [restreint]
101
+     * @param array $opt
102
+     *   options sous forme de tableau associatif
103
+     * @return bool
104
+     *   true si la personne peut effectuer l'action
105
+     */
106
+    function autoriser(string $faire, ?string $type = '', $id = null, $qui = null, array $opt = []): bool {
107
+        // Charger les fonctions d'autorisation supplementaires
108
+        static $pipe;
109
+        if (!isset($pipe)) {
110
+            $pipe = 1;
111
+            pipeline('autoriser');
112
+        }
113
+
114
+        return autoriser_dist($faire, $type, $id, $qui, $opt);
115
+    }
116 116
 }
117 117
 
118 118
 
119 119
 // mes_fonctions peut aussi declarer des autorisations, il faut donc le charger
120 120
 // mais apres la fonction autoriser()
121 121
 if ($f = find_in_path('mes_fonctions.php')) {
122
-	global $dossier_squelettes;
123
-	include_once(_ROOT_CWD . $f);
122
+    global $dossier_squelettes;
123
+    include_once(_ROOT_CWD . $f);
124 124
 }
125 125
 
126 126
 
@@ -151,85 +151,85 @@  discard block
 block discarded – undo
151 151
  */
152 152
 function autoriser_dist(string $faire, ?string $type = '', $id = null, $qui = null, array $opt = []): bool {
153 153
 
154
-	if ($type === null) {
155
-		$type = '';
156
-	}
157
-
158
-	// Qui ? visiteur_session ?
159
-	// si null ou '' (appel depuis #AUTORISER) on prend l'auteur loge
160
-	if ($qui === null or $qui === '') {
161
-		$qui = $GLOBALS['visiteur_session'] ?: [];
162
-		$qui = array_merge(['statut' => '', 'id_auteur' => 0, 'webmestre' => 'non'], $qui);
163
-	} elseif (is_numeric($qui)) {
164
-		$qui = sql_fetsel('*', 'spip_auteurs', 'id_auteur=' . $qui);
165
-		if (!$qui) {
166
-			return false;
167
-		}
168
-	}
169
-
170
-	// Admins restreints, on construit ici (pas generique mais...)
171
-	// le tableau de toutes leurs rubriques (y compris les sous-rubriques)
172
-	if (_ADMINS_RESTREINTS and is_array($qui)) {
173
-		$qui['restreint'] = isset($qui['id_auteur']) ? liste_rubriques_auteur($qui['id_auteur']) : [];
174
-	}
175
-
176
-	spip_log(
177
-		"autoriser $faire $type $id (" . ($qui['nom'] ?? '') . ') ?',
178
-		'autoriser' . _LOG_DEBUG
179
-	);
180
-
181
-	// passer par objet_type pour avoir les alias
182
-	// sauf si _ est le premier caractère.
183
-	if ($type and $type[0] !== '_') {
184
-		$type = objet_type($type, false);
185
-	}
186
-	// et supprimer les _
187
-	$type = str_replace('_', '', (string) $type);
188
-
189
-	// Si une exception a ete decretee plus haut dans le code, l'appliquer
190
-	if (
191
-		(isset($GLOBALS['autoriser_exception'][$faire][$type][$id]) and autoriser_exception($faire, $type, $id, 'verifier'))
192
-		or (isset($GLOBALS['autoriser_exception'][$faire][$type]['*']) and autoriser_exception($faire, $type, '*', 'verifier'))
193
-	) {
194
-		spip_log("autoriser ($faire, $type, $id, " . ($qui['nom'] ?? '') . ') : OK Exception', 'autoriser' . _LOG_DEBUG);
195
-		return true;
196
-	}
197
-
198
-	// Chercher une fonction d'autorisation
199
-	// Dans l'ordre on va chercher autoriser_type_faire[_dist], autoriser_type[_dist],
200
-	// autoriser_faire[_dist], autoriser_defaut[_dist]
201
-	$fonctions = $type
202
-		? [
203
-			'autoriser_' . $type . '_' . $faire,
204
-			'autoriser_' . $type . '_' . $faire . '_dist',
205
-			'autoriser_' . $type,
206
-			'autoriser_' . $type . '_dist',
207
-			'autoriser_' . $faire,
208
-			'autoriser_' . $faire . '_dist',
209
-			'autoriser_defaut',
210
-			'autoriser_defaut_dist'
211
-		]
212
-		: [
213
-			'autoriser_' . $faire,
214
-			'autoriser_' . $faire . '_dist',
215
-			'autoriser_defaut',
216
-			'autoriser_defaut_dist'
217
-		];
218
-
219
-	$a = false;
220
-	foreach ($fonctions as $f) {
221
-		if (function_exists($f)) {
222
-			$a = $f($faire, $type, $id, $qui, $opt);
223
-			break;
224
-		}
225
-	}
226
-
227
-	spip_log(
228
-		"$f($faire, $type, $id, " . ($qui['nom'] ?? '') . ') : ' . ($a ? 'OK' : 'niet'),
229
-		'autoriser' . _LOG_DEBUG
230
-	);
231
-
232
-	return $a;
154
+    if ($type === null) {
155
+        $type = '';
156
+    }
157
+
158
+    // Qui ? visiteur_session ?
159
+    // si null ou '' (appel depuis #AUTORISER) on prend l'auteur loge
160
+    if ($qui === null or $qui === '') {
161
+        $qui = $GLOBALS['visiteur_session'] ?: [];
162
+        $qui = array_merge(['statut' => '', 'id_auteur' => 0, 'webmestre' => 'non'], $qui);
163
+    } elseif (is_numeric($qui)) {
164
+        $qui = sql_fetsel('*', 'spip_auteurs', 'id_auteur=' . $qui);
165
+        if (!$qui) {
166
+            return false;
167
+        }
168
+    }
169
+
170
+    // Admins restreints, on construit ici (pas generique mais...)
171
+    // le tableau de toutes leurs rubriques (y compris les sous-rubriques)
172
+    if (_ADMINS_RESTREINTS and is_array($qui)) {
173
+        $qui['restreint'] = isset($qui['id_auteur']) ? liste_rubriques_auteur($qui['id_auteur']) : [];
174
+    }
175
+
176
+    spip_log(
177
+        "autoriser $faire $type $id (" . ($qui['nom'] ?? '') . ') ?',
178
+        'autoriser' . _LOG_DEBUG
179
+    );
180
+
181
+    // passer par objet_type pour avoir les alias
182
+    // sauf si _ est le premier caractère.
183
+    if ($type and $type[0] !== '_') {
184
+        $type = objet_type($type, false);
185
+    }
186
+    // et supprimer les _
187
+    $type = str_replace('_', '', (string) $type);
188
+
189
+    // Si une exception a ete decretee plus haut dans le code, l'appliquer
190
+    if (
191
+        (isset($GLOBALS['autoriser_exception'][$faire][$type][$id]) and autoriser_exception($faire, $type, $id, 'verifier'))
192
+        or (isset($GLOBALS['autoriser_exception'][$faire][$type]['*']) and autoriser_exception($faire, $type, '*', 'verifier'))
193
+    ) {
194
+        spip_log("autoriser ($faire, $type, $id, " . ($qui['nom'] ?? '') . ') : OK Exception', 'autoriser' . _LOG_DEBUG);
195
+        return true;
196
+    }
197
+
198
+    // Chercher une fonction d'autorisation
199
+    // Dans l'ordre on va chercher autoriser_type_faire[_dist], autoriser_type[_dist],
200
+    // autoriser_faire[_dist], autoriser_defaut[_dist]
201
+    $fonctions = $type
202
+        ? [
203
+            'autoriser_' . $type . '_' . $faire,
204
+            'autoriser_' . $type . '_' . $faire . '_dist',
205
+            'autoriser_' . $type,
206
+            'autoriser_' . $type . '_dist',
207
+            'autoriser_' . $faire,
208
+            'autoriser_' . $faire . '_dist',
209
+            'autoriser_defaut',
210
+            'autoriser_defaut_dist'
211
+        ]
212
+        : [
213
+            'autoriser_' . $faire,
214
+            'autoriser_' . $faire . '_dist',
215
+            'autoriser_defaut',
216
+            'autoriser_defaut_dist'
217
+        ];
218
+
219
+    $a = false;
220
+    foreach ($fonctions as $f) {
221
+        if (function_exists($f)) {
222
+            $a = $f($faire, $type, $id, $qui, $opt);
223
+            break;
224
+        }
225
+    }
226
+
227
+    spip_log(
228
+        "$f($faire, $type, $id, " . ($qui['nom'] ?? '') . ') : ' . ($a ? 'OK' : 'niet'),
229
+        'autoriser' . _LOG_DEBUG
230
+    );
231
+
232
+    return $a;
233 233
 }
234 234
 
235 235
 // une globale pour aller au plus vite dans la fonction generique ci dessus
@@ -249,33 +249,33 @@  discard block
 block discarded – undo
249 249
  * @return bool
250 250
  */
251 251
 function autoriser_exception(string $faire, ?string $type = '', $id = null, $autoriser = true): bool {
252
-	// une static innaccessible par url pour verifier que la globale est positionnee a bon escient
253
-	static $autorisation;
254
-	// Tolérance avec certains appels
255
-	if ($type === null) {
256
-		$type = '';
257
-	}
258
-	if ($id === null) {
259
-		$id = 0;
260
-	}
261
-	if ($autoriser === 'verifier') {
262
-		return isset($autorisation[$faire][$type][$id]);
263
-	}
264
-	if ($autoriser === true) {
265
-		$GLOBALS['autoriser_exception'][$faire][$type][$id] = $autorisation[$faire][$type][$id] = true;
266
-	}
267
-	if ($autoriser === false) {
268
-		if ($id === '*') {
269
-			unset($GLOBALS['autoriser_exception'][$faire][$type]);
270
-			unset($autorisation[$faire][$type]);
271
-		}
272
-		else {
273
-			unset($GLOBALS['autoriser_exception'][$faire][$type][$id]);
274
-			unset($autorisation[$faire][$type][$id]);
275
-		}
276
-	}
277
-
278
-	return false;
252
+    // une static innaccessible par url pour verifier que la globale est positionnee a bon escient
253
+    static $autorisation;
254
+    // Tolérance avec certains appels
255
+    if ($type === null) {
256
+        $type = '';
257
+    }
258
+    if ($id === null) {
259
+        $id = 0;
260
+    }
261
+    if ($autoriser === 'verifier') {
262
+        return isset($autorisation[$faire][$type][$id]);
263
+    }
264
+    if ($autoriser === true) {
265
+        $GLOBALS['autoriser_exception'][$faire][$type][$id] = $autorisation[$faire][$type][$id] = true;
266
+    }
267
+    if ($autoriser === false) {
268
+        if ($id === '*') {
269
+            unset($GLOBALS['autoriser_exception'][$faire][$type]);
270
+            unset($autorisation[$faire][$type]);
271
+        }
272
+        else {
273
+            unset($GLOBALS['autoriser_exception'][$faire][$type][$id]);
274
+            unset($autorisation[$faire][$type][$id]);
275
+        }
276
+    }
277
+
278
+    return false;
279 279
 }
280 280
 
281 281
 
@@ -294,9 +294,9 @@  discard block
 block discarded – undo
294 294
  * @return bool true s'il a le droit, false sinon
295 295
  **/
296 296
 function autoriser_defaut_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
297
-	return
298
-		$qui['statut'] === '0minirezo'
299
-		and !$qui['restreint'];
297
+    return
298
+        $qui['statut'] === '0minirezo'
299
+        and !$qui['restreint'];
300 300
 }
301 301
 
302 302
 /**
@@ -316,10 +316,10 @@  discard block
 block discarded – undo
316 316
  * @return bool true s'il a le droit, false sinon
317 317
  */
318 318
 function autoriser_loger_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
319
-	if ($qui['statut'] === '5poubelle') {
320
-		return false;
321
-	}
322
-	return true;
319
+    if ($qui['statut'] === '5poubelle') {
320
+        return false;
321
+    }
322
+    return true;
323 323
 }
324 324
 
325 325
 /**
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
  * @return bool true s'il a le droit, false sinon
336 336
  **/
337 337
 function autoriser_ecrire_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
338
-	return isset($qui['statut']) and in_array($qui['statut'], ['0minirezo', '1comite']);
338
+    return isset($qui['statut']) and in_array($qui['statut'], ['0minirezo', '1comite']);
339 339
 }
340 340
 
341 341
 /**
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
  * @return bool true s'il a le droit, false sinon
355 355
  **/
356 356
 function autoriser_creer_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
357
-	return in_array($qui['statut'], ['0minirezo', '1comite']);
357
+    return in_array($qui['statut'], ['0minirezo', '1comite']);
358 358
 }
359 359
 
360 360
 /**
@@ -374,18 +374,18 @@  discard block
 block discarded – undo
374 374
  **/
375 375
 function autoriser_previsualiser_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
376 376
 
377
-	// Le visiteur a-t-il un statut prevu par la config ?
378
-	if (strpos($GLOBALS['meta']['preview'], ',' . $qui['statut'] . ',') !== false) {
379
-		return test_previsualiser_objet_champ($type, $id, $qui, $opt);
380
-	}
377
+    // Le visiteur a-t-il un statut prevu par la config ?
378
+    if (strpos($GLOBALS['meta']['preview'], ',' . $qui['statut'] . ',') !== false) {
379
+        return test_previsualiser_objet_champ($type, $id, $qui, $opt);
380
+    }
381 381
 
382
-	// A-t-on un token de prévisualisation valable ?
383
-	include_spip('inc/securiser_action');
384
-	if (decrire_token_previsu()) {
385
-		return true;
386
-	}
382
+    // A-t-on un token de prévisualisation valable ?
383
+    include_spip('inc/securiser_action');
384
+    if (decrire_token_previsu()) {
385
+        return true;
386
+    }
387 387
 
388
-	return false;
388
+    return false;
389 389
 }
390 390
 
391 391
 /**
@@ -414,58 +414,58 @@  discard block
 block discarded – undo
414 414
  */
415 415
 function test_previsualiser_objet_champ(string $type = '', $id = null, array $qui = [], array $opt = []): bool {
416 416
 
417
-	// si pas de type et statut fourni, c'est une autorisation generale => OK
418
-	if (!$type) {
419
-		return true;
420
-	}
421
-
422
-	include_spip('base/objets');
423
-	$infos = lister_tables_objets_sql(table_objet_sql($type));
424
-	if (isset($infos['statut'])) {
425
-		foreach ($infos['statut'] as $c) {
426
-			if (isset($c['publie'])) {
427
-				if (!isset($c['previsu'])) {
428
-					return false;
429
-				} // pas de previsu definie => NIET
430
-				$champ = $c['champ'];
431
-				if (!isset($opt[$champ])) {
432
-					return false;
433
-				} // pas de champ passe a la demande => NIET
434
-				$previsu = explode(',', $c['previsu']);
435
-				// regarder si ce statut est autorise pour l'auteur
436
-				if (in_array($opt[$champ] . '/auteur', $previsu)) {
437
-					// retrouver l’id_auteur qui a filé un lien de prévisu éventuellement,
438
-					// sinon l’auteur en session
439
-					include_spip('inc/securiser_action');
440
-					if ($desc = decrire_token_previsu()) {
441
-						$id_auteur = $desc['id_auteur'];
442
-					} elseif (isset($GLOBALS['visiteur_session']['id_auteur'])) {
443
-						$id_auteur = intval($GLOBALS['visiteur_session']['id_auteur']);
444
-					} else {
445
-						$id_auteur = null;
446
-					}
447
-
448
-					if (!$id_auteur) {
449
-						return false;
450
-					} elseif (autoriser('previsualiser' . $opt[$champ], $type, 0, $id_auteur)) {
451
-						// dans ce cas (admin en general), pas de filtrage sur ce statut
452
-					} elseif (
453
-						!sql_countsel(
454
-							'spip_auteurs_liens',
455
-							'id_auteur=' . intval($id_auteur) . ' AND objet=' . sql_quote($type) . ' AND id_objet=' . intval($id)
456
-						)
457
-					) {
458
-						return false;
459
-					} // pas auteur de cet objet => NIET
460
-				} elseif (!in_array($opt[$champ], $previsu)) {
461
-					// le statut n'est pas dans ceux definis par la previsu => NIET
462
-					return false;
463
-				}
464
-			}
465
-		}
466
-	}
467
-
468
-	return true;
417
+    // si pas de type et statut fourni, c'est une autorisation generale => OK
418
+    if (!$type) {
419
+        return true;
420
+    }
421
+
422
+    include_spip('base/objets');
423
+    $infos = lister_tables_objets_sql(table_objet_sql($type));
424
+    if (isset($infos['statut'])) {
425
+        foreach ($infos['statut'] as $c) {
426
+            if (isset($c['publie'])) {
427
+                if (!isset($c['previsu'])) {
428
+                    return false;
429
+                } // pas de previsu definie => NIET
430
+                $champ = $c['champ'];
431
+                if (!isset($opt[$champ])) {
432
+                    return false;
433
+                } // pas de champ passe a la demande => NIET
434
+                $previsu = explode(',', $c['previsu']);
435
+                // regarder si ce statut est autorise pour l'auteur
436
+                if (in_array($opt[$champ] . '/auteur', $previsu)) {
437
+                    // retrouver l’id_auteur qui a filé un lien de prévisu éventuellement,
438
+                    // sinon l’auteur en session
439
+                    include_spip('inc/securiser_action');
440
+                    if ($desc = decrire_token_previsu()) {
441
+                        $id_auteur = $desc['id_auteur'];
442
+                    } elseif (isset($GLOBALS['visiteur_session']['id_auteur'])) {
443
+                        $id_auteur = intval($GLOBALS['visiteur_session']['id_auteur']);
444
+                    } else {
445
+                        $id_auteur = null;
446
+                    }
447
+
448
+                    if (!$id_auteur) {
449
+                        return false;
450
+                    } elseif (autoriser('previsualiser' . $opt[$champ], $type, 0, $id_auteur)) {
451
+                        // dans ce cas (admin en general), pas de filtrage sur ce statut
452
+                    } elseif (
453
+                        !sql_countsel(
454
+                            'spip_auteurs_liens',
455
+                            'id_auteur=' . intval($id_auteur) . ' AND objet=' . sql_quote($type) . ' AND id_objet=' . intval($id)
456
+                        )
457
+                    ) {
458
+                        return false;
459
+                    } // pas auteur de cet objet => NIET
460
+                } elseif (!in_array($opt[$champ], $previsu)) {
461
+                    // le statut n'est pas dans ceux definis par la previsu => NIET
462
+                    return false;
463
+                }
464
+            }
465
+        }
466
+    }
467
+
468
+    return true;
469 469
 }
470 470
 
471 471
 /**
@@ -481,51 +481,51 @@  discard block
 block discarded – undo
481 481
  * @return bool true s'il a le droit, false sinon
482 482
  **/
483 483
 function autoriser_changerlangue_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
484
-	$multi_objets = explode(',', lire_config('multi_objets'));
485
-	$gerer_trad_objets = explode(',', lire_config('gerer_trad_objets'));
486
-	$table = table_objet_sql($type);
487
-	if (
488
-		in_array($table, $multi_objets)
489
-		or in_array($table, $gerer_trad_objets)
490
-	) { // affichage du formulaire si la configuration l'accepte
491
-		$multi_secteurs = lire_config('multi_secteurs');
492
-		$champs = objet_info($type, 'field');
493
-		if (
494
-			$multi_secteurs === 'oui'
495
-			and array_key_exists('id_rubrique', $champs)
496
-		) {
497
-			// multilinguisme par secteur et objet rattaché à une rubrique
498
-			$primary = id_table_objet($type);
499
-			if ($table != 'spip_rubriques') {
500
-				$id_rubrique = sql_getfetsel('id_rubrique', "$table", "$primary=" . intval($id));
501
-			} else {
502
-				$id_rubrique = $id;
503
-			}
504
-			$id_secteur = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique));
505
-			if (!$id_secteur > 0) {
506
-				$id_secteur = $id_rubrique;
507
-			}
508
-			$langue_secteur = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique=' . intval($id_secteur));
509
-			$langue_objet = sql_getfetsel('lang', "$table", "$primary=" . intval($id));
510
-			if ($langue_secteur != $langue_objet) {
511
-				// configuration incohérente, on laisse l'utilisateur corriger la situation
512
-				return true;
513
-			}
514
-			if ($table != 'spip_rubriques') { // le choix de la langue se fait seulement sur les rubriques
515
-				return false;
516
-			} else {
517
-				$id_parent = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique=' . intval($id));
518
-				if ($id_parent != 0) {
519
-					// sous-rubriques : pas de choix de langue
520
-					return false;
521
-				}
522
-			}
523
-		}
524
-	} else {
525
-		return false;
526
-	}
527
-
528
-	return autoriser('modifier', $type, $id, $qui, $opt);
484
+    $multi_objets = explode(',', lire_config('multi_objets'));
485
+    $gerer_trad_objets = explode(',', lire_config('gerer_trad_objets'));
486
+    $table = table_objet_sql($type);
487
+    if (
488
+        in_array($table, $multi_objets)
489
+        or in_array($table, $gerer_trad_objets)
490
+    ) { // affichage du formulaire si la configuration l'accepte
491
+        $multi_secteurs = lire_config('multi_secteurs');
492
+        $champs = objet_info($type, 'field');
493
+        if (
494
+            $multi_secteurs === 'oui'
495
+            and array_key_exists('id_rubrique', $champs)
496
+        ) {
497
+            // multilinguisme par secteur et objet rattaché à une rubrique
498
+            $primary = id_table_objet($type);
499
+            if ($table != 'spip_rubriques') {
500
+                $id_rubrique = sql_getfetsel('id_rubrique', "$table", "$primary=" . intval($id));
501
+            } else {
502
+                $id_rubrique = $id;
503
+            }
504
+            $id_secteur = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique));
505
+            if (!$id_secteur > 0) {
506
+                $id_secteur = $id_rubrique;
507
+            }
508
+            $langue_secteur = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique=' . intval($id_secteur));
509
+            $langue_objet = sql_getfetsel('lang', "$table", "$primary=" . intval($id));
510
+            if ($langue_secteur != $langue_objet) {
511
+                // configuration incohérente, on laisse l'utilisateur corriger la situation
512
+                return true;
513
+            }
514
+            if ($table != 'spip_rubriques') { // le choix de la langue se fait seulement sur les rubriques
515
+                return false;
516
+            } else {
517
+                $id_parent = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique=' . intval($id));
518
+                if ($id_parent != 0) {
519
+                    // sous-rubriques : pas de choix de langue
520
+                    return false;
521
+                }
522
+            }
523
+        }
524
+    } else {
525
+        return false;
526
+    }
527
+
528
+    return autoriser('modifier', $type, $id, $qui, $opt);
529 529
 }
530 530
 
531 531
 /**
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
  * @return bool true s'il a le droit, false sinon
542 542
  **/
543 543
 function autoriser_changertraduction_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
544
-	return autoriser('modifier', $type, $id, $qui, $opt);
544
+    return autoriser('modifier', $type, $id, $qui, $opt);
545 545
 }
546 546
 
547 547
 /**
@@ -557,41 +557,41 @@  discard block
 block discarded – undo
557 557
  * @return bool true s'il a le droit, false sinon
558 558
  **/
559 559
 function autoriser_dater_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
560
-	$table = table_objet($type);
561
-	$trouver_table = charger_fonction('trouver_table', 'base');
562
-	$desc = $trouver_table($table);
563
-	if (!$desc) {
564
-		return false;
565
-	}
566
-
567
-	if (!isset($opt['statut'])) {
568
-		if (isset($desc['field']['statut'])) {
569
-			$statut = sql_getfetsel('statut', $desc['table'], id_table_objet($type) . '=' . intval($id));
570
-		} else {
571
-			$statut = 'publie';
572
-		} // pas de statut => publie
573
-	} else {
574
-		$statut = $opt['statut'];
575
-	}
576
-
577
-	// Liste des statuts publiés pour cet objet
578
-	if (isset($desc['statut'][0]['publie'])) {
579
-		$statuts_publies = explode(',', $desc['statut'][0]['publie']);
580
-	}
581
-	// Sinon en dur le statut "publie"
582
-	else {
583
-		$statuts_publies = ['publie'];
584
-	}
585
-
586
-	if (
587
-		in_array($statut, $statuts_publies)
588
-		// Ou cas particulier géré en dur ici pour les articles
589
-		or ($statut === 'prop' and $type === 'article' and $GLOBALS['meta']['post_dates'] === 'non')
590
-	) {
591
-		return autoriser('modifier', $type, $id);
592
-	}
593
-
594
-	return false;
560
+    $table = table_objet($type);
561
+    $trouver_table = charger_fonction('trouver_table', 'base');
562
+    $desc = $trouver_table($table);
563
+    if (!$desc) {
564
+        return false;
565
+    }
566
+
567
+    if (!isset($opt['statut'])) {
568
+        if (isset($desc['field']['statut'])) {
569
+            $statut = sql_getfetsel('statut', $desc['table'], id_table_objet($type) . '=' . intval($id));
570
+        } else {
571
+            $statut = 'publie';
572
+        } // pas de statut => publie
573
+    } else {
574
+        $statut = $opt['statut'];
575
+    }
576
+
577
+    // Liste des statuts publiés pour cet objet
578
+    if (isset($desc['statut'][0]['publie'])) {
579
+        $statuts_publies = explode(',', $desc['statut'][0]['publie']);
580
+    }
581
+    // Sinon en dur le statut "publie"
582
+    else {
583
+        $statuts_publies = ['publie'];
584
+    }
585
+
586
+    if (
587
+        in_array($statut, $statuts_publies)
588
+        // Ou cas particulier géré en dur ici pour les articles
589
+        or ($statut === 'prop' and $type === 'article' and $GLOBALS['meta']['post_dates'] === 'non')
590
+    ) {
591
+        return autoriser('modifier', $type, $id);
592
+    }
593
+
594
+    return false;
595 595
 }
596 596
 
597 597
 /**
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
  * @return bool true s'il a le droit, false sinon
611 611
  **/
612 612
 function autoriser_instituer_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
613
-	return autoriser('modifier', $type, $id, $qui, $opt);
613
+    return autoriser('modifier', $type, $id, $qui, $opt);
614 614
 }
615 615
 
616 616
 /**
@@ -628,12 +628,12 @@  discard block
 block discarded – undo
628 628
  * @return bool true s'il a le droit, false sinon
629 629
  **/
630 630
 function autoriser_rubrique_publierdans_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
631
-	return
632
-		($qui['statut'] === '0minirezo')
633
-		and (
634
-			!$qui['restreint'] or !$id
635
-			or in_array($id, $qui['restreint'])
636
-		);
631
+    return
632
+        ($qui['statut'] === '0minirezo')
633
+        and (
634
+            !$qui['restreint'] or !$id
635
+            or in_array($id, $qui['restreint'])
636
+        );
637 637
 }
638 638
 
639 639
 /**
@@ -651,12 +651,12 @@  discard block
 block discarded – undo
651 651
  * @return bool true s'il a le droit, false sinon
652 652
  **/
653 653
 function autoriser_rubrique_creer_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
654
-	if (!empty($opt['id_parent'])) {
655
-		return autoriser('creerrubriquedans', 'rubrique', $opt['id_parent'], $qui);
656
-	}
657
-	else {
658
-		return autoriser('defaut', null, 0, $qui, $opt);
659
-	}
654
+    if (!empty($opt['id_parent'])) {
655
+        return autoriser('creerrubriquedans', 'rubrique', $opt['id_parent'], $qui);
656
+    }
657
+    else {
658
+        return autoriser('defaut', null, 0, $qui, $opt);
659
+    }
660 660
 }
661 661
 
662 662
 /**
@@ -674,10 +674,10 @@  discard block
 block discarded – undo
674 674
  * @return bool true s'il a le droit, false sinon
675 675
  **/
676 676
 function autoriser_rubrique_creerrubriquedans_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
677
-	return
678
-		($id or ($qui['statut'] === '0minirezo' and !$qui['restreint']))
679
-		and autoriser('voir', 'rubrique', $id)
680
-		and autoriser('publierdans', 'rubrique', $id);
677
+    return
678
+        ($id or ($qui['statut'] === '0minirezo' and !$qui['restreint']))
679
+        and autoriser('voir', 'rubrique', $id)
680
+        and autoriser('publierdans', 'rubrique', $id);
681 681
 }
682 682
 
683 683
 /**
@@ -695,10 +695,10 @@  discard block
 block discarded – undo
695 695
  * @return bool true s'il a le droit, false sinon
696 696
  **/
697 697
 function autoriser_rubrique_creerarticledans_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
698
-	return
699
-		$id
700
-		and autoriser('voir', 'rubrique', $id)
701
-		and autoriser('creer', 'article');
698
+    return
699
+        $id
700
+        and autoriser('voir', 'rubrique', $id)
701
+        and autoriser('creer', 'article');
702 702
 }
703 703
 
704 704
 
@@ -717,8 +717,8 @@  discard block
 block discarded – undo
717 717
  * @return bool true s'il a le droit, false sinon
718 718
  **/
719 719
 function autoriser_rubrique_modifier_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
720
-	return
721
-		autoriser('publierdans', 'rubrique', $id, $qui, $opt);
720
+    return
721
+        autoriser('publierdans', 'rubrique', $id, $qui, $opt);
722 722
 }
723 723
 
724 724
 /**
@@ -736,29 +736,29 @@  discard block
 block discarded – undo
736 736
  * @return bool true s'il a le droit, false sinon
737 737
  **/
738 738
 function autoriser_rubrique_supprimer_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
739
-	if (!$id = intval($id)) {
740
-		return false;
741
-	}
739
+    if (!$id = intval($id)) {
740
+        return false;
741
+    }
742 742
 
743
-	if (sql_countsel('spip_rubriques', 'id_parent=' . intval($id))) {
744
-		return false;
745
-	}
743
+    if (sql_countsel('spip_rubriques', 'id_parent=' . intval($id))) {
744
+        return false;
745
+    }
746 746
 
747
-	if (sql_countsel('spip_articles', 'id_rubrique=' . intval($id) . " AND (statut<>'poubelle')")) {
748
-		return false;
749
-	}
747
+    if (sql_countsel('spip_articles', 'id_rubrique=' . intval($id) . " AND (statut<>'poubelle')")) {
748
+        return false;
749
+    }
750 750
 
751
-	$compte = pipeline(
752
-		'objet_compte_enfants',
753
-		['args' => ['objet' => 'rubrique', 'id_objet' => $id], 'data' => []]
754
-	);
755
-	foreach ($compte as $objet => $n) {
756
-		if ($n) {
757
-			return false;
758
-		}
759
-	}
751
+    $compte = pipeline(
752
+        'objet_compte_enfants',
753
+        ['args' => ['objet' => 'rubrique', 'id_objet' => $id], 'data' => []]
754
+    );
755
+    foreach ($compte as $objet => $n) {
756
+        if ($n) {
757
+            return false;
758
+        }
759
+    }
760 760
 
761
-	return autoriser('modifier', 'rubrique', $id);
761
+    return autoriser('modifier', 'rubrique', $id);
762 762
 }
763 763
 
764 764
 
@@ -778,23 +778,23 @@  discard block
 block discarded – undo
778 778
  * @return bool true s'il a le droit, false sinon
779 779
  **/
780 780
 function autoriser_article_modifier_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
781
-	if (!$id) {
782
-		return false;
783
-	}
784
-	$r = sql_fetsel('id_rubrique,statut', 'spip_articles', 'id_article=' . sql_quote($id));
785
-
786
-	return
787
-		$r
788
-		and
789
-		(
790
-			autoriser('publierdans', 'rubrique', $r['id_rubrique'], $qui, $opt)
791
-			or (
792
-				(!isset($opt['statut']) or !in_array($opt['statut'], ['publie', 'refuse'], true))
793
-				and in_array($qui['statut'], ['0minirezo', '1comite'])
794
-				and in_array($r['statut'], ['prop', 'prepa', 'poubelle'])
795
-				and auteurs_objet('article', $id, 'id_auteur=' . $qui['id_auteur'])
796
-			)
797
-		);
781
+    if (!$id) {
782
+        return false;
783
+    }
784
+    $r = sql_fetsel('id_rubrique,statut', 'spip_articles', 'id_article=' . sql_quote($id));
785
+
786
+    return
787
+        $r
788
+        and
789
+        (
790
+            autoriser('publierdans', 'rubrique', $r['id_rubrique'], $qui, $opt)
791
+            or (
792
+                (!isset($opt['statut']) or !in_array($opt['statut'], ['publie', 'refuse'], true))
793
+                and in_array($qui['statut'], ['0minirezo', '1comite'])
794
+                and in_array($r['statut'], ['prop', 'prepa', 'poubelle'])
795
+                and auteurs_objet('article', $id, 'id_auteur=' . $qui['id_auteur'])
796
+            )
797
+        );
798 798
 }
799 799
 
800 800
 /**
@@ -812,13 +812,13 @@  discard block
 block discarded – undo
812 812
  * @return bool true s'il a le droit, false sinon
813 813
  **/
814 814
 function autoriser_article_creer_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
815
-	if (!empty($opt['id_parent'])) {
816
-		// creerarticledans rappelle autoriser(creer,article) sans id, donc on verifiera condition du else aussi
817
-		return autoriser('creerarticledans', 'rubrique', $opt['id_parent'], $qui);
818
-	}
819
-	else {
820
-		return (sql_countsel('spip_rubriques') > 0 and in_array($qui['statut'], ['0minirezo', '1comite']));
821
-	}
815
+    if (!empty($opt['id_parent'])) {
816
+        // creerarticledans rappelle autoriser(creer,article) sans id, donc on verifiera condition du else aussi
817
+        return autoriser('creerarticledans', 'rubrique', $opt['id_parent'], $qui);
818
+    }
819
+    else {
820
+        return (sql_countsel('spip_rubriques') > 0 and in_array($qui['statut'], ['0minirezo', '1comite']));
821
+    }
822 822
 }
823 823
 
824 824
 /**
@@ -840,28 +840,28 @@  discard block
 block discarded – undo
840 840
  * @return bool true s'il a le droit, false sinon
841 841
  */
842 842
 function autoriser_article_voir_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
843
-	if ($qui['statut'] === '0minirezo') {
844
-		return true;
845
-	}
846
-	// cas des articles : depend du statut de l'article et de l'auteur
847
-	if (isset($opt['statut'])) {
848
-		$statut = $opt['statut'];
849
-	} else {
850
-		if (!$id) {
851
-			return false;
852
-		}
853
-		$statut = sql_getfetsel('statut', 'spip_articles', 'id_article=' . intval($id));
854
-	}
855
-
856
-	return
857
-		// si on est pas auteur de l'article,
858
-		// seuls les propose et publies sont visibles
859
-		in_array($statut, ['prop', 'publie'])
860
-		// sinon si on est auteur, on a le droit de le voir, evidemment !
861
-		or
862
-		($id
863
-			and $qui['id_auteur']
864
-			and auteurs_objet('article', $id, 'id_auteur=' . $qui['id_auteur']));
843
+    if ($qui['statut'] === '0minirezo') {
844
+        return true;
845
+    }
846
+    // cas des articles : depend du statut de l'article et de l'auteur
847
+    if (isset($opt['statut'])) {
848
+        $statut = $opt['statut'];
849
+    } else {
850
+        if (!$id) {
851
+            return false;
852
+        }
853
+        $statut = sql_getfetsel('statut', 'spip_articles', 'id_article=' . intval($id));
854
+    }
855
+
856
+    return
857
+        // si on est pas auteur de l'article,
858
+        // seuls les propose et publies sont visibles
859
+        in_array($statut, ['prop', 'publie'])
860
+        // sinon si on est auteur, on a le droit de le voir, evidemment !
861
+        or
862
+        ($id
863
+            and $qui['id_auteur']
864
+            and auteurs_objet('article', $id, 'id_auteur=' . $qui['id_auteur']));
865 865
 }
866 866
 
867 867
 
@@ -880,24 +880,24 @@  discard block
 block discarded – undo
880 880
  * @return bool true s'il a le droit, false sinon
881 881
  **/
882 882
 function autoriser_voir_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
883
-	# securite, mais on aurait pas du arriver ici !
884
-	if (
885
-		function_exists($f = 'autoriser_' . $type . '_voir')
886
-		or function_exists($f = 'autoriser_' . $type . '_voir_dist')
887
-	) {
888
-		return $f($faire, $type, $id, $qui, $opt);
889
-	}
883
+    # securite, mais on aurait pas du arriver ici !
884
+    if (
885
+        function_exists($f = 'autoriser_' . $type . '_voir')
886
+        or function_exists($f = 'autoriser_' . $type . '_voir_dist')
887
+    ) {
888
+        return $f($faire, $type, $id, $qui, $opt);
889
+    }
890 890
 
891
-	if ($qui['statut'] === '0minirezo') {
892
-		return true;
893
-	}
894
-	// admins et redacteurs peuvent voir un auteur
895
-	if ($type === 'auteur') {
896
-		return in_array($qui['statut'], ['0minirezo', '1comite']);
897
-	}
898
-	// sinon par defaut tout est visible
899
-	// sauf cas particuliers traites separemment (ie article)
900
-	return true;
891
+    if ($qui['statut'] === '0minirezo') {
892
+        return true;
893
+    }
894
+    // admins et redacteurs peuvent voir un auteur
895
+    if ($type === 'auteur') {
896
+        return in_array($qui['statut'], ['0minirezo', '1comite']);
897
+    }
898
+    // sinon par defaut tout est visible
899
+    // sauf cas particuliers traites separemment (ie article)
900
+    return true;
901 901
 }
902 902
 
903 903
 
@@ -920,12 +920,12 @@  discard block
 block discarded – undo
920 920
  * @return bool true s'il a le droit, false sinon
921 921
  **/
922 922
 function autoriser_webmestre_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
923
-	return
924
-		(defined('_ID_WEBMESTRES') ?
925
-			in_array($qui['id_auteur'], explode(':', _ID_WEBMESTRES))
926
-			: $qui['webmestre'] === 'oui')
927
-		and $qui['statut'] === '0minirezo'
928
-		and !$qui['restreint'];
923
+    return
924
+        (defined('_ID_WEBMESTRES') ?
925
+            in_array($qui['id_auteur'], explode(':', _ID_WEBMESTRES))
926
+            : $qui['webmestre'] === 'oui')
927
+        and $qui['statut'] === '0minirezo'
928
+        and !$qui['restreint'];
929 929
 }
930 930
 
931 931
 /**
@@ -943,9 +943,9 @@  discard block
 block discarded – undo
943 943
  * @return bool true s'il a le droit, false sinon
944 944
  **/
945 945
 function autoriser_configurer_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
946
-	return
947
-		$qui['statut'] === '0minirezo'
948
-		and !$qui['restreint'];
946
+    return
947
+        $qui['statut'] === '0minirezo'
948
+        and !$qui['restreint'];
949 949
 }
950 950
 
951 951
 /**
@@ -963,8 +963,8 @@  discard block
 block discarded – undo
963 963
  * @return bool true s'il a le droit, false sinon
964 964
  **/
965 965
 function autoriser_sauvegarder_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
966
-	return
967
-		$qui['statut'] === '0minirezo';
966
+    return
967
+        $qui['statut'] === '0minirezo';
968 968
 }
969 969
 
970 970
 /**
@@ -982,7 +982,7 @@  discard block
 block discarded – undo
982 982
  * @return bool true s'il a le droit, false sinon
983 983
  **/
984 984
 function autoriser_detruire_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
985
-	return autoriser('webmestre', null, 0, $qui, $opt);
985
+    return autoriser('webmestre', null, 0, $qui, $opt);
986 986
 }
987 987
 
988 988
 /**
@@ -1001,23 +1001,23 @@  discard block
 block discarded – undo
1001 1001
  * @return bool true s'il a le droit, false sinon
1002 1002
  **/
1003 1003
 function autoriser_auteur_previsualiser_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1004
-	// les admins peuvent "previsualiser" une page auteur
1005
-	if (
1006
-		$qui['statut'] === '0minirezo'
1007
-		and !$qui['restreint']
1008
-	) {
1009
-		return true;
1010
-	} elseif ($id === 0) {
1011
-		return false;
1012
-	}
1013
-	// "Voir en ligne" si l'auteur a un article publie
1014
-	$n = sql_fetsel(
1015
-		'A.id_article',
1016
-		'spip_auteurs_liens AS L LEFT JOIN spip_articles AS A ON (L.objet=\'article\' AND L.id_objet=A.id_article)',
1017
-		"A.statut='publie' AND L.id_auteur=" . sql_quote($id)
1018
-	);
1004
+    // les admins peuvent "previsualiser" une page auteur
1005
+    if (
1006
+        $qui['statut'] === '0minirezo'
1007
+        and !$qui['restreint']
1008
+    ) {
1009
+        return true;
1010
+    } elseif ($id === 0) {
1011
+        return false;
1012
+    }
1013
+    // "Voir en ligne" si l'auteur a un article publie
1014
+    $n = sql_fetsel(
1015
+        'A.id_article',
1016
+        'spip_auteurs_liens AS L LEFT JOIN spip_articles AS A ON (L.objet=\'article\' AND L.id_objet=A.id_article)',
1017
+        "A.statut='publie' AND L.id_auteur=" . sql_quote($id)
1018
+    );
1019 1019
 
1020
-	return $n ? true : false;
1020
+    return $n ? true : false;
1021 1021
 }
1022 1022
 
1023 1023
 
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
  * @return bool true s'il a le droit, false sinon
1047 1047
  **/
1048 1048
 function autoriser_auteur_creer_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1049
-	return ($qui['statut'] === '0minirezo');
1049
+    return ($qui['statut'] === '0minirezo');
1050 1050
 }
1051 1051
 
1052 1052
 
@@ -1067,75 +1067,75 @@  discard block
 block discarded – undo
1067 1067
  * @return bool true s'il a le droit, false sinon
1068 1068
  **/
1069 1069
 function autoriser_auteur_modifier_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1070
-	$id = intval($id);
1071
-
1072
-	// Si pas admin : seulement le droit de modifier ses donnees perso, mais pas statut ni login
1073
-	// la modif de l'email doit etre verifiee ou notifiee si possible, mais c'est a l'interface de gerer ca
1074
-	if (!in_array($qui['statut'], ['0minirezo'])) {
1075
-		if (
1076
-			$id == $qui['id_auteur']
1077
-			&& empty($opt['statut'])
1078
-			&& empty($opt['webmestre'])
1079
-			&& empty($opt['restreintes'])
1080
-			&& empty($opt['login'])
1081
-		) {
1082
-			return true;
1083
-		}
1084
-		return false;
1085
-	}
1086
-
1087
-	// Un admin restreint peut modifier/creer un auteur non-admin mais il
1088
-	// n'a le droit ni de le promouvoir admin, ni de changer les rubriques
1089
-	if ($qui['restreint']) {
1090
-		if (isset($opt['webmestre']) and $opt['webmestre']) {
1091
-			return false;
1092
-		} elseif (
1093
-			(isset($opt['statut']) and ($opt['statut'] === '0minirezo'))
1094
-			or (isset($opt['restreintes']) and $opt['restreintes'])
1095
-		) {
1096
-			return false;
1097
-		} else {
1098
-			if ($id == $qui['id_auteur']) {
1099
-				if (isset($opt['statut']) and $opt['statut']) {
1100
-					return false;
1101
-				} else {
1102
-					return true;
1103
-				}
1104
-			} else {
1105
-				if ($id_auteur = intval($id)) {
1106
-					$t = sql_fetsel('statut', 'spip_auteurs', "id_auteur=$id_auteur");
1107
-					if ($t and $t['statut'] != '0minirezo') {
1108
-						return true;
1109
-					} else {
1110
-						return false;
1111
-					}
1112
-				} // id = 0 => creation
1113
-				else {
1114
-					return true;
1115
-				}
1116
-			}
1117
-		}
1118
-	}
1119
-
1120
-	// Un admin complet fait ce qu'il veut
1121
-	// sauf se degrader
1122
-	if ($id == $qui['id_auteur'] && (isset($opt['statut']) and $opt['statut'])) {
1123
-		return false;
1124
-	} elseif (
1125
-		isset($opt['webmestre'])
1126
-				and $opt['webmestre']
1127
-				and (defined('_ID_WEBMESTRES')
1128
-				or !autoriser('webmestre'))
1129
-	) {
1130
-		// et toucher au statut webmestre si il ne l'est pas lui meme
1131
-		// ou si les webmestres sont fixes par constante (securite)
1132
-		return false;
1133
-	} // et modifier un webmestre si il ne l'est pas lui meme
1134
-	elseif (intval($id) and !autoriser('webmestre') and autoriser('webmestre', '', 0, $id)) {
1135
-		return false;
1136
-	} else {
1137
-		return true;
1138
-	}
1070
+    $id = intval($id);
1071
+
1072
+    // Si pas admin : seulement le droit de modifier ses donnees perso, mais pas statut ni login
1073
+    // la modif de l'email doit etre verifiee ou notifiee si possible, mais c'est a l'interface de gerer ca
1074
+    if (!in_array($qui['statut'], ['0minirezo'])) {
1075
+        if (
1076
+            $id == $qui['id_auteur']
1077
+            && empty($opt['statut'])
1078
+            && empty($opt['webmestre'])
1079
+            && empty($opt['restreintes'])
1080
+            && empty($opt['login'])
1081
+        ) {
1082
+            return true;
1083
+        }
1084
+        return false;
1085
+    }
1086
+
1087
+    // Un admin restreint peut modifier/creer un auteur non-admin mais il
1088
+    // n'a le droit ni de le promouvoir admin, ni de changer les rubriques
1089
+    if ($qui['restreint']) {
1090
+        if (isset($opt['webmestre']) and $opt['webmestre']) {
1091
+            return false;
1092
+        } elseif (
1093
+            (isset($opt['statut']) and ($opt['statut'] === '0minirezo'))
1094
+            or (isset($opt['restreintes']) and $opt['restreintes'])
1095
+        ) {
1096
+            return false;
1097
+        } else {
1098
+            if ($id == $qui['id_auteur']) {
1099
+                if (isset($opt['statut']) and $opt['statut']) {
1100
+                    return false;
1101
+                } else {
1102
+                    return true;
1103
+                }
1104
+            } else {
1105
+                if ($id_auteur = intval($id)) {
1106
+                    $t = sql_fetsel('statut', 'spip_auteurs', "id_auteur=$id_auteur");
1107
+                    if ($t and $t['statut'] != '0minirezo') {
1108
+                        return true;
1109
+                    } else {
1110
+                        return false;
1111
+                    }
1112
+                } // id = 0 => creation
1113
+                else {
1114
+                    return true;
1115
+                }
1116
+            }
1117
+        }
1118
+    }
1119
+
1120
+    // Un admin complet fait ce qu'il veut
1121
+    // sauf se degrader
1122
+    if ($id == $qui['id_auteur'] && (isset($opt['statut']) and $opt['statut'])) {
1123
+        return false;
1124
+    } elseif (
1125
+        isset($opt['webmestre'])
1126
+                and $opt['webmestre']
1127
+                and (defined('_ID_WEBMESTRES')
1128
+                or !autoriser('webmestre'))
1129
+    ) {
1130
+        // et toucher au statut webmestre si il ne l'est pas lui meme
1131
+        // ou si les webmestres sont fixes par constante (securite)
1132
+        return false;
1133
+    } // et modifier un webmestre si il ne l'est pas lui meme
1134
+    elseif (intval($id) and !autoriser('webmestre') and autoriser('webmestre', '', 0, $id)) {
1135
+        return false;
1136
+    } else {
1137
+        return true;
1138
+    }
1139 1139
 }
1140 1140
 
1141 1141
 
@@ -1154,7 +1154,7 @@  discard block
 block discarded – undo
1154 1154
  * @return bool true s'il a le droit, false sinon
1155 1155
  **/
1156 1156
 function autoriser_associerauteurs_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1157
-	return autoriser('modifier', $type, $id, $qui, $opt);
1157
+    return autoriser('modifier', $type, $id, $qui, $opt);
1158 1158
 }
1159 1159
 
1160 1160
 
@@ -1173,7 +1173,7 @@  discard block
 block discarded – undo
1173 1173
  * @return bool true s'il a le droit, false sinon
1174 1174
  **/
1175 1175
 function autoriser_chargerftp_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1176
-	return $qui['statut'] === '0minirezo';
1176
+    return $qui['statut'] === '0minirezo';
1177 1177
 }
1178 1178
 
1179 1179
 /**
@@ -1191,7 +1191,7 @@  discard block
 block discarded – undo
1191 1191
  * @return bool true s'il a le droit, false sinon
1192 1192
  **/
1193 1193
 function autoriser_debug_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1194
-	return $qui['statut'] === '0minirezo';
1194
+    return $qui['statut'] === '0minirezo';
1195 1195
 }
1196 1196
 
1197 1197
 /**
@@ -1208,54 +1208,54 @@  discard block
 block discarded – undo
1208 1208
  * @return array          Liste des rubriques
1209 1209
  **/
1210 1210
 function liste_rubriques_auteur($id_auteur, $raz = false) {
1211
-	static $restreint = [];
1212
-
1213
-	if (!$id_auteur = intval($id_auteur)) {
1214
-		return [];
1215
-	}
1216
-	if ($raz) {
1217
-		unset($restreint[$id_auteur]);
1218
-	} elseif (isset($restreint[$id_auteur])) {
1219
-		return $restreint[$id_auteur];
1220
-	}
1221
-
1222
-	$rubriques = [];
1223
-	if (
1224
-		(!isset($GLOBALS['meta']['version_installee'])
1225
-		or $GLOBALS['meta']['version_installee'] > 16428)
1226
-		and $r = sql_allfetsel(
1227
-			'id_objet',
1228
-			'spip_auteurs_liens',
1229
-			'id_auteur=' . intval($id_auteur) . " AND objet='rubrique' AND id_objet!=0"
1230
-		)
1231
-		and is_countable($r) ? count($r) : 0
1232
-	) {
1233
-		$r = array_column($r, 'id_objet');
1234
-
1235
-		// recuperer toute la branche, au format chaine enumeration
1236
-		include_spip('inc/rubriques');
1237
-		$r = calcul_branche_in($r);
1238
-		$r = explode(',', $r);
1239
-
1240
-		// passer les rubriques en index, elimine les doublons
1241
-		$r = array_flip($r);
1242
-		// recuperer les index seuls
1243
-		$r = array_keys($r);
1244
-		// combiner pour avoir un tableau id_rubrique=>id_rubrique
1245
-		// est-ce vraiment utile ? (on preserve la forme donnee par le code precedent)
1246
-		$rubriques = array_combine($r, $r);
1247
-	}
1248
-
1249
-	// Affecter l'auteur session le cas echeant
1250
-	if (
1251
-		isset($GLOBALS['visiteur_session']['id_auteur'])
1252
-		and $GLOBALS['visiteur_session']['id_auteur'] == $id_auteur
1253
-	) {
1254
-		$GLOBALS['visiteur_session']['restreint'] = $rubriques;
1255
-	}
1256
-
1257
-
1258
-	return $restreint[$id_auteur] = $rubriques;
1211
+    static $restreint = [];
1212
+
1213
+    if (!$id_auteur = intval($id_auteur)) {
1214
+        return [];
1215
+    }
1216
+    if ($raz) {
1217
+        unset($restreint[$id_auteur]);
1218
+    } elseif (isset($restreint[$id_auteur])) {
1219
+        return $restreint[$id_auteur];
1220
+    }
1221
+
1222
+    $rubriques = [];
1223
+    if (
1224
+        (!isset($GLOBALS['meta']['version_installee'])
1225
+        or $GLOBALS['meta']['version_installee'] > 16428)
1226
+        and $r = sql_allfetsel(
1227
+            'id_objet',
1228
+            'spip_auteurs_liens',
1229
+            'id_auteur=' . intval($id_auteur) . " AND objet='rubrique' AND id_objet!=0"
1230
+        )
1231
+        and is_countable($r) ? count($r) : 0
1232
+    ) {
1233
+        $r = array_column($r, 'id_objet');
1234
+
1235
+        // recuperer toute la branche, au format chaine enumeration
1236
+        include_spip('inc/rubriques');
1237
+        $r = calcul_branche_in($r);
1238
+        $r = explode(',', $r);
1239
+
1240
+        // passer les rubriques en index, elimine les doublons
1241
+        $r = array_flip($r);
1242
+        // recuperer les index seuls
1243
+        $r = array_keys($r);
1244
+        // combiner pour avoir un tableau id_rubrique=>id_rubrique
1245
+        // est-ce vraiment utile ? (on preserve la forme donnee par le code precedent)
1246
+        $rubriques = array_combine($r, $r);
1247
+    }
1248
+
1249
+    // Affecter l'auteur session le cas echeant
1250
+    if (
1251
+        isset($GLOBALS['visiteur_session']['id_auteur'])
1252
+        and $GLOBALS['visiteur_session']['id_auteur'] == $id_auteur
1253
+    ) {
1254
+        $GLOBALS['visiteur_session']['restreint'] = $rubriques;
1255
+    }
1256
+
1257
+
1258
+    return $restreint[$id_auteur] = $rubriques;
1259 1259
 }
1260 1260
 
1261 1261
 /**
@@ -1273,7 +1273,7 @@  discard block
 block discarded – undo
1273 1273
  * @return bool true s'il a le droit, false sinon
1274 1274
  **/
1275 1275
 function autoriser_rubrique_previsualiser_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1276
-	return autoriser('previsualiser');
1276
+    return autoriser('previsualiser');
1277 1277
 }
1278 1278
 
1279 1279
 /**
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
  * @return bool true s'il a le droit, false sinon
1292 1292
  **/
1293 1293
 function autoriser_rubrique_iconifier_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1294
-	return autoriser('publierdans', 'rubrique', $id, $qui, $opt);
1294
+    return autoriser('publierdans', 'rubrique', $id, $qui, $opt);
1295 1295
 }
1296 1296
 
1297 1297
 /**
@@ -1309,9 +1309,9 @@  discard block
 block discarded – undo
1309 1309
  * @return bool true s'il a le droit, false sinon
1310 1310
  **/
1311 1311
 function autoriser_auteur_iconifier_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1312
-	$id = intval($id);
1313
-	return (($id == $qui['id_auteur']) or
1314
-		(($qui['statut'] === '0minirezo') and !$qui['restreint']));
1312
+    $id = intval($id);
1313
+    return (($id == $qui['id_auteur']) or
1314
+        (($qui['statut'] === '0minirezo') and !$qui['restreint']));
1315 1315
 }
1316 1316
 
1317 1317
 /**
@@ -1329,8 +1329,8 @@  discard block
 block discarded – undo
1329 1329
  * @return bool true s'il a le droit, false sinon
1330 1330
  **/
1331 1331
 function autoriser_iconifier_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1332
-	// par defaut, on a le droit d'iconifier si on a le droit de modifier
1333
-	return autoriser('modifier', $type, $id, $qui, $opt);
1332
+    // par defaut, on a le droit d'iconifier si on a le droit de modifier
1333
+    return autoriser('modifier', $type, $id, $qui, $opt);
1334 1334
 }
1335 1335
 
1336 1336
 
@@ -1350,7 +1350,7 @@  discard block
 block discarded – undo
1350 1350
  * @return true
1351 1351
  **/
1352 1352
 function autoriser_ok_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1353
-	return true;
1353
+    return true;
1354 1354
 }
1355 1355
 
1356 1356
 /**
@@ -1369,7 +1369,7 @@  discard block
 block discarded – undo
1369 1369
  * @return false
1370 1370
  **/
1371 1371
 function autoriser_niet_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1372
-	return false;
1372
+    return false;
1373 1373
 }
1374 1374
 
1375 1375
 /**
@@ -1387,11 +1387,11 @@  discard block
 block discarded – undo
1387 1387
  * @return bool true s'il a le droit, false sinon
1388 1388
  **/
1389 1389
 function autoriser_base_reparer_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1390
-	if (!autoriser('detruire') or _request('reinstall')) {
1391
-		return false;
1392
-	}
1390
+    if (!autoriser('detruire') or _request('reinstall')) {
1391
+        return false;
1392
+    }
1393 1393
 
1394
-	return true;
1394
+    return true;
1395 1395
 }
1396 1396
 
1397 1397
 /**
@@ -1409,7 +1409,7 @@  discard block
 block discarded – undo
1409 1409
  * @return true
1410 1410
  **/
1411 1411
 function autoriser_infosperso_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1412
-	return true;
1412
+    return true;
1413 1413
 }
1414 1414
 
1415 1415
 /**
@@ -1427,7 +1427,7 @@  discard block
 block discarded – undo
1427 1427
  * @return true
1428 1428
  **/
1429 1429
 function autoriser_langage_configurer_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1430
-	return true;
1430
+    return true;
1431 1431
 }
1432 1432
 
1433 1433
 /**
@@ -1445,7 +1445,7 @@  discard block
 block discarded – undo
1445 1445
  * @return bool true s'il a le droit, false sinon
1446 1446
  **/
1447 1447
 function autoriser_configurerlangage_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1448
-	return autoriser('configurer', '_langage', $id, $qui, $opt);
1448
+    return autoriser('configurer', '_langage', $id, $qui, $opt);
1449 1449
 }
1450 1450
 
1451 1451
 /**
@@ -1463,7 +1463,7 @@  discard block
 block discarded – undo
1463 1463
  * @return true
1464 1464
  **/
1465 1465
 function autoriser_preferences_configurer_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1466
-	return true;
1466
+    return true;
1467 1467
 }
1468 1468
 
1469 1469
 /**
@@ -1481,7 +1481,7 @@  discard block
 block discarded – undo
1481 1481
  * @return bool true s'il a le droit, false sinon
1482 1482
  **/
1483 1483
 function autoriser_configurerpreferences_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1484
-	return autoriser('configurer', '_preferences', $id, $qui, $opt);
1484
+    return autoriser('configurer', '_preferences', $id, $qui, $opt);
1485 1485
 }
1486 1486
 
1487 1487
 /**
@@ -1499,8 +1499,8 @@  discard block
 block discarded – undo
1499 1499
  * @return bool true s'il a le droit, false sinon
1500 1500
  **/
1501 1501
 function autoriser_menudeveloppement_menugrandeentree_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1502
-	return (isset($GLOBALS['visiteur_session']['prefs']['activer_menudev'])
1503
-		and $GLOBALS['visiteur_session']['prefs']['activer_menudev'] === 'oui');
1502
+    return (isset($GLOBALS['visiteur_session']['prefs']['activer_menudev'])
1503
+        and $GLOBALS['visiteur_session']['prefs']['activer_menudev'] === 'oui');
1504 1504
 }
1505 1505
 
1506 1506
 /**
@@ -1519,7 +1519,7 @@  discard block
 block discarded – undo
1519 1519
  * @return true
1520 1520
  **/
1521 1521
 function autoriser_menugrandeentree_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1522
-	return true;
1522
+    return true;
1523 1523
 }
1524 1524
 
1525 1525
 /**
@@ -1537,7 +1537,7 @@  discard block
 block discarded – undo
1537 1537
  * @return true
1538 1538
  **/
1539 1539
 function autoriser_auteurs_voir_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1540
-	return true;
1540
+    return true;
1541 1541
 }
1542 1542
 
1543 1543
 /**
@@ -1555,7 +1555,7 @@  discard block
 block discarded – undo
1555 1555
  * @return bool true s'il a le droit, false sinon
1556 1556
  **/
1557 1557
 function autoriser_auteurs_menu_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1558
-	return autoriser('voir', '_auteurs', $id, $qui, $opt);
1558
+    return autoriser('voir', '_auteurs', $id, $qui, $opt);
1559 1559
 }
1560 1560
 
1561 1561
 /**
@@ -1573,7 +1573,7 @@  discard block
 block discarded – undo
1573 1573
  * @return true
1574 1574
  **/
1575 1575
 function autoriser_articles_voir_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1576
-	return true;
1576
+    return true;
1577 1577
 }
1578 1578
 
1579 1579
 /**
@@ -1591,7 +1591,7 @@  discard block
 block discarded – undo
1591 1591
  * @return bool true s'il a le droit, false sinon
1592 1592
  **/
1593 1593
 function autoriser_articles_menu_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1594
-	return autoriser('voir', '_articles', $id, $qui, $opt);
1594
+    return autoriser('voir', '_articles', $id, $qui, $opt);
1595 1595
 }
1596 1596
 
1597 1597
 /**
@@ -1609,7 +1609,7 @@  discard block
 block discarded – undo
1609 1609
  * @return true
1610 1610
  **/
1611 1611
 function autoriser_rubriques_voir_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1612
-	return true;
1612
+    return true;
1613 1613
 }
1614 1614
 
1615 1615
 /**
@@ -1627,7 +1627,7 @@  discard block
 block discarded – undo
1627 1627
  * @return bool true s'il a le droit, false sinon
1628 1628
  **/
1629 1629
 function autoriser_rubriques_menu_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1630
-	return autoriser('voir', '_rubriques', $id, $qui, $opt);
1630
+    return autoriser('voir', '_rubriques', $id, $qui, $opt);
1631 1631
 }
1632 1632
 
1633 1633
 /**
@@ -1645,7 +1645,7 @@  discard block
 block discarded – undo
1645 1645
  * @return bool true s'il a le droit, false sinon
1646 1646
  **/
1647 1647
 function autoriser_articlecreer_menu_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1648
-	return verifier_table_non_vide();
1648
+    return verifier_table_non_vide();
1649 1649
 }
1650 1650
 
1651 1651
 
@@ -1666,7 +1666,7 @@  discard block
 block discarded – undo
1666 1666
  * @return bool true s'il a le droit, false sinon
1667 1667
  **/
1668 1668
 function autoriser_auteurcreer_menu_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1669
-	return autoriser('creer', 'auteur', $id, $qui, $opt);
1669
+    return autoriser('creer', 'auteur', $id, $qui, $opt);
1670 1670
 }
1671 1671
 
1672 1672
 /**
@@ -1684,13 +1684,13 @@  discard block
 block discarded – undo
1684 1684
  * @return bool true s'il a le droit, false sinon
1685 1685
  **/
1686 1686
 function autoriser_visiteurs_menu_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1687
-	include_spip('base/abstract_sql');
1688
-	return
1689
-		$qui['statut'] === '0minirezo' and !$qui['restreint']
1690
-		and (
1691
-			$GLOBALS['meta']['accepter_visiteurs'] != 'non'
1692
-			or sql_countsel('spip_auteurs', 'statut in ("6forum", "nouveau")') > 0
1693
-		);
1687
+    include_spip('base/abstract_sql');
1688
+    return
1689
+        $qui['statut'] === '0minirezo' and !$qui['restreint']
1690
+        and (
1691
+            $GLOBALS['meta']['accepter_visiteurs'] != 'non'
1692
+            or sql_countsel('spip_auteurs', 'statut in ("6forum", "nouveau")') > 0
1693
+        );
1694 1694
 }
1695 1695
 
1696 1696
 /**
@@ -1708,7 +1708,7 @@  discard block
 block discarded – undo
1708 1708
  * @return bool true s'il a le droit, false sinon
1709 1709
  **/
1710 1710
 function autoriser_suiviedito_menu_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1711
-	return $qui['statut'] === '0minirezo';
1711
+    return $qui['statut'] === '0minirezo';
1712 1712
 }
1713 1713
 
1714 1714
 /**
@@ -1726,7 +1726,7 @@  discard block
 block discarded – undo
1726 1726
  * @return bool true s'il a le droit, false sinon
1727 1727
  **/
1728 1728
 function autoriser_synchro_menu_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1729
-	return $qui['statut'] === '0minirezo';
1729
+    return $qui['statut'] === '0minirezo';
1730 1730
 }
1731 1731
 
1732 1732
 /**
@@ -1744,7 +1744,7 @@  discard block
 block discarded – undo
1744 1744
  * @return bool true s'il a le droit, false sinon
1745 1745
  **/
1746 1746
 function autoriser_configurerinteractions_menu_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1747
-	return autoriser('configurer', '_interactions', $id, $qui, $opt);
1747
+    return autoriser('configurer', '_interactions', $id, $qui, $opt);
1748 1748
 }
1749 1749
 
1750 1750
 /**
@@ -1762,7 +1762,7 @@  discard block
 block discarded – undo
1762 1762
  * @return bool true s'il a le droit, false sinon
1763 1763
  **/
1764 1764
 function autoriser_configurerlangue_menu_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1765
-	return autoriser('configurer', '_langue', $id, $qui, $opt);
1765
+    return autoriser('configurer', '_langue', $id, $qui, $opt);
1766 1766
 }
1767 1767
 
1768 1768
 /**
@@ -1780,7 +1780,7 @@  discard block
 block discarded – undo
1780 1780
  * @return bool true s'il a le droit, false sinon
1781 1781
  **/
1782 1782
 function autoriser_configurermultilinguisme_menu_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1783
-	return autoriser('configurer', '_multilinguisme', $id, $qui, $opt);
1783
+    return autoriser('configurer', '_multilinguisme', $id, $qui, $opt);
1784 1784
 }
1785 1785
 
1786 1786
 /**
@@ -1798,7 +1798,7 @@  discard block
 block discarded – undo
1798 1798
  * @return bool true s'il a le droit, false sinon
1799 1799
  **/
1800 1800
 function autoriser_configurercontenu_menu_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1801
-	return autoriser('configurer', '_contenu', $id, $qui, $opt);
1801
+    return autoriser('configurer', '_contenu', $id, $qui, $opt);
1802 1802
 }
1803 1803
 
1804 1804
 /**
@@ -1816,7 +1816,7 @@  discard block
 block discarded – undo
1816 1816
  * @return bool true s'il a le droit, false sinon
1817 1817
  **/
1818 1818
 function autoriser_configureravancees_menu_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1819
-	return autoriser('configurer', '_avancees', $id, $qui, $opt);
1819
+    return autoriser('configurer', '_avancees', $id, $qui, $opt);
1820 1820
 }
1821 1821
 
1822 1822
 /**
@@ -1834,7 +1834,7 @@  discard block
 block discarded – undo
1834 1834
  * @return bool true s'il a le droit, false sinon
1835 1835
  **/
1836 1836
 function autoriser_adminplugin_menu_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1837
-	return autoriser('configurer', '_plugins', $id, $qui, $opt);
1837
+    return autoriser('configurer', '_plugins', $id, $qui, $opt);
1838 1838
 }
1839 1839
 
1840 1840
 /**
@@ -1852,7 +1852,7 @@  discard block
 block discarded – undo
1852 1852
  * @return bool true s'il a le droit, false sinon
1853 1853
  **/
1854 1854
 function autoriser_admintech_menu_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1855
-	return autoriser('detruire', $type, $id, $qui, $opt);
1855
+    return autoriser('detruire', $type, $id, $qui, $opt);
1856 1856
 }
1857 1857
 
1858 1858
 /**
@@ -1870,7 +1870,7 @@  discard block
 block discarded – undo
1870 1870
  * @return bool true s'il a le droit, false sinon
1871 1871
  **/
1872 1872
 function autoriser_queue_purger_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1873
-	return autoriser('webmestre');
1873
+    return autoriser('webmestre');
1874 1874
 }
1875 1875
 
1876 1876
 
@@ -1890,11 +1890,11 @@  discard block
 block discarded – undo
1890 1890
  * @return bool true s'il a le droit, false sinon
1891 1891
  **/
1892 1892
 function autoriser_echafauder_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
1893
-	if (test_espace_prive()) {
1894
-		return intval($qui['id_auteur']) ? true : false;
1895
-	} else {
1896
-		return autoriser('webmestre', '', $id, $qui, $opt);
1897
-	}
1893
+    if (test_espace_prive()) {
1894
+        return intval($qui['id_auteur']) ? true : false;
1895
+    } else {
1896
+        return autoriser('webmestre', '', $id, $qui, $opt);
1897
+    }
1898 1898
 }
1899 1899
 
1900 1900
 
@@ -1909,27 +1909,27 @@  discard block
 block discarded – undo
1909 1909
  *     Identifiants d'auteurs
1910 1910
  */
1911 1911
 function auteurs_objet($objet, $id_objet, $cond = '') {
1912
-	$objet = objet_type($objet);
1913
-	$where = [
1914
-		'objet=' . sql_quote($objet),
1915
-		'id_objet=' . intval($id_objet)
1916
-	];
1917
-	if (!empty($cond)) {
1918
-		if (is_array($cond)) {
1919
-			$where = array_merge($where, $cond);
1920
-		} else {
1921
-			$where[] = $cond;
1922
-		}
1923
-	}
1924
-	$auteurs = sql_allfetsel(
1925
-		'id_auteur',
1926
-		'spip_auteurs_liens',
1927
-		$where
1928
-	);
1929
-	if (is_array($auteurs)) {
1930
-		return array_column($auteurs, 'id_auteur');
1931
-	}
1932
-	return [];
1912
+    $objet = objet_type($objet);
1913
+    $where = [
1914
+        'objet=' . sql_quote($objet),
1915
+        'id_objet=' . intval($id_objet)
1916
+    ];
1917
+    if (!empty($cond)) {
1918
+        if (is_array($cond)) {
1919
+            $where = array_merge($where, $cond);
1920
+        } else {
1921
+            $where[] = $cond;
1922
+        }
1923
+    }
1924
+    $auteurs = sql_allfetsel(
1925
+        'id_auteur',
1926
+        'spip_auteurs_liens',
1927
+        $where
1928
+    );
1929
+    if (is_array($auteurs)) {
1930
+        return array_column($auteurs, 'id_auteur');
1931
+    }
1932
+    return [];
1933 1933
 }
1934 1934
 
1935 1935
 /**
@@ -1944,11 +1944,11 @@  discard block
 block discarded – undo
1944 1944
  *     - false : serveur SQL indisponible
1945 1945
  */
1946 1946
 function auteurs_article($id_article, $cond = '') {
1947
-	return sql_allfetsel(
1948
-		'id_auteur',
1949
-		'spip_auteurs_liens',
1950
-		"objet='article' AND id_objet=" . intval($id_article) . ($cond ? " AND $cond" : '')
1951
-	);
1947
+    return sql_allfetsel(
1948
+        'id_auteur',
1949
+        'spip_auteurs_liens',
1950
+        "objet='article' AND id_objet=" . intval($id_article) . ($cond ? " AND $cond" : '')
1951
+    );
1952 1952
 }
1953 1953
 
1954 1954
 
@@ -1962,7 +1962,7 @@  discard block
 block discarded – undo
1962 1962
  */
1963 1963
 function acces_restreint_rubrique($id_rubrique) {
1964 1964
 
1965
-	return (isset($GLOBALS['connect_id_rubrique'][$id_rubrique]));
1965
+    return (isset($GLOBALS['connect_id_rubrique'][$id_rubrique]));
1966 1966
 }
1967 1967
 
1968 1968
 
@@ -1975,12 +1975,12 @@  discard block
 block discarded – undo
1975 1975
  * @return bool             true si un parent existe
1976 1976
  */
1977 1977
 function verifier_table_non_vide($table = 'spip_rubriques') {
1978
-	static $done = [];
1979
-	if (!isset($done[$table])) {
1980
-		$done[$table] = sql_countsel($table) > 0;
1981
-	}
1978
+    static $done = [];
1979
+    if (!isset($done[$table])) {
1980
+        $done[$table] = sql_countsel($table) > 0;
1981
+    }
1982 1982
 
1983
-	return $done[$table];
1983
+    return $done[$table];
1984 1984
 }
1985 1985
 
1986 1986
 /**
@@ -2007,15 +2007,15 @@  discard block
 block discarded – undo
2007 2007
  */
2008 2008
 function autoriser_inscrireauteur_dist($faire, $quoi, $id, $qui, $opt) {
2009 2009
 
2010
-	$s = array_search($quoi, $GLOBALS['liste_des_statuts']);
2011
-	switch ($s) {
2012
-		case 'info_redacteurs':
2013
-			return ($GLOBALS['meta']['accepter_inscriptions'] === 'oui');
2014
-		case 'info_visiteurs':
2015
-			return ($GLOBALS['meta']['accepter_visiteurs'] === 'oui' or $GLOBALS['meta']['forums_publics'] === 'abo');
2016
-	}
2010
+    $s = array_search($quoi, $GLOBALS['liste_des_statuts']);
2011
+    switch ($s) {
2012
+        case 'info_redacteurs':
2013
+            return ($GLOBALS['meta']['accepter_inscriptions'] === 'oui');
2014
+        case 'info_visiteurs':
2015
+            return ($GLOBALS['meta']['accepter_visiteurs'] === 'oui' or $GLOBALS['meta']['forums_publics'] === 'abo');
2016
+    }
2017 2017
 
2018
-	return false;
2018
+    return false;
2019 2019
 }
2020 2020
 
2021 2021
 /**
@@ -2033,7 +2033,7 @@  discard block
 block discarded – undo
2033 2033
  * @return bool true s'il a le droit, false sinon
2034 2034
  **/
2035 2035
 function autoriser_inscription_relancer_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
2036
-	return $qui['statut'] === '0minirezo' and !$qui['restreint'];
2036
+    return $qui['statut'] === '0minirezo' and !$qui['restreint'];
2037 2037
 }
2038 2038
 
2039 2039
 /**
@@ -2051,5 +2051,5 @@  discard block
 block discarded – undo
2051 2051
  * @return bool true s'il a le droit, false sinon
2052 2052
  **/
2053 2053
 function autoriser_phpinfos_dist(string $faire, string $type, $id, array $qui, array $opt): bool {
2054
-	return autoriser('webmestre');
2054
+    return autoriser('webmestre');
2055 2055
 }
Please login to merge, or discard this patch.
ecrire/lang/ecrire_sv.php 1 patch
Indentation   +539 added lines, -539 removed lines patch added patch discarded remove patch
@@ -4,585 +4,585 @@
 block discarded – undo
4 4
 // ** ne pas modifier le fichier **
5 5
 
6 6
 if (!defined('_ECRIRE_INC_VERSION')) {
7
-	return;
7
+    return;
8 8
 }
9 9
 
10 10
 $GLOBALS[$GLOBALS['idx_lang']] = array(
11 11
 
12
-	// A
13
-	'activer_plugin' => 'Aktivera insticksmodulen',
14
-	'affichage' => 'Visa',
15
-	'aide_non_disponible' => 'Den här delen av direkthjälpen finns inte i det aktuella språket',
16
-	'auteur' => 'Redaktör',
17
-	'avis_acces_interdit' => 'Tillträde förbjudet.',
18
-	'avis_article_modifie' => 'Varning, @nom_auteur_modif@ har arbetat på den här artikeln för @date_diff@ minuter sen',
19
-	'avis_aucun_resultat' => 'Hittade inga resultat',
20
-	'avis_chemin_invalide_1' => 'Sökvägen du har angett',
21
-	'avis_chemin_invalide_2' => 'är ogiltig. Återgå till den föregående sidan och kontrollera den angivna informationen',
22
-	'avis_connexion_echec_1' => 'Anslutningen till SQL-servern misslyckades.',
23
-	'avis_connexion_echec_2' => 'Återgå till den föregående sidan och kontrollera informationen du angivit.',
24
-	'avis_connexion_echec_3' => '<b>OBS</b> På många servrar måste du  <b>begära</b> aktivering av din databas innan du kan använda den. Om du inte lyckas med uppkopplingen, se till att den är aktiverad.',
25
-	'avis_connexion_ldap_echec_1' => 'Anslutning till LDAP-server misslyckades.',
26
-	'avis_connexion_ldap_echec_2' => 'Återgå till den föregående sidan och kontrollera informationen du angivit.',
27
-	'avis_connexion_ldap_echec_3' => 'Alternativt kan du välja att inte använda LDAP stöd för att importera användare.',
28
-	'avis_deplacement_rubrique' => 'Varning! Den här avdelningen innehåller @contient_breves@ notiser@scb@: om du flyttar den, markera i kryssrutan för att bekräfta.',
29
-	'avis_erreur_connexion_mysql' => 'Fel på SQL-förbindelsen',
30
-	'avis_espace_interdit' => '<b>Förbjudet område</b><p>SPIP är redan installerat.', # MODIF
31
-	'avis_lecture_noms_bases_1' => 'Installerings-scriptet kunde inte läsa namnen på de installerade databaserna.',
32
-	'avis_lecture_noms_bases_2' => 'Antingen finns det ingen tillgänglig databas eller så är funktionen som listar
12
+    // A
13
+    'activer_plugin' => 'Aktivera insticksmodulen',
14
+    'affichage' => 'Visa',
15
+    'aide_non_disponible' => 'Den här delen av direkthjälpen finns inte i det aktuella språket',
16
+    'auteur' => 'Redaktör',
17
+    'avis_acces_interdit' => 'Tillträde förbjudet.',
18
+    'avis_article_modifie' => 'Varning, @nom_auteur_modif@ har arbetat på den här artikeln för @date_diff@ minuter sen',
19
+    'avis_aucun_resultat' => 'Hittade inga resultat',
20
+    'avis_chemin_invalide_1' => 'Sökvägen du har angett',
21
+    'avis_chemin_invalide_2' => 'är ogiltig. Återgå till den föregående sidan och kontrollera den angivna informationen',
22
+    'avis_connexion_echec_1' => 'Anslutningen till SQL-servern misslyckades.',
23
+    'avis_connexion_echec_2' => 'Återgå till den föregående sidan och kontrollera informationen du angivit.',
24
+    'avis_connexion_echec_3' => '<b>OBS</b> På många servrar måste du  <b>begära</b> aktivering av din databas innan du kan använda den. Om du inte lyckas med uppkopplingen, se till att den är aktiverad.',
25
+    'avis_connexion_ldap_echec_1' => 'Anslutning till LDAP-server misslyckades.',
26
+    'avis_connexion_ldap_echec_2' => 'Återgå till den föregående sidan och kontrollera informationen du angivit.',
27
+    'avis_connexion_ldap_echec_3' => 'Alternativt kan du välja att inte använda LDAP stöd för att importera användare.',
28
+    'avis_deplacement_rubrique' => 'Varning! Den här avdelningen innehåller @contient_breves@ notiser@scb@: om du flyttar den, markera i kryssrutan för att bekräfta.',
29
+    'avis_erreur_connexion_mysql' => 'Fel på SQL-förbindelsen',
30
+    'avis_espace_interdit' => '<b>Förbjudet område</b><p>SPIP är redan installerat.', # MODIF
31
+    'avis_lecture_noms_bases_1' => 'Installerings-scriptet kunde inte läsa namnen på de installerade databaserna.',
32
+    'avis_lecture_noms_bases_2' => 'Antingen finns det ingen tillgänglig databas eller så är funktionen som listar
33 33
  databaser inaktiverad av säkerhetsskäl (det är fallet hos många webbvärdar).',
34
-	'avis_lecture_noms_bases_3' => 'I fråga om det andra alternativet är det möjligt att en databas med ditt användarnamn kan användas:',
35
-	'avis_non_acces_page' => 'Du har inte tillgång till den här sidan.',
36
-	'avis_operation_echec' => 'Operationen misslyckades.',
37
-	'avis_operation_impossible' => 'Operationen omöjlig att genomföra',
38
-	'avis_suppression_base' => 'OBS! Radering av data är permanent och kan inte göras ogjord.',
34
+    'avis_lecture_noms_bases_3' => 'I fråga om det andra alternativet är det möjligt att en databas med ditt användarnamn kan användas:',
35
+    'avis_non_acces_page' => 'Du har inte tillgång till den här sidan.',
36
+    'avis_operation_echec' => 'Operationen misslyckades.',
37
+    'avis_operation_impossible' => 'Operationen omöjlig att genomföra',
38
+    'avis_suppression_base' => 'OBS! Radering av data är permanent och kan inte göras ogjord.',
39 39
 
40
-	// B
41
-	'bouton_acces_ldap' => 'Lägg till en LDAP-katalog >>',
42
-	'bouton_ajouter' => 'Lägg till',
43
-	'bouton_annuler' => 'Avbryt',
44
-	'bouton_demande_publication' => 'Begär att den här artikeln ska publiceras',
45
-	'bouton_desactive_tout' => 'Avaktivera alla',
46
-	'bouton_desinstaller' => 'Avinstallera',
47
-	'bouton_effacer_tout' => 'Radera ALLA',
48
-	'bouton_envoyer_message' => 'Färdigt meddelande: skicka',
49
-	'bouton_modifier' => 'Ändra',
50
-	'bouton_radio_afficher' => 'Visa',
51
-	'bouton_radio_apparaitre_liste_redacteurs_connectes' => 'Synas i listan över anslutna redaktörere',
52
-	'bouton_radio_envoi_annonces_adresse' => 'Skicka meddelanden till adressen:',
53
-	'bouton_radio_envoi_liste_nouveautes' => 'Skicka lista över senaste notiser',
54
-	'bouton_radio_non_apparaitre_liste_redacteurs_connectes' => 'Inte synas i listan över anslutna redaktörere',
55
-	'bouton_radio_non_envoi_annonces_editoriales' => 'Skicka inga redaktionella meddelanden',
56
-	'bouton_redirection' => 'OMPEKA',
57
-	'bouton_relancer_installation' => 'Kör installationen igen',
58
-	'bouton_suivant' => 'Nästa',
59
-	'bouton_tenter_recuperation' => 'Försök till reparation',
60
-	'bouton_test_proxy' => 'Testa proxyn',
61
-	'bouton_vider_cache' => 'Töm cachen',
40
+    // B
41
+    'bouton_acces_ldap' => 'Lägg till en LDAP-katalog >>',
42
+    'bouton_ajouter' => 'Lägg till',
43
+    'bouton_annuler' => 'Avbryt',
44
+    'bouton_demande_publication' => 'Begär att den här artikeln ska publiceras',
45
+    'bouton_desactive_tout' => 'Avaktivera alla',
46
+    'bouton_desinstaller' => 'Avinstallera',
47
+    'bouton_effacer_tout' => 'Radera ALLA',
48
+    'bouton_envoyer_message' => 'Färdigt meddelande: skicka',
49
+    'bouton_modifier' => 'Ändra',
50
+    'bouton_radio_afficher' => 'Visa',
51
+    'bouton_radio_apparaitre_liste_redacteurs_connectes' => 'Synas i listan över anslutna redaktörere',
52
+    'bouton_radio_envoi_annonces_adresse' => 'Skicka meddelanden till adressen:',
53
+    'bouton_radio_envoi_liste_nouveautes' => 'Skicka lista över senaste notiser',
54
+    'bouton_radio_non_apparaitre_liste_redacteurs_connectes' => 'Inte synas i listan över anslutna redaktörere',
55
+    'bouton_radio_non_envoi_annonces_editoriales' => 'Skicka inga redaktionella meddelanden',
56
+    'bouton_redirection' => 'OMPEKA',
57
+    'bouton_relancer_installation' => 'Kör installationen igen',
58
+    'bouton_suivant' => 'Nästa',
59
+    'bouton_tenter_recuperation' => 'Försök till reparation',
60
+    'bouton_test_proxy' => 'Testa proxyn',
61
+    'bouton_vider_cache' => 'Töm cachen',
62 62
 
63
-	// C
64
-	'cache_modifiable_webmestre' => 'Den här parametern kan ändras av den webbansvariga.',
65
-	'calendrier_synchro' => 'Om du använder ett kalenderprogram som är kompatibelt med <b>iCal</b> kan du synkronisera det med informationen på den här webbplatsen.',
66
-	'config_activer_champs' => 'Aktivera följande fält',
67
-	'config_choix_base_sup' => 'Ge namnet på en databas på servern',
68
-	'config_erreur_base_sup' => 'SPIP har inte tillgång till de existerande databaserna',
69
-	'config_info_base_sup_disponibles' => 'Ytterligare databaser dit databasfrågor kan skickas:',
70
-	'config_info_logos' => 'Alla objekt på sajten kan kan ha sin egen logotype och dessutom en "mouseover" logotype',
71
-	'config_info_logos_utiliser' => 'Använd logotyper',
72
-	'config_info_logos_utiliser_non' => 'Använd inte logotyper',
73
-	'config_info_logos_utiliser_survol' => 'Använd "mouseover" logotyper',
74
-	'config_info_logos_utiliser_survol_non' => 'Använd inte "mouseover" logotyper',
75
-	'config_info_redirection' => 'Genom att aktivera det här valet kan du skapa virtuella artiklar, som enbart är länkar till artiklar som publicerats på andra sajter oavsett om det är SPIP-sajter eller ej.',
76
-	'config_redirection' => 'Virtuella artiklar',
77
-	'config_titre_base_sup' => 'Konfigurera ytterligare en databas',
78
-	'config_titre_base_sup_choix' => 'Välj ytterligare en databas',
79
-	'connexion_ldap' => 'ldapuppkoppling:',
63
+    // C
64
+    'cache_modifiable_webmestre' => 'Den här parametern kan ändras av den webbansvariga.',
65
+    'calendrier_synchro' => 'Om du använder ett kalenderprogram som är kompatibelt med <b>iCal</b> kan du synkronisera det med informationen på den här webbplatsen.',
66
+    'config_activer_champs' => 'Aktivera följande fält',
67
+    'config_choix_base_sup' => 'Ge namnet på en databas på servern',
68
+    'config_erreur_base_sup' => 'SPIP har inte tillgång till de existerande databaserna',
69
+    'config_info_base_sup_disponibles' => 'Ytterligare databaser dit databasfrågor kan skickas:',
70
+    'config_info_logos' => 'Alla objekt på sajten kan kan ha sin egen logotype och dessutom en "mouseover" logotype',
71
+    'config_info_logos_utiliser' => 'Använd logotyper',
72
+    'config_info_logos_utiliser_non' => 'Använd inte logotyper',
73
+    'config_info_logos_utiliser_survol' => 'Använd "mouseover" logotyper',
74
+    'config_info_logos_utiliser_survol_non' => 'Använd inte "mouseover" logotyper',
75
+    'config_info_redirection' => 'Genom att aktivera det här valet kan du skapa virtuella artiklar, som enbart är länkar till artiklar som publicerats på andra sajter oavsett om det är SPIP-sajter eller ej.',
76
+    'config_redirection' => 'Virtuella artiklar',
77
+    'config_titre_base_sup' => 'Konfigurera ytterligare en databas',
78
+    'config_titre_base_sup_choix' => 'Välj ytterligare en databas',
79
+    'connexion_ldap' => 'ldapuppkoppling:',
80 80
 
81
-	// D
82
-	'date_mot_heures' => 'h',
81
+    // D
82
+    'date_mot_heures' => 'h',
83 83
 
84
-	// E
85
-	'email' => 'e-post',
86
-	'email_2' => 'e-post:',
87
-	'entree_adresse_annuaire' => 'Katalogens adress',
88
-	'entree_adresse_email' => 'Din e-postadress',
89
-	'entree_base_donnee_1' => 'Adress till databasen',
90
-	'entree_base_donnee_2' => '(Ofta är det samma adress som till din webbplats, ibland är det "localhost" och ibland lämnas det helt tomt.)',
91
-	'entree_biographie' => 'Kort biografi med några få ord.',
92
-	'entree_chemin_acces' => '<b>Fyll i</b> sökvägen:',
93
-	'entree_cle_pgp' => 'Din PGP-nyckel',
94
-	'entree_contenu_rubrique' => '(Några få ord som beskriver innehållet i avdelningen)',
95
-	'entree_identifiants_connexion' => 'Dina anslutningsuppgifter',
96
-	'entree_informations_connexion_ldap' => 'Fyll i det här formuläret med uppgifter om din anslutning till LDAP. Din system eller nätverks administratör kan ge dig dessa.',
97
-	'entree_infos_perso' => 'Vem är du?',
98
-	'entree_interieur_rubrique' => 'I avdelning:',
99
-	'entree_liens_sites' => '<b>Hyperlänk</b> (referens, sajt att besöka...)',
100
-	'entree_login' => 'Dina användaruppgifter',
101
-	'entree_login_connexion_1' => 'Användarupgifter för anslutningen',
102
-	'entree_login_connexion_2' => '(Är ibland samma som lösenordet för FTP-åtkomst och ibland kan det lämnas tomt)',
103
-	'entree_mot_passe' => 'Ditt lösenord',
104
-	'entree_mot_passe_1' => 'Lösenord för anslutningen',
105
-	'entree_mot_passe_2' => '(Är ibland samma som lösenordet för FTP-åtkomst och ibland kan det lämnas tomt)',
106
-	'entree_nom_fichier' => 'Skriv in filnamnet @texte_compresse@',
107
-	'entree_nom_pseudo' => 'Ditt namn eller alias',
108
-	'entree_nom_pseudo_1' => '(Ditt namn eller alias)',
109
-	'entree_nom_site' => 'Din webbplats namn',
110
-	'entree_nouveau_passe' => 'Nytt lösenord',
111
-	'entree_passe_ldap' => 'Lösenord',
112
-	'entree_port_annuaire' => 'Katalogens portnummer',
113
-	'entree_signature' => 'Signatur',
114
-	'entree_titre_obligatoire' => '<b>Title</b> [Krävs]<br />',
115
-	'entree_url' => 'Din webbplats URL',
116
-	'erreur_plugin_fichier_absent' => 'Filen saknas',
117
-	'erreur_plugin_fichier_def_absent' => 'Definitionsfilen saknas',
118
-	'erreur_plugin_nom_fonction_interdit' => 'Förbjudet namn för funktionen',
119
-	'erreur_plugin_nom_manquant' => 'plugin-namnet saknas',
120
-	'erreur_plugin_prefix_manquant' => 'Pluginens prefix odefinierad',
121
-	'erreur_plugin_tag_plugin_absent' => '&lt;plugin&gt; saknas i definitionsfilen',
122
-	'erreur_plugin_version_manquant' => 'Denna plugin saknar version.',
84
+    // E
85
+    'email' => 'e-post',
86
+    'email_2' => 'e-post:',
87
+    'entree_adresse_annuaire' => 'Katalogens adress',
88
+    'entree_adresse_email' => 'Din e-postadress',
89
+    'entree_base_donnee_1' => 'Adress till databasen',
90
+    'entree_base_donnee_2' => '(Ofta är det samma adress som till din webbplats, ibland är det "localhost" och ibland lämnas det helt tomt.)',
91
+    'entree_biographie' => 'Kort biografi med några få ord.',
92
+    'entree_chemin_acces' => '<b>Fyll i</b> sökvägen:',
93
+    'entree_cle_pgp' => 'Din PGP-nyckel',
94
+    'entree_contenu_rubrique' => '(Några få ord som beskriver innehållet i avdelningen)',
95
+    'entree_identifiants_connexion' => 'Dina anslutningsuppgifter',
96
+    'entree_informations_connexion_ldap' => 'Fyll i det här formuläret med uppgifter om din anslutning till LDAP. Din system eller nätverks administratör kan ge dig dessa.',
97
+    'entree_infos_perso' => 'Vem är du?',
98
+    'entree_interieur_rubrique' => 'I avdelning:',
99
+    'entree_liens_sites' => '<b>Hyperlänk</b> (referens, sajt att besöka...)',
100
+    'entree_login' => 'Dina användaruppgifter',
101
+    'entree_login_connexion_1' => 'Användarupgifter för anslutningen',
102
+    'entree_login_connexion_2' => '(Är ibland samma som lösenordet för FTP-åtkomst och ibland kan det lämnas tomt)',
103
+    'entree_mot_passe' => 'Ditt lösenord',
104
+    'entree_mot_passe_1' => 'Lösenord för anslutningen',
105
+    'entree_mot_passe_2' => '(Är ibland samma som lösenordet för FTP-åtkomst och ibland kan det lämnas tomt)',
106
+    'entree_nom_fichier' => 'Skriv in filnamnet @texte_compresse@',
107
+    'entree_nom_pseudo' => 'Ditt namn eller alias',
108
+    'entree_nom_pseudo_1' => '(Ditt namn eller alias)',
109
+    'entree_nom_site' => 'Din webbplats namn',
110
+    'entree_nouveau_passe' => 'Nytt lösenord',
111
+    'entree_passe_ldap' => 'Lösenord',
112
+    'entree_port_annuaire' => 'Katalogens portnummer',
113
+    'entree_signature' => 'Signatur',
114
+    'entree_titre_obligatoire' => '<b>Title</b> [Krävs]<br />',
115
+    'entree_url' => 'Din webbplats URL',
116
+    'erreur_plugin_fichier_absent' => 'Filen saknas',
117
+    'erreur_plugin_fichier_def_absent' => 'Definitionsfilen saknas',
118
+    'erreur_plugin_nom_fonction_interdit' => 'Förbjudet namn för funktionen',
119
+    'erreur_plugin_nom_manquant' => 'plugin-namnet saknas',
120
+    'erreur_plugin_prefix_manquant' => 'Pluginens prefix odefinierad',
121
+    'erreur_plugin_tag_plugin_absent' => '&lt;plugin&gt; saknas i definitionsfilen',
122
+    'erreur_plugin_version_manquant' => 'Denna plugin saknar version.',
123 123
 
124
-	// I
125
-	'ical_info1' => 'Denna sida visar flera metoder att hålla dig informerad om aktiviteter på sajten.',
126
-	'ical_info2' => 'För mer information, tveka inte om att besöka <a href="@spipnet@">SPIP’s dokumentation</a>.', # MODIF
127
-	'ical_info_calendrier' => 'Du kan använda två kalendrar. En är en sajtkarta med alla publicerade artiklar. Den andra innehåller redaktionella meddelanden och dina senaste privata meddelanden: Den är personlig, tack vare en genererad nyckel som du kan förändra när som helst genom att byta lösenord.',
128
-	'ical_methode_http' => 'Nerladdning',
129
-	'ical_methode_webcal' => 'Synkronisering (webcal://)', # MODIF
130
-	'ical_texte_prive' => 'Den här kalendern som är personlig, innnehåller dina egna redaktionella händelser på den här sajten (uppgifter, egna möten, inlämnade artiklar och nyheter...).',
131
-	'ical_texte_public' => 'Den här kalendern låter dig följa den publika aktiviteten på sajten (publicerade artiklar och nyheter).',
132
-	'ical_texte_rss' => 'Du kan syndikerar de senaste nyheterna på den är sajten i vilken XML/RSS-läsare som helst. Det är samma format som gör det möjligt att läsa de senaste nyheterna på andra sajter som använder ett kompatibelt format. (syndikerade sajter).',
133
-	'ical_titre_js' => 'Javascript',
134
-	'ical_titre_mailing' => 'E-postlista',
135
-	'ical_titre_rss' => 'Syndikeringsfiler',
136
-	'icone_activer_cookie' => 'Sätt en cookie',
137
-	'icone_admin_plugin' => 'Hantera plugin’s',
138
-	'icone_afficher_auteurs' => 'Visa redaktörer',
139
-	'icone_afficher_visiteurs' => 'Visa besökare',
140
-	'icone_arret_discussion' => 'Avsluta diskussionen',
141
-	'icone_calendrier' => 'Kalender',
142
-	'icone_creer_auteur' => 'Skapa en ny redaktör och koppla honom (henne) till den här artikeln',
143
-	'icone_creer_mot_cle' => 'Skapa ett nytt nyckelord och länka det till artikeln',
144
-	'icone_creer_rubrique_2' => 'Skapa en ny avdelning',
145
-	'icone_modifier_article' => 'Editera artikeln',
146
-	'icone_modifier_rubrique' => 'Editera avdelningen',
147
-	'icone_relancer_signataire' => 'Kontakta personen igen',
148
-	'icone_retour' => 'Tillbaka',
149
-	'icone_retour_article' => 'Tillbaka till artikeln',
150
-	'icone_supprimer_cookie' => 'Radera cookien',
151
-	'icone_supprimer_rubrique' => 'Radera den här avdelningen',
152
-	'icone_supprimer_signature' => 'Radera den här signaturen',
153
-	'icone_valider_signature' => 'Validera signaturen',
154
-	'image_administrer_rubrique' => 'Du kan hantera den här avdelningen',
155
-	'impossible_modifier_login_auteur' => 'Impossible de modifier le login.', # MODIF
156
-	'impossible_modifier_pass_auteur' => 'Impossible de modifier le mot de passe.', # MODIF
157
-	'info_1_article' => '1 artikel',
158
-	'info_activer_cookie' => 'Du kan aktivera en <b>administrationscookie</b>, som tillåter dig
124
+    // I
125
+    'ical_info1' => 'Denna sida visar flera metoder att hålla dig informerad om aktiviteter på sajten.',
126
+    'ical_info2' => 'För mer information, tveka inte om att besöka <a href="@spipnet@">SPIP’s dokumentation</a>.', # MODIF
127
+    'ical_info_calendrier' => 'Du kan använda två kalendrar. En är en sajtkarta med alla publicerade artiklar. Den andra innehåller redaktionella meddelanden och dina senaste privata meddelanden: Den är personlig, tack vare en genererad nyckel som du kan förändra när som helst genom att byta lösenord.',
128
+    'ical_methode_http' => 'Nerladdning',
129
+    'ical_methode_webcal' => 'Synkronisering (webcal://)', # MODIF
130
+    'ical_texte_prive' => 'Den här kalendern som är personlig, innnehåller dina egna redaktionella händelser på den här sajten (uppgifter, egna möten, inlämnade artiklar och nyheter...).',
131
+    'ical_texte_public' => 'Den här kalendern låter dig följa den publika aktiviteten på sajten (publicerade artiklar och nyheter).',
132
+    'ical_texte_rss' => 'Du kan syndikerar de senaste nyheterna på den är sajten i vilken XML/RSS-läsare som helst. Det är samma format som gör det möjligt att läsa de senaste nyheterna på andra sajter som använder ett kompatibelt format. (syndikerade sajter).',
133
+    'ical_titre_js' => 'Javascript',
134
+    'ical_titre_mailing' => 'E-postlista',
135
+    'ical_titre_rss' => 'Syndikeringsfiler',
136
+    'icone_activer_cookie' => 'Sätt en cookie',
137
+    'icone_admin_plugin' => 'Hantera plugin’s',
138
+    'icone_afficher_auteurs' => 'Visa redaktörer',
139
+    'icone_afficher_visiteurs' => 'Visa besökare',
140
+    'icone_arret_discussion' => 'Avsluta diskussionen',
141
+    'icone_calendrier' => 'Kalender',
142
+    'icone_creer_auteur' => 'Skapa en ny redaktör och koppla honom (henne) till den här artikeln',
143
+    'icone_creer_mot_cle' => 'Skapa ett nytt nyckelord och länka det till artikeln',
144
+    'icone_creer_rubrique_2' => 'Skapa en ny avdelning',
145
+    'icone_modifier_article' => 'Editera artikeln',
146
+    'icone_modifier_rubrique' => 'Editera avdelningen',
147
+    'icone_relancer_signataire' => 'Kontakta personen igen',
148
+    'icone_retour' => 'Tillbaka',
149
+    'icone_retour_article' => 'Tillbaka till artikeln',
150
+    'icone_supprimer_cookie' => 'Radera cookien',
151
+    'icone_supprimer_rubrique' => 'Radera den här avdelningen',
152
+    'icone_supprimer_signature' => 'Radera den här signaturen',
153
+    'icone_valider_signature' => 'Validera signaturen',
154
+    'image_administrer_rubrique' => 'Du kan hantera den här avdelningen',
155
+    'impossible_modifier_login_auteur' => 'Impossible de modifier le login.', # MODIF
156
+    'impossible_modifier_pass_auteur' => 'Impossible de modifier le mot de passe.', # MODIF
157
+    'info_1_article' => '1 artikel',
158
+    'info_activer_cookie' => 'Du kan aktivera en <b>administrationscookie</b>, som tillåter dig
159 159
  att enkelt växla mellan den publika och den privata delen.',
160
-	'info_administrateur' => 'Administratör',
161
-	'info_administrateur_1' => 'Administratör',
162
-	'info_administrateur_2' => 'på sajten (<i>använd med försiktighet</i>)',
163
-	'info_administrateur_site_01' => 'Om du är en sajt-administratör, var vänlig',
164
-	'info_administrateur_site_02' => 'klicka på den här länken',
165
-	'info_administrateurs' => 'Administratörer',
166
-	'info_administrer_rubrique' => 'Du kan hantera den här avdelningen',
167
-	'info_adresse' => 'till adressen:',
168
-	'info_adresse_url' => 'Din sajts publika URL',
169
-	'info_aide_en_ligne' => 'SPIP Online Hjälp',
170
-	'info_ajout_image' => 'När du lägget till filer som bifogade dokument till en artikel,
160
+    'info_administrateur' => 'Administratör',
161
+    'info_administrateur_1' => 'Administratör',
162
+    'info_administrateur_2' => 'på sajten (<i>använd med försiktighet</i>)',
163
+    'info_administrateur_site_01' => 'Om du är en sajt-administratör, var vänlig',
164
+    'info_administrateur_site_02' => 'klicka på den här länken',
165
+    'info_administrateurs' => 'Administratörer',
166
+    'info_administrer_rubrique' => 'Du kan hantera den här avdelningen',
167
+    'info_adresse' => 'till adressen:',
168
+    'info_adresse_url' => 'Din sajts publika URL',
169
+    'info_aide_en_ligne' => 'SPIP Online Hjälp',
170
+    'info_ajout_image' => 'När du lägget till filer som bifogade dokument till en artikel,
171 171
   kan SPIP automatiskt skapa miniatyrer av de
172 172
   inlagda bilderna. Det tillåter till exempel
173 173
   att man automatiskt skapar ett galleri eller en portfolio.',
174
-	'info_ajouter_rubrique' => 'lägg till en annan avdelning:',
175
-	'info_annonce_nouveautes' => 'Senaste nyheterna',
176
-	'info_article' => 'artikel',
177
-	'info_article_2' => 'artiklar',
178
-	'info_article_a_paraitre' => 'Fördaterade artiklar som kommer att publiceras',
179
-	'info_articles_02' => 'artiklar',
180
-	'info_articles_2' => 'Artiklar',
181
-	'info_articles_auteur' => 'Den här redaktörens artiklar',
182
-	'info_articles_trouves' => 'Artiklar hittade',
183
-	'info_attente_validation' => 'Dina artiklar som väntar på validering',
184
-	'info_aujourdhui' => 'idag:',
185
-	'info_auteurs' => 'Redaktörer',
186
-	'info_auteurs_par_tri' => 'Redaktörer@partri@',
187
-	'info_auteurs_trouves' => 'Redaktörer funna',
188
-	'info_authentification_externe' => 'Extern autentifiering',
189
-	'info_avertissement' => 'Varning',
190
-	'info_barre_outils' => 'med dess verktygsfält?',
191
-	'info_base_installee' => 'Databasen är skapad',
192
-	'info_chapeau' => 'Ingress',
193
-	'info_chapeau_2' => 'Introduktion:',
194
-	'info_chemin_acces_1' => 'inställningar: <b>sökväg i katalogen</b>',
195
-	'info_chemin_acces_2' => 'Från och med nu måste du konfigurera sökvägen till katalogen information. Det är nödvändigt för att kunna läsa användarprofilerna som är sparade i katalogen.',
196
-	'info_chemin_acces_annuaire' => 'Inställningar: <b>Sökväg i katalogen</b>',
197
-	'info_choix_base' => 'Tredje steget:',
198
-	'info_code_acces' => 'Glöm inte ditt eget lösenord!',
199
-	'info_config_suivi' => 'Om den här adressen är en mailing lista, kan du under adressen visa var man kan registrera sig. Det kan vara en URL (till exempel en webbsida där man kan registrera sig), eller en e-postadress med en speciell ärenderad (till exempel: <tt>@adresse_suivi@?subject=subscribe</tt>):',
200
-	'info_config_suivi_explication' => 'Du kan anmäla dig till sajtens nyhetsbrev. Du kommer då att automatiskt få meddelanden om artiklar och nyheter som laddats upp för publicering.',
201
-	'info_confirmer_passe' => 'Bekräfta ditt nya lösenord:',
202
-	'info_connexion_base' => 'Försöker att ansluta till databasen',
203
-	'info_connexion_ldap_ok' => 'Din förbindelse till LDAP-servern lyckades.</b><p> Du kan gå vidare till nästa steg.</p>', # MODIF
204
-	'info_connexion_mysql' => 'Din databasförbindelse',
205
-	'info_connexion_ok' => 'Förbindelsen lyckades.',
206
-	'info_contact' => 'Kontakt',
207
-	'info_contenu_articles' => 'Innehåll i artiklarna',
208
-	'info_creation_paragraphe' => '(För att skapa stycken, räcker det att lämna tomma rader.)', # MODIF
209
-	'info_creation_rubrique' => 'Innan du kan skriva artiklar,<br /> måste du skapa åtminstone en avdelning.<br />',
210
-	'info_creation_tables' => 'Skapar databastabeller',
211
-	'info_creer_base' => '<b>Skapa</b> en ny databas:',
212
-	'info_dans_rubrique' => 'I avdelningen:',
213
-	'info_date_publication_anterieure' => 'Datum för tidigare publicering:',
214
-	'info_date_referencement' => 'DATUM DÅ SAJTEN LÄNKADES:',
215
-	'info_derniere_etape' => 'Klart!',
216
-	'info_descriptif' => 'Beskrivning:',
217
-	'info_desinstaller_plugin' => 'raderar data och avaktiverar tillägget',
218
-	'info_discussion_cours' => 'Pågående diskussion',
219
-	'info_ecrire_article' => 'Innan du kan skriva artiklar, ymåste du skapa minst en avdelning.',
220
-	'info_email_envoi' => 'Avsändaren mailadress (frivilligt)',
221
-	'info_email_envoi_txt' => 'Skriv in avsändarens e-postadress som används när man sänder mejlen (som default används mottagarens adress som avsändaradress) :',
222
-	'info_email_webmestre' => 'Webmasterns mejladress (frivillig)', # MODIF
223
-	'info_envoi_email_automatique' => 'Automatisk e-post',
224
-	'info_envoyer_maintenant' => 'Skicka nu',
225
-	'info_etape_suivante' => 'Gå till nästa steg',
226
-	'info_etape_suivante_1' => 'Du kan fortsätta till nästa steg.',
227
-	'info_etape_suivante_2' => 'Du kan fortsätta till nästa steg.',
228
-	'info_exportation_base' => 'Exportera databasen till @archive@',
229
-	'info_facilite_suivi_activite' => 'För att underlätta att följa de redaktionella;
174
+    'info_ajouter_rubrique' => 'lägg till en annan avdelning:',
175
+    'info_annonce_nouveautes' => 'Senaste nyheterna',
176
+    'info_article' => 'artikel',
177
+    'info_article_2' => 'artiklar',
178
+    'info_article_a_paraitre' => 'Fördaterade artiklar som kommer att publiceras',
179
+    'info_articles_02' => 'artiklar',
180
+    'info_articles_2' => 'Artiklar',
181
+    'info_articles_auteur' => 'Den här redaktörens artiklar',
182
+    'info_articles_trouves' => 'Artiklar hittade',
183
+    'info_attente_validation' => 'Dina artiklar som väntar på validering',
184
+    'info_aujourdhui' => 'idag:',
185
+    'info_auteurs' => 'Redaktörer',
186
+    'info_auteurs_par_tri' => 'Redaktörer@partri@',
187
+    'info_auteurs_trouves' => 'Redaktörer funna',
188
+    'info_authentification_externe' => 'Extern autentifiering',
189
+    'info_avertissement' => 'Varning',
190
+    'info_barre_outils' => 'med dess verktygsfält?',
191
+    'info_base_installee' => 'Databasen är skapad',
192
+    'info_chapeau' => 'Ingress',
193
+    'info_chapeau_2' => 'Introduktion:',
194
+    'info_chemin_acces_1' => 'inställningar: <b>sökväg i katalogen</b>',
195
+    'info_chemin_acces_2' => 'Från och med nu måste du konfigurera sökvägen till katalogen information. Det är nödvändigt för att kunna läsa användarprofilerna som är sparade i katalogen.',
196
+    'info_chemin_acces_annuaire' => 'Inställningar: <b>Sökväg i katalogen</b>',
197
+    'info_choix_base' => 'Tredje steget:',
198
+    'info_code_acces' => 'Glöm inte ditt eget lösenord!',
199
+    'info_config_suivi' => 'Om den här adressen är en mailing lista, kan du under adressen visa var man kan registrera sig. Det kan vara en URL (till exempel en webbsida där man kan registrera sig), eller en e-postadress med en speciell ärenderad (till exempel: <tt>@adresse_suivi@?subject=subscribe</tt>):',
200
+    'info_config_suivi_explication' => 'Du kan anmäla dig till sajtens nyhetsbrev. Du kommer då att automatiskt få meddelanden om artiklar och nyheter som laddats upp för publicering.',
201
+    'info_confirmer_passe' => 'Bekräfta ditt nya lösenord:',
202
+    'info_connexion_base' => 'Försöker att ansluta till databasen',
203
+    'info_connexion_ldap_ok' => 'Din förbindelse till LDAP-servern lyckades.</b><p> Du kan gå vidare till nästa steg.</p>', # MODIF
204
+    'info_connexion_mysql' => 'Din databasförbindelse',
205
+    'info_connexion_ok' => 'Förbindelsen lyckades.',
206
+    'info_contact' => 'Kontakt',
207
+    'info_contenu_articles' => 'Innehåll i artiklarna',
208
+    'info_creation_paragraphe' => '(För att skapa stycken, räcker det att lämna tomma rader.)', # MODIF
209
+    'info_creation_rubrique' => 'Innan du kan skriva artiklar,<br /> måste du skapa åtminstone en avdelning.<br />',
210
+    'info_creation_tables' => 'Skapar databastabeller',
211
+    'info_creer_base' => '<b>Skapa</b> en ny databas:',
212
+    'info_dans_rubrique' => 'I avdelningen:',
213
+    'info_date_publication_anterieure' => 'Datum för tidigare publicering:',
214
+    'info_date_referencement' => 'DATUM DÅ SAJTEN LÄNKADES:',
215
+    'info_derniere_etape' => 'Klart!',
216
+    'info_descriptif' => 'Beskrivning:',
217
+    'info_desinstaller_plugin' => 'raderar data och avaktiverar tillägget',
218
+    'info_discussion_cours' => 'Pågående diskussion',
219
+    'info_ecrire_article' => 'Innan du kan skriva artiklar, ymåste du skapa minst en avdelning.',
220
+    'info_email_envoi' => 'Avsändaren mailadress (frivilligt)',
221
+    'info_email_envoi_txt' => 'Skriv in avsändarens e-postadress som används när man sänder mejlen (som default används mottagarens adress som avsändaradress) :',
222
+    'info_email_webmestre' => 'Webmasterns mejladress (frivillig)', # MODIF
223
+    'info_envoi_email_automatique' => 'Automatisk e-post',
224
+    'info_envoyer_maintenant' => 'Skicka nu',
225
+    'info_etape_suivante' => 'Gå till nästa steg',
226
+    'info_etape_suivante_1' => 'Du kan fortsätta till nästa steg.',
227
+    'info_etape_suivante_2' => 'Du kan fortsätta till nästa steg.',
228
+    'info_exportation_base' => 'Exportera databasen till @archive@',
229
+    'info_facilite_suivi_activite' => 'För att underlätta att följa de redaktionella;
230 230
   aktiviteterna, kan SPIP skicka medddelanden via e-post, exempelvis till en maillista för redaktörer,
231 231
   angående publiceringar och godkännanden.', # MODIF
232
-	'info_fichiers_authent' => 'Lösenordsfil ".htpasswd"',
233
-	'info_gauche_auteurs' => 'Här hittar du alla redaktörer på sajten.
232
+    'info_fichiers_authent' => 'Lösenordsfil ".htpasswd"',
233
+    'info_gauche_auteurs' => 'Här hittar du alla redaktörer på sajten.
234 234
  Status på var och en av dem visas av färgen på ikonen (administratör = grön; redaktör = gul).',
235
-	'info_gauche_auteurs_exterieurs' => 'Externa redaktörer utan behörighet på sajten, visas med en blå ikon; raderade redaktörer med en soptunna.', # MODIF
236
-	'info_generation_miniatures_images' => 'Skapande av tumnagelbilder.',
237
-	'info_hebergeur_desactiver_envoi_email' => 'Vissa webhotell avaktiverar automatisk mejl
235
+    'info_gauche_auteurs_exterieurs' => 'Externa redaktörer utan behörighet på sajten, visas med en blå ikon; raderade redaktörer med en soptunna.', # MODIF
236
+    'info_generation_miniatures_images' => 'Skapande av tumnagelbilder.',
237
+    'info_hebergeur_desactiver_envoi_email' => 'Vissa webhotell avaktiverar automatisk mejl
238 238
 på deras servrar. Om så är fallet kan följande
239 239
 funktioner hos SPIP inte användas.',
240
-	'info_hier' => 'I går:',
241
-	'info_identification_publique' => 'Din publika identitet...',
242
-	'info_image_process' => 'Välj den bästa metoden för att skapa miniatyrer genom att klicka på motsvarande bild.',
243
-	'info_image_process2' => '<b>OBS!.</b> <i>Om du inte kan se någon bild, så är din server inte konfigurerad för att använda sådana verktyg. Om du vill använda dessa finesser så kontakta din leverantörs tekniska support och be dem installera utökningarna för «GD» eller «Imagick».</i>', # MODIF
244
-	'info_informations_personnelles' => 'Personlig information',
245
-	'info_inscription_automatique' => 'Automatisk registreing av nya redaktörer',
246
-	'info_jeu_caractere' => 'Sajtens teckenuppsättning',
247
-	'info_jours' => 'dagar',
248
-	'info_laisser_champs_vides' => 'Lämna dessa fält tomma)',
249
-	'info_langues' => 'Sajtens språk',
250
-	'info_lien_hypertexte' => 'Hyperlänk:',
251
-	'info_liste_redacteurs_connectes' => 'Inlogggade redaktörer',
252
-	'info_login_existant' => 'Användarnamnet finns redan.',
253
-	'info_login_trop_court' => 'Användarnamnet är för kort.',
254
-	'info_logos' => 'Logotyperna',
255
-	'info_maximum' => 'maximum:',
256
-	'info_meme_rubrique' => 'I samma avdelning',
257
-	'info_message_en_redaction' => 'utkorg',
258
-	'info_message_technique' => 'Tekniskt meddelande:',
259
-	'info_messagerie_interne' => 'Internmeddelande',
260
-	'info_mise_a_niveau_base' => 'SQL database upgradering',
261
-	'info_mise_a_niveau_base_2' => '{{Warning!}} Du har installerat {äldre} 
240
+    'info_hier' => 'I går:',
241
+    'info_identification_publique' => 'Din publika identitet...',
242
+    'info_image_process' => 'Välj den bästa metoden för att skapa miniatyrer genom att klicka på motsvarande bild.',
243
+    'info_image_process2' => '<b>OBS!.</b> <i>Om du inte kan se någon bild, så är din server inte konfigurerad för att använda sådana verktyg. Om du vill använda dessa finesser så kontakta din leverantörs tekniska support och be dem installera utökningarna för «GD» eller «Imagick».</i>', # MODIF
244
+    'info_informations_personnelles' => 'Personlig information',
245
+    'info_inscription_automatique' => 'Automatisk registreing av nya redaktörer',
246
+    'info_jeu_caractere' => 'Sajtens teckenuppsättning',
247
+    'info_jours' => 'dagar',
248
+    'info_laisser_champs_vides' => 'Lämna dessa fält tomma)',
249
+    'info_langues' => 'Sajtens språk',
250
+    'info_lien_hypertexte' => 'Hyperlänk:',
251
+    'info_liste_redacteurs_connectes' => 'Inlogggade redaktörer',
252
+    'info_login_existant' => 'Användarnamnet finns redan.',
253
+    'info_login_trop_court' => 'Användarnamnet är för kort.',
254
+    'info_logos' => 'Logotyperna',
255
+    'info_maximum' => 'maximum:',
256
+    'info_meme_rubrique' => 'I samma avdelning',
257
+    'info_message_en_redaction' => 'utkorg',
258
+    'info_message_technique' => 'Tekniskt meddelande:',
259
+    'info_messagerie_interne' => 'Internmeddelande',
260
+    'info_mise_a_niveau_base' => 'SQL database upgradering',
261
+    'info_mise_a_niveau_base_2' => '{{Warning!}} Du har installerat {äldre} 
262 262
   SPIP filer än de som redan
263 263
   varit installerade på sajten: Du riskerar att förlora databasen
264 264
   och ha en sajt som inte längre fungerar.<br />{{återinstallera
265 265
   SPIP filerna.}}',
266
-	'info_modifier_auteur' => 'Editera detaljer för redaktören:',
267
-	'info_modifier_rubrique' => 'Editera avdelningen:',
268
-	'info_modifier_titre' => 'Editera: @titre@',
269
-	'info_mon_site_spip' => 'Min SPIP-sajt',
270
-	'info_moyenne' => 'genomsnitt:',
271
-	'info_multi_cet_article' => 'Den här artikelns språk:',
272
-	'info_multi_langues_choisies' => 'Var vänlig, välj tillgängliga språk för redaktörerna bland språken nedan.
266
+    'info_modifier_auteur' => 'Editera detaljer för redaktören:',
267
+    'info_modifier_rubrique' => 'Editera avdelningen:',
268
+    'info_modifier_titre' => 'Editera: @titre@',
269
+    'info_mon_site_spip' => 'Min SPIP-sajt',
270
+    'info_moyenne' => 'genomsnitt:',
271
+    'info_multi_cet_article' => 'Den här artikelns språk:',
272
+    'info_multi_langues_choisies' => 'Var vänlig, välj tillgängliga språk för redaktörerna bland språken nedan.
273 273
   Språk som redan används på din sajt (högst upp på listan) kan inte avaktiveras.',
274
-	'info_multi_secteurs' => '... bara för avdelningarna i roten?',
275
-	'info_nom' => 'Namn',
276
-	'info_nom_destinataire' => 'Mottagarens namn',
277
-	'info_nom_site' => 'Din sajts namn',
278
-	'info_nombre_articles' => '@nb_articles@ artiklar,',
279
-	'info_nombre_rubriques' => '@nb_rubriques@ avdelningar,',
280
-	'info_nombre_sites' => '@nb_sites@ sajter,',
281
-	'info_non_deplacer' => 'Flytta inte...',
282
-	'info_non_envoi_liste_nouveautes' => 'Skicka inte listan med senaste nyheterna',
283
-	'info_non_modifiable' => 'kan inte förändras',
284
-	'info_non_suppression_mot_cle' => 'Jag vill inte radera nyckelordet.',
285
-	'info_notes' => 'Fotnoter',
286
-	'info_nouvel_article' => 'Ny artikel',
287
-	'info_nouvelle_traduction' => 'Ny översättning:',
288
-	'info_numero_article' => 'ARTIKEL NUMMER:',
289
-	'info_obligatoire_02' => '[Krävs]', # MODIF
290
-	'info_option_accepter_visiteurs' => 'Tillåt besökare registrera sig på den publika delen',
291
-	'info_option_ne_pas_accepter_visiteurs' => 'Avvisa besökarregistrering',
292
-	'info_options_avancees' => 'AVANCERADE INSTÄLLNINGAR',
293
-	'info_ou' => 'eller...',
294
-	'info_page_interdite' => 'Förbjuden sida',
295
-	'info_par_nom' => 'efter namn',
296
-	'info_par_nombre_article' => 'efter antal artiklar',
297
-	'info_par_statut' => 'efter status',
298
-	'info_par_tri' => '’(efter @tri@)’',
299
-	'info_passe_trop_court' => 'lösenordet är för kort.',
300
-	'info_passes_identiques' => 'De två lösenorden är inte identiska.',
301
-	'info_plus_cinq_car' => 'mer än 5 tecken',
302
-	'info_plus_cinq_car_2' => '(Mer än 5 tecken)',
303
-	'info_plus_trois_car' => '(Mer än 3 tecken)',
304
-	'info_popularite' => 'popularitet: @popularite@; besök: @visites@',
305
-	'info_post_scriptum' => 'Postscript',
306
-	'info_post_scriptum_2' => 'PS:',
307
-	'info_pour' => 'för',
308
-	'info_procedez_par_etape' => 'Var vänlig, fortsätt steg för steg',
309
-	'info_procedure_maj_version' => 'Uppdateringsproceduren skall köras för att
274
+    'info_multi_secteurs' => '... bara för avdelningarna i roten?',
275
+    'info_nom' => 'Namn',
276
+    'info_nom_destinataire' => 'Mottagarens namn',
277
+    'info_nom_site' => 'Din sajts namn',
278
+    'info_nombre_articles' => '@nb_articles@ artiklar,',
279
+    'info_nombre_rubriques' => '@nb_rubriques@ avdelningar,',
280
+    'info_nombre_sites' => '@nb_sites@ sajter,',
281
+    'info_non_deplacer' => 'Flytta inte...',
282
+    'info_non_envoi_liste_nouveautes' => 'Skicka inte listan med senaste nyheterna',
283
+    'info_non_modifiable' => 'kan inte förändras',
284
+    'info_non_suppression_mot_cle' => 'Jag vill inte radera nyckelordet.',
285
+    'info_notes' => 'Fotnoter',
286
+    'info_nouvel_article' => 'Ny artikel',
287
+    'info_nouvelle_traduction' => 'Ny översättning:',
288
+    'info_numero_article' => 'ARTIKEL NUMMER:',
289
+    'info_obligatoire_02' => '[Krävs]', # MODIF
290
+    'info_option_accepter_visiteurs' => 'Tillåt besökare registrera sig på den publika delen',
291
+    'info_option_ne_pas_accepter_visiteurs' => 'Avvisa besökarregistrering',
292
+    'info_options_avancees' => 'AVANCERADE INSTÄLLNINGAR',
293
+    'info_ou' => 'eller...',
294
+    'info_page_interdite' => 'Förbjuden sida',
295
+    'info_par_nom' => 'efter namn',
296
+    'info_par_nombre_article' => 'efter antal artiklar',
297
+    'info_par_statut' => 'efter status',
298
+    'info_par_tri' => '’(efter @tri@)’',
299
+    'info_passe_trop_court' => 'lösenordet är för kort.',
300
+    'info_passes_identiques' => 'De två lösenorden är inte identiska.',
301
+    'info_plus_cinq_car' => 'mer än 5 tecken',
302
+    'info_plus_cinq_car_2' => '(Mer än 5 tecken)',
303
+    'info_plus_trois_car' => '(Mer än 3 tecken)',
304
+    'info_popularite' => 'popularitet: @popularite@; besök: @visites@',
305
+    'info_post_scriptum' => 'Postscript',
306
+    'info_post_scriptum_2' => 'PS:',
307
+    'info_pour' => 'för',
308
+    'info_procedez_par_etape' => 'Var vänlig, fortsätt steg för steg',
309
+    'info_procedure_maj_version' => 'Uppdateringsproceduren skall köras för att
310 310
  anpassa databasen till den nya versionen av SPIP.',
311
-	'info_proxy_ok' => 'Testen av proxy lyckades.',
312
-	'info_ps' => 'P.S.',
313
-	'info_publier' => 'publicera',
314
-	'info_publies' => 'Dina onlinepublicerade artiklar',
315
-	'info_question_accepter_visiteurs' => 'Om sajtens template tillåter besökare att registrera sig utan att gå in i den privata delen, var vänlig och aktivera följande option:',
316
-	'info_racine_site' => 'Sajtens bas',
317
-	'info_recharger_page' => 'Var vänlig och uppdatera sidan om en liten stund.',
318
-	'info_recherche_auteur_zero' => 'Inga resultat hittades för "@cherche_auteur@".',
319
-	'info_recommencer' => 'Var vänlig och försök igen.',
320
-	'info_redacteur_1' => 'Redaktör',
321
-	'info_redacteur_2' => 'för tillgång till den privata delen (<i>rekommenderas</i>)',
322
-	'info_redacteurs' => 'Redaktörer',
323
-	'info_redaction_en_cours' => 'UNDER ARBETE',
324
-	'info_redirection' => 'Ompekning',
325
-	'info_refuses' => 'Refuserade artiklar',
326
-	'info_reglage_ldap' => 'inställningar: <b>anpassar LDAP import</b>',
327
-	'info_renvoi_article' => '<b>Ompekning.</b> Den här artikeln pekar om till:',
328
-	'info_reserve_admin' => 'Enbart administratörer kan förändra adressen.',
329
-	'info_restreindre_rubrique' => 'Begränsa administrationen till avdelningen:',
330
-	'info_resultat_recherche' => 'Sökresultat:',
331
-	'info_rubriques' => 'Avdelningar',
332
-	'info_rubriques_02' => 'avdelningar',
333
-	'info_rubriques_trouvees' => 'Hittade avdelningar',
334
-	'info_sans_titre' => 'Utan titel',
335
-	'info_selection_chemin_acces' => '<b>Välj</b> åtkomstväg i katalogen:',
336
-	'info_signatures' => 'underskrifter',
337
-	'info_site' => 'Sajt',
338
-	'info_site_2' => 'sajt:',
339
-	'info_site_min' => 'sajt',
340
-	'info_site_reference_2' => 'Länkad sajt',
341
-	'info_site_web' => 'WEBBSAJT:', # MODIF
342
-	'info_sites' => 'sajter',
343
-	'info_sites_lies_mot' => 'Länkade sajter knutna till detta nyckelord',
344
-	'info_sites_proxy' => 'Använder en proxy',
345
-	'info_sites_trouves' => 'Hittade sajter',
346
-	'info_sous_titre' => 'Undertitel:',
347
-	'info_statut_administrateur' => 'Administratör',
348
-	'info_statut_auteur' => 'Redaktörens status:', # MODIF
349
-	'info_statut_auteur_a_confirmer' => 'Registreringar som skall godkännas',
350
-	'info_statut_auteur_autre' => 'Annan status:',
351
-	'info_statut_redacteur' => 'Redaktör',
352
-	'info_statut_utilisateurs_1' => 'Startinställningar för importerade användare',
353
-	'info_suivi_activite' => 'Följ upp aktiviteten på sajten',
354
-	'info_surtitre' => 'Övertitel:',
355
-	'info_syndication_integrale_1' => 'Din sajt publiceras RSS-filer för syndikering (Se “<a href="@url@">@titre@</a>”).',
356
-	'info_syndication_integrale_2' => 'Vill du skicka hela artiklar eller bara en sammanfattning på ett par hundra tecken?',
357
-	'info_table_prefix' => 'Det är möjligt att byta prefix i databastabellernas namn. (Du behöver göra det om di installerar flera sajter i samma databas). Prefixet måste skrivas utan accenter, med versaler utan mellanslag.',
358
-	'info_taille_maximale_vignette' => 'Maximal storlek på miniatyrer som skapats av systemet:',
359
-	'info_terminer_installation' => 'Du kan nu avsluta installationsprocessen.',
360
-	'info_texte' => 'Text',
361
-	'info_texte_explicatif' => 'Förklarande text',
362
-	'info_texte_long' => '(Texten är lång: Den kommer att synas i flera delar som sedan sammanfogas efter validering.)',
363
-	'info_texte_message' => 'Texten i ditt meddelande:', # MODIF
364
-	'info_texte_message_02' => 'Texten i ditt meddelande',
365
-	'info_titre' => 'Titel:',
366
-	'info_total' => 'total:',
367
-	'info_tous_articles_en_redaction' => 'Alla artiklar under arbete',
368
-	'info_tous_articles_presents' => 'Alla artiklar som publicerats i den här avdelningen',
369
-	'info_tous_les' => 'alla:',
370
-	'info_tout_site' => 'Hela sajten',
371
-	'info_tout_site2' => 'Artikeln har inte blivit översatt till det här språket.',
372
-	'info_tout_site3' => 'Artikeln har blivit översatt till det hör språket men vissa förändringar har gjorts senare i orginalartikeln. Översättningen behöver uppdateras.',
373
-	'info_tout_site4' => 'Artikeln har blivit översatt till det här språket och översättningen är aktuell.',
374
-	'info_tout_site5' => 'Orginalartikeln.',
375
-	'info_tout_site6' => '<b>OBS:</b> bara orginalartiklarna visas.
311
+    'info_proxy_ok' => 'Testen av proxy lyckades.',
312
+    'info_ps' => 'P.S.',
313
+    'info_publier' => 'publicera',
314
+    'info_publies' => 'Dina onlinepublicerade artiklar',
315
+    'info_question_accepter_visiteurs' => 'Om sajtens template tillåter besökare att registrera sig utan att gå in i den privata delen, var vänlig och aktivera följande option:',
316
+    'info_racine_site' => 'Sajtens bas',
317
+    'info_recharger_page' => 'Var vänlig och uppdatera sidan om en liten stund.',
318
+    'info_recherche_auteur_zero' => 'Inga resultat hittades för "@cherche_auteur@".',
319
+    'info_recommencer' => 'Var vänlig och försök igen.',
320
+    'info_redacteur_1' => 'Redaktör',
321
+    'info_redacteur_2' => 'för tillgång till den privata delen (<i>rekommenderas</i>)',
322
+    'info_redacteurs' => 'Redaktörer',
323
+    'info_redaction_en_cours' => 'UNDER ARBETE',
324
+    'info_redirection' => 'Ompekning',
325
+    'info_refuses' => 'Refuserade artiklar',
326
+    'info_reglage_ldap' => 'inställningar: <b>anpassar LDAP import</b>',
327
+    'info_renvoi_article' => '<b>Ompekning.</b> Den här artikeln pekar om till:',
328
+    'info_reserve_admin' => 'Enbart administratörer kan förändra adressen.',
329
+    'info_restreindre_rubrique' => 'Begränsa administrationen till avdelningen:',
330
+    'info_resultat_recherche' => 'Sökresultat:',
331
+    'info_rubriques' => 'Avdelningar',
332
+    'info_rubriques_02' => 'avdelningar',
333
+    'info_rubriques_trouvees' => 'Hittade avdelningar',
334
+    'info_sans_titre' => 'Utan titel',
335
+    'info_selection_chemin_acces' => '<b>Välj</b> åtkomstväg i katalogen:',
336
+    'info_signatures' => 'underskrifter',
337
+    'info_site' => 'Sajt',
338
+    'info_site_2' => 'sajt:',
339
+    'info_site_min' => 'sajt',
340
+    'info_site_reference_2' => 'Länkad sajt',
341
+    'info_site_web' => 'WEBBSAJT:', # MODIF
342
+    'info_sites' => 'sajter',
343
+    'info_sites_lies_mot' => 'Länkade sajter knutna till detta nyckelord',
344
+    'info_sites_proxy' => 'Använder en proxy',
345
+    'info_sites_trouves' => 'Hittade sajter',
346
+    'info_sous_titre' => 'Undertitel:',
347
+    'info_statut_administrateur' => 'Administratör',
348
+    'info_statut_auteur' => 'Redaktörens status:', # MODIF
349
+    'info_statut_auteur_a_confirmer' => 'Registreringar som skall godkännas',
350
+    'info_statut_auteur_autre' => 'Annan status:',
351
+    'info_statut_redacteur' => 'Redaktör',
352
+    'info_statut_utilisateurs_1' => 'Startinställningar för importerade användare',
353
+    'info_suivi_activite' => 'Följ upp aktiviteten på sajten',
354
+    'info_surtitre' => 'Övertitel:',
355
+    'info_syndication_integrale_1' => 'Din sajt publiceras RSS-filer för syndikering (Se “<a href="@url@">@titre@</a>”).',
356
+    'info_syndication_integrale_2' => 'Vill du skicka hela artiklar eller bara en sammanfattning på ett par hundra tecken?',
357
+    'info_table_prefix' => 'Det är möjligt att byta prefix i databastabellernas namn. (Du behöver göra det om di installerar flera sajter i samma databas). Prefixet måste skrivas utan accenter, med versaler utan mellanslag.',
358
+    'info_taille_maximale_vignette' => 'Maximal storlek på miniatyrer som skapats av systemet:',
359
+    'info_terminer_installation' => 'Du kan nu avsluta installationsprocessen.',
360
+    'info_texte' => 'Text',
361
+    'info_texte_explicatif' => 'Förklarande text',
362
+    'info_texte_long' => '(Texten är lång: Den kommer att synas i flera delar som sedan sammanfogas efter validering.)',
363
+    'info_texte_message' => 'Texten i ditt meddelande:', # MODIF
364
+    'info_texte_message_02' => 'Texten i ditt meddelande',
365
+    'info_titre' => 'Titel:',
366
+    'info_total' => 'total:',
367
+    'info_tous_articles_en_redaction' => 'Alla artiklar under arbete',
368
+    'info_tous_articles_presents' => 'Alla artiklar som publicerats i den här avdelningen',
369
+    'info_tous_les' => 'alla:',
370
+    'info_tout_site' => 'Hela sajten',
371
+    'info_tout_site2' => 'Artikeln har inte blivit översatt till det här språket.',
372
+    'info_tout_site3' => 'Artikeln har blivit översatt till det hör språket men vissa förändringar har gjorts senare i orginalartikeln. Översättningen behöver uppdateras.',
373
+    'info_tout_site4' => 'Artikeln har blivit översatt till det här språket och översättningen är aktuell.',
374
+    'info_tout_site5' => 'Orginalartikeln.',
375
+    'info_tout_site6' => '<b>OBS:</b> bara orginalartiklarna visas.
376 376
 Översättningarna är länkade till orginalet
377 377
 med en färg som visar deras status:',
378
-	'info_travail_colaboratif' => 'Gemensamt arbete på artiklar',
379
-	'info_un_article' => 'en artikel,',
380
-	'info_un_site' => 'En sajt,',
381
-	'info_une_rubrique' => 'en avdelning,',
382
-	'info_une_rubrique_02' => '1 avdelning',
383
-	'info_url' => 'URL:',
384
-	'info_urlref' => 'Hyperlänk:',
385
-	'info_utilisation_spip' => 'SPIP är nu färdig att användas..',
386
-	'info_visites_par_mois' => 'Besökare per månad:',
387
-	'info_visiteur_1' => 'Besökare',
388
-	'info_visiteur_2' => 'på den publika delen',
389
-	'info_visiteurs' => 'Besökare',
390
-	'info_visiteurs_02' => 'Beökare på den publika delen',
391
-	'install_adresse_base_hebergeur' => 'Databasadress tillhandahållen av webbhotellet',
392
-	'install_echec_annonce' => 'Den här installationen kommer förmodligen inte att fungera, alternativt resulterar den i en sajt med reducerad funktionalitet ...',
393
-	'install_extension_mbstring' => 'SPIP fungerar inte med:',
394
-	'install_extension_php_obligatoire' => 'SPIP kräver ett tillägg till php:',
395
-	'install_login_base_hebergeur' => 'Login tilldelat av leverantören',
396
-	'install_nom_base_hebergeur' => 'Databasnamn tilldelat av leverantören:',
397
-	'install_pas_table' => 'Databasen har inga tabeller',
398
-	'install_pass_base_hebergeur' => 'Lösenord till databasen tilldelat av leverantören',
399
-	'install_php_version' => 'Versionen av PHP, @version@ är för gammal (minimum = @minimum@)',
400
-	'install_select_langue' => 'Välj ett språk, klicka sedan på knappen "fortsätt" för att starta installationen.',
401
-	'install_select_type_db' => 'Välj typ av databas :',
402
-	'install_select_type_mysql' => 'MySQL',
403
-	'install_select_type_sqlite2' => 'SQLite 2',
404
-	'install_select_type_sqlite3' => 'SQLite 3',
405
-	'install_tables_base' => 'Databasens tabeller',
406
-	'intem_redacteur' => 'redaktör',
407
-	'intitule_licence' => 'Licens',
408
-	'item_accepter_inscriptions' => 'Tillåt registreringar',
409
-	'item_activer_messages_avertissement' => 'Aktivera varningsmeddelanden',
410
-	'item_administrateur_2' => 'administratör',
411
-	'item_afficher_calendrier' => 'Visa i kalendern',
412
-	'item_autoriser_syndication_integrale' => 'Inkludera hela artiklar i syndikeringsfilerna',
413
-	'item_choix_administrateurs' => 'administratörer',
414
-	'item_choix_generation_miniature' => 'Generera miniatyrer automatiskt.',
415
-	'item_choix_non_generation_miniature' => 'Generera inte miniatyrer.',
416
-	'item_choix_redacteurs' => 'redaktörer',
417
-	'item_choix_visiteurs' => 'besökare till den publika delen',
418
-	'item_creer_fichiers_authent' => 'Skapa .htpasswd filer',
419
-	'item_login' => 'Login',
420
-	'item_messagerie_agenda' => 'Aktivera meddelandesystemet och kalendern',
421
-	'item_mots_cles_association_articles' => 'artiklar',
422
-	'item_mots_cles_association_rubriques' => 'avdelningar',
423
-	'item_mots_cles_association_sites' => 'länkade eller syndikerade sajter.',
424
-	'item_non' => 'Nej',
425
-	'item_non_accepter_inscriptions' => 'Tillåt inte registreringar',
426
-	'item_non_activer_messages_avertissement' => 'Inga varningsmeddelanden',
427
-	'item_non_afficher_calendrier' => 'Visa inte i kalendern',
428
-	'item_non_autoriser_syndication_integrale' => 'Skicka bara en sammanfattning',
429
-	'item_non_creer_fichiers_authent' => 'Skapa inte dessa filer',
430
-	'item_non_messagerie_agenda' => 'Avaktivera meddelandesystemet och kalendern',
431
-	'item_non_publier_articles' => 'Publicera inte artiklar innan deras publiceringsdatum.',
432
-	'item_nouvel_auteur' => 'Ny redaktör',
433
-	'item_nouvelle_rubrique' => 'Ny avdelning',
434
-	'item_oui' => 'Ja',
435
-	'item_publier_articles' => 'Publicera artiklarna utan att ta hänsyn till publiceringsdatum.',
436
-	'item_reponse_article' => 'Svara på artikeln',
437
-	'item_visiteur' => 'besökare',
378
+    'info_travail_colaboratif' => 'Gemensamt arbete på artiklar',
379
+    'info_un_article' => 'en artikel,',
380
+    'info_un_site' => 'En sajt,',
381
+    'info_une_rubrique' => 'en avdelning,',
382
+    'info_une_rubrique_02' => '1 avdelning',
383
+    'info_url' => 'URL:',
384
+    'info_urlref' => 'Hyperlänk:',
385
+    'info_utilisation_spip' => 'SPIP är nu färdig att användas..',
386
+    'info_visites_par_mois' => 'Besökare per månad:',
387
+    'info_visiteur_1' => 'Besökare',
388
+    'info_visiteur_2' => 'på den publika delen',
389
+    'info_visiteurs' => 'Besökare',
390
+    'info_visiteurs_02' => 'Beökare på den publika delen',
391
+    'install_adresse_base_hebergeur' => 'Databasadress tillhandahållen av webbhotellet',
392
+    'install_echec_annonce' => 'Den här installationen kommer förmodligen inte att fungera, alternativt resulterar den i en sajt med reducerad funktionalitet ...',
393
+    'install_extension_mbstring' => 'SPIP fungerar inte med:',
394
+    'install_extension_php_obligatoire' => 'SPIP kräver ett tillägg till php:',
395
+    'install_login_base_hebergeur' => 'Login tilldelat av leverantören',
396
+    'install_nom_base_hebergeur' => 'Databasnamn tilldelat av leverantören:',
397
+    'install_pas_table' => 'Databasen har inga tabeller',
398
+    'install_pass_base_hebergeur' => 'Lösenord till databasen tilldelat av leverantören',
399
+    'install_php_version' => 'Versionen av PHP, @version@ är för gammal (minimum = @minimum@)',
400
+    'install_select_langue' => 'Välj ett språk, klicka sedan på knappen "fortsätt" för att starta installationen.',
401
+    'install_select_type_db' => 'Välj typ av databas :',
402
+    'install_select_type_mysql' => 'MySQL',
403
+    'install_select_type_sqlite2' => 'SQLite 2',
404
+    'install_select_type_sqlite3' => 'SQLite 3',
405
+    'install_tables_base' => 'Databasens tabeller',
406
+    'intem_redacteur' => 'redaktör',
407
+    'intitule_licence' => 'Licens',
408
+    'item_accepter_inscriptions' => 'Tillåt registreringar',
409
+    'item_activer_messages_avertissement' => 'Aktivera varningsmeddelanden',
410
+    'item_administrateur_2' => 'administratör',
411
+    'item_afficher_calendrier' => 'Visa i kalendern',
412
+    'item_autoriser_syndication_integrale' => 'Inkludera hela artiklar i syndikeringsfilerna',
413
+    'item_choix_administrateurs' => 'administratörer',
414
+    'item_choix_generation_miniature' => 'Generera miniatyrer automatiskt.',
415
+    'item_choix_non_generation_miniature' => 'Generera inte miniatyrer.',
416
+    'item_choix_redacteurs' => 'redaktörer',
417
+    'item_choix_visiteurs' => 'besökare till den publika delen',
418
+    'item_creer_fichiers_authent' => 'Skapa .htpasswd filer',
419
+    'item_login' => 'Login',
420
+    'item_messagerie_agenda' => 'Aktivera meddelandesystemet och kalendern',
421
+    'item_mots_cles_association_articles' => 'artiklar',
422
+    'item_mots_cles_association_rubriques' => 'avdelningar',
423
+    'item_mots_cles_association_sites' => 'länkade eller syndikerade sajter.',
424
+    'item_non' => 'Nej',
425
+    'item_non_accepter_inscriptions' => 'Tillåt inte registreringar',
426
+    'item_non_activer_messages_avertissement' => 'Inga varningsmeddelanden',
427
+    'item_non_afficher_calendrier' => 'Visa inte i kalendern',
428
+    'item_non_autoriser_syndication_integrale' => 'Skicka bara en sammanfattning',
429
+    'item_non_creer_fichiers_authent' => 'Skapa inte dessa filer',
430
+    'item_non_messagerie_agenda' => 'Avaktivera meddelandesystemet och kalendern',
431
+    'item_non_publier_articles' => 'Publicera inte artiklar innan deras publiceringsdatum.',
432
+    'item_nouvel_auteur' => 'Ny redaktör',
433
+    'item_nouvelle_rubrique' => 'Ny avdelning',
434
+    'item_oui' => 'Ja',
435
+    'item_publier_articles' => 'Publicera artiklarna utan att ta hänsyn till publiceringsdatum.',
436
+    'item_reponse_article' => 'Svara på artikeln',
437
+    'item_visiteur' => 'besökare',
438 438
 
439
-	// J
440
-	'jour_non_connu_nc' => 'okänd',
439
+    // J
440
+    'jour_non_connu_nc' => 'okänd',
441 441
 
442
-	// L
443
-	'lien_ajouter_auteur' => 'Lätt till redaktören',
444
-	'lien_email' => 'e-post',
445
-	'lien_nom_site' => 'SAJTENS NAMN:',
446
-	'lien_retirer_auteur' => 'Ta bort redaktören',
447
-	'lien_site' => 'sajt',
448
-	'lien_tout_deplier' => 'Expandera alla',
449
-	'lien_tout_replier' => 'Kollapsa alla',
450
-	'lien_tout_supprimer' => 'Radera alla',
451
-	'lien_trier_nom' => 'Sortera efter namn',
452
-	'lien_trier_nombre_articles' => 'Sortera efter artikelnummer',
453
-	'lien_trier_statut' => 'Sortera efter status',
454
-	'lien_voir_en_ligne' => 'SE ONLINE:',
455
-	'logo_article' => 'ARTIKELNS LOGOTYPE', # MODIF
456
-	'logo_auteur' => 'REDAKTÖRENS LOGOTYPE', # MODIF
457
-	'logo_rubrique' => 'Avdelningens logotype', # MODIF
458
-	'logo_site' => 'SAJTENS LOGOTYPE', # MODIF
459
-	'logo_standard_rubrique' => 'STANDARDLOGOTYPE FÖR AVDELNINGAR', # MODIF
460
-	'logo_survol' => 'LOGOTYPE FÖR MUS-ÖVER', # MODIF
442
+    // L
443
+    'lien_ajouter_auteur' => 'Lätt till redaktören',
444
+    'lien_email' => 'e-post',
445
+    'lien_nom_site' => 'SAJTENS NAMN:',
446
+    'lien_retirer_auteur' => 'Ta bort redaktören',
447
+    'lien_site' => 'sajt',
448
+    'lien_tout_deplier' => 'Expandera alla',
449
+    'lien_tout_replier' => 'Kollapsa alla',
450
+    'lien_tout_supprimer' => 'Radera alla',
451
+    'lien_trier_nom' => 'Sortera efter namn',
452
+    'lien_trier_nombre_articles' => 'Sortera efter artikelnummer',
453
+    'lien_trier_statut' => 'Sortera efter status',
454
+    'lien_voir_en_ligne' => 'SE ONLINE:',
455
+    'logo_article' => 'ARTIKELNS LOGOTYPE', # MODIF
456
+    'logo_auteur' => 'REDAKTÖRENS LOGOTYPE', # MODIF
457
+    'logo_rubrique' => 'Avdelningens logotype', # MODIF
458
+    'logo_site' => 'SAJTENS LOGOTYPE', # MODIF
459
+    'logo_standard_rubrique' => 'STANDARDLOGOTYPE FÖR AVDELNINGAR', # MODIF
460
+    'logo_survol' => 'LOGOTYPE FÖR MUS-ÖVER', # MODIF
461 461
 
462
-	// M
463
-	'menu_aide_installation_choix_base' => 'Välj din databas',
464
-	'module_fichier_langue' => 'Språkfiler',
465
-	'module_raccourci' => 'Genväg',
466
-	'module_texte_affiche' => 'Visad text',
467
-	'module_texte_traduction' => 'Språkfilen « @module@ » finns i:',
462
+    // M
463
+    'menu_aide_installation_choix_base' => 'Välj din databas',
464
+    'module_fichier_langue' => 'Språkfiler',
465
+    'module_raccourci' => 'Genväg',
466
+    'module_texte_affiche' => 'Visad text',
467
+    'module_texte_traduction' => 'Språkfilen « @module@ » finns i:',
468 468
 
469
-	// O
470
-	'onglet_contenu' => 'Innehåll',
471
-	'onglet_declarer_une_autre_base' => 'Ange en annan databas',
472
-	'onglet_discuter' => 'Diskutera',
473
-	'onglet_interactivite' => 'Interaktivitet',
474
-	'onglet_proprietes' => 'Egenskaper',
475
-	'onglet_repartition_actuelle' => 'nu',
469
+    // O
470
+    'onglet_contenu' => 'Innehåll',
471
+    'onglet_declarer_une_autre_base' => 'Ange en annan databas',
472
+    'onglet_discuter' => 'Diskutera',
473
+    'onglet_interactivite' => 'Interaktivitet',
474
+    'onglet_proprietes' => 'Egenskaper',
475
+    'onglet_repartition_actuelle' => 'nu',
476 476
 
477
-	// P
478
-	'plugin_etat_developpement' => 'Under utveckling',
479
-	'plugin_etat_experimental' => 'exprimentell',
480
-	'plugin_etat_stable' => 'Stabil',
481
-	'plugin_etat_test' => 'under test',
482
-	'plugin_impossible_activer' => 'Omöjligt att aktivera pluginen @plugin@',
483
-	'plugin_necessite_plugin' => 'Version @version@ eller nyare av pluginen @plugin@ krävs.', # MODIF
484
-	'plugin_zip_active' => 'Fortsätt för att aktivera',
485
-	'plugin_zip_installe_finie' => 'Filen @zip@ har packats upp och installerats.',
486
-	'plugin_zip_installe_rep_finie' => 'Filen @zip@ har packats upp och installerats i katalogen @rep@',
487
-	'plugin_zip_installer' => 'Du kan installera nu.',
488
-	'plugins_actifs' => '@count@ aktiva plugins.',
489
-	'plugins_compte' => '@count@ plugins',
490
-	'plugins_disponibles' => '@count@ tillgängliga plugins.',
491
-	'plugins_erreur' => 'Fel i följande plugin: @plugins@',
492
-	'plugins_liste' => 'Lista över plugins',
477
+    // P
478
+    'plugin_etat_developpement' => 'Under utveckling',
479
+    'plugin_etat_experimental' => 'exprimentell',
480
+    'plugin_etat_stable' => 'Stabil',
481
+    'plugin_etat_test' => 'under test',
482
+    'plugin_impossible_activer' => 'Omöjligt att aktivera pluginen @plugin@',
483
+    'plugin_necessite_plugin' => 'Version @version@ eller nyare av pluginen @plugin@ krävs.', # MODIF
484
+    'plugin_zip_active' => 'Fortsätt för att aktivera',
485
+    'plugin_zip_installe_finie' => 'Filen @zip@ har packats upp och installerats.',
486
+    'plugin_zip_installe_rep_finie' => 'Filen @zip@ har packats upp och installerats i katalogen @rep@',
487
+    'plugin_zip_installer' => 'Du kan installera nu.',
488
+    'plugins_actifs' => '@count@ aktiva plugins.',
489
+    'plugins_compte' => '@count@ plugins',
490
+    'plugins_disponibles' => '@count@ tillgängliga plugins.',
491
+    'plugins_erreur' => 'Fel i följande plugin: @plugins@',
492
+    'plugins_liste' => 'Lista över plugins',
493 493
 
494
-	// R
495
-	'required' => '[Krävs]', # MODIF
494
+    // R
495
+    'required' => '[Krävs]', # MODIF
496 496
 
497
-	// T
498
-	'taille_cache_vide' => 'Cachen är tom.',
499
-	'text_article_propose_publication' => 'Artikel inlämnad för publicering. tveka inte att säga din mening i forumet längst ned på sidan.', # MODIF
500
-	'texte_admin_effacer_01' => 'Detta kommando raderar <i>all</i> information i databasen,
497
+    // T
498
+    'taille_cache_vide' => 'Cachen är tom.',
499
+    'text_article_propose_publication' => 'Artikel inlämnad för publicering. tveka inte att säga din mening i forumet längst ned på sidan.', # MODIF
500
+    'texte_admin_effacer_01' => 'Detta kommando raderar <i>all</i> information i databasen,
501 501
 inklusive <i>alla</i> uppgifter om användare. Efter att du använt det, måste du 
502 502
 installera om SPIP för att skapa en ny databas och den första administratören.',
503
-	'texte_adresse_annuaire_1' => '( Om din katalog är installerad på samma dator som din websajt, är det troligen «localhost».)',
504
-	'texte_ajout_auteur' => 'Följande redaktör lades till artikeln:',
505
-	'texte_annuaire_ldap_1' => 'Om du har tillgång till en LDAP-katalog kan du använda den för att importera användare till SPIP.',
506
-	'texte_article_statut' => 'Artikelns status:',
507
-	'texte_article_virtuel' => 'Virtuell artikel',
508
-	'texte_article_virtuel_reference' => '<b>Virtuell Artikel:</b> länkad artikel i din SPIP site, men ompekad till en annan URL. För att ta bort ompekningen, radera denna URL.',
509
-	'texte_aucun_resultat_auteur' => 'Inga resultat för "@cherche_auteur@".',
510
-	'texte_auteurs' => 'REDAKTÖRERNA',
511
-	'texte_choix_base_1' => 'Välj din databas:',
512
-	'texte_choix_base_2' => 'Databasservern innehåller flera databaser.',
513
-	'texte_choix_base_3' => '<b>Välj</b> den som din leverantör har gett dig:',
514
-	'texte_choix_table_prefix' => 'Prefix för tabeller:',
515
-	'texte_compte_element' => '@count@ objekt',
516
-	'texte_compte_elements' => '@count@ element',
517
-	'texte_jeu_caractere_3' => 'Din sajt använder följande teckenuppsättning:',
518
-	'texte_mise_a_niveau_base_1' => 'Du har just uppdaterat filerna i SPIP.
503
+    'texte_adresse_annuaire_1' => '( Om din katalog är installerad på samma dator som din websajt, är det troligen «localhost».)',
504
+    'texte_ajout_auteur' => 'Följande redaktör lades till artikeln:',
505
+    'texte_annuaire_ldap_1' => 'Om du har tillgång till en LDAP-katalog kan du använda den för att importera användare till SPIP.',
506
+    'texte_article_statut' => 'Artikelns status:',
507
+    'texte_article_virtuel' => 'Virtuell artikel',
508
+    'texte_article_virtuel_reference' => '<b>Virtuell Artikel:</b> länkad artikel i din SPIP site, men ompekad till en annan URL. För att ta bort ompekningen, radera denna URL.',
509
+    'texte_aucun_resultat_auteur' => 'Inga resultat för "@cherche_auteur@".',
510
+    'texte_auteurs' => 'REDAKTÖRERNA',
511
+    'texte_choix_base_1' => 'Välj din databas:',
512
+    'texte_choix_base_2' => 'Databasservern innehåller flera databaser.',
513
+    'texte_choix_base_3' => '<b>Välj</b> den som din leverantör har gett dig:',
514
+    'texte_choix_table_prefix' => 'Prefix för tabeller:',
515
+    'texte_compte_element' => '@count@ objekt',
516
+    'texte_compte_elements' => '@count@ element',
517
+    'texte_jeu_caractere_3' => 'Din sajt använder följande teckenuppsättning:',
518
+    'texte_mise_a_niveau_base_1' => 'Du har just uppdaterat filerna i SPIP.
519 519
  Nu måste du uppgradera sajtens databas.',
520
-	'texte_modifier_article' => 'Redigera artikeln:',
521
-	'texte_multilinguisme' => 'Om du vill hantera artiklar på flera språk, med en avancerad navigering, kan du lägga till en option för språkval i artiklar och avdelningar, i enlighet med sajtens struktur.', # MODIF
522
-	'texte_multilinguisme_trad' => 'Dessutom kan du aktivera ett system för länkhantering av de olika översättningarna av en artikel.', # MODIF
523
-	'texte_non_compresse' => '<i>okomprimerad</i> (din server stöder inte denna funktion)',
524
-	'texte_nouvelle_version_spip_1' => 'Du har installerat en ny version av SPIP.',
525
-	'texte_plus_trois_car' => 'mer än tre tecken',
526
-	'texte_plusieurs_articles' => 'Flera redaktörer hittades för  "@cherche_auteur@":',
527
-	'texte_recalcul_page' => 'Om du vill uppdatera
520
+    'texte_modifier_article' => 'Redigera artikeln:',
521
+    'texte_multilinguisme' => 'Om du vill hantera artiklar på flera språk, med en avancerad navigering, kan du lägga till en option för språkval i artiklar och avdelningar, i enlighet med sajtens struktur.', # MODIF
522
+    'texte_multilinguisme_trad' => 'Dessutom kan du aktivera ett system för länkhantering av de olika översättningarna av en artikel.', # MODIF
523
+    'texte_non_compresse' => '<i>okomprimerad</i> (din server stöder inte denna funktion)',
524
+    'texte_nouvelle_version_spip_1' => 'Du har installerat en ny version av SPIP.',
525
+    'texte_plus_trois_car' => 'mer än tre tecken',
526
+    'texte_plusieurs_articles' => 'Flera redaktörer hittades för  "@cherche_auteur@":',
527
+    'texte_recalcul_page' => 'Om du vill uppdatera
528 528
 enbart en sida, är det bäst att göra det från den publika delen genom att klicka på « Ladda om sidan ».',
529
-	'texte_recuperer_base' => 'Reparera databasen',
530
-	'texte_sous_titre' => 'Undertitel',
531
-	'texte_statistiques_visites' => '(mörka staplar:  Söndag / mörk linje: genomsnittlig nivå)',
532
-	'texte_statut_attente_validation' => 'väntar på godkännande',
533
-	'texte_statut_publies' => 'publicerad online',
534
-	'texte_statut_refuses' => 'avvisad',
535
-	'texte_suppression_fichiers' => 'Använd detta kommando för att radera alla filer
529
+    'texte_recuperer_base' => 'Reparera databasen',
530
+    'texte_sous_titre' => 'Undertitel',
531
+    'texte_statistiques_visites' => '(mörka staplar:  Söndag / mörk linje: genomsnittlig nivå)',
532
+    'texte_statut_attente_validation' => 'väntar på godkännande',
533
+    'texte_statut_publies' => 'publicerad online',
534
+    'texte_statut_refuses' => 'avvisad',
535
+    'texte_suppression_fichiers' => 'Använd detta kommando för att radera alla filer
536 536
 i SPIP’s cache. Det gör det möjligt att tvinga fram en uppdatering av alla sidor om du
537 537
 gjort viktiga förändringar i sajtens utseende eller struktur.',
538
-	'texte_sur_titre' => 'Övertitel',
539
-	'texte_table_ok' => ': den här tabellen är OK.',
540
-	'texte_tentative_recuperation' => 'Reparationsförsök',
541
-	'texte_tenter_reparation' => 'Försök att reparera databasen',
542
-	'texte_titre_02' => 'Ärenderad:',
543
-	'texte_titre_obligatoire' => '<b>Titel</b> [Krävs]',
544
-	'texte_travail_article' => '@nom_auteur_modif@ arbetade med den här artikeln för @date_diff@ minuter sedan',
545
-	'texte_vide' => 'tom',
546
-	'texte_vider_cache' => 'töm cachen',
547
-	'titre_admin_tech' => 'Tekniskt underhåll',
548
-	'titre_admin_vider' => 'Tekniskt underhåll',
549
-	'titre_cadre_afficher_article' => 'Visa artiklarna:',
550
-	'titre_cadre_afficher_traductions' => 'Visa status för översättningen för följande språk:',
551
-	'titre_cadre_ajouter_auteur' => 'LÄGG TILL EN REDAKTÖR:',
552
-	'titre_cadre_interieur_rubrique' => 'I Avdelningen',
553
-	'titre_cadre_numero_auteur' => 'Redaktör nummer',
554
-	'titre_cadre_signature_obligatoire' => '<b>Signatur</b> [krävs]<br />',
555
-	'titre_config_fonctions' => 'Sajtens konfiguration',
556
-	'titre_configuration' => 'Sajtens konfiguration',
557
-	'titre_connexion_ldap' => 'Optioner: <b>Din LDAP koppling</b>',
558
-	'titre_groupe_mots' => 'NYCKELORDSGRUPP:',
559
-	'titre_langue_article' => 'ARTIKELNS SPRÅK', # MODIF
560
-	'titre_langue_rubrique' => 'AVDELNINGENS SPRÅK', # MODIF
561
-	'titre_langue_trad_article' => 'ARTIKESPRÅK OCH ÖVERSÄTTNINGAR',
562
-	'titre_les_articles' => 'ARTIKLAR',
563
-	'titre_naviguer_dans_le_site' => 'Navigera i sajten...',
564
-	'titre_nouvelle_rubrique' => 'Ny avdelning',
565
-	'titre_numero_rubrique' => 'AVDELNING NUMMER:',
566
-	'titre_page_articles_edit' => 'Editera: @titre@',
567
-	'titre_page_articles_page' => 'Artiklar',
568
-	'titre_page_articles_tous' => 'Hela sajten',
569
-	'titre_page_calendrier' => 'Kalender @nom_mois@ @annee@',
570
-	'titre_page_config_contenu' => 'Sajtens inställningar',
571
-	'titre_page_delete_all' => 'total och oåterkallelig radering',
572
-	'titre_page_recherche' => 'Sökresultat @recherche@',
573
-	'titre_page_statistiques_referers' => 'Statistik (inkommande länkar)',
574
-	'titre_page_upgrade' => 'Uppgradera SPIP',
575
-	'titre_publication_articles_post_dates' => 'Tidsstyrd publicering av artiklar',
576
-	'titre_reparation' => 'Reparera',
577
-	'titre_suivi_petition' => 'Uppföljning av namninasamlingar',
578
-	'trad_article_traduction' => 'Alla versioner av den här artikeln:',
579
-	'trad_delier' => 'Sluta länka den här artikeln till dess översättningar', # MODIF
580
-	'trad_lier' => 'Den här artikeln är en översättning av artikel nummer:',
581
-	'trad_new' => 'Skriv en ny översättning av den här artikeln', # MODIF
538
+    'texte_sur_titre' => 'Övertitel',
539
+    'texte_table_ok' => ': den här tabellen är OK.',
540
+    'texte_tentative_recuperation' => 'Reparationsförsök',
541
+    'texte_tenter_reparation' => 'Försök att reparera databasen',
542
+    'texte_titre_02' => 'Ärenderad:',
543
+    'texte_titre_obligatoire' => '<b>Titel</b> [Krävs]',
544
+    'texte_travail_article' => '@nom_auteur_modif@ arbetade med den här artikeln för @date_diff@ minuter sedan',
545
+    'texte_vide' => 'tom',
546
+    'texte_vider_cache' => 'töm cachen',
547
+    'titre_admin_tech' => 'Tekniskt underhåll',
548
+    'titre_admin_vider' => 'Tekniskt underhåll',
549
+    'titre_cadre_afficher_article' => 'Visa artiklarna:',
550
+    'titre_cadre_afficher_traductions' => 'Visa status för översättningen för följande språk:',
551
+    'titre_cadre_ajouter_auteur' => 'LÄGG TILL EN REDAKTÖR:',
552
+    'titre_cadre_interieur_rubrique' => 'I Avdelningen',
553
+    'titre_cadre_numero_auteur' => 'Redaktör nummer',
554
+    'titre_cadre_signature_obligatoire' => '<b>Signatur</b> [krävs]<br />',
555
+    'titre_config_fonctions' => 'Sajtens konfiguration',
556
+    'titre_configuration' => 'Sajtens konfiguration',
557
+    'titre_connexion_ldap' => 'Optioner: <b>Din LDAP koppling</b>',
558
+    'titre_groupe_mots' => 'NYCKELORDSGRUPP:',
559
+    'titre_langue_article' => 'ARTIKELNS SPRÅK', # MODIF
560
+    'titre_langue_rubrique' => 'AVDELNINGENS SPRÅK', # MODIF
561
+    'titre_langue_trad_article' => 'ARTIKESPRÅK OCH ÖVERSÄTTNINGAR',
562
+    'titre_les_articles' => 'ARTIKLAR',
563
+    'titre_naviguer_dans_le_site' => 'Navigera i sajten...',
564
+    'titre_nouvelle_rubrique' => 'Ny avdelning',
565
+    'titre_numero_rubrique' => 'AVDELNING NUMMER:',
566
+    'titre_page_articles_edit' => 'Editera: @titre@',
567
+    'titre_page_articles_page' => 'Artiklar',
568
+    'titre_page_articles_tous' => 'Hela sajten',
569
+    'titre_page_calendrier' => 'Kalender @nom_mois@ @annee@',
570
+    'titre_page_config_contenu' => 'Sajtens inställningar',
571
+    'titre_page_delete_all' => 'total och oåterkallelig radering',
572
+    'titre_page_recherche' => 'Sökresultat @recherche@',
573
+    'titre_page_statistiques_referers' => 'Statistik (inkommande länkar)',
574
+    'titre_page_upgrade' => 'Uppgradera SPIP',
575
+    'titre_publication_articles_post_dates' => 'Tidsstyrd publicering av artiklar',
576
+    'titre_reparation' => 'Reparera',
577
+    'titre_suivi_petition' => 'Uppföljning av namninasamlingar',
578
+    'trad_article_traduction' => 'Alla versioner av den här artikeln:',
579
+    'trad_delier' => 'Sluta länka den här artikeln till dess översättningar', # MODIF
580
+    'trad_lier' => 'Den här artikeln är en översättning av artikel nummer:',
581
+    'trad_new' => 'Skriv en ny översättning av den här artikeln', # MODIF
582 582
 
583
-	// U
584
-	'utf8_convert_erreur_orig' => 'Fel: teckenkodningen @charset@ stöds inte.',
583
+    // U
584
+    'utf8_convert_erreur_orig' => 'Fel: teckenkodningen @charset@ stöds inte.',
585 585
 
586
-	// V
587
-	'version' => 'Version:'
586
+    // V
587
+    'version' => 'Version:'
588 588
 );
Please login to merge, or discard this patch.