function spam_mark_as_not_spam in Spam 5.3
Same name and namespace in other branches
- 6 spam.module \spam_mark_as_not_spam()
Invoke appropriate actions for marking content as not spam. TODO: Integrate with the Actions module, making actions fully configurable.
3 calls to spam_mark_as_not_spam()
- comment_spamapi_form_alter in modules/
spam_comment.inc - Form alter gets it's own function so we can reference &$form without causing errors in PHP4 installations. (If we use spamapi, we have to set a default, which PHP4 doesn't support.)
- spam_admin_feedback_form_submit in ./
spam.module - Process spam feedback.
- spam_content_filter in ./
spam.module - API call to determine the likeliness that a given piece of content is spam, returning a rating from 1% likelihood to 99% likelihood. It is unlikely that you want to call this function directly.
1 string reference to 'spam_mark_as_not_spam'
- spam_menu in ./
spam.module - Drupal _menu() hook.
File
- ./
spam.module, line 1702
Code
function spam_mark_as_not_spam($type, $id, $extra = array()) {
// TODO: Fix this loop
static $loop = array();
if (isset($loop[$id])) {
spam_log(SPAM_DEBUG, 'spam_mark_as_not_spam', t('FIX ME: looping'), $type, $id);
return;
}
$loop[$id] = TRUE;
spam_update_statistics(t('@type marked as not spam', array(
'@type' => $type,
)));
$extra['sid'] = db_result(db_query("SELECT sid FROM {spam_tracker} WHERE content_type = '%s' AND content_id = %d", $type, $id));
if (!$extra['score']) {
$extra['score'] = 1;
}
spam_log(SPAM_VERBOSE, 'spam_mark_as_not_spam', t('marked as not spam, score(@score)', array(
'@score' => $extra['score'],
)), $type, $id);
if ($extra['sid']) {
db_query('UPDATE {spam_tracker} SET score = %d WHERE sid = %d', $extra['score'], $extra['sid']);
}
else {
if ($id) {
$hostname = spam_invoke_module($type, 'hostname', $id);
db_query("INSERT INTO {spam_tracker} (content_type, content_id, score, hostname, timestamp) VALUES('%s', %d, %d, '%s', %d)", $type, $id, $extra['score'], $hostname, time());
$extra['sid'] = db_result(db_query("SELECT sid FROM {spam_tracker} WHERE content_type = '%s' AND content_id = %d", $type, $id));
}
}
if (!isset($extra['content'])) {
$extra['content'] = spam_invoke_module($type, 'load', $id);
}
$extra['id'] = $id;
spam_invoke_api('mark_as_not_spam', $type, array(), array(), $extra);
if ($id) {
// For now, we're hard coding the actions...
spam_publish($type, $id);
}
if ($extra['redirect']) {
spam_invoke_module($type, 'redirect', $id);
}
}