You are here

function spam_denied_page in Spam 6

Same name and namespace in other branches
  1. 5.3 spam.module \spam_denied_page()

Generate an error message informing the user that their posting has been blocked by the spam filter. Provide a dynamic link for reporting if their posting was blocked in error.

TODO: We don't need to use the maintenance_page, we could create our own using the current theme.

2 calls to spam_denied_page()
spam_filter_duplicate_denied_ip in filters/spam_filter_duplicate/spam_filter_duplicate.module
spam_filter_duplicate_denied_post in filters/spam_filter_duplicate/spam_filter_duplicate.module
1 string reference to 'spam_denied_page'
spam_menu in ./spam.module
Drupal _menu() hook.

File

./spam.module, line 1616
Spam module, v3 Copyright(c) 2006-2008 Jeremy Andrews <jeremy@tag1consulting.com>. All rights reserved.

Code

function spam_denied_page($message = NULL, $title = NULL) {
  global $theme;
  $no_maintenance = !empty($theme);
  if (!$no_maintenance) {
    drupal_maintenance_theme();
  }
  drupal_set_header('HTTP/1.1 403 Forbidden');
  if (!$message) {
    $message = strtr(variable_get('spam_filtered_message', t('<p>Your posting on @site from %IP has been automatically flagged by our spam filters as being inappropriate for this website.</p>At @site we work very hard to keep our web pages free of spam.  Unfortunately, sometimes we accidentally block legitimate content.  If you are attempting to post legitimate content to this website, you can help us to improve our spam filters and ensure that your post appears on our website by clicking this link:</p><blockquote>%LINK</blockquote>', array(
      '@site' => variable_get('site_name', 'Drupal'),
    ))), array(
      '%IP' => ip_address(),
      '%LINK' => _spam_error_link($_SESSION['spam_content']),
    ));
  }
  if (!$title) {
    $title = t('Your posting was blocked by our spam filter');
  }
  drupal_set_title($title);
  if (!$no_maintenance) {
    echo theme('maintenance_page', filter_xss_admin($message));
  }
  else {
    echo '<html><head><title>', check_plain($title), '</title></head><body><h1>', check_plain($title), '</h1><p>', filter_xss_admin($message), '</p></body></html>';
  }
}