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:
+19
-5
@@ -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;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user