cvs: phpweb /include langchooser.inc
| From: | Gabor Hojtsy | Date: | Sun, 02 Mar 2003 16:16:04 +0000 |
| Subject: | cvs: phpweb /include langchooser.inc | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-15999@lists.php.net to get a copy of this message | ||
goba Sun Mar 2 11:16:04 2003 EDT
Modified files:
/phpweb/include langchooser.inc
Log:
Better explicit language handling, including REQUEST vars now...
Index: phpweb/include/langchooser.inc
diff -u phpweb/include/langchooser.inc:1.9 phpweb/include/langchooser.inc:1.10
--- phpweb/include/langchooser.inc:1.9 Sun Mar 2 10:47:42 2003
+++ phpweb/include/langchooser.inc Sun Mar 2 11:16:04 2003
@@ -1,6 +1,6 @@
<?php // -*- C++ -*-
-// $Id: langchooser.inc,v 1.9 2003/03/02 15:47:42 goba Exp $
+// $Id: langchooser.inc,v 1.10 2003/03/02 16:16:04 goba Exp $
/*
@@ -34,7 +34,9 @@
unset($EXPL_LANG);
// Specified for the request (GET/POST parameter)
-if (isset($_REQUEST['lang'])) { language_add($_REQUEST['lang']); }
+if (isset($_REQUEST['lang'])) {
+ $EXPL_LANG = language_add($_REQUEST['lang']);
+}
// Specified in a shortcut URL (eg. /en/echo or /pt_br/echo)
if (preg_match("!^/(\\w{2}(_\\w{2})?)/!", $_SERVER['REQUEST_URI'], $flang)) {
@@ -46,11 +48,17 @@
$_SERVER['STRIPPED_URI'] = preg_replace(
"!^/$flang[1]/!", "/", $_SERVER['REQUEST_URI']
);
+
+ // No need to set $EXPL_LANG here, as no page will be displayed,
+ // only a Location header is sent back to the user.
}
// Specified in a manual URL (eg. manual/en/ or manual/pt_br/)
if (preg_match("!^/manual/(\\w{2}(_\\w{2})?)(/|$)!", $_SERVER['REQUEST_URI'],
$flang)) {
- $EXPL_LANG = language_add($flang[1]);
+ $flang = language_add($flang[1]);
+ if (!isset($EXPL_LANG)) {
+ $EXPL_LANG = $flang;
+ }
}
unset($flang);