--- C:/Documents and Settings/Raxiux/Desktop/wikitools/wikitools.pages.inc	Wed Jun 17 22:08:36 2009
+++ C:/xampp/htdocs/drupal/sites/all/modules/contrib/wikitools/wikitools.pages.inc	Thu Jul  2 23:58:54 2009
@@ -51,11 +51,13 @@
     $page_name = wikitools_main_page_title();
   }
 
-  // Don't do anything if no node types are active or no page name is available
-  $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);
+    // Don't do anything if no node types are active or no page name is available
+    $node_types = wikitools_node_types();
+    if (count($node_types) && $page_name) {
+    // Try to find the current page with this name, limit the query by node types
+    $params = $node_types;
+    $params[] = $page_name;
+    $result = db_query("SELECT nid, type FROM {node} WHERE type IN (" .db_placeholders($node_types, 'varchar'). ") AND LOWER(title) = LOWER('%s')", $params);
     $found_nodes = array();
     while ($node = db_fetch_object($result)) {
       if (wikitools_type_affected($node->type)) {
