You are here

function flag_comment::type_access_multiple in Flag 6.2

Same name and namespace in other branches
  1. 7.3 includes/flag/flag_comment.inc \flag_comment::type_access_multiple()
  2. 7.2 flag.inc \flag_comment::type_access_multiple()

File

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

Class

flag_comment
Implements a comment flag.

Code

function type_access_multiple($content_ids, $account) {
  $access = array();

  // Ensure node types are granted access. This avoids a
  // node_load() on every type, usually done by applies_to_content_id().
  $cids = implode(',', array_map('intval', array_keys($content_ids)));
  $placeholders = implode(',', array_fill(0, sizeof($this->types), "'%s'"));
  $result = db_query("SELECT cid as content_id FROM {comments} c INNER JOIN {node} n ON c.nid = n.nid WHERE cid IN ({$cids}) and n.type NOT IN ({$placeholders})", $this->types);
  while ($row = db_fetch_object($result)) {
    $access[$row->content_id] = FALSE;
  }
  return $access;
}