public static function submit_spam($key, $fields, $environment)
 {
     self::$apiKey = $key;
     PerchUtil::debug('Submitting spam to Akismet');
     $Perch = Perch::fetch();
     $data = array();
     $data['blog'] = self::get_site_url();
     $data['user_ip'] = $environment['REMOTE_ADDR'];
     $data['user_agent'] = $environment['HTTP_USER_AGENT'];
     $data['referrer'] = $environment['HTTP_REFERER'];
     $data['permalink'] = $Perch->get_page();
     $data['comment_type'] = 'contactform';
     $data['comment_author'] = @$fields['name'];
     $data['comment_author_email'] = @$fields['email'];
     $data['comment_author_url'] = @$fields['url'];
     $data['comment_content'] = @$fields['body'];
     $data = array_merge($environment, $data);
     $result = self::make_request('submit-spam', $data);
 }
 public function mark_as_spam()
 {
     $data = array();
     $data['responseSpam'] = '1';
     $this->update($data);
     $json = PerchUtil::json_safe_decode($this->responseSpamData(), true);
     if (PerchUtil::count($json)) {
         $API = new PerchAPI(1, 'perch_forms');
         $Forms = new PerchForms_Forms($API);
         $Form = $Forms->find($this->formID());
         if ($Form) {
             $opts = $Form->get_settings();
             if (isset($opts['akismet']) && $opts['akismet']) {
                 if (isset($opts['akismetAPIKey']) && $opts['akismetAPIKey'] != '') {
                     PerchForms_Akismet::submit_spam($opts['akismetAPIKey'], $json['fields'], $json['environment']);
                 }
             }
         }
     }
 }
    $ThisForm = $Forms->find($formID);
    $details = $ThisForm->to_array();
    $settings = $ThisForm->get_settings();
} else {
    $message = $HTML->failure_message('Sorry, that form could not be updated.');
}
$Form->require_field('formTitle', 'Required');
if ($Form->submitted()) {
    $postvars = array('formTitle');
    $data = $Form->receive($postvars);
    $settingvars = array('store', 'fileLocation', 'email', 'emailAddress', 'adminEmailMessage', 'adminEmailTemplate', 'adminEmailSubject', 'adminEmailFromName', 'adminEmailFromAddress', 'akismet', 'akismetAPIKey', 'successURL', 'responseEmailSubject', 'responseEmailMessage', 'formEmailFieldID', 'sendAutoResponse', 'autoresponseTemplate');
    $settingdata = $Form->receive($settingvars);
    if (isset($settingdata['successURL']) && trim($settingdata['successURL']) == '') {
        unset($settingdata['successURL']);
    }
    $data['formOptions'] = PerchUtil::json_safe_encode($settingdata);
    $ThisForm->update($data);
    if (is_object($ThisForm)) {
        $message = $HTML->success_message('Your form has been successfully edited. Return to %sform listing%s', '<a href="' . $API->app_path() . '">', '</a>');
    } else {
        $message = $HTML->failure_message('Sorry, that form could not be edited.');
    }
    if (isset($settingdata['akismet']) && $settingdata['akismet'] == '1' && isset($settingdata['akismetAPIKey']) && $settingdata['akismetAPIKey'] != '') {
        if (!PerchForms_Akismet::verify_key($settingdata['akismetAPIKey'])) {
            $message .= $HTML->failure_message('Sorry, Akismet API key does not appear to be correct.');
        }
    }
    $details = $ThisForm->to_array();
    $settings = $ThisForm->get_settings();
}
$filter = 'options';
 private function _check_for_spam($fields, $environment, $akismetAPIKey = false)
 {
     if (isset($fields['honeypot']) && trim($fields['honeypot']) != '') {
         PerchUtil::debug('Honeypot field completed: message is spam');
         return true;
     }
     if ($akismetAPIKey) {
         if (PerchForms_Akismet::check_message_is_spam($akismetAPIKey, $fields, $environment)) {
             PerchUtil::debug('Message is spam');
             return true;
         } else {
             PerchUtil::debug('Message is not spam');
         }
     }
     return false;
 }