You are here

function antispam_load in AntiSpam 6

Same name and namespace in other branches
  1. 7 antispam.module \antispam_load()

File

./antispam.module, line 565

Code

function antispam_load($arg, &$map, $index) {
  module_load_include('inc', 'comment', 'comment.admin');
  if (!is_numeric($map[2])) {

    // Node and comment ids are always numeric!
    return FALSE;
  }
  $content_type = $map[1];
  if ($content_type == 'node') {
    if (!($map[2] = node_load($map[2]))) {
      return FALSE;
    }
  }
  if ($content_type == 'comment' && module_exists('comment')) {
    if (!($map[2] = _comment_load($map[2]))) {
      return FALSE;
    }
  }
  $op = $map[3];
  if ($op == 'publish' || $op == 'unpublish') {
    $map[0] = 'antispam_callback_set_published_status';
  }
  else {
    if ($op == 'submit-spam' || $op == 'submit-ham') {
      $map[0] = 'antispam_callback_set_spam_status';
    }
  }
  return $map[$index];
}