cvs: phpweb / search.php

From: Date: Fri, 03 Jan 2003 13:20:50 +0000
Subject: cvs: phpweb / search.php
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-14661@lists.php.net to get a copy of this message
goba Fri Jan 3 08:20:50 2003 EDT Modified files: /phpweb search.php Log: Adding support for preferred_language() selection, in case the language was not specified. Adding exact bug number jump in search form Preserve language preference when falling back to php.net search (no local search) Index: phpweb/search.php diff -u phpweb/search.php:1.51 phpweb/search.php:1.52 --- phpweb/search.php:1.51 Sat Dec 21 06:10:10 2002 +++ phpweb/search.php Fri Jan 3 08:20:49 2003 @@ -34,7 +34,8 @@ /* Form parameters expected: pattern - search keywords - lang - language to limit search to [this is not used currently!!!] + lang - language to limit search to [this is not + used currently in searches, only for redirection!!!] show - target of search action base - base URL to point result links to */ @@ -46,6 +47,9 @@ if (isset($lang)) { $lang = stripslashes($lang); } } +// Set language to the preferred one if not set +if (!isset($lang)) { $lang = preferred_language(); } + // We received something to search for if (isset($pattern)) { @@ -80,9 +84,18 @@ // Bug database search case "bugdb" : - $location = "http://bugs.php.net/search.php"; - $query = "cmd=Display+Bugs&status=All&bug_type=Any&search_for=" . urlencode($pattern); - header("Location: $location?$query"); + + // Redirect to bug page in case of exact number + if (preg_match("!^\\d+$!", $pattern)) { + header("Location: http://bugs.php.net/$pattern"); + } + + // Redirect to bug search page in case of some other pattern + else { + $location = "http://bugs.php.net/search.php"; + $query = "cmd=Display+Bugs&status=All&bug_type=Any&search_for=" . urlencode($pattern); + header("Location: $location?$query"); + } exit; } @@ -102,7 +115,8 @@ // We can redirect to the php.net search page else { $location = "http://www.php.net/search.php"; - $query = "show=" . $show . "&pattern=" . urlencode($pattern) . "&base=" . urlencode($MYSITE); + $query = "show=" . urlencode($show) . "&pattern=" . urlencode($pattern) . + "&base=" . urlencode($MYSITE) "&lang=" . urlencode($lang); header("Location: $location?$query"); exit; }

« previous php.mirrors (#14661) next »