home *** CD-ROM | disk | FTP | other *** search
/ PC World 2005 April / PCWorld_2005-04_cd.bin / akce / web / phpnuke / PHP-Nuke-7.5.exe / html / modules / Search / index.php
PHP Script  |  2004-08-21  |  23KB  |  471 lines

  1. <?php
  2.  
  3. /************************************************************************/
  4. /* PHP-NUKE: Web Portal System                                          */
  5. /* ===========================                                          */
  6. /*                                                                      */
  7. /* Copyright (c) 2002 by Francisco Burzi                                */
  8. /* http://phpnuke.org                                                   */
  9. /*                                                                      */
  10. /* This program is free software. You can redistribute it and/or modify */
  11. /* it under the terms of the GNU General Public License as published by */
  12. /* the Free Software Foundation; either version 2 of the License.       */
  13. /************************************************************************/
  14. /*         Additional security & Abstraction layer conversion           */
  15. /*                           2003 chatserv                              */
  16. /*      http://www.nukefixes.com -- http://www.nukeresources.com        */
  17. /************************************************************************/
  18.  
  19. if (!eregi("modules.php", $_SERVER['PHP_SELF'])) {
  20.     die ("You can't access this file directly...");
  21. }
  22.  
  23. require_once("mainfile.php");
  24. $module_name = basename(dirname(__FILE__));
  25. get_lang($module_name);
  26.  
  27.     global $admin, $prefix, $db, $module_name, $articlecomm, $multilingual;
  28. if ($multilingual == 1) {
  29.     $queryalang = "AND (s.alanguage='$currentlang' OR s.alanguage='')"; /* stories */
  30.     $queryrlang = "AND rlanguage='$currentlang' "; /* reviews */
  31. } else {
  32.     $queryalang = "";
  33.     $queryrlang = "";
  34.     $queryslang = "";
  35. }
  36.  
  37. switch($op) {
  38.  
  39.         case "comments":
  40.                 break;
  41.  
  42.         default:
  43.         $ThemeSel = get_theme();
  44.                 $offset=10;
  45.                 if (!isset($min)) $min=0;
  46.                 if (!isset($max)) $max=$min+$offset;
  47.                 $query = stripslashes(check_html($query, nohtml));
  48.         $pagetitle = "- "._SEARCH."";
  49.                 include("header.php");
  50.                 $topic = intval($topic);
  51.         if ($topic>0) {
  52.             $row = $db->sql_fetchrow($db->sql_query("SELECT topicimage, topictext from ".$prefix."_topics where topicid='$topic'"));
  53.             $topicimage = stripslashes($row['topicimage']);
  54.             $topictext = stripslashes(check_html($row['topictext'], "nohtml"));
  55.             if (file_exists("themes/$ThemeSel/images/topics/$topicimage")) {
  56.             $topicimage = "themes/$ThemeSel/images/topics/$topicimage";
  57.             } else {
  58.             $topicimage = "$tipath/$topicimage";
  59.             }
  60.         } else {
  61.             $topictext = ""._ALLTOPICS."";
  62.             if (file_exists("themes/$ThemeSel/images/topics/AllTopics.gif")) {
  63.             $topicimage = "themes/$ThemeSel/images/topics/AllTopics.gif";
  64.             } else {
  65.             $topicimage = "$tipath/AllTopics.gif";
  66.             }
  67.         }
  68.         if (file_exists("themes/$ThemeSel/images/topics/AllTopics.gif")) {
  69.             $alltop = "themes/$ThemeSel/images/topics/AllTopics.gif";
  70.         } else {
  71.             $alltop = "$tipath/AllTopics.gif";
  72.         }
  73.         OpenTable();
  74.         if ($type == "users") {
  75.             echo "<center><font class=\"title\"><b>"._SEARCHUSERS."</b></font></center><br>";
  76.         } elseif ($type == "reviews") {
  77.             echo "<center><font class=\"title\"><b>"._SEARCHREVIEWS."</b></font></center><br>";
  78.         } elseif ($type == "comments" AND isset($sid)) {
  79.             $res = $db->sql_query("select title from ".$prefix."_stories where sid='$sid'");
  80.             list($st_title) = $db->sql_fetchrow($res);
  81.             $st_title = stripslashes(check_html($st_title, "nohtml"));
  82.             $instory = "AND sid='$sid'";
  83.             echo "<center><font class=\"title\"><b>"._SEARCHINSTORY." $st_title</b></font></center><br>";
  84.         } else {
  85.             echo "<center><font class=\"title\"><b>"._SEARCHIN." $topictext</b></font></center><br>";
  86.         }
  87.  
  88.         echo "<table width=\"100%\" border=\"0\"><TR><TD>";
  89.         if (($type == "users") OR ($type == "reviews")) {
  90.             echo "<img src=\"$alltop\" align=\"right\" border=\"0\" alt=\"\">";
  91.                 } else {
  92.             echo "<img src=\"$topicimage\" align=\"right\" border=\"0\" alt=\"$topictext\">";
  93.         }
  94.         echo "<form action=\"modules.php?name=$module_name\" method=\"POST\">"
  95.                     ."<input size=\"25\" type=\"text\" name=\"query\" value=\"$query\">  "
  96.             ."<input type=\"submit\" value=\""._SEARCH."\"><br><br>";
  97.         if (isset($sid)) {
  98.             echo "<input type='hidden' name='sid' value='$sid'>";
  99.         }
  100.                 echo "<!-- Topic Selection -->";
  101.         $toplist = $db->sql_query("SELECT topicid, topictext from ".$prefix."_topics order by topictext");
  102.         echo "<select name=\"topic\">";
  103.                 echo "<option value=\"\">"._ALLTOPICS."</option>\n";
  104.                 while($row2 = $db->sql_fetchrow($toplist)) {
  105.                 $topicid = intval($row2['topicid']);
  106.                 $topics = stripslashes(check_html($row2['topictext'], "nohtml"));
  107.                         if ($topicid==$topic) { $sel = "selected "; }
  108.                         echo "<option $sel value=\"$topicid\">$topics</option>\n";
  109.             $sel = "";
  110.                 }
  111.         echo "</select>";
  112.         /* Category Selection */
  113.         $category = intval($category);
  114.         echo " <select name=\"category\">";
  115.                 echo "<option value=\"0\">"._ARTICLES."</option>\n";
  116.         $result3 = $db->sql_query("SELECT catid, title from ".$prefix."_stories_cat order by title");
  117.         while ($row3 = $db->sql_fetchrow($result3)) {
  118.         $catid = intval($row3['catid']);
  119.         $title = stripslashes(check_html($row3['title'], "nohtml"));
  120.                         if ($catid==$category) { $sel = "selected "; }
  121.                         echo "<option $sel value=\"$catid\">$title</option>\n";
  122.             $sel = "";
  123.                 }
  124.         echo "</select>";
  125.         /* Authors Selection */
  126.                 $thing = $db->sql_query("SELECT aid from ".$prefix."_authors order by aid");
  127.         echo " <select name=\"author\">";
  128.                 echo "<option value=\"\">"._ALLAUTHORS."</option>\n";
  129.                 while($row4 = $db->sql_fetchrow($thing)) {
  130.                 $authors = stripslashes($row4['aid']);
  131.                         if ($authors==$author) { $sel = "selected "; }
  132.             echo "<option value=\"$authors\">$authors</option>\n";
  133.             $sel = "";
  134.                 }
  135.                 echo "</select>";
  136.                 /* Date Selection */
  137.                 ?>
  138.          <select name="days">
  139.                         <option <?php echo $days == 0 ? "selected " : ""; ?> value="0"><?php echo _ALL ?></option>
  140.                         <option <?php echo $days == 7 ? "selected " : ""; ?> value="7">1 <?php echo _WEEK ?></option>
  141.                         <option <?php echo $days == 14 ? "selected " : ""; ?> value="14">2 <?php echo _WEEKS ?></option>
  142.                         <option <?php echo $days == 30 ? "selected " : ""; ?> value="30">1 <?php echo _MONTH ?></option>
  143.             <option <?php echo $days == 60 ? "selected " : ""; ?> value="60">2 <?php echo _MONTHS ?></option>
  144.                         <option <?php echo $days == 90 ? "selected " : ""; ?> value="90">3 <?php echo _MONTHS ?></option>
  145.                 </select><br>
  146.         <?php
  147.         if (($type == "stories") OR ($type == "")) {
  148.             $sel1 = "checked";
  149.         } elseif ($type == "comments") {
  150.             $sel2 = "checked";
  151.         } elseif ($type == "users") {
  152.             $sel3 = "checked";
  153.         } elseif ($type == "reviews") {
  154.             $sel4 = "checked";
  155.         }
  156.         $num_rev = $db->sql_numrows($db->sql_query("SELECT * from ".$prefix."_reviews"));
  157.         echo ""._SEARCHON."";
  158.         echo "<input type=\"radio\" name=\"type\" value=\"stories\" $sel1> "._SSTORIES."";
  159.         if ($articlecomm == 1) {
  160.             echo "<input type=\"radio\" name=\"type\" value=\"comments\" $sel2> "._SCOMMENTS."";
  161.         }
  162.         echo "<input type=\"radio\" name=\"type\" value=\"users\" $sel3> "._SUSERS."";
  163.         if ($num_rev > 0) {
  164.             echo "<input type=\"radio\" name=\"type\" value=\"reviews\" $sel4> "._REVIEWS."";
  165.                 }
  166.         echo "</form></td></tr></table>";
  167.         $query = stripslashes(check_html($query, "nohtml"));
  168.     if ($type=="stories" OR !$type) {
  169.  
  170.         if ($category > 0) {
  171.             $categ = "AND catid='$category' ";
  172.         } else {
  173.             $categ = "";
  174.         }
  175.                 $q = "select s.sid, s.aid, s.informant, s.title, s.time, s.hometext, s.bodytext, a.url, s.comments, s.topic from ".$prefix."_stories s, ".$prefix."_authors a where s.aid=a.aid $queryalang $categ";
  176.                 if (isset($query)) $q .= "AND (s.title LIKE '%$query%' OR s.hometext LIKE '%$query%' OR s.bodytext LIKE '%$query%' OR s.notes LIKE '%$query%') ";
  177.                 if ($author != "") $q .= "AND s.aid='$author' ";
  178.                 if ($topic != "") $q .= "AND s.topic='$topic' ";
  179.                 if ($days != "" && $days!=0) $q .= "AND TO_DAYS(NOW()) - TO_DAYS(time) <= '$days' ";
  180.                 $q .= " ORDER BY s.time DESC LIMIT $min,$offset";
  181.         $t = $topic;
  182.                 $result5 = $db->sql_query($q);
  183.                 $nrows = $db->sql_numrows($result5);
  184.                 $x=0;
  185.         if ($query != "") {
  186.         echo "<br><hr noshade size=\"1\"><center><b>"._SEARCHRESULTS."</b></center><br><br>";
  187.                 echo "<table width=\"99%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n";
  188.         if ($nrows>0) {
  189.             while($row5 = $db->sql_fetchrow($result5)) {
  190.                 $sid = intval($row5['sid']);
  191.                 $aid = stripslashes($row5['aid']);
  192.                 $informant = stripslashes($row5['informant']);
  193.                 $title = stripslashes(check_html($row5['title'], "nohtml"));
  194.                 $time = $row5['time'];
  195.                 $hometext = stripslashes($row5['hometext']);
  196.                 $bodytext = stripslashes($row5['bodytext']);
  197.                 $url = stripslashes($row5['url']);
  198.                 $comments = intval($row5['comments']);
  199.                 $topic = intval($row5['topic']);
  200.                 $row6 = $db->sql_fetchrow($db->sql_query("SELECT topictext from ".$prefix."_topics where topicid='$topic'"));
  201.                 $topictext = stripslashes(check_html($row6['topictext'], "nohtml"));
  202.                 
  203.                 $furl = "modules.php?name=News&file=article&sid=$sid";
  204.                 $datetime = formatTimestamp($time);
  205.                 $query = stripslashes(check_html($query, "nohtml"));
  206.                 if ($informant == "") {
  207.                     $informant = $anonymous;
  208.                 } else {
  209.                     $informant = "<a href=\"modules.php?name=Your_Account&op=userinfo&username=$informant\">$informant</a>";
  210.                 }
  211.                 if ($query != "" AND $query != "*") {
  212.                     if (eregi(quotemeta($query),$title)) {
  213.                     $a = 1;
  214.                     }
  215.                     $text = "$hometext$bodytext";
  216.                     if (eregi(quotemeta($query),$text)) {
  217.                     $a = 2;
  218.                     }
  219.                     if (eregi(quotemeta($query),$text) AND eregi(quotemeta($query),$title)) {
  220.                     $a = 3;
  221.                     }
  222.                     if ($a == 1) {
  223.                     $match = _MATCHTITLE;
  224.                     } elseif ($a == 2) {
  225.                     $match = _MATCHTEXT;
  226.                     } elseif ($a == 3) {
  227.                     $match = _MATCHBOTH;
  228.                     }
  229.                     if (!isset($a)) {
  230.                     $match = "";
  231.                     } else {
  232.                     $match = "$match<br>";
  233.                     }
  234.                 }
  235.                                 printf("<tr><td><img src=\"images/folders.gif\" border=\"0\" alt=\"\"> <font class=\"option\"><a href=\"%s\"><b>%s</b></a></font><br><font class=\"content\">"._CONTRIBUTEDBY." $informant<br>"._POSTEDBY." <a href=\"%s\">%s</a>",$furl,$title,$url,$aid,$informant);
  236.                                 echo " "._ON." $datetime<br>"
  237.                     ."$match"
  238.                     .""._TOPIC.": <a href=\"modules.php?name=$module_name&query=&topic=$topic\">$topictext</a> ";
  239.                 if ($comments == 0) {
  240.                     echo "("._NOCOMMENTS.")";
  241.                 } elseif ($comments == 1) {
  242.                     echo "($comments "._UCOMMENT.")";
  243.                                 } elseif ($comments >1) {
  244.                     echo "($comments "._UCOMMENTS.")";
  245.                 }
  246.                 if (is_admin($admin)) {
  247.                     echo " [ <a href=\"admin.php?op=EditStory&sid=$sid\">"._EDIT."</a> | <a href=\"admin.php?op=RemoveStory&sid=$sid\">"._DELETE."</a> ]";
  248.                 }
  249.                 echo "</font><br><br><br></td></tr>\n";
  250.                 $x++;
  251.                         }
  252.  
  253.         echo "</table>";
  254.         } else {
  255.                         echo "<tr><td><center><font class=\"option\"><b>"._NOMATCHES."</b></font></center><br><br>";
  256.             echo "</td></tr></table>";
  257.                 }
  258.  
  259.                 $prev=$min-$offset;
  260.                 if ($prev>=0) {
  261.                         print "<br><br><center><a href=\"modules.php?name=$module_name&author=$author&topic=$t&min=$prev&query=$query&type=$type&category=$category\">";
  262.                         print "<b>$min "._PREVMATCHES."</b></a></center>";
  263.                 }
  264.  
  265.                 $next=$min+$offset;
  266.         if ($x>=9) {
  267.                         print "<br><br><center><a href=\"modules.php?name=$module_name&author=$author&topic=$t&min=$max&query=$query&type=$type&category=$category\">";
  268.                         print "<b>"._NEXTMATCHES."</b></a></center>";
  269.                 }
  270.         }
  271.  
  272.     } elseif ($type=="comments") {
  273. /*
  274.                 $sid = intval($sid);
  275.         if (isset($sid)) {
  276.         $row7 = $db->sql_fetchrow($db->sql_query("SELECT title from ".$prefix."_stories where sid='$sid'"));
  277.         $st_title = stripslashes(check_html($row7['title'], "nohtml"));
  278.         $instory = "AND sid='$sid'";
  279.         } else {
  280.         $instory = "";
  281.         }
  282. */
  283.             $result8 = $db->sql_query("SELECT tid, sid, subject, date, name from ".$prefix."_comments where (subject like '%$query%' OR comment like '%$query%') order by date DESC limit $min,$offset");
  284.             $nrows = $db->sql_numrows($result8);
  285.             $x=0;
  286.         if ($query != "") {
  287.         echo "<br><hr noshade size=\"1\"><center><b>"._SEARCHRESULTS."</b></center><br><br>";
  288.         echo "<table width=\"99%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n";
  289.         if ($nrows>0) {
  290.             while($row8 = $db->sql_fetchrow($result8)) {
  291.                 $tid = intval($row8['tid']);
  292.                 $sid = intval($row8['sid']);
  293.                 $subject = stripslashes(check_html($row8['subject'], "nohtml"));
  294.                 $date = $row8['date'];
  295.                 $name = stripslashes($row8['name']);
  296.                 $row_res = $db->sql_fetchrow($db->sql_query("SELECT title from ".$prefix."_stories where sid='$sid'"));
  297.                 $title = stripslashes(check_html($row_res['title'], "nohtml"));
  298.                 $reply = $db->sql_numrows($db->sql_query("SELECT * from ".$prefix."_comments where pid='$tid'"));
  299.                 $furl = "modules.php?name=News&file=article&thold=-1&mode=flat&order=1&sid=$sid#$tid";
  300.                 if(!$name) {
  301.                     $name = "$anonymous";
  302.                 } else {
  303.                     $name = "<a href=\"modules.php?name=Your_Account&op=userinfo&username=$name\">$name</a>";
  304.                 }
  305.                 $datetime = formatTimestamp($date);
  306.                 echo "<tr><td><img src=\"images/folders.gif\" border=\"0\" alt=\"\"> <font class=\"option\"><a href=\"$furl\"><b>$subject</b></a></font><font class=\"content\"><br>"._POSTEDBY." $name"
  307.                       ." "._ON." $datetime<br>"
  308.                     .""._ATTACHART.": $title<br>";
  309.                 if ($reply == 1) {
  310.                     echo "($reply "._SREPLY.")";
  311.                     if (is_admin($admin)) {
  312.                         echo " [ <a href=\"admin.php?op=RemoveComment&tid=$tid&sid=$sid\">"._DELETE."</a> ]";
  313.                     }
  314.                     echo "<br><br><br></td></tr>\n";
  315.                 } else {
  316.                     echo "($reply "._SREPLIES.")";
  317.                     if (is_admin($admin)) {
  318.                         echo " [ <a href=\"admin.php?op=RemoveComment&tid=$tid&sid=$sid\">"._DELETE."</a> ]";
  319.                     }
  320.                     echo "<br><br><br></td></tr>\n";
  321.                 }
  322.                 $x++;
  323.             }
  324.             echo "</table>";
  325.         } else {
  326.             echo "<tr><td><center><font class=\"option\"><b>"._NOMATCHES."</b></font></center><br><br>";
  327.             echo "</td></tr></table>";
  328.         }
  329.  
  330.                 $prev=$min-$offset;
  331.                 if ($prev>=0) {
  332.                         print "<br><br><center><a href=\"modules.php?name=$module_name&author=$author&topic=$topic&min=$prev&query=$query&type=$type\">";
  333.                         print "<b>$min "._PREVMATCHES."</b></a></center>";
  334.                 }
  335.  
  336.                 $next=$min+$offset;
  337.         if ($x>=9) {
  338.                         print "<br><br><center><a href=\"modules.php?name=$module_name&author=$author&topic=$topic&min=$max&query=$query&type=$type\">";
  339.                         print "<b>"._NEXTMATCHES."</b></a></center>";
  340.                 }
  341.         }
  342.     } elseif ($type=="reviews") {
  343.             $res_n = $db->sql_query("SELECT id, title, text, reviewer, score from ".$prefix."_reviews where (title like '%$query%' OR text like '%$query%') $queryrlang order by date DESC limit $min,$offset");
  344.             $nrows = $db->sql_numrows($res_n);
  345.             $x=0;
  346.         if ($query != "") {
  347.         echo "<br><hr noshade size=\"1\"><center><b>"._SEARCHRESULTS."</b></center><br><br>";
  348.         echo "<table width=\"99%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n";
  349.         if ($nrows>0) {
  350.                     while($rown = $db->sql_fetchrow($res_n)) {
  351.                         $id = intval($rown['id']);
  352.                         $title = stripslashes(check_html($rown['title'], "nohtml"));
  353.                         $text = stripslashes($rown['text']);
  354.                         $reviewer = stripslashes($rown['reviewer']);
  355.             $furl = "modules.php?name=Reviews&op=showcontent&id=$id";
  356.             $pages = count(explode( "<!--pagebreak-->", $text ));
  357.                         echo "<tr><td><img src=\"images/folders.gif\" border=\"0\" alt=\"\"> <font class=\"option\"><a href=\"$furl\"><b>$title</b></a></font><br>"
  358.                 ."<font class=\"content\">"._POSTEDBY." $reviewer<br>"
  359.                 .""._REVIEWSCORE.": $score/10<br>";
  360.             if ($pages == 1) {
  361.                 echo "($pages "._PAGE.")";
  362.                         } else {
  363.                 echo "($pages "._PAGES.")";
  364.             }
  365.             if (is_admin($admin)) {
  366.                 echo " [ <a href=\"modules.php?name=Reviews&op=mod_review&id=$id\">"._EDIT."</a> | <a href=\"modules.php?name=Reviews.php&op=del_review&id_del=$id\">"._DELETE."</a> ]";
  367.             }
  368.                         print "<br><br><br></font></td></tr>\n";
  369.                         $x++;
  370.                     }
  371.             echo "</table>";
  372.         } else {
  373.                     echo "<tr><td><center><font class=\"option\"><b>"._NOMATCHES."</b></font></center><br><br>";
  374.             echo "</td></tr></table>";
  375.                 }
  376.  
  377.                 $prev=$min-$offset;
  378.                 if ($prev>=0) {
  379.                         print "<br><br><center><a href=\"modules.php?name=$module_name&author=$author&topic=$t&min=$prev&query=$query&type=$type\">";
  380.                         print "<b>$min "._PREVMATCHES."</b></a></center>";
  381.                 }
  382.  
  383.                 $next=$min+$offset;
  384.         if ($x>=9) {
  385.                         print "<br><br><center><a href=\"modules.php?name=$module_name&author=$author&topic=$t&min=$max&query=$query&type=$type\">";
  386.                         print "<b>"._NEXTMATCHES."</b></a></center>";
  387.                 }
  388.         }
  389.     } elseif ($type=="users") {
  390.             $res_n3 = $db->sql_query("SELECT user_id, username, name from ".$user_prefix."_users where (username like '%$query%' OR name like '%$query%' OR bio like '%$query%') order by username ASC limit $min,$offset");
  391.             $nrows = $db->sql_numrows($res_n3);
  392.             $x=0;
  393.         if ($query != "") {
  394.         echo "<br><hr noshade size=\"1\"><center><b>"._SEARCHRESULTS."</b></center><br><br>";
  395.         echo "<table width=\"99%\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\">\n";
  396.         if ($nrows>0) {
  397.                         while($rown3 = $db->sql_fetchrow($res_n3)) {
  398.                             $uid = intval($rown3['user_id']);
  399.                             $uname = stripslashes($rown3['username']);
  400.                             $name = stripslashes($rown3['name']);
  401.                 $furl = "modules.php?name=Your_Account&op=userinfo&username=$uname";
  402.                 if ($name=="") {
  403.                 $name = ""._NONAME."";
  404.                 }
  405.                             echo "<tr><td><img src=\"images/folders.gif\" border=\"0\" alt=\"\"> <font class=\"option\"><a href=\"$furl\"><b>$uname</b></a></font><font class=\"content\"> ($name)";
  406.                 if (is_admin($admin)) {
  407.                 echo " [ <a href=\"admin.php?chng_uid=$uid&op=modifyUser\">"._EDIT."</a> | <a href=\"admin.php?op=delUser&chng_uid=$uid\">"._DELETE."</a> ]";
  408.                 }
  409.                 echo "</font></td></tr>\n";
  410.                             $x++;
  411.                         }
  412.  
  413.         echo "</table>";
  414.         } else {
  415.                         echo "<tr><td><center><font class=\"option\"><b>"._NOMATCHES."</b></font></center><br><br>";
  416.             echo "</td></tr></table>";
  417.                 }
  418.  
  419.                 $prev=$min-$offset;
  420.                 if ($prev>=0) {
  421.                         print "<br><br><center><a href=\"modules.php?name=$module_name&author=$author&topic=$t&min=$prev&query=$query&type=$type\">";
  422.                         print "<b>$min "._PREVMATCHES."</b></a></center>";
  423.                 }
  424.  
  425.                 $next=$min+$offset;
  426.         if ($x>=9) {
  427.                         print "<br><br><center><a href=\"modules.php?name=$module_name&author=$author&topic=$t&min=$max&query=$query&type=$type\">";
  428.                         print "<b>"._NEXTMATCHES."</b></a></center>";
  429.                 }
  430.         }
  431.     }
  432.     CloseTable();
  433.     if (isset($query) AND $query != "") {
  434.     echo "<br>";
  435.     if (is_active("Downloads")) {
  436.         $dcnt = $db->sql_numrows($db->sql_query("SELECT * from ".$prefix."_downloads_downloads WHERE title LIKE '%$query%' OR description LIKE '%$query%'"));
  437.         $mod1 = "<li> <a href=\"modules.php?name=Downloads&d_op=search&query=$query\">"._DOWNLOADS."</a> ($dcnt "._SEARCHRESULTS.")";
  438.     }
  439.     if (is_active("Web_Links")) {
  440.         $lcnt = $db->sql_numrows($db->sql_query("SELECT * from ".$prefix."_links_links WHERE title LIKE '%$query%' OR description LIKE '%$query%'"));
  441.         $mod2 = "<li> <a href=\"modules.php?name=Web_Links&l_op=search&query=$query\">"._WEBLINKS."</a> ($lcnt "._SEARCHRESULTS.")";
  442.     }
  443.     if (is_active("Encyclopedia")) {
  444.         $ecnt1 = $db->sql_query("SELECT eid from ".$prefix."_encyclopedia WHERE active='1'");
  445.         $ecnt = 0;
  446.         while($row_e = $db->sql_fetchrow($ecnt1)) {
  447.                 $eid = intval($row_e['eid']);
  448.         $ecnt2 = $db->sql_numrows($db->sql_query("select * from ".$prefix."_encyclopedia WHERE title LIKE '%$query%' OR description LIKE '%$query%' AND eid='$eid'"));
  449.         $ecnt3 = $db->sql_numrows($db->sql_query("select * from ".$prefix."_encyclopedia_text WHERE title LIKE '%$query%' OR text LIKE '%$query%' AND eid='$eid'"));
  450.         $ecnt = $ecnt+$ecnt2+$ecnt3;
  451.         }
  452.         $mod3 = "<li> <a href=\"modules.php?name=Encyclopedia&file=search&query=$query\">"._ENCYCLOPEDIA."</a> ($ecnt "._SEARCHRESULTS.")";
  453.     }
  454.     OpenTable();
  455.     echo "<font class=\"title\">"._FINDMORE."<br><br>"
  456.         .""._DIDNOTFIND."</font><br><br>"
  457.         .""._SEARCH." \"<b>$query</b>\" "._ON.":<br><br>"
  458.         ."<ul>"
  459.         ."$mod1"
  460.         ."$mod2"
  461.         ."$mod3"
  462.         ."<li> <a href=\"http://www.google.com/search?q=$query\" target=\"new\">Google</a>"
  463.         ."<li> <a href=\"http://groups.google.com/groups?q=$query\" target=\"new\">Google Groups</a>"
  464.         ."</ul>";
  465.     CloseTable();
  466.     }
  467.     include("footer.php");
  468.     break;
  469. }
  470.  
  471. ?>