function spam_links in Spam 6
Same name and namespace in other branches
- 5.3 spam.module \spam_links()
Add the appropriate links to all content that is actively being filtered.
3 calls to spam_links()
- comment_spamapi in content/
spam_content_comment.inc - Spam module _spamapi() hook.
- node_spamapi in content/
spam_content_node.inc - Spam module _spamapi() hook.
- spam_user in content/
spam_content_user.inc
File
- ./
spam.module, line 1721 - Spam module, v3 Copyright(c) 2006-2008 Jeremy Andrews <jeremy@tag1consulting.com>. All rights reserved.
Code
function spam_links($type, $id, $content) {
$links = array();
if (spam_invoke_module($type, 'filter_content_type', $content)) {
if (user_access('administer spam')) {
$score = (int) db_result(db_query("SELECT score FROM {spam_tracker} WHERE content_type = '%s' AND content_id = '%s'", $type, $id));
if ($score >= variable_get('spam_threshold', SPAM_DEFAULT_THRESHOLD)) {
$links['spam'] = array(
'title' => t('spam (@score)', array(
'@score' => $score,
)),
);
$token = drupal_get_token("not spam {$type} {$id}");
$links['mark-as-not-spam'] = array(
'href' => "spam/{$type}/{$id}/not_spam",
'title' => t('mark as not spam'),
'query' => array(
'token' => $token,
),
);
}
else {
$token = drupal_get_token("spam {$type} {$id}");
$links['spam'] = array(
'title' => t('not spam (@score)', array(
'@score' => $score,
)),
);
$links['mark-as-spam'] = array(
'href' => "spam/{$type}/{$id}/spam",
'title' => t('mark as spam'),
'query' => array(
'token' => $token,
),
);
}
}
}
return $links;
}