[SPIP] ~2.1.12 -->2.1.25
[velocampus/web/www.git] / www / ecrire / action / instituer_langue_rubrique.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 // http://doc.spip.org/@action_instituer_langue_rubrique_dist
16 function action_instituer_langue_rubrique_dist() {
17
18 $securiser_action = charger_fonction('securiser_action', 'inc');
19 $arg = $securiser_action();
20 $changer_lang = _request('changer_lang');
21
22 list($id_rubrique, $id_parent) = preg_split('/\W/', $arg);
23
24 if ($changer_lang
25 AND $id_rubrique>0
26 AND $GLOBALS['meta']['multi_rubriques'] == 'oui'
27 AND ($GLOBALS['meta']['multi_secteurs'] == 'non' OR $id_parent == 0)) {
28 if ($changer_lang != "herit")
29 sql_updateq('spip_rubriques', array('lang'=>$changer_lang, 'langue_choisie'=>'oui'), "id_rubrique=$id_rubrique");
30 else {
31 if ($id_parent == 0)
32 $langue_parent = $GLOBALS['meta']['langue_site'];
33 else {
34 $langue_parent = sql_getfetsel("lang", "spip_rubriques", "id_rubrique=$id_parent");
35 }
36 sql_updateq('spip_rubriques', array('lang'=>$langue_parent, 'langue_choisie'=>'non'), "id_rubrique=$id_rubrique");
37 }
38 include_spip('inc/rubriques');
39 calculer_langues_rubriques();
40
41 // invalider les caches marques de cette rubrique
42 include_spip('inc/invalideur');
43 suivre_invalideur("id='id_rubrique/$id_rubrique'");
44 }
45 }
46 ?>