[SPIP] ~2.1.12 -->2.1.25
[velocampus/web/www.git] / www / ecrire / action / instituer_groupe_mots.php
1 <?php
2
3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
5 * *
6 * Copyright (c) 2001-2014 *
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 include_spip('inc/filtres');
16
17 // http://doc.spip.org/@action_instituer_groupe_mots_dist
18 function action_instituer_groupe_mots_dist()
19 {
20 $securiser_action = charger_fonction('securiser_action', 'inc');
21 $arg = $securiser_action();
22
23 if (preg_match(",^([a-zA-Z_]\w+)$,", $arg, $r))
24 action_instituer_groupe_mots_get($arg);
25 elseif (!preg_match(",^(-?\d+)$,", $arg, $r)) {
26 spip_log("action_instituer_groupe_mots_dist $arg pas compris");
27 } else action_instituer_groupe_mots_post($r[1]);
28 }
29
30 // http://doc.spip.org/@action_instituer_groupe_mots_post
31 function action_instituer_groupe_mots_post($id_groupe)
32 {
33 if ($id_groupe < 0){
34 sql_delete("spip_groupes_mots", "id_groupe=" . (0- $id_groupe));
35 }
36 else
37 spip_log('appel deprecie, rien a faire ici (voir action/edite_groupe_mot)');
38 }
39
40 // http://doc.spip.org/@action_instituer_groupe_mots_get
41 function action_instituer_groupe_mots_get($table)
42 {
43 $titre = _T('info_mot_sans_groupe');
44 $id_groupe = sql_insertq("spip_groupes_mots", array(
45 'titre' => $titre,
46 'unseul' => 'non',
47 'obligatoire' => 'non',
48 'tables_liees'=>$table,
49 'minirezo' => 'oui',
50 'comite' => 'non',
51 'forum' => 'non')) ;
52
53 redirige_par_entete(parametre_url(urldecode(_request('redirect')),
54 'id_groupe', $id_groupe, '&'));
55 }
56
57 ?>