You are here

function spam_links in Spam 5.3

Same name and namespace in other branches
  1. 6 spam.module \spam_links()

Add the appropriate links to all content that is actively being filtered.

3 calls to spam_links()
comment_spamapi in modules/spam_comment.inc
Spam module _spamapi() hook.
node_spamapi in modules/spam_node.inc
Spam module _spamapi() hook.
spam_user in modules/spam_user.inc

File

./spam.module, line 1637

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 = %d", $type, $id));
      if ($score >= variable_get('spam_threshold', SPAM_DEFAULT_THRESHOLD)) {
        $links['spam'] = array(
          'title' => t('spam (@score)', array(
            '@score' => $score,
          )),
        );
        $links['mark-as-not-spam'] = array(
          'href' => "spam/{$type}/{$id}/notspam",
          'title' => t('mark as not spam'),
        );
      }
      else {
        $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'),
        );
      }
    }
  }
  return $links;
}