PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.9.1
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.9.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 2.10.2 All 137 releases
← All changes | includes/Core/Database/FormEntryLogModel.php +14 -27 3.1.22.9.1 View file →
@@ -13,14 +13,15 @@
13 13 protected static $table = 'bitforms_form_log_details';
14 14
15 15 public function geLogHistory($form_id, $entry_id)
16 16 {
17 - $sql = "SELECT * FROM `{$this->app_db->prefix}bitforms_form_entry_log` where form_entry_id=%d AND form_id=%d order By created_at DESC";
18 - $logs = $this->execute($sql, [$entry_id, $form_id])->getResult();
17 + $sql = "SELECT * FROM `{$this->app_db->prefix}bitforms_form_entry_log` where form_entry_id=$entry_id AND form_id=$form_id order By created_at DESC";
18 +
19 + $logs = $this->execute($sql)->getResult();
19 20 $response = ['success' => true, 'data' => [], 'integrations' => []];
20 21 $ids = [];
21 22 foreach ($logs as $log) {
22 - $ids[] = (int) $log->id;
23 + $ids[] = $log->id;
23 24 }
24 25 if (isset($logs->errors['result_empty'])) {
25 26 wp_send_json($response);
26 27 } else {
@@ -26,21 +27,18 @@
26 27 } else {
27 28 $allLogId = preg_replace('/"/', '', implode(',', $ids));
28 29 $sql2 = "SELECT * FROM `{$this->app_db->prefix}bitforms_form_log_details` WHERE `log_id` IN ($allLogId)";
29 30 $integrations = $this->execute($sql2)->getResult();
30 -
31 + foreach ($logs as $key => $log) {
32 + foreach ($integrations as $integration) {
33 + if ($integration->log_id === $log->id) {
34 + $logs[$key]->integration = true;
35 + }
36 + }
37 + }
31 38 if (isset($integrations->errors['result_empty'])) {
32 39 $integrations = [];
33 - } else {
34 - foreach ($logs as $key => $log) {
35 - foreach ($integrations as $integration) {
36 - if ($integration->log_id === $log->id) {
37 - $logs[$key]->integration = true;
38 - }
39 - }
40 - }
41 40 }
42 -
43 41 wp_send_json(['success' => true, 'data' => $logs, 'integrations' => $integrations]);
44 42 }
45 43 }
46 44
@@ -48,13 +46,9 @@
48 46 {
49 47 if (is_null($entry_id)) {
50 48 return new WP_Error('empty_data', __('Form data is empty', 'bit-form'));
51 49 }
52 - $sql = $this->app_db->prepare(
53 - "SELECT api_type, response_obj FROM `{$this->app_db->prefix}bitforms_form_entry_log` as el JOIN `{$this->app_db->prefix}bitforms_form_log_details` as ld ON ld.log_id = el.id WHERE form_entry_id = %d AND integration_id = %d AND ld.response_type = 'success' ORDER BY el.id DESC LIMIT 1",
54 - $entry_id,
55 - $integ_id
56 - );
50 + $sql = "SELECT api_type, response_obj FROM `{$this->app_db->prefix}bitforms_form_entry_log` as el JOIN `{$this->app_db->prefix}bitforms_form_log_details` as ld ON ld.log_id = el.id WHERE form_entry_id = {$entry_id} AND integration_id = {$integ_id} AND ld.response_type = 'success' ORDER BY el.id DESC LIMIT 1";
57 51
58 52 return $this->app_db->get_results($sql);
59 53 }
60 54
@@ -83,12 +77,9 @@
83 77 }
84 78
85 79 public function get_form_value($form_id = '')
86 80 {
87 - $sql = $this->app_db->prepare(
88 - "SELECT `meta_key`,`meta_value` FROM `{$this->app_db->prefix}bitforms_form_entrymeta` WHERE bitforms_form_entry_id=%d",
89 - $form_id
90 - );
81 + $sql = "SELECT `meta_key`,`meta_value` FROM `{$this->app_db->prefix}bitforms_form_entrymeta` where bitforms_form_entry_id=$form_id";
91 82 return $this->execute($sql)->getResult();
92 83 }
93 84
94 85 public function logUpdate($updateValue, $logID)
@@ -95,12 +86,8 @@
95 86 {
96 87 if (empty($logID)) {
97 88 return false;
98 89 }
99 - $sql = $this->app_db->prepare(
100 - "UPDATE `{$this->app_db->prefix}bitforms_form_entry_log` SET content=%s WHERE id=%d",
101 - $updateValue,
102 - $logID
103 - );
90 + $sql = "UPDATE `{$this->app_db->prefix}bitforms_form_entry_log` SET content='$updateValue' WHERE id=$logID";
104 91 return $this->execute($sql)->getResult();
105 92 }
106 93 }