[SPIP][PLUGINS] v3.0-->v3.2
[lhc/web/www.git] / www / ecrire / action / instituer_langue_rubrique.php
index 1889317..7bb2316 100644 (file)
@@ -3,16 +3,26 @@
 /***************************************************************************\
  *  SPIP, Systeme de publication pour l'internet                           *
  *                                                                         *
- *  Copyright (c) 2001-2016                                                *
+ *  Copyright (c) 2001-2017                                                *
  *  Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James  *
  *                                                                         *
  *  Ce programme est un logiciel libre distribue sous licence GNU/GPL.     *
  *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
 \***************************************************************************/
 
-if (!defined('_ECRIRE_INC_VERSION')) return;
+/**
+ * Action des changements de langue des rubriques
+ *
+ * @package SPIP\Core\Edition
+ **/
 
-// http://doc.spip.org/@action_instituer_langue_rubrique_dist
+if (!defined('_ECRIRE_INC_VERSION')) {
+       return;
+}
+
+/**
+ * Modifie la langue d'une rubrique
+ **/
 function action_instituer_langue_rubrique_dist() {
 
        $securiser_action = charger_fonction('securiser_action', 'inc');
@@ -22,18 +32,21 @@ function action_instituer_langue_rubrique_dist() {
        list($id_rubrique, $id_parent) = preg_split('/\W/', $arg);
 
        if ($changer_lang
-       AND $id_rubrique>0
-       AND $GLOBALS['meta']['multi_rubriques'] == 'oui'
-       AND ($GLOBALS['meta']['multi_secteurs'] == 'non' OR $id_parent == 0)) {
-               if ($changer_lang != "herit")
-                       sql_updateq('spip_rubriques', array('lang'=>$changer_lang, 'langue_choisie'=>'oui'), "id_rubrique=$id_rubrique");
-               else {
-                       if ($id_parent == 0)
+               and $id_rubrique > 0
+               and $GLOBALS['meta']['multi_rubriques'] == 'oui'
+               and ($GLOBALS['meta']['multi_secteurs'] == 'non' or $id_parent == 0)
+       ) {
+               if ($changer_lang != "herit") {
+                       sql_updateq('spip_rubriques', array('lang' => $changer_lang, 'langue_choisie' => 'oui'),
+                               "id_rubrique=$id_rubrique");
+               } else {
+                       if ($id_parent == 0) {
                                $langue_parent = $GLOBALS['meta']['langue_site'];
-                       else {
+                       else {
                                $langue_parent = sql_getfetsel("lang", "spip_rubriques", "id_rubrique=$id_parent");
                        }
-                       sql_updateq('spip_rubriques', array('lang'=>$langue_parent, 'langue_choisie'=>'non'), "id_rubrique=$id_rubrique");
+                       sql_updateq('spip_rubriques', array('lang' => $langue_parent, 'langue_choisie' => 'non'),
+                               "id_rubrique=$id_rubrique");
                }
                include_spip('inc/rubriques');
                calculer_langues_rubriques();
@@ -43,4 +56,3 @@ function action_instituer_langue_rubrique_dist() {
                suivre_invalideur("id='rubrique/$id_rubrique'");
        }
 }
-?>