Index: wikitools.pages.inc =================================================================== --- wikitools.pages.inc (revision 1014) +++ wikitools.pages.inc (working copy) @@ -55,7 +55,8 @@ $node_types = wikitools_node_types(); if (count($node_types) && $page_name) { // Try to find the current page with this name. - $result = db_query("SELECT nid, type FROM {node} WHERE LOWER(title) = LOWER('%s')", $page_name); + $node_limit = " type IN ('" . implode("','", $node_types) . "')"; + $result = db_query("SELECT nid, type FROM {node} WHERE $node_limit AND LOWER(title) = LOWER('%s')", $page_name); $found_nodes = array(); while ($node = db_fetch_object($result)) { if (wikitools_type_affected($node->type)) { @@ -79,7 +80,7 @@ } else { // No match for title. Try to find an old page with this name - $result = db_query("SELECT n.nid, n.type, n.title FROM {node} n LEFT JOIN {node_revisions} r ON n.nid = r.nid WHERE LOWER(r.title) = LOWER('%s') ORDER BY n.vid DESC", $page_name); + $result = db_query("SELECT n.nid, n.type, n.title FROM {node} n INNER JOIN {node_revisions} r ON n.nid = r.nid WHERE $node_limit AND LOWER(r.title) = LOWER('%s') ORDER BY n.vid DESC", $page_name); $moved_nodes = array(); while ($node = db_fetch_object($result)) { if (wikitools_type_affected($node->type)) {