From 0a7878f4e80ba86bf7f67ae0669635a5d0d758ef Mon Sep 17 00:00:00 2001 From: mistic100 Date: Wed, 25 Jul 2012 20:19:39 +0000 Subject: works with Additional Pages git-svn-id: http://piwigo.org/svn/trunk@17064 68402e56-0260-453c-a942-63ccdbb3a9ee --- plugins/language_switch/language_switch.inc.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'plugins/language_switch/language_switch.inc.php') diff --git a/plugins/language_switch/language_switch.inc.php b/plugins/language_switch/language_switch.inc.php index 49c1a6c49..7b99f4b06 100644 --- a/plugins/language_switch/language_switch.inc.php +++ b/plugins/language_switch/language_switch.inc.php @@ -87,7 +87,7 @@ UPDATE '.USER_INFOS_TABLE.' function language_controler_flags() { - global $user, $template, $conf; + global $user, $template, $conf, $page; $available_lang = get_languages(); @@ -97,11 +97,21 @@ function language_controler_flags() } $url_starting = get_query_string_diff(array('lang')); - + + if ($page['section'] == 'additional_page' and isset($page['additional_page'])) + { + $base_url = make_index_url(array('section'=>'page')).'/'.(isset($page['additional_page']['permalink']) ? $page['additional_page']['permalink'] : $page['additional_page']['id']); + } + else + { + $base_url = duplicate_index_url(); + } + foreach ($available_lang as $code => $displayname) { + $qlc = array ( - 'url' => add_url_params(duplicate_index_url(), array('lang'=> $code)), + 'url' => add_url_params($base_url, array('lang'=> $code)), 'alt' => ucwords($displayname), 'title' => substr($displayname, 0, -4), // remove [FR] or [RU] 'img' => get_root_url().'language/'.$code.'/'.$code.'.jpg', -- cgit v1.2.3