Commit 6ca6e831 authored by Dries's avatar Dries

- fixed bug in section.module: id -> nid
- fixed bug in book.module: not 100% yet
parent 74fe7990
......@@ -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");
......
......@@ -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) {
......
......@@ -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) {
......
......@@ -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";
}
......
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