0) { $query = "SELECT category FROM categories WHERE category_id='$catid'"; $result = mysql_query($query); $row = mysql_fetch_array($result); $category = $row['category']; print "
".$sph_messages['Search'].": ".$sph_messages['Only in category']." \"$category\" ".$sph_messages['All sites']."
"; } ?>
0 && $search==1) print "".$sph_messages['Categories'].""; ?>
0) { $query1 = "SELECT category FROM ".$mysql_table_prefix."categories WHERE category_id='$catid'"; $result = mysql_query($query1); $row = mysql_fetch_array($result); $category = $row['category']; // print "
\n"; // print "$category\n"; $query1 = "SELECT parent_num FROM ".$mysql_table_prefix."categories WHERE category_id=$catid"; $result = mysql_query($query1); if (mysql_num_rows($result)> 0) print "

"; $row = mysql_fetch_array($result); $catid2 = $row['parent_num']; $i=0; while ($catid2<>0) { $query1 = "SELECT category_id, category FROM ".$mysql_table_prefix."categories WHERE category_id='$catid2'"; $result = mysql_query($query1); $row = mysql_fetch_array($result); $catname[$i][1] = $row['category']; $cid = $catname[$i][2] = $row['category_id']; $query1 = "SELECT parent_num FROM ".$mysql_table_prefix."categories WHERE category_id='$cid'"; $result = mysql_query($query1); $row = mysql_fetch_array($result); $catid2 = $row['parent_num']; $i++; } print "".$sph_messages['Categories']." > "; for ($x=count($catname)-1;$x>=0;$x--) { print "".$catname[$x][1]." > "; } print "$category\n"; $query1 = "SELECT * FROM ".$mysql_table_prefix."categories WHERE parent_num=$catid ORDER BY category"; $result = mysql_query($query1); $rows = mysql_num_rows($result); if (mysql_num_rows($result)> 0) print "

".$sph_messages['Categories']."

"; $i=0; for ($x=1; $x<=3; $x++) { while ($i < $rows/(3/$x) ) { $row = mysql_fetch_array($result); $newcatid = $row['category_id']; $category = $row['category']; $query1 = "SELECT count(*) FROM ".$mysql_table_prefix."site_category WHERE category_id=$newcatid"; $result2 = mysql_query($query1); $row2 = mysql_fetch_row($result2); $sites = $row2[0]; print "$category ($sites)
\n"; $i++; } } $query1 = "SELECT url, title, short_desc FROM ".$mysql_table_prefix."sites, ".$mysql_table_prefix."site_category WHERE category_id=$catid AND ".$mysql_table_prefix."sites.site_id=".$mysql_table_prefix."site_category.site_id order by title"; $result = mysql_query($query1); if (mysql_num_rows($result)> 0) print "

".$sph_messages['Web pages']."

"; while ($row = mysql_fetch_array($result)) { $title = $row['title']; $url = $row['url']; $desc = $row['short_desc']; $num++; print "$num. $title
$desc
http://$url

\n"; } ?>


Sphider


"; if ($rows >0) print "".$sph_messages['CATEGORIES'].""; print "\n"; print "
"; if ($rows >0) print "
"; $i=0; for ($x=1; $x<=2;$x++) { while ($j < $rows/(2/$x) ) { $row = mysql_fetch_array($result); $catid = $row['category_id']; $category = $row['category']; $query1 = "SELECT * FROM ".$mysql_table_prefix."categories WHERE parent_num=$catid"; $result2 = mysql_query($query1); $i = 0; print "".$row['category']."
\n  "; print ""; while (($row2 = mysql_fetch_array($result2)) && $i<3) { if ($i != 0) print ", "; $id=$row2['category_id']; print "".$row2['category'].""; $i++; } if ($i> 3) print "..."; print "

"; $j++; } } print "
";?>

0) { print "
"; print "


"; } ?>
Sphider

"; if (count($ignorewords)>0) { print "
".$sph_messages["ignoredWords"]." "; while ($thisword=each($words['ignore'])) { print " ".$thisword[1]; } print "
"; } if ($start==0) $start=1; $result = search($words, $category, $start, $results_per_page); $query= stripslashes($query); $entitiesQuery = htmlspecialchars($query); if ($result==0) print "
".$sph_messages["The search"]." \"$entitiesQuery\" ".$sph_messages["noMatch"].".
"; $endtime = getmicrotime() - $starttime; $rows = $result['results']; $time = round($endtime*100)/100; $matchword = $sph_messages["matches"]; if ($rows == 1) { $matchword= $sph_messages["match"]; } $num_of_results = count($result) - 2; if ($start < 2) saveToLog(addslashes($query), $time, $rows); $from = ($start-1) * $results_per_page+1; $to = min(($start)*$results_per_page, $rows); if ($result != 0 && $from <= $to) print "
".$sph_messages["Results"]." $from-$to".$sph_messages["of"]." $rows $matchword ($time ".$sph_messages["seconds"].")

"; print "
"; if ($rows>0) { $maxweight = $result['maxweight']; $i = 0; while ($i < $num_of_results && $i < $results_per_page) { $title = $result[$i]['title']; $url = $result[$i]['url']; $fulltxt = $result[$i]['fulltxt']; $pageSize = $result[$i]['size']; if ($pageSize!="") $pageSize = "- ".number_format($pageSize, 1)."kb"; $txtlen = strlen($fulltxt); $places = array(); foreach($words['+'] as $word) { $tmp = strtolower($fulltxt); $found_in = strpos($tmp, $word); $sum = -strlen($word); while (!($found_in =='')) { $pos = $found_in+strlen($word); $sum += $pos; //FIX!! $tmp = substr($tmp, $pos); $places[] = $sum; $found_in = strpos($tmp, $word); } } sort($places); $x = 0; $begin = 0; $end = 0; while(list($id, $place) = each($places)) { while ($places[$id + $x] - $place < 250 && $x+$id < count($places) && $place < strlen($fulltxt) -250) { $x++; $begin = $id; $end = $id + $x; } } $begin_pos = max(0, $places[$begin] - 30); $fulltxt = substr($fulltxt, $begin_pos, 250); if ($places[$begin] > 0) { $begin_pos = strpos($fulltxt, " "); } $fulltxt = substr($fulltxt, $begin_pos, 250); $fulltxt = substr($fulltxt, 0, strrpos($fulltxt, " ")); $weight = number_format($result[$i]['weight']/$maxweight*100, 2); if ($title=='') $title = $sph_messages["Untitled"]; foreach($words['+'] as $change) { while (@eregi("[^\>](".$change.")[^\<]", " ".$title." ", $regs)) { $title = eregi_replace($regs[1], "".$regs[1]."", $title); } while (@eregi("[^\>](".$change.")[^\<]", " ".$fulltxt." ", $regs)) { $fulltxt = eregi_replace($regs[1], "".$regs[1]."", $fulltxt); } $url2 = $url; while (@eregi("[^\>](".$change.")[^\<]", $url2, $regs)) { $url2 = eregi_replace($regs[1], "".$regs[1]."", $url2); } } if ($show_query_scores == 0) { $weight = ''; } else $weight = '['.$weight.'%]'; $num = $from + $i; print "$num. $weight $title
...$fulltxt...
http://$url2 $pageSize

\n"; $i++; } } $pages = ceil($rows / $results_per_page); $prev = $start - 1; $next = $start + 1; if ($from <= $to) { if ($pages > 0) print "
".$sph_messages["Result page"].": "; if ($start<>1) print "".$sph_messages["Previous"]." "; $firstpage = $start - $links_to_next; if ($firstpage < 1) $firstpage = 1; $lastpage = $start + $links_to_next; if ($lastpage > $pages) $lastpage = $pages; for ($x=$firstpage; $x<=$lastpage; $x++) if ($x<>$start) { print "$x "; } else print "$x "; if ($next <= $pages) print "".$sph_messages["Next"].""; } if ($pages > 0 && $from <=$to) { print "
"; ?>


Sphider



Sphider