You are here

function _fetch_affected_nodes in Glossify 6

Same name and namespace in other branches
  1. 6.3 glossify.module \_fetch_affected_nodes()

Helper function that fetches and returns an array of all the nodes that contain the keywords.

File

./glossify.module, line 535

Code

function _fetch_affected_nodes($keywords, $content_types) {
  $nodes = array();
  foreach ($keywords as $keyword) {
    $q = db_query("SELECT n.nid FROM {node} n INNER JOIN {node_revisions} r ON r.nid = n.nid WHERE n.type IN (" . db_placeholders($content_types, 'varchar') . ") AND r.body LIKE '%%%s%%'", $content_types, $keyword);
    while ($r = db_fetch_array($q)) {
      $nodes[] = $r['nid'];
    }
  }
  return $nodes;
}