You are here

function _cloudflare_spam_report in CloudFlare 6

Same name and namespace in other branches
  1. 7 cloudflare.module \_cloudflare_spam_report()
1 call to _cloudflare_spam_report()
cloudflare_form_comment_admin_overview_alter in ./cloudflare.module
Implementation of hook_form_FORM_ID_alter().

File

./cloudflare.module, line 156

Code

function _cloudflare_spam_report($cid, $deletecid = FALSE) {
  $return_val = _cloudflare_spam_api($cid);
  if ($return_val['result']->result == 'error') {
    watchdog('cloudflare', t('Spam report failed.') . "\n" . serialize($return_val['result']->msg) . "\n" . serialize($return_val['options']));
    drupal_set_message(t("Spam report failed: %msg", array(
      '%msg' => $return_val['result']->msg,
    )));
  }
  elseif ($return_val['result']->result == 'success') {
    watchdog('cloudflare', t('Successfully submitted CloudFlare spam report.') . "\n" . serialize($return_val['value']));
    drupal_set_message(t("Successfully submitted CloudFlare spam report for ") . $return_val['value']['am'] . ' / ' . $return_val['value']['ip']);

    // If delete is chosen, let's get that done now.
    if ($deletecid) {
      _cloudflare_delete_comment($cid);
    }
  }
  else {
    watchdog('cloudflare', t('Unexpected Response from CloudFlare.') . "\n" . $return_val['fc']);
    drupal_set_message(t("Unexpected Response from CloudFlare. Please review your watchdog report for detailed information."));
  }
}