Commit 171479fc authored by Dries's avatar Dries

- a 2nd batch of various updates

parent d6ce51e4
drupal 1.xx, xx/xx/2001
-----------------------
- rewrote the comment/discussion code:
* comment navigation should be less confusing now additional/alternative
display and order methods have been added.
* modules can be extended with a "comment system" as they can embed the
existing comment code without having to write duplicate code.
- added section manager:
* story sections can be maintained from the administration pages.
* makes the open submission more adaptive in that you can set individual
post, dump and expiration thresholds for each section according to the
story type and urgency level: some section do not really "expire" and
stay interesting and active as time passes by, whereas news-related
stories are only considered "hot" over a short period of time.
- multiple vhosts + multiple directories:
* you can setup multiple drupal sites on top of the same physical source
tree either by using vhosts or sub-directories
- added "user ratings" similar to SlashCode's karma or Scoop's mojo.
- added search infractructure:
* better search page + search functionality in administration pages.
- various updates:
* improved cron-module
* improved module-module
* revised documentation
drupal 1.00, 15/01/2001
-----------------------
- initial release
\ No newline at end of file
Listed in order of "appearance":
Dries Buytaert <dries@drop.org>
- project architect
Jeroen Bensch <jeroen@drop.org>
- themes and images
Steven Wittens <unconed@drop.org>
- themes and images
Kjartan Mannes <natrak@drop.org>
- hosting, hardware, bandwidth
Michael O'Henly <michael@tenzo.com>
- documentation revisions
......@@ -222,7 +222,7 @@ function account_content_edit() {
$output .= "</FORM>\n";
$theme->header();
$theme->box("Edit site content", $output);
$theme->box("Edit your content", $output);
$theme->footer();
}
else {
......@@ -255,17 +255,16 @@ function module($name, $module, $username) {
if ($user->id && $user->userid == $uname) {
$output .= "<TABLE BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
$output .= " <TR><TD ALIGN=\"right\"><B>User ID:</B></TD><TD>$user->userid</TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\"><B>Name:</B></TD><TD>". format_data($user->name) ."</TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\"><B>Username:</B></TD><TD>$user->userid</TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\"><B>E-mail:</B></TD><TD>". format_email($user->fake_email) ."</A></TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\"><B>URL:</B></TD><TD>". format_url($user->url) ."</TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\"><B>Homepage:</B></TD><TD>". format_url($user->url) ."</TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>Bio:</B></TD><TD>". format_data($user->bio) ."</TD></TR>\n";
$output .= " <TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>Signature:</B></TD><TD>". format_data($user->signature) ."</TD></TR>\n";
$output .= "</TABLE>\n";
// Display account information:
$theme->header();
$theme->box("View user settings", $output);
$theme->box("Personal information", $output);
$theme->footer();
}
elseif ($uname && $account = account_get_user($uname)) {
......@@ -426,8 +425,6 @@ function account_password($min_length=6) {
function account_track_comments() {
global $theme, $user;
$msg = "<P>This page might be helpful in case you want to keep track of your recent comments in any of the current discussions. You are presented an overview of your comments in each of the stories you participated in along with the number of replies each comment got.\n<P>\n";
$sresult = db_query("SELECT s.id, s.subject, COUNT(s.id) as count FROM comments c LEFT JOIN stories s ON c.lid = s.id WHERE c.author = $user->id GROUP BY s.id DESC LIMIT 5");
while ($story = db_fetch_object($sresult)) {
......@@ -441,7 +438,7 @@ function account_track_comments() {
$output .= " </UL>\n";
}
$output = ($output) ? "$msg $output" : "$info <CENTER>You have not posted any comments recently.</CENTER>\n";
$output = ($output) ? "$output" : "$info <CENTER>You have not posted any comments recently.</CENTER>\n";
$theme->header();
$theme->box("Track your comments", $output);
......@@ -451,8 +448,6 @@ function account_track_comments() {
function account_track_stories() {
global $theme, $user;
$msg = "<P>This page might be helpful in case you want to keep track of the stories you contributed. You are presented an overview of your stories along with the number of replies each story got.\n<P>\n";
$result = db_query("SELECT s.id, s.subject, s.timestamp, s.section, COUNT(c.cid) as count FROM stories s LEFT JOIN comments c ON c.lid = s.id WHERE s.status = 2 AND s.author = $user->id GROUP BY s.id DESC");
while ($story = db_fetch_object($result)) {
......@@ -465,54 +460,29 @@ function account_track_stories() {
}
$theme->header();
$theme->box("Track your stories", ($output ? "$msg $output" : "$msg You have not posted any stories.\n"));
$theme->box("Track your stories", ($output ? "$output" : "You have not posted any stories.\n"));
$theme->footer();
}
function account_track_site() {
global $theme, $user, $site_name;
$result1 = db_query("SELECT c.cid, c.pid, c.lid, c.subject, u.userid, s.subject AS story FROM comments c LEFT JOIN users u ON u.id = c.author LEFT JOIN stories s ON s.id = c.lid WHERE s.status = 2 ORDER BY cid DESC LIMIT 10");
while ($comment = db_fetch_object($result1)) {
$block1 .= "<TABLE BORDER=\"0\" CELLPADDING=\"1\" CELLSPACING=\"1\">\n";
$block1 .= " <TR><TD ALIGN=\"right\"><B>Comment:</B></TD><TD><A HREF=\"story.php?id=$comment->lid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</A></TD></TR>\n";
$block1 .= " <TR><TD ALIGN=\"right\"><B>Author:</B></TD><TD>". format_username($comment->userid) ."</TD></TR>\n";
$block1 .= " <TR><TD ALIGN=\"right\"><B>Story:</B></TD><TD><A HREF=\"story.php?id=$comment->lid\">". check_output($comment->story) ."</A></TD></TR>\n";
$block1 .= "</TABLE>\n";
$block1 .= "<P>\n";
}
$block1 = ($block1) ? $block1 : "<CENTER>There have not posted any comments recently.</CENTER>\n";
$users_total = db_result(db_query("SELECT COUNT(id) FROM users"));
$stories_posted = db_result(db_query("SELECT COUNT(id) FROM stories WHERE status = 2"));
$stories_queued = db_result(db_query("SELECT COUNT(id) FROM stories WHERE status = 1"));
$stories_dumped = db_result(db_query("SELECT COUNT(id) FROM stories WHERE status = 0"));
$result = db_query("SELECT u.userid, COUNT(s.author) AS count FROM stories s LEFT JOIN users u ON s.author = u.id GROUP BY s.author ORDER BY count DESC LIMIT 10");
while ($poster = db_fetch_object($result)) $stories_posters .= format_username($poster->userid) .", ";
$period = 259200; // 3 days
$comments_total = db_result(db_query("SELECT COUNT(cid) FROM comments"));
$comments_score = db_result(db_query("SELECT TRUNCATE(AVG(score / votes), 2) FROM comments WHERE votes > 0"));
$result = db_query("SELECT u.userid, COUNT(c.author) AS count FROM comments c LEFT JOIN users u ON c.author = u.id GROUP BY c.author ORDER BY count DESC LIMIT 10");
while ($poster = db_fetch_object($result)) $comments_posters .= format_username($poster->userid) .", ";
$diaries_total = db_result(db_query("SELECT COUNT(id) FROM diaries"));
$result = db_query("SELECT u.userid, COUNT(d.author) AS count FROM diaries d LEFT JOIN users u ON d.author = u.id GROUP BY d.author ORDER BY count DESC LIMIT 10");
while ($poster = db_fetch_object($result)) $diaries_posters .= format_username($poster->userid) .", ";
$sresult = db_query("SELECT s.subject, s.id, COUNT(c.lid) AS count FROM comments c LEFT JOIN stories s ON c.lid = s.id WHERE s.status = 2 AND c.link = 'story' AND ". time() ." - c.timestamp < $period GROUP BY c.lid ORDER BY count DESC LIMIT 10");
while ($story = db_fetch_object($sresult)) {
$output .= "<LI>". format_plural($story->count, "new comment", "new comments") ." attached to story '<A HREF=\"story.php?id=$story->id\">". check_output($story->subject) ."</A>':</LI>";
$block2 .= "<TABLE BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"1\">\n";
$block2 .= " <TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>Users:</B></TD><TD>$users_total users</TD></TR>\n";
$block2 .= " <TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>Stories:</B></TD><TD>$stories_posted posted, $stories_queued queued, $stories_dumped dumped<BR><I>[most frequent posters: $stories_posters ...]</I></TD></TR>\n";
$block2 .= " <TR><TD ALIGN=\"right\" VALIGN=\"top\"><B>Comments:</B></TD><TD>$comments_total comments with an average score of $comments_score<BR><I>[most frequent posters: $comments_posters ...]</I></TD></TR>\n";
$block2 .= "</TABLE>\n";
$cresult = db_query("SELECT c.subject, c.cid, c.pid, u.userid FROM comments c LEFT JOIN users u ON u.id = c.author WHERE c.lid = $story->id AND c.link = 'story' ORDER BY timestamp DESC LIMIT $story->count");
$output .= "<UL>\n";
while ($comment = db_fetch_object($cresult)) {
$output .= " <LI>'<A HREF=\"story.php?id=$story->id&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</A>' by ". format_username($comment->userid) ."</LI>\n";
}
$output .= "</UL>\n";
}
$theme->header();
$theme->box("Recent comments", $block1);
$theme->box("Site statistics", $block2);
$theme->header();
$theme->box("Track $site_name", $output);
$theme->footer();
}
......
<?
function search_form($keys) {
global $REQUEST_URI;
$output .= "<FORM ACTION=\"$REQUEST_URI\" METHOD=\"POST\">\n";
$output .= " <INPUT SIZE=\"50\" VALUE=\"". check_textfield($keys) ."\" NAME=\"keys\">";
$output .= " <INPUT TYPE=\"submit\" VALUE=\"Search\">\n";
$output .= "</FORM>\n";
return $output;
}
function search_data($keys, $type) {
if ($keys && $type) {
$result = module_execute($type, "find", $keys);
foreach ($result as $entry) {
$output .= "<P>\n";
$output .= " <B><U><A HREF=\"$entry[link]\">$entry[subject]</A></U></B><BR>";
$output .= " <SMALL>$site_url$entry[link]". ($entry[user] ? " - ". format_username($entry[user]) : "") ."". ($entry[date] ? " - ". format_date($entry[date], "small") : "") ."</SMALL>";
$output .= "</P>\n";
}
}
if (!$output) {
$output .= "<P><SMALL>Your search yielded no results:</P><UL><LI>try using fewer words.</LI><LI>try using more general keywords.</LI><LI>try using different keywords.</LI></UL></SMALL>\n";
}
return $output;
}
?>
\ No newline at end of file
......@@ -38,7 +38,7 @@ function menu($name, $module) {
$content .= "<P>\n";
$content .= "<LI><A HREF=\"account.php?op=edit&topic=user\">edit your information</A></LI>\n";
$content .= "<LI><A HREF=\"account.php?op=edit&topic=site\">edit your preferences</A></LI>\n";
$content .= "<LI><A HREF=\"account.php?op=edit&topic=content\">edit site content</A></LI>\n";
$content .= "<LI><A HREF=\"account.php?op=edit&topic=content\">edit your content</A></LI>\n";
$content .= "<P>\n";
if (user_permission($user)) {
......
......@@ -69,8 +69,8 @@ function account_find($keys) {
function account_search() {
global $keys, $mod;
search_form($keys);
search_data($keys, $mod);
print search_form($keys);
print search_data($keys, $mod);
}
function account_display($order = "username") {
......
......@@ -15,8 +15,8 @@ function comment_find($keys) {
function comment_search() {
global $keys, $mod;
search_form($keys);
search_data($keys, $mod);
print search_form($keys);
print search_data($keys, $mod);
}
function comment_edit($id) {
......
......@@ -15,8 +15,8 @@ function comment_find($keys) {
function comment_search() {
global $keys, $mod;
search_form($keys);
search_data($keys, $mod);
print search_form($keys);
print search_data($keys, $mod);
}
function comment_edit($id) {
......
......@@ -24,8 +24,8 @@ function diary_find($keys) {
function diary_search() {
global $keys, $mod;
search_form($keys);
search_data($keys, $mod);
print search_form($keys);
print search_data($keys, $mod);
}
function diary_page_overview($num = 20) {
......
......@@ -27,8 +27,8 @@ function story_find($keys) {
function story_search() {
global $keys, $mod;
search_form($keys);
search_data($keys, $mod);
print search_form($keys);
print search_data($keys, $mod);
}
function story_help() {
......
......@@ -27,8 +27,8 @@ function story_find($keys) {
function story_search() {
global $keys, $mod;
search_form($keys);
search_data($keys, $mod);
print search_form($keys);
print search_data($keys, $mod);
}
function story_help() {
......
<?
include_once "includes/common.inc";
$theme->header();
include_once "includes/common.inc";
$terms = check_input($terms);
function find_module($name, $module) {
global $options, $type;
if ($module["find"]) $options .= "<OPTION VALUE=\"$name\"". ($name == $type ? " SELECTED" : "") .">$name</OPTION>\n";
}
$output .= "<TABLE WIDTH=\"100%\" BORDER=\"0\">\n";
$output .= " <TR VALIGN=\"center\">\n";
$output .= " <TD COLSPAN=3>\n";
$output .= " <FORM ACTION=\"search.php\" METHOD=\"POST\">\n";
$output .= " <INPUT SIZE=\"50\" VALUE=\"$terms\" NAME=\"terms\" TYPE=\"text\"><BR>\n";
module_iterate("find_module");
// section:
$output .= "<SELECT NAME=\"section\">\n";
$output .= " <OPTION VALUE=\"\">All sections</OPTION>\n";
foreach ($sections = section_get() as $value) $output .= " <OPTION VALUE=\"$value\"". ($section == $value ? " SELECTED" : "") .">$value</OPTION>\n";
$output .= "</SELECT>\n";
$search .= "<FORM ACTION=\"search.php\" METHOD=\"POST\">\n";
$search .= " <INPUT SIZE=\"50\" VALUE=\"". check_textfield($keys) ."\" NAME=\"keys\" TYPE=\"text\">\n";
$search .= " <SELECT NAME=\"type\">$options</SELECT>\n";
$search .= " <INPUT TYPE=\"submit\" VALUE=\"Search\">\n";
$search .= "</FORM>\n";
// order:
$output .= "<SELECT NAME=\"order\">\n";
if ($order == 1) {
$output .= " <OPTION VALUE=\"1\">Oldest first</OPTION>\n";
$output .= " <OPTION VALUE=\"2\">Newest first</OPTION>\n";
}
else {
$output .= " <OPTION VALUE=\"1\">Newest first</OPTION>\n";
$output .= " <OPTION VALUE=\"2\">Oldest first</OPTION>\n";
}
$output .= "</SELECT>\n";
$output = search_data($keys, $type);
$output .= " <INPUT TYPE=\"submit\" VALUE=\"Search\">\n";
$output .= " </TD>\n";
$output .= " </TR>\n";
$output .= " <TR>\n";
$output .= " <TD>\n";
// 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.lid WHERE s.status = 2 ";
$query .= ($author) ? "AND u.userid = '$author' " : "";
$query .= ($terms) ? "AND (s.subject LIKE '%$terms%' OR s.abstract LIKE '%$terms%' OR s.updates LIKE '%$terms%') " : "";
$query .= ($section) ? "AND s.section = '$section' GROUP BY s.id " : "GROUP BY s.id ";
$query .= ($order == 1) ? "ORDER BY s.timestamp ASC" : "ORDER BY s.timestamp DESC";
$result = db_query($query);
// Display search results:
$output .= "<HR>\n";
while ($entry = db_fetch_object($result)) {
$num++;
$output .= "<P>$num) <B><A HREF=\"story.php?id=$entry->id\">". check_output($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";
}
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";
$output .= " </TD>\n";
$output .= " </TR>\n";
$output .= "</TABLE>\n";
$theme->box("Search", $output);
$theme->footer();
$theme->header();
$theme->box("Search", $search);
$theme->box("Result", $output);
$theme->footer();
?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment