PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.15.3
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.15.3
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/OneDrive/OneDriveHandler.php +11 -39 3.3.12.15.3 View file →
@@ -1,18 +1,13 @@
1 1 <?php
2 2
3 3 namespace BitCode\BitForm\Core\Integration\OneDrive;
4 4
5 -if (!defined('ABSPATH')) {
6 - exit;
7 -}
8 -
9 5 use BitCode\BitForm\Core\Integration\IntegrationHandler;
10 6 use BitCode\BitForm\Core\Integration\OneDrive\RecordApiHelper as OneDriveRecordApiHelper;
11 7 use BitCode\BitForm\Core\Util\ApiResponse;
12 8 use BitCode\BitForm\Core\Util\HttpHelper;
13 9 use BitCode\BitForm\Core\Util\IpTool;
14 -use BitCode\BitForm\GlobalHelper;
15 10
16 11 class OneDriveHandler
17 12 {
18 13 private $formID;
@@ -32,20 +27,15 @@
32 27 }
33 28
34 29 public static function authorization()
35 30 {
36 - if (!isset($_REQUEST['_ajax_nonce']) || !wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['_ajax_nonce'])), 'bitforms_save')) {
31 + if (!isset($_REQUEST['_ajax_nonce']) && !wp_verify_nonce($_REQUEST['_ajax_nonce'], 'bitforms_save')) {
37 32 wp_send_json_error(__('Token expired', 'bit-form'), 401);
38 33 }
39 34
40 - GlobalHelper::requirePostMethod();
35 + $inputJSON = file_get_contents('php://input');
36 + $queryParams = json_decode($inputJSON);
41 37
42 - try {
43 - $queryParams = GlobalHelper::formatRequestData();
44 - } catch (\InvalidArgumentException $e) {
45 - wp_send_json_error($e->getMessage(), 400);
46 - }
47 -
48 38 if (empty($queryParams->clientId) || empty($queryParams->clientSecret) || empty($queryParams->code) || empty($queryParams->redirectURI)) {
49 39 wp_send_json_error(__('Requested parameter is empty', 'bit-form'), 400);
50 40 }
51 41
@@ -68,19 +58,14 @@
68 58 }
69 59
70 60 public static function getAllFolders()
71 61 {
72 - if (!isset($_REQUEST['_ajax_nonce']) || !wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['_ajax_nonce'])), 'bitforms_save')) {
62 + if (!isset($_REQUEST['_ajax_nonce']) && !wp_verify_nonce($_REQUEST['_ajax_nonce'], 'bitforms_save')) {
73 63 wp_send_json_error(__('Token expired', 'bit-form'), 401);
74 64 }
75 65
76 - GlobalHelper::requirePostMethod();
77 -
78 - try {
79 - $queryParams = GlobalHelper::formatRequestData();
80 - } catch (\InvalidArgumentException $e) {
81 - wp_send_json_error($e->getMessage(), 400);
82 - }
66 + $inputJSON = file_get_contents('php://input');
67 + $queryParams = json_decode($inputJSON);
83 68 if (empty($queryParams->tokenDetails) || empty($queryParams->clientId) || empty($queryParams->clientSecret)) {
84 69 wp_send_json_error(__('Requested parameter is empty', 'bit-form'), 400);
85 70 }
86 71
@@ -121,20 +106,15 @@
121 106 }
122 107
123 108 public static function singleOneDriveFolderList()
124 109 {
125 - if (!isset($_REQUEST['_ajax_nonce']) || !wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['_ajax_nonce'])), 'bitforms_save')) {
110 + if (!isset($_REQUEST['_ajax_nonce']) && !wp_verify_nonce($_REQUEST['_ajax_nonce'], 'bitforms_save')) {
126 111 wp_send_json_error(__('Token expired', 'bit-form'), 401);
127 112 }
128 113
129 - GlobalHelper::requirePostMethod();
114 + $inputJSON = file_get_contents('php://input');
115 + $queryParams = json_decode($inputJSON);
130 116
131 - try {
132 - $queryParams = GlobalHelper::formatRequestData();
133 - } catch (\InvalidArgumentException $e) {
134 - wp_send_json_error($e->getMessage(), 400);
135 - }
136 -
137 117 if (empty($queryParams->tokenDetails) || empty($queryParams->clientId) || empty($queryParams->clientSecret)) {
138 118 wp_send_json_error(__('Requested parameter is empty', 'bit-form'), 400);
139 119 }
140 120
@@ -222,16 +202,10 @@
222 202 public function execute(IntegrationHandler $integrationHandler, $integrationData, $fieldValues, $entryID, $logID)
223 203 {
224 204 $integrationDetails = json_decode($integrationData->integration_details);
225 205
226 - $entryDetails = [
227 - 'formID' => $this->formID,
228 - 'entryID' => $entryID,
229 - 'fieldValues' => $fieldValues
230 - ];
231 -
232 206 if (empty($integrationDetails->tokenDetails->access_token)) {
233 - (new ApiResponse())->apiResponse($logID, $this->integrationID, ['type' => 'record', 'type_name' => 'insert'], 'error', 'Not Authorization By OneDrive.', $entryDetails);
207 + (new ApiResponse())->apiResponse($logID, $this->integrationID, ['type' => 'record', 'type_name' => 'insert'], 'error', 'Not Authorization By OneDrive.');
234 208 return;
235 209 }
236 210
237 211 $actions = $integrationDetails->actions;
@@ -242,10 +216,8 @@
242 216 if ($tokenDetails->access_token !== $integrationDetails->tokenDetails->access_token) {
243 217 self::saveRefreshedToken($this->formID, $this->integrationID, $tokenDetails);
244 218 }
245 219
246 - $oneDriveRecordApiHelper = new OneDriveRecordApiHelper($tokenDetails->access_token, $this->formID, $entryID);
247 -
248 - $oneDriveRecordApiHelper->executeRecordApi($this->integrationID, $logID, $fieldValues, $fieldMap, $actions, $folderId, $parentId, $this->formID);
220 + (new OneDriveRecordApiHelper($tokenDetails->access_token, $this->formID, $entryID))->executeRecordApi($this->integrationID, $logID, $fieldValues, $fieldMap, $actions, $folderId, $parentId);
249 221 return true;
250 222 }
251 223 }