diff options
-rw-r--r-- | account.php | 16 | ||||
-rw-r--r-- | includes/comment.inc | 33 | ||||
-rw-r--r-- | modules/drupal.module | 7 | ||||
-rw-r--r-- | modules/drupal/drupal.module | 7 | ||||
-rw-r--r-- | story.php | 12 | ||||
-rw-r--r-- | themes/marvin/marvin.theme | 5 | ||||
-rw-r--r-- | themes/unconed/unconed.theme | 4 |
7 files changed, 42 insertions, 42 deletions
diff --git a/account.php b/account.php index 39b2fa074..aaa4cb597 100644 --- a/account.php +++ b/account.php @@ -169,16 +169,12 @@ function account_site_edit() { } $output .= "<B>Comment sort order:</B><BR>\n"; $output .= "<SELECT NAME=\"edit[sort]\">$options5</SELECT><P>\n"; - $options = "<OPTION VALUE=\"-1\"". ($user->threshold == -1 ? " SELECTED" : "") .">-1: Display uncut and raw comments.</OPTION>"; - $options .= "<OPTION VALUE=\"0\"". ($user->threshold == 0 ? " SELECTED" : "") .">0: Display almost all comments.</OPTION>"; - $options .= "<OPTION VALUE=\"1\"". ($user->threshold == 1 ? " SELECTED" : "") .">1: Display almost no anonymous comments.</OPTION>"; - $options .= "<OPTION VALUE=\"2\"". ($user->threshold == 2 ? " SELECTED" : "") .">2: Display comments with score +2 only.</OPTION>"; - $options .= "<OPTION VALUE=\"3\"". ($user->threshold == 3 ? " SELECTED" : "") .">3: Display comments with score +3 only.</OPTION>"; - $options .= "<OPTION VALUE=\"4\"". ($user->threshold == 4 ? " SELECTED" : "") .">4: Display comments with score +4 only.</OPTION>"; - $options .= "<OPTION VALUE=\"5\"". ($user->threshold == 5 ? " SELECTED" : "") .">5: Display comments with score +5 only.</OPTION>"; - $output .= "<B>Comment threshold:</B><BR>\n"; - $output .= "<SELECT NAME=\"edit[threshold]\">$options</SELECT><BR>\n"; - $output .= "<I>Comments that scored less than this setting will be ignored. Anonymous comments start at 0, comments of people logged on start at 1 and moderators can add and subtract points.</I><P>\n"; + for ($i = -1; $i < 6; $i++) { + $options6 .= " <OPTION VALUE=\"$i\"". ($user->threshold == $i ? " SELECTED" : "") .">Filter - $i</OPTION>"; + } + $output .= "<B>Comment filter:</B><BR>\n"; + $output .= "<SELECT NAME=\"edit[threshold]\">$options6</SELECT><BR>\n"; + $output .= "<I>Comments that scored less than this threshold setting will be ignored. Anonymous comments start at 0, comments of people logged on start at 1 and moderators can add and subtract points.</I><P>\n"; $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Save site settings\"><BR>\n"; $output .= "</FORM>\n"; diff --git a/includes/comment.inc b/includes/comment.inc index cf6ce6919..64f0c1000 100644 --- a/includes/comment.inc +++ b/includes/comment.inc @@ -7,7 +7,7 @@ if (strstr($id, " ") || strstr($pid, " ") || strstr($lid, " ") || strstr($mode, } $cmodes = array(1 => "List - min", 2 => "List - max", 3 => "Threaded - min", 4 => "Threaded - max"); -$corder = array(1 => "Date - new", 2 => "Date - old", 3 => "Rate - high"); +$corder = array(1 => "Date - new", 2 => "Date - old", 3 => "Rate - high", 4 => "Rate - low"); $link = ($mod) ? $mod : substr($PHP_SELF, 1, strlen($PHP_SELF) - 5); class Comment { @@ -61,8 +61,11 @@ function comment_reply($pid, $id) { $theme->comment(new Comment($item->userid, $item->subject, $item->comment, $item->timestamp, $item->url, $item->fake_email, comment_score($comment), $comment->votes, $item->cid), "reply to this comment"); } else { - $item = db_fetch_object(db_query("SELECT stories.*, users.userid FROM stories LEFT JOIN users ON stories.author = users.id WHERE stories.status != 0 AND stories.id = $id")); - $theme->article($item, ""); + $pid = 0; + if ($link == "story") { + $item = db_fetch_object(db_query("SELECT stories.*, users.userid FROM stories LEFT JOIN users ON stories.author = users.id WHERE stories.status != 0 AND stories.id = $id")); + $theme->article($item, ""); + } } // Build reply form: @@ -211,16 +214,15 @@ function comment_moderation($comment) { return $output; } - -function comment_controls($threshold, $mode, $order) { - global $REQUEST_URI; +function comment_controls($threshold = 1, $mode = 3, $order = 1) { + global $REQUEST_URI, $user; $output .= "<FONT SIZE=\"2\">\n"; $output .= "<FORM METHOD=\"post\" ACTION=\"$REQUEST_URI\">\n"; - $output .= comment_threshold($threshold); - $output .= comment_mode($mode); - $output .= comment_order($order); - $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Update\">\n"; - // $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Reply\">\n"; + $output .= comment_mode(($user->id ? $user->mode : $mode)); + $output .= comment_order(($user->id ? $user->sort : $order)); + $output .= comment_threshold(($user->id ? $user->threshold : $threshold)); + $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Update settings\">\n"; + $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Add comment\">\n"; $output .= "</FORM>\n"; $output .= "</FONT>\n"; return $output; @@ -229,7 +231,7 @@ function comment_controls($threshold, $mode, $order) { function comment_threshold($threshold) { $output .= "<SELECT NAME=\"threshold\">\n"; for ($i = -1; $i < 6; $i++) { - $output .= " <OPTION VALUE=\"$i\"". ($threshold == $i ? " SELECTED" : "") .">Threshold: $i</OPTION>"; + $output .= " <OPTION VALUE=\"$i\"". ($threshold == $i ? " SELECTED" : "") .">Filter - $i</OPTION>"; } $output .= "</SELECT>\n"; return $output; @@ -259,7 +261,9 @@ function comment_query($link, $lid, $order, $pid = -1) { $query .= "SELECT c.*, u.* FROM comments c LEFT JOIN users u ON c.author = u.id WHERE link = '$link' AND c.lid = $lid"; if ($pid >= 0) $query .= " AND pid = $pid"; if ($order == 1) $query .= " ORDER BY c.timestamp DESC"; - if ($order == 2) $query .= " ORDER BY c.score DESC"; + else if ($order == 2) $query .= " ORDER BY c.timestamp"; + else if ($order == 3) $query .= " ORDER BY c.score DESC"; + else if ($order == 4) $query .= " ORDER BY c.score"; return db_query($query); } @@ -332,6 +336,9 @@ function comment_render($lid, $cid) { $threshold = ($user->id) ? $user->threshold : 3; if ($user->id) { + // Comment control: + $theme->controls($threshold, $mode, $order); + // Print moderation form: print "<FORM METHOD=\"post\" ACTION=\"$REQUEST_URI\">\n"; } diff --git a/modules/drupal.module b/modules/drupal.module index 113cbe95e..8e7cc249c 100644 --- a/modules/drupal.module +++ b/modules/drupal.module @@ -6,7 +6,7 @@ include_once "includes/common.inc"; include_once "includes/comment.inc"; function drupal_render($id, $cid) { - global $theme, $threshold, $mode, $order, $user; + global $theme, $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"; @@ -35,9 +35,6 @@ function drupal_render($id, $cid) { print "<H3>Comments</H3>\n"; - // Display 'comment control'-box: - if ($user->id) $theme->controls($threshold, $mode, $order); - // Display comments: comment_render($id, $cid); } @@ -59,7 +56,7 @@ function drupal_page() { comment_reply($pid, $id); $theme->footer(); break; - case "Update": + case "Update settings": comment_settings($mode, $order, $threshold); $theme->header(); drupal_render($id, $cid); diff --git a/modules/drupal/drupal.module b/modules/drupal/drupal.module index 113cbe95e..8e7cc249c 100644 --- a/modules/drupal/drupal.module +++ b/modules/drupal/drupal.module @@ -6,7 +6,7 @@ include_once "includes/common.inc"; include_once "includes/comment.inc"; function drupal_render($id, $cid) { - global $theme, $threshold, $mode, $order, $user; + global $theme, $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"; @@ -35,9 +35,6 @@ function drupal_render($id, $cid) { print "<H3>Comments</H3>\n"; - // Display 'comment control'-box: - if ($user->id) $theme->controls($threshold, $mode, $order); - // Display comments: comment_render($id, $cid); } @@ -59,7 +56,7 @@ function drupal_page() { comment_reply($pid, $id); $theme->footer(); break; - case "Update": + case "Update settings": comment_settings($mode, $order, $threshold); $theme->header(); drupal_render($id, $cid); @@ -3,7 +3,7 @@ include "includes/common.inc"; function story_render($id, $cid) { - global $theme, $threshold, $mode, $order, $user; + global $theme, $user; // Compose story query: $result = db_query("SELECT s.*, u.userid FROM stories s LEFT JOIN users u ON s.author = u.id WHERE s.status != 0 AND s.id = $id"); @@ -13,9 +13,6 @@ function story_render($id, $cid) { if ($story->status == 1) $theme->article($story, "[ <A HREF=\"submission.php\"><FONT COLOR=\"$theme->hlcolor2\">submission queue</FONT></A> | <A HREF=\"story.php?op=reply&id=$story->id&pid=0\"><FONT COLOR=\"$theme->hlcolor2\">add a comment</FONT></A> ]"); else $theme->article($story, "[ <A HREF=\"\"><FONT COLOR=\"$theme->hlcolor2\">home</FONT></A> | <A HREF=\"story.php?op=reply&id=$story->id&pid=0\"><FONT COLOR=\"$theme->hlcolor2\">add a comment</FONT></A> ]"); - // Display 'comment control'-box: - if ($user->id) $theme->controls($threshold, $mode, $order); - // Display comments: comment_render($id, $cid); } @@ -29,12 +26,17 @@ switch($op) { case "Post comment": comment_post($pid, $id, $subject, $comment); break; + case "Add comment": + $theme->header(); + comment_reply($cid, $id); + $theme->footer(); + break; case "reply": $theme->header(); comment_reply($pid, $id); $theme->footer(); break; - case "Update": + case "Update settings": comment_settings($mode, $order, $threshold); $theme->header(); story_render($id, $cid); diff --git a/themes/marvin/marvin.theme b/themes/marvin/marvin.theme index d63cbba76..9f562af61 100644 --- a/themes/marvin/marvin.theme +++ b/themes/marvin/marvin.theme @@ -94,10 +94,11 @@ print "<BR><BR>\n\n"; } - function controls($threshold, $mode, $order) { + function controls() { print "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\">\n"; print " <TR><TD BGCOLOR=\"#000000\"><IMG SRC=\"themes/marvin/images/pixel.gif\" WIDTH=\"100%\" HEIGHT=\"0\" ALT=\"\"></TD></TR>\n"; - print " <TR><TD>". comment_controls($threshold, $mode, $order) ."</TD></TR>\n"; + print " <TR><TD> </TD></TR>\n"; + print " <TR><TD>". comment_controls() ."</TD></TR>\n"; print " <TR><TD BGCOLOR=\"#000000\"><IMG SRC=\"themes/marvin/images/pixel.gif\" WIDTH=\"100%\" HEIGHT=\"0\" ALT=\"\"></TD></TR>\n"; print "</TABLE>"; } diff --git a/themes/unconed/unconed.theme b/themes/unconed/unconed.theme index bb93d4a60..34bf2677d 100644 --- a/themes/unconed/unconed.theme +++ b/themes/unconed/unconed.theme @@ -140,9 +140,9 @@ <? } - function controls($threshold, $mode, $order) { + function controls() { print "<HR>"; - print comment_controls($threshold, $mode, $order); + print comment_controls(); print "<HR>"; } |