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/ZohoProjects/ZohoProjectsHandler.php +105 -34 2.10.03.3.1 View file →
@@ -6,11 +6,17 @@
6 6 */
7 7
8 8 namespace BitCode\BitForm\Core\Integration\ZohoProjects;
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\HttpHelper;
12 16 use BitCode\BitForm\Core\Util\IpTool;
17 +use BitCode\BitForm\GlobalHelper;
18 +use WP_Error;
13 19
14 20 /**
15 21 * Provide functionality for ZohoCrm integration
16 22 */
@@ -51,11 +57,17 @@
51 57 * @return string zoho crm api response and status
52 58 */
53 59 public static function generateTokens()
54 60 {
55 - if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce($_REQUEST['_ajax_nonce'], 'bitforms_save')) {
56 - $inputJSON = file_get_contents('php://input');
57 - $requestsParams = json_decode($inputJSON);
61 + if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['_ajax_nonce'])), 'bitforms_save')) {
62 + GlobalHelper::requirePostMethod();
63 +
64 + try {
65 + $requestsParams = GlobalHelper::formatRequestData();
66 + } catch (\InvalidArgumentException $e) {
67 + wp_send_json_error($e->getMessage(), 400);
68 + }
69 +
58 70 if (
59 71 empty($requestsParams->{'accounts-server'})
60 72 || empty($requestsParams->dataCenter)
61 73 || empty($requestsParams->clientId)
@@ -103,11 +115,17 @@
103 115
104 116 public static function refreshPortalsAjaxHelper()
105 117 {
106 118 $authorizationHeader = null;
107 - if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce($_REQUEST['_ajax_nonce'], 'bitforms_save')) {
108 - $inputJSON = file_get_contents('php://input');
109 - $queryParams = json_decode($inputJSON);
119 + if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['_ajax_nonce'])), 'bitforms_save')) {
120 + GlobalHelper::requirePostMethod();
121 +
122 + try {
123 + $queryParams = GlobalHelper::formatRequestData();
124 + } catch (\InvalidArgumentException $e) {
125 + wp_send_json_error($e->getMessage(), 400);
126 + }
127 +
110 128 if (
111 129 empty($queryParams->tokenDetails)
112 130 || empty($queryParams->dataCenter)
113 131 || empty($queryParams->clientId)
@@ -168,11 +186,17 @@
168 186
169 187 public static function refreshProjectsAjaxHelper()
170 188 {
171 189 $authorizationHeader = null;
172 - if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce($_REQUEST['_ajax_nonce'], 'bitforms_save')) {
173 - $inputJSON = file_get_contents('php://input');
174 - $queryParams = json_decode($inputJSON);
190 + if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['_ajax_nonce'])), 'bitforms_save')) {
191 + GlobalHelper::requirePostMethod();
192 +
193 + try {
194 + $queryParams = GlobalHelper::formatRequestData();
195 + } catch (\InvalidArgumentException $e) {
196 + wp_send_json_error($e->getMessage(), 400);
197 + }
198 +
175 199 if (
176 200 empty($queryParams->tokenDetails)
177 201 || empty($queryParams->dataCenter)
178 202 || empty($queryParams->clientId)
@@ -236,11 +260,17 @@
236 260
237 261 public static function refreshMilestonesAjaxHelper()
238 262 {
239 263 $authorizationHeader = null;
240 - if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce($_REQUEST['_ajax_nonce'], 'bitforms_save')) {
241 - $inputJSON = file_get_contents('php://input');
242 - $queryParams = json_decode($inputJSON);
264 + if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['_ajax_nonce'])), 'bitforms_save')) {
265 + GlobalHelper::requirePostMethod();
266 +
267 + try {
268 + $queryParams = GlobalHelper::formatRequestData();
269 + } catch (\InvalidArgumentException $e) {
270 + wp_send_json_error($e->getMessage(), 400);
271 + }
272 +
243 273 if (
244 274 empty($queryParams->tokenDetails)
245 275 || empty($queryParams->dataCenter)
246 276 || empty($queryParams->clientId)
@@ -303,11 +333,17 @@
303 333
304 334 public static function refreshTasklistsAjaxHelper()
305 335 {
306 336 $authorizationHeader = null;
307 - if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce($_REQUEST['_ajax_nonce'], 'bitforms_save')) {
308 - $inputJSON = file_get_contents('php://input');
309 - $queryParams = json_decode($inputJSON);
337 + if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['_ajax_nonce'])), 'bitforms_save')) {
338 + GlobalHelper::requirePostMethod();
339 +
340 + try {
341 + $queryParams = GlobalHelper::formatRequestData();
342 + } catch (\InvalidArgumentException $e) {
343 + wp_send_json_error($e->getMessage(), 400);
344 + }
345 +
310 346 if (
311 347 empty($queryParams->tokenDetails)
312 348 || empty($queryParams->dataCenter)
313 349 || empty($queryParams->clientId)
@@ -375,11 +411,17 @@
375 411
376 412 public static function refreshTasksAjaxHelper()
377 413 {
378 414 $authorizationHeader = null;
379 - if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce($_REQUEST['_ajax_nonce'], 'bitforms_save')) {
380 - $inputJSON = file_get_contents('php://input');
381 - $queryParams = json_decode($inputJSON);
415 + if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['_ajax_nonce'])), 'bitforms_save')) {
416 + GlobalHelper::requirePostMethod();
417 +
418 + try {
419 + $queryParams = GlobalHelper::formatRequestData();
420 + } catch (\InvalidArgumentException $e) {
421 + wp_send_json_error($e->getMessage(), 400);
422 + }
423 +
382 424 if (
383 425 empty($queryParams->tokenDetails)
384 426 || empty($queryParams->dataCenter)
385 427 || empty($queryParams->clientId)
@@ -448,11 +490,17 @@
448 490 }
449 491
450 492 public static function refreshFieldsAjaxHelper()
451 493 {
452 - if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce($_REQUEST['_ajax_nonce'], 'bitforms_save')) {
453 - $inputJSON = file_get_contents('php://input');
454 - $queryParams = json_decode($inputJSON);
494 + if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['_ajax_nonce'])), 'bitforms_save')) {
495 + GlobalHelper::requirePostMethod();
496 +
497 + try {
498 + $queryParams = GlobalHelper::formatRequestData();
499 + } catch (\InvalidArgumentException $e) {
500 + wp_send_json_error($e->getMessage(), 400);
501 + }
502 +
455 503 if (
456 504 empty($queryParams->tokenDetails)
457 505 || empty($queryParams->dataCenter)
458 506 || empty($queryParams->clientId)
@@ -789,11 +837,17 @@
789 837
790 838 public static function refreshUsersAjaxHelper()
791 839 {
792 840 $authorizationHeader = null;
793 - if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce($_REQUEST['_ajax_nonce'], 'bitforms_save')) {
794 - $inputJSON = file_get_contents('php://input');
795 - $queryParams = json_decode($inputJSON);
841 + if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['_ajax_nonce'])), 'bitforms_save')) {
842 + GlobalHelper::requirePostMethod();
843 +
844 + try {
845 + $queryParams = GlobalHelper::formatRequestData();
846 + } catch (\InvalidArgumentException $e) {
847 + wp_send_json_error($e->getMessage(), 400);
848 + }
849 +
796 850 if (
797 851 empty($queryParams->tokenDetails)
798 852 || empty($queryParams->dataCenter)
799 853 || empty($queryParams->clientId)
@@ -861,11 +915,17 @@
861 915
862 916 public static function refreshTaskLaysAjaxHelper()
863 917 {
864 918 $authorizationHeader = null;
865 - if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce($_REQUEST['_ajax_nonce'], 'bitforms_save')) {
866 - $inputJSON = file_get_contents('php://input');
867 - $queryParams = json_decode($inputJSON);
919 + if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['_ajax_nonce'])), 'bitforms_save')) {
920 + GlobalHelper::requirePostMethod();
921 +
922 + try {
923 + $queryParams = GlobalHelper::formatRequestData();
924 + } catch (\InvalidArgumentException $e) {
925 + wp_send_json_error($e->getMessage(), 400);
926 + }
927 +
868 928 if (
869 929 empty($queryParams->tokenDetails)
870 930 || empty($queryParams->dataCenter)
871 931 || empty($queryParams->clientId)
@@ -926,11 +986,16 @@
926 986
927 987 public static function refreshGroupsAjaxHelper()
928 988 {
929 989 $authorizationHeader = null;
930 - if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce($_REQUEST['_ajax_nonce'], 'bitforms_save')) {
931 - $inputJSON = file_get_contents('php://input');
932 - $queryParams = json_decode($inputJSON);
990 + if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['_ajax_nonce'])), 'bitforms_save')) {
991 + GlobalHelper::requirePostMethod();
992 +
993 + try {
994 + $queryParams = GlobalHelper::formatRequestData();
995 + } catch (\InvalidArgumentException $e) {
996 + wp_send_json_error($e->getMessage(), 400);
997 + }
933 998 if (
934 999 empty($queryParams->tokenDetails)
935 1000 || empty($queryParams->dataCenter)
936 1001 || empty($queryParams->clientId)
@@ -991,11 +1056,17 @@
991 1056
992 1057 public static function refreshTagsAjaxHelper()
993 1058 {
994 1059 $authorizationHeader = null;
995 - if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce($_REQUEST['_ajax_nonce'], 'bitforms_save')) {
996 - $inputJSON = file_get_contents('php://input');
997 - $queryParams = json_decode($inputJSON);
1060 + if (isset($_REQUEST['_ajax_nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['_ajax_nonce'])), 'bitforms_save')) {
1061 + GlobalHelper::requirePostMethod();
1062 +
1063 + try {
1064 + $queryParams = GlobalHelper::formatRequestData();
1065 + } catch (\InvalidArgumentException $e) {
1066 + wp_send_json_error($e->getMessage(), 400);
1067 + }
1068 +
998 1069 if (
999 1070 empty($queryParams->tokenDetails)
1000 1071 || empty($queryParams->dataCenter)
1001 1072 || empty($queryParams->clientId)
@@ -1163,5 +1234,5 @@
1163 1234 return $zprojectsApiResponse;
1164 1235 }
1165 1236 return $zprojectsApiResponse;
1166 1237 }
1167 -}
1238 +}