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']); } } } } }
<?php $Forms = new PerchForms_Forms($API); $Responses = new PerchForms_Responses($API); $HTML = $API->get('HTML'); $Paging = $API->get('Paging'); $Paging->set_per_page(10); $filter = 'all'; if (isset($_GET['id']) && $_GET['id'] != '') { $Form = $Forms->find($_GET['id']); $spam = false; if (isset($_GET['spam']) && ($_GET['spam'] = 1)) { $spam = true; $filter = 'spam'; } $responses = $Responses->get_for_from($_GET['id'], $Paging, $spam); } else { PerchUtil::redirect($API->app_path()); }
<?php if (!$CurrentUser->has_priv('perch_forms.delete')) { exit; } $Forms = new PerchForms_Forms($API); $HTML = $API->get('HTML'); $Form = $API->get('Form'); $Form->set_name('delete'); $message = false; if (isset($_GET['id']) && $_GET['id'] != '') { $ThisForm = $Forms->find($_GET['id'], true); } else { PerchUtil::redirect($API->app_path()); } if ($Form->submitted()) { if (is_object($ThisForm)) { $ThisForm->delete(); if ($Form->submitted_via_ajax) { echo $API->app_path(); exit; } else { PerchUtil::redirect($API->app_path() . '/'); } } else { $message = $HTML->failure_message('Sorry, that form could not be deleted.'); } } $details = $ThisForm->to_array();
<?php if (!$CurrentUser->has_priv('perch_forms.configure')) { exit; } $Forms = new PerchForms_Forms($API); $HTML = $API->get('HTML'); $Form = $API->get('Form'); $message = false; if (isset($_GET['id']) && $_GET['id'] != '') { $formID = (int) $_GET['id']; $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 {