summaryrefslogtreecommitdiff
path: root/modules/forum/forum.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/forum/forum.module')
-rw-r--r--modules/forum/forum.module37
1 files changed, 20 insertions, 17 deletions
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index e8866de2b..5364b7e34 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -1,10 +1,6 @@
<?php
// $Id$
-function forum_status() {
- return array(dumped, posted);
-}
-
function forum_link($type) {
if ($type == "page" && user_access("access content")) {
$links[] = "<a href=\"module.php?mod=forum\">". t("forum") ."</a>";
@@ -19,20 +15,27 @@ function forum_view($node) {
$theme->box(t("Discussion forum"), $output);
}
-function forum_form($edit = array()) {
+function forum_form($node) {
- $form .= form_textfield("Subject", "title", $edit[title], 50, 64);
- $form .= form_textarea("Body", "body", $edit[body], 70, 10);
- $form .= form_hidden("nid", $edit[nid]);
- $form .= form_submit(t("Submit"));
+ $output .= form_textarea("Body", "body", $node->body, 60, 10);
- return form($form);
+ return $output;
}
-function forum_save($edit) {
- global $user, $status;
+function forum_save() {
+
+ if (user_access("administer nodes")) {
+ if ($node->nid) {
+ return array();
+ }
+ else {
+ return array("promote" => 0, "moderate" => 0, "status" => 1);
+ }
+ }
+ else {
+ return 0;
+ }
- node_save($edit, array(uid => $user->uid, body, comment => 1, moderate => 0, promote => 0, score => 0, status => $status[posted], timestamp => time(), title, type => "forum", votes => 0));
}
function forum_num_comments($nid) {
@@ -52,10 +55,10 @@ function forum_page() {
$result = db_query("SELECT nid FROM node WHERE type = 'forum' ORDER BY title");
$output .= "<TABLE BORDER=\"0\" CELLSPACING=\"4\" CELLPADDING=\"4\">\n";
- $output .= " <TR><TH>". t("Forum") ."</TH><TH>". t("Comments") ."</TH><TH>". t("Last comment") ."</TH><TH>". t("Moderators") ."</TH></TR>";
+ $output .= " <TR><TH>". t("Forum") ."</TH><TH>". t("Comments") ."</TH><TH>". t("Last comment") ."</TH></TR>";
while ($node = db_fetch_object($result)) {
- $node = node_get_object(array("nid" => $node->nid));
- $output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A><BR><SMALL>". check_output($node->body, 1) ."</SMALL></TD><TD ALIGN=\"center\">". forum_num_comments($node->nid) ."</TD><TD ALIGN=\"center\">". forum_last_comment($node->nid) ."</TD><TD ALIGN=\"center\"><SMALL>". check_output($node->moderate) ."</SMALL></TD></TR>";
+ $node = node_load(array("nid" => $node->nid));
+ $output .= " <TR><TD><A HREF=\"node.php?id=$node->nid\">". check_output($node->title) ."</A><BR><SMALL>". check_output($node->body, 1) ."</SMALL></TD><TD ALIGN=\"center\">". forum_num_comments($node->nid) ."</TD><TD ALIGN=\"center\">". forum_last_comment($node->nid) ."</TD></TR>";
}
$output .= "</TABLE>\n";
@@ -69,5 +72,5 @@ function forum_page() {
$theme->footer();
}
}
-
+
?> \ No newline at end of file