From 5bc08a15224b74c2c62ebc7bc6b89b58a162f7bb Mon Sep 17 00:00:00 2001 From: Gabor Hojtsy Date: Wed, 4 Jun 2003 08:40:09 +0000 Subject: [PATCH] Tabs -> spaces on top, and override $lang with $LANG if $lang was empty or not set, given that $LANG is always set to some useable language code --- search.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/search.php b/search.php index 917cfd047..8ec94eb7c 100644 --- a/search.php +++ b/search.php @@ -3,11 +3,11 @@ include_once "prepend.inc"; -/* convert POST -> GET when dumping the user onto a mirror */ +// Convert POST -> GET when dumping the user onto a mirror if ($_SERVER['REQUEST_METHOD'] == 'POST') { - $_SERVER['REQUEST_URI'] = "/search.php?show=$show&pattern=" . - urlencode($pattern) . - "&base=" . urlencode($MYSITE) . "&lang=$lang"; + $_SERVER['REQUEST_URI'] = "/search.php?show=$show&pattern=" . + urlencode($pattern) . + "&base=" . urlencode($MYSITE) . "&lang=$lang"; } include 'loadavg.inc'; @@ -55,11 +55,9 @@ if ($MQ) { if (isset($lang)) { $lang = stripslashes($lang); } } -// Set language to the preferred one if not set -// (also preserves $lang if provided in POST/GET) -if (!isset($lang) && isset($LANG)) { - $lang = $LANG; -} +// Fallack to preferred language, preserving any +// language provided in the request +if (empty($lang)) { $lang = $LANG; } // Only allow alphabetical chars in lang (security) if (!preg_match("!^\\w+$!", $lang)) {