function spam_nodeapi in Spam 6
Same name and namespace in other branches
- 5 spam.module \spam_nodeapi()
Drupal _nodeapi() hook.
File
- content/
spam_content_node.inc, line 11 - Include file for integration with the node system.
Code
function spam_nodeapi(&$node, $op) {
switch ($op) {
case 'update':
if (!spam_bypass_filters()) {
spam_content_update($node, 'node');
$spam = spam_content_is_spam($node, 'node', $node->nid);
if (isset($spam['is_spam']) && $spam['is_spam']) {
$node->is_spam = TRUE;
}
}
break;
case 'insert':
if (!spam_bypass_filters()) {
spam_content_insert($node, 'node');
$spam = spam_content_is_spam($node, 'node', $node->nid);
if (isset($spam['is_spam']) && $spam['is_spam']) {
$node->is_spam = TRUE;
}
}
break;
case 'delete':
spam_content_delete($node, 'node');
break;
case 'view':
$node->is_spam = FALSE;
if (spam_score_is_spam(_spam_content_node_score($node->nid))) {
drupal_add_css(drupal_get_path('module', 'spam') . '/content/spam-node.css');
$node->is_spam = TRUE;
}
}
}