Index: plugins/freelinking_nid.inc
===================================================================
--- plugins/freelinking_nid.inc	(revision 4737)
+++ plugins/freelinking_nid.inc	(working copy)
@@ -17,8 +17,8 @@
 );

 /**
- * Builds a link to a node in the site
- *
+ * Builds a link to a node in the site
+ *
  * @return
  *   an array with node properties to build the link.
  */
@@ -29,10 +29,11 @@
       'message' => t('Invalid Node ID "!nid"', array('!nid' => $target['dest'])),
     );
   }
-  $sql = 'SELECT title FROM {node} WHERE nid = "%s" ';
-  $result = db_query('SELECT title FROM {node} WHERE nid = :nid ', array(':nid' => $target['dest']));
-
-  foreach ($result as $node) { // should be only one
+  $query = db_select('node', 'n')->
+    condition('n.nid', $target['dest'])->
+    addTag('node_access');
+  $result = $query->execute();
+  while ($node = $result->fetchObject()) { // should be only one
     $title = $node->title;
   } // endwhile looping through (one) node

@@ -55,4 +56,3 @@
 }

 // vim:tw=300 nowrap syn=php
-
Index: plugins/freelinking_nodetitle.inc
===================================================================
--- plugins/freelinking_nodetitle.inc	(revision 4737)
+++ plugins/freelinking_nodetitle.inc	(working copy)
@@ -110,15 +110,16 @@
     $type = variable_get('freelinking_nodetitle_searchcontenttype', 'none');
   }

-  $sql = "SELECT title, nid, language FROM {node} WHERE title = :title";
-  $params = array(':title' => $title);
+  $query = db_select('node', 'n')->
+    fields('n')->
+    condition('n.title', $title);
   if ($type != 'none') {
-    $sql .= " AND type = :type";
-    $params[':type'] = $type;
+    $query->condition('n.type', $type);
   }
-  $result = db_query($sql, $params);
+  $query->addTag('node_access');
+  $result = $query->execute();
   $set = array();
-  foreach ($result as $record) {
+  while ($record = $result->fetchObject()) {
     $set[] = $record;
   }
