[geeklog-users] bug fix in search.php
Lucas Gonze
lgonze at panix.com
Sat Dec 6 15:48:48 EST 2003
In search.php, the code tests mode to see if it's 'search':
if ($HTTP_GET_VARS['mode'] == 'search' ) {
$display .= $searchObj->doSearch();
} else {
$display .= $searchObj->showForm();
}
But if the search was submitted via searchform.html (my own version of
this was cannibalized from the Yahoo theme), the mode variable will be
'Search' rather than 'search'.
One possible fix is to do the test case-insensitive. However that
wouldn't catch situations where the text had been translated. A more
dependable fix is to look for the 'query' variable instead:
if (!empty($HTTP_GET_VARS['query']) ) {
$display .= $searchObj->doSearch();
} else {
$display .= $searchObj->showForm();
}
The new search.php would be:
require_once('lib-common.php');
require_once($_CONF['path_system'] . 'classes/search.class.php');
$display = COM_siteHeader();
$searchObj = new Search();
if ( !empty($HTTP_GET_VARS['query']) ) {
$display .= $searchObj->doSearch();
} else {
$display .= $searchObj->showForm();
}
$display .= COM_siteFooter();
echo $display;
More information about the geeklog-users
mailing list