Commit 168db4c9 authored by Dries's avatar Dries

- Fixed problem with book.module (reported by Jared).

- Fixed problem with forum.module (reported by Jared).
parent ca6af5ad
......@@ -97,7 +97,7 @@ function book_toc($parent = "", $indent = "", $toc = array()) {
// add root node:
if (user_access($user, "add and edit nodes")) {
$toc[0] = " ";
$toc[0] = "<root>";
}
// build table of contents:
......@@ -120,12 +120,7 @@ function book_form($edit = array()) {
$form .= form_hidden(userid, $edit[userid]);
$form .= form_textfield(t("Subject"), "title", $edit[title], 50, 64);
if ($edit[pid] > 0) {
$form .= form_hidden("pid", $edit[pid]);
}
else {
$form .= form_select(t("Parent"), "parent", $edit[parent], book_toc(), t("The parent subject or category the page belongs in."));
}
$form .= form_select(t("Parent"), "parent", $edit[parent], book_toc(), t("The parent subject or category the page belongs in."));
$form .= form_textarea(t("Content"), "body", $edit[body], 70, 20, t("Allowed HTML tags") .": ". htmlspecialchars(variable_get("allowed_html", "")));
$form .= form_textarea(t("Log message"), "log", $edit[log], 70, 5, t("An explanation of the additions or updates being made to help the group understand your motivations."));
......@@ -138,6 +133,10 @@ function book_form($edit = array()) {
$form .= form_hidden("nid", $edit[nid]);
}
if ($edit[pid] > 0) {
$form .= form_hidden("pid", $edit[pid]);
}
if ($edit && !$edit[title]) {
$form .= "<FONT COLOR=\"red\">". t("Warning: you did not supply a title.") ."</FONT><P>\n";
$form .= form_submit(t("Preview"));
......@@ -169,13 +168,13 @@ function book_delete($node) {
function book_insert($node) {
if ($node->pid && $node->status == node_status("posted")) {
db_query("UPDATE node SET status = '". node_status("expired") ."' WHERE nid = '$node->pid'");
db_query("UPDATE node SET status = '". node_status("expired") ."' WHERE nid = '$node->pid'", 1);
}
}
function book_update($node) {
if ($node->pid && $node->status == node_status("posted")) {
db_query("UPDATE node SET status = '". node_status("expired") ."' WHERE nid = '$node->pid'");
db_query("UPDATE node SET status = '". node_status("expired") ."' WHERE nid = '$node->pid'", 1);
}
}
......
......@@ -97,7 +97,7 @@ function book_toc($parent = "", $indent = "", $toc = array()) {
// add root node:
if (user_access($user, "add and edit nodes")) {
$toc[0] = "&nbsp;";
$toc[0] = "<root>";
}
// build table of contents:
......@@ -120,12 +120,7 @@ function book_form($edit = array()) {
$form .= form_hidden(userid, $edit[userid]);
$form .= form_textfield(t("Subject"), "title", $edit[title], 50, 64);
if ($edit[pid] > 0) {
$form .= form_hidden("pid", $edit[pid]);
}
else {
$form .= form_select(t("Parent"), "parent", $edit[parent], book_toc(), t("The parent subject or category the page belongs in."));
}
$form .= form_select(t("Parent"), "parent", $edit[parent], book_toc(), t("The parent subject or category the page belongs in."));
$form .= form_textarea(t("Content"), "body", $edit[body], 70, 20, t("Allowed HTML tags") .": ". htmlspecialchars(variable_get("allowed_html", "")));
$form .= form_textarea(t("Log message"), "log", $edit[log], 70, 5, t("An explanation of the additions or updates being made to help the group understand your motivations."));
......@@ -138,6 +133,10 @@ function book_form($edit = array()) {
$form .= form_hidden("nid", $edit[nid]);
}
if ($edit[pid] > 0) {
$form .= form_hidden("pid", $edit[pid]);
}
if ($edit && !$edit[title]) {
$form .= "<FONT COLOR=\"red\">". t("Warning: you did not supply a title.") ."</FONT><P>\n";
$form .= form_submit(t("Preview"));
......@@ -169,13 +168,13 @@ function book_delete($node) {
function book_insert($node) {
if ($node->pid && $node->status == node_status("posted")) {
db_query("UPDATE node SET status = '". node_status("expired") ."' WHERE nid = '$node->pid'");
db_query("UPDATE node SET status = '". node_status("expired") ."' WHERE nid = '$node->pid'", 1);
}
}
function book_update($node) {
if ($node->pid && $node->status == node_status("posted")) {
db_query("UPDATE node SET status = '". node_status("expired") ."' WHERE nid = '$node->pid'");
db_query("UPDATE node SET status = '". node_status("expired") ."' WHERE nid = '$node->pid'", 1);
}
}
......
......@@ -24,7 +24,7 @@ function forum_form($edit = array()) {
function forum_save($edit) {
global $user, $status;
node_save($edit, array(author => $user->id, body, comment => variable_get("forum_comment", 0), moderate => variable_get("forum_moderate", ""), promote => variable_get("forum_promote", 0), score => 0, status => $status[posted], timestamp => time(), title, type => "forum", votes => 0));
node_save($edit, array(author => $user->id, body, comment => 1, moderate => variable_get("forum_moderate", ""), promote => variable_get("forum_promote", 0), score => 0, status => $status[posted], timestamp => time(), title, type => "forum", votes => 0));
}
function forum_num_comments($nid) {
......
......@@ -24,7 +24,7 @@ function forum_form($edit = array()) {
function forum_save($edit) {
global $user, $status;
node_save($edit, array(author => $user->id, body, comment => variable_get("forum_comment", 0), moderate => variable_get("forum_moderate", ""), promote => variable_get("forum_promote", 0), score => 0, status => $status[posted], timestamp => time(), title, type => "forum", votes => 0));
node_save($edit, array(author => $user->id, body, comment => 1, moderate => variable_get("forum_moderate", ""), promote => variable_get("forum_promote", 0), score => 0, status => $status[posted], timestamp => time(), title, type => "forum", votes => 0));
}
function forum_num_comments($nid) {
......
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