summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorSteven Wittens <steven@10.no-reply.drupal.org>2006-03-14 15:43:49 +0000
committerSteven Wittens <steven@10.no-reply.drupal.org>2006-03-14 15:43:49 +0000
commit729c464d001288ca646c1edcf2b013a50ad88202 (patch)
treea48b0dfdf9d837978a3f51857cffb82d83bab93c /modules
parente74aa7eeb62f0db82215e24b9a1a70bc43f01cd7 (diff)
downloadbrdo-729c464d001288ca646c1edcf2b013a50ad88202.tar.gz
brdo-729c464d001288ca646c1edcf2b013a50ad88202.tar.bz2
#50987: book next link breaks with php 5.1
Diffstat (limited to 'modules')
-rw-r--r--modules/book.module11
-rw-r--r--modules/book/book.module11
2 files changed, 12 insertions, 10 deletions
diff --git a/modules/book.module b/modules/book.module
index fca2c28a3..517a1b4ac 100644
--- a/modules/book.module
+++ b/modules/book.module
@@ -376,7 +376,7 @@ function book_location($node, $nodes = array()) {
$parent = db_fetch_object(db_query(db_rewrite_sql('SELECT n.nid, n.title, b.parent, b.weight FROM {node} n INNER JOIN {book} b ON n.vid = b.vid WHERE n.nid = %d'), $node->parent));
if ($parent->title) {
$nodes = book_location($parent, $nodes);
- array_push($nodes, $parent);
+ $nodes[] = $parent;
}
return $nodes;
}
@@ -387,7 +387,7 @@ function book_location($node, $nodes = array()) {
function book_location_down($node, $nodes = array()) {
$last_direct_child = db_fetch_object(db_query(db_rewrite_sql('SELECT n.nid, n.title, b.parent, b.weight FROM {node} n INNER JOIN {book} b ON n.nid = b.nid WHERE n.status = 1 AND b.parent = %d ORDER BY b.weight DESC, n.title DESC'), $node->nid));
if ($last_direct_child) {
- array_push($nodes, $last_direct_child);
+ $nodes[] = $last_direct_child;
$nodes = book_location_down($last_direct_child, $nodes);
}
return $nodes;
@@ -428,7 +428,8 @@ function book_next($node) {
}
// No direct child: get next for this level or any parent in this book.
- array_push($path = book_location($node), $node); // Path to top-level node including this one.
+ $path[] = book_location($node); // Path to top-level node including this one.
+ $path[] = $node;
while (($leaf = array_pop($path)) && count($path)) {
$next = db_fetch_object(db_query(db_rewrite_sql("SELECT n.nid, n.title, b.weight FROM {node} n INNER JOIN {book} b ON n.vid = b.vid WHERE b.parent = %d AND n.status = 1 AND n.moderate = 0 AND (b.weight > %d OR (b.weight = %d AND n.title > '%s')) ORDER BY b.weight ASC, n.title ASC"), $leaf->parent, $leaf->weight, $leaf->weight, $leaf->title));
@@ -569,7 +570,7 @@ function book_toc($exclude = 0) {
if (!$children[$node->parent]) {
$children[$node->parent] = array();
}
- array_push($children[$node->parent], $node);
+ $children[$node->parent][] = $node;
}
$toc = array();
@@ -625,7 +626,7 @@ function book_tree($parent = 0, $depth = 3, $unfold = array()) {
while ($node = db_fetch_object($result)) {
$list = $children[$node->parent] ? $children[$node->parent] : array();
- array_push($list, $node);
+ $list[] = $node;
$children[$node->parent] = $list;
}
diff --git a/modules/book/book.module b/modules/book/book.module
index fca2c28a3..517a1b4ac 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -376,7 +376,7 @@ function book_location($node, $nodes = array()) {
$parent = db_fetch_object(db_query(db_rewrite_sql('SELECT n.nid, n.title, b.parent, b.weight FROM {node} n INNER JOIN {book} b ON n.vid = b.vid WHERE n.nid = %d'), $node->parent));
if ($parent->title) {
$nodes = book_location($parent, $nodes);
- array_push($nodes, $parent);
+ $nodes[] = $parent;
}
return $nodes;
}
@@ -387,7 +387,7 @@ function book_location($node, $nodes = array()) {
function book_location_down($node, $nodes = array()) {
$last_direct_child = db_fetch_object(db_query(db_rewrite_sql('SELECT n.nid, n.title, b.parent, b.weight FROM {node} n INNER JOIN {book} b ON n.nid = b.nid WHERE n.status = 1 AND b.parent = %d ORDER BY b.weight DESC, n.title DESC'), $node->nid));
if ($last_direct_child) {
- array_push($nodes, $last_direct_child);
+ $nodes[] = $last_direct_child;
$nodes = book_location_down($last_direct_child, $nodes);
}
return $nodes;
@@ -428,7 +428,8 @@ function book_next($node) {
}
// No direct child: get next for this level or any parent in this book.
- array_push($path = book_location($node), $node); // Path to top-level node including this one.
+ $path[] = book_location($node); // Path to top-level node including this one.
+ $path[] = $node;
while (($leaf = array_pop($path)) && count($path)) {
$next = db_fetch_object(db_query(db_rewrite_sql("SELECT n.nid, n.title, b.weight FROM {node} n INNER JOIN {book} b ON n.vid = b.vid WHERE b.parent = %d AND n.status = 1 AND n.moderate = 0 AND (b.weight > %d OR (b.weight = %d AND n.title > '%s')) ORDER BY b.weight ASC, n.title ASC"), $leaf->parent, $leaf->weight, $leaf->weight, $leaf->title));
@@ -569,7 +570,7 @@ function book_toc($exclude = 0) {
if (!$children[$node->parent]) {
$children[$node->parent] = array();
}
- array_push($children[$node->parent], $node);
+ $children[$node->parent][] = $node;
}
$toc = array();
@@ -625,7 +626,7 @@ function book_tree($parent = 0, $depth = 3, $unfold = array()) {
while ($node = db_fetch_object($result)) {
$list = $children[$node->parent] ? $children[$node->parent] : array();
- array_push($list, $node);
+ $list[] = $node;
$children[$node->parent] = $list;
}