--- linktonode_default.inc	2006-10-25 23:40:51.077238400 +0200
+++ linktonode_default.inc.new	2006-10-25 23:32:53.059883200 +0200
@@ -14,7 +14,7 @@
   function get_nodes($container, $parent = -1) {
     $results = array();
     $types = variable_get('linktonode_node_types', array());
-		$nodes = $this->_select_nodes($parent);
+		$nodes = $this->_select_nodes(($container <= 0 ? -1 : $parent));
     $obj = null;
     while ($nd = db_fetch_object($nodes)) {
       $node = node_load($nd->nid);
@@ -63,7 +63,13 @@
     $descendant_tids[] = array_merge(array($tid), array_map('_taxonomy_get_tid_from_term', $tree));
 
     $str_tids = implode(',', call_user_func_array('array_merge', $descendant_tids));
-    $sql = 'SELECT DISTINCT(n.nid), n.sticky, n.title, n.created FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN ('. $str_tids .') AND n.status = 1 ORDER BY '. $order;
+    $join = 'INNER JOIN';
+    $where = 'tn.tid IN (' . $str_tids . ')';
+    if ($tid < 0) {
+      $join = 'LEFT JOIN';
+      $where = 'ISNULL(tn.tid)';
+    }
+    $sql = 'SELECT DISTINCT(n.nid), n.sticky, n.title, n.created, tn.tid FROM {node} n ' . $join . ' {term_node} tn ON n.nid = tn.nid WHERE ' . $where . ' AND n.status = 1 ORDER BY '. $order;
 
     $result = db_query(db_rewrite_sql($sql));
 
