drupal/modules/comment.module

76 lines
3.0 KiB
Plaintext
Raw Normal View History

<?php
2000-12-14 14:13:37 +00:00
function comment_search($keys) {
global $user;
$result = db_query("SELECT c.*, u.userid FROM comments c LEFT JOIN users u ON c.author = u.id WHERE c.subject LIKE '%$keys%' OR c.comment LIKE '%$keys%' ORDER BY c.timestamp DESC LIMIT 20");
while ($comment = db_fetch_object($result)) {
$find[$i++] = array("title" => check_output($comment->subject), "link" => (user_access($user, "edit user comments") ? "admin.php?mod=comment&op=edit&id=$comment->cid" : "node.php?id=$comment->lid&cid=$comment->cid"), "user" => $comment->userid, "date" => $comment->timestamp);
}
return $find;
}
2000-12-14 14:13:37 +00:00
function comment_perm() {
return array("view comments", "post comments", "edit comments");
}
2000-12-14 14:13:37 +00:00
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'");
2000-12-14 14:13:37 +00:00
$comment = db_fetch_object($result);
Welp. Large commit ahead. CHANGES: - Added "read" and "write" permissions into drupal but removed it again because - when finished after 3 hours of work - it was considered nothing but added complexity that didn't buy us anything. :I (I'll explain this in detail on the mailing list, I guess.) - Added a very simple help.module to group all available documentation on a single page. - Fixed bug in node_control(), book.module: UnConeD forgot to global $user when updating the combobox code. - Removed static wishlist.module: in future, the wishlist can be maintained as a page in our collaborative book. - Revised most of settings.module: tidied up the code and the descriptions to accompany the settings and introduced a new "default maximum number of nodes to display on the main page" variable. - Revised most of comment.module: the administration interface looks better now, integrated node permissions, and -finally- made it possible to delete comments. - Polished on: + account.module + structure.module + locale.module + module.module + forum.module - Form-ified: + account.php + account.module + setting.module + cvs.module + submit.php + comment.module + forum.module + book.module + page.module + locale.module - Updated CHANGELOG INFO: - Designed a "generic tracker system with optional backends" on paper. The idea is to allow registered users to hot-list certain topics, individual nodes or threads (comments) and to "plug-in" output backends like - for instance - an e-mail digest. The design requires "intelligent blocks" though. TODO: - I want to tidy up the headline.module and backend.class as well as merge in headlineRSS10.module. Julian spent quite some time working on headline.module but I'm not sure what he changed and whether he'd contribute it back?
2001-04-30 17:13:08 +00:00
$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(t("Submit"));
2000-12-14 14:13:37 +00:00
return form($REQUEST_URI, $form);
2000-12-14 14:13:37 +00:00
}
Welp. Large commit ahead. CHANGES: - Added "read" and "write" permissions into drupal but removed it again because - when finished after 3 hours of work - it was considered nothing but added complexity that didn't buy us anything. :I (I'll explain this in detail on the mailing list, I guess.) - Added a very simple help.module to group all available documentation on a single page. - Fixed bug in node_control(), book.module: UnConeD forgot to global $user when updating the combobox code. - Removed static wishlist.module: in future, the wishlist can be maintained as a page in our collaborative book. - Revised most of settings.module: tidied up the code and the descriptions to accompany the settings and introduced a new "default maximum number of nodes to display on the main page" variable. - Revised most of comment.module: the administration interface looks better now, integrated node permissions, and -finally- made it possible to delete comments. - Polished on: + account.module + structure.module + locale.module + module.module + forum.module - Form-ified: + account.php + account.module + setting.module + cvs.module + submit.php + comment.module + forum.module + book.module + page.module + locale.module - Updated CHANGELOG INFO: - Designed a "generic tracker system with optional backends" on paper. The idea is to allow registered users to hot-list certain topics, individual nodes or threads (comments) and to "plug-in" output backends like - for instance - an e-mail digest. The design requires "intelligent blocks" though. TODO: - I want to tidy up the headline.module and backend.class as well as merge in headlineRSS10.module. Julian spent quite some time working on headline.module but I'm not sure what he changed and whether he'd contribute it back?
2001-04-30 17:13:08 +00:00
function comment_save($id, $edit) {
db_query("UPDATE comments SET subject = '". check_input($edit[subject]) ."', comment = '". check_input($edit[comment]) ."' WHERE cid = '$id'");
watchdog("message", "comment: modified '$edit[subject]'");
2000-12-14 14:13:37 +00:00
}
function comment_overview() {
Welp. Large commit ahead. CHANGES: - Added "read" and "write" permissions into drupal but removed it again because - when finished after 3 hours of work - it was considered nothing but added complexity that didn't buy us anything. :I (I'll explain this in detail on the mailing list, I guess.) - Added a very simple help.module to group all available documentation on a single page. - Fixed bug in node_control(), book.module: UnConeD forgot to global $user when updating the combobox code. - Removed static wishlist.module: in future, the wishlist can be maintained as a page in our collaborative book. - Revised most of settings.module: tidied up the code and the descriptions to accompany the settings and introduced a new "default maximum number of nodes to display on the main page" variable. - Revised most of comment.module: the administration interface looks better now, integrated node permissions, and -finally- made it possible to delete comments. - Polished on: + account.module + structure.module + locale.module + module.module + forum.module - Form-ified: + account.php + account.module + setting.module + cvs.module + submit.php + comment.module + forum.module + book.module + page.module + locale.module - Updated CHANGELOG INFO: - Designed a "generic tracker system with optional backends" on paper. The idea is to allow registered users to hot-list certain topics, individual nodes or threads (comments) and to "plug-in" output backends like - for instance - an e-mail digest. The design requires "intelligent blocks" though. TODO: - I want to tidy up the headline.module and backend.class as well as merge in headlineRSS10.module. Julian spent quite some time working on headline.module but I'm not sure what he changed and whether he'd contribute it back?
2001-04-30 17:13:08 +00:00
$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");
2001-01-26 13:38:46 +00:00
$output .= "<TABLE BORDER=\"1\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n";
Welp. Large commit ahead. CHANGES: - Added "read" and "write" permissions into drupal but removed it again because - when finished after 3 hours of work - it was considered nothing but added complexity that didn't buy us anything. :I (I'll explain this in detail on the mailing list, I guess.) - Added a very simple help.module to group all available documentation on a single page. - Fixed bug in node_control(), book.module: UnConeD forgot to global $user when updating the combobox code. - Removed static wishlist.module: in future, the wishlist can be maintained as a page in our collaborative book. - Revised most of settings.module: tidied up the code and the descriptions to accompany the settings and introduced a new "default maximum number of nodes to display on the main page" variable. - Revised most of comment.module: the administration interface looks better now, integrated node permissions, and -finally- made it possible to delete comments. - Polished on: + account.module + structure.module + locale.module + module.module + forum.module - Form-ified: + account.php + account.module + setting.module + cvs.module + submit.php + comment.module + forum.module + book.module + page.module + locale.module - Updated CHANGELOG INFO: - Designed a "generic tracker system with optional backends" on paper. The idea is to allow registered users to hot-list certain topics, individual nodes or threads (comments) and to "plug-in" output backends like - for instance - an e-mail digest. The design requires "intelligent blocks" though. TODO: - I want to tidy up the headline.module and backend.class as well as merge in headlineRSS10.module. Julian spent quite some time working on headline.module but I'm not sure what he changed and whether he'd contribute it back?
2001-04-30 17:13:08 +00:00
$output .= " <TR><TH>subject</TH><TH>author</TH><TH>date</TH><TH COLSPAN=\"2\">operations</TH></TR>\n";
2000-12-14 14:13:37 +00:00
while ($comment = db_fetch_object($result)) {
Welp. Large commit ahead. CHANGES: - Added "read" and "write" permissions into drupal but removed it again because - when finished after 3 hours of work - it was considered nothing but added complexity that didn't buy us anything. :I (I'll explain this in detail on the mailing list, I guess.) - Added a very simple help.module to group all available documentation on a single page. - Fixed bug in node_control(), book.module: UnConeD forgot to global $user when updating the combobox code. - Removed static wishlist.module: in future, the wishlist can be maintained as a page in our collaborative book. - Revised most of settings.module: tidied up the code and the descriptions to accompany the settings and introduced a new "default maximum number of nodes to display on the main page" variable. - Revised most of comment.module: the administration interface looks better now, integrated node permissions, and -finally- made it possible to delete comments. - Polished on: + account.module + structure.module + locale.module + module.module + forum.module - Form-ified: + account.php + account.module + setting.module + cvs.module + submit.php + comment.module + forum.module + book.module + page.module + locale.module - Updated CHANGELOG INFO: - Designed a "generic tracker system with optional backends" on paper. The idea is to allow registered users to hot-list certain topics, individual nodes or threads (comments) and to "plug-in" output backends like - for instance - an e-mail digest. The design requires "intelligent blocks" though. TODO: - I want to tidy up the headline.module and backend.class as well as merge in headlineRSS10.module. Julian spent quite some time working on headline.module but I'm not sure what he changed and whether he'd contribute it back?
2001-04-30 17:13:08 +00:00
$output .= " <TR><TD><A HREF=\"node.php?id=$comment->lid&cid=$comment->cid&pid=$comment->pid#$comment->cid\">". check_output($comment->subject) ."</A></TD><TD>". format_username($comment->userid) ."</TD><TD>". format_date($comment->timestamp, "small") ."</TD><TD><A HREF=\"admin.php?mod=comment&op=edit&id=$comment->cid\">edit comment</A></TD><TD><A HREF=\"admin.php?mod=comment&op=delete&id=$comment->cid\">delete comment</A></TD></TR>\n";
2000-12-14 14:13:37 +00:00
}
$output .= "</TABLE>\n";
2001-01-26 13:38:46 +00:00
Welp. Large commit ahead. CHANGES: - Added "read" and "write" permissions into drupal but removed it again because - when finished after 3 hours of work - it was considered nothing but added complexity that didn't buy us anything. :I (I'll explain this in detail on the mailing list, I guess.) - Added a very simple help.module to group all available documentation on a single page. - Fixed bug in node_control(), book.module: UnConeD forgot to global $user when updating the combobox code. - Removed static wishlist.module: in future, the wishlist can be maintained as a page in our collaborative book. - Revised most of settings.module: tidied up the code and the descriptions to accompany the settings and introduced a new "default maximum number of nodes to display on the main page" variable. - Revised most of comment.module: the administration interface looks better now, integrated node permissions, and -finally- made it possible to delete comments. - Polished on: + account.module + structure.module + locale.module + module.module + forum.module - Form-ified: + account.php + account.module + setting.module + cvs.module + submit.php + comment.module + forum.module + book.module + page.module + locale.module - Updated CHANGELOG INFO: - Designed a "generic tracker system with optional backends" on paper. The idea is to allow registered users to hot-list certain topics, individual nodes or threads (comments) and to "plug-in" output backends like - for instance - an e-mail digest. The design requires "intelligent blocks" though. TODO: - I want to tidy up the headline.module and backend.class as well as merge in headlineRSS10.module. Julian spent quite some time working on headline.module but I'm not sure what he changed and whether he'd contribute it back?
2001-04-30 17:13:08 +00:00
return $output;
2000-12-14 14:13:37 +00:00
}
function comment_admin() {
global $user, $op, $id, $edit, $mod, $keys, $order;
2000-12-14 14:13:37 +00:00
if (user_access($user, "edit comments")) {
print "<SMALL><A HREF=\"admin.php?mod=comment\">overview</A> | <A HREF=\"admin.php?mod=comment&op=search\">search comment</A></SMALL><HR>\n";
switch ($op) {
case "edit":
print comment_edit($id);
break;
case "search":
print search_form($keys);
print search_data($keys, $mod);
break;
case t("Submit"):
print status(comment_save(check_input($id), $edit));
print comment_overview();
break;
default:
print comment_overview();
}
}
else {
print message_access();
2000-12-14 14:13:37 +00:00
}
}
?>