← All changes
|
includes/Core/Integration/Autonami/AutonamiHandler.php
+14
-5
2.10.0
→
3.3.1
View file →
| @@ -6,8 +6,12 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | namespace BitCode\BitForm\Core\Integration\Autonami; |
| 9 | 9 | |
| 10 | +if (!defined('ABSPATH')) { | |
| 11 | + exit; | |
| 12 | +} | |
| 13 | + | |
| 10 | 14 | use BitCode\BitForm\Core\Integration\IntegrationHandler; |
| 11 | 15 | use BitCode\BitForm\Core\Util\ApiResponse as UtilApiResponse; |
| 12 | 16 | use BWFCRM_Fields; |
| 13 | 17 | use BWFCRM_Lists; |
| @@ -53,9 +57,9 @@ | ||
| 53 | 57 | * @return Autonami lists |
| 54 | 58 | */ |
| 55 | 59 | public static function autonamiListsAndTags() |
| 56 | 60 | { |
| 57 | - if (!isset($_REQUEST['_ajax_nonce']) && !wp_verify_nonce($_REQUEST['_ajax_nonce'], 'bitforms_save')) { | |
| 61 | + if (!isset($_REQUEST['_ajax_nonce']) || !wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['_ajax_nonce'])), 'bitforms_save')) { | |
| 58 | 62 | wp_send_json_error(__('Token expired', 'bit-form'), 401); |
| 59 | 63 | } |
| 60 | 64 | |
| 61 | 65 | self::checkedExistsAutonami(); |
| @@ -84,9 +88,9 @@ | ||
| 84 | 88 | } |
| 85 | 89 | |
| 86 | 90 | public static function autonamiFields() |
| 87 | 91 | { |
| 88 | - if (!isset($_REQUEST['_ajax_nonce']) && !wp_verify_nonce($_REQUEST['_ajax_nonce'], 'bitforms_save')) { | |
| 92 | + if (!isset($_REQUEST['_ajax_nonce']) || !wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['_ajax_nonce'])), 'bitforms_save')) { | |
| 89 | 93 | wp_send_json_error(__('Token expired', 'bit-form'), 401); |
| 90 | 94 | } |
| 91 | 95 | |
| 92 | 96 | self::checkedExistsAutonami(); |
| @@ -120,9 +124,9 @@ | ||
| 120 | 124 | * @return True Autonami are exists |
| 121 | 125 | */ |
| 122 | 126 | public static function autonamiAuthorize() |
| 123 | 127 | { |
| 124 | - if (!isset($_REQUEST['_ajax_nonce']) && !wp_verify_nonce($_REQUEST['_ajax_nonce'], 'bitforms_save')) { | |
| 128 | + if (!isset($_REQUEST['_ajax_nonce']) || !wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['_ajax_nonce'])), 'bitforms_save')) { | |
| 125 | 129 | wp_send_json_error(__('Token expired', 'bit-form'), 401); |
| 126 | 130 | } |
| 127 | 131 | |
| 128 | 132 | if (self::checkedExistsAutonami()) { |
| @@ -133,10 +137,15 @@ | ||
| 133 | 137 | } |
| 134 | 138 | |
| 135 | 139 | public function execute(IntegrationHandler $integrationHandler, $integrationData, $fieldValues, $entryID, $logID) |
| 136 | 140 | { |
| 141 | + $entryDetails = [ | |
| 142 | + 'formId' => $this->_formID, | |
| 143 | + 'entryId' => $entryID, | |
| 144 | + 'fieldValues' => $fieldValues | |
| 145 | + ]; | |
| 137 | 146 | if (!class_exists('BWFCRM_Contact')) { |
| 138 | - (new UtilApiResponse())->apiResponse($logID, $this->_integrationID, ['type' => 'record', 'type_name' => 'insert'], 'error', 'Autonami Pro Plugins not found'); | |
| 147 | + (new UtilApiResponse())->apiResponse($logID, $this->_integrationID, ['type' => 'record', 'type_name' => 'insert'], 'error', 'Autonami Pro Plugins not found', $entryDetails); | |
| 139 | 148 | return; |
| 140 | 149 | } |
| 141 | 150 | |
| 142 | 151 | $integrationDetails = is_string($integrationData->integration_details) ? json_decode($integrationData->integration_details) : $integrationData->integration_details; |
| @@ -150,9 +159,9 @@ | ||
| 150 | 159 | return new WP_Error('REQ_FIELD_EMPTY', __('module, fields are required for Autonami api', 'bit-form')); |
| 151 | 160 | } |
| 152 | 161 | |
| 153 | 162 | $recordApiHelper = new RecordApiHelper($this->_integrationID, $logID, $entryID); |
| 154 | - $autonamiApiResponse = $recordApiHelper->executeRecordApi($fieldValues, $fieldMap, $actions, $lists, $tags); | |
| 163 | + $autonamiApiResponse = $recordApiHelper->executeRecordApi($fieldValues, $fieldMap, $actions, $lists, $tags, $this->_formID); | |
| 155 | 164 | |
| 156 | 165 | if (is_wp_error($autonamiApiResponse)) { |
| 157 | 166 | return $autonamiApiResponse; |
| 158 | 167 | } |