The search service is currently not available..
"; echo "Please try later.\n"; commonFooter(); exit; } // We can redirect to the php.net search page else { $location = "http://ch.php.net/search.php"; $query = "show=$show&pattern=" . urlencode($pattern) . "&base=" . urlencode($MYSITE) . "&lang=$lang"; header("Location: $location?$query"); exit; } } // The local search engine is in place, and some // local search function is needed, so try to do it else { // Print out common headers commonHeader("Search Results"); echo "

Search Results

\n"; // This will be the link for new searches (a clean search page) $sourceurl = htmlentities(!isset($base) ? $PHP_SELF : $base . substr($PHP_SELF, 1)); // If the pattern is empty, print out an error, and exit $pattern = trim($pattern); if ($pattern == "") { echo "Error: No search words specified.

"; echo "Click here for a New Search

\n"; commonFooter(); exit; } // We have something to search for, now encode it as appropriate $words = escapeshellcmd(urlencode($pattern)); // Restrict the search to the English manual or the // whole site depending on what the request asked for if ($show == "manual") { $restrict = $MYSITE . "manual/en"; $where = "in the PHP documentation"; } else { $restrict = $MYSITE; $where = "on the PHP website"; } // If we have a page restriction, provide it for htdig if (isset($page)) { $page = intval($page); $pgr = "&page=$page"; } else { $pgr = ""; } // Always exclude the printer friendly pages of both types // The '.php/' exclude is a fix for the bogus index database of php.net, // and may be removed if the index problems are resolved [see bug #20870] $exclude = escapeshellcmd(urlencode("/print/|/printwn/|.php/|/manual/howto/")); // Create the htdig query, and execute the engine $query = "words=$words&config=php&exclude=$exclude&restrict=$restrict$pgr"; exec("$htsearch_prog \"$query\"", $result); // Count the number of result rows $rc = count($result); // 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) { searchError(); } // Create versions insertable in HTML output and URLs too $htmlpt = htmlspecialchars($pattern); $urlpt = urlencode($pattern); // If the third row says there is no match, then we need to inform the user if ($result[2] == "NOMATCH") { echo "Sorry, no documents matched your search for \"$htmlpt\".

"; echo "Continue your search at "; echo "AllTheWeb "; echo "or Google

"; echo "Click here for a New Search on the PHP website

\n"; commonFooter(); 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; // Detect htsearch error, which is returned in a HTML output file if (strpos($matches, "error") > 0) { searchError(); } // String to carry on the search parameters in prev/next URLs $baseurl = substr($PHP_SELF, 1) . "?pattern=" . urlencode($pattern) . "&show=$show"; if (isset($base)) { $baseurl .= "&base=" . urlencode($base); } // We need to preserve the state with a full URL, // as remote searches would otherwise make these links // relative to the originating server $baseurl = $MYSITE . htmlentities($baseurl); // Print out search results information header echo "$matches documents match your search for '$htmlpt' $where:

\n"; echo "Click here for a New Search

\n"; // Top navigation makeBar($page, $pages, $baseurl, $firstdisplayed, $lastdisplayed); // Skip response header, start from index 7 $i = 7; while ($i < $rc) { // If we have not performed a "remote search", leave the text as is if (!isset($base)) { echo preg_replace("/\/gifs\/star/i", "/images/star", $result[$i]); } // Otherwise modify links to point to the referrer site else { echo preg_replace("!http://[^.]+\\.php\\.net/!i", htmlspecialchars($base), preg_replace("/\/gifs\/star/i", "/images/star", $result[$i])); } // Make HTML output readable echo "\n"; // If the result element ended (a or a // depending on htdig version and setup), print out delimiter if (preg_match("!(|)$!", $result[$i])) { echo hdelim("#cccccc"); } // Go to next result element $i++; } echo "
\n"; // Bottom navigation makeBar($page, $pages, $baseurl, $firstdisplayed, $lastdisplayed); // Indicate what search engine we use echo "

Website search powered by " . make_link("http://www.htdig.org/", "ht://Dig") . "

\n"; // End HTML page with footer commonFooter(); } } // else of isset($pattern) else { // Print out common header commonHeader("Site Search"); // Choose the target for the search form if (isset($htsearch_prog)) { $target = $PHP_SELF; } else { $target = "http://ch.php.net/search.php"; } ?>

Search

Search for:

Restrict the search to:

1) { $prev = make_link( $baseurl . '&page=' . ($page - 1), make_image('caret-l.gif', '<') . 'previous page' ); } // Not the last page, we need link to go forward if ($page < $pages) { $next = make_link( $baseurl . '&page=' . ($page + 1), 'next page' . make_image('caret-r.gif', '>') ); } // This goes to the center $display = "Displaying results $firstdisplayed to $lastdisplayed"; // Print out navigation table echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
' . $display . '
' . spacer(1, 1, TRUE) . '
' . $prev . '
' . $next . '

' . "\n"; } // This message is printed out if an error // is encountered while searching the site function searchError() { echo 'There was an error executing this query.

Please try later, or use another mirror with local search support.

'; commonFooter(); exit; } ?>