drupal/search.php

67 lines
2.7 KiB
PHP
Raw Normal View History

2000-05-18 19:52:00 +00:00
<?
2000-10-10 10:51:00 +00:00
include "includes/theme.inc";
2000-05-18 19:52:00 +00:00
$theme->header();
2000-05-18 19:52:00 +00:00
$terms = check_input($terms);
2000-05-18 19:52:00 +00:00
2000-07-02 11:21:00 +00:00
$output .= "<TABLE WIDTH=\"100%\" BORDER=\"0\">\n";
$output .= " <TR VALIGN=\"center\">\n";
$output .= " <TD COLSPAN=3>\n";
Over the last 2 days I redid and reorganized an afwul lot of code and made quite a lot of additions. The most remarkable addition is the diary server, which I slapped together in less then 40 minutes. Most of the other changes are however `unvisible' for the user but add much value to a better maintainability from a developer's objective. Like always, I fixed quite a number of small bugs that creeped into the code so we should have a bigger, better and more stable drop.org. Unfortunatly, some theme update _are_ required: REQUIRED THEME UPDATES: ======================= * use format_username() where usernames are used * use format_date() where timestamps/dates are used * use format_email() where e-mail addresses are displayed * use format_url() where url are displayed * replace 'formatTimestamp' with format_date * replace 'morelink_*' with 'display_morelink' [most of these functions are in function.inc or template.inc] ___PLEASE___ (<- this should get your attention ;) update your themes as soon as possible - it only takes 30 min. to get in sync with the other themes. Don't start whining about the fact you don't know what to change ... either eat the source cookie, or ask me to elaborate on a few changes. Just let me know what's puzzling you and I'll try to help you out! TODO LIST FOR NEXT WEEK ======================= * Add checks for max. text length in textarea's? Is there an HMTL attribute for this or ...? * Comment moderation + mojo * Edit/admin user accounts: block, delete, change permissions, ... * E-mail password, change password, change e-mail address -> extra checks and routines to validate such `special' changes. * Input checking - input filter: bad words, html tags, ...
2000-09-11 07:45:22 +00:00
$output .= " <FORM ACTION=\"search.php\" METHOD=\"POST\">\n";
2000-07-02 11:21:00 +00:00
$output .= " <INPUT SIZE=\"50\" VALUE=\"$terms\" NAME=\"terms\" TYPE=\"text\"><BR>\n";
### category:
Over the last 2 days I redid and reorganized an afwul lot of code and made quite a lot of additions. The most remarkable addition is the diary server, which I slapped together in less then 40 minutes. Most of the other changes are however `unvisible' for the user but add much value to a better maintainability from a developer's objective. Like always, I fixed quite a number of small bugs that creeped into the code so we should have a bigger, better and more stable drop.org. Unfortunatly, some theme update _are_ required: REQUIRED THEME UPDATES: ======================= * use format_username() where usernames are used * use format_date() where timestamps/dates are used * use format_email() where e-mail addresses are displayed * use format_url() where url are displayed * replace 'formatTimestamp' with format_date * replace 'morelink_*' with 'display_morelink' [most of these functions are in function.inc or template.inc] ___PLEASE___ (<- this should get your attention ;) update your themes as soon as possible - it only takes 30 min. to get in sync with the other themes. Don't start whining about the fact you don't know what to change ... either eat the source cookie, or ask me to elaborate on a few changes. Just let me know what's puzzling you and I'll try to help you out! TODO LIST FOR NEXT WEEK ======================= * Add checks for max. text length in textarea's? Is there an HMTL attribute for this or ...? * Comment moderation + mojo * Edit/admin user accounts: block, delete, change permissions, ... * E-mail password, change password, change e-mail address -> extra checks and routines to validate such `special' changes. * Input checking - input filter: bad words, html tags, ...
2000-09-11 07:45:22 +00:00
$output .= "<SELECT NAME=\"category\">\n";
if ($category) $output .= " <OPTION VALUE=\"$category\">$category</OPTION>\n";
$output .= " <OPTION VALUE=\"\">All categories</OPTION>\n";
for ($i = 0; $i < sizeof($categories); $i++) {
2000-07-02 11:21:00 +00:00
$output .= " <OPTION VALUE=\"$categories[$i]\">$categories[$i]</OPTION>\n";
}
2000-07-02 11:21:00 +00:00
$output .= "</SELECT>\n";
### order:
2000-07-02 11:21:00 +00:00
$output .= "<SELECT NAME=\"order\">\n";
if ($order == "Oldest first") {
2000-07-02 11:21:00 +00:00
$output .= " <OPTION VALUE=\"Oldest first\">Oldest first</OPTION>\n";
$output .= " <OPTION VALUE=\"Newest first\">Newest first</OPTION>\n";
}
else {
2000-07-02 11:21:00 +00:00
$output .= " <OPTION VALUE=\"Newest first\">Newest first</OPTION>\n";
$output .= " <OPTION VALUE=\"Oldest first\">Oldest first</OPTION>\n";
}
2000-07-02 11:21:00 +00:00
$output .= "</SELECT>\n";
2000-07-02 11:21:00 +00:00
$output .= " <INPUT TYPE=\"submit\" VALUE=\"Search\">\n";
$output .= " </TD>\n";
$output .= " </TR>\n";
$output .= " <TR>\n";
$output .= " <TD>\n";
Over the last 2 days I redid and reorganized an afwul lot of code and made quite a lot of additions. The most remarkable addition is the diary server, which I slapped together in less then 40 minutes. Most of the other changes are however `unvisible' for the user but add much value to a better maintainability from a developer's objective. Like always, I fixed quite a number of small bugs that creeped into the code so we should have a bigger, better and more stable drop.org. Unfortunatly, some theme update _are_ required: REQUIRED THEME UPDATES: ======================= * use format_username() where usernames are used * use format_date() where timestamps/dates are used * use format_email() where e-mail addresses are displayed * use format_url() where url are displayed * replace 'formatTimestamp' with format_date * replace 'morelink_*' with 'display_morelink' [most of these functions are in function.inc or template.inc] ___PLEASE___ (<- this should get your attention ;) update your themes as soon as possible - it only takes 30 min. to get in sync with the other themes. Don't start whining about the fact you don't know what to change ... either eat the source cookie, or ask me to elaborate on a few changes. Just let me know what's puzzling you and I'll try to help you out! TODO LIST FOR NEXT WEEK ======================= * Add checks for max. text length in textarea's? Is there an HMTL attribute for this or ...? * Comment moderation + mojo * Edit/admin user accounts: block, delete, change permissions, ... * E-mail password, change password, change e-mail address -> extra checks and routines to validate such `special' changes. * Input checking - input filter: bad words, html tags, ...
2000-09-11 07:45:22 +00:00
### Compose and perform query:
$query = "SELECT s.id, s.subject, u.userid, s.timestamp, COUNT(c.cid) AS comments FROM stories s LEFT JOIN users u ON s.author = u.id LEFT JOIN comments c ON s.id = c.sid WHERE s.status = 2 ";
Over the last 2 days I redid and reorganized an afwul lot of code and made quite a lot of additions. The most remarkable addition is the diary server, which I slapped together in less then 40 minutes. Most of the other changes are however `unvisible' for the user but add much value to a better maintainability from a developer's objective. Like always, I fixed quite a number of small bugs that creeped into the code so we should have a bigger, better and more stable drop.org. Unfortunatly, some theme update _are_ required: REQUIRED THEME UPDATES: ======================= * use format_username() where usernames are used * use format_date() where timestamps/dates are used * use format_email() where e-mail addresses are displayed * use format_url() where url are displayed * replace 'formatTimestamp' with format_date * replace 'morelink_*' with 'display_morelink' [most of these functions are in function.inc or template.inc] ___PLEASE___ (<- this should get your attention ;) update your themes as soon as possible - it only takes 30 min. to get in sync with the other themes. Don't start whining about the fact you don't know what to change ... either eat the source cookie, or ask me to elaborate on a few changes. Just let me know what's puzzling you and I'll try to help you out! TODO LIST FOR NEXT WEEK ======================= * Add checks for max. text length in textarea's? Is there an HMTL attribute for this or ...? * Comment moderation + mojo * Edit/admin user accounts: block, delete, change permissions, ... * E-mail password, change password, change e-mail address -> extra checks and routines to validate such `special' changes. * Input checking - input filter: bad words, html tags, ...
2000-09-11 07:45:22 +00:00
$query .= ($author) ? "AND u.userid = '$author' " : "";
$query .= ($terms) ? "AND (s.subject LIKE '%$terms%' OR s.abstract LIKE '%$terms%' OR s.updates LIKE '%$terms%') " : "";
$query .= ($category) ? "AND s.category = '$category' GROUP BY s.id " : "GROUP BY s.id ";
Over the last 2 days I redid and reorganized an afwul lot of code and made quite a lot of additions. The most remarkable addition is the diary server, which I slapped together in less then 40 minutes. Most of the other changes are however `unvisible' for the user but add much value to a better maintainability from a developer's objective. Like always, I fixed quite a number of small bugs that creeped into the code so we should have a bigger, better and more stable drop.org. Unfortunatly, some theme update _are_ required: REQUIRED THEME UPDATES: ======================= * use format_username() where usernames are used * use format_date() where timestamps/dates are used * use format_email() where e-mail addresses are displayed * use format_url() where url are displayed * replace 'formatTimestamp' with format_date * replace 'morelink_*' with 'display_morelink' [most of these functions are in function.inc or template.inc] ___PLEASE___ (<- this should get your attention ;) update your themes as soon as possible - it only takes 30 min. to get in sync with the other themes. Don't start whining about the fact you don't know what to change ... either eat the source cookie, or ask me to elaborate on a few changes. Just let me know what's puzzling you and I'll try to help you out! TODO LIST FOR NEXT WEEK ======================= * Add checks for max. text length in textarea's? Is there an HMTL attribute for this or ...? * Comment moderation + mojo * Edit/admin user accounts: block, delete, change permissions, ... * E-mail password, change password, change e-mail address -> extra checks and routines to validate such `special' changes. * Input checking - input filter: bad words, html tags, ...
2000-09-11 07:45:22 +00:00
$query .= ($order == "Oldest first") ? "ORDER BY s.timestamp ASC" : "ORDER BY s.timestamp DESC";
$result = db_query("$query");
2000-05-18 19:52:00 +00:00
### Display search results:
2000-07-02 11:21:00 +00:00
$output .= "<HR>\n";
Over the last 2 days I redid and reorganized an afwul lot of code and made quite a lot of additions. The most remarkable addition is the diary server, which I slapped together in less then 40 minutes. Most of the other changes are however `unvisible' for the user but add much value to a better maintainability from a developer's objective. Like always, I fixed quite a number of small bugs that creeped into the code so we should have a bigger, better and more stable drop.org. Unfortunatly, some theme update _are_ required: REQUIRED THEME UPDATES: ======================= * use format_username() where usernames are used * use format_date() where timestamps/dates are used * use format_email() where e-mail addresses are displayed * use format_url() where url are displayed * replace 'formatTimestamp' with format_date * replace 'morelink_*' with 'display_morelink' [most of these functions are in function.inc or template.inc] ___PLEASE___ (<- this should get your attention ;) update your themes as soon as possible - it only takes 30 min. to get in sync with the other themes. Don't start whining about the fact you don't know what to change ... either eat the source cookie, or ask me to elaborate on a few changes. Just let me know what's puzzling you and I'll try to help you out! TODO LIST FOR NEXT WEEK ======================= * Add checks for max. text length in textarea's? Is there an HMTL attribute for this or ...? * Comment moderation + mojo * Edit/admin user accounts: block, delete, change permissions, ... * E-mail password, change password, change e-mail address -> extra checks and routines to validate such `special' changes. * Input checking - input filter: bad words, html tags, ...
2000-09-11 07:45:22 +00:00
while ($entry = db_fetch_object($result)) {
$num++;
$output .= "<P>$num) <B><A HREF=\"discussion.php?id=$entry->id\">$entry->subject</A></B> (". format_plural($entry->comments, "comment", comments) .")<BR><SMALL>by ". format_username($entry->userid) ."</B>, posted on ". format_date($entry->timestamp) .".</SMALL></P>\n";
}
2000-05-18 19:52:00 +00:00
2000-07-02 11:21:00 +00:00
if ($num == 0) $output .= "<P>Your search did <B>not</B> match any articles in our database: <UL><LI>Try using fewer words.</LI><LI>Try using more general keywords.</LI><LI>Try using different keywords.</LI></UL></P>\n";
else $output .= "<P><B>$num</B> results matched your search query.</P>\n";
2000-07-02 11:21:00 +00:00
$output .= " </TD>\n";
$output .= " </TR>\n";
$output .= "</TABLE>\n";
2000-05-18 19:52:00 +00:00
$theme->box("Search", $output);
2000-05-18 19:52:00 +00:00
$theme->footer();
?>