Completed
Push — master ( 8ac1c9...4b0d59 )
by cam
01:18
created
ecrire/action/editer_auteur.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	$champs['source'] = $source ?: 'spip';
94 94
 
95 95
 	$champs['login'] = '';
96
-	$champs['statut'] = '5poubelle';  // inutilisable tant qu'il n'a pas ete renseigne et institue
96
+	$champs['statut'] = '5poubelle'; // inutilisable tant qu'il n'a pas ete renseigne et institue
97 97
 	$champs['webmestre'] = 'non';
98 98
 	if (empty($champs['imessage'])) {
99 99
 		$champs['imessage'] = 'oui';
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 		$champs['pass'] = $c['pass'];
314 314
 	}
315 315
 
316
-	$statut = $statut_ancien = sql_getfetsel('statut', 'spip_auteurs', 'id_auteur=' . intval($id_auteur));
316
+	$statut = $statut_ancien = sql_getfetsel('statut', 'spip_auteurs', 'id_auteur='.intval($id_auteur));
317 317
 
318 318
 	if (
319 319
 		isset($c['statut'])
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 	// commencer par traiter les cas particuliers des logins et pass
374 374
 	// avant les autres ecritures en base
375 375
 	if (isset($champs['login']) or isset($champs['pass'])) {
376
-		$auth_methode = sql_getfetsel('source', 'spip_auteurs', 'id_auteur=' . intval($id_auteur));
376
+		$auth_methode = sql_getfetsel('source', 'spip_auteurs', 'id_auteur='.intval($id_auteur));
377 377
 		include_spip('inc/auth');
378 378
 		if (isset($champs['login']) and strlen($champs['login'])) {
379 379
 			if (!auth_modifier_login($auth_methode, $champs['login'], $id_auteur)) {
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 			}
382 382
 		}
383 383
 		if (isset($champs['pass']) and strlen($champs['pass'])) {
384
-			$champs['login'] = sql_getfetsel('login', 'spip_auteurs', 'id_auteur=' . intval($id_auteur));
384
+			$champs['login'] = sql_getfetsel('login', 'spip_auteurs', 'id_auteur='.intval($id_auteur));
385 385
 			if (!auth_modifier_pass($auth_methode, $champs['login'], $champs['pass'], $id_auteur)) {
386 386
 				$erreurs[] = 'ecrire:impossible_modifier_pass_auteur';
387 387
 			}
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 	if (!(is_countable($champs) ? count($champs) : 0)) {
395 395
 		return implode(' ', array_map('_T', $erreurs));
396 396
 	}
397
-	sql_updateq('spip_auteurs', $champs, 'id_auteur=' . $id_auteur);
397
+	sql_updateq('spip_auteurs', $champs, 'id_auteur='.$id_auteur);
398 398
 
399 399
 	// .. mettre a jour les fichiers .htpasswd et .htpasswd-admin
400 400
 	if (
Please login to merge, or discard this patch.
Indentation   +318 added lines, -318 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
 /**
@@ -37,41 +37,41 @@  discard block
 block discarded – undo
37 37
  */
38 38
 function action_editer_auteur_dist($arg = null) {
39 39
 
40
-	if (is_null($arg)) {
41
-		$securiser_action = charger_fonction('securiser_action', 'inc');
42
-		$arg = $securiser_action();
43
-	}
44
-
45
-
46
-	// si id_auteur n'est pas un nombre, c'est une creation
47
-	if (!$id_auteur = intval($arg)) {
48
-		if (($id_auteur = auteur_inserer()) > 0) {
49
-			# cf. GROS HACK
50
-			# recuperer l'eventuel logo charge avant la creation
51
-			# ils ont un id = 0-id_auteur de la session
52
-			$id_hack = 0 - $GLOBALS['visiteur_session']['id_auteur'];
53
-			$chercher_logo = charger_fonction('chercher_logo', 'inc');
54
-			foreach (['on', 'off'] as $type) {
55
-				if ($logo = $chercher_logo($id_hack, 'id_auteur', $type)) {
56
-					if ($logo = reset($logo)) {
57
-						rename($logo, str_replace($id_hack, $id_auteur, $logo));
58
-					}
59
-				}
60
-			}
61
-		}
62
-	}
63
-
64
-	// Enregistre l'envoi dans la BD
65
-	$err = '';
66
-	if ($id_auteur > 0) {
67
-		$err = auteur_modifier($id_auteur);
68
-	}
69
-
70
-	if ($err) {
71
-		spip_log("echec editeur auteur: $err", _LOG_ERREUR);
72
-	}
73
-
74
-	return [$id_auteur, $err];
40
+    if (is_null($arg)) {
41
+        $securiser_action = charger_fonction('securiser_action', 'inc');
42
+        $arg = $securiser_action();
43
+    }
44
+
45
+
46
+    // si id_auteur n'est pas un nombre, c'est une creation
47
+    if (!$id_auteur = intval($arg)) {
48
+        if (($id_auteur = auteur_inserer()) > 0) {
49
+            # cf. GROS HACK
50
+            # recuperer l'eventuel logo charge avant la creation
51
+            # ils ont un id = 0-id_auteur de la session
52
+            $id_hack = 0 - $GLOBALS['visiteur_session']['id_auteur'];
53
+            $chercher_logo = charger_fonction('chercher_logo', 'inc');
54
+            foreach (['on', 'off'] as $type) {
55
+                if ($logo = $chercher_logo($id_hack, 'id_auteur', $type)) {
56
+                    if ($logo = reset($logo)) {
57
+                        rename($logo, str_replace($id_hack, $id_auteur, $logo));
58
+                    }
59
+                }
60
+            }
61
+        }
62
+    }
63
+
64
+    // Enregistre l'envoi dans la BD
65
+    $err = '';
66
+    if ($id_auteur > 0) {
67
+        $err = auteur_modifier($id_auteur);
68
+    }
69
+
70
+    if ($err) {
71
+        spip_log("echec editeur auteur: $err", _LOG_ERREUR);
72
+    }
73
+
74
+    return [$id_auteur, $err];
75 75
 }
76 76
 
77 77
 /**
@@ -88,64 +88,64 @@  discard block
 block discarded – undo
88 88
  */
89 89
 function auteur_inserer($source = null, $set = null) {
90 90
 
91
-	// Ce qu'on va demander comme modifications
92
-	$champs = [];
93
-	$champs['source'] = $source ?: 'spip';
94
-
95
-	$champs['login'] = '';
96
-	$champs['statut'] = '5poubelle';  // inutilisable tant qu'il n'a pas ete renseigne et institue
97
-	$champs['webmestre'] = 'non';
98
-	if (empty($champs['imessage'])) {
99
-		$champs['imessage'] = 'oui';
100
-	}
101
-
102
-	if ($set) {
103
-		$champs = array_merge($champs, $set);
104
-	}
105
-
106
-	// Envoyer aux plugins
107
-	$champs = pipeline(
108
-		'pre_insertion',
109
-		[
110
-			'args' => [
111
-				'table' => 'spip_auteurs',
112
-			],
113
-			'data' => $champs
114
-		]
115
-	);
116
-	$id_auteur = sql_insertq('spip_auteurs', $champs);
117
-	pipeline(
118
-		'post_insertion',
119
-		[
120
-			'args' => [
121
-				'table' => 'spip_auteurs',
122
-				'id_objet' => $id_auteur
123
-			],
124
-			'data' => $champs
125
-		]
126
-	);
91
+    // Ce qu'on va demander comme modifications
92
+    $champs = [];
93
+    $champs['source'] = $source ?: 'spip';
94
+
95
+    $champs['login'] = '';
96
+    $champs['statut'] = '5poubelle';  // inutilisable tant qu'il n'a pas ete renseigne et institue
97
+    $champs['webmestre'] = 'non';
98
+    if (empty($champs['imessage'])) {
99
+        $champs['imessage'] = 'oui';
100
+    }
101
+
102
+    if ($set) {
103
+        $champs = array_merge($champs, $set);
104
+    }
105
+
106
+    // Envoyer aux plugins
107
+    $champs = pipeline(
108
+        'pre_insertion',
109
+        [
110
+            'args' => [
111
+                'table' => 'spip_auteurs',
112
+            ],
113
+            'data' => $champs
114
+        ]
115
+    );
116
+    $id_auteur = sql_insertq('spip_auteurs', $champs);
117
+    pipeline(
118
+        'post_insertion',
119
+        [
120
+            'args' => [
121
+                'table' => 'spip_auteurs',
122
+                'id_objet' => $id_auteur
123
+            ],
124
+            'data' => $champs
125
+        ]
126
+    );
127 127
 	
128
-	// Appeler une notification
129
-	if ($notifications = charger_fonction('notifications', 'inc')) {
130
-		$notifications(
131
-			'auteur_inserer',
132
-			$id_auteur,
133
-			[
134
-				'champs' => $champs,
135
-			]
136
-		);
137
-		$notifications(
138
-			'objet_inserer',
139
-			$id_auteur,
140
-			[
141
-				'objet' => 'auteur',
142
-				'id_objet' => $id_auteur,
143
-				'champs' => $champs,
144
-			]
145
-		);
146
-	}
147
-
148
-	return $id_auteur;
128
+    // Appeler une notification
129
+    if ($notifications = charger_fonction('notifications', 'inc')) {
130
+        $notifications(
131
+            'auteur_inserer',
132
+            $id_auteur,
133
+            [
134
+                'champs' => $champs,
135
+            ]
136
+        );
137
+        $notifications(
138
+            'objet_inserer',
139
+            $id_auteur,
140
+            [
141
+                'objet' => 'auteur',
142
+                'id_objet' => $id_auteur,
143
+                'champs' => $champs,
144
+            ]
145
+        );
146
+    }
147
+
148
+    return $id_auteur;
149 149
 }
150 150
 
151 151
 
@@ -170,70 +170,70 @@  discard block
 block discarded – undo
170 170
  */
171 171
 function auteur_modifier($id_auteur, $set = null, $force_update = false) {
172 172
 
173
-	include_spip('inc/modifier');
174
-	include_spip('inc/filtres');
175
-	$c = collecter_requests(
176
-		// include list
177
-		objet_info('auteur', 'champs_editables'),
178
-		// exclude list
179
-		$force_update ? [] : ['webmestre', 'pass', 'login'],
180
-		// donnees eventuellement fournies
181
-		$set
182
-	);
183
-
184
-	if (
185
-		$err = objet_modifier_champs(
186
-			'auteur',
187
-			$id_auteur,
188
-			[
189
-			'data' => $set,
190
-			'nonvide' => ['nom' => _T('ecrire:item_nouvel_auteur')]
191
-			],
192
-			$c
193
-		)
194
-	) {
195
-		return $err;
196
-	}
197
-	$session = $c;
198
-
199
-	$err = '';
200
-	if (!$force_update) {
201
-		// Modification de statut, changement de rubrique ?
202
-		$c = collecter_requests(
203
-		// include list
204
-			[
205
-				'statut',
206
-				'new_login',
207
-				'new_pass',
208
-				'login',
209
-				'pass',
210
-				'webmestre',
211
-				'restreintes',
212
-				'id_parent'
213
-			],
214
-			// exclude list
215
-			[],
216
-			// donnees eventuellement fournies
217
-			$set
218
-		);
219
-		if (isset($c['new_login']) and !isset($c['login'])) {
220
-			$c['login'] = $c['new_login'];
221
-		}
222
-		if (isset($c['new_pass']) and !isset($c['pass'])) {
223
-			$c['pass'] = $c['new_pass'];
224
-		}
225
-		$err = auteur_instituer($id_auteur, $c);
226
-		$session = array_merge($session, $c);
227
-	}
228
-
229
-	// .. mettre a jour les sessions de cet auteur
230
-	include_spip('inc/session');
231
-	$session['id_auteur'] = $id_auteur;
232
-	unset($session['new_login']);
233
-	unset($session['new_pass']);
234
-	actualiser_sessions($session);
235
-
236
-	return $err;
173
+    include_spip('inc/modifier');
174
+    include_spip('inc/filtres');
175
+    $c = collecter_requests(
176
+        // include list
177
+        objet_info('auteur', 'champs_editables'),
178
+        // exclude list
179
+        $force_update ? [] : ['webmestre', 'pass', 'login'],
180
+        // donnees eventuellement fournies
181
+        $set
182
+    );
183
+
184
+    if (
185
+        $err = objet_modifier_champs(
186
+            'auteur',
187
+            $id_auteur,
188
+            [
189
+            'data' => $set,
190
+            'nonvide' => ['nom' => _T('ecrire:item_nouvel_auteur')]
191
+            ],
192
+            $c
193
+        )
194
+    ) {
195
+        return $err;
196
+    }
197
+    $session = $c;
198
+
199
+    $err = '';
200
+    if (!$force_update) {
201
+        // Modification de statut, changement de rubrique ?
202
+        $c = collecter_requests(
203
+        // include list
204
+            [
205
+                'statut',
206
+                'new_login',
207
+                'new_pass',
208
+                'login',
209
+                'pass',
210
+                'webmestre',
211
+                'restreintes',
212
+                'id_parent'
213
+            ],
214
+            // exclude list
215
+            [],
216
+            // donnees eventuellement fournies
217
+            $set
218
+        );
219
+        if (isset($c['new_login']) and !isset($c['login'])) {
220
+            $c['login'] = $c['new_login'];
221
+        }
222
+        if (isset($c['new_pass']) and !isset($c['pass'])) {
223
+            $c['pass'] = $c['new_pass'];
224
+        }
225
+        $err = auteur_instituer($id_auteur, $c);
226
+        $session = array_merge($session, $c);
227
+    }
228
+
229
+    // .. mettre a jour les sessions de cet auteur
230
+    include_spip('inc/session');
231
+    $session['id_auteur'] = $id_auteur;
232
+    unset($session['new_login']);
233
+    unset($session['new_pass']);
234
+    actualiser_sessions($session);
235
+
236
+    return $err;
237 237
 }
238 238
 
239 239
 /**
@@ -254,9 +254,9 @@  discard block
 block discarded – undo
254 254
  * @return string
255 255
  */
256 256
 function auteur_associer($id_auteur, $objets, $qualif = null) {
257
-	include_spip('action/editer_liens');
257
+    include_spip('action/editer_liens');
258 258
 
259
-	return objet_associer(['auteur' => $id_auteur], $objets, $qualif);
259
+    return objet_associer(['auteur' => $id_auteur], $objets, $qualif);
260 260
 }
261 261
 
262 262
 /**
@@ -275,9 +275,9 @@  discard block
 block discarded – undo
275 275
  * @return string
276 276
  */
277 277
 function auteur_dissocier($id_auteur, $objets) {
278
-	include_spip('action/editer_liens');
278
+    include_spip('action/editer_liens');
279 279
 
280
-	return objet_dissocier(['auteur' => $id_auteur], $objets);
280
+    return objet_dissocier(['auteur' => $id_auteur], $objets);
281 281
 }
282 282
 
283 283
 /**
@@ -298,9 +298,9 @@  discard block
 block discarded – undo
298 298
  * @return bool|int
299 299
  */
300 300
 function auteur_qualifier($id_auteur, $objets, $qualif) {
301
-	include_spip('action/editer_liens');
301
+    include_spip('action/editer_liens');
302 302
 
303
-	return objet_qualifier_liens(['auteur' => $id_auteur], $objets, $qualif);
303
+    return objet_qualifier_liens(['auteur' => $id_auteur], $objets, $qualif);
304 304
 }
305 305
 
306 306
 
@@ -319,160 +319,160 @@  discard block
 block discarded – undo
319 319
  * @return bool|string
320 320
  */
321 321
 function auteur_instituer($id_auteur, $c, $force_webmestre = false) {
322
-	if (!$id_auteur = intval($id_auteur)) {
323
-		return false;
324
-	}
325
-	$erreurs = []; // contiendra les differentes erreurs a traduire par _T()
326
-	$champs = [];
327
-
328
-	// les memoriser pour les faire passer dans le pipeline pre_edition
329
-	if (isset($c['login']) and strlen($c['login'])) {
330
-		$champs['login'] = $c['login'];
331
-	}
332
-	if (isset($c['pass']) and strlen($c['pass'])) {
333
-		$champs['pass'] = $c['pass'];
334
-	}
335
-
336
-	$statut = $statut_ancien = sql_getfetsel('statut', 'spip_auteurs', 'id_auteur=' . intval($id_auteur));
337
-
338
-	if (
339
-		isset($c['statut'])
340
-		and (autoriser('modifier', 'auteur', $id_auteur, null, ['statut' => $c['statut']]))
341
-	) {
342
-		$statut = $champs['statut'] = $c['statut'];
343
-	}
344
-
345
-	// Restreindre avant de declarer l'auteur
346
-	// (section critique sur les droits)
347
-	if (isset($c['id_parent']) and $c['id_parent']) {
348
-		if (is_array($c['restreintes'])) {
349
-			$c['restreintes'][] = $c['id_parent'];
350
-		} else {
351
-			$c['restreintes'] = [$c['id_parent']];
352
-		}
353
-	}
354
-
355
-	if (
356
-		isset($c['webmestre'])
357
-		and ($force_webmestre or autoriser('modifier', 'auteur', $id_auteur, null, ['webmestre' => '?']))
358
-	) {
359
-		$champs['webmestre'] = $c['webmestre'] == 'oui' ? 'oui' : 'non';
360
-	}
361
-
362
-	// si statut change et n'est pas 0minirezo, on force webmestre a non
363
-	if (isset($c['statut']) and $c['statut'] !== '0minirezo') {
364
-		$champs['webmestre'] = $c['webmestre'] = 'non';
365
-	}
366
-
367
-	// Envoyer aux plugins
368
-	$champs = pipeline(
369
-		'pre_edition',
370
-		[
371
-			'args' => [
372
-				'table' => 'spip_auteurs',
373
-				'id_objet' => $id_auteur,
374
-				'action' => 'instituer',
375
-				'statut_ancien' => $statut_ancien,
376
-			],
377
-			'data' => $champs
378
-		]
379
-	);
380
-
381
-	if (
382
-		isset($c['restreintes']) and is_array($c['restreintes'])
383
-		and autoriser('modifier', 'auteur', $id_auteur, null, ['restreint' => $c['restreintes']])
384
-	) {
385
-		$rubriques = array_map('intval', $c['restreintes']);
386
-		$rubriques = array_unique($rubriques);
387
-		$rubriques = array_diff($rubriques, [0]);
388
-		auteur_dissocier($id_auteur, ['rubrique' => '*']);
389
-		auteur_associer($id_auteur, ['rubrique' => $rubriques]);
390
-	}
391
-
392
-	$flag_ecrire_acces = false;
393
-	// commencer par traiter les cas particuliers des logins et pass
394
-	// avant les autres ecritures en base
395
-	if (isset($champs['login']) or isset($champs['pass'])) {
396
-		$auth_methode = sql_getfetsel('source', 'spip_auteurs', 'id_auteur=' . intval($id_auteur));
397
-		include_spip('inc/auth');
398
-		if (isset($champs['login']) and strlen($champs['login'])) {
399
-			if (!auth_modifier_login($auth_methode, $champs['login'], $id_auteur)) {
400
-				$erreurs[] = 'ecrire:impossible_modifier_login_auteur';
401
-			}
402
-		}
403
-		if (isset($champs['pass']) and strlen($champs['pass'])) {
404
-			$champs['login'] = sql_getfetsel('login', 'spip_auteurs', 'id_auteur=' . intval($id_auteur));
405
-			if (!auth_modifier_pass($auth_methode, $champs['login'], $champs['pass'], $id_auteur)) {
406
-				$erreurs[] = 'ecrire:impossible_modifier_pass_auteur';
407
-			}
408
-		}
409
-		unset($champs['login']);
410
-		unset($champs['pass']);
411
-		$flag_ecrire_acces = true;
412
-	}
413
-
414
-	if (!(is_countable($champs) ? count($champs) : 0)) {
415
-		return implode(' ', array_map('_T', $erreurs));
416
-	}
417
-	sql_updateq('spip_auteurs', $champs, 'id_auteur=' . $id_auteur);
418
-
419
-	// .. mettre a jour les fichiers .htpasswd et .htpasswd-admin
420
-	if (
421
-		$flag_ecrire_acces
422
-		or isset($champs['statut'])
423
-	) {
424
-		include_spip('inc/acces');
425
-		ecrire_acces();
426
-	}
427
-
428
-	// Invalider les caches
429
-	include_spip('inc/invalideur');
430
-	suivre_invalideur("id='auteur/$id_auteur'");
431
-
432
-	// Pipeline
433
-	pipeline(
434
-		'post_edition',
435
-		[
436
-			'args' => [
437
-				'table' => 'spip_auteurs',
438
-				'id_objet' => $id_auteur,
439
-				'action' => 'instituer',
440
-				'statut_ancien' => $statut_ancien,
441
-			],
442
-			'data' => $champs
443
-		]
444
-	);
445
-
446
-	// Notifications
447
-	if ($notifications = charger_fonction('notifications', 'inc')) {
448
-		$notifications(
449
-			'auteur_instituer',
450
-			$id_auteur,
451
-			[
452
-				'statut' => $statut,
453
-				'statut_ancien' => $statut_ancien,
454
-				'champs' => $champs,
455
-			]
456
-		);
457
-		$notifications(
458
-			'objet_instituer',
459
-			$id_auteur,
460
-			[
461
-				'objet' => 'auteur',
462
-				'id_objet' => $id_auteur,
463
-				'statut' => $statut,
464
-				'statut_ancien' => $statut_ancien,
465
-				'champs' => $champs,
466
-			]
467
-		);
322
+    if (!$id_auteur = intval($id_auteur)) {
323
+        return false;
324
+    }
325
+    $erreurs = []; // contiendra les differentes erreurs a traduire par _T()
326
+    $champs = [];
327
+
328
+    // les memoriser pour les faire passer dans le pipeline pre_edition
329
+    if (isset($c['login']) and strlen($c['login'])) {
330
+        $champs['login'] = $c['login'];
331
+    }
332
+    if (isset($c['pass']) and strlen($c['pass'])) {
333
+        $champs['pass'] = $c['pass'];
334
+    }
335
+
336
+    $statut = $statut_ancien = sql_getfetsel('statut', 'spip_auteurs', 'id_auteur=' . intval($id_auteur));
337
+
338
+    if (
339
+        isset($c['statut'])
340
+        and (autoriser('modifier', 'auteur', $id_auteur, null, ['statut' => $c['statut']]))
341
+    ) {
342
+        $statut = $champs['statut'] = $c['statut'];
343
+    }
344
+
345
+    // Restreindre avant de declarer l'auteur
346
+    // (section critique sur les droits)
347
+    if (isset($c['id_parent']) and $c['id_parent']) {
348
+        if (is_array($c['restreintes'])) {
349
+            $c['restreintes'][] = $c['id_parent'];
350
+        } else {
351
+            $c['restreintes'] = [$c['id_parent']];
352
+        }
353
+    }
354
+
355
+    if (
356
+        isset($c['webmestre'])
357
+        and ($force_webmestre or autoriser('modifier', 'auteur', $id_auteur, null, ['webmestre' => '?']))
358
+    ) {
359
+        $champs['webmestre'] = $c['webmestre'] == 'oui' ? 'oui' : 'non';
360
+    }
361
+
362
+    // si statut change et n'est pas 0minirezo, on force webmestre a non
363
+    if (isset($c['statut']) and $c['statut'] !== '0minirezo') {
364
+        $champs['webmestre'] = $c['webmestre'] = 'non';
365
+    }
366
+
367
+    // Envoyer aux plugins
368
+    $champs = pipeline(
369
+        'pre_edition',
370
+        [
371
+            'args' => [
372
+                'table' => 'spip_auteurs',
373
+                'id_objet' => $id_auteur,
374
+                'action' => 'instituer',
375
+                'statut_ancien' => $statut_ancien,
376
+            ],
377
+            'data' => $champs
378
+        ]
379
+    );
380
+
381
+    if (
382
+        isset($c['restreintes']) and is_array($c['restreintes'])
383
+        and autoriser('modifier', 'auteur', $id_auteur, null, ['restreint' => $c['restreintes']])
384
+    ) {
385
+        $rubriques = array_map('intval', $c['restreintes']);
386
+        $rubriques = array_unique($rubriques);
387
+        $rubriques = array_diff($rubriques, [0]);
388
+        auteur_dissocier($id_auteur, ['rubrique' => '*']);
389
+        auteur_associer($id_auteur, ['rubrique' => $rubriques]);
390
+    }
391
+
392
+    $flag_ecrire_acces = false;
393
+    // commencer par traiter les cas particuliers des logins et pass
394
+    // avant les autres ecritures en base
395
+    if (isset($champs['login']) or isset($champs['pass'])) {
396
+        $auth_methode = sql_getfetsel('source', 'spip_auteurs', 'id_auteur=' . intval($id_auteur));
397
+        include_spip('inc/auth');
398
+        if (isset($champs['login']) and strlen($champs['login'])) {
399
+            if (!auth_modifier_login($auth_methode, $champs['login'], $id_auteur)) {
400
+                $erreurs[] = 'ecrire:impossible_modifier_login_auteur';
401
+            }
402
+        }
403
+        if (isset($champs['pass']) and strlen($champs['pass'])) {
404
+            $champs['login'] = sql_getfetsel('login', 'spip_auteurs', 'id_auteur=' . intval($id_auteur));
405
+            if (!auth_modifier_pass($auth_methode, $champs['login'], $champs['pass'], $id_auteur)) {
406
+                $erreurs[] = 'ecrire:impossible_modifier_pass_auteur';
407
+            }
408
+        }
409
+        unset($champs['login']);
410
+        unset($champs['pass']);
411
+        $flag_ecrire_acces = true;
412
+    }
413
+
414
+    if (!(is_countable($champs) ? count($champs) : 0)) {
415
+        return implode(' ', array_map('_T', $erreurs));
416
+    }
417
+    sql_updateq('spip_auteurs', $champs, 'id_auteur=' . $id_auteur);
418
+
419
+    // .. mettre a jour les fichiers .htpasswd et .htpasswd-admin
420
+    if (
421
+        $flag_ecrire_acces
422
+        or isset($champs['statut'])
423
+    ) {
424
+        include_spip('inc/acces');
425
+        ecrire_acces();
426
+    }
427
+
428
+    // Invalider les caches
429
+    include_spip('inc/invalideur');
430
+    suivre_invalideur("id='auteur/$id_auteur'");
431
+
432
+    // Pipeline
433
+    pipeline(
434
+        'post_edition',
435
+        [
436
+            'args' => [
437
+                'table' => 'spip_auteurs',
438
+                'id_objet' => $id_auteur,
439
+                'action' => 'instituer',
440
+                'statut_ancien' => $statut_ancien,
441
+            ],
442
+            'data' => $champs
443
+        ]
444
+    );
445
+
446
+    // Notifications
447
+    if ($notifications = charger_fonction('notifications', 'inc')) {
448
+        $notifications(
449
+            'auteur_instituer',
450
+            $id_auteur,
451
+            [
452
+                'statut' => $statut,
453
+                'statut_ancien' => $statut_ancien,
454
+                'champs' => $champs,
455
+            ]
456
+        );
457
+        $notifications(
458
+            'objet_instituer',
459
+            $id_auteur,
460
+            [
461
+                'objet' => 'auteur',
462
+                'id_objet' => $id_auteur,
463
+                'statut' => $statut,
464
+                'statut_ancien' => $statut_ancien,
465
+                'champs' => $champs,
466
+            ]
467
+        );
468 468
 		
469
-		// Rétro-compat
470
-		$notifications(
471
-			'instituerauteur',
472
-			$id_auteur,
473
-			['statut' => $statut, 'statut_ancien' => $statut_ancien]
474
-		);
475
-	}
476
-
477
-	return implode(' ', array_map('_T', $erreurs));
469
+        // Rétro-compat
470
+        $notifications(
471
+            'instituerauteur',
472
+            $id_auteur,
473
+            ['statut' => $statut, 'statut_ancien' => $statut_ancien]
474
+        );
475
+    }
476
+
477
+    return implode(' ', array_map('_T', $erreurs));
478 478
 }
Please login to merge, or discard this patch.
ecrire/action/instituer_objet.php 1 patch
Indentation   +19 added lines, -19 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
 /**
@@ -29,24 +29,24 @@  discard block
 block discarded – undo
29 29
  */
30 30
 function action_instituer_objet_dist($arg = null) {
31 31
 
32
-	if (is_null($arg)) {
33
-		$securiser_action = charger_fonction('securiser_action', 'inc');
34
-		$arg = $securiser_action();
35
-	}
32
+    if (is_null($arg)) {
33
+        $securiser_action = charger_fonction('securiser_action', 'inc');
34
+        $arg = $securiser_action();
35
+    }
36 36
 
37
-	[$objet, $id_objet, $statut] = preg_split('/\W/', $arg);
38
-	if (!$statut) {
39
-		$statut = _request('statut_nouv');
40
-	} // cas POST
41
-	if (!$statut) {
42
-		return;
43
-	} // impossible mais sait-on jamais
37
+    [$objet, $id_objet, $statut] = preg_split('/\W/', $arg);
38
+    if (!$statut) {
39
+        $statut = _request('statut_nouv');
40
+    } // cas POST
41
+    if (!$statut) {
42
+        return;
43
+    } // impossible mais sait-on jamais
44 44
 
45
-	if (
46
-		$id_objet = intval($id_objet)
47
-		and autoriser('instituer', $objet, $id_objet, '', ['statut' => $statut])
48
-	) {
49
-		include_spip('action/editer_objet');
50
-		objet_modifier($objet, $id_objet, ['statut' => $statut]);
51
-	}
45
+    if (
46
+        $id_objet = intval($id_objet)
47
+        and autoriser('instituer', $objet, $id_objet, '', ['statut' => $statut])
48
+    ) {
49
+        include_spip('action/editer_objet');
50
+        objet_modifier($objet, $id_objet, ['statut' => $statut]);
51
+    }
52 52
 }
Please login to merge, or discard this patch.
ecrire/action/instituer_langue_rubrique.php 1 patch
Indentation   +35 added lines, -35 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
 /**
@@ -25,41 +25,41 @@  discard block
 block discarded – undo
25 25
  **/
26 26
 function action_instituer_langue_rubrique_dist() {
27 27
 
28
-	$securiser_action = charger_fonction('securiser_action', 'inc');
29
-	$arg = $securiser_action();
30
-	$changer_lang = _request('changer_lang');
28
+    $securiser_action = charger_fonction('securiser_action', 'inc');
29
+    $arg = $securiser_action();
30
+    $changer_lang = _request('changer_lang');
31 31
 
32
-	[$id_rubrique, $id_parent] = preg_split('/\W/', $arg);
32
+    [$id_rubrique, $id_parent] = preg_split('/\W/', $arg);
33 33
 
34
-	if (
35
-		$changer_lang
36
-		and $id_rubrique > 0
37
-		and $GLOBALS['meta']['multi_rubriques'] == 'oui'
38
-		and ($GLOBALS['meta']['multi_secteurs'] == 'non' or $id_parent == 0)
39
-	) {
40
-		if ($changer_lang != 'herit') {
41
-			sql_updateq(
42
-				'spip_rubriques',
43
-				['lang' => $changer_lang, 'langue_choisie' => 'oui'],
44
-				"id_rubrique=$id_rubrique"
45
-			);
46
-		} else {
47
-			if ($id_parent == 0) {
48
-				$langue_parent = $GLOBALS['meta']['langue_site'];
49
-			} else {
50
-				$langue_parent = sql_getfetsel('lang', 'spip_rubriques', "id_rubrique=$id_parent");
51
-			}
52
-			sql_updateq(
53
-				'spip_rubriques',
54
-				['lang' => $langue_parent, 'langue_choisie' => 'non'],
55
-				"id_rubrique=$id_rubrique"
56
-			);
57
-		}
58
-		include_spip('inc/rubriques');
59
-		calculer_langues_rubriques();
34
+    if (
35
+        $changer_lang
36
+        and $id_rubrique > 0
37
+        and $GLOBALS['meta']['multi_rubriques'] == 'oui'
38
+        and ($GLOBALS['meta']['multi_secteurs'] == 'non' or $id_parent == 0)
39
+    ) {
40
+        if ($changer_lang != 'herit') {
41
+            sql_updateq(
42
+                'spip_rubriques',
43
+                ['lang' => $changer_lang, 'langue_choisie' => 'oui'],
44
+                "id_rubrique=$id_rubrique"
45
+            );
46
+        } else {
47
+            if ($id_parent == 0) {
48
+                $langue_parent = $GLOBALS['meta']['langue_site'];
49
+            } else {
50
+                $langue_parent = sql_getfetsel('lang', 'spip_rubriques', "id_rubrique=$id_parent");
51
+            }
52
+            sql_updateq(
53
+                'spip_rubriques',
54
+                ['lang' => $langue_parent, 'langue_choisie' => 'non'],
55
+                "id_rubrique=$id_rubrique"
56
+            );
57
+        }
58
+        include_spip('inc/rubriques');
59
+        calculer_langues_rubriques();
60 60
 
61
-		// invalider les caches marques de cette rubrique
62
-		include_spip('inc/invalideur');
63
-		suivre_invalideur("id='rubrique/$id_rubrique'");
64
-	}
61
+        // invalider les caches marques de cette rubrique
62
+        include_spip('inc/invalideur');
63
+        suivre_invalideur("id='rubrique/$id_rubrique'");
64
+    }
65 65
 }
Please login to merge, or discard this patch.
ecrire/action/supprimer_lien.php 1 patch
Indentation   +9 added lines, -9 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
 
@@ -35,14 +35,14 @@  discard block
 block discarded – undo
35 35
  * @return void
36 36
  */
37 37
 function action_supprimer_lien_dist($arg = null) {
38
-	if (is_null($arg)) {
39
-		$securiser_action = charger_fonction('securiser_action', 'inc');
40
-		$arg = $securiser_action();
41
-	}
38
+    if (is_null($arg)) {
39
+        $securiser_action = charger_fonction('securiser_action', 'inc');
40
+        $arg = $securiser_action();
41
+    }
42 42
 
43
-	$arg = explode('-', $arg);
44
-	[$objet_source, $ids, $objet_lie, $idl] = $arg;
43
+    $arg = explode('-', $arg);
44
+    [$objet_source, $ids, $objet_lie, $idl] = $arg;
45 45
 
46
-	include_spip('action/editer_liens');
47
-	objet_dissocier([$objet_source => $ids], [$objet_lie => $idl]);
46
+    include_spip('action/editer_liens');
47
+    objet_dissocier([$objet_source => $ids], [$objet_lie => $idl]);
48 48
 }
Please login to merge, or discard this patch.
ecrire/action/tester_taille.php 2 patches
Indentation   +79 added lines, -79 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
 include_spip('inc/headers');
24 24
 
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
  *     Sortie du buffer
36 36
  **/
37 37
 function action_tester_taille_error_handler($output) {
38
-	// on est ici, donc echec lors de la creation de l'image
39
-	if (!empty($GLOBALS['redirect'])) {
40
-		return redirige_formulaire($GLOBALS['redirect']);
41
-	}
38
+    // on est ici, donc echec lors de la creation de l'image
39
+    if (!empty($GLOBALS['redirect'])) {
40
+        return redirige_formulaire($GLOBALS['redirect']);
41
+    }
42 42
 
43
-	return $output;
43
+    return $output;
44 44
 }
45 45
 
46 46
 
@@ -58,77 +58,77 @@  discard block
 block discarded – undo
58 58
  **/
59 59
 function action_tester_taille_dist() {
60 60
 
61
-	if (!autoriser('configurer')) {
62
-		return;
63
-	}
64
-
65
-	$taille = _request('arg');
66
-	$taille = explode('-', $taille);
67
-
68
-	$GLOBALS['taille_max'] = end($taille);
69
-	$GLOBALS['taille_min'] = 0;
70
-	if (count($taille) > 1) {
71
-		$GLOBALS['taille_min'] = reset($taille);
72
-	}
73
-
74
-	// si l'intervalle est assez petit, on garde la valeur min
75
-	if ($GLOBALS['taille_max'] * $GLOBALS['taille_max'] - $GLOBALS['taille_min'] * $GLOBALS['taille_min'] < 50000) {
76
-		$t = ($GLOBALS['taille_min'] * $GLOBALS['taille_min']);
77
-		if ($GLOBALS['taille_min'] !== $GLOBALS['taille_max']) {
78
-			$t = $t * 0.9; // marge de securite
79
-			echo round($t / 1_000_000, 3) . ' Mpx';
80
-		} else {
81
-			// c'est un cas "on a reussi la borne max initiale, donc on a pas de limite connue"
82
-			$t = 0;
83
-			echo '&infin;';
84
-		}
85
-		ecrire_meta('max_taille_vignettes', $t, 'non');
86
-		die();
87
-	}
88
-
89
-	$taille = $GLOBALS['taille_test'] = round(($GLOBALS['taille_max'] + $GLOBALS['taille_min']) / 2);
90
-
91
-	include_spip('inc/filtres');
92
-	// des inclusions representatives d'un hit prive et/ou public pour la conso memoire
93
-	include_spip('public/assembler');
94
-	include_spip('public/balises');
95
-	include_spip('public/boucles');
96
-	include_spip('public/cacher');
97
-	include_spip('public/compiler');
98
-	include_spip('public/composer');
99
-	include_spip('public/criteres');
100
-	include_spip('public/interfaces');
101
-	include_spip('public/parametrer');
102
-	include_spip('public/phraser_html');
103
-	include_spip('public/references');
104
-
105
-	include_spip('inc/presentation');
106
-	include_spip('inc/charsets');
107
-	include_spip('inc/documents');
108
-	include_spip('inc/header');
109
-	propre('<doc1>'); // charger propre avec le trairement d'un modele
110
-
111
-	$i = _request('i') + 1;
112
-	$image_source = chemin_image('test.png');
113
-	$GLOBALS['redirect'] = generer_url_action(
114
-		'tester_taille',
115
-		"i=$i&arg=" . $GLOBALS['taille_min'] . '-' . $GLOBALS['taille_test']
116
-	);
117
-
118
-	ob_start('action_tester_taille_error_handler');
119
-	filtrer('image_recadre', $image_source, $taille, $taille);
120
-	$GLOBALS['redirect'] = generer_url_action('tester_taille', "i=$i&arg=$taille-" . $GLOBALS['taille_max']);
121
-
122
-	// si la valeur intermediaire a reussi, on teste la valeur maxi qui est peut etre sous estimee
123
-	// si $GLOBALS['taille_min']==0 (car on est au premier coup)
124
-	if ($GLOBALS['taille_min'] == 0) {
125
-		$taille = $GLOBALS['taille_max'];
126
-		filtrer('image_recadre', $image_source, $taille, $taille);
127
-		$GLOBALS['redirect'] = generer_url_action('tester_taille', "i=$i&arg=$taille-" . $GLOBALS['taille_max']);
128
-	}
129
-	ob_end_clean();
130
-
131
-
132
-	// on est ici, donc pas de plantage
133
-	echo redirige_formulaire($GLOBALS['redirect']);
61
+    if (!autoriser('configurer')) {
62
+        return;
63
+    }
64
+
65
+    $taille = _request('arg');
66
+    $taille = explode('-', $taille);
67
+
68
+    $GLOBALS['taille_max'] = end($taille);
69
+    $GLOBALS['taille_min'] = 0;
70
+    if (count($taille) > 1) {
71
+        $GLOBALS['taille_min'] = reset($taille);
72
+    }
73
+
74
+    // si l'intervalle est assez petit, on garde la valeur min
75
+    if ($GLOBALS['taille_max'] * $GLOBALS['taille_max'] - $GLOBALS['taille_min'] * $GLOBALS['taille_min'] < 50000) {
76
+        $t = ($GLOBALS['taille_min'] * $GLOBALS['taille_min']);
77
+        if ($GLOBALS['taille_min'] !== $GLOBALS['taille_max']) {
78
+            $t = $t * 0.9; // marge de securite
79
+            echo round($t / 1_000_000, 3) . ' Mpx';
80
+        } else {
81
+            // c'est un cas "on a reussi la borne max initiale, donc on a pas de limite connue"
82
+            $t = 0;
83
+            echo '&infin;';
84
+        }
85
+        ecrire_meta('max_taille_vignettes', $t, 'non');
86
+        die();
87
+    }
88
+
89
+    $taille = $GLOBALS['taille_test'] = round(($GLOBALS['taille_max'] + $GLOBALS['taille_min']) / 2);
90
+
91
+    include_spip('inc/filtres');
92
+    // des inclusions representatives d'un hit prive et/ou public pour la conso memoire
93
+    include_spip('public/assembler');
94
+    include_spip('public/balises');
95
+    include_spip('public/boucles');
96
+    include_spip('public/cacher');
97
+    include_spip('public/compiler');
98
+    include_spip('public/composer');
99
+    include_spip('public/criteres');
100
+    include_spip('public/interfaces');
101
+    include_spip('public/parametrer');
102
+    include_spip('public/phraser_html');
103
+    include_spip('public/references');
104
+
105
+    include_spip('inc/presentation');
106
+    include_spip('inc/charsets');
107
+    include_spip('inc/documents');
108
+    include_spip('inc/header');
109
+    propre('<doc1>'); // charger propre avec le trairement d'un modele
110
+
111
+    $i = _request('i') + 1;
112
+    $image_source = chemin_image('test.png');
113
+    $GLOBALS['redirect'] = generer_url_action(
114
+        'tester_taille',
115
+        "i=$i&arg=" . $GLOBALS['taille_min'] . '-' . $GLOBALS['taille_test']
116
+    );
117
+
118
+    ob_start('action_tester_taille_error_handler');
119
+    filtrer('image_recadre', $image_source, $taille, $taille);
120
+    $GLOBALS['redirect'] = generer_url_action('tester_taille', "i=$i&arg=$taille-" . $GLOBALS['taille_max']);
121
+
122
+    // si la valeur intermediaire a reussi, on teste la valeur maxi qui est peut etre sous estimee
123
+    // si $GLOBALS['taille_min']==0 (car on est au premier coup)
124
+    if ($GLOBALS['taille_min'] == 0) {
125
+        $taille = $GLOBALS['taille_max'];
126
+        filtrer('image_recadre', $image_source, $taille, $taille);
127
+        $GLOBALS['redirect'] = generer_url_action('tester_taille', "i=$i&arg=$taille-" . $GLOBALS['taille_max']);
128
+    }
129
+    ob_end_clean();
130
+
131
+
132
+    // on est ici, donc pas de plantage
133
+    echo redirige_formulaire($GLOBALS['redirect']);
134 134
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		$t = ($GLOBALS['taille_min'] * $GLOBALS['taille_min']);
77 77
 		if ($GLOBALS['taille_min'] !== $GLOBALS['taille_max']) {
78 78
 			$t = $t * 0.9; // marge de securite
79
-			echo round($t / 1_000_000, 3) . ' Mpx';
79
+			echo round($t / 1_000_000, 3).' Mpx';
80 80
 		} else {
81 81
 			// c'est un cas "on a reussi la borne max initiale, donc on a pas de limite connue"
82 82
 			$t = 0;
@@ -112,19 +112,19 @@  discard block
 block discarded – undo
112 112
 	$image_source = chemin_image('test.png');
113 113
 	$GLOBALS['redirect'] = generer_url_action(
114 114
 		'tester_taille',
115
-		"i=$i&arg=" . $GLOBALS['taille_min'] . '-' . $GLOBALS['taille_test']
115
+		"i=$i&arg=".$GLOBALS['taille_min'].'-'.$GLOBALS['taille_test']
116 116
 	);
117 117
 
118 118
 	ob_start('action_tester_taille_error_handler');
119 119
 	filtrer('image_recadre', $image_source, $taille, $taille);
120
-	$GLOBALS['redirect'] = generer_url_action('tester_taille', "i=$i&arg=$taille-" . $GLOBALS['taille_max']);
120
+	$GLOBALS['redirect'] = generer_url_action('tester_taille', "i=$i&arg=$taille-".$GLOBALS['taille_max']);
121 121
 
122 122
 	// si la valeur intermediaire a reussi, on teste la valeur maxi qui est peut etre sous estimee
123 123
 	// si $GLOBALS['taille_min']==0 (car on est au premier coup)
124 124
 	if ($GLOBALS['taille_min'] == 0) {
125 125
 		$taille = $GLOBALS['taille_max'];
126 126
 		filtrer('image_recadre', $image_source, $taille, $taille);
127
-		$GLOBALS['redirect'] = generer_url_action('tester_taille', "i=$i&arg=$taille-" . $GLOBALS['taille_max']);
127
+		$GLOBALS['redirect'] = generer_url_action('tester_taille', "i=$i&arg=$taille-".$GLOBALS['taille_max']);
128 128
 	}
129 129
 	ob_end_clean();
130 130
 
Please login to merge, or discard this patch.
ecrire/action/ajouter_lien.php 1 patch
Indentation   +9 added lines, -9 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
 /**
@@ -34,14 +34,14 @@  discard block
 block discarded – undo
34 34
  * @return void
35 35
  */
36 36
 function action_ajouter_lien_dist($arg = null) {
37
-	if (is_null($arg)) {
38
-		$securiser_action = charger_fonction('securiser_action', 'inc');
39
-		$arg = $securiser_action();
40
-	}
37
+    if (is_null($arg)) {
38
+        $securiser_action = charger_fonction('securiser_action', 'inc');
39
+        $arg = $securiser_action();
40
+    }
41 41
 
42
-	$arg = explode('-', $arg);
43
-	[$objet_source, $ids, $objet_lie, $idl] = $arg;
42
+    $arg = explode('-', $arg);
43
+    [$objet_source, $ids, $objet_lie, $idl] = $arg;
44 44
 
45
-	include_spip('action/editer_liens');
46
-	objet_associer([$objet_source => $ids], [$objet_lie => $idl]);
45
+    include_spip('action/editer_liens');
46
+    objet_associer([$objet_source => $ids], [$objet_lie => $idl]);
47 47
 }
Please login to merge, or discard this patch.
ecrire/action/debloquer_edition.php 1 patch
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  */
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 
23 23
 /**
@@ -31,17 +31,17 @@  discard block
 block discarded – undo
31 31
  */
32 32
 function action_debloquer_edition_dist() {
33 33
 
34
-	$securiser_action = charger_fonction('securiser_action', 'inc');
35
-	$arg = $securiser_action();
34
+    $securiser_action = charger_fonction('securiser_action', 'inc');
35
+    $arg = $securiser_action();
36 36
 
37
-	if ($arg) {
38
-		include_spip('inc/drapeau_edition');
39
-		if ($arg == 'tous') {
40
-			debloquer_tous($GLOBALS['visiteur_session']['id_auteur']);
41
-		} else {
42
-			$arg = explode('-', $arg);
43
-			[$objet, $id_objet] = $arg;
44
-			debloquer_edition($GLOBALS['visiteur_session']['id_auteur'], $id_objet, $objet);
45
-		}
46
-	}
37
+    if ($arg) {
38
+        include_spip('inc/drapeau_edition');
39
+        if ($arg == 'tous') {
40
+            debloquer_tous($GLOBALS['visiteur_session']['id_auteur']);
41
+        } else {
42
+            $arg = explode('-', $arg);
43
+            [$objet, $id_objet] = $arg;
44
+            debloquer_edition($GLOBALS['visiteur_session']['id_auteur'], $id_objet, $objet);
45
+        }
46
+    }
47 47
 }
Please login to merge, or discard this patch.
ecrire/action/cookie.php 2 patches
Indentation   +85 added lines, -85 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
 include_spip('inc/actions');
@@ -33,93 +33,93 @@  discard block
 block discarded – undo
33 33
  * @return void
34 34
  */
35 35
 function action_cookie_dist($set_cookie_admin = null, $change_session = null) {
36
-	$redirect_echec = $redirect = null;
37
-	$test_echec_cookie = null;
38
-	$url = '';
39
-	if (is_null($set_cookie_admin)) {
40
-		$set_cookie_admin = _request('cookie_admin');
41
-		$change_session = _request('change_session');
42
-		$test_echec_cookie = _request('test_echec_cookie');
36
+    $redirect_echec = $redirect = null;
37
+    $test_echec_cookie = null;
38
+    $url = '';
39
+    if (is_null($set_cookie_admin)) {
40
+        $set_cookie_admin = _request('cookie_admin');
41
+        $change_session = _request('change_session');
42
+        $test_echec_cookie = _request('test_echec_cookie');
43 43
 
44
-		// La cible de notre operation de connexion
45
-		$url = securiser_redirect_action(_request('url'));
46
-		$redirect = $url ?: generer_url_ecrire('accueil');
47
-		$redirect_echec = _request('url_echec');
48
-		if (!isset($redirect_echec)) {
49
-			if (strpos($redirect, (string) _DIR_RESTREINT_ABS) !== false) {
50
-				$redirect_echec = generer_url_public('login', '', true);
51
-			} else {
52
-				$redirect_echec = $redirect;
53
-			}
54
-		}
55
-	}
44
+        // La cible de notre operation de connexion
45
+        $url = securiser_redirect_action(_request('url'));
46
+        $redirect = $url ?: generer_url_ecrire('accueil');
47
+        $redirect_echec = _request('url_echec');
48
+        if (!isset($redirect_echec)) {
49
+            if (strpos($redirect, (string) _DIR_RESTREINT_ABS) !== false) {
50
+                $redirect_echec = generer_url_public('login', '', true);
51
+            } else {
52
+                $redirect_echec = $redirect;
53
+            }
54
+        }
55
+    }
56 56
 
57 57
 
58
-	// rejoue le cookie pour renouveler spip_session
59
-	if ($change_session == 'oui') {
60
-		$session = charger_fonction('session', 'inc');
61
-		$session(true);
62
-		spip_log('statut 204 pour ' . $_SERVER['REQUEST_URI']);
63
-		http_response_code(204); // No Content
64
-		return;
65
-	}
58
+    // rejoue le cookie pour renouveler spip_session
59
+    if ($change_session == 'oui') {
60
+        $session = charger_fonction('session', 'inc');
61
+        $session(true);
62
+        spip_log('statut 204 pour ' . $_SERVER['REQUEST_URI']);
63
+        http_response_code(204); // No Content
64
+        return;
65
+    }
66 66
 
67
-	// tentative de connexion en auth_http
68
-	if (_request('essai_auth_http') and !$GLOBALS['ignore_auth_http']) {
69
-		include_spip('inc/auth');
70
-		if (
71
-			@$_SERVER['PHP_AUTH_USER']
72
-			and @$_SERVER['PHP_AUTH_PW']
73
-			and $auteur = lire_php_auth($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])
74
-		) {
75
-			auth_loger($auteur);
76
-			redirige_par_entete(parametre_url($redirect, 't', time(), '&'));
77
-		} else {
78
-			ask_php_auth(
79
-				_T('info_connexion_refusee'),
80
-				_T('login_login_pass_incorrect'),
81
-				_T('login_retour_site'),
82
-				'url=' . rawurlencode($redirect),
83
-				_T('login_nouvelle_tentative'),
84
-				(strpos($url, (string) _DIR_RESTREINT_ABS) !== false)
85
-			);
86
-		}
87
-	} else {
88
-		// en cas de login sur bonjour=oui, on tente de poser un cookie
89
-		// puis de passer au login qui diagnostiquera l'echec de cookie
90
-		// le cas echeant.
91
-		if ($test_echec_cookie == 'oui') {
92
-			spip_setcookie('spip_session', 'test_echec_cookie');
93
-			if ($redirect) {
94
-				$redirect = parametre_url(
95
-					parametre_url($redirect_echec, 'var_echec_cookie', 'oui', '&'),
96
-					'url',
97
-					rawurlencode($redirect),
98
-					'&'
99
-				);
100
-			}
101
-		} else {
102
-			$cook = $_COOKIE['spip_admin'] ?? '';
103
-			// Suppression cookie d'admin ?
104
-			if ($set_cookie_admin == 'non') {
105
-				if ($cook) {
106
-					spip_setcookie('spip_admin', $cook, [
107
-						'expires' => time() - 3600 * 24
108
-					]);
109
-				}
110
-			} // Ajout de cookie d'admin
111
-			else {
112
-				if ($set_cookie_admin and _DUREE_COOKIE_ADMIN) {
113
-					spip_setcookie('spip_admin', $set_cookie_admin, [
114
-						'expires' => time() + max(_DUREE_COOKIE_ADMIN, 2 * _RENOUVELLE_ALEA)
115
-					]);
116
-				}
117
-			}
118
-		}
119
-	}
67
+    // tentative de connexion en auth_http
68
+    if (_request('essai_auth_http') and !$GLOBALS['ignore_auth_http']) {
69
+        include_spip('inc/auth');
70
+        if (
71
+            @$_SERVER['PHP_AUTH_USER']
72
+            and @$_SERVER['PHP_AUTH_PW']
73
+            and $auteur = lire_php_auth($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])
74
+        ) {
75
+            auth_loger($auteur);
76
+            redirige_par_entete(parametre_url($redirect, 't', time(), '&'));
77
+        } else {
78
+            ask_php_auth(
79
+                _T('info_connexion_refusee'),
80
+                _T('login_login_pass_incorrect'),
81
+                _T('login_retour_site'),
82
+                'url=' . rawurlencode($redirect),
83
+                _T('login_nouvelle_tentative'),
84
+                (strpos($url, (string) _DIR_RESTREINT_ABS) !== false)
85
+            );
86
+        }
87
+    } else {
88
+        // en cas de login sur bonjour=oui, on tente de poser un cookie
89
+        // puis de passer au login qui diagnostiquera l'echec de cookie
90
+        // le cas echeant.
91
+        if ($test_echec_cookie == 'oui') {
92
+            spip_setcookie('spip_session', 'test_echec_cookie');
93
+            if ($redirect) {
94
+                $redirect = parametre_url(
95
+                    parametre_url($redirect_echec, 'var_echec_cookie', 'oui', '&'),
96
+                    'url',
97
+                    rawurlencode($redirect),
98
+                    '&'
99
+                );
100
+            }
101
+        } else {
102
+            $cook = $_COOKIE['spip_admin'] ?? '';
103
+            // Suppression cookie d'admin ?
104
+            if ($set_cookie_admin == 'non') {
105
+                if ($cook) {
106
+                    spip_setcookie('spip_admin', $cook, [
107
+                        'expires' => time() - 3600 * 24
108
+                    ]);
109
+                }
110
+            } // Ajout de cookie d'admin
111
+            else {
112
+                if ($set_cookie_admin and _DUREE_COOKIE_ADMIN) {
113
+                    spip_setcookie('spip_admin', $set_cookie_admin, [
114
+                        'expires' => time() + max(_DUREE_COOKIE_ADMIN, 2 * _RENOUVELLE_ALEA)
115
+                    ]);
116
+                }
117
+            }
118
+        }
119
+    }
120 120
 
121
-	// Redirection finale
122
-	if ($redirect) {
123
-		redirige_par_entete($redirect, true);
124
-	}
121
+    // Redirection finale
122
+    if ($redirect) {
123
+        redirige_par_entete($redirect, true);
124
+    }
125 125
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	if ($change_session == 'oui') {
60 60
 		$session = charger_fonction('session', 'inc');
61 61
 		$session(true);
62
-		spip_log('statut 204 pour ' . $_SERVER['REQUEST_URI']);
62
+		spip_log('statut 204 pour '.$_SERVER['REQUEST_URI']);
63 63
 		http_response_code(204); // No Content
64 64
 		return;
65 65
 	}
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 				_T('info_connexion_refusee'),
80 80
 				_T('login_login_pass_incorrect'),
81 81
 				_T('login_retour_site'),
82
-				'url=' . rawurlencode($redirect),
82
+				'url='.rawurlencode($redirect),
83 83
 				_T('login_nouvelle_tentative'),
84 84
 				(strpos($url, (string) _DIR_RESTREINT_ABS) !== false)
85 85
 			);
Please login to merge, or discard this patch.
ecrire/action/desinstaller_plugin.php 1 patch
Indentation   +25 added lines, -25 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
 /**
@@ -32,28 +32,28 @@  discard block
 block discarded – undo
32 32
  */
33 33
 function action_desinstaller_plugin_dist() {
34 34
 
35
-	$securiser_action = charger_fonction('securiser_action', 'inc');
36
-	$arg = $securiser_action();
37
-	[$dir_plugins, $plugin] = explode('::', $arg);
38
-	$dir_type = '_DIR_PLUGINS';
39
-	if (defined('_DIR_PLUGINS_SUPPL') and $dir_plugins == _DIR_PLUGINS_SUPPL) {
40
-		$dir_type = '_DIR_PLUGINS_SUPPL';
41
-	}
42
-	$installer_plugins = charger_fonction('installer', 'plugins');
43
-	$infos = $installer_plugins($plugin, 'uninstall', $dir_type);
44
-	if ($infos and !$infos['install_test'][0]) {
45
-		include_spip('inc/plugin');
46
-		ecrire_plugin_actifs([$plugin], false, 'enleve');
47
-		$erreur = '';
48
-	} else {
49
-		$erreur = 'erreur_plugin_desinstalation_echouee';
50
-	}
51
-	if ($redirect = _request('redirect')) {
52
-		include_spip('inc/headers');
53
-		if ($erreur) {
54
-			$redirect = parametre_url($redirect, 'erreur', $erreur);
55
-		}
56
-		$redirect = str_replace('&amp;', '&', $redirect);
57
-		redirige_par_entete($redirect);
58
-	}
35
+    $securiser_action = charger_fonction('securiser_action', 'inc');
36
+    $arg = $securiser_action();
37
+    [$dir_plugins, $plugin] = explode('::', $arg);
38
+    $dir_type = '_DIR_PLUGINS';
39
+    if (defined('_DIR_PLUGINS_SUPPL') and $dir_plugins == _DIR_PLUGINS_SUPPL) {
40
+        $dir_type = '_DIR_PLUGINS_SUPPL';
41
+    }
42
+    $installer_plugins = charger_fonction('installer', 'plugins');
43
+    $infos = $installer_plugins($plugin, 'uninstall', $dir_type);
44
+    if ($infos and !$infos['install_test'][0]) {
45
+        include_spip('inc/plugin');
46
+        ecrire_plugin_actifs([$plugin], false, 'enleve');
47
+        $erreur = '';
48
+    } else {
49
+        $erreur = 'erreur_plugin_desinstalation_echouee';
50
+    }
51
+    if ($redirect = _request('redirect')) {
52
+        include_spip('inc/headers');
53
+        if ($erreur) {
54
+            $redirect = parametre_url($redirect, 'erreur', $erreur);
55
+        }
56
+        $redirect = str_replace('&amp;', '&', $redirect);
57
+        redirige_par_entete($redirect);
58
+    }
59 59
 }
Please login to merge, or discard this patch.