You are here

function flag_comment::applies_to_content_id_array in Flag 5

Same name and namespace in other branches
  1. 6 flag.inc \flag_comment::applies_to_content_id_array()

File

./flag.inc, line 1079
Implements various flags. Uses object oriented style inspired by that of Views 2.

Class

flag_comment
Implements a comment flag.

Code

function applies_to_content_id_array($content_ids) {
  $passed = array();
  $content_ids = implode(',', array_map('intval', $content_ids));
  $placeholders = implode(',', array_fill(0, sizeof($this->types), "'%s'"));
  $result = db_query("SELECT cid FROM {comments} c INNER JOIN {node} n ON c.nid = n.nid WHERE cid IN ({$content_ids}) and n.type IN ({$placeholders})", $this->types);
  while ($row = db_fetch_object($result)) {
    $passed[$row->cid] = TRUE;
  }
  return $passed;
}