Index: /extensions/language_switch_menubar/index.php
===================================================================
--- /extensions/language_switch_menubar/index.php	(revision 13492)
+++ /extensions/language_switch_menubar/index.php	(revision 13492)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based photo gallery                                    |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2012 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/language_switch_menubar/language/en_UK/description.txt
===================================================================
--- /extensions/language_switch_menubar/language/en_UK/description.txt	(revision 13492)
+++ /extensions/language_switch_menubar/language/en_UK/description.txt	(revision 13492)
@@ -0,0 +1,1 @@
+Switch to another language from flags on your gallery home page.
Index: /extensions/language_switch_menubar/language/en_UK/index.php
===================================================================
--- /extensions/language_switch_menubar/language/en_UK/index.php	(revision 13492)
+++ /extensions/language_switch_menubar/language/en_UK/index.php	(revision 13492)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based photo gallery                                    |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2011 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/language_switch_menubar/language/fr_FR/description.txt
===================================================================
--- /extensions/language_switch_menubar/language/fr_FR/description.txt	(revision 13492)
+++ /extensions/language_switch_menubar/language/fr_FR/description.txt	(revision 13492)
@@ -0,0 +1,1 @@
+Changez la langue de la galerie facilement à partir des drapeaux de la page d'accueil.
Index: /extensions/language_switch_menubar/language/fr_FR/index.php
===================================================================
--- /extensions/language_switch_menubar/language/fr_FR/index.php	(revision 13492)
+++ /extensions/language_switch_menubar/language/fr_FR/index.php	(revision 13492)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based photo gallery                                    |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2011 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/language_switch_menubar/language/index.php
===================================================================
--- /extensions/language_switch_menubar/language/index.php	(revision 13492)
+++ /extensions/language_switch_menubar/language/index.php	(revision 13492)
@@ -0,0 +1,30 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based photo gallery                                    |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2011 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+// Recursive call
+$url = '../';
+header( 'Request-URI: '.$url );
+header( 'Content-Location: '.$url );
+header( 'Location: '.$url );
+exit();
+?>
Index: /extensions/language_switch_menubar/language_switch_menu.css
===================================================================
--- /extensions/language_switch_menubar/language_switch_menu.css	(revision 13492)
+++ /extensions/language_switch_menubar/language_switch_menu.css	(revision 13492)
@@ -0,0 +1,7 @@
+.lsm {padding:0px; text-align:center;}
+.lsmli{text-decoration:none;  list-style: none;}
+.activeFlag {border-bottom:0px !important;}
+.activeFlag :hover{border-bottom:0px !important; text-decoration:none;}
+.activeFlag :active{border-bottom:0px !important; text-decoration:none;}
+.aflags {border-bottom:0px !important;}
+.flags :hover {border-bottom:0px !important; text-decoration:none;}
Index: /extensions/language_switch_menubar/main.inc.php
===================================================================
--- /extensions/language_switch_menubar/main.inc.php	(revision 13492)
+++ /extensions/language_switch_menubar/main.inc.php	(revision 13492)
@@ -0,0 +1,148 @@
+<?php
+// +-----------------------------------------------------------------------+
+// | Piwigo - a PHP based photo gallery                                    |
+// +-----------------------------------------------------------------------+
+// | Copyright(C) 2008-2012 Piwigo Team                  http://piwigo.org |
+// | Copyright(C) 2003-2008 PhpWebGallery team    http://phpwebgallery.net |
+// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
+// +-----------------------------------------------------------------------+
+// | This program is free software; you can redistribute it and/or modify  |
+// | it under the terms of the GNU General Public License as published by  |
+// | the Free Software Foundation                                          |
+// |                                                                       |
+// | This program is distributed in the hope that it will be useful, but   |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
+// | General Public License for more details.                              |
+// |                                                                       |
+// | You should have received a copy of the GNU General Public License     |
+// | along with this program; if not, write to the Free Software           |
+// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
+// | USA.                                                                  |
+// +-----------------------------------------------------------------------+
+
+/*
+Plugin Name: Language Switch Menubar
+Version: 2.3.0
+Description: Switch to another language from flags on your menubar gallery.
+Plugin URI: http://piwigo.org/ext/extension_view.php?eid=
+Author: ddtddt
+Author URI: http://piwigo.org
+*/
+
+    if (!defined('PHPWG_ROOT_PATH'))
+    {
+      die('Hacking attempt!');
+    }
+
+define('LSM_DIR' , basename(dirname(__FILE__)));
+define('LSM_PATH' , PHPWG_PLUGINS_PATH . LSM_DIR . '/');
+
+add_event_handler('blockmanager_register_blocks', 'register_lsm_menubar_blocks');
+add_event_handler('blockmanager_apply', 'lsm_apply');
+add_event_handler('loading_lang', 'reloadlang');
+
+function register_lsm_menubar_blocks( $menu_ref_arr )
+{
+  $menu = & $menu_ref_arr[0];
+  if ($menu->get_id() != 'menubar')
+    return;
+  $menu->register_block( new RegisteredBlock( 'mbLSM', 'lsm', 'LSM'));
+}
+
+function lsm_apply($menu_ref_arr)
+{
+  global $template, $user, $template, $conf;
+
+ $menu = & $menu_ref_arr[0];
+ 
+load_language('plugin.lang', LSM_PATH);
+	    $template->assign(
+		array	(
+        'LSMTITLE'     => l10n('Language'),
+				));
+   
+    if (($block = $menu->get_block( 'mbLSM' )) != null) {
+	$template->set_template_dir(LSM_PATH.'template/');
+	$block->template = 'flags.tpl';
+    }
+   
+    $available_lang = get_languages();
+    foreach ($available_lang as $code => $displayname)
+    {
+      $qlc = array (
+        'url' => add_url_params(duplicate_index_url(), array('lang'=> $code)),
+        'alt' => ucwords($displayname),
+        'img' => get_root_url().'language/'.$code.'/'.$code.'.jpg',
+        );
+      
+      $lsw['flags'][$code] = $qlc ;
+      
+      if ($code == $user['language'])
+      {
+        $lsw['Active'] = $qlc;
+      }
+    }
+
+    $lsw['side'] = ceil(sqrt(count($available_lang)));
+    $template->clear_assign('lang_switch');   
+    $template->assign(
+      array(
+        'lang_switch'=> $lsw,
+        'LSM_PATH' => LSM_PATH,
+        )
+      );
+}
+
+function reloadlang()
+{
+  global $user;
+     $same = $user['language'];   
+ 
+    if (isset($_GET['lang']))
+    {
+      if (!empty($_GET['lang']) and file_exists(PHPWG_ROOT_PATH.'language/'.$_GET['lang'].'/common.lang.php'))
+      {
+        if (is_a_guest() or is_generic())
+        {
+          pwg_set_session_var('lang_switch', $_GET['lang']);
+        }
+        else
+        {
+          $query = '
+UPDATE '.USER_INFOS_TABLE.'
+  SET language = \''.$_GET['lang'].'\'
+  WHERE user_id = '.$user['id'].'
+;';
+          pwg_query($query);
+        }
+        $user['language'] = $_GET['lang'];
+      }
+    }
+    elseif ((is_a_guest() or is_generic()))
+    {
+      $user['language'] = pwg_get_session_var('lang_switch', $user['language']);
+    }
+    
+    if ( $same !== $user['language'])
+    {
+      load_language('common.lang', '', array('language'=>$user['language']));
+      
+      load_language(
+        'lang',
+        PHPWG_ROOT_PATH.PWG_LOCAL_DIR,
+        array(
+          'language' => $user['language'],
+          'no_fallback' => true,
+          'local' => true
+          )
+        );}
+      
+      if (defined('IN_ADMIN') and IN_ADMIN)
+      {
+        load_language('admin.lang', '', array('language'=>$user['language']));
+      }
+
+}
+
+?>
Index: /extensions/language_switch_menubar/template/flags.tpl
===================================================================
--- /extensions/language_switch_menubar/template/flags.tpl	(revision 13492)
+++ /extensions/language_switch_menubar/template/flags.tpl	(revision 13492)
@@ -0,0 +1,17 @@
+<dt>{$LSMTITLE}
+        <a rel="nofollow" href="" class="activeFlag">
+          <img class="flags" src="{$lang_switch.Active.img}" alt="{$lang_switch.Active.alt}" title="{$lang_switch.Active.alt}"/>
+        </a></dt><dd>
+<div class="lsm">
+	<ul class="lsmul">
+		<li class="lsmli">
+{foreach from=$lang_switch.flags key=code item=flag name=f}
+            <a rel="nofollow" href="{$flag.url}" class="aflags">
+              <img class="flags" src="{$flag.img}" alt="{$flag.alt}" title="{$flag.alt}"/> 
+            </a>
+{/foreach}
+		</li>
+	</ul>
+</div>
+{combine_css path="plugins/language_switch_menubar/language_switch_menu.css"}
+</dd>
