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/Fallback/Report.php +43 -4 2.03.3.1 View file →
@@ -5,15 +5,24 @@
5 5 use BitCode\BitForm\Core\Database\FormModel;
6 6 use BitCode\BitForm\Core\Database\ReportsModel;
7 7 use BitCode\BitForm\Core\Util\IpTool;
8 8
9 -class Report {
10 - public function report() {
9 +class Report
10 +{
11 + public function report()
12 + {
11 13 $reportMdl = new ReportsModel();
12 14 global $wpdb;
13 15 $tablename = $wpdb->prefix . 'bitforms_reports';
14 16
15 - $latestIds = $wpdb->get_results("SELECT MAX(`id`) as latest_id FROM $tablename GROUP BY `context`");
17 + // $latestIds = $wpdb->get_results("SELECT MAX(`id`) as latest_id FROM $tablename GROUP BY `context`");
18 + // Direct query: table name from $wpdb->prefix concatenation (no user input). $wpdb->prepare() cannot parameterize table names.
19 + $wpdb->query(
20 + $wpdb->prepare(
21 + "SELECT MAX(`id`) as latest_id FROM `{$tablename}` GROUP BY `context`"
22 + )
23 + );
24 + $latestIds = $wpdb->last_result;
16 25
17 26 $notDeletedIds = array_column($latestIds, 'latest_id');
18 27
19 28 if (!is_wp_error($latestIds) && count($notDeletedIds) > 0) {
@@ -29,9 +38,9 @@
29 38 ['id']
30 39 );
31 40
32 41 $details = [
33 - 'report_name' => 'All Entries',
42 + 'report_name' => __('All Entries', 'bit-form'),
34 43 'hiddenColumns' => [],
35 44 'pageSize' => 10,
36 45 'sortBy' => [],
37 46 'filters' => [],
@@ -62,8 +71,38 @@
62 71 'updated_at' => $user_details['time'],
63 72 ];
64 73
65 74 $reportMdl->insert($defaultReport);
75 + }
76 + }
77 + }
78 +
79 + public function addHiddenColumns()
80 + {
81 + $reportMdl = new ReportsModel();
82 + $reports = $reportMdl->get(
83 + [
84 + 'id',
85 + 'details',
86 + ],
87 + [
88 + 'category' => 'form',
89 + 'type' => 'table',
90 + ]
91 + );
92 +
93 + foreach ($reports as $report) {
94 + $reportDetails = json_decode($report->details);
95 + if (is_object($reportDetails) && (!property_exists($reportDetails, 'hiddenColumns') || empty($reportDetails->hiddenColumns))) {
96 + $reportDetails->hiddenColumns = ['__user_id', '__user_ip', '__referer', '__user_device', '__created_at', '__updated_at'];
97 + $reportMdl->update(
98 + [
99 + 'details' => wp_json_encode($reportDetails),
100 + ],
101 + [
102 + 'id' => $report->id,
103 + ]
104 + );
66 105 }
67 106 }
68 107 }
69 108 }