[SPIP][PLUGINS] v3.0-->v3.2
[lhc/web/www.git] / www / ecrire / action / instituer_langue_objet.php
index 4b49751..bb1f87c 100644 (file)
@@ -3,17 +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 objets éditoriaux
+ *
+ * @package SPIP\Core\Edition
+ **/
+
+if (!defined('_ECRIRE_INC_VERSION')) {
+       return;
+}
 
 /**
  * Modifier la langue d'un objet
+ *
  * @param string $objet
  * @param int $id
  * @param int $id_rubrique
@@ -42,11 +51,11 @@ function action_instituer_langue_objet_dist($objet, $id, $id_rubrique, $changer_
                        }
                        $langues = calculer_langues_utilisees($serveur);
                        ecrire_meta('langues_utilisees', $langues);
-               }
-               else {
+               } else {
                        $langue_parent = sql_getfetsel("lang", "spip_rubriques", "id_rubrique=" . intval($id_rubrique));
-                       if (!$langue_parent)
+                       if (!$langue_parent) {
                                $langue_parent = $GLOBALS['meta']['langue_site'];
+                       }
                        $changer_lang = $langue_parent;
                        $set['lang'] = $changer_lang;
                        if (isset($set['langue_choisie'])){
@@ -59,5 +68,6 @@ function action_instituer_langue_objet_dist($objet, $id, $id_rubrique, $changer_
                        }
                }
        }
+
        return $changer_lang;
 }