Completed
Push — master ( 91a3ef...7545cf )
by cam
04:01
created
ecrire/action/editer_article.php 1 patch
Indentation   +300 added lines, -300 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
 /**
@@ -40,36 +40,36 @@  discard block
 block discarded – undo
40 40
  *     Liste (identifiant de l'article, Texte d'erreur éventuel)
41 41
  */
42 42
 function action_editer_article_dist($arg = null) {
43
-	include_spip('inc/autoriser');
44
-	$err = "";
45
-	if (is_null($arg)) {
46
-		$securiser_action = charger_fonction('securiser_action', 'inc');
47
-		$arg = $securiser_action();
48
-	}
49
-
50
-	// si id_article 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_article = intval($arg)) {
53
-		$id_parent = _request('id_parent');
54
-		if (!$id_parent) {
55
-			$err = _L("creation interdite d'un article sans rubrique");
56
-		} elseif (!autoriser('creerarticledans', 'rubrique', $id_parent)) {
57
-			$err = _T("info_creerdansrubrique_non_autorise");
58
-		} else {
59
-			$id_article = article_inserer($id_parent);
60
-		}
61
-	}
62
-
63
-	// Enregistre l'envoi dans la BD
64
-	if ($id_article > 0) {
65
-		$err = article_modifier($id_article);
66
-	}
67
-
68
-	if ($err) {
69
-		spip_log("echec editeur article: $err", _LOG_ERREUR);
70
-	}
71
-
72
-	return array($id_article, $err);
43
+    include_spip('inc/autoriser');
44
+    $err = "";
45
+    if (is_null($arg)) {
46
+        $securiser_action = charger_fonction('securiser_action', 'inc');
47
+        $arg = $securiser_action();
48
+    }
49
+
50
+    // si id_article 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_article = intval($arg)) {
53
+        $id_parent = _request('id_parent');
54
+        if (!$id_parent) {
55
+            $err = _L("creation interdite d'un article sans rubrique");
56
+        } elseif (!autoriser('creerarticledans', 'rubrique', $id_parent)) {
57
+            $err = _T("info_creerdansrubrique_non_autorise");
58
+        } else {
59
+            $id_article = article_inserer($id_parent);
60
+        }
61
+    }
62
+
63
+    // Enregistre l'envoi dans la BD
64
+    if ($id_article > 0) {
65
+        $err = article_modifier($id_article);
66
+    }
67
+
68
+    if ($err) {
69
+        spip_log("echec editeur article: $err", _LOG_ERREUR);
70
+    }
71
+
72
+    return array($id_article, $err);
73 73
 }
74 74
 
75 75
 /**
@@ -91,46 +91,46 @@  discard block
 block discarded – undo
91 91
  */
92 92
 function article_modifier($id_article, $set = null) {
93 93
 
94
-	// unifier $texte en cas de texte trop long
95
-	trop_longs_articles();
96
-
97
-	include_spip('inc/modifier');
98
-	include_spip('inc/filtres');
99
-	$c = collecter_requests(
100
-	// white list
101
-		objet_info('article', 'champs_editables'),
102
-		// black list
103
-		array('date', 'statut', 'id_parent'),
104
-		// donnees eventuellement fournies
105
-		$set
106
-	);
107
-
108
-	// Si l'article est publie, invalider les caches et demander sa reindexation
109
-	$t = sql_getfetsel("statut", "spip_articles", "id_article=" . intval($id_article));
110
-	$invalideur = $indexation = false;
111
-	if ($t == 'publie') {
112
-		$invalideur = "id='article/$id_article'";
113
-		$indexation = true;
114
-	}
115
-
116
-	if ($err = objet_modifier_champs('article', $id_article,
117
-		array(
118
-			'data' => $set,
119
-			'nonvide' => array('titre' => _T('info_nouvel_article') . " " . _T('info_numero_abbreviation') . $id_article),
120
-			'invalideur' => $invalideur,
121
-			'indexation' => $indexation,
122
-			'date_modif' => 'date_modif' // champ a mettre a date('Y-m-d H:i:s') s'il y a modif
123
-		),
124
-		$c)
125
-	) {
126
-		return $err;
127
-	}
128
-
129
-	// Modification de statut, changement de rubrique ?
130
-	$c = collecter_requests(array('date', 'statut', 'id_parent'), array(), $set);
131
-	$err = article_instituer($id_article, $c);
132
-
133
-	return $err;
94
+    // unifier $texte en cas de texte trop long
95
+    trop_longs_articles();
96
+
97
+    include_spip('inc/modifier');
98
+    include_spip('inc/filtres');
99
+    $c = collecter_requests(
100
+    // white list
101
+        objet_info('article', 'champs_editables'),
102
+        // black list
103
+        array('date', 'statut', 'id_parent'),
104
+        // donnees eventuellement fournies
105
+        $set
106
+    );
107
+
108
+    // Si l'article est publie, invalider les caches et demander sa reindexation
109
+    $t = sql_getfetsel("statut", "spip_articles", "id_article=" . intval($id_article));
110
+    $invalideur = $indexation = false;
111
+    if ($t == 'publie') {
112
+        $invalideur = "id='article/$id_article'";
113
+        $indexation = true;
114
+    }
115
+
116
+    if ($err = objet_modifier_champs('article', $id_article,
117
+        array(
118
+            'data' => $set,
119
+            'nonvide' => array('titre' => _T('info_nouvel_article') . " " . _T('info_numero_abbreviation') . $id_article),
120
+            'invalideur' => $invalideur,
121
+            'indexation' => $indexation,
122
+            'date_modif' => 'date_modif' // champ a mettre a date('Y-m-d H:i:s') s'il y a modif
123
+        ),
124
+        $c)
125
+    ) {
126
+        return $err;
127
+    }
128
+
129
+    // Modification de statut, changement de rubrique ?
130
+    $c = collecter_requests(array('date', 'statut', 'id_parent'), array(), $set);
131
+    $err = article_instituer($id_article, $c);
132
+
133
+    return $err;
134 134
 }
135 135
 
136 136
 /**
@@ -166,89 +166,89 @@  discard block
 block discarded – undo
166 166
  */
167 167
 function article_inserer($id_rubrique, $set = null) {
168 168
 
169
-	// Si id_rubrique vaut 0 ou n'est pas definie, creer l'article
170
-	// dans la premiere rubrique racine
171
-	if (!$id_rubrique = intval($id_rubrique)) {
172
-		$row = sql_fetsel("id_rubrique, id_secteur, lang", "spip_rubriques", "id_parent=0", '', '0+titre,titre', "1");
173
-		$id_rubrique = $row['id_rubrique'];
174
-	} else {
175
-		$row = sql_fetsel("lang, id_secteur", "spip_rubriques", "id_rubrique=$id_rubrique");
176
-	}
177
-
178
-	// eviter $id_secteur = NULL (erreur sqlite) si la requete precedente echoue 
179
-	// cas de id_rubrique = -1 par exemple avec plugin "pages"
180
-	$id_secteur = isset($row['id_secteur']) ? $row['id_secteur'] : 0;
181
-	$lang_rub = isset($row['lang']) ? $row['lang'] : '';
182
-
183
-	$lang = "";
184
-	$choisie = 'non';
185
-	// La langue a la creation : si les liens de traduction sont autorises
186
-	// dans les rubriques, on essaie avec la langue de l'auteur,
187
-	// ou a defaut celle de la rubrique
188
-	// Sinon c'est la langue de la rubrique qui est choisie + heritee
189
-	if (!empty($GLOBALS['meta']['multi_objets']) and in_array('spip_articles',
190
-			explode(',', $GLOBALS['meta']['multi_objets']))
191
-	) {
192
-		lang_select($GLOBALS['visiteur_session']['lang']);
193
-		if (in_array($GLOBALS['spip_lang'],
194
-			explode(',', $GLOBALS['meta']['langues_multilingue']))) {
195
-			$lang = $GLOBALS['spip_lang'];
196
-			$choisie = 'oui';
197
-		}
198
-	}
199
-
200
-	if (!$lang) {
201
-		$choisie = 'non';
202
-		$lang = $lang_rub ? $lang_rub : $GLOBALS['meta']['langue_site'];
203
-	}
204
-
205
-	$champs = array(
206
-		'id_rubrique' => $id_rubrique,
207
-		'id_secteur' => $id_secteur,
208
-		'statut' => 'prepa',
209
-		'date' => date('Y-m-d H:i:s'),
210
-		'lang' => $lang,
211
-		'langue_choisie' => $choisie
212
-	);
213
-
214
-	if ($set) {
215
-		$champs = array_merge($champs, $set);
216
-	}
217
-
218
-	// Envoyer aux plugins
219
-	$champs = pipeline('pre_insertion',
220
-		array(
221
-			'args' => array(
222
-				'table' => 'spip_articles',
223
-			),
224
-			'data' => $champs
225
-		)
226
-	);
227
-
228
-	$id_article = sql_insertq("spip_articles", $champs);
229
-
230
-	// controler si le serveur n'a pas renvoye une erreur
231
-	if ($id_article > 0) {
232
-		$id_auteur = ((is_null(_request('id_auteur')) and isset($GLOBALS['visiteur_session']['id_auteur'])) ?
233
-			$GLOBALS['visiteur_session']['id_auteur']
234
-			: _request('id_auteur'));
235
-		if ($id_auteur) {
236
-			include_spip('action/editer_auteur');
237
-			auteur_associer($id_auteur, array('article' => $id_article));
238
-		}
239
-	}
240
-
241
-	pipeline('post_insertion',
242
-		array(
243
-			'args' => array(
244
-				'table' => 'spip_articles',
245
-				'id_objet' => $id_article
246
-			),
247
-			'data' => $champs
248
-		)
249
-	);
250
-
251
-	return $id_article;
169
+    // Si id_rubrique vaut 0 ou n'est pas definie, creer l'article
170
+    // dans la premiere rubrique racine
171
+    if (!$id_rubrique = intval($id_rubrique)) {
172
+        $row = sql_fetsel("id_rubrique, id_secteur, lang", "spip_rubriques", "id_parent=0", '', '0+titre,titre', "1");
173
+        $id_rubrique = $row['id_rubrique'];
174
+    } else {
175
+        $row = sql_fetsel("lang, id_secteur", "spip_rubriques", "id_rubrique=$id_rubrique");
176
+    }
177
+
178
+    // eviter $id_secteur = NULL (erreur sqlite) si la requete precedente echoue 
179
+    // cas de id_rubrique = -1 par exemple avec plugin "pages"
180
+    $id_secteur = isset($row['id_secteur']) ? $row['id_secteur'] : 0;
181
+    $lang_rub = isset($row['lang']) ? $row['lang'] : '';
182
+
183
+    $lang = "";
184
+    $choisie = 'non';
185
+    // La langue a la creation : si les liens de traduction sont autorises
186
+    // dans les rubriques, on essaie avec la langue de l'auteur,
187
+    // ou a defaut celle de la rubrique
188
+    // Sinon c'est la langue de la rubrique qui est choisie + heritee
189
+    if (!empty($GLOBALS['meta']['multi_objets']) and in_array('spip_articles',
190
+            explode(',', $GLOBALS['meta']['multi_objets']))
191
+    ) {
192
+        lang_select($GLOBALS['visiteur_session']['lang']);
193
+        if (in_array($GLOBALS['spip_lang'],
194
+            explode(',', $GLOBALS['meta']['langues_multilingue']))) {
195
+            $lang = $GLOBALS['spip_lang'];
196
+            $choisie = 'oui';
197
+        }
198
+    }
199
+
200
+    if (!$lang) {
201
+        $choisie = 'non';
202
+        $lang = $lang_rub ? $lang_rub : $GLOBALS['meta']['langue_site'];
203
+    }
204
+
205
+    $champs = array(
206
+        'id_rubrique' => $id_rubrique,
207
+        'id_secteur' => $id_secteur,
208
+        'statut' => 'prepa',
209
+        'date' => date('Y-m-d H:i:s'),
210
+        'lang' => $lang,
211
+        'langue_choisie' => $choisie
212
+    );
213
+
214
+    if ($set) {
215
+        $champs = array_merge($champs, $set);
216
+    }
217
+
218
+    // Envoyer aux plugins
219
+    $champs = pipeline('pre_insertion',
220
+        array(
221
+            'args' => array(
222
+                'table' => 'spip_articles',
223
+            ),
224
+            'data' => $champs
225
+        )
226
+    );
227
+
228
+    $id_article = sql_insertq("spip_articles", $champs);
229
+
230
+    // controler si le serveur n'a pas renvoye une erreur
231
+    if ($id_article > 0) {
232
+        $id_auteur = ((is_null(_request('id_auteur')) and isset($GLOBALS['visiteur_session']['id_auteur'])) ?
233
+            $GLOBALS['visiteur_session']['id_auteur']
234
+            : _request('id_auteur'));
235
+        if ($id_auteur) {
236
+            include_spip('action/editer_auteur');
237
+            auteur_associer($id_auteur, array('article' => $id_article));
238
+        }
239
+    }
240
+
241
+    pipeline('post_insertion',
242
+        array(
243
+            'args' => array(
244
+                'table' => 'spip_articles',
245
+                'id_objet' => $id_article
246
+            ),
247
+            'data' => $champs
248
+        )
249
+    );
250
+
251
+    return $id_article;
252 252
 }
253 253
 
254 254
 
@@ -276,120 +276,120 @@  discard block
 block discarded – undo
276 276
  */
277 277
 function article_instituer($id_article, $c, $calcul_rub = true) {
278 278
 
279
-	include_spip('inc/autoriser');
280
-	include_spip('inc/rubriques');
281
-	include_spip('inc/modifier');
282
-
283
-	$row = sql_fetsel("statut, date, id_rubrique", "spip_articles", "id_article=$id_article");
284
-	$id_rubrique = $row['id_rubrique'];
285
-	$statut_ancien = $statut = $row['statut'];
286
-	$date_ancienne = $date = $row['date'];
287
-	$champs = array();
288
-
289
-	$d = isset($c['date']) ? $c['date'] : null;
290
-	$s = isset($c['statut']) ? $c['statut'] : $statut;
291
-
292
-	// cf autorisations dans inc/instituer_article
293
-	if ($s != $statut or ($d and $d != $date)) {
294
-		if (autoriser('publierdans', 'rubrique', $id_rubrique)) {
295
-			$statut = $champs['statut'] = $s;
296
-		} else {
297
-			if (autoriser('modifier', 'article', $id_article) and $s != 'publie') {
298
-				$statut = $champs['statut'] = $s;
299
-			} else {
300
-				spip_log("editer_article $id_article refus " . join(' ', $c));
301
-			}
302
-		}
303
-
304
-		// En cas de publication, fixer la date a "maintenant"
305
-		// sauf si $c commande autre chose
306
-		// ou si l'article est deja date dans le futur
307
-		// En cas de proposition d'un article (mais pas depublication), idem
308
-		if ($champs['statut'] == 'publie'
309
-			or ($champs['statut'] == 'prop' and ($d or !in_array($statut_ancien, array('publie', 'prop'))))
310
-		) {
311
-			if ($d or strtotime($d = $date) > time()) {
312
-				$champs['date'] = $date = $d;
313
-			} else {
314
-				$champs['date'] = $date = date('Y-m-d H:i:s');
315
-			}
316
-		}
317
-	}
318
-
319
-	// Verifier que la rubrique demandee existe et est differente
320
-	// de la rubrique actuelle
321
-	if (isset($c['id_parent'])
322
-		and $id_parent = $c['id_parent']
323
-		and $id_parent != $id_rubrique
324
-		and (sql_fetsel('1', "spip_rubriques", "id_rubrique=" . intval($id_parent)))
325
-	) {
326
-		$champs['id_rubrique'] = $id_parent;
327
-
328
-		// si l'article etait publie
329
-		// et que le demandeur n'est pas admin de la rubrique de destination
330
-		// repasser l'article en statut 'propose'.
331
-		if ($statut == 'publie'
332
-			and !autoriser('publierdans', 'rubrique', $id_parent)
333
-		) {
334
-			$champs['statut'] = 'prop';
335
-		}
336
-	}
337
-
338
-	// Envoyer aux plugins
339
-	$champs = pipeline('pre_edition',
340
-		array(
341
-			'args' => array(
342
-				'table' => 'spip_articles',
343
-				'id_objet' => $id_article,
344
-				'action' => 'instituer',
345
-				'statut_ancien' => $statut_ancien,
346
-				'date_ancienne' => $date_ancienne,
347
-			),
348
-			'data' => $champs
349
-		)
350
-	);
351
-
352
-	if (!count($champs)) {
353
-		return '';
354
-	}
355
-
356
-	// Envoyer les modifs.
357
-	editer_article_heritage($id_article, $id_rubrique, $statut_ancien, $champs, $calcul_rub);
358
-
359
-	// Invalider les caches
360
-	include_spip('inc/invalideur');
361
-	suivre_invalideur("id='article/$id_article'");
362
-
363
-	if ($date) {
364
-		$t = strtotime($date);
365
-		$p = @$GLOBALS['meta']['date_prochain_postdate'];
366
-		if ($t > time() and (!$p or ($t < $p))) {
367
-			ecrire_meta('date_prochain_postdate', $t);
368
-		}
369
-	}
370
-
371
-	// Pipeline
372
-	pipeline('post_edition',
373
-		array(
374
-			'args' => array(
375
-				'table' => 'spip_articles',
376
-				'id_objet' => $id_article,
377
-				'action' => 'instituer',
378
-				'statut_ancien' => $statut_ancien,
379
-				'date_ancienne' => $date_ancienne,
380
-			),
381
-			'data' => $champs
382
-		)
383
-	);
384
-
385
-	// Notifications
386
-	if ($notifications = charger_fonction('notifications', 'inc')) {
387
-		$notifications('instituerarticle', $id_article,
388
-			array('statut' => $statut, 'statut_ancien' => $statut_ancien, 'date' => $date, 'date_ancienne' => $date_ancienne)
389
-		);
390
-	}
391
-
392
-	return ''; // pas d'erreur
279
+    include_spip('inc/autoriser');
280
+    include_spip('inc/rubriques');
281
+    include_spip('inc/modifier');
282
+
283
+    $row = sql_fetsel("statut, date, id_rubrique", "spip_articles", "id_article=$id_article");
284
+    $id_rubrique = $row['id_rubrique'];
285
+    $statut_ancien = $statut = $row['statut'];
286
+    $date_ancienne = $date = $row['date'];
287
+    $champs = array();
288
+
289
+    $d = isset($c['date']) ? $c['date'] : null;
290
+    $s = isset($c['statut']) ? $c['statut'] : $statut;
291
+
292
+    // cf autorisations dans inc/instituer_article
293
+    if ($s != $statut or ($d and $d != $date)) {
294
+        if (autoriser('publierdans', 'rubrique', $id_rubrique)) {
295
+            $statut = $champs['statut'] = $s;
296
+        } else {
297
+            if (autoriser('modifier', 'article', $id_article) and $s != 'publie') {
298
+                $statut = $champs['statut'] = $s;
299
+            } else {
300
+                spip_log("editer_article $id_article refus " . join(' ', $c));
301
+            }
302
+        }
303
+
304
+        // En cas de publication, fixer la date a "maintenant"
305
+        // sauf si $c commande autre chose
306
+        // ou si l'article est deja date dans le futur
307
+        // En cas de proposition d'un article (mais pas depublication), idem
308
+        if ($champs['statut'] == 'publie'
309
+            or ($champs['statut'] == 'prop' and ($d or !in_array($statut_ancien, array('publie', 'prop'))))
310
+        ) {
311
+            if ($d or strtotime($d = $date) > time()) {
312
+                $champs['date'] = $date = $d;
313
+            } else {
314
+                $champs['date'] = $date = date('Y-m-d H:i:s');
315
+            }
316
+        }
317
+    }
318
+
319
+    // Verifier que la rubrique demandee existe et est differente
320
+    // de la rubrique actuelle
321
+    if (isset($c['id_parent'])
322
+        and $id_parent = $c['id_parent']
323
+        and $id_parent != $id_rubrique
324
+        and (sql_fetsel('1', "spip_rubriques", "id_rubrique=" . intval($id_parent)))
325
+    ) {
326
+        $champs['id_rubrique'] = $id_parent;
327
+
328
+        // si l'article etait publie
329
+        // et que le demandeur n'est pas admin de la rubrique de destination
330
+        // repasser l'article en statut 'propose'.
331
+        if ($statut == 'publie'
332
+            and !autoriser('publierdans', 'rubrique', $id_parent)
333
+        ) {
334
+            $champs['statut'] = 'prop';
335
+        }
336
+    }
337
+
338
+    // Envoyer aux plugins
339
+    $champs = pipeline('pre_edition',
340
+        array(
341
+            'args' => array(
342
+                'table' => 'spip_articles',
343
+                'id_objet' => $id_article,
344
+                'action' => 'instituer',
345
+                'statut_ancien' => $statut_ancien,
346
+                'date_ancienne' => $date_ancienne,
347
+            ),
348
+            'data' => $champs
349
+        )
350
+    );
351
+
352
+    if (!count($champs)) {
353
+        return '';
354
+    }
355
+
356
+    // Envoyer les modifs.
357
+    editer_article_heritage($id_article, $id_rubrique, $statut_ancien, $champs, $calcul_rub);
358
+
359
+    // Invalider les caches
360
+    include_spip('inc/invalideur');
361
+    suivre_invalideur("id='article/$id_article'");
362
+
363
+    if ($date) {
364
+        $t = strtotime($date);
365
+        $p = @$GLOBALS['meta']['date_prochain_postdate'];
366
+        if ($t > time() and (!$p or ($t < $p))) {
367
+            ecrire_meta('date_prochain_postdate', $t);
368
+        }
369
+    }
370
+
371
+    // Pipeline
372
+    pipeline('post_edition',
373
+        array(
374
+            'args' => array(
375
+                'table' => 'spip_articles',
376
+                'id_objet' => $id_article,
377
+                'action' => 'instituer',
378
+                'statut_ancien' => $statut_ancien,
379
+                'date_ancienne' => $date_ancienne,
380
+            ),
381
+            'data' => $champs
382
+        )
383
+    );
384
+
385
+    // Notifications
386
+    if ($notifications = charger_fonction('notifications', 'inc')) {
387
+        $notifications('instituerarticle', $id_article,
388
+            array('statut' => $statut, 'statut_ancien' => $statut_ancien, 'date' => $date, 'date_ancienne' => $date_ancienne)
389
+        );
390
+    }
391
+
392
+    return ''; // pas d'erreur
393 393
 }
394 394
 
395 395
 /**
@@ -414,33 +414,33 @@  discard block
 block discarded – undo
414 414
  */
415 415
 function editer_article_heritage($id_article, $id_rubrique, $statut, $champs, $cond = true) {
416 416
 
417
-	// Si on deplace l'article
418
-	//  changer aussi son secteur et sa langue (si heritee)
419
-	if (isset($champs['id_rubrique'])) {
417
+    // Si on deplace l'article
418
+    //  changer aussi son secteur et sa langue (si heritee)
419
+    if (isset($champs['id_rubrique'])) {
420 420
 
421
-		$row_rub = sql_fetsel("id_secteur, lang", "spip_rubriques", "id_rubrique=" . sql_quote($champs['id_rubrique']));
421
+        $row_rub = sql_fetsel("id_secteur, lang", "spip_rubriques", "id_rubrique=" . sql_quote($champs['id_rubrique']));
422 422
 
423
-		$langue = $row_rub['lang'];
424
-		$champs['id_secteur'] = $row_rub['id_secteur'];
425
-		if (sql_fetsel('1', 'spip_articles',
426
-			"id_article=" . intval($id_article) . " AND langue_choisie<>'oui' AND lang<>" . sql_quote($langue))) {
427
-			$champs['lang'] = $langue;
428
-		}
429
-	}
423
+        $langue = $row_rub['lang'];
424
+        $champs['id_secteur'] = $row_rub['id_secteur'];
425
+        if (sql_fetsel('1', 'spip_articles',
426
+            "id_article=" . intval($id_article) . " AND langue_choisie<>'oui' AND lang<>" . sql_quote($langue))) {
427
+            $champs['lang'] = $langue;
428
+        }
429
+    }
430 430
 
431
-	if (!$champs) {
432
-		return;
433
-	}
431
+    if (!$champs) {
432
+        return;
433
+    }
434 434
 
435
-	sql_updateq('spip_articles', $champs, "id_article=" . intval($id_article));
435
+    sql_updateq('spip_articles', $champs, "id_article=" . intval($id_article));
436 436
 
437
-	// Changer le statut des rubriques concernees 
437
+    // Changer le statut des rubriques concernees 
438 438
 
439
-	if ($cond) {
440
-		include_spip('inc/rubriques');
441
-		$postdate = ($GLOBALS['meta']["post_dates"] == "non" and isset($champs['date']) and (strtotime($champs['date']) < time())) ? $champs['date'] : false;
442
-		calculer_rubriques_if($id_rubrique, $champs, $statut, $postdate);
443
-	}
439
+    if ($cond) {
440
+        include_spip('inc/rubriques');
441
+        $postdate = ($GLOBALS['meta']["post_dates"] == "non" and isset($champs['date']) and (strtotime($champs['date']) < time())) ? $champs['date'] : false;
442
+        calculer_rubriques_if($id_rubrique, $champs, $statut, $postdate);
443
+    }
444 444
 }
445 445
 
446 446
 /**
@@ -449,12 +449,12 @@  discard block
 block discarded – undo
449 449
  * @return void
450 450
  */
451 451
 function trop_longs_articles() {
452
-	if (is_array($plus = _request('texte_plus'))) {
453
-		foreach ($plus as $n => $t) {
454
-			$plus[$n] = preg_replace(",<!--SPIP-->[\n\r]*,", "", $t);
455
-		}
456
-		set_request('texte', join('', $plus) . _request('texte'));
457
-	}
452
+    if (is_array($plus = _request('texte_plus'))) {
453
+        foreach ($plus as $n => $t) {
454
+            $plus[$n] = preg_replace(",<!--SPIP-->[\n\r]*,", "", $t);
455
+        }
456
+        set_request('texte', join('', $plus) . _request('texte'));
457
+    }
458 458
 }
459 459
 
460 460
 
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
  *     Chaîne contenant un texte d'erreur sinon.
480 480
  */
481 481
 function revisions_articles($id_article, $c = false) {
482
-	return article_modifier($id_article, $c);
482
+    return article_modifier($id_article, $c);
483 483
 }
484 484
 
485 485
 /**
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
  *     Chaîne contenant un texte d'erreur sinon.
501 501
  */
502 502
 function revision_article($id_article, $c = false) {
503
-	return article_modifier($id_article, $c);
503
+    return article_modifier($id_article, $c);
504 504
 }
505 505
 
506 506
 /**
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
  *     Chaîne contenant un texte d'erreur sinon.
522 522
  */
523 523
 function articles_set($id_article, $set = null) {
524
-	return article_modifier($id_article, $set);
524
+    return article_modifier($id_article, $set);
525 525
 }
526 526
 
527 527
 /**
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
  *     Identifiant du nouvel article
537 537
  */
538 538
 function insert_article($id_rubrique) {
539
-	return article_inserer($id_rubrique);
539
+    return article_inserer($id_rubrique);
540 540
 }
541 541
 
542 542
 /**
@@ -558,5 +558,5 @@  discard block
 block discarded – undo
558 558
  *     Chaîne vide
559 559
  */
560 560
 function instituer_article($id_article, $c, $calcul_rub = true) {
561
-	return article_instituer($id_article, $c, $calcul_rub);
561
+    return article_instituer($id_article, $c, $calcul_rub);
562 562
 }
Please login to merge, or discard this patch.