Commit 343e71c8 authored by Dries's avatar Dries

CHANGES:

- Added moderator permissions to nodes.

- Added moderator support to structure.module.

- Added new moderate.module.

- Renamed moderation.module to queue.module to avoid confusing.
  Updated theme yaroon as it seems to have a hard-coded reference
  to moderation.module.

- Polished on:
   + account.module: improved access list
   + fixed HTML typo in node.module

ACTIONS:

- Jeroen: can jeroen2.theme be removed from ./themes/yaroon?
parent 853141a9
......@@ -54,7 +54,7 @@ function node_get_comments($nid) {
function node_save($node) {
global $user, $status;
$rows = array(nid, pid, lid, cid, tid, log, type, title, score, votes, author, status, comment, promote, timestamp);
$rows = array(nid, pid, lid, cid, tid, log, type, title, score, votes, author, status, comment, promote, moderate, timestamp);
if ($node[nid] > 0) {
$n = node_get_object("nid", $node[nid]);
......@@ -90,7 +90,7 @@ function node_save($node) {
throttle("post node", variable_get(max_node_rate, 900));
// setup default values:
$node = array_merge(array(title => "?", author => $user->id, type => "?", pid => 0, cid => 0, tid => 0, log => "node created", status => (category_submission($node[cid]) ? $status[queued] : $status[posted]) , score => 0, votes => 0, comment => category_comment($node[cid]), promote => category_promote($node[cid]), timestamp => time()), $node);
$node = array_merge(array(title => "?", author => $user->id, type => "?", pid => 0, cid => 0, tid => 0, log => "node created", status => (category_submission($node[cid]) ? $status[queued] : $status[posted]) , score => 0, votes => 0, comment => category_comment($node[cid]), promote => category_promote($node[cid]), moderate => "", timestamp => time()), $node);
// prepare queries:
$f1 = array();
......@@ -159,8 +159,8 @@ function node_form($node) {
}
function node_status($node, $index = -1) {
$status = array_intersect(array(dumped, expired, queued, posted), node_invoke($node, "status"));
return $index < 0 ? $status : $status[$index];
$status = array(dumped, expired, queued, posted);
return $index < 0 ? array_intersect($status, node_invoke($node, "status")) : $status[$index];
}
function node_control($node) {
......@@ -198,4 +198,8 @@ function node_visible($node) {
return ($node->status == $status[posted]) || ($node->status == $status[queued] && $user->id) || user_access($user, $node->type) || user_access($user, "node");
}
function node_access($account, $node) {
return strstr($node->moderate, $account->userid);
}
?>
\ No newline at end of file
......@@ -155,7 +155,7 @@ function account_edit($name) {
function access($name, $module) {
global $access, $account;
$access .= "<OPTION VALUE=\"$name\"". (user_access($account, $name) ? " SELECTED" : "") .">$name</OPTION>";
if ($module["admin"]) $access .= "<OPTION VALUE=\"$name\"". (user_access($account, $name) ? " SELECTED" : "") .">$name</OPTION>";
}
$status = array("blocked", "not confirmed", "open");
......
......@@ -92,7 +92,7 @@ function book_toc($parent = 0, $indent = "", $toc = array()) {
}
function book_form($edit = array()) {
global $allowed_html, $PHP_SELF, $REQUEST_URI, $user;
global $allowed_html, $REQUEST_URI, $user;
$form .= form_item(t("Author"), format_username(($edit[userid] ? $edit[userid] : $user->userid)));
$form .= form_hidden(userid, $edit[userid]);
......
......@@ -92,7 +92,7 @@ function book_toc($parent = 0, $indent = "", $toc = array()) {
}
function book_form($edit = array()) {
global $allowed_html, $PHP_SELF, $REQUEST_URI, $user;
global $allowed_html, $REQUEST_URI, $user;
$form .= form_item(t("Author"), format_username(($edit[userid] ? $edit[userid] : $user->userid)));
$form .= form_hidden(userid, $edit[userid]);
......
......@@ -14,15 +14,17 @@ function comment_find($keys) {
}
function comment_edit($id) {
global $REQUEST_URI;
$result = db_query("SELECT c.*, u.userid FROM comments c LEFT JOIN users u ON c.author = u.id WHERE c.cid = '$id'");
$comment = db_fetch_object($result);
$form .= form_item(t("Author"), format_username($comment->userid));
$form .= form_textfield(t("Subject"), "subject", $comment->subject, 50, 128);
$form .= form_textarea(t("Comment"), "comment", $comment->comment, 50, 10);
$form .= form_submit("Save comment");
$form .= form_submit("Submit");
return form("admin.php?mod=comment&id=$id", $form);
return form($REQUEST_URI, $form);
}
function comment_save($id, $edit) {
......@@ -30,7 +32,7 @@ function comment_save($id, $edit) {
watchdog("message", "comment: modified '$edit[subject]'");
}
function comment_display() {
function comment_overview() {
$result = db_query("SELECT c.*, u.userid FROM comments c LEFT JOIN users u ON u.id = c.author ORDER BY timestamp DESC LIMIT 50");
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
......@@ -56,12 +58,12 @@ function comment_admin() {
print search_form($keys);
print search_data($keys, $mod);
break;
case "Save comment":
case "Submit":
print status(comment_save(check_input($id), $edit));
print comment_display();
print comment_overview();
break;
default:
print comment_display();
print comment_overview();
}
}
......
......@@ -14,15 +14,17 @@ function comment_find($keys) {
}
function comment_edit($id) {
global $REQUEST_URI;
$result = db_query("SELECT c.*, u.userid FROM comments c LEFT JOIN users u ON c.author = u.id WHERE c.cid = '$id'");
$comment = db_fetch_object($result);
$form .= form_item(t("Author"), format_username($comment->userid));
$form .= form_textfield(t("Subject"), "subject", $comment->subject, 50, 128);
$form .= form_textarea(t("Comment"), "comment", $comment->comment, 50, 10);
$form .= form_submit("Save comment");
$form .= form_submit("Submit");
return form("admin.php?mod=comment&id=$id", $form);
return form($REQUEST_URI, $form);
}
function comment_save($id, $edit) {
......@@ -30,7 +32,7 @@ function comment_save($id, $edit) {
watchdog("message", "comment: modified '$edit[subject]'");
}
function comment_display() {
function comment_overview() {
$result = db_query("SELECT c.*, u.userid FROM comments c LEFT JOIN users u ON u.id = c.author ORDER BY timestamp DESC LIMIT 50");
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
......@@ -56,12 +58,12 @@ function comment_admin() {
print search_form($keys);
print search_data($keys, $mod);
break;
case "Save comment":
case "Submit":
print status(comment_save(check_input($id), $edit));
print comment_display();
print comment_overview();
break;
default:
print comment_display();
print comment_overview();
}
}
......
......@@ -21,15 +21,15 @@ function forum_view($node) {
}
function forum_form($edit = array()) {
global $format;
global $format, $REQUEST_URI;
$form .= form_textfield(t("Subject"), "title", $edit[title], 50, 64);
$form .= structure_form("forum", $edit);
$form .= form_textarea(t("Body"), "body", $edit[body], 50, 10);
$form .= form_hidden("nid", $edit[nid]);
$form .= form_submit("Save forum");
$form .= form_submit("Submit");
return form("admin.php?mod=forum", $form);
return form($REQUEST_URI, $form);
}
function forum_save($edit) {
......@@ -83,7 +83,7 @@ function forum_admin() {
case "edit":
print forum_form(node_get_array(nid, $id));
break;
case "Save forum":
case "Submit":
print status(forum_save($edit));
// fall through:
default:
......
......@@ -21,15 +21,15 @@ function forum_view($node) {
}
function forum_form($edit = array()) {
global $format;
global $format, $REQUEST_URI;
$form .= form_textfield(t("Subject"), "title", $edit[title], 50, 64);
$form .= structure_form("forum", $edit);
$form .= form_textarea(t("Body"), "body", $edit[body], 50, 10);
$form .= form_hidden("nid", $edit[nid]);
$form .= form_submit("Save forum");
$form .= form_submit("Submit");
return form("admin.php?mod=forum", $form);
return form($REQUEST_URI, $form);
}
function forum_save($edit) {
......@@ -83,7 +83,7 @@ function forum_admin() {
case "edit":
print forum_form(node_get_array(nid, $id));
break;
case "Save forum":
case "Submit":
print status(forum_save($edit));
// fall through:
default:
......
<?php
$module = array("admin" => "moderate_admin");
function moderate_comment_access($cid) {
global $user;
return db_fetch_object(db_query("SELECT n.moderate FROM comments c LEFT JOIN node n ON c.lid = n.nid WHERE c.cid = '". check_input($cid) ."' AND n.moderate LIKE '%$user->userid%'"));
}
function moderate_overview($query = array()) {
global $user;
$result = db_query("SELECT n.*, u.userid FROM node n LEFT JOIN users u ON n.author = u.id WHERE n.moderate LIKE '%$user->userid%' ORDER BY n.timestamp DESC LIMIT 15");
$output .= status($query[0]);
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
$output .= " <TR><TH>node</TH><TH>category / topic</TH><TH>status</TH><TH>author</TH><TH>date</TH><TH>operations</TH></TR>\n";
$r1 = db_query("SELECT n.*, u.userid FROM node n LEFT JOIN users u ON n.author = u.id WHERE n.moderate LIKE '%$user->userid%' ORDER BY n.timestamp DESC LIMIT 30");
while ($node = db_fetch_object($r1)) {
$output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD>". category_name($node->cid) ." / ". topic_name($node->tid) ."</TD><TD>". node_status($node, $node->status) ."</TD><TD>". format_username($node->userid) ."</TD><TD>". format_date($node->timestamp, "small") ."</TD><TD><A HREF=\"admin.php?mod=moderate&type=node&op=edit&id=$node->nid\">edit $node->type</A></TD></TR>\n";
$r2 = db_query("SELECT c.*, u.userid FROM comments c LEFT JOIN users u ON c.author = u.id WHERE c.lid = '$node->nid' ORDER BY c.timestamp DESC");
while ($comment = db_fetch_object($r2)) {
$output .= "<TR><TD COLSPAN=\"3\">&nbsp;- <A HREF=\"node.php?id=$comment->lid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</A></TD><TD>". format_username($user->userid) ."</TD><TD>". format_date($node->timestamp, "small") ."</TD><TD><A HREF=\"admin.php?mod=moderate&type=comment&op=edit&id=$comment->cid\">edit comment</A></TD></TR>\n";
}
}
$output .= "</TABLE>\n";
return $output;
}
function moderate_node_edit($id) {
global $user;
$node = node_get_array("nid", $id);
if ($node && strstr($node[moderate], $user->userid)) {
return node_form($node);
}
else {
return "access denied";
}
}
function moderate_node_save($edit) {
global $user;
$node = node_get_array("nid", $edit[nid]);
if ($node && strstr($node[moderate], $user->userid)) {
$edit[type] = $node[type];
return node_invoke($edit, "save");
}
else {
return "access denied";
}
}
function moderate_comment_edit($id) {
if (moderate_comment_access($id)) {
return comment_edit($id);
}
else {
return "access denied";
}
}
function moderate_comment_save($id, $edit) {
if (moderate_comment_access($id)) {
return comment_save($id, $edit);
}
else {
return "access denied";
}
}
function moderate_admin() {
global $op, $id, $edit, $type;
switch ($type) {
case "comment":
switch ($op) {
case "edit":
print moderate_comment_edit($id);
break;
case "Submit":
print status(moderate_comment_save($id, $edit));
// fall through:
default:
print moderate_overview();
}
break;
default:
switch ($op) {
case "edit":
print moderate_node_edit($id);
break;
case "Submit":
print status(moderate_node_save($edit));
// fall through:
default:
print moderate_overview();
}
}
}
?>
......@@ -3,15 +3,15 @@
$module = array("admin" => "node_admin");
function node_overview($query = array()) {
global $user, $rstatus;
global $user;
$result = db_query("SELECT n.*, u.userid, c.name AS category FROM node n LEFT JOIN users u ON n.author = u.id LEFT JOIN category c ON n.cid = c.cid $query[1] LIMIT 50");
$output .= status($query[0]);
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
$output .= " <TR><TH>title</TH><TH>category</TH><TH>status</TH><TH>author</TH><TH>date</TH><TH COLSPAN=\"3\">operations</TH></TR>\n";
$output .= " <TR><TH>title</TH><TH>category</TH><TH>status</TH><TH>author</TH><TH>date</TH><TH COLSPAN=\"2\">operations</TH></TR>\n";
while ($node = db_fetch_object($result)) {
$output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">". check_output($node->category ? $node->category : $node->type) ."</TD><TD>". $rstatus[$node->status] ."</TD><TD>". format_username($node->userid) ."</TD><TD>". format_date($node->timestamp, "small") ."</TD><TD>". (user_access($user, "node") ? "<A HREF=\"admin.php?mod=node&op=view&id=$node->nid\">view node</A></TD>" : "view node") ."</TD><TD>". (user_access($user, "node") ? "<A HREF=\"admin.php?mod=node&op=edit&id=$node->nid\">edit node</A></TD>" : "edit node") ."</TD><TD>". (user_access($user, $node->type) ? "<A HREF=\"admin.php?mod=$node->type&op=edit&id=$node->nid\">edit $node->type</A></TD>" : "edit $node->type") ."</TD></TR>\n";
$output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">". check_output($node->category ? $node->category : $node->type) ."</TD><TD>". node_status($node, $node->status) ."</TD><TD>". format_username($node->userid) ."</TD><TD>". format_date($node->timestamp, "small") ."</TD><TD>". (user_access($user, "node") ? "<A HREF=\"admin.php?mod=node&op=edit&id=$node->nid\">edit node</A>" : "edit node") ."</TD><TD>". (user_access($user, $node->type) ? "<A HREF=\"admin.php?mod=$node->type&op=edit&id=$node->nid\">edit $node->type</A>" : "edit $node->type") ."</TD></TR>\n";
}
$output .= "</TABLE>\n";
......@@ -19,16 +19,15 @@ function node_overview($query = array()) {
}
function node_admin_view($id) {
global $rstatus;
$node = node_get_object("nid", $id);
$output .= "<FORM ACTION=\"admin.php?mod=node&id=$node->nid\" METHOD=\"post\">\n";
$output .= form_item("Title", check_output($node->title));
$output .= form_item("Author", format_username($node->userid));
$output .= form_item("Status", $rstatus[$node->status]);
$output .= form_item("Status", node_status($node, $node->status));
$output .= form_item("Comment", node_comment_status($node->comment));
$output .= form_item("Promote", node_promote_status($node->promote));
$output .= form_item("Moderate", check_output($node->moderate));
$output .= form_item("Date", format_date($node->timestamp));
$output .= form_submit("Edit node");
$output .= form_submit("Delete node");
......@@ -48,6 +47,7 @@ function node_admin_edit($id) {
$output .= form_select("Status", "status", $node->status, node_status($node));
$output .= form_select("Comment", "comment", $node->comment, node_comment_status());
$output .= form_select("Promote", "promote", $node->promote, node_promote_status());
$output .= form_textfield("Moderate", "moderate", $node->moderate, 35, 255, t("A comma-seperated list of usernames."));
$output .= form_select("Date", "timestamp", $node->timestamp, array($node->timestamp => format_date($node->timestamp) ." (original)", time() => format_date(time()) ." (current)"));
$output .= form_hidden("nid", $node->nid);
$output .= form_submit("View node");
......
......@@ -3,15 +3,15 @@
$module = array("admin" => "node_admin");
function node_overview($query = array()) {
global $user, $rstatus;
global $user;
$result = db_query("SELECT n.*, u.userid, c.name AS category FROM node n LEFT JOIN users u ON n.author = u.id LEFT JOIN category c ON n.cid = c.cid $query[1] LIMIT 50");
$output .= status($query[0]);
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
$output .= " <TR><TH>title</TH><TH>category</TH><TH>status</TH><TH>author</TH><TH>date</TH><TH COLSPAN=\"3\">operations</TH></TR>\n";
$output .= " <TR><TH>title</TH><TH>category</TH><TH>status</TH><TH>author</TH><TH>date</TH><TH COLSPAN=\"2\">operations</TH></TR>\n";
while ($node = db_fetch_object($result)) {
$output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">". check_output($node->category ? $node->category : $node->type) ."</TD><TD>". $rstatus[$node->status] ."</TD><TD>". format_username($node->userid) ."</TD><TD>". format_date($node->timestamp, "small") ."</TD><TD>". (user_access($user, "node") ? "<A HREF=\"admin.php?mod=node&op=view&id=$node->nid\">view node</A></TD>" : "view node") ."</TD><TD>". (user_access($user, "node") ? "<A HREF=\"admin.php?mod=node&op=edit&id=$node->nid\">edit node</A></TD>" : "edit node") ."</TD><TD>". (user_access($user, $node->type) ? "<A HREF=\"admin.php?mod=$node->type&op=edit&id=$node->nid\">edit $node->type</A></TD>" : "edit $node->type") ."</TD></TR>\n";
$output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">". check_output($node->category ? $node->category : $node->type) ."</TD><TD>". node_status($node, $node->status) ."</TD><TD>". format_username($node->userid) ."</TD><TD>". format_date($node->timestamp, "small") ."</TD><TD>". (user_access($user, "node") ? "<A HREF=\"admin.php?mod=node&op=edit&id=$node->nid\">edit node</A>" : "edit node") ."</TD><TD>". (user_access($user, $node->type) ? "<A HREF=\"admin.php?mod=$node->type&op=edit&id=$node->nid\">edit $node->type</A>" : "edit $node->type") ."</TD></TR>\n";
}
$output .= "</TABLE>\n";
......@@ -19,16 +19,15 @@ function node_overview($query = array()) {
}
function node_admin_view($id) {
global $rstatus;
$node = node_get_object("nid", $id);
$output .= "<FORM ACTION=\"admin.php?mod=node&id=$node->nid\" METHOD=\"post\">\n";
$output .= form_item("Title", check_output($node->title));
$output .= form_item("Author", format_username($node->userid));
$output .= form_item("Status", $rstatus[$node->status]);
$output .= form_item("Status", node_status($node, $node->status));
$output .= form_item("Comment", node_comment_status($node->comment));
$output .= form_item("Promote", node_promote_status($node->promote));
$output .= form_item("Moderate", check_output($node->moderate));
$output .= form_item("Date", format_date($node->timestamp));
$output .= form_submit("Edit node");
$output .= form_submit("Delete node");
......@@ -48,6 +47,7 @@ function node_admin_edit($id) {
$output .= form_select("Status", "status", $node->status, node_status($node));
$output .= form_select("Comment", "comment", $node->comment, node_comment_status());
$output .= form_select("Promote", "promote", $node->promote, node_promote_status());
$output .= form_textfield("Moderate", "moderate", $node->moderate, 35, 255, t("A comma-seperated list of usernames."));
$output .= form_select("Date", "timestamp", $node->timestamp, array($node->timestamp => format_date($node->timestamp) ." (original)", time() => format_date(time()) ." (current)"));
$output .= form_hidden("nid", $node->nid);
$output .= form_submit("View node");
......
......@@ -38,7 +38,7 @@ function page_form($edit = array()) {
$form .= form_textarea(t("Body"), "body", $edit[body], 50, 10);
$form .= form_select(t("Type"), "format", $edit[format], $format);
$form .= form_hidden("nid", $edit[nid]);
$form .= form_submit("Save page");
$form .= form_submit("Submit");
return form($REQUEST_URI, $form);
}
......@@ -75,7 +75,7 @@ function page_admin() {
case "listing":
print node_listing(page_query());
break;
case "Save page":
case "Submit":
print status(page_save($edit));
// fall through:
default:
......
......@@ -38,7 +38,7 @@ function page_form($edit = array()) {
$form .= form_textarea(t("Body"), "body", $edit[body], 50, 10);
$form .= form_select(t("Type"), "format", $edit[format], $format);
$form .= form_hidden("nid", $edit[nid]);
$form .= form_submit("Save page");
$form .= form_submit("Submit");
return form($REQUEST_URI, $form);
}
......@@ -75,7 +75,7 @@ function page_admin() {
case "listing":
print node_listing(page_query());
break;
case "Save page":
case "Submit":
print status(page_save($edit));
// fall through:
default:
......
......@@ -6,29 +6,29 @@
# submission's selection box whereas the corresponding values
# represent the mathematical calculation to be performed to
# update a comment's value.
$moderation_votes = array("neutral (+0)" => "+ 0",
$queue_votes = array("neutral (+0)" => "+ 0",
"post it (+1)" => "+ 1",
"dump it (-1)" => "- 1");
$module = array("menu" => "moderation_menu",
"page" => "moderation_page");
$module = array("menu" => "queue_menu",
"page" => "queue_page");
function moderation_menu() {
return array("<A HREF=\"module.php?mod=moderation\">". t("moderation queue") ."</A> (<FONT COLOR=\"red\">". moderation_count() ."</FONT>)");
function queue_menu() {
return array("<A HREF=\"module.php?mod=queue\">". t("moderation queue") ."</A> (<FONT COLOR=\"red\">". queue_count() ."</FONT>)");
}
function moderation_count() {
function queue_count() {
global $status;
$result = db_query("SELECT COUNT(nid) FROM node WHERE status = '$status[queued]'");
return ($result) ? db_result($result, 0) : 0;
}
function moderation_score($id) {
function queue_score($id) {
$result = db_query("SELECT score FROM node WHERE nid = '$id'");
return ($result) ? db_result($result, 0) : 0;
}
function moderation_vote($id, $vote) {
function queue_vote($id, $vote) {
global $status, $user;
if (!user_get($user, "history", "n$id")) {
......@@ -55,7 +55,7 @@ function moderation_vote($id, $vote) {
}
}
function moderation_overview() {
function queue_overview() {
global $status, $theme, $user;
$result = db_query("SELECT n.*, u.userid FROM node n LEFT JOIN users u ON n.author = u.id WHERE n.status = '$status[queued]'");
......@@ -63,8 +63,8 @@ function moderation_overview() {
$content .= "<TABLE BORDER=\"0\" CELLSPACING=\"4\" CELLPADDING=\"4\">\n";
$content .= " <TR><TH>". t("Subject") ."</TH><TH>". t("Author") ."</TH><TH>". t("Type") ."</TH><TH>". t("Score") ."</TH></TR>\n";
while ($node = db_fetch_object($result)) {
if ($user->id == $node->author || user_get($user, "history", "n$node->nid")) $content .= " <TR><TD><A HREF=\"module.php?mod=moderation&op=view&id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">". format_username($node->userid) ."</TD><TD ALIGN=\"center\">". check_output($node->type) ."</TD><TD ALIGN=\"center\">". moderation_score($node->nid) ."</TD></TR>\n";
else $content .= " <TR><TD><A HREF=\"module.php?mod=moderation&op=view&id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">". format_username($node->userid) ."</TD><TD ALIGN=\"center\">". check_output($node->type) ."</TD><TD ALIGN=\"center\"><A HREF=\"module.php?mod=moderation&op=view&id=$node->nid\">". t("vote") ."</A></TD></TR>\n";
if ($user->id == $node->author || user_get($user, "history", "n$node->nid")) $content .= " <TR><TD><A HREF=\"module.php?mod=queue&op=view&id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">". format_username($node->userid) ."</TD><TD ALIGN=\"center\">". check_output($node->type) ."</TD><TD ALIGN=\"center\">". queue_score($node->nid) ."</TD></TR>\n";
else $content .= " <TR><TD><A HREF=\"module.php?mod=queue&op=view&id=$node->nid\">". check_output($node->title) ."</A></TD><TD ALIGN=\"center\">". format_username($node->userid) ."</TD><TD ALIGN=\"center\">". check_output($node->type) ."</TD><TD ALIGN=\"center\"><A HREF=\"module.php?mod=queue&op=view&id=$node->nid\">". t("vote") ."</A></TD></TR>\n";
}
$content .= "</TABLE>\n";
......@@ -73,8 +73,8 @@ function moderation_overview() {
$theme->footer();
}
function moderation_node($id) {
global $theme, $user, $moderation_votes;
function queue_node($id) {
global $theme, $user, $queue_votes;
$node = node_get_object(nid, $id);
......@@ -91,8 +91,8 @@ function moderation_node($id) {
}
// moderation form:
$output .= "<FORM ACTION=\"module.php?mod=moderation\" METHOD=\"post\">\n";
foreach ($moderation_votes as $key=>$value) $options .= " <OPTION VALUE=\"$value\">$key</OPTION>\n";
$output .= "<FORM ACTION=\"module.php?mod=queue\" METHOD=\"post\">\n";
foreach ($queue_votes as $key=>$value) $options .= " <OPTION VALUE=\"$value\">$key</OPTION>\n";
$output .= "<SELECT NAME=\"vote\">$options</SELECT>\n";
$output .= "<INPUT TYPE=\"hidden\" NAME=\"id\" VALUE=\"$node->nid\">\n";
$output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Vote\">\n";
......@@ -105,19 +105,19 @@ function moderation_node($id) {
}
}
function moderation_page() {
function queue_page() {
global $id, $op, $user, $vote;
if ($user->id) {
switch($op) {
case "Vote";
moderation_vote(check_input($id), check_input($vote));
queue_vote(check_input($id), check_input($vote));
// fall through:
case "view":
moderation_node(check_input($id));
queue_node(check_input($id));
break;
default:
moderation_overview();
queue_overview();
break;
}
}
......
......@@ -62,10 +62,9 @@ function story_form($edit = array()) {
$form .= form_textarea(t("Abstract"), "abstract", $edit[abstract], 50, 10, t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html));
$form .= form_textarea(t("Body"), "body", $edit[body], 50, 15, t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html));
if (user_access($user, "story")) {
$form .= form_hidden("timestamp", $edit[timestamp]);
$form .= form_hidden("nid", $edit[nid]);
}
// hidden fields:
$form .= form_hidden("timestamp", $edit[timestamp]);
$form .= form_hidden("nid", $edit[nid]);
if (!$edit) {
$form .= form_submit(t("Preview"));
......
......@@ -62,10 +62,9 @@ function story_form($edit = array()) {
$form .= form_textarea(t("Abstract"), "abstract", $edit[abstract], 50, 10, t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html));
$form .= form_textarea(t("Body"), "body", $edit[body], 50, 15, t("Allowed HTML tags") .": ". htmlspecialchars($allowed_html));
if (user_access($user, "story")) {
$form .= form_hidden("timestamp", $edit[timestamp]);
$form .= form_hidden("nid", $edit[nid]);
}
// hidden fields:
$form .= form_hidden("timestamp", $edit[timestamp]);
$form .= form_hidden("nid", $edit[nid]);
if (!$edit) {
$form .= form_submit(t("Preview"));
......
......@@ -75,7 +75,7 @@ function do_nav() {
<option value="module.php?mod=book" <?php if (strstr($REQUEST_URI, "mod=book")) { echo "selected"; $true = 1; } ?>>Handbook</option>
<option value="submit.php" <?php if (strstr($PHP_SELF, "submit.php")) { echo "selected"; $true = 1; } ?>>Submit</option>
<option value="search.php" <?php if (strstr($PHP_SELF, "search.php")) { echo "selected"; $true = 1; } ?>>Search</option>
<?php if ($REQUEST_URI == "/module.php?mod=moderation") { $true = 1; echo "<option selected>Moderation</option>"; }
<?php if ($REQUEST_URI == "/module.php?mod=queue") { $true = 1; echo "<option selected>Moderation</option>"; }
if (!$true) { echo "<option selected>"; if($cid) echo "Node $cid"; else if($id) echo "Node $id"; else echo "Other"; echo"</option>"; } ?>
</select>
<noscript><input type="submit" value="Go"></noscript>
......
......@@ -130,3 +130,6 @@ CREATE TABLE forum (
body text NOT NULL,
PRIMARY KEY (lid)
);
# 01/05/2001:
ALTER TABLE node ADD moderate TEXT NOT NULL;
\ No newline at end of file
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