diff options
-rw-r--r-- | includes/node.inc | 2 | ||||
-rw-r--r-- | modules/book.module | 2 | ||||
-rw-r--r-- | modules/book/book.module | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/includes/node.inc b/includes/node.inc index 5cde16949..d4ba181e0 100644 --- a/includes/node.inc +++ b/includes/node.inc @@ -35,7 +35,7 @@ function node_save($node) { $rows = array(nid, pid, lid, log, type, title, score, votes, author, status, timestamp); - if ($node[nid]) { + if ($node[nid] > 0) { $u1 = array(); $u2 = array(); diff --git a/modules/book.module b/modules/book.module index 40baa5246..8009ae27e 100644 --- a/modules/book.module +++ b/modules/book.module @@ -18,7 +18,7 @@ class Book { } function book_navigation($node) { - if ($node->nid) { + if ($node->nid && $node->parent && $node->weight) { $next = db_fetch_object(db_query("SELECT n.nid, n.title FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE b.parent = '$node->parent' AND b.weight > $node->weight ORDER BY b.weight ASC")); $prev = db_fetch_object(db_query("SELECT n.nid, n.title FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE b.parent = '$node->parent' AND b.weight < $node->weight ORDER BY b.weight DESC")); } diff --git a/modules/book/book.module b/modules/book/book.module index 40baa5246..8009ae27e 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -18,7 +18,7 @@ class Book { } function book_navigation($node) { - if ($node->nid) { + if ($node->nid && $node->parent && $node->weight) { $next = db_fetch_object(db_query("SELECT n.nid, n.title FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE b.parent = '$node->parent' AND b.weight > $node->weight ORDER BY b.weight ASC")); $prev = db_fetch_object(db_query("SELECT n.nid, n.title FROM node n LEFT JOIN book b ON n.nid = b.nid AND n.lid = b.lid WHERE b.parent = '$node->parent' AND b.weight < $node->weight ORDER BY b.weight DESC")); } |