PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 3.3.1
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v3.3.1
3.3.1 V-3.3.0 3.2.2 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 V3.0.3 V3.0.2 -3.0.1 V_3.0.0 1.1.1 1.1.8 1.2 1.3 1.4 1.4.18 1.5.2 1.9 2.0 2.10.0 2.10.1 All 138 releases
← All changes | includes/Core/Integration/SendFox/SendFoxHandler.php +26 -7 2.10.03.3.1 View file →
@@ -5,10 +5,15 @@
5 5 */
6 6
7 7 namespace BitCode\BitForm\Core\Integration\SendFox;
8 8
9 +if (!defined('ABSPATH')) {
10 + exit;
11 +}
12 +
9 13 use BitCode\BitForm\Core\Integration\IntegrationHandler;
10 14 use BitCode\BitForm\Core\Util\HttpHelper;
15 +use BitCode\BitForm\GlobalHelper;
11 16 use WP_Error;
12 17
13 18 class SendFoxHandler
14 19 {
@@ -14,11 +19,14 @@
14 19 {
15 20 private $integrationID;
16 21 public static $baseUrl = 'https://api.sendfox.com/';
17 22
23 + private $formId;
24 +
18 25 public function __construct($integrationID, $fromID)
19 26 {
20 27 $this->integrationID = $integrationID;
28 + $this->formId = $fromID;
21 29 }
22 30
23 31 public static function registerAjax()
24 32 {
@@ -27,14 +35,19 @@
27 35 }
28 36
29 37 public static function sendFoxAuthorize($requestParams)
30 38 {
31 - if (!isset($_REQUEST['_ajax_nonce']) && !wp_verify_nonce($_REQUEST['_ajax_nonce'], 'bitforms_save')) {
39 + if (!isset($_REQUEST['_ajax_nonce']) || !wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['_ajax_nonce'])), 'bitforms_save')) {
32 40 wp_send_json_error(__('Token expired', 'bit-form'), 401);
33 41 }
34 42
35 - $inputJSON = file_get_contents('php://input');
36 - $requestParams = json_decode($inputJSON);
43 + GlobalHelper::requirePostMethod();
44 +
45 + try {
46 + $requestParams = GlobalHelper::formatRequestData();
47 + } catch (\InvalidArgumentException $e) {
48 + wp_send_json_error($e->getMessage(), 400);
49 + }
37 50 if (empty($requestParams->access_token)) {
38 51 wp_send_json_error(
39 52 __(
40 53 'Requested parameter is empty',
@@ -61,15 +74,20 @@
61 74 }
62 75
63 76 public static function fetchContactLists($requestParams)
64 77 {
65 - if (!isset($_REQUEST['_ajax_nonce']) && !wp_verify_nonce($_REQUEST['_ajax_nonce'], 'bitforms_save')) {
78 + if (!isset($_REQUEST['_ajax_nonce']) || !wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['_ajax_nonce'])), 'bitforms_save')) {
66 79 wp_send_json_error(__('Token expired', 'bit-form'), 401);
67 80 }
68 81
69 - $inputJSON = file_get_contents('php://input');
70 - $requestParams = json_decode($inputJSON);
82 + GlobalHelper::requirePostMethod();
71 83
84 + try {
85 + $requestParams = GlobalHelper::formatRequestData();
86 + } catch (\InvalidArgumentException $e) {
87 + wp_send_json_error($e->getMessage(), 400);
88 + }
89 +
72 90 if (empty($requestParams->access_token)) {
73 91 wp_send_json_error(
74 92 __(
75 93 'Requested parameter is empty',
@@ -117,9 +135,10 @@
117 135 $mainAction,
118 136 $fieldValues,
119 137 $fieldMap,
120 138 $access_token,
121 - $integrationDetails
139 + $integrationDetails,
140 + $this->formId
122 141 );
123 142
124 143 if (is_wp_error($sendFoxApiResponse)) {
125 144 return $sendFoxApiResponse;