summaryrefslogtreecommitdiff
path: root/modules/comment
diff options
context:
space:
mode:
Diffstat (limited to 'modules/comment')
-rw-r--r--modules/comment/comment.module45
1 files changed, 20 insertions, 25 deletions
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 7d2dde4b9..b5b2dbe59 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -812,15 +812,14 @@ function comment_admin_overview($status = 0) {
}
function comment_mod_matrix($edit) {
- global $rid;
$output .= "<h3>Moderators/vote values matrix</h3>";
$output .= "<p><small><b>Note:</b> you must assign the <b>moderate comments</b> permission to at least one role in order to use this page.</small></p>";
$output .= "<p>In order to use comment moderation, every textbox on this page should be populated with an integer. On this page, you also might wish to value the votes from some users more than others. For example, administrator votes might count twice as much as authenticated users.</p>";
- if ($rid) {
+ if ($edit) {
db_query("DELETE FROM moderation_roles");
- foreach ($rid as $role_id => $votes) {
+ foreach ($edit as $role_id => $votes) {
foreach ($votes as $mid => $value) {
$sql[] = "('$mid', '$role_id', '$value')";
}
@@ -839,18 +838,17 @@ function comment_mod_matrix($edit) {
$mod_roles[$role->rid][$role->mid] = $role->value;
}
- $output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
- $output .= " <tr><th>" . t("votes") . "</th><th>". implode("</th><th>", array_values($role_names)) ."</th></tr>";
+ $header = array_merge(array(t("votes")), array_values($role_names));
$result = db_query("SELECT mid, vote FROM moderation_votes ORDER BY weight");
while ($vote = db_fetch_object($result)) {
- $output .= "<tr><td>$vote->vote</td>";
+ $row = array($vote->vote);
foreach (array_keys($role_names) as $rid) {
- $output .= "<td align=\"center\"><input maxlength=\"3\" name=\"rid[$rid][$vote->mid]\" size=\"4\" value=\"". $mod_roles[$rid][$vote->mid] ."\" /></td>";
+ $row[] = array("data" => form_textfield(NULL, "$rid][$vote->mid", $mod_roles[$rid][$vote->mid], 4, 3), "align" => "center");
}
- $output .= "</tr>";
+ $rows[] = $row;
}
- $output .= "</table>";
+ $output .= table($header, $rows);
$output .= "<br />". form_submit(t("Submit votes"));
return form($output);
@@ -859,7 +857,7 @@ function comment_mod_matrix($edit) {
function comment_mod_roles($edit) {
$output .= "<h3>Initial comment scores</h3>";
- $output .= "<p>Here is your opportunity to value comments from some users more than others. For example, administrator comments might count twice as much as authenticated users. Enter an integr into the <b>initial score</b> column.</p>";
+ $output .= "<p>Here is your opportunity to value comments from some users more than others. For example, administrator comments might count twice as much as authenticated users. Enter an integer into the <b>initial score</b> column.</p>";
if ($edit) {
variable_set("comment_roles", $edit);
@@ -869,15 +867,13 @@ function comment_mod_roles($edit) {
$result = db_query("SELECT r.rid, r.name FROM role r, permission p WHERE r.rid = p.rid AND p.perm LIKE '%post comments%'");
- $output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
- $output .= " <tr><th>" . t("user role") . "</th><th>" . t("initial score") . "</th></tr>";
+ $header = array(t("user role"), t("initial score"));
while ($role = db_fetch_object($result)) {
- $output .= "<tr><td>$role->name</td>";
- $output .= "<td align=\"center\"><input maxlength=\"3\" name=\"edit[$role->rid]\" size=\"4\" value=\"". $start_values[$role->rid] ."\" /></td></tr>";
+ $rows[] = array($role->name, array("data" => form_textfield(NULL, $role->rid, $start_values[$role->rid], 4, 3), "align" => "center"));
}
- $output .= "</table>";
+ $output .= table($header, $rows);
$output .= "<br />". form_submit(t("Save scores"));
return form($output);
@@ -903,20 +899,19 @@ function comment_mod_votes($edit) {
}
$output .= "<h3>" . t("Moderation votes overview") . "</h3>";
- $output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
- $output .= " <tr><th>" . t("votes") . "</th><th>" . t("weight") . "</th><th>" . t("operations") . "</th></tr>";
+ $header = array(t("votes"), t("weight"), t("operations"));
$result = db_query("SELECT mid, vote, weight FROM moderation_votes ORDER BY weight");
while ($vote = db_fetch_object($result)) {
- $output .= " <tr><td>$vote->vote</td><td align=\"center\">$vote->weight</td><td align=\"center\">". l(t("edit"), "admin/comment/votes/$vote->mid") ."</td></tr>";
+ $rows[] = array($vote->vote, array("data" => $vote->weight, "align" => "center"), array("data" => l(t("edit"), "admin/comment/votes/$vote->mid"), "align" => "center"));
}
- $output .= "</table>";
+ $output .= table($header, $rows);
if ($mid) {
$vote = db_fetch_object(db_query("SELECT vote, weight FROM moderation_votes WHERE mid = %d", $mid));
}
- $output .= "<h3>Add new moderation option</h3>";
+ $output .= "<br /><h3>Add new moderation option</h3>";
$form .= form_textfield(t("Vote"), "vote", $vote->vote, 32, 64, t("The name of this vote. Example: 'off topic', 'excellent', 'sucky'."));
$form .= form_textfield(t("Weight"), "weight", $vote->weight, 32, 64, t("Used to order votes in the comment control box; heavier sink."));
if ($mid) {
@@ -952,20 +947,20 @@ function comment_mod_filters($edit) {
$output .= "<h3>Comment threshold overview</h3>";
$output .= "<p><i>Optional</i>. If your site gets lots of comments, you may offer your users thresholds, which are used to hide all comments whose moderation score is lower than the threshold. This cuts down on clutter while your readers view the site. These thresholds appear in the Comment Control Panel.</p>";
- $output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
- $output .= " <tr><th>" . t("name") . "</th><th>" . t("minimum score") . "</th><th>" . t("operations") . "</th></tr>";
+
+ $header = array(t("name"), t("minimum score"), t("operations"));
$result = db_query("SELECT fid, filter, minimum FROM moderation_filters ORDER BY minimum");
while ($filter = db_fetch_object($result)) {
- $output .= " <tr><td>$filter->filter</td><td align=\"center\">$filter->minimum</td><td align=\"center\">". l(t("edit"), "admin/comment/filters/$filter->fid") ."</td></tr>";
+ $rows[] = array($filter->filter, array("data" => $filter->minimum, "align" => "center"), array("data" => l(t("edit"), "admin/comment/filters/$filter->fid"), "align" => "center"));
}
- $output .= "</table>";
+ $output .= table($header, $rows);
if ($fid) {
$filter = db_fetch_object(db_query("SELECT filter, fid, minimum FROM moderation_filters WHERE fid = %d", $fid));
}
- $output .= "<h3>Add new threshold</h3>";
+ $output .= "<br /><h3>Add new threshold</h3>";
$form .= form_textfield(t("Threshhold name"), "filter", $filter->filter, 32, 64, t("The name of this threshold. Example: 'good comments', '+1 comments', 'everything'."));
$form .= form_textfield(t("Minimum score"), "minimum", $filter->minimum, 32, 64, t("Show all comments whose score is larger or equal to the provided minimal score. Range: -127 + 128"));
if ($fid) {