PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / 2.15.3
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder v2.15.3
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/Admin/Form/Helpers.php +33 -6 2.10.22.15.3 View file →
@@ -8,8 +8,12 @@
8 8 use Exception;
9 9
10 10 class Helpers
11 11 {
12 +
13 + public static $file_upload_types = ['file-up', 'advanced-file-up'];
14 +
15 + public static $repeated_array_type_data_fields = ['check', 'image-select'];
12 16 public static function filterNullEntries($entries)
13 17 {
14 18 $filteredEntries = [];
15 19 foreach ($entries as $entry) {
@@ -222,9 +226,9 @@
222 226 {
223 227 // check if the user is logged in
224 228 if (is_user_logged_in()) {
225 229 $user = wp_get_current_user();
226 - if(in_array('administrator', $user->roles) || current_user_can('manage_bitform')){
230 + if (in_array('administrator', $user->roles) || current_user_can('manage_bitform')) {
227 231 return true;
228 232 }
229 233 $entryModel = new FormEntryModel();
230 234 $entry = $entryModel->get(
@@ -229,28 +233,42 @@
229 233 $entryModel = new FormEntryModel();
230 234 $entry = $entryModel->get(
231 235 'id, user_id, form_id',
232 236 [
233 - 'id' => $entryId,
237 + 'id' => $entryId,
234 238 'user_id' => $user->ID
235 239 ]
236 240 );
237 - error_log(print_r(['entry', $entry], true));
238 - if(!is_wp_error($entry) && !empty($entry)){
241 + if (!is_wp_error($entry) && !empty($entry)) {
239 242 return true;
240 243 }
241 - }
244 + }
242 245 // check if the entry token is valid
243 246 if (isset($entryToken) && $entryToken) {
244 247 $decryptEntryId = Cryptography::decrypt($entryToken, AUTH_SALT);
245 248 if ($decryptEntryId === $entryId) {
246 249 return true;
247 - }
250 + }
248 251 }
249 252
250 253 return false;
251 254 }
252 255
256 + public static function validateEormEntryEditPermission($formId, $entryId)
257 + {
258 + if (is_user_logged_in()) {
259 + if(current_user_can('prevent_bitform_entry_edit')){
260 + return false;
261 + }
262 +
263 + if(current_user_can('manage_bitform')||current_user_can('bitform_entry_edit') || current_user_can('edit_post')){
264 + return true;
265 + }
266 +
267 + }
268 + return false;
269 + }
270 +
253 271 public static function honeypotEncryptedToken($str)
254 272 {
255 273 $token = base64_encode(base64_encode($str));
256 274 return $token;
@@ -274,6 +292,15 @@
274 292 return \hash_equals(
275 293 \base64_encode(\hash_hmac('sha256', $identy, $secretKey, true)),
276 294 $token
277 295 );
296 + }
297 +
298 + public static function checkIsIntArr($arr)
299 + {
300 + $filteredArray = array_filter($arr, 'is_numeric');
301 + $intArray = array_map('intval', $filteredArray);
302 + $result = count($arr) === count($intArray);
303 +
304 + return $result;
278 305 }
279 306 }