cvs: phpweb /include langchooser.inc

From: Date: Sat, 01 Mar 2003 16:03:44 +0000
Subject: cvs: phpweb /include langchooser.inc
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-15969@lists.php.net to get a copy of this message
goba Sat Mar 1 11:03:44 2003 EDT Modified files: /phpweb/include langchooser.inc Log: Provide an URL version with language code stripped off for cleaner shortcut handling Index: phpweb/include/langchooser.inc diff -u phpweb/include/langchooser.inc:1.6 phpweb/include/langchooser.inc:1.7 --- phpweb/include/langchooser.inc:1.6 Sat Mar 1 08:53:56 2003 +++ phpweb/include/langchooser.inc Sat Mar 1 11:03:44 2003 @@ -1,6 +1,6 @@ <?php // -*- C++ -*- -// $Id: langchooser.inc,v 1.6 2003/03/01 13:53:56 goba Exp $ +// $Id: langchooser.inc,v 1.7 2003/03/01 16:03:44 goba Exp $ /* @@ -12,6 +12,11 @@ After this script run, $LANG is set to the preferred language, or is the empty string, if no manual is available on the current mirror site. + + The $_SERVER['STRIPPED_URI'] var is also set to the + stripped request URI (in case of a shortcut, the + language is stipped, so the shortcut handling code + is not bothered with it). */ @@ -23,7 +28,14 @@ // Specified in a shortcut URL (eg. /en/echo or /pt_br/echo) if (preg_match("!^/(\\w{2}(_\\w{2})?)/!", $_SERVER['REQUEST_URI'], $flang)) { + + // Put language into preference list language_add($flang[1]); + + // Drop out langauge specification from URL, as this is already handled + $_SERVER['STRIPPED_URI'] = preg_replace( + "!^/$flang[1]/!", "/", $_SERVER['REQUEST_URI'] + ); } // Specified in a manual URL (eg. manual/en/ or manual/pt_br/)

« previous php.mirrors (#15969) next »