1
0
mirror of https://github.com/php/web-php.git synced 2026-04-22 22:48:13 +02:00

Getting rid of php.net's search bug once and for all...

This commit is contained in:
Gabor Hojtsy
2003-04-23 16:07:11 +00:00
parent c7f865468b
commit 0ce2585c4f
+19 -5
View File
@@ -204,11 +204,7 @@ if (isset($pattern)) {
// This means that some error occured (the output templates are in
// Mirrors-htdig.tgz, and one of those should appear on the output)
if ($rc < 2) {
echo "<b>There was an error executing this query.</b><br /><br />Please try later.<br /><br />";
commonFooter();
exit;
}
if ($rc < 2) { searchError(); }
// Create versions insertable in HTML output and URLs too
$htmlpt = htmlspecialchars($pattern);
@@ -225,6 +221,13 @@ if (isset($pattern)) {
exit;
}
// If we have not received the NOMATCH sign, then there need to
// be at least one result. The first 7 rows are meta information,
// the 8th row is the first result. Htdig seems to have a bug to
// return valid meta information even if there are no results
// returned, we would like to avoid that here...
if ($rc < 8) { searchError(); }
// We have matches, so grab the info from the output
// (the template for this is phphead.html in Mirrors-htdig.tgz)
list(, , $matches, $firstdisplayed, $lastdisplayed, $page, $pages) = $result;
@@ -373,4 +376,15 @@ function makeBar($page, $pages, $baseurl, $firstdisplayed, $lastdisplayed)
echo '</table><br>' . "\n";
}
// This message is printed out if an error
// is encountered while searching the site
function searchError()
{
echo '<b>There was an error executing this query.</b><br /><br />
Please try later, or <a href="/mirrors.php">use another mirror
with local search support</a>.<br /><br />';
commonFooter();
exit;
}
?>