2001-05-02 20:52:19 +00:00
<?php
2001-06-20 20:00:40 +00:00
function moderate_perm() {
return array("access moderation pages");
}
2001-06-29 22:08:57 +00:00
function moderate_link($type) {
if ($type == "admin") {
$links[] = "<a href=\"admin.php?mod=moderate\">moderate content</a>";
}
return $links ? $links : array();
}
2001-05-02 20:52:19 +00:00
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";
This a rather large commit that needs a lot of fine-tuning. If you
update, you'll break your site as you need switching from structure
to index.module: so this can be considered an intermediate commit.
If you upgrade, and you are welcome to, just create a collection
called "section" (for now) and assign your nodes some attributes
in the described format.
Feedback and bugreports are welcomed. Questions will be answered.
CHANGES:
- comment system:
+ when replying to a node (rather then to a comment), that
node is displayed above the reply form.
+ when replying to a comment (rather then to a node), that
comment is displayd above the reply form.
- removed structure.inc, removed structure.module.
- node.inc:
+ added 2 new node functions called 'node_attribute_edit()' and
'node_attribute_save()' used to 'hook in' any indexing system
including your home-brewed stuff if you'd want to. Currently,
index.module is the facto default index system.
See story.module for usage.
- book.module, story.module, poll.module, page.module, forum.module:
+ added preview functionality to administration section (via node
module).
+ removed all references to structure.inc (category, topic).
- moderate.module:
+ removed all references to structure.inc (category, topic).
- book.module, story.module, page.module, forum.module:
+ increased the sizes of some textareas.
- submit.php:
+ removed all references to structure.inc (category, topic).
- marvin.theme:
+ removed dead code: function story() was depricated.
- unconed.theme:
+ removed hardcoded references to drop.org.
- marvin.theme, unconed.theme, jeroen.theme, yaroon.theme, example.theme:
+ removed all references to structure.inc (category, topic).
TODO:
- file.module, trip_link.module:
+ update preview functionality:
see story.module for example.
+ remove references to 'cid' and 'tid', use 'attribute' instead:
see story.module for example.
- extend and build upon index.module as well as making it configurable
2001-06-10 15:01:20 +00:00
$output .= " <TR><TH>node</TH><TH>type</TH><TH>status</TH><TH>author</TH><TH>date</TH><TH>operations</TH></TR>\n";
2001-05-02 20:52:19 +00:00
$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)) {
This a rather large commit that needs a lot of fine-tuning. If you
update, you'll break your site as you need switching from structure
to index.module: so this can be considered an intermediate commit.
If you upgrade, and you are welcome to, just create a collection
called "section" (for now) and assign your nodes some attributes
in the described format.
Feedback and bugreports are welcomed. Questions will be answered.
CHANGES:
- comment system:
+ when replying to a node (rather then to a comment), that
node is displayed above the reply form.
+ when replying to a comment (rather then to a node), that
comment is displayd above the reply form.
- removed structure.inc, removed structure.module.
- node.inc:
+ added 2 new node functions called 'node_attribute_edit()' and
'node_attribute_save()' used to 'hook in' any indexing system
including your home-brewed stuff if you'd want to. Currently,
index.module is the facto default index system.
See story.module for usage.
- book.module, story.module, poll.module, page.module, forum.module:
+ added preview functionality to administration section (via node
module).
+ removed all references to structure.inc (category, topic).
- moderate.module:
+ removed all references to structure.inc (category, topic).
- book.module, story.module, page.module, forum.module:
+ increased the sizes of some textareas.
- submit.php:
+ removed all references to structure.inc (category, topic).
- marvin.theme:
+ removed dead code: function story() was depricated.
- unconed.theme:
+ removed hardcoded references to drop.org.
- marvin.theme, unconed.theme, jeroen.theme, yaroon.theme, example.theme:
+ removed all references to structure.inc (category, topic).
TODO:
- file.module, trip_link.module:
+ update preview functionality:
see story.module for example.
+ remove references to 'cid' and 'tid', use 'attribute' instead:
see story.module for example.
- extend and build upon index.module as well as making it configurable
2001-06-10 15:01:20 +00:00
$output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A></TD><TD>$node->type</TD><TD>". node_status($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";
2001-05-02 20:52:19 +00:00
$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\"> - <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;
}
2001-05-05 13:57:29 +00:00
function moderate_node($edit, $name) {
2001-05-02 20:52:19 +00:00
global $user;
2001-05-20 16:47:50 +00:00
$node = node_get_array(array("nid" => $edit[nid]));
2001-05-02 20:52:19 +00:00
if ($node && strstr($node[moderate], $user->userid)) {
2001-05-05 13:57:29 +00:00
$edit[type] = $node[type];
return node_invoke($edit, $name);
2001-05-02 20:52:19 +00:00
}
else {
2001-06-20 20:00:40 +00:00
return status(message_access());
2001-05-02 20:52:19 +00:00
}
}
2001-05-05 13:57:29 +00:00
function moderate_node_edit($edit) {
return moderate_node($edit, "form");
}
2001-05-02 20:52:19 +00:00
2001-05-05 13:57:29 +00:00
function moderate_node_save($edit) {
return moderate_node($edit, "save");
2001-05-02 20:52:19 +00:00
}
function moderate_comment_edit($id) {
if (moderate_comment_access($id)) {
return comment_edit($id);
}
else {
2001-06-20 20:00:40 +00:00
return status(message_access());
2001-05-02 20:52:19 +00:00
}
}
function moderate_comment_save($id, $edit) {
if (moderate_comment_access($id)) {
return comment_save($id, $edit);
}
else {
2001-06-20 20:00:40 +00:00
return status(message_access());
2001-05-02 20:52:19 +00:00
}
}
function moderate_admin() {
2001-06-29 22:08:57 +00:00
global $op, $id, $edit, $type;
2001-06-20 20:00:40 +00:00
2001-06-29 22:08:57 +00:00
if (user_access("access moderation pages")) {
2001-06-20 20:00:40 +00:00
switch ($type) {
case "comment":
switch ($op) {
case "edit":
print moderate_comment_edit($id);
break;
case t("Submit"):
print status(moderate_comment_save($id, $edit));
// fall through:
default:
print moderate_overview();
}
break;
default:
switch ($op) {
case "edit":
print moderate_node_edit(node_get_array(array("nid" => $id)));
break;
case t("Preview"):
print moderate_node_edit($edit);
break;
case t("Submit"):
print status(moderate_node_save($edit));
// fall through:
default:
print moderate_overview();
2001-05-02 20:52:19 +00:00
}
}
}
2001-06-20 20:00:40 +00:00
else {
print message_access();
}
2001-05-02 20:52:19 +00:00
}
?>