Commit c85a0ee0 authored by Dries's avatar Dries

- bugfix in "Top 10: most recent stories"
parent ca2d5d6f
...@@ -13,6 +13,8 @@ function story_block() { ...@@ -13,6 +13,8 @@ function story_block() {
$blocks[0]["content"] = $content; $blocks[0]["content"] = $content;
$blocks[0]["info"] = "Top 10: all stories"; $blocks[0]["info"] = "Top 10: all stories";
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.sid WHERE s.status = 2 AND ". time() ." - s.timestamp < 2419200 GROUP BY s.id ORDER BY comments DESC LIMIT 10");
while ($story = db_fetch_object($result)) { 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=\"discussion.php?id=$story->id\">$story->subject</A><BR><SMALL>(". format_plural($story->comments, "comment", "comments") .")</SMALL></LI>\n";
......
...@@ -13,6 +13,8 @@ function story_block() { ...@@ -13,6 +13,8 @@ function story_block() {
$blocks[0]["content"] = $content; $blocks[0]["content"] = $content;
$blocks[0]["info"] = "Top 10: all stories"; $blocks[0]["info"] = "Top 10: all stories";
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.sid WHERE s.status = 2 AND ". time() ." - s.timestamp < 2419200 GROUP BY s.id ORDER BY comments DESC LIMIT 10");
while ($story = db_fetch_object($result)) { 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=\"discussion.php?id=$story->id\">$story->subject</A><BR><SMALL>(". format_plural($story->comments, "comment", "comments") .")</SMALL></LI>\n";
......
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