Commit 34a927e6 authored by Dries's avatar Dries

- fixed 2 small bugs (reported by martin@abol.com)
parent abe57bbb
......@@ -10,7 +10,7 @@
function story_cron() {
$result = db_query("SELECT * FROM stories WHERE status = 3 AND timestamp <= ". time() ."");
while ($story = db_fetch_object($result)) {
db_query("UPDATE stories SET status = '1', timestamp = '". time() ."' WHERE id = '$story->id'");
db_query("UPDATE stories SET status = '1', timestamp = '". time() ."' WHERE id = '$story->id'");
}
}
......@@ -24,9 +24,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.lid WHERE s.status = 2 AND c.link = 'story' GROUP BY s.id ORDER BY comments DESC LIMIT 10");
$result = db_query("SELECT s.id, COUNT(c.cid) AS comments, s.subject FROM stories s LEFT JOIN comments c ON s.id = c.lid WHERE s.status = 2 AND c.link = 'story' GROUP BY s.id ORDER BY comments DESC LIMIT 10");
while ($story = db_fetch_object($result)) {
$content .= "<LI><A HREF=\"story.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\">". check_output($story->subject) ."</A><BR><SMALL>(". format_plural($story->comments, "comment", "comments") .")</SMALL></LI>\n";
}
$blocks[0]["subject"] = "Top 10:<BR>all stories";
......@@ -35,9 +35,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.lid WHERE s.status = 2 AND c.link = 'story' AND ". time() ." - s.timestamp < 2419200 GROUP BY s.id ORDER BY comments DESC LIMIT 10");
$result = db_query("SELECT s.id, COUNT(c.cid) 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=\"story.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\">". check_output($story->subject) ."</A><BR><SMALL>(". format_plural($story->comments, "comment", "comments") .")</SMALL></LI>\n";
}
$blocks[1]["subject"] = "Top 10:<BR>recent stories";
......@@ -51,27 +51,27 @@ function story_add() {
global $allowed_html;
$output .= "<FORM ACTION=\"admin.php?mod=story\" METHOD=\"post\">\n";
$output .= "<P>\n";
$output .= " <B>Subject:</B><BR>\n";
$output .= " <INPUT TYPE=\"text\" NAME=\"edit[subject]\" SIZE=\"50\" MAXLENGTH=\"60\"><BR>\n";
$output .= "</P>\n";
$output .= "<P><B>Section:</B><BR>\n";
$output .= " <SELECT NAME=\"edit[section]\">\n";
$output .= " <SELECT NAME=\"edit[section]\">\n";
foreach ($sections = section_get() as $value) {
$output .= " <OPTION VALUE=\"$value\">$value</OPTION>\n";
$output .= " <OPTION VALUE=\"$value\">$value</OPTION>\n";
}
$output .= " </SELECT>\n";
$output .= "</P>\n";
$output .= "<P>\n";
$output .= "<P>\n";
$output .= " <B>Abstract:</B><BR>\n";
$output .= " <TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"10\" NAME=\"edit[abstract]\" MAXLENGTH=\"20\"></TEXTAREA><BR>\n";
$output .= " <SMALL><I>Allowed HTML tags: ". htmlspecialchars($allowed_html) .".</I></SMALL>\n";
$output .= "</P>\n";
$output .= "<P>\n";
$output .= "<P>\n";
$output .= " <B>Extended story:</B><BR>\n";
$output .= " <TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"15\" NAME=\"edit[article]\"></TEXTAREA><BR>\n";
$output .= " <SMALL><I>Allowed HTML tags: ". htmlspecialchars($allowed_html) .".</I></SMALL>\n";
......@@ -85,7 +85,7 @@ function story_add() {
$output .= " <INPUT TYPE=\"radio\" NAME=\"edit[status]\" VALUE=\"0\">dumped story<BR>\n";
$output .= " <SMALL><I>The textfield for scheduled stories expects a string containing an English date format of when you want to have your story automatically published.<BR>Example input: '". date("j F Y G:i") ."', '". date("m/d/y H:i") ."', '". date("F j, Y H:i") ."', ...</I></SMALL>\n";
$output .= "</P>\n";
$output .= "<P>\n";
$output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Add story\">\n";
$output .= "</P>\n";
......@@ -160,7 +160,7 @@ function story_edit($id) {
$output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Save story\">\n";
$output .= "</P>\n";
$output .= "</FORM>\n";
print $output;
}
......@@ -170,7 +170,7 @@ function story_edit_save($id, $edit) {
watchdog("message", "story: modified `$edit[subject]'");
}
function story_display() {
function story_display() {
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
// Pending stories:
......@@ -200,9 +200,9 @@ function story_display() {
while ($story = db_fetch_object($result)) {
$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->section</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=edit&id=$story->id\">edit</A></TD></TR>\n";
}
$output .= "</TABLE>\n";
print $output;
}
......
......@@ -10,7 +10,7 @@
function story_cron() {
$result = db_query("SELECT * FROM stories WHERE status = 3 AND timestamp <= ". time() ."");
while ($story = db_fetch_object($result)) {
db_query("UPDATE stories SET status = '1', timestamp = '". time() ."' WHERE id = '$story->id'");
db_query("UPDATE stories SET status = '1', timestamp = '". time() ."' WHERE id = '$story->id'");
}
}
......@@ -24,9 +24,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.lid WHERE s.status = 2 AND c.link = 'story' GROUP BY s.id ORDER BY comments DESC LIMIT 10");
$result = db_query("SELECT s.id, COUNT(c.cid) AS comments, s.subject FROM stories s LEFT JOIN comments c ON s.id = c.lid WHERE s.status = 2 AND c.link = 'story' GROUP BY s.id ORDER BY comments DESC LIMIT 10");
while ($story = db_fetch_object($result)) {
$content .= "<LI><A HREF=\"story.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\">". check_output($story->subject) ."</A><BR><SMALL>(". format_plural($story->comments, "comment", "comments") .")</SMALL></LI>\n";
}
$blocks[0]["subject"] = "Top 10:<BR>all stories";
......@@ -35,9 +35,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.lid WHERE s.status = 2 AND c.link = 'story' AND ". time() ." - s.timestamp < 2419200 GROUP BY s.id ORDER BY comments DESC LIMIT 10");
$result = db_query("SELECT s.id, COUNT(c.cid) 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=\"story.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\">". check_output($story->subject) ."</A><BR><SMALL>(". format_plural($story->comments, "comment", "comments") .")</SMALL></LI>\n";
}
$blocks[1]["subject"] = "Top 10:<BR>recent stories";
......@@ -51,27 +51,27 @@ function story_add() {
global $allowed_html;
$output .= "<FORM ACTION=\"admin.php?mod=story\" METHOD=\"post\">\n";
$output .= "<P>\n";
$output .= " <B>Subject:</B><BR>\n";
$output .= " <INPUT TYPE=\"text\" NAME=\"edit[subject]\" SIZE=\"50\" MAXLENGTH=\"60\"><BR>\n";
$output .= "</P>\n";
$output .= "<P><B>Section:</B><BR>\n";
$output .= " <SELECT NAME=\"edit[section]\">\n";
$output .= " <SELECT NAME=\"edit[section]\">\n";
foreach ($sections = section_get() as $value) {
$output .= " <OPTION VALUE=\"$value\">$value</OPTION>\n";
$output .= " <OPTION VALUE=\"$value\">$value</OPTION>\n";
}
$output .= " </SELECT>\n";
$output .= "</P>\n";
$output .= "<P>\n";
$output .= "<P>\n";
$output .= " <B>Abstract:</B><BR>\n";
$output .= " <TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"10\" NAME=\"edit[abstract]\" MAXLENGTH=\"20\"></TEXTAREA><BR>\n";
$output .= " <SMALL><I>Allowed HTML tags: ". htmlspecialchars($allowed_html) .".</I></SMALL>\n";
$output .= "</P>\n";
$output .= "<P>\n";
$output .= "<P>\n";
$output .= " <B>Extended story:</B><BR>\n";
$output .= " <TEXTAREA WRAP=\"virtual\" COLS=\"50\" ROWS=\"15\" NAME=\"edit[article]\"></TEXTAREA><BR>\n";
$output .= " <SMALL><I>Allowed HTML tags: ". htmlspecialchars($allowed_html) .".</I></SMALL>\n";
......@@ -85,7 +85,7 @@ function story_add() {
$output .= " <INPUT TYPE=\"radio\" NAME=\"edit[status]\" VALUE=\"0\">dumped story<BR>\n";
$output .= " <SMALL><I>The textfield for scheduled stories expects a string containing an English date format of when you want to have your story automatically published.<BR>Example input: '". date("j F Y G:i") ."', '". date("m/d/y H:i") ."', '". date("F j, Y H:i") ."', ...</I></SMALL>\n";
$output .= "</P>\n";
$output .= "<P>\n";
$output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Add story\">\n";
$output .= "</P>\n";
......@@ -160,7 +160,7 @@ function story_edit($id) {
$output .= " <INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Save story\">\n";
$output .= "</P>\n";
$output .= "</FORM>\n";
print $output;
}
......@@ -170,7 +170,7 @@ function story_edit_save($id, $edit) {
watchdog("message", "story: modified `$edit[subject]'");
}
function story_display() {
function story_display() {
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
// Pending stories:
......@@ -200,9 +200,9 @@ function story_display() {
while ($story = db_fetch_object($result)) {
$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->section</TD><TD ALIGN=\"center\"><A HREF=\"admin.php?mod=story&op=edit&id=$story->id\">edit</A></TD></TR>\n";
}
$output .= "</TABLE>\n";
print $output;
}
......
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