/*
You need to grab http://www.php.net/Mirrors-htdig.tgz and follow the
directions in there if you want to run the search engine on your
mirror (or emulate it on your own website).
*/
if (isset($pattern) && ($pattern)) {
SetCookie("prevsearch",$pattern,0,"",".php.net");
}
require("shared.inc");
$HAVE_SEARCH=$MIRRORS[$MYSITE][5];
if (isset($pattern) && ($pattern)) {
$location = "http://www.progressive-comp.com/Lists/";
if ($show=="maillist") {
$query = "l=php3-general&r=1&w=2&s=".urlencode($pattern);
Header("Location: ".$location."?".$query);
exit;
} else if ($show=="devlist") {
$query = "l=php-dev&r=1&w=2&s=".urlencode($pattern);
Header("Location: ".$location."?".$query);
exit;
}
if (!$HAVE_SEARCH) {
$location="http://uk.php.net/search.php3";
$query = "show=".$show."&pattern=".urlencode($pattern)."&sourceurl=".urlencode($MYSITE);
Header("Location: ".$location."?".$query);
exit;
}
}
include("configuration.inc");
function makeBar($no,$page,$pages,$baseurl,$firstdisplayed,$lastdisplayed) {
global $FONTFACE;
if ($page>1) {
$i=$page-1;
$last="
";
} else {
$last=" ";
}
if ($page<$pages) {
$i=$page+1;
$next="
";
} else {
$next=" ";
}
$middle="Displaying results $firstdisplayed to $lastdisplayed";
echo "
\n";
echo "\n";
echo "
| \n";
echo "$last
| \n";
echo "$middle
| \n";
echo "$next
| \n";
echo "
| \n";
echo "
\n";
}
if(!isset($pattern)) {
$DISABLE_KICKOUTS = true;
commonHeader("Site Search");
$form=$PHP_SELF;
?>
} else {
commonHeader("Search Results");
if ($HAVE_SEARCH) {
$form=$PHP_SELF;
} else {
$form="http://uk.php.net/search.php3";
}
if (!isset($base)) {
if (ereg("^(.+//[^/]+)/",$HTTP_REFERER,&$reg)) {
$base=$reg[1];
}
if ($base==$MYSITE) {
$base="-";
}
}
if ($base=="-") {
$sourceurl=$PHP_SELF;
} else {
$sourceurl=$base.$PHP_SELF;
}
if ($pattern=="") {
echo "Error: No search words specified.
";
echo "Click here for a New Search
\n";
CommonFooter();
exit();
}
$words=EscapeShellCmd(UrlEncode($pattern));
$config="php";
if ($show=="source") {
$exclude="/manual";
$restrict=$MYSITE."source";
$where="PHP3 site source code";
} elseif ($show=="manual") {
$restrict=$MYSITE."manual";
$exclude="/source";
$where="PHP documentation";
} else {
$exclude="/source";
$restrict=$MYSITE;
$where="PHP3 web site";
}
if (isset($page)) {$off="&page=$page";} else {$off="";}
$query="words=$words&config=$config&exclude=$exclude&restrict=$restrict$off";
exec("$htsearch_prog \"$query\"",&$result);
$rc=count($result);
if ($rc<2) {
echo "There was an error executing this query.
Please try later
";
commonFooter();
exit;
}
if ($result[2]=="NOMATCH") {
echo "Sorry, no documents matched your search for"".$pattern."".
";
echo "Click here for a New Search
\n";
commonFooter();
exit;
}
$matches=$result[2];
$firstdisplayed=$result[3];
$lastdisplayed=$result[4];
$page=$result[5];
$pages=$result[6];
$baseurl=$PHP_SELF."?pattern=$words&show=$show&base=$base";
echo "$matches documents match your search for '$pattern' in the $where:
\n";
echo "Click here for a New Search
\n";
makeBar("",$page,$pages,$baseurl,$firstdisplayed,$lastdisplayed);
$i=7; #skip response header
while($i<$rc) {
if ($base=="-") {
echo $result[$i];
} else {
echo eregi_replace("http://[^.]+\.php\.net/","$base/",$result[$i]);
}
echo "\n";
$i++;
}
echo "
\n";
makeBar("2",$page,$pages,$baseurl,$firstdisplayed,$lastdisplayed);
?>
Search results courtesy of
}
commonFooter();
?>