Bug #14985: Language when searching on mirrors

From: Date: Fri, 11 Jan 2002 00:04:46 +0000
Subject: Bug #14985: Language when searching on mirrors
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-8172@lists.php.net to get a copy of this message
From: msopacua@idg.nl Operating system: Not relevant PHP version: 4.1.1 PHP Bug Type: Website problem Bug description: Language when searching on mirrors The following has been discussed with Gorba, but he didn't have the time to look into it and requested I reported it here. Basically - manual-lookup.php already is prepared for a language. Search.php however, doesn't know about it. The following unified diff, shows a basic implementation of how it can be supported. Without this, even if you read the english manual, the search box, will direct you to the manual, in the default language for the mirror you're visiting. This may not be what you want. --- ./search.php.dist Wed Jan 9 20:19:14 2002 +++ ./search.php Fri Jan 11 00:58:26 2002 @@ -13,11 +13,19 @@ if (isset($prevsearch) && get_magic_quotes_gpc()) $prevsearch = stripslashes($prevsearch); +if (isset($lang) && get_magic_quotes_gpc()) +{ + $lang = stripslashes($lang); +} +else +{ + $lang = ereg_replace("^([a-z]{2}).*$", "\\1". $HTTP_ACCEPT_LANGUAGE); +} if ($pattern) { setcookie("prevsearch",$pattern,0,"",".php.net"); if ($show=="quickref") { - header("Location: manual-lookup.php?pattern=".urlencode($pattern)); + header("Location: manual-lookup.php?pattern=".urlencode($pattern)."&lang=".urlencode($lang)); exit; } $location = "http://www.progressive-comp.com/Lists/"; @@ -59,7 +67,7 @@ header("Location: ".$location."?".$query); exit; } -} +} if (file_exists("configuration.inc")) { include_once 'configuration.inc'; @@ -101,6 +109,7 @@ ?> <h1>Search</h1> <form action="<?php echo $form;?>" method="post"> +<input type="hidden" name="lang" value="<?php echo htmlspecialchars($lang); ?>"> <table cellspacing="0" cellpadding="2" border="0" align="center"> <tr valign="top"> <td align="right"> -- Edit bug report at: http://bugs.php.net/?id=14985&edit=1

« previous php.mirrors (#8172) next »