PluginProbe
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder / 6.2.12
Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder v6.2.12
6.2.14 6.2.13 6.2.12 6.2.10 6.2.11 6.2.9 6.2.8 6.2.7 6.2.6 6.2.5 6.2.4 6.2.3 6.2.2 3.6.22 3.6.31 3.6.40 3.6.41 3.6.42 3.6.50 3.6.51 3.6.60 3.6.61 3.6.62 3.6.64 3.6.65 All 196 releases
fluentform / app / Http / Controllers / FormIntegrationController.php

FormIntegrationController.php in Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder 6.2.12, at app/Http/Controllers/FormIntegrationController.php

119 lines 4.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentForm\App\Http\Controllers;
4
5 use FluentForm\App\Modules\Acl\Acl;
6 use FluentForm\App\Services\Integrations\FormIntegrationService;
7
8 class FormIntegrationController extends Controller
9 {
10 public function index(FormIntegrationService $integrationService, $formId)
11 {
12 try {
13 $formId = (int) $formId;
14 // SECURITY (FINDING-09): returns full integration feed configurations (webhook
15 // URLs, headers, credential-like fields). The shared `index` method name resolved
16 // to FormPolicy@index (dashboard_access); require forms-manager on this form.
17 if (!Acl::hasPermission('fluentform_forms_manager', $formId)) {
18 return $this->sendError([
19 'message' => __('You do not have permission to view these integrations.', 'fluentform'),
20 ], 403);
21 }
22 return $this->sendSuccess(
23 $integrationService->get($formId)
24 );
25 } catch (\Exception $e) {
26 return $this->sendError([
27 'message' => $e->getMessage(),
28 ], 422);
29 }
30 }
31
32 public function find(FormIntegrationService $integrationService, $formId)
33 {
34 try {
35 $attributes = $this->request->all();
36 $attributes['form_id'] = (int) $formId;
37
38 $integration = $integrationService->find($attributes);
39 return $this->sendSuccess($integration);
40 } catch (\Exception $e) {
41 return $this->sendError([
42 'message' => $e->getMessage(),
43 ], 422);
44 }
45 }
46
47 public function update(FormIntegrationService $integrationService, $formId)
48 {
49 try {
50 $attributes = $this->request->all();
51 $attributes['form_id'] = (int) $formId;
52
53 $integration = $integrationService->update($attributes);
54 return $this->sendSuccess($integration);
55 } catch (\Exception $e) {
56 return $this->sendError([
57 'message' => $e->getMessage()
58 ], 422);
59 }
60 }
61
62 public function delete(FormIntegrationService $integrationService, $formId)
63 {
64 try {
65 $formId = (int) $formId;
66 $id = intval($this->request->get('integration_id'));
67 $integrationService->delete($id, $formId);
68 return $this->sendSuccess([
69 'message' => __('Successfully deleted the Integration.', 'fluentform'),
70 ], 200);
71 } catch (\Exception $e) {
72 return $this->sendError([
73 'message' => $e->getMessage(),
74 ], 422);
75 }
76 }
77
78 public function integrationListComponent($formId)
79 {
80 try {
81 $attributes = $this->request->all();
82 $attributes['form_id'] = (int) $formId;
83
84 $sanitizeMap = [
85 'integration_name' => 'sanitize_text_field',
86 'list_id' => 'sanitize_text_field',
87 ];
88 $attributes = fluentform_backend_sanitizer($attributes, $sanitizeMap);
89
90 $integrationName = $attributes['integration_name'];
91 $formId = (int)$attributes['form_id'];
92 $listId = $attributes['list_id'];
93 $merge_fields = false;
94 $merge_fields = apply_filters_deprecated(
95 'fluentform_get_integration_merge_fields_' . $integrationName,
96 [
97 $merge_fields,
98 $listId,
99 $formId
100 ],
101 FLUENTFORM_FRAMEWORK_UPGRADE,
102 'fluentform/get_integration_merge_fields_' . $integrationName,
103 'Use fluentform/get_integration_merge_fields_' . $integrationName . ' instead of fluentform_get_integration_merge_fields_' . $integrationName
104 );
105
106 $merge_fields = apply_filters('fluentform/get_integration_merge_fields_' . $integrationName, $merge_fields, $listId, $formId);
107
108 return $this->sendSuccess([
109 'merge_fields' => $merge_fields,
110 ]);
111 } catch (\Exception $e) {
112 return $this->sendError([
113 'message' => $e->getMessage(),
114 ], 422);
115 }
116 }
117
118 }
119