Commit bfe2229b authored by Gábor Hojtsy's avatar Gábor Hojtsy

#172977 by pwolanin: fix E_ALL NOTICEs with some taxonomy module queries

parent a6a6e5ad
......@@ -334,7 +334,7 @@ function node_teaser($body, $format = NULL, $size = NULL) {
*
* @return
* Either an array of all available node types, or a single node type, in a
* variable format.
* variable format. Returns FALSE if the node type is not found.
*/
function node_get_types($op = 'types', $node = NULL, $reset = FALSE) {
static $_node_types, $_node_names;
......@@ -361,13 +361,13 @@ function node_get_types($op = 'types', $node = NULL, $reset = FALSE) {
case 'types':
return $_node_types;
case 'type':
return $_node_types[$type];
return isset($_node_types[$type]) ? $_node_types[$type] : FALSE;
case 'module':
return $_node_types[$type]->module;
return isset($_node_types[$type]->module) ? $_node_types[$type]->module : FALSE;
case 'names':
return $_node_names;
case 'name':
return $_node_names[$type];
return isset($_node_names[$type]) ? $_node_names[$type] : FALSE;
}
}
......
......@@ -387,9 +387,16 @@ function taxonomy_get_vocabularies($type = NULL) {
$vocabularies = array();
$node_types = array();
while ($voc = db_fetch_object($result)) {
$node_types[$voc->vid][] = $voc->type;
unset($voc->type);
$voc->nodes = $node_types[$voc->vid];
// If no node types are associated with a vocabulary, the LEFT JOIN will
// return a NULL value for type.
if (isset($voc->type)) {
$node_types[$voc->vid][] = $voc->type;
unset($voc->type);
$voc->nodes = $node_types[$voc->vid];
}
elseif (!isset($voc->nodes)) {
$voc->nodes = array();
}
$vocabularies[$voc->vid] = $voc;
}
......@@ -777,7 +784,7 @@ function taxonomy_term_count_nodes($tid, $type = 0) {
$count[$type][$term->tid] = $term->c;
}
}
$children_count = 0;
foreach (_taxonomy_term_children($tid) as $c) {
$children_count += taxonomy_term_count_nodes($c, $type);
}
......@@ -805,7 +812,7 @@ function _taxonomy_term_children($tid) {
$children[$term->parent][] = $term->tid;
}
}
return $children[$tid] ? $children[$tid] : array();
return isset($children[$tid]) ? $children[$tid] : array();
}
/**
......
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