Commit | Line | Data |
---|---|---|
c495c100 P |
1 | <?php |
2 | ||
3 | /***************************************************************************\ | |
4 | * SPIP, Systeme de publication pour l'internet * | |
5 | * * | |
6 | * Copyright (c) 2001-2007 * | |
7 | * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * | |
8 | * * | |
9 | * Ce programme est un logiciel libre distribue sous licence GNU/GPL. * | |
10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * | |
11 | \***************************************************************************/ | |
12 | ||
13 | if (!defined("_ECRIRE_INC_VERSION")) return; | |
14 | ||
15 | // http://doc.spip.org/@action_supprimer_traduction_dist | |
16 | function action_supprimer_traduction_dist() { | |
17 | ||
18 | $securiser_action = charger_fonction('securiser_action', 'inc'); | |
19 | $arg = $securiser_action(); | |
20 | ||
21 | if (!preg_match(",^(\d+)\D(\d+)$,", $arg, $r)) | |
22 | spip_log("action supprimer_traduction: $arg pas compris"); | |
23 | else action_supprimer_traduction_post($r); | |
24 | } | |
25 | ||
26 | // http://doc.spip.org/@action_supprimer_traduction_post | |
27 | function action_supprimer_traduction_post($r) | |
28 | { | |
29 | spip_query("UPDATE spip_articles SET id_trad=0 WHERE id_article=" . $r[1]); | |
30 | // Si l'ancien groupe ne comporte plus qu'un seul article | |
31 | // mettre a zero. | |
32 | ||
33 | $cpt = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_articles WHERE id_trad=" . $r[2])); | |
34 | ||
35 | if ($cpt['n'] == 1) | |
36 | spip_query("UPDATE spip_articles SET id_trad = 0 WHERE id_trad=" . $r[2]); | |
37 | } | |
38 | ?> |