You are here

function cleantalk_uc_order in Anti Spam by CleanTalk 8

Same name and namespace in other branches
  1. 8.4 cleantalk.module \cleantalk_uc_order()
  2. 8.3 cleantalk.module \cleantalk_uc_order()
  3. 7.5 cleantalk.module \cleantalk_uc_order()
  4. 7 cleantalk.module \cleantalk_uc_order()
  5. 7.2 cleantalk.module \cleantalk_uc_order()
  6. 7.4 cleantalk.module \cleantalk_uc_order()
  7. 9.1.x cleantalk.module \cleantalk_uc_order()

File

./cleantalk.module, line 1230
Main CleanTalk integration module functions.

Code

function cleantalk_uc_order($op, $order, $arg2) {
  global $cleantalk_executed;
  $email = '';
  $message = '';
  $nickname = '';
  $subject = '';
  cleantalk_get_fields_any($email, $message, $nickname, $subject, $_POST);
  if ($email != '' && !$cleantalk_executed && $op != 'total' && $op != 'presave' && $op != 'save') {
    $spam_check = array();
    $spam_check['type'] = 'comment';
    $spam_check['sender_email'] = $email;
    $spam_check['sender_nickname'] = $nickname;
    $spam_check['message_title'] = $subject;
    $spam_check['message_body'] = $message;
    $spam_check['example_title'] = '';
    $spam_check['example_body'] = '';
    $spam_check['example_comments'] = '';
    $spam_result = _cleantalk_check_spam($spam_check);
    $cleantalk_executed = true;
    if (isset($spam_result) && is_array($spam_result) && $spam_result['errno'] == 0 && $spam_result['allow'] != 1 && $spam_result['stop_queue'] == 1) {
      if (strpos($_SERVER['REQUEST_URI'], 'ajax') !== false) {
        print $spam_result['ct_result_comment'];
        drupal_exit();
      }
      else {
        _cleantalk_die($spam_result['ct_result_comment']);
      }
    }
  }
}