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/Database/ReportsModel.php +21 -1 2.10.03.3.1 View file →
@@ -1,5 +1,6 @@
1 1 <?php
2 +
2 3 /**
3 4 * Provides Report Model Class
4 5 */
5 6
@@ -13,11 +14,30 @@
13 14 class ReportsModel extends Model
14 15 {
15 16 protected static $table = 'bitforms_reports';
16 17
18 + /**
19 + * Whether a report payload carries enough to validate.
20 + *
21 + * The save path feeds this the request's `currentReport`, and the React `$reportSelector` atom
22 + * yields `{}` whenever the report list has not resolved — an empty stdClass, which PHP's
23 + * empty() reports as non-empty. Callers must therefore ask before acting on it.
24 + *
25 + * @param mixed $reportData
26 + *
27 + * @return bool
28 + */
29 + public static function isValidatableReport($reportData)
30 + {
31 + return \is_object($reportData) && !empty($reportData->type) && isset($reportData->details);
32 + }
33 +
17 34 public function validateReportFields($reportData, $fieldNames)
18 35 {
19 36 $reportDetails = [];
37 + if (!self::isValidatableReport($reportData)) {
38 + return $reportDetails;
39 + }
20 40 switch ($reportData->type) {
21 41 case 'table':
22 42 $tableAction = 'table_ac';
23 43 $reportDetails = !is_string($reportData->details) ? $reportData->details : json_decode($reportData->details);
@@ -84,9 +104,9 @@
84 104 );
85 105 }
86 106 $result = $this->app_db->query(
87 107 $this->app_db->prepare(
88 - "DELETE FROM $this->table_name $condition_to_check",
108 + "DELETE FROM `{$this->table_name}` $condition_to_check",
89 109 $all_values
90 110 )
91 111 );
92 112 return $this->getResult($result);