summaryrefslogtreecommitdiff
path: root/php
diff options
context:
space:
mode:
authorSteffen Hansen <steffen@kdab.com>2005-11-28 02:27:33 (GMT)
committerSteffen Hansen <steffen@kdab.com>2005-11-28 02:27:33 (GMT)
commita71cdba673524e8835e44a2393f017834e732571 (patch)
tree1fe7fd6e2399b00a4f4db9e6c4595462590e9b54 /php
parent244eebd2eed56d41950559f6f89e6d0c98f0be92 (diff)
downloadkolab-webadmin-a71cdba673524e8835e44a2393f017834e732571.tar.gz
Simplified and corrected patch from Fabio that prevents the URL from growing when languages are switched multiple times.
Diffstat (limited to 'php')
-rw-r--r--php/admin/include/mysmarty.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/php/admin/include/mysmarty.php b/php/admin/include/mysmarty.php
index 8515255..3a159f7 100644
--- a/php/admin/include/mysmarty.php
+++ b/php/admin/include/mysmarty.php
@@ -46,11 +46,13 @@ class MySmarty extends Smarty {
$this->assign( 'topdir', $topdir );
$this->assign( 'self_url', $_SERVER['REQUEST_URI'] );
- $this->assign( 'lang_url',
- strpos($_SERVER['REQUEST_URI'],'?')===false?
- ($_SERVER['REQUEST_URI'].'?lang='):
- ($_SERVER['REQUEST_URI'].'&lang=') );
+ $cleanurl = preg_replace('/(\?|&)lang=(.*)(&|$)/', '', $_SERVER['REQUEST_URI']);
+ $this->assign( 'lang_url',
+ strpos($cleanurl,'?')===false?
+ ($cleanurl.'?lang='):
+ ($cleanurl.'&lang=') );
+
// If you add a translation,
// add the new language here
$this->assign( 'currentlang', $language );