Skip to content
Snippets Groups Projects
Commit c50d7bcb authored by Neil Drumm's avatar Neil Drumm :wave:
Browse files

#71613 by keve, fixing some PHP notices in the book module.

parent d048681f
Branches
Tags
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -361,7 +361,7 @@ function book_outline_submit($form_id, $form_values) { ...@@ -361,7 +361,7 @@ function book_outline_submit($form_id, $form_values) {
*/ */
function book_location($node, $nodes = array()) { 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)); $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) { if (isset($parent->title)) {
$nodes = book_location($parent, $nodes); $nodes = book_location($parent, $nodes);
$nodes[] = $parent; $nodes[] = $parent;
} }
...@@ -499,6 +499,7 @@ function book_nodeapi(&$node, $op, $teaser, $page) { ...@@ -499,6 +499,7 @@ function book_nodeapi(&$node, $op, $teaser, $page) {
*/ */
function theme_book_navigation($node) { function theme_book_navigation($node) {
$output = ''; $output = '';
$links = '';
if ($node->nid) { if ($node->nid) {
$tree = book_tree($node->nid); $tree = book_tree($node->nid);
...@@ -575,8 +576,9 @@ function book_toc($exclude = 0) { ...@@ -575,8 +576,9 @@ function book_toc($exclude = 0) {
* This is a helper function for book_tree() * This is a helper function for book_tree()
*/ */
function book_tree_recurse($nid, $depth, $children, $unfold = array()) { function book_tree_recurse($nid, $depth, $children, $unfold = array()) {
$output = '';
if ($depth > 0) { if ($depth > 0) {
if ($children[$nid]) { if (isset($children[$nid])) {
foreach ($children[$nid] as $foo => $node) { foreach ($children[$nid] as $foo => $node) {
if (in_array($node->nid, $unfold)) { if (in_array($node->nid, $unfold)) {
if ($tree = book_tree_recurse($node->nid, $depth - 1, $children, $unfold)) { if ($tree = book_tree_recurse($node->nid, $depth - 1, $children, $unfold)) {
...@@ -612,7 +614,7 @@ function book_tree($parent = 0, $depth = 3, $unfold = array()) { ...@@ -612,7 +614,7 @@ function book_tree($parent = 0, $depth = 3, $unfold = array()) {
$result = 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.status = 1 AND n.moderate = 0 ORDER BY b.weight, n.title')); $result = 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.status = 1 AND n.moderate = 0 ORDER BY b.weight, n.title'));
while ($node = db_fetch_object($result)) { while ($node = db_fetch_object($result)) {
$list = $children[$node->parent] ? $children[$node->parent] : array(); $list = isset($children[$node->parent]) ? $children[$node->parent] : array();
$list[] = $node; $list[] = $node;
$children[$node->parent] = $list; $children[$node->parent] = $list;
} }
......
...@@ -361,7 +361,7 @@ function book_outline_submit($form_id, $form_values) { ...@@ -361,7 +361,7 @@ function book_outline_submit($form_id, $form_values) {
*/ */
function book_location($node, $nodes = array()) { 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)); $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) { if (isset($parent->title)) {
$nodes = book_location($parent, $nodes); $nodes = book_location($parent, $nodes);
$nodes[] = $parent; $nodes[] = $parent;
} }
...@@ -499,6 +499,7 @@ function book_nodeapi(&$node, $op, $teaser, $page) { ...@@ -499,6 +499,7 @@ function book_nodeapi(&$node, $op, $teaser, $page) {
*/ */
function theme_book_navigation($node) { function theme_book_navigation($node) {
$output = ''; $output = '';
$links = '';
if ($node->nid) { if ($node->nid) {
$tree = book_tree($node->nid); $tree = book_tree($node->nid);
...@@ -575,8 +576,9 @@ function book_toc($exclude = 0) { ...@@ -575,8 +576,9 @@ function book_toc($exclude = 0) {
* This is a helper function for book_tree() * This is a helper function for book_tree()
*/ */
function book_tree_recurse($nid, $depth, $children, $unfold = array()) { function book_tree_recurse($nid, $depth, $children, $unfold = array()) {
$output = '';
if ($depth > 0) { if ($depth > 0) {
if ($children[$nid]) { if (isset($children[$nid])) {
foreach ($children[$nid] as $foo => $node) { foreach ($children[$nid] as $foo => $node) {
if (in_array($node->nid, $unfold)) { if (in_array($node->nid, $unfold)) {
if ($tree = book_tree_recurse($node->nid, $depth - 1, $children, $unfold)) { if ($tree = book_tree_recurse($node->nid, $depth - 1, $children, $unfold)) {
...@@ -612,7 +614,7 @@ function book_tree($parent = 0, $depth = 3, $unfold = array()) { ...@@ -612,7 +614,7 @@ function book_tree($parent = 0, $depth = 3, $unfold = array()) {
$result = 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.status = 1 AND n.moderate = 0 ORDER BY b.weight, n.title')); $result = 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.status = 1 AND n.moderate = 0 ORDER BY b.weight, n.title'));
while ($node = db_fetch_object($result)) { while ($node = db_fetch_object($result)) {
$list = $children[$node->parent] ? $children[$node->parent] : array(); $list = isset($children[$node->parent]) ? $children[$node->parent] : array();
$list[] = $node; $list[] = $node;
$children[$node->parent] = $list; $children[$node->parent] = $list;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment