/[nuke]/html/search.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /html/search.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (hide annotations) (vendor branch)
Fri Sep 22 07:22:13 2000 UTC (23 years, 7 months ago) by dpavlin
Branch: dbp, MAIN
CVS Tags: r3_6, HEAD
Changes since 1.1: +0 -0 lines
import of version 3.6

1 dpavlin 1.1 <?php
2    
3     ######################################################################
4     # PHP-NUKE: Web Portal System
5     # ===========================
6     #
7     # Copyright (c) 2000 by Francisco Burzi (fburzi@ncc.org.ve)
8     # http://www.ncc.org.ve/php-nuke.php
9     #
10     # This modules is a search engine. A portal without Search? bah!
11     #
12     # This program is free software. You can redistribute it and/or modify
13     # it under the terms of the GNU General Public License as published by
14     # the Free Software Foundation; either version 2 of the License.
15     ######################################################################
16    
17     if(!isset($mainfile)) { include("mainfile.php"); }
18    
19     switch($op) {
20    
21     case "comments":
22     break;
23    
24     default:
25     $offset=30;
26     if (!isset($min)) $min=0;
27     if (!isset($max)) $max=$min+$offset;
28     $query = stripslashes($query);
29     include("header.php");
30     if ($topic>0) {
31     $result = mysql_query("select topicimage, topictext from topics where topicid=$topic");
32     list($topicimage, $topictext) = mysql_fetch_row($result);
33     } else {
34     $topictext = "".translate("All Topics")."";
35     $topicimage = "AllTopics.gif";
36     }
37     echo "<table border=0 width=100% bgcolor=000000 cellpadding=1 cellspacing=0><tr><td>";
38     echo "<table border=0 width=100% bgcolor=$bgcolor1 cellpadding=5 cellspacing=0><tr><td>";
39     echo "<center><font size=4 Face=Arial,Helvetica><b>".translate("Search in")." $topictext</b></center><br>";
40     ?>
41     <TABLE WIDTH=100% BORDER=0>
42     <TR><TD>
43     <img src=<?php echo "$tipath$topicimage"; ?> align=right border=2 Alt="<?php echo "$topictext"; ?>">
44     <form action="search.php" method=get>
45     <input size=25 type=name name=query value="<?php echo $query; ?>">
46     <input type=submit value="<?php echo translate("Search"); ?>"><br>
47     <!-- Topic Selection -->
48     <?php
49     $toplist = mysql_query("select topicid, topictext from topics order by topictext");
50     echo "<SELECT NAME=\"topic\">";
51     echo "<OPTION VALUE=\"\">".translate("All Topics")."</option>\n";
52     while(list($topicid, $topics) = mysql_fetch_row($toplist)) {
53     if ($topicid==$topic) { $sel = "selected "; }
54     echo "<option $sel value=\"$topicid\">$topics</option>\n";
55     $sel = "";
56     }
57     echo "</SELECT>";
58     // Authors Selection -->
59     $thing = mysql_query("select aid from authors order by aid");
60     echo "<SELECT NAME=\"author\">";
61     echo "<OPTION VALUE=\"\">".translate("All Authors")."</option>\n";
62     while(list($authors) = mysql_fetch_row($thing)) {
63     if ($authors==$author) { $sel = "selected "; }
64     echo "<option value=\"$authors\">$authors</option>\n";
65     $sel = "";
66     }
67     echo "</SELECT>";
68     ?>
69     <!-- Date Selection -->
70     <select name="days">
71     <option <?php echo $days == 0 ? "selected " : ""; ?> value=0><?php echo translate("All"); ?></option>
72     <option <?php echo $days == 7 ? "selected " : ""; ?> value=7>1 <?php echo translate("week"); ?></option>
73     <option <?php echo $days == 14 ? "selected " : ""; ?> value=14>2 <?php echo translate("weeks"); ?></option>
74     <option <?php echo $days == 30 ? "selected " : ""; ?> value=30>1 <?php echo translate("month"); ?></option>
75     <option <?php echo $days == 60 ? "selected " : ""; ?> value=60>2 <?php echo translate("months"); ?></option>
76     <option <?php echo $days == 90 ? "selected " : ""; ?> value=90>3 <?php echo translate("months"); ?></option>
77     </select></form>
78     <?PHP
79     echo "</td></tr></TABLE><P>";
80    
81     $q = "select s.sid, s.aid, s.title, s.time, a.url, s.comments, s.topic from stories s, authors a where s.aid=a.aid ";
82     if (isset($query)) $q .= "AND (s.title LIKE '%$query%' OR s.hometext LIKE '%$query%') ";
83     if ($author != "") $q .= "AND s.aid='$author' ";
84     if ($topic != "") $q .= "AND s.topic='$topic' ";
85     if ($days != "" && $days!=0) $q .= "AND TO_DAYS(NOW()) - TO_DAYS(time) <= $days ";
86     $q .= " ORDER BY s.time DESC LIMIT $min,$offset";
87     $t = $topic;
88     $result = mysql_query($q);
89     $nrows = mysql_num_rows($result);
90     $x=0;
91     echo "<table width=99% cellspacing=0 cellpadding=0 border=0>\n";
92     if ($nrows>0) {
93     while(list($sid, $aid, $title, $time, $url, $comments, $topic) = mysql_fetch_row($result)) {
94    
95     $result2=mysql_query("select topictext from topics where topicid=$topic");
96     list($topictext) = mysql_fetch_row($result2);
97    
98     $furl = "article.php?sid=$sid";
99     formatTimestamp($time);
100     printf("<tr><td>$font3<a href=\"%s\"><b>%s</b></a> $font2 ".translate("by")." <a href=\"%s\">%s</a>",$furl,$title,$url,$aid);
101     print " ".translate("on")." $datetime (<b>$comments</b>)</td></tr>\n";
102     $x++;
103     }
104    
105     echo "</td></tr></table>";
106     } else {
107     echo "<center><font color=Red>".translate("No matches found to your query")."</font></center><br><br>";
108     echo "</td></tr></table>";
109     }
110    
111     $prev=$min-$offset;
112     if ($prev>=0) {
113     print "<a href=\"search.php?author=$author&topic=$t&min=$prev&query=$query\">";
114     print "<br><br><center><b>$min ".translate("previous matches")."</b></a>";
115     }
116    
117     $next=$min+$offset;
118     if ($x>=29) {
119     print "<a href=\"search.php?author=$author&topic=$t&min=$max&query=$query";
120     print "&section=$section\"><br><br><center><b>".translate("next matches")."</b></a>";
121     }
122    
123     echo "</td></tr></table></td></tr></table>\n";
124     include("footer.php");
125     break;
126     }
127     ?>

  ViewVC Help
Powered by ViewVC 1.1.26