Searching for
:
Error performing search!\n\n\t- Administrator\n\t\t
- Please check System-Specific variables defined at the beginning of the script.
");
// Jump out to HTML and set the table...
/************************************/
$i=0;
while(substr($aryResults[$i],0,1) == "#" || substr($aryResults[$i],0,3) == "err" && $i < 50):
$strResultsClean = $aryResults[$i];
// Correct for offset caused by SWISH-E Comments.
$intPageOffsetCorrect++;
//Explodes the Comment into an array
$aryComment = Explode(": ", strstr($strResultsClean, " "));
fncDebug($aryComment[0], $aryComment[1], 2);
// Print number of results
If (trim($aryComment[0]) == "Number of hits") {
$intNumHits = trim($aryComment[1]);
if ($intNumHits > 0) {
if ($intNumHits >= $intMaxHits) {
//Print 0 as 1
If($intPageOffset == 0){$intPageOffsetOne = $intPageOffset + 1;}
Else{$intPageOffsetOne = $intPageOffset;};
// What is the result number of the last document
If ($intNumHits > $intMaxHitsOffset){$intPageHitsThru = $intMaxHitsOffset;}
Else {$intPageHitsThru = $intNumHits;};
// At which results am I looking
echo "Displaying $intPageOffsetOne through $intPageHitsThru of $intNumHits results. \n\n";
print "\n";
} else {
// If in the off chance it is a small result, under MaxHits.
print "$intNumHits results found. \n\n";
print "\n";
};
};
};
// Set the strBaseURL if it isn't in the config already.
If (trim($aryComment[0]) == "Pointer" && !isset($strBaseURL)){
$strBaseURL = trim($aryComment[1]);
fncDebug("URL Pointer",$strBaseURL, 3);
};
fncDebug("strResultsClean", $strResultsClean, 3);
// Crappy No Results "err:" handling. Will be fixed someday, maybe...
if(substr($strResultsClean,0,3) == "err"){
print "No match for your search!\n";
print "\n\tUser: Please try adjusting the search criteria and/or changing the words.\n ";
};
$i++;
endwhile;
/******************************************/
$i = $intPageOffset + $intPageOffsetCorrect;
while(substr($aryResults[$i],0,1) != "#" && substr($aryResults[$i],0,3) != "err" && $aryResults[$i] != "" && $aryResults[$i] != "." && $i <= $intPageOffset + $intPageOffsetCorrect + $intMaxHits):
$strResultsClean = $aryResults[$i];
// if (substr($strResultsClean,0,1) != "#" && substr($strResultsClean,0,3) != "err"){
// if (!ereg("^#.*",$strResultsClean) && !ereg("^e.*",$strResultsClean) && $i >= $intPageOffset){
//$strResultsClean String Format:
// ""
// Array exploded on Double-Quote ("):
// [RANK URL :0][TITLE:1][ SIZE:2]
/* Take note of evil whitespace in the array values,
** which must be trimmed later.*/
$aryResultLine = explode("\"", $strResultsClean);
$j=0;
while($aryResultLine[$j]):
// Find the position, from begin, of the first space, then:
// Rank is everything from begin to the first space trimming whitespace.
$intResultRank = trim(substr($aryResultLine[0], 0, strpos($aryResultLine[0]," ")));
/* URL everything following first space trimming whitespace.
** Assuming file is under the DOCUMENT_ROOT directory somewhere.
** If not, the file may not be found via HTTP... However,
** if the indexer is configured correctly this is a
** waste of time. Too easy of a mistake to ignore, though. */
// $strResultURL = trim(strstr($aryResultLine[0]," "));
$strResultURL = ereg_replace($strSiteRootDir, "", trim(strstr($aryResultLine[0]," ")));
// The rest is a piece of cake...
$strResultTitle = trim($aryResultLine[1]);
$intResultBytes = trim($aryResultLine[2]);
// Attempt to grab data from each file
if (count($aryMetaList) > 0) {
unset($aryMetaTags);
$strCurrentFile = $strSiteRootDir.$strResultURL ;
if (file_exists($strCurrentFile) && $intGetFileData > 0) {
// Get the META tags from the file
$aryMetaTags = get_meta_tags($strCurrentFile);
// Get the modification date stored in the file system
$strResultModDate = gmdate("\M\o\d\i\f\i\e\d \a\\t H:i:s, \o\\n M d, Y \G\M\T", filemtime($strCurrentFile));
// $aryMetaTags = get_meta_tags("/www/share/apache/htdocs/test/test.html");
}
}
/* This is broken until I find a means of juggling FileSystem:
** versus HTTP resource names. Field not necessary, slows things down,
** but impressive and useful nonetheless. */
$j++;
endwhile;
print "\t- $strResultTitle\n";
print "\t
- \n";
fncDebug("Current File", $strCurrentFile, 4);
reset ($aryMetaList);
$p = 0;
while($aryMetaList[$p]) {
list ($strMetaName, $strLineHeading) = explode("|",$aryMetaList[$p]);
if ($aryMetaTags["$strMetaName"]){print "\t\t$strLineHeading".$aryMetaTags["$strMetaName"]."
\n";}
$p++;
};
print "\t\tScore: $intResultRank, Size: $intResultBytes Bytes, $strResultModDate\n";
$i++;
endwhile;
If ($intNumHits > 0) {print " \n";}
// Print out the Previous and Next buttons
If ($intNumHits > $intMaxHits) {
print "\n\n";
If ($intMaxHits < $intMaxHitsOffset){
print "\t| \n";
$intPrevVal = $intMaxHitsOffset - (2 * $intMaxHits);
print "\t\n";
print "\t | \n";
};
If ($intNumHits > $intMaxHitsOffset){
if ( ( $intNumHits - $intPageHitsThru ) < $intMaxHits ) {
$intNextVal = ( $intNumHits - $intPageHitsThru );
} else {
$intNextVal = $intMaxHits ;
}
print "\t\n";
print "\t\n";
print "\t | \n";
};
print "\t \n \n";
};
//Print the footer and exit
$intTimeComplete = time() - $intTimeBegan;
If ($intTimeComplete < 1){$intTimeComplete = "less than 1 second";}
Else {$intTimeComplete = $intTimeComplete." seconds";};
fncPrintFooter("Search completed in $intTimeComplete.");
?>
|