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/Frontend/FormEntryView.php +16 -7 2.10.03.3.1 View file →
@@ -8,14 +8,22 @@
8 8 class FormEntryView
9 9 {
10 10 public static function preview()
11 11 {
12 - $requestUri = $_SERVER['REQUEST_URI'];
12 + if (!(current_user_can('manage_options') || current_user_can('manage_bitform') || current_user_can('bitform_entry_edit'))) {
13 + auth_redirect();
14 + return;
15 + }
16 + // Read-only: REQUEST_URI and query params used for view dispatch. Capability check enforced above (line 12).
17 + $requestUri = isset($_SERVER['REQUEST_URI']) ? esc_url_raw(wp_unslash($_SERVER['REQUEST_URI'])) : '';
13 18 $uri = explode('/', $requestUri);
14 19
15 - if (is_array($uri) && count($uri) > 0) {
16 - $formID = $uri[count($uri) - 2];
17 - $entryID = $uri[count($uri) - 1];
20 + $formID = isset($_REQUEST['formId']) ? intval(sanitize_text_field(wp_unslash($_REQUEST['formId']))) : null;
21 + $entryID = isset($_REQUEST['entryId']) ? intval(sanitize_text_field(wp_unslash($_REQUEST['entryId']))) : null;
22 +
23 + if (!is_array($formID) && !is_array($entryID) && is_numeric($formID) && is_numeric($entryID)) {
24 + // $formID = $uri[count($uri) - 2];
25 + // $entryID = $uri[count($uri) - 1];
18 26 $attr = ['form_id' => $formID, 'entry_id' => $entryID, 'form_preview' => true];
19 27
20 28 $frontendFormHandler = new FrontendFormHandler();
21 29 $formViewObject = $frontendFormHandler->handleFrontendRenderRequest($attr);
@@ -26,13 +34,14 @@
26 34
27 35 $formHTML = $formViewObject->html;
28 36 $font = $formViewObject->font;
29 37 $bfGlobals = $formViewObject->bfGlobals;
30 -
38 + $configTag = isset($formViewObject->configTag) ? $formViewObject->configTag : '';
39 + $formContent = isset($formViewObject->formContent) ? $formViewObject->formContent : null;
40 +
31 41 set_transient('bitform_form_preview', true);
32 42 $frontendFormHandler->generateJs($formID, $entryID);
33 43 $title = 'BitForm Entry edit';
34 - Render::view('views/entry-edit-page', compact('formID', 'title', 'formHTML', 'font', 'bfGlobals'));
35 -
44 + Render::view('views/entry-edit-page', compact('formID', 'title', 'formHTML', 'font', 'bfGlobals', 'configTag', 'formContent'));
36 45 }
37 46 }
38 47 }