PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.21.4
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.21.4
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/Database/ApiModel.php +120 -109 1.32.21.4 View file →
@@ -1,9 +1,8 @@
1 1 <?php
2 2
3 3 namespace BitCode\BitForm\Core\Database;
4 4
5 -use BitCode\BitForm\Core\Database\Model;
6 5 use BitCode\BitForm\Core\Util\IpTool;
7 6
8 7 /**
9 8 * Undocumented class
@@ -10,139 +9,151 @@
10 9 */
11 10
12 11 class ApiModel extends Model
13 12 {
14 - public function __construct()
15 - {
16 - global $wpdb;
17 - $this->_wpdb = $wpdb;
18 - }
19 - public function getForm()
20 - {
21 - $result = $this->_wpdb->get_results(
22 - "
13 + public $_wpdb;
14 +
15 + public function __construct()
16 + {
17 + global $wpdb;
18 + $this->_wpdb = $wpdb;
19 + }
20 +
21 + public function getForm()
22 + {
23 + $result = $this->_wpdb->get_results(
24 + "
23 25 SELECT form_name,id FROM `{$this->_wpdb->prefix}bitforms_form` WHERE `status`=1 order By created_at DESC
24 26 "
25 - );
26 - return $result;
27 - }
27 + );
28 + return $result;
29 + }
28 30
29 - public function getField($id)
30 - {
31 - $result = $this->_wpdb->get_results(
32 - "
31 + public function getField($id)
32 + {
33 + $result = $this->_wpdb->get_results(
34 + "
33 35 SELECT form_content,id FROM `{$this->_wpdb->prefix}bitforms_form` WHERE `status`=1 AND `id`='$id'
34 36 "
35 - );
36 - return $result;
37 - }
37 + );
38 + return $result;
39 + }
38 40
39 - public function editEntry($entryID)
40 - {
41 - $result = $this->_wpdb->get_results(
42 - "
41 + public function editEntry($entryID)
42 + {
43 + $result = $this->_wpdb->get_results(
44 + "
43 45 SELECT bitforms_form_entry_id,meta_key,meta_value FROM `{$this->_wpdb->prefix}bitforms_form_entrymeta` WHERE `bitforms_form_entry_id`='$entryID'
44 46 "
45 - );
46 - return $result;
47 - }
47 + );
48 + return $result;
49 + }
48 50
49 - public function entryDelete( $entryID )
50 - {
51 - $sql = "DELETE FROM `{$this->_wpdb->prefix}bitforms_form_entrymeta` WHERE `bitforms_form_entry_id` = $entryID";
52 - $result = $this->_wpdb->query($sql);
53 - return $result;
54 - }
51 + public function entryDelete($entryID)
52 + {
53 + $sql = "DELETE FROM `{$this->_wpdb->prefix}bitforms_form_entrymeta` WHERE `bitforms_form_entry_id` = $entryID";
54 + $result = $this->_wpdb->query($sql);
55 + return $result;
56 + }
55 57
56 - public function findRecord($table_name, $column, $value)
57 - {
58 - $result = $this->_wpdb->get_results(
59 - "
58 + public function findRecord($table_name, $column, $value)
59 + {
60 + $result = $this->_wpdb->get_results(
61 + "
60 62 SELECT $column FROM `{$this->_wpdb->prefix}$table_name` WHERE `$column`='$value'
61 63 "
62 - );
63 - return $result;
64 - }
64 + );
65 + return $result;
66 + }
65 67
66 - public function noteCreate($formID, $entryID, $note_details)
67 - {
68 - $ipTool = new IpTool();
69 - $user_details = $ipTool->getUserDetail();
70 - $result = $this->_wpdb->insert(
71 - "{$this->_wpdb->prefix}bitforms_form_entry_relatedinfo",
72 - array(
73 - 'info_type' => 'note',
74 - 'info_details' => $note_details,
75 - 'form_id' => $formID,
76 - 'entry_id' => $entryID,
77 - 'user_id' => $user_details['id'],
78 - 'user_ip' => $user_details['ip'],
79 - 'created_at' => $user_details['time'],
80 - )
81 - );
82 - return $result;
83 - }
68 + public function noteCreate($formID, $entryID, $note_details)
69 + {
70 + $ipTool = new IpTool();
71 + $user_details = $ipTool->getUserDetail();
72 + $result = $this->_wpdb->insert(
73 + "{$this->_wpdb->prefix}bitforms_form_entry_relatedinfo",
74 + [
75 + 'info_type' => 'note',
76 + 'info_details' => $note_details,
77 + 'form_id' => $formID,
78 + 'entry_id' => $entryID,
79 + 'user_id' => $user_details['id'],
80 + 'user_ip' => $user_details['ip'],
81 + 'created_at' => $user_details['time'],
82 + ]
83 + );
84 + return $result;
85 + }
84 86
85 - public function noteList()
86 - {
87 - $result = $this->_wpdb->get_results(
88 - "
87 + public function noteList()
88 + {
89 + $result = $this->_wpdb->get_results(
90 + "
89 91 SELECT * FROM `{$this->_wpdb->prefix}bitforms_form_entry_relatedinfo` WHERE `status`=1
90 92 "
91 - );
92 - return $result;
93 - }
93 + );
94 + return $result;
95 + }
94 96
95 - public function getWorkFlow( $formID ){
96 - $result = $this->_wpdb->get_results(
97 - "
97 + public function getWorkFlow($formID)
98 + {
99 + $result = $this->_wpdb->get_results(
100 + "
98 101 SELECT workflow_name,id FROM `{$this->_wpdb->prefix}bitforms_workflows` WHERE `form_id`= $formID
99 102 "
100 - );
101 - return $result;
102 - }
103 + );
104 + return $result;
105 + }
103 106
104 - public function noteUpdate($noteID, $note_details)
105 - {
106 - $data = array('info_details' => $note_details,);
107 - $result = $this->_wpdb->update(
108 - "{$this->_wpdb->prefix}bitforms_form_entry_relatedinfo",
109 - $data,
110 - array(
111 - 'id' => $noteID,
112 - )
113 - );
114 - return $result;
115 - }
107 + public function noteUpdate($noteID, $note_details)
108 + {
109 + $data = ['info_details' => $note_details];
110 + $result = $this->_wpdb->update(
111 + "{$this->_wpdb->prefix}bitforms_form_entry_relatedinfo",
112 + $data,
113 + [
114 + 'id' => $noteID,
115 + ]
116 + );
117 + return $result;
118 + }
116 119
117 - public function noteDelete($noteID)
118 - {
119 - $sql = "DELETE FROM `{$this->_wpdb->prefix}bitforms_form_entry_relatedinfo` WHERE `id` = $noteID";
120 - $result = $this->_wpdb->query($sql);
121 - return $result;
122 - }
120 + public function noteDelete($noteID)
121 + {
122 + $sql = "DELETE FROM `{$this->_wpdb->prefix}bitforms_form_entry_relatedinfo` WHERE `id` = $noteID";
123 + $result = $this->_wpdb->query($sql);
124 + return $result;
125 + }
123 126
124 - public function get_form_value($entryID){
127 + public function get_form_value($entryID)
128 + {
129 + $sql = "SELECT `meta_key`,`meta_value` FROM `{$this->_wpdb->prefix}bitforms_form_entrymeta` where bitforms_form_entry_id=$entryID";
130 + $result = $this->_wpdb->get_results($sql);
131 + return $result;
132 + }
125 133
126 - $sql = "SELECT `meta_key`,`meta_value` FROM `{$this->_wpdb->prefix}bitforms_form_entrymeta` where bitforms_form_entry_id=$entryID";
127 - $result = $this->_wpdb->get_results($sql);
128 - return $result;
129 -
134 + public function logUpdate($updateValue, $logID)
135 + {
136 + if (empty($logID)) {
137 + return false;
130 138 }
139 + $sql = "UPDATE `{$this->_wpdb->prefix}bitforms_form_entry_log` SET content='$updateValue' WHERE id=$logID";
140 + $result = $this->_wpdb->get_results($sql);
141 + return $result;
142 + }
131 143
132 - public function logUpdate($updateValue, $logID)
133 - {
134 - if (empty($logID)) {
135 - return false;
136 - }
137 - $sql = "UPDATE `{$this->_wpdb->prefix}bitforms_form_entry_log` SET content='$updateValue' WHERE id=$logID";
138 - $result = $this->_wpdb->get_results($sql);
139 - return $result;
140 - }
144 + public function getFormId($formID)
145 + {
146 + $sql = "SELECT form_id FROM `{$this->_wpdb->prefix}bitforms_form_entries` WHERE id=$formID";
147 + $result = $this->_wpdb->get_results($sql);
148 + return $result;
149 + }
141 150
142 - public function getFormId($formID){
143 - $sql = "SELECT form_id FROM `{$this->_wpdb->prefix}bitforms_form_entries` WHERE id=$formID";
144 - $result = $this->_wpdb->get_results($sql);
145 - return $result;
146 - }
147 -
151 + public function getOnSubmitWorkflow($formID)
152 + {
153 + $sql = "SELECT `id`, `workflow_name`, `workflow_type`, `workflow_run`, `workflow_behaviour`, `workflow_status`
154 + FROM `{$this->_wpdb->prefix}bitforms_workflows`
155 + WHERE `form_id`=$formID AND `workflow_type`='onsubmit' order by id desc";
156 + $result = $this->_wpdb->get_results($sql);
157 + return $result;
158 + }
148 159 }