diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-01-20 12:20:31 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-01-20 12:20:31 +0000 |
commit | 2952d16f78eea91724760f526504010cb8f796a9 (patch) | |
tree | 21598276fd9bc316be320308c5cd8eeafa77c12d /modules | |
parent | 53b92a614a9e30b693760b8299342f9bfb01320b (diff) | |
download | brdo-2952d16f78eea91724760f526504010cb8f796a9.tar.gz brdo-2952d16f78eea91724760f526504010cb8f796a9.tar.bz2 |
- updated/improved discussion engine: it needs additional fine-tuning
though but I think this is stable enough for public consumption and
real-life testing.
==> a first big step towards a flexible comment engine.
IMPORTANT:
- Required theme updatins:
UnConeD: check your $theme->controls() as I added a very, very
dummy implementation
- Required database updates:
alter table users modify mode tinyint(1) DEFAULT '' NOT NULL;
alter table comments change sid lid int(6) DEFAULT '0' NOT NULL;
alter table comments add link varchar(16) DEFAULT '' NOT NULL;
update comments set link = 'story';
Diffstat (limited to 'modules')
-rw-r--r-- | modules/account.module | 6 | ||||
-rw-r--r-- | modules/comment.module | 2 | ||||
-rw-r--r-- | modules/comment/comment.module | 2 | ||||
-rw-r--r-- | modules/drupal.module | 99 | ||||
-rw-r--r-- | modules/drupal/drupal.module | 99 | ||||
-rw-r--r-- | modules/headline.module | 2 | ||||
-rw-r--r-- | modules/story.module | 16 | ||||
-rw-r--r-- | modules/story/story.module | 16 |
8 files changed, 160 insertions, 82 deletions
diff --git a/modules/account.module b/modules/account.module index 4d382ccf4..942cf6072 100644 --- a/modules/account.module +++ b/modules/account.module @@ -87,15 +87,15 @@ function account_display($order = "username") { function account_stories($id) { $result = db_query("SELECT * FROM stories WHERE author = $id ORDER BY timestamp DESC"); while ($story = db_fetch_object($result)) { - $output .= "<LI><A HREF=\"discussion.php?id=$story->id\">". check_output($story->subject) ."</A></LI>\n"; + $output .= "<LI><A HREF=\"story.php?id=$story->id\">". check_output($story->subject) ."</A></LI>\n"; } return $output; } function account_comments($id) { - $result = db_query("SELECT * FROM comments WHERE author = $id ORDER BY timestamp DESC"); + $result = db_query("SELECT * FROM comments WHERE link = 'story' AND author = $id ORDER BY timestamp DESC"); while ($comment = db_fetch_object($result)) { - $output .= "<LI><A HREF=\"discussion.php?id=$comment->sid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</A></LI>\n"; + $output .= "<LI><A HREF=\"story.php?id=$comment->sid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</A></LI>\n"; } return $output; } diff --git a/modules/comment.module b/modules/comment.module index db863616f..bdda1cc0e 100644 --- a/modules/comment.module +++ b/modules/comment.module @@ -66,7 +66,7 @@ function comment_display($order = "date") { $output .= " </TR>\n"; while ($comment = db_fetch_object($result)) { - $output .= " <TR><TD><A HREF=\"discussion.php?id=$comment->sid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</A></TD><TD>". format_username($comment->userid, 1) ."</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=comment&op=edit&id=$comment->cid\">edit</A></TD></TR>\n"; + $output .= " <TR><TD>". ($comment->link == "story" ? "<A HREF=\"story.php?id=$comment->lid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</A>" : check_output($comment->subject)) ."</TD><TD>". format_username($comment->userid, 1) ."</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=comment&op=edit&id=$comment->cid\">edit</A></TD></TR>\n"; } $output .= "</TABLE>\n"; diff --git a/modules/comment/comment.module b/modules/comment/comment.module index db863616f..bdda1cc0e 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -66,7 +66,7 @@ function comment_display($order = "date") { $output .= " </TR>\n"; while ($comment = db_fetch_object($result)) { - $output .= " <TR><TD><A HREF=\"discussion.php?id=$comment->sid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</A></TD><TD>". format_username($comment->userid, 1) ."</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=comment&op=edit&id=$comment->cid\">edit</A></TD></TR>\n"; + $output .= " <TR><TD>". ($comment->link == "story" ? "<A HREF=\"story.php?id=$comment->lid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</A>" : check_output($comment->subject)) ."</TD><TD>". format_username($comment->userid, 1) ."</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=comment&op=edit&id=$comment->cid\">edit</A></TD></TR>\n"; } $output .= "</TABLE>\n"; diff --git a/modules/drupal.module b/modules/drupal.module index d03a3bc5b..fca8c6119 100644 --- a/modules/drupal.module +++ b/modules/drupal.module @@ -2,41 +2,80 @@ $module = array("page" => "drupal_page"); -include "includes/common.inc"; +include_once "includes/common.inc"; +include_once "includes/comment.inc"; -function drupal_page() { - global $theme; - - $output .= " - <H2>Introduction</H2> - <P>Drupal is the English pronunciation for the Dutch word 'druppel' which stands for 'drop'. Drupal is a full-featured content management/discussion engine suitable to setup a news-driven community or portal site. Drupal aims towards easy installation, excessive configuration and fine-grained maintenance capabilities. Due to its modular design drupal is flexible and easy to adapt or extend.</P> - <P>Drupal is primarily written by Dries Buytaert (dries_at_drop.org) and build after Slash (<A HREF=\"http://slashcode.com/\">http://slashcode.com/</A>) and Scoop (<A HREF=\"http://scoop.kuro5hin.org/\">http://scoop.kuro5hin.org/</A>) and source code is available under terms of GNU General Public License (GPL).</P> - <H2>Download</H2> - <LI><A HREF=\"drupal/drupal-1.00.tgz\">drupal 1.00</A> (2000/01/15)</LI> - <LI><A HREF=\"drupal/drupal-1.00-rc2.tgz\">drupal 1.00-rc2</A> (2000/01/08)</LI> - <LI><A HREF=\"drupal/drupal-1.00-rc1.tgz\">drupal 1.00-rc1</A> (2000/01/01)</LI> - <H2>Screenshots</H2> - "; +function drupal_render($id, $cid) { + global $theme, $threshold, $mode, $order, $user; + + $output = " <P>Drupal is the English pronunciation for the Dutch word 'druppel' which stands for 'drop'. Drupal is a full-featured content management/discussion engine suitable to setup a news-driven community or portal site. Drupal aims towards easy installation, excessive configuration and fine-grained maintenance capabilities. Due to its modular design drupal is flexible and easy to adapt or extend.</P>\n"; + $output .= " <P>Drupal is primarily written by Dries Buytaert (dries_at_drop.org) and build after Slash (<A HREF=\"http://slashcode.com/\">http://slashcode.com/</A>) and Scoop (<A HREF=\"http://scoop.kuro5hin.org/\">http://scoop.kuro5hin.org/</A>). The source code is available under terms of GNU General Public License (GPL).</P>\n"; + $output .= " <P>We don't have a real demo site yet but drupal is used by (and created for) <A HREF=\"http://drop.org/\">http://drop.org/</A>. Create an account, play with it for a bit, read the <A HREF=\"module.php?mod=documentation\">documentation</A> and spend some time getting used to it.</P>\n"; + $theme->box("Introduction", $output); + + $output = "<LI><A HREF=\"drupal/drupal-1.00.tgz\">drupal 1.00</A> (2000/01/15 - latest version)</LI>\n"; + $output .= "<LI><A HREF=\"drupal/drupal-1.00-rc2.tgz\">drupal 1.00-rc2</A> (2000/01/08)</LI>\n"; + $output .= "<LI><A HREF=\"drupal/drupal-1.00-rc1.tgz\">drupal 1.00-rc1</A> (2000/01/01)</LI>\n"; + $theme->box("Download", $output); + unset($output); $handle = opendir("drupal"); while ($file = readdir($handle)) if (ereg(".jpg", $file) || ereg(".gif", $file)) $output .= " <LI><SMALL><A HREF=\"drupal/$file\">$file</A></SMALL></LI>\n"; closedir($handle); + $theme->box("Screenshots", $output); + + $output = "<H2>Documentation</H2>\n"; + $output .= " <LI><A HREF=\"module.php?mod=documentation\">documentation</A></LI>\n"; + $output .= " <LI><A HREF=\"module.php?mod=wishlist\">wishlist</A></LI>\n"; + $output .= "<H2>Mailing list</H2>\n"; + $output .= " <P>The <CODE>drupal-support@drop.org</CODE> list discusses drupal development. All submissions relevant to that, such as bug reports, enhancement ideas, patches or reports that a patch fixed a bug are appropriate.</P>\n"; + $output .= " <LI>To subscribe to the <CODE>drupal-support@drop.org</CODE> mailing list, send an e-mail to <A HREF=\"mailto:drupal-support-request@drop.org\">drupal-support-request@drop.org</A> with no subject and put <B>subscribe</B> in the body of your message.</LI>\n"; + $output .= " <LI>To unsubscribe from the <CODE>drupal-support@drop.org</CODE> mailing list, send an e-mail to <A HREF=\"mailto:drupal-support-request@drop.org\">drupal-support-request@drop.org</A> and put <B>unsubscribe</B> in the body of your mail.\n"; + $theme->box("Support and development", $output); + + print "<H3>Comments</H3>\n"; + + // Display 'comment control'-box: + if ($user->id) $theme->controls($threshold, $mode, $order); + + // Display comments: + comment_render($id, $cid); +} + +function drupal_page() { + global $cid, $comment, $id, $op, $pid, $lid, $link, $mode, $order, $subject, $theme, $threshold; - $output .= " - <H2>Demo</H2> - <P>We don't have a real demo site yet but drupal is used by (and created for) <A HREF=\"http://drop.org/\">http://drop.org/</A>. Create an account, play with it for a bit, read the <A HREF=\"module.php?mod=documentation\">documentation</A> and spend some time getting used to it.</P> - <H2>Documentation</H2> - <LI><A HREF=\"module.php?mod=documentation\">documentation</A></LI> - <LI><A HREF=\"module.php?mod=wishlist\">wishlist</A></LI> - <H2>Mailing list</H2> - <P>The <CODE>drupal-support@drop.org</CODE> list discusses drupal development. All submissions relevant to that, such as bug reports, enhancement ideas, patches or reports that a patch fixed a bug are appropriate.</P> - <LI>To subscribe to the <CODE>drupal-support@drop.org</CODE> mailing list, send an e-mail to <A HREF=\"mailto:drupal-support-request@drop.org\">drupal-support-request@drop.org</A> with no subject and put <B>subscribe</B> in the body of your message.</LI> - <LI>To unsubscribe from the <CODE>drupal-support@drop.org</CODE> mailing list, send an e-mail to <A HREF=\"mailto:drupal-support-request@drop.org\">drupal-support-request@drop.org</A> and put <B>unsubscribe</B> in the body of your mail. - "; - - $theme->header(); - $theme->box("Drupal", $output); - $theme->footer(); + switch($op) { + case "Preview comment": + $theme->header(); + comment_preview($pid, $id, $subject, $comment); + $theme->footer(); + break; + case "Post comment": + comment_post($pid, $id, $subject, $comment); + break; + case "reply": + $theme->header(); + comment_reply($pid, $id); + $theme->footer(); + break; + case "Update": + comment_settings($mode, $order, $threshold); + $theme->header(); + drupal_render($id, $cid); + $theme->footer(); + break; + case "Moderate comments": + comment_moderate($moderate); + $theme->header(); + drupal_render($id, $cid); + $theme->footer(); + break; + default: + $theme->header(); + drupal_render(0, $cid); + $theme->footer(); + } } -?> +?>
\ No newline at end of file diff --git a/modules/drupal/drupal.module b/modules/drupal/drupal.module index d03a3bc5b..fca8c6119 100644 --- a/modules/drupal/drupal.module +++ b/modules/drupal/drupal.module @@ -2,41 +2,80 @@ $module = array("page" => "drupal_page"); -include "includes/common.inc"; +include_once "includes/common.inc"; +include_once "includes/comment.inc"; -function drupal_page() { - global $theme; - - $output .= " - <H2>Introduction</H2> - <P>Drupal is the English pronunciation for the Dutch word 'druppel' which stands for 'drop'. Drupal is a full-featured content management/discussion engine suitable to setup a news-driven community or portal site. Drupal aims towards easy installation, excessive configuration and fine-grained maintenance capabilities. Due to its modular design drupal is flexible and easy to adapt or extend.</P> - <P>Drupal is primarily written by Dries Buytaert (dries_at_drop.org) and build after Slash (<A HREF=\"http://slashcode.com/\">http://slashcode.com/</A>) and Scoop (<A HREF=\"http://scoop.kuro5hin.org/\">http://scoop.kuro5hin.org/</A>) and source code is available under terms of GNU General Public License (GPL).</P> - <H2>Download</H2> - <LI><A HREF=\"drupal/drupal-1.00.tgz\">drupal 1.00</A> (2000/01/15)</LI> - <LI><A HREF=\"drupal/drupal-1.00-rc2.tgz\">drupal 1.00-rc2</A> (2000/01/08)</LI> - <LI><A HREF=\"drupal/drupal-1.00-rc1.tgz\">drupal 1.00-rc1</A> (2000/01/01)</LI> - <H2>Screenshots</H2> - "; +function drupal_render($id, $cid) { + global $theme, $threshold, $mode, $order, $user; + + $output = " <P>Drupal is the English pronunciation for the Dutch word 'druppel' which stands for 'drop'. Drupal is a full-featured content management/discussion engine suitable to setup a news-driven community or portal site. Drupal aims towards easy installation, excessive configuration and fine-grained maintenance capabilities. Due to its modular design drupal is flexible and easy to adapt or extend.</P>\n"; + $output .= " <P>Drupal is primarily written by Dries Buytaert (dries_at_drop.org) and build after Slash (<A HREF=\"http://slashcode.com/\">http://slashcode.com/</A>) and Scoop (<A HREF=\"http://scoop.kuro5hin.org/\">http://scoop.kuro5hin.org/</A>). The source code is available under terms of GNU General Public License (GPL).</P>\n"; + $output .= " <P>We don't have a real demo site yet but drupal is used by (and created for) <A HREF=\"http://drop.org/\">http://drop.org/</A>. Create an account, play with it for a bit, read the <A HREF=\"module.php?mod=documentation\">documentation</A> and spend some time getting used to it.</P>\n"; + $theme->box("Introduction", $output); + + $output = "<LI><A HREF=\"drupal/drupal-1.00.tgz\">drupal 1.00</A> (2000/01/15 - latest version)</LI>\n"; + $output .= "<LI><A HREF=\"drupal/drupal-1.00-rc2.tgz\">drupal 1.00-rc2</A> (2000/01/08)</LI>\n"; + $output .= "<LI><A HREF=\"drupal/drupal-1.00-rc1.tgz\">drupal 1.00-rc1</A> (2000/01/01)</LI>\n"; + $theme->box("Download", $output); + unset($output); $handle = opendir("drupal"); while ($file = readdir($handle)) if (ereg(".jpg", $file) || ereg(".gif", $file)) $output .= " <LI><SMALL><A HREF=\"drupal/$file\">$file</A></SMALL></LI>\n"; closedir($handle); + $theme->box("Screenshots", $output); + + $output = "<H2>Documentation</H2>\n"; + $output .= " <LI><A HREF=\"module.php?mod=documentation\">documentation</A></LI>\n"; + $output .= " <LI><A HREF=\"module.php?mod=wishlist\">wishlist</A></LI>\n"; + $output .= "<H2>Mailing list</H2>\n"; + $output .= " <P>The <CODE>drupal-support@drop.org</CODE> list discusses drupal development. All submissions relevant to that, such as bug reports, enhancement ideas, patches or reports that a patch fixed a bug are appropriate.</P>\n"; + $output .= " <LI>To subscribe to the <CODE>drupal-support@drop.org</CODE> mailing list, send an e-mail to <A HREF=\"mailto:drupal-support-request@drop.org\">drupal-support-request@drop.org</A> with no subject and put <B>subscribe</B> in the body of your message.</LI>\n"; + $output .= " <LI>To unsubscribe from the <CODE>drupal-support@drop.org</CODE> mailing list, send an e-mail to <A HREF=\"mailto:drupal-support-request@drop.org\">drupal-support-request@drop.org</A> and put <B>unsubscribe</B> in the body of your mail.\n"; + $theme->box("Support and development", $output); + + print "<H3>Comments</H3>\n"; + + // Display 'comment control'-box: + if ($user->id) $theme->controls($threshold, $mode, $order); + + // Display comments: + comment_render($id, $cid); +} + +function drupal_page() { + global $cid, $comment, $id, $op, $pid, $lid, $link, $mode, $order, $subject, $theme, $threshold; - $output .= " - <H2>Demo</H2> - <P>We don't have a real demo site yet but drupal is used by (and created for) <A HREF=\"http://drop.org/\">http://drop.org/</A>. Create an account, play with it for a bit, read the <A HREF=\"module.php?mod=documentation\">documentation</A> and spend some time getting used to it.</P> - <H2>Documentation</H2> - <LI><A HREF=\"module.php?mod=documentation\">documentation</A></LI> - <LI><A HREF=\"module.php?mod=wishlist\">wishlist</A></LI> - <H2>Mailing list</H2> - <P>The <CODE>drupal-support@drop.org</CODE> list discusses drupal development. All submissions relevant to that, such as bug reports, enhancement ideas, patches or reports that a patch fixed a bug are appropriate.</P> - <LI>To subscribe to the <CODE>drupal-support@drop.org</CODE> mailing list, send an e-mail to <A HREF=\"mailto:drupal-support-request@drop.org\">drupal-support-request@drop.org</A> with no subject and put <B>subscribe</B> in the body of your message.</LI> - <LI>To unsubscribe from the <CODE>drupal-support@drop.org</CODE> mailing list, send an e-mail to <A HREF=\"mailto:drupal-support-request@drop.org\">drupal-support-request@drop.org</A> and put <B>unsubscribe</B> in the body of your mail. - "; - - $theme->header(); - $theme->box("Drupal", $output); - $theme->footer(); + switch($op) { + case "Preview comment": + $theme->header(); + comment_preview($pid, $id, $subject, $comment); + $theme->footer(); + break; + case "Post comment": + comment_post($pid, $id, $subject, $comment); + break; + case "reply": + $theme->header(); + comment_reply($pid, $id); + $theme->footer(); + break; + case "Update": + comment_settings($mode, $order, $threshold); + $theme->header(); + drupal_render($id, $cid); + $theme->footer(); + break; + case "Moderate comments": + comment_moderate($moderate); + $theme->header(); + drupal_render($id, $cid); + $theme->footer(); + break; + default: + $theme->header(); + drupal_render(0, $cid); + $theme->footer(); + } } -?> +?>
\ No newline at end of file diff --git a/modules/headline.module b/modules/headline.module index 7629594d5..3a42b3d76 100644 --- a/modules/headline.module +++ b/modules/headline.module @@ -207,7 +207,7 @@ function headline_export($uri) { while ($story = db_fetch_object($result)) { print "<item>\n"; print " <title>$story->subject</title>\n"; - print " <link>". $site_url ."discussion.php?id=$story->id</link>\n"; + print " <link>". $site_url ."story.php?id=$story->id</link>\n"; print "</item>\n"; } diff --git a/modules/story.module b/modules/story.module index 4eb1534d4..2e0ea5b23 100644 --- a/modules/story.module +++ b/modules/story.module @@ -22,9 +22,9 @@ function story_help() { } function story_block() { - $result = db_query("SELECT s.id, COUNT(s.id) AS comments, s.subject FROM stories s LEFT JOIN comments c ON s.id = c.sid WHERE s.status = 2 GROUP BY s.id ORDER BY comments DESC LIMIT 10"); + $result = db_query("SELECT s.id, COUNT(s.id) AS comments, s.subject FROM stories s LEFT JOIN comments c ON s.id = c.lid WHERE s.status = 2 AND c.link = 'link' GROUP BY s.id ORDER BY comments DESC LIMIT 10"); while ($story = db_fetch_object($result)) { - $content .= "<LI><A HREF=\"discussion.php?id=$story->id\">$story->subject</A><BR><SMALL>(". format_plural($story->comments, "comment", "comments") .")</SMALL></LI>\n"; + $content .= "<LI><A HREF=\"story.php?id=$story->id\">$story->subject</A><BR><SMALL>(". format_plural($story->comments, "comment", "comments") .")</SMALL></LI>\n"; } $blocks[0]["subject"] = "Top 10:<BR>all stories"; @@ -33,9 +33,9 @@ function story_block() { unset($content); - $result = db_query("SELECT s.id, COUNT(s.id) AS comments, s.subject FROM stories s LEFT JOIN comments c ON s.id = c.sid WHERE s.status = 2 AND ". time() ." - s.timestamp < 2419200 GROUP BY s.id ORDER BY comments DESC LIMIT 10"); + $result = db_query("SELECT s.id, COUNT(s.id) AS comments, s.subject FROM stories s LEFT JOIN comments c ON s.id = c.lid WHERE s.status = 2 AND c.link = 'story' AND ". time() ." - s.timestamp < 2419200 GROUP BY s.id ORDER BY comments DESC LIMIT 10"); while ($story = db_fetch_object($result)) { - $content .= "<LI><A HREF=\"discussion.php?id=$story->id\">$story->subject</A><BR><SMALL>(". format_plural($story->comments, "comment", "comments") .")</SMALL></LI>\n"; + $content .= "<LI><A HREF=\"story.php?id=$story->id\">$story->subject</A><BR><SMALL>(". format_plural($story->comments, "comment", "comments") .")</SMALL></LI>\n"; } $blocks[1]["subject"] = "Top 10:<BR>recent stories"; @@ -175,28 +175,28 @@ function story_display() { $result = db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON u.id = s.author WHERE s.status = 1 ORDER BY timestamp DESC"); $output .= " <TR><TH COLSPAN=\"4\">queued stories</TH></TR>\n"; while ($story = db_fetch_object($result)) { - $output .= " <TR><TD><A HREF=\"discussion.php?id=$story->id\">". check_output($story->subject) ."</A></TD><TD>". format_username($story->userid, 1) ."</TD><TD>votes: $story->votes, score: $story->score</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=edit&id=$story->id\">edit</A></TD></TR>\n"; + $output .= " <TR><TD><A HREF=\"story.php?id=$story->id\">". check_output($story->subject) ."</A></TD><TD>". format_username($story->userid, 1) ."</TD><TD>votes: $story->votes, score: $story->score</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=edit&id=$story->id\">edit</A></TD></TR>\n"; } // Scheduled stories: $result = db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON u.id = s.author WHERE s.status = 3 ORDER BY timestamp"); $output .= " <TR><TH COLSPAN=\"4\">scheduled stories</TH></TR>\n"; while ($story = db_fetch_object($result)) { - $output .= " <TR><TD><A HREF=\"discussion.php?id=$story->id\">". check_output($story->subject) ."</A></TD><TD>". format_username($story->userid, 1) ."</TD><TD>". date("D, m/d/Y H:i", $story->timestamp) ." - ". format_interval($story->timestamp - time()) ." left</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=edit&id=$story->id\">edit</A></TD></TR>\n"; + $output .= " <TR><TD><A HREF=\"story.php?id=$story->id\">". check_output($story->subject) ."</A></TD><TD>". format_username($story->userid, 1) ."</TD><TD>". date("D, m/d/Y H:i", $story->timestamp) ." - ". format_interval($story->timestamp - time()) ." left</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=edit&id=$story->id\">edit</A></TD></TR>\n"; } // Dumped stories: $result = db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON u.id = s.author WHERE s.status = 0 ORDER BY timestamp DESC LIMIT 5"); $output .= " <TR><TH COLSPAN=\"4\">dumped stories</TTH></TR>\n"; while ($story = db_fetch_object($result)) { - $output .= " <TR><TD><A HREF=\"discussion.php?id=$story->id\">". check_output($story->subject) ."</A></TD><TD>". format_username($story->userid, 1) ."</TD><TD>$story->category</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=edit&id=$story->id\">edit</A></TD></TR>\n"; + $output .= " <TR><TD><A HREF=\"story.php?id=$story->id\">". check_output($story->subject) ."</A></TD><TD>". format_username($story->userid, 1) ."</TD><TD>$story->category</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=edit&id=$story->id\">edit</A></TD></TR>\n"; } // Posted stories: $result = db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON u.id = s.author WHERE s.status = 2 ORDER BY timestamp DESC LIMIT 15"); $output .= " <TR><TH COLSPAN=\"4\">posted stories</TH></TR>\n"; while ($story = db_fetch_object($result)) { - $output .= " <TR><TD><A HREF=\"discussion.php?id=$story->id\">". check_output($story->subject) ."</A></TD><TD>". format_username($story->userid, 1) ."</TD><TD>$story->category</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=edit&id=$story->id\">edit</A></TD></TR>\n"; + $output .= " <TR><TD><A HREF=\"story.php?id=$story->id\">". check_output($story->subject) ."</A></TD><TD>". format_username($story->userid, 1) ."</TD><TD>$story->category</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=edit&id=$story->id\">edit</A></TD></TR>\n"; } $output .= "</TABLE>\n"; diff --git a/modules/story/story.module b/modules/story/story.module index 4eb1534d4..2e0ea5b23 100644 --- a/modules/story/story.module +++ b/modules/story/story.module @@ -22,9 +22,9 @@ function story_help() { } function story_block() { - $result = db_query("SELECT s.id, COUNT(s.id) AS comments, s.subject FROM stories s LEFT JOIN comments c ON s.id = c.sid WHERE s.status = 2 GROUP BY s.id ORDER BY comments DESC LIMIT 10"); + $result = db_query("SELECT s.id, COUNT(s.id) AS comments, s.subject FROM stories s LEFT JOIN comments c ON s.id = c.lid WHERE s.status = 2 AND c.link = 'link' GROUP BY s.id ORDER BY comments DESC LIMIT 10"); while ($story = db_fetch_object($result)) { - $content .= "<LI><A HREF=\"discussion.php?id=$story->id\">$story->subject</A><BR><SMALL>(". format_plural($story->comments, "comment", "comments") .")</SMALL></LI>\n"; + $content .= "<LI><A HREF=\"story.php?id=$story->id\">$story->subject</A><BR><SMALL>(". format_plural($story->comments, "comment", "comments") .")</SMALL></LI>\n"; } $blocks[0]["subject"] = "Top 10:<BR>all stories"; @@ -33,9 +33,9 @@ function story_block() { unset($content); - $result = db_query("SELECT s.id, COUNT(s.id) AS comments, s.subject FROM stories s LEFT JOIN comments c ON s.id = c.sid WHERE s.status = 2 AND ". time() ." - s.timestamp < 2419200 GROUP BY s.id ORDER BY comments DESC LIMIT 10"); + $result = db_query("SELECT s.id, COUNT(s.id) AS comments, s.subject FROM stories s LEFT JOIN comments c ON s.id = c.lid WHERE s.status = 2 AND c.link = 'story' AND ". time() ." - s.timestamp < 2419200 GROUP BY s.id ORDER BY comments DESC LIMIT 10"); while ($story = db_fetch_object($result)) { - $content .= "<LI><A HREF=\"discussion.php?id=$story->id\">$story->subject</A><BR><SMALL>(". format_plural($story->comments, "comment", "comments") .")</SMALL></LI>\n"; + $content .= "<LI><A HREF=\"story.php?id=$story->id\">$story->subject</A><BR><SMALL>(". format_plural($story->comments, "comment", "comments") .")</SMALL></LI>\n"; } $blocks[1]["subject"] = "Top 10:<BR>recent stories"; @@ -175,28 +175,28 @@ function story_display() { $result = db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON u.id = s.author WHERE s.status = 1 ORDER BY timestamp DESC"); $output .= " <TR><TH COLSPAN=\"4\">queued stories</TH></TR>\n"; while ($story = db_fetch_object($result)) { - $output .= " <TR><TD><A HREF=\"discussion.php?id=$story->id\">". check_output($story->subject) ."</A></TD><TD>". format_username($story->userid, 1) ."</TD><TD>votes: $story->votes, score: $story->score</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=edit&id=$story->id\">edit</A></TD></TR>\n"; + $output .= " <TR><TD><A HREF=\"story.php?id=$story->id\">". check_output($story->subject) ."</A></TD><TD>". format_username($story->userid, 1) ."</TD><TD>votes: $story->votes, score: $story->score</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=edit&id=$story->id\">edit</A></TD></TR>\n"; } // Scheduled stories: $result = db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON u.id = s.author WHERE s.status = 3 ORDER BY timestamp"); $output .= " <TR><TH COLSPAN=\"4\">scheduled stories</TH></TR>\n"; while ($story = db_fetch_object($result)) { - $output .= " <TR><TD><A HREF=\"discussion.php?id=$story->id\">". check_output($story->subject) ."</A></TD><TD>". format_username($story->userid, 1) ."</TD><TD>". date("D, m/d/Y H:i", $story->timestamp) ." - ". format_interval($story->timestamp - time()) ." left</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=edit&id=$story->id\">edit</A></TD></TR>\n"; + $output .= " <TR><TD><A HREF=\"story.php?id=$story->id\">". check_output($story->subject) ."</A></TD><TD>". format_username($story->userid, 1) ."</TD><TD>". date("D, m/d/Y H:i", $story->timestamp) ." - ". format_interval($story->timestamp - time()) ." left</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=edit&id=$story->id\">edit</A></TD></TR>\n"; } // Dumped stories: $result = db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON u.id = s.author WHERE s.status = 0 ORDER BY timestamp DESC LIMIT 5"); $output .= " <TR><TH COLSPAN=\"4\">dumped stories</TTH></TR>\n"; while ($story = db_fetch_object($result)) { - $output .= " <TR><TD><A HREF=\"discussion.php?id=$story->id\">". check_output($story->subject) ."</A></TD><TD>". format_username($story->userid, 1) ."</TD><TD>$story->category</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=edit&id=$story->id\">edit</A></TD></TR>\n"; + $output .= " <TR><TD><A HREF=\"story.php?id=$story->id\">". check_output($story->subject) ."</A></TD><TD>". format_username($story->userid, 1) ."</TD><TD>$story->category</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=edit&id=$story->id\">edit</A></TD></TR>\n"; } // Posted stories: $result = db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON u.id = s.author WHERE s.status = 2 ORDER BY timestamp DESC LIMIT 15"); $output .= " <TR><TH COLSPAN=\"4\">posted stories</TH></TR>\n"; while ($story = db_fetch_object($result)) { - $output .= " <TR><TD><A HREF=\"discussion.php?id=$story->id\">". check_output($story->subject) ."</A></TD><TD>". format_username($story->userid, 1) ."</TD><TD>$story->category</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=edit&id=$story->id\">edit</A></TD></TR>\n"; + $output .= " <TR><TD><A HREF=\"story.php?id=$story->id\">". check_output($story->subject) ."</A></TD><TD>". format_username($story->userid, 1) ."</TD><TD>$story->category</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=edit&id=$story->id\">edit</A></TD></TR>\n"; } $output .= "</TABLE>\n"; |