diff options
-rw-r--r-- | includes/node.inc | 3 | ||||
-rw-r--r-- | modules/book.module | 4 | ||||
-rw-r--r-- | modules/book/book.module | 4 | ||||
-rw-r--r-- | modules/section.module | 2 |
4 files changed, 9 insertions, 4 deletions
diff --git a/includes/node.inc b/includes/node.inc index 5bfefe00c..4c9ad18a1 100644 --- a/includes/node.inc +++ b/includes/node.inc @@ -59,7 +59,7 @@ function node_save($node) { else { $duplicate = node_get_object("title", $node[title]); - if ($duplicate && (time() - $duplicate->timestamp < 300)) { + if ($duplicate && (time() - $duplicate->timestamp < 60)) { watchdog("warning", "node: duplicate '$node[title]'"); } else { @@ -96,6 +96,7 @@ function node_save($node) { $result = db_query("UPDATE node SET lid = '$lid' WHERE nid = '$nid'"); if ($result) { watchdog("message", "node: added '$node[title]'"); + return db_insert_id(); } else { watchdog("warning", "node: added '$node[title]' - failed"); diff --git a/modules/book.module b/modules/book.module index 59c1b35d4..6c42604a2 100644 --- a/modules/book.module +++ b/modules/book.module @@ -95,9 +95,11 @@ function book_form($edit = array()) { $output .= format_username(($edit[userid] ? $edit[userid] : $user->userid)) ."<P>\n"; if ($edit[pid]) { + print "parent: $edit[parent]<BR>"; $node = node_get_object("nid", $edit[pid]); $output .= "<B>". t("Parent") .":</B><BR>\n"; $output .= "<A HREF=\"node.php?id=$node->id\">". check_output($node->title) ."</A><P>\n"; + $output .= "<INPUT TYPE=\"hidden\" NAME=\"edit[parent]\" VALUE=\"$edit[parent]\">\n"; $output .= "<SMALL><I>". t("The parent subject or category the new page belongs in.") ."</I></SMALL><P>\n"; } else { @@ -155,7 +157,7 @@ function book_form($edit = array()) { } function book_save($edit) { - node_save(array_diff(array_merge($edit, array(nid => $edit[nid], type => "book")), array(userid => $edit[userid]))); + $id = node_save(array_diff(array_merge($edit, array(nid => $edit[nid], type => "book")), array(userid => $edit[userid]))); } function book_delete($id) { diff --git a/modules/book/book.module b/modules/book/book.module index 59c1b35d4..6c42604a2 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -95,9 +95,11 @@ function book_form($edit = array()) { $output .= format_username(($edit[userid] ? $edit[userid] : $user->userid)) ."<P>\n"; if ($edit[pid]) { + print "parent: $edit[parent]<BR>"; $node = node_get_object("nid", $edit[pid]); $output .= "<B>". t("Parent") .":</B><BR>\n"; $output .= "<A HREF=\"node.php?id=$node->id\">". check_output($node->title) ."</A><P>\n"; + $output .= "<INPUT TYPE=\"hidden\" NAME=\"edit[parent]\" VALUE=\"$edit[parent]\">\n"; $output .= "<SMALL><I>". t("The parent subject or category the new page belongs in.") ."</I></SMALL><P>\n"; } else { @@ -155,7 +157,7 @@ function book_form($edit = array()) { } function book_save($edit) { - node_save(array_diff(array_merge($edit, array(nid => $edit[nid], type => "book")), array(userid => $edit[userid]))); + $id = node_save(array_diff(array_merge($edit, array(nid => $edit[nid], type => "book")), array(userid => $edit[userid]))); } function book_delete($id) { diff --git a/modules/section.module b/modules/section.module index 07054903e..9b42e46d1 100644 --- a/modules/section.module +++ b/modules/section.module @@ -18,7 +18,7 @@ function section_help() { } function section_block() { - $result = db_query("SELECT se.name, COUNT(st.id) AS stories FROM sections se LEFT JOIN story st ON se.name = st.section GROUP BY se.name"); + $result = db_query("SELECT se.name, COUNT(st.nid) AS stories FROM sections se LEFT JOIN story st ON se.name = st.section GROUP BY se.name"); while ($_section = db_fetch_object($result)) { $content .= "<LI><A HREF=\"?section=". urlencode($_section->name) ."\">$_section->name</A> (". check_output($_section->stories, 0) .")</LI>\n"; } |