Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/custom-registration-form-builder-with-submission-manager/admin/controllers/class_rm_form_controller.php
+++ b/custom-registration-form-builder-with-submission-manager/admin/controllers/class_rm_form_controller.php
@@ -35,10 +35,17 @@
}
$attach_service = new RM_Attachment_Service();
- $search_term = isset($request->req['rm_form_search']) ? $request->req['rm_form_search'] : null;
- $form_filter = isset($request->req['rm_form_filter']) ? $request->req['rm_form_filter'] : null;
- $sort_by = (isset($request->req['rm_sortby'])) ? $request->req['rm_sortby'] : null;
- $descending = (isset($request->req['rm_descending']) && absint($request->req['rm_descending']) == 0) ? false : true;
+ $search_term = isset($request->req['rm_form_search']) ? $request->req['rm_form_search'] : null;
+ $form_filter = isset($request->req['rm_form_filter']) ? $request->req['rm_form_filter'] : null;
+ $sort_by = (isset($request->req['rm_sortby'])) ? $request->req['rm_sortby'] : null;
+ $allowed_sort_columns = array(
+ 'form_name' => 'form_name',
+ 'created_on' => 'created_on',
+ 'form_id' => 'form_id',
+ 'form_submissions' => 'form_submissions'
+ );
+ $sort_by = isset($allowed_sort_columns[$sort_by]) ? $allowed_sort_columns[$sort_by] : 'created_on';
+ $descending = (isset($request->req['rm_descending']) && absint($request->req['rm_descending']) == 0) ? false : true;
$req_page = (isset($request->req['rm_reqpage']) && $request->req['rm_reqpage'] > 0) ? $request->req['rm_reqpage'] : 1;
$url_params = array(
'page' => 'rm_form_manage',
@@ -785,4 +792,4 @@
$view->render($data); */
}
}
-}
No newline at end of file
+}
--- a/custom-registration-form-builder-with-submission-manager/admin/views/template_rm_field_add.php
+++ b/custom-registration-form-builder-with-submission-manager/admin/views/template_rm_field_add.php
@@ -47,11 +47,11 @@
$bg_b = intval(substr($f_icon->bg_color,4,2),16);
$icon_style = "style="padding:5px;color:#{$f_icon->fg_color};background-color:rgba({$bg_r},{$bg_g},{$bg_b},{$f_icon->bg_alpha});border-radius:{$radius};"";
-$is_icon_selected = !empty($f_icon->codepoint);
-$field_icon_action_label = $is_icon_selected ? RM_UI_Strings::get('LABEL_FIELD_ICON_CHANGE') : RM_UI_Strings::get('LABEL_SELECT');
-$remove_icon_style = $is_icon_selected ? '' : ' style="display:none"';
-$selected_icon_style = $is_icon_selected ? $icon_style : rtrim($icon_style, '"') . 'display:none;"';
-$field_types_array = RM_Utilities::get_field_types(false);
+$is_icon_selected = !empty($f_icon->codepoint);
+$field_icon_action_label = $is_icon_selected ? RM_UI_Strings::get('LABEL_FIELD_ICON_CHANGE') : RM_UI_Strings::get('LABEL_SELECT');
+$remove_icon_style = $is_icon_selected ? '' : ' style="display:none"';
+$selected_icon_style = $is_icon_selected ? $icon_style : rtrim($icon_style, '"') . 'display:none;"';
+$field_types_array = RM_Utilities::get_field_types(false);
wp_enqueue_style( 'rm_material_icons', RM_BASE_URL . 'admin/css/material-icons.css' );
echo "<style>#id_show_selected_icon {background-color:rgba(".esc_html("$bg_r,$bg_g,$bg_b,$f_icon->bg_alpha").")}</style>";
@@ -207,7 +207,7 @@
$form->addElement(new Element_HTML('<div class="rmrow rm_field_settings_group_header rm_icon_sett_collapsed" id="rm_icon_field_settings_header" onclick="rm_toggle_icon_settings()"><a>' . RM_UI_Strings::get('ICON_FIELD_SETTINGS') . '<span class="rm-toggle-settings"></span></a></div>'));
$form->addElement(new Element_HTML('<div id="rm_icon_field_settings_container" style="display:none">'));
$form->addElement(new Element_HTML('<div id="rm_icon_setting_container">'));
-$form->addElement(new Element_HTML('<div class="rmrow" id="rm_jqnotice_row_date_type"><div class="rmfield" for="rm_field_value_options_textarea"><label>'.RM_UI_Strings::get('LABEL_FIELD_ICON').'</label></div><div class="rminput" id="rm_field_icon_chosen"><i class="material-icons" '.$selected_icon_style.' id="id_show_selected_icon">'.$f_icon->codepoint.'</i><div class="rm-icon-action"><div class="rm_show_icons" onclick="show_icon_reservoir()"><a>'.$field_icon_action_label.'</a></div> <div class="rm_remove_icon" onclick="rm_remove_icon()"'.$remove_icon_style.'><a>'.RM_UI_Strings::get('LABEL_REMOVE').'</a></div></div></div><div class="rmnote"><div class="rmprenote"></div><div class="rmnotecontent">'.RM_UI_Strings::get('HELP_FIELD_ICON').'</div></div></div>'));
+$form->addElement(new Element_HTML('<div class="rmrow" id="rm_jqnotice_row_date_type"><div class="rmfield" for="rm_field_value_options_textarea"><label>'.RM_UI_Strings::get('LABEL_FIELD_ICON').'</label></div><div class="rminput" id="rm_field_icon_chosen"><i class="material-icons" '.$selected_icon_style.' id="id_show_selected_icon">'.$f_icon->codepoint.'</i><div class="rm-icon-action"><div class="rm_show_icons" onclick="show_icon_reservoir()"><a>'.$field_icon_action_label.'</a></div> <div class="rm_remove_icon" onclick="rm_remove_icon()"'.$remove_icon_style.'><a>'.RM_UI_Strings::get('LABEL_REMOVE').'</a></div></div></div><div class="rmnote"><div class="rmprenote"></div><div class="rmnotecontent">'.RM_UI_Strings::get('HELP_FIELD_ICON').'</div></div></div>'));
$form->addElement(new Element_Hidden('input_selected_icon_codepoint', $f_icon->codepoint, array('id'=>'id_input_selected_icon')));
$form->addElement(new Element_Color(RM_UI_Strings::get('LABEL_FIELD_ICON_FG_COLOR'), "icon_fg_color", array("id" => "rm_", "value" => $f_icon->fg_color, "onchange" => "change_icon_fg_color(this)", "longDesc" => RM_UI_Strings::get('HELP_FIELD_ICON_FG_COLOR'))));
@@ -287,7 +287,7 @@
}
}
$non_meta_fields= array('Price','ImageV','Shortcode','MapV','SubCountV','Form_Chart','FormData','Feed','Username','UserPassword','Privacy','WCBilling','WCShipping','WCBillingPhone','Fname','Lname','BInfo','Nickname','SecEmail','Website');
-if(!in_array($data->selected_field, $non_meta_fields) && $data->is_registration_form){
+if(!in_array($data->selected_field, $non_meta_fields)){
$form->addElement(new Element_HTML("<div id='rm_user_meta_options'>"));
$form->addElement(new Element_Radio(__('Add Field to WordPress User Profile','custom-registration-form-builder-with-submission-manager').":", "field_user_profile",$meta_options, array("id" => "field_user_profile", "value" =>$data->model->field_options->field_user_profile, "longDesc"=>__('Saves the field value in a profile field in WordPress User Profile using User Meta. You can create new custom fields in the profile by selecting "Define new user meta key". Please note that this feature only works with user registration forms.','custom-registration-form-builder-with-submission-manager'))));
$display_user_meta_options= $data->model->field_options->field_user_profile=='existing_user_meta' || $data->model->field_options->field_user_profile=='define_new_user_meta' ? '' : 'style="display:none"';
@@ -463,12 +463,12 @@
}
}
- //jQuery('#rm-icon_'+ico_cp).addClass('rm_active_icon');
- jQuery('#id_show_selected_icon').html('');
- jQuery('#id_show_selected_icon').hide();
- jQuery('#id_input_selected_icon').val('');
- jQuery('.rm_show_icons a').html(rmFieldIconSelectLabel);
- jQuery('.rm_remove_icon').hide();
+ //jQuery('#rm-icon_'+ico_cp).addClass('rm_active_icon');
+ jQuery('#id_show_selected_icon').html('');
+ jQuery('#id_show_selected_icon').hide();
+ jQuery('#id_input_selected_icon').val('');
+ jQuery('.rm_show_icons a').html(rmFieldIconSelectLabel);
+ jQuery('.rm_remove_icon').hide();
}
function rm_select_icon(e){
@@ -486,11 +486,11 @@
jQuery('#'+oicid).removeClass('rm_active_icon');
}
- jQuery('#rm-icon_'+ico_cp).addClass('rm_active_icon');
- jQuery('#id_show_selected_icon').html('&#x'+ico_cp);
- jQuery('#id_show_selected_icon').show();
- jQuery('#id_input_selected_icon').val('&#x'+ico_cp);
- jQuery('.rm_show_icons a').html(rmFieldIconChangeLabel);
+ jQuery('#rm-icon_'+ico_cp).addClass('rm_active_icon');
+ jQuery('#id_show_selected_icon').html('&#x'+ico_cp);
+ jQuery('#id_show_selected_icon').show();
+ jQuery('#id_input_selected_icon').val('&#x'+ico_cp);
+ jQuery('.rm_show_icons a').html(rmFieldIconChangeLabel);
jQuery('.rm_remove_icon').show();
jQuery('#id_rm_field_icon_reservoir').hide();
}
--- a/custom-registration-form-builder-with-submission-manager/admin/views/template_rm_form_email_templates.php
+++ b/custom-registration-form-builder-with-submission-manager/admin/views/template_rm_form_email_templates.php
@@ -1,54 +1,73 @@
-<?php
-if (!defined('WPINC')) {
- die('Closed');
-}
-if(defined('REGMAGIC_ADDON')) include_once(RM_ADDON_ADMIN_DIR . 'views/template_rm_form_email_templates.php'); else {
-
-wp_enqueue_style( 'rm_material_icons', RM_BASE_URL . 'admin/css/material-icons.css' );
-?>
-<div class="rmagic">
-
- <!--Dialogue Box Starts-->
- <div class="rmcontent">
-
-
- <?php
- $form = new RM_PFBC_Form("form_sett_email_templates");
- $form->configure(array(
- "prevent" => array("bootstrap", "jQuery"),
- "action" => ""
- ));
-
- if (isset($data->model->form_id)) {
- $form->addElement(new Element_HTML('<div class="rmheader">' . $data->model->form_name . '</div>'));
- $form->addElement(new Element_HTML('<div class="rmsettingtitle">' . RM_UI_Strings::get('LABEL_F_EMAIL_TEMP_SETT') . '</div>'));
- $form->addElement(new Element_HTML('<div class="rmrow"><div class="rmnotice">More email configuration settings are available in <a target="_blank" href="admin.php?page=rm_options_autoresponder">Global Settings</a>.</div></div>'));
- $form->addElement(new Element_Hidden("form_id", $data->model->form_id));
- }
-
- $form->addElement(new Element_HTML('<div class="rmrow"><h3>'.__('Notification Templates for User', 'custom-registration-form-builder-with-submission-manager').'</h3></div>'));
-
- $form->addElement(new Element_Textbox("<b>" . RM_UI_Strings::get('LABEL_NEW_USER_EMAIL_SUB') . "</b>", "form_nu_notification_sub", array("class" => "rm_static_field", "value" => $data->model->form_options->form_nu_notification_sub, "longDesc"=>RM_UI_Strings::get('HELP_ADD_FORM_NU_EMAIL_SUB'))));
- $form->addElement(new Element_TinyMCEWP("<b>" . RM_UI_Strings::get('LABEL_NEW_USER_EMAIL') . "</b>(".__('Mail Merge and HTML Supported', 'custom-registration-form-builder-with-submission-manager')."):", $data->model->get_notification_messages('form_nu_notification'), "form_nu_notification", array('editor_class' => 'rm_TinydMCE', 'editor_height' => '100px'), array("longDesc" => RM_UI_Strings::get('HELP_ADD_FORM_NU_EMAIL_MSG'))));
-
- $form->addElement(new Element_Textbox("<b>" . RM_UI_Strings::get('LABEL_USER_ACTIVATION_EMAIL_SUB') . "</b>", "form_user_activated_notification_sub", array("class" => "rm_static_field", "value" => $data->model->form_options->form_user_activated_notification_sub, "longDesc"=>RM_UI_Strings::get('HELP_ADD_FORM_USER_ACTIVATED_SUB'))));
- $form->addElement(new Element_TinyMCEWP("<b>" . RM_UI_Strings::get('LABEL_USER_ACTIVATION_EMAIL') . "</b>(".__('Mail Merge and HTML Supported', 'custom-registration-form-builder-with-submission-manager')."):", $data->model->get_notification_messages('form_user_activated_notification'), "form_user_activated_notification", array('editor_class' => 'rm_TinydMCE', 'editor_height' => '100px'), array("longDesc" => RM_UI_Strings::get('HELP_ADD_FORM_USER_ACTIVATED_MSG'))));
-
- $form->addElement(new Element_Textbox("<b>" . RM_UI_Strings::get('LABEL_USER_PAYMENT_INVOICE_EMAIL_SUB') . "</b>", "form_user_payment_invoice_sub", array("class" => "rm_static_field", "value" => $data->model->form_options->form_user_payment_invoice_sub, "longDesc"=>RM_UI_Strings::get('HELP_ADD_FORM_USER_PI_SUB'))));
- $form->addElement(new Element_TinyMCEWP("<b>" . RM_UI_Strings::get('LABEL_USER_PAYMENT_INVOICE_EMAIL') . "</b>(".__('Mail Merge and HTML Supported', 'custom-registration-form-builder-with-submission-manager')."):", $data->model->get_notification_messages('form_user_payment_invoice'), "form_user_payment_invoice", array('editor_class' => 'rm_TinydMCE', 'editor_height' => '100px'), array("longDesc" => RM_UI_Strings::get('HELP_ADD_FORM_USER_PI_MSG'))));
-
- $form->addElement(new Element_HTML('<div class="rmrow"><h3>Notification Templates for Admin</h3></div>'));
-
- //$form->addElement(new Element_TinyMCEWP("<b>" . RM_UI_Strings::get('LABEL_ACTIVATE_USER_EMAIL') . "</b>(Mail Merge and HTML Supported):", $data->model->get_notification_messages('form_activate_user_notification'), "form_activate_user_notification", array('editor_class' => 'rm_TinydMCE', 'editor_height' => '100px'), array("longDesc" => RM_UI_Strings::get('HELP_ADD_FORM_ACTIVATE_USER_MSG'))));
- $form->addElement(new Element_Textbox("<b>" . RM_UI_Strings::get('LABEL_ADMIN_NEW_SUBMISSION_EMAIL_SUB') . "</b>", "form_admin_ns_notification_sub", array("class" => "rm_static_field", "value" => $data->model->form_options->form_admin_ns_notification_sub, "longDesc"=>RM_UI_Strings::get('HELP_ADD_FORM_ADMIN_NS_SUB'))));
- $form->addElement(new Element_TinyMCEWP("<b>" . RM_UI_Strings::get('LABEL_ADMIN_NEW_SUBMISSION_EMAIL') . "</b>(".__('Mail Merge and HTML Supported', 'custom-registration-form-builder-with-submission-manager')."):", $data->model->get_notification_messages('form_admin_ns_notification'), "form_admin_ns_notification", array('editor_class' => 'rm_TinydMCE', 'editor_height' => '100px'), array("longDesc" => RM_UI_Strings::get('HELP_ADD_FORM_ADMIN_NS_MSG').RM_UI_Strings::get('MSG_BUY_PRO_INLINE'))));
-
- $form->addElement(new Element_HTMLL('← '.__('Cancel','custom-registration-form-builder-with-submission-manager'), '?page='.$data->next_page.'&rm_form_id=' . $data->model->form_id, array('class' => 'cancel')));
- $form->addElement(new Element_Button(RM_UI_Strings::get('LABEL_SAVE'), "submit", array("id" => "rm_submit_btn", "class" => "rm_btn", "name" => "submit", "onClick" => "jQuery.prevent_field_add(event,'".__('This is a required field.','custom-registration-form-builder-with-submission-manager')."')")));
- $form->render();
- ?>
- </div>
-</div>
-
-
-<?php } ?>
+<?php
+if (!defined('WPINC')) {
+ die('Closed');
+}
+if(defined('REGMAGIC_ADDON')) include_once(RM_ADDON_ADMIN_DIR . 'views/template_rm_form_email_templates.php'); else {
+
+wp_enqueue_style( 'rm_material_icons', RM_BASE_URL . 'admin/css/material-icons.css' );
+?>
+<div class="rmagic">
+
+ <!--Dialogue Box Starts-->
+ <div class="rmcontent">
+
+
+ <?php
+ $form = new RM_PFBC_Form("form_sett_email_templates");
+ $form->configure(array(
+ "prevent" => array("bootstrap", "jQuery"),
+ "action" => ""
+ ));
+
+ if (isset($data->model->form_id)) {
+ $form->addElement(new Element_HTML('<div class="rmheader">' . $data->model->form_name . '</div>'));
+ $form->addElement(new Element_HTML('<div class="rmsettingtitle">' . RM_UI_Strings::get('LABEL_F_EMAIL_TEMP_SETT') . '</div>'));
+ $form->addElement(new Element_HTML('<div class="rmrow"><div class="rmnotice">More email configuration settings are available in <a target="_blank" href="admin.php?page=rm_options_autoresponder">Global Settings</a>.</div></div>'));
+ $form->addElement(new Element_Hidden("form_id", $data->model->form_id));
+ }
+
+ $form->addElement(new Element_HTML('<div class="rmrow"><h3>'.__('Notification Templates for User', 'custom-registration-form-builder-with-submission-manager').'</h3></div>'));
+
+ $form->addElement(new Element_Textbox("<b>" . RM_UI_Strings::get('LABEL_NEW_USER_EMAIL_SUB') . "</b>", "form_nu_notification_sub", array("class" => "rm_static_field", "value" => $data->model->form_options->form_nu_notification_sub, "longDesc"=>RM_UI_Strings::get('HELP_ADD_FORM_NU_EMAIL_SUB'))));
+ $form->addElement(new Element_TinyMCEWP("<b>" . RM_UI_Strings::get('LABEL_NEW_USER_EMAIL') . "</b>(".__('Mail Merge and HTML Supported', 'custom-registration-form-builder-with-submission-manager')."):", $data->model->get_notification_messages('form_nu_notification'), "form_nu_notification", array('editor_class' => 'rm_TinydMCE', 'editor_height' => '100px'), array("longDesc" => RM_UI_Strings::get('HELP_ADD_FORM_NU_EMAIL_MSG'))));
+
+ $form->addElement(new Element_Textbox("<b>" . RM_UI_Strings::get('LABEL_USER_ACTIVATION_EMAIL_SUB') . "</b>", "form_user_activated_notification_sub", array("class" => "rm_static_field", "value" => $data->model->form_options->form_user_activated_notification_sub, "longDesc"=>RM_UI_Strings::get('HELP_ADD_FORM_USER_ACTIVATED_SUB'))));
+ $form->addElement(new Element_TinyMCEWP("<b>" . RM_UI_Strings::get('LABEL_USER_ACTIVATION_EMAIL') . "</b>(".__('Mail Merge and HTML Supported', 'custom-registration-form-builder-with-submission-manager')."):", $data->model->get_notification_messages('form_user_activated_notification'), "form_user_activated_notification", array('editor_class' => 'rm_TinydMCE', 'editor_height' => '100px'), array("longDesc" => RM_UI_Strings::get('HELP_ADD_FORM_USER_ACTIVATED_MSG'))));
+
+ $form->addElement(new Element_Textbox("<b>" . RM_UI_Strings::get('LABEL_USER_PAYMENT_INVOICE_EMAIL_SUB') . "</b>", "form_user_payment_invoice_sub", array("class" => "rm_static_field", "value" => $data->model->form_options->form_user_payment_invoice_sub, "longDesc"=>RM_UI_Strings::get('HELP_ADD_FORM_USER_PI_SUB'))));
+ $form->addElement(new Element_TinyMCEWP("<b>" . RM_UI_Strings::get('LABEL_USER_PAYMENT_INVOICE_EMAIL') . "</b>(".__('Mail Merge and HTML Supported', 'custom-registration-form-builder-with-submission-manager')."):", $data->model->get_notification_messages('form_user_payment_invoice'), "form_user_payment_invoice", array('editor_class' => 'rm_TinydMCE', 'editor_height' => '100px'), array("longDesc" => RM_UI_Strings::get('HELP_ADD_FORM_USER_PI_MSG'))));
+
+ $form->addElement(new Element_HTML('<div class="rmrow"><h3>Notification Templates for Admin</h3></div>'));
+
+ //$form->addElement(new Element_TinyMCEWP("<b>" . RM_UI_Strings::get('LABEL_ACTIVATE_USER_EMAIL') . "</b>(Mail Merge and HTML Supported):", $data->model->get_notification_messages('form_activate_user_notification'), "form_activate_user_notification", array('editor_class' => 'rm_TinydMCE', 'editor_height' => '100px'), array("longDesc" => RM_UI_Strings::get('HELP_ADD_FORM_ACTIVATE_USER_MSG'))));
+ $admin_ns_subject_field_service = new RM_Editor_Actions_Service();
+ $admin_ns_subject_fields = $admin_ns_subject_field_service->add_email($data->model->form_id);
+ $admin_ns_subject_field_select = '';
+ if (!empty($admin_ns_subject_fields)) {
+ $admin_ns_subject_field_options = '<option value="0">' . esc_html(RM_UI_Strings::get("LABEL_ADD_EMAIL")) . '</option>';
+ foreach ($admin_ns_subject_fields as $admin_ns_subject_field) {
+ $admin_ns_subject_field_value = $admin_ns_subject_field->field_type . '_' . $admin_ns_subject_field->field_id;
+ $admin_ns_subject_field_type = strtolower($admin_ns_subject_field->field_type);
+ if ($admin_ns_subject_field_type == 'username') {
+ $admin_ns_subject_field_value = 'Username';
+ } else if ($admin_ns_subject_field_type == 'userpassword') {
+ $admin_ns_subject_field_value = 'UserPassword';
+ }
+ $admin_ns_subject_field_options .= '<option value="' . esc_attr($admin_ns_subject_field_value) . '">' . esc_html($admin_ns_subject_field->field_label) . '</option>';
+ }
+ $admin_ns_subject_field_select = '<select id="rm_editor_add_admin_ns_email_subject">' . $admin_ns_subject_field_options . '</select>';
+ }
+ $form->addElement(new Element_HTML(
+ '<div class="rmrow"><div class="rmfield" for="form_admin_ns_notification_sub"><label><b>' . RM_UI_Strings::get('LABEL_ADMIN_NEW_SUBMISSION_EMAIL_SUB') . '</b></label></div><div class="rminput"><div class="rm-notification-sb-wrap"><input type="text" name="form_admin_ns_notification_sub" id="form_admin_ns_notification_sub" class="rm_static_field" value="' . esc_attr($data->model->form_options->form_admin_ns_notification_sub) . '">' . $admin_ns_subject_field_select . '</div></div><div class="rmnote"><div class="rmprenote"></div><div class="rmnotecontent">' . RM_UI_Strings::get('HELP_ADD_FORM_ADMIN_NS_SUB') . '</div></div></div>'
+ ));
+ $form->addElement(new Element_TinyMCEWP("<b>" . RM_UI_Strings::get('LABEL_ADMIN_NEW_SUBMISSION_EMAIL') . "</b>(".__('Mail Merge and HTML Supported', 'custom-registration-form-builder-with-submission-manager')."):", $data->model->get_notification_messages('form_admin_ns_notification'), "form_admin_ns_notification", array('editor_class' => 'rm_TinydMCE', 'editor_height' => '100px'), array("longDesc" => RM_UI_Strings::get('HELP_ADD_FORM_ADMIN_NS_MSG').RM_UI_Strings::get('MSG_BUY_PRO_INLINE'))));
+
+ $form->addElement(new Element_HTMLL('← '.__('Cancel','custom-registration-form-builder-with-submission-manager'), '?page='.$data->next_page.'&rm_form_id=' . $data->model->form_id, array('class' => 'cancel')));
+ $form->addElement(new Element_Button(RM_UI_Strings::get('LABEL_SAVE'), "submit", array("id" => "rm_submit_btn", "class" => "rm_btn", "name" => "submit", "onClick" => "jQuery.prevent_field_add(event,'".__('This is a required field.','custom-registration-form-builder-with-submission-manager')."')")));
+ $form->render();
+ ?>
+ </div>
+</div>
+
+
+<?php } ?>
--- a/custom-registration-form-builder-with-submission-manager/external/PFBC/Element/Terms.php
+++ b/custom-registration-form-builder-with-submission-manager/external/PFBC/Element/Terms.php
@@ -48,10 +48,8 @@
$cb_label = '';
$scroll = '';
- $disabled = '';
if($this->required_scroll==1){
$scroll = "scroll_down_end(this);";
- $disabled='disabled';
}
$checked = '';
@@ -59,7 +57,7 @@
$checked = "checked";
if(isset($this->_attributes["check_above_tc"]) && $this->_attributes["check_above_tc"] == 1)
- echo "<div class='rm_terms_checkbox'><input ",esc_attr($checked)," ",esc_attr($disabled)," value='on' type='checkbox'", wp_kses_post((string)$this->getAttributes(array("default_value", "value"))), " class='rm_check_box'>".wp_kses_post((string)$cb_label)."</div>";
+ $this->render_checkbox($checked, $cb_label);
echo "<div id='rm_terms_textarea' class='rm_terms_textarea'><textarea ", wp_kses_post((string)$style) ," onscroll='",esc_js($scroll),"' readonly id='rm_terms_area_", esc_attr($this->_attributes['name']), "' class='rm_terms_area'>";
@@ -68,9 +66,47 @@
echo "</textarea></div>";
if(!isset($this->_attributes["check_above_tc"]) || $this->_attributes["check_above_tc"] == 0)
- echo "<div class='rm_terms_checkbox'><input ",esc_attr($checked)," ",esc_attr($disabled)," value='on' type='checkbox'", wp_kses_post((string)$this->getAttributes(array("default_value", "value"))), " class='rm_check_box'>".wp_kses_post((string)$cb_label)."</div>";
+ $this->render_checkbox($checked, $cb_label);
}
+ protected function render_checkbox($checked, $cb_label)
+ {
+ $classes = 'rm_check_box';
+ if ($this->required_scroll == 1) {
+ $classes .= ' rm_terms_scroll_required';
+ }
+ if (!empty($this->_attributes['class'])) {
+ $classes .= ' ' . $this->_attributes['class'];
+ }
+
+ $scroll_attrs = '';
+ if ($this->required_scroll == 1) {
+ $scroll_complete = $checked === 'checked' ? '1' : '0';
+ $aria_disabled = $checked === 'checked' ? 'false' : 'true';
+ $scroll_attrs = " data-rm-terms-scroll-required='1' data-rm-terms-scroll-complete='" . esc_attr($scroll_complete) . "' aria-disabled='" . esc_attr($aria_disabled) . "'";
+ }
+
+ echo "<div class='rm_terms_checkbox'><input ", esc_attr($checked), " value='on' type='checkbox'", wp_kses_post((string)$this->getAttributes(array("default_value", "value", "class"))), " class='", esc_attr($classes), "'", wp_kses_post((string)$scroll_attrs), ">".wp_kses_post((string)$cb_label)."</div>";
+ }
+
+ public function isValid($value, $form_id)
+ {
+ if ($this->is_terms_required() && $value !== 'on') {
+ $element = !empty($this->label) ? $this->label : $this->_attributes["name"];
+ if(substr($element, -1) == ":")
+ $element = substr($element, 0, -1);
+ $this->_errors[] = " <b>'" . $element . "'</b> " . RM_UI_Strings::get("ERROR_REQUIRED");
+ return false;
+ }
+
+ return parent::isValid($value, $form_id);
+ }
+
+ protected function is_terms_required()
+ {
+ return $this->isRequired() || array_key_exists('required', $this->_attributes);
+ }
+
public function getAttributes($ignore = "") {
--- a/custom-registration-form-builder-with-submission-manager/includes/class_rm_dbmanager.php
+++ b/custom-registration-form-builder-with-submission-manager/includes/class_rm_dbmanager.php
@@ -1202,16 +1202,17 @@
__FUNCTION__ . " needs the second argument to be an array or 1,'" . gettype($where) . "'is passed.");
}
- if ($descending === false) {
- if (!$limit)
- $qry .= "ORDER BY `$sort_by`";
- else
- $qry .= "ORDER BY `$sort_by` LIMIT $limit OFFSET $offset";
- } else {
- if (!$limit)
- $qry .= "ORDER BY `$sort_by` DESC";
- else
- $qry .= "ORDER BY `$sort_by` DESC LIMIT $limit OFFSET $offset";
+ $sort_by = is_string($sort_by) ? trim($sort_by) : '';
+ $limit = absint($limit);
+ $offset = absint($offset);
+ if ($sort_by !== '' && preg_match('/^[A-Za-z0-9_]+$/', $sort_by)) {
+ $qry .= " ORDER BY `$sort_by`";
+ if ($descending !== false)
+ $qry .= " DESC";
+ }
+
+ if ($limit) {
+ $qry .= " LIMIT $limit OFFSET $offset";
}
if ($result_type === 'results' || $result_type === 'row' || $result_type === 'var' || $result_type === 'col') {
@@ -1720,13 +1721,17 @@
return $wpdb->query($qry);
}
- public static function update_last_activity() {
+ public static function update_last_activity($otp_code = null) {
global $wpdb;
$table_name = RM_Table_Tech::get_table_name_for('FRONT_USERS');
- return $wpdb->query("UPDATE $table_name set `last_activity_time`= '" . RM_Utilities::get_current_time() . "'");
+ if (!empty($otp_code)) {
+ return $wpdb->query($wpdb->prepare("UPDATE $table_name set `last_activity_time`= %s WHERE `otp_code` = %s", RM_Utilities::get_current_time(), $otp_code));
+ }
+
+ return $wpdb->query($wpdb->prepare("UPDATE $table_name set `last_activity_time`= %s", RM_Utilities::get_current_time()));
}
public static function delete_rows($model_identifier, $where, $where_format = null) {
@@ -3212,4 +3217,4 @@
return $wpdb->get_results($qry);
}
-}
No newline at end of file
+}
--- a/custom-registration-form-builder-with-submission-manager/libs/factory/class_rm_field_factory_revamp.php
+++ b/custom-registration-form-builder-with-submission-manager/libs/factory/class_rm_field_factory_revamp.php
@@ -1798,9 +1798,13 @@
if (isset($field->field_options->field_css_class)){
$attributes['class'] .= " ".$field->field_options->field_css_class;
}
- if (isset($field->field_options->field_is_required_scroll) && $field->field_options->field_is_required_scroll == 1){
- $attributes['disabled'] = "disabled";
- }
+ $requires_scroll = isset($field->field_options->field_is_required_scroll) && $field->field_options->field_is_required_scroll == 1;
+ if ($requires_scroll) {
+ $attributes['class'] .= ' rm_terms_scroll_required';
+ $attributes['data-rm-terms-scroll-required'] = '1';
+ $attributes['data-rm-terms-scroll-complete'] = '0';
+ $attributes['aria-disabled'] = 'true';
+ }
$meta_value = "";
if(isset($old_value)) {
$meta_value = $old_value;
@@ -1812,9 +1816,13 @@
$meta_value = get_user_meta(get_current_user_id(), $field->field_options->field_meta_add, true);
}
}
- if($meta_value == $attributes['value']) {
- $attributes['checked'] = 'checked';
- }
+ if($meta_value == $attributes['value']) {
+ $attributes['checked'] = 'checked';
+ if ($requires_scroll) {
+ $attributes['data-rm-terms-scroll-complete'] = '1';
+ $attributes['aria-disabled'] = 'false';
+ }
+ }
$text = $field->field_label;
$check_box_label = $field->field_options->tnc_cb_label;
@@ -1848,15 +1856,15 @@
echo "<input " . $this->print_attributes($attributes) . " >";
echo "<label for='$input_id' id='$label_id' class='rmform-label'> $check_box_label </label>";
- echo "</div>";
-
- echo "<div class='rmform-terms-textarea'>";
- echo "<textarea onscroll='scroll_down_end(this);' readonly class='rmform-terms-text-area' >".wp_kses_post((string)$field->field_value)."</textarea>";
- echo "</div>";
- } else {
- echo "<div class='rmform-terms-textarea'>";
- echo "<textarea onscroll='scroll_down_end(this);' readonly class='rmform-terms-text-area' >".wp_kses_post((string)$field->field_value)."</textarea>";
- echo "</div>";
+ echo "</div>";
+
+ echo "<div class='rmform-terms-textarea'>";
+ echo "<textarea onscroll='scroll_down_end(this);' readonly class='rmform-terms-text-area rm_terms_area' >".wp_kses_post((string)$field->field_value)."</textarea>";
+ echo "</div>";
+ } else {
+ echo "<div class='rmform-terms-textarea'>";
+ echo "<textarea onscroll='scroll_down_end(this);' readonly class='rmform-terms-text-area rm_terms_area' >".wp_kses_post((string)$field->field_value)."</textarea>";
+ echo "</div>";
echo "<div class='rmform-terms-checkbox'>";
if (isset($field->field_options->field_is_required) && $field->field_options->field_is_required == 1) {
--- a/custom-registration-form-builder-with-submission-manager/libs/factory/class_rm_form_factory_revamp.php
+++ b/custom-registration-form-builder-with-submission-manager/libs/factory/class_rm_form_factory_revamp.php
@@ -564,13 +564,17 @@
$db_data[$field_id] = $data_block;
}
- } else {
- if(in_array($form->fields[$field_id]->field_type, array('WCBilling','WCShipping'))) {
- $field_name = strtolower($field_name);
- }
- if(isset($sub_data[$field_name])) {
- // Validating social fields
- if(!empty($sub_data[$field_name])) {
+ } else {
+ if(in_array($form->fields[$field_id]->field_type, array('WCBilling','WCShipping'))) {
+ $field_name = strtolower($field_name);
+ }
+ if(!$save_submission && $form->fields[$field_id]->field_type == 'Terms' && absint($form->fields[$field_id]->field_options->field_is_required) == 1 && (!isset($sub_data[$field_name]) || $sub_data[$field_name] !== 'on')) {
+ array_push($errors, sprintf(esc_html__('%s is a required field','custom-registration-form-builder-with-submission-manager'), $form->fields[$field_id]->field_label));
+ continue;
+ }
+ if(isset($sub_data[$field_name])) {
+ // Validating social fields
+ if(!empty($sub_data[$field_name])) {
foreach($social_validation_arr as $social_k => $social_v) {
if($form->fields[$field_id]->field_type == $social_k) {
if(!preg_match($social_v, $sub_data[$field_name])) {
--- a/custom-registration-form-builder-with-submission-manager/public/controllers/class_rm_front_form_controller.php
+++ b/custom-registration-form-builder-with-submission-manager/public/controllers/class_rm_front_form_controller.php
@@ -302,10 +302,37 @@
/*if (count($rm_form_diary) > 0 && !isset($params['force_enable_multiform']))
return;*/
- $params['form_id'] = $request->req['form_id'];
- if (isset($params['form_id'],$request->req['submission_id']) && $params['form_id'] && $request->req['submission_id']) {
+ $front_service = new RM_Front_Service;
+ $authorized_email = $front_service->get_user_email();
+ if (empty($authorized_email)) {
+ return;
+ }
+
+ $params['form_id'] = isset($request->req['form_id']) ? absint($request->req['form_id']) : 0;
+ $requested_submission_id = isset($request->req['submission_id']) ? absint($request->req['submission_id']) : 0;
+ if (isset($params['form_id'], $request->req['submission_id']) && $params['form_id'] && $requested_submission_id) {
$form_id = $params['form_id'];
- $request->req['submission_id'] = $service->get_latest_submission_from_group($request->req['submission_id']);
+ $latest_submission_id = absint($service->get_latest_submission_from_group($requested_submission_id));
+ if (!$latest_submission_id) {
+ return;
+ }
+
+ $submission = new RM_Submissions;
+ if (!$submission->load_from_db($latest_submission_id)) {
+ return;
+ }
+
+ $nonce_email = strtolower((string) $authorized_email);
+ if ((int) $submission->get_form_id() !== (int) $form_id || strtolower((string) $submission->get_user_email()) !== $nonce_email) {
+ return;
+ }
+
+ $nonce = isset($request->req['rm_edit_sub_nonce']) ? sanitize_text_field(wp_unslash($request->req['rm_edit_sub_nonce'])) : '';
+ if (!wp_verify_nonce($nonce, 'rm_edit_submission_' . $latest_submission_id . '_' . $nonce_email)) {
+ return;
+ }
+
+ $request->req['submission_id'] = $latest_submission_id;
$fe_form = $this->form_factory->create_form_prefilled($form_id,$request->req['submission_id']);
$form_name = 'form_' . $fe_form->get_form_id();
} else {
@@ -334,8 +361,8 @@
$db_data = $fe_form->get_prepared_data($request->req, 'dbonly');
- $sub_detail = $service->save_edited_submission($form_id, $request->req['submission_id'], $db_data, $primary_data['user_email']->value);
- do_action('rm_submission_edited', $primary_data['user_email']->value);
+ $sub_detail = $service->save_edited_submission($form_id, $request->req['submission_id'], $db_data, $authorized_email);
+ do_action('rm_submission_edited', $authorized_email);
$form_options = $fe_form->get_form_options();
@@ -373,7 +400,7 @@
$params['paystate'] = 'na';
$fe_form->post_sub_proc($request->req, $params);
- $this->update_user_profile($primary_data['user_email']->value, $db_data, $service);
+ $this->update_user_profile($authorized_email, $db_data, $service);
//redirect user to new submissions page
$form_options->redirection_type = 'url';
@@ -399,4 +426,4 @@
}
}
-}
No newline at end of file
+}
--- a/custom-registration-form-builder-with-submission-manager/public/controllers/class_rm_login_controller.php
+++ b/custom-registration-form-builder-with-submission-manager/public/controllers/class_rm_login_controller.php
@@ -191,15 +191,17 @@
$data->form_type= 'rm_token_form';
$data->invalid_token = 1;
} else {
- $tk = get_user_meta($users[0]->ID,'rm_pass_expiry_token', true);
- $token_expired = false;
- if(!empty($tk) && $tk<time()) {
- $token_expired= true;
- }
- if($token_expired) {
- $data->expired_token = 1;
- $data->form_type= 'rm_recovery_form';
- } else {
+ $tk = get_user_meta($users[0]->ID,'rm_pass_expiry_token', true);
+ $token_expired = false;
+ if($tk === '' || (!empty($tk) && $tk<time())) {
+ $token_expired= true;
+ }
+ if($token_expired) {
+ delete_user_meta($users[0]->ID,'rm_pass_token');
+ delete_user_meta($users[0]->ID,'rm_pass_expiry_token');
+ $data->expired_token = 1;
+ $data->form_type= 'rm_recovery_form';
+ } else {
$data->form_type= 'rm_reset_password_form';
$data->sec_token= $token;
}
@@ -242,19 +244,31 @@
if(empty($token)) {
$data->invalid_copy_token = 1;
} else {
- $users = get_users(array('meta_key' => 'rm_pass_token', 'meta_value' => $token));
- if(!empty($users)){
- $user_id = wp_update_user(array('ID'=>$users[0]->ID,'user_pass' => $request->req['password']));
- if(is_wp_error($user_id)) {
- $data->password_updated = 0;
- } else {
- delete_user_meta($users[0]->ID,'rm_pass_token');
- delete_user_meta($users[0]->ID,'rm_pass_expiry_token');
- $data->password_updated = 1;
- }
- }
- }
- }
+ $users = get_users(array('meta_key' => 'rm_pass_token', 'meta_value' => $token));
+ if(!empty($users)){
+ $tk = get_user_meta($users[0]->ID,'rm_pass_expiry_token', true);
+ $token_expired = false;
+ if($tk === '' || (!empty($tk) && $tk<time())) {
+ $token_expired= true;
+ }
+ if($token_expired) {
+ delete_user_meta($users[0]->ID,'rm_pass_token');
+ delete_user_meta($users[0]->ID,'rm_pass_expiry_token');
+ $data->expired_token = 1;
+ $data->form_type= 'rm_recovery_form';
+ } else {
+ $user_id = wp_update_user(array('ID'=>$users[0]->ID,'user_pass' => $request->req['password']));
+ if(is_wp_error($user_id)) {
+ $data->password_updated = 0;
+ } else {
+ delete_user_meta($users[0]->ID,'rm_pass_token');
+ delete_user_meta($users[0]->ID,'rm_pass_expiry_token');
+ $data->password_updated = 1;
+ }
+ }
+ }
+ }
+ }
}
}
}
@@ -263,4 +277,4 @@
$view = $this->mv_handler->setView('pass_recovery',true);
return $view->read($data);
}
-}
No newline at end of file
+}
--- a/custom-registration-form-builder-with-submission-manager/public/models/class_rm_frontend_form_multipage.php
+++ b/custom-registration-form-builder-with-submission-manager/public/models/class_rm_frontend_form_multipage.php
@@ -121,14 +121,18 @@
}
if (isset($data['submission_id']) && $data['submission_id'])
- {
- $form->addElement(new Element_HTML('<div id="rm_stat_container" style="display:none">'));
- $form->addElement(new Element_Textbox('RM_Slug', 'rm_slug', array('value' => 'rm_user_form_edit_sub', 'style' => 'display:none')));
- $form->addElement(new Element_Textbox('RM_form_id', 'form_id', array('value' => $this->form_id, 'style' => 'display:none')));
- $form->addElement(new Element_HTML('</div>'));
- if(defined('REGMAGIC_ADDON'))
- $editing_sub=true;
- }
+ {
+ $form->addElement(new Element_HTML('<div id="rm_stat_container" style="display:none">'));
+ $form->addElement(new Element_Textbox('RM_Slug', 'rm_slug', array('value' => 'rm_user_form_edit_sub', 'style' => 'display:none')));
+ $form->addElement(new Element_Textbox('RM_form_id', 'form_id', array('value' => $this->form_id, 'style' => 'display:none')));
+ $form->addElement(new Element_Textbox('RM_Submission_Id', 'submission_id', array('value' => absint($data['submission_id']), 'style' => 'display:none')));
+ $front_service = new RM_Front_Service();
+ $user_email = strtolower((string) $front_service->get_user_email());
+ $form->addElement(new Element_Textbox('RM_Edit_Sub_Nonce', 'rm_edit_sub_nonce', array('value' => wp_create_nonce('rm_edit_submission_' . absint($data['submission_id']) . '_' . $user_email), 'style' => 'display:none')));
+ $form->addElement(new Element_HTML('</div>'));
+ if(defined('REGMAGIC_ADDON'))
+ $editing_sub=true;
+ }
parent::pre_render();
if(defined('REGMAGIC_ADDON')) {
--- a/custom-registration-form-builder-with-submission-manager/public/views/template_rm_front_submission_data.php
+++ b/custom-registration-form-builder-with-submission-manager/public/views/template_rm_front_submission_data.php
@@ -259,10 +259,12 @@
endforeach;
if($data->is_editable == true){
?>
- <form id="rmeditsubmission" method="post" action="">
- <input type="hidden" name="rm_slug" value="rm_user_form_edit_sub">
- <input type="hidden" name="form_id" value="<?php echo esc_attr($data->submission->get_form_id()); ?>">
- </form>
+ <form id="rmeditsubmission" method="post" action="">
+ <input type="hidden" name="rm_slug" value="rm_user_form_edit_sub">
+ <input type="hidden" name="form_id" value="<?php echo esc_attr($data->submission->get_form_id()); ?>">
+ <input type="hidden" name="submission_id" value="<?php echo esc_attr($data->submission->get_submission_id()); ?>">
+ <input type="hidden" name="rm_edit_sub_nonce" value="<?php echo esc_attr(wp_create_nonce('rm_edit_submission_' . $data->submission->get_submission_id() . '_' . strtolower((string) $data->submission->get_user_email()))); ?>">
+ </form>
<!--
<div id="rm_edit_sub_link">
<a href="javascript:void(0)" onclick="document.getElementById('rmeditsubmission').submit();"><?php echo RM_UI_Strings::get('MSG_EDIT_SUBMISSION'); ?></a>
@@ -350,4 +352,4 @@
?>
</div>
-<?php } ?>
No newline at end of file
+<?php } ?>
--- a/custom-registration-form-builder-with-submission-manager/registration_magic.php
+++ b/custom-registration-form-builder-with-submission-manager/registration_magic.php
@@ -15,7 +15,7 @@
* Plugin Name: RegistrationMagic
* Plugin URI: http://www.registrationmagic.com
* Description: A powerful system for customizing registration forms, setting up paid registrations, tracking submissions, managing users, assigning user roles, analyzing stats, and much more!!
- * Version: 6.0.9.3
+ * Version: 6.0.9.4
* Tags: registration, form, custom, analytics, simple, submissions
* Requires at least: 5.2.0
* Requires PHP: 7.2
@@ -78,7 +78,7 @@
*/
if(!defined('RM_PLUGIN_VERSION')) {
define('RM_PLUGIN_BASENAME', plugin_basename(__FILE__ ));
- define('RM_PLUGIN_VERSION', '6.0.9.3');
+ define('RM_PLUGIN_VERSION', '6.0.9.4');
define('RM_DB_VERSION', 5.9);
define('RM_SHOW_WHATSNEW_SPLASH', false); //Set it to 'false' to disable whatsnew screen.
//define FB SDK req flags. Flags should be combined using logical OR and should be checked using AND.
--- a/custom-registration-form-builder-with-submission-manager/services/class_rm_email_service.php
+++ b/custom-registration-form-builder-with-submission-manager/services/class_rm_email_service.php
@@ -130,11 +130,15 @@
$to = explode(',',(string)$gopt->get_value_of('admin_email'));
}
- $subject= $form->form_options->form_admin_ns_notification_sub;
- if(empty($subject))
- $subject = $params->form_name . " " . RM_UI_Strings::get('LABEL_NEWFORM_NOTIFICATION') . " ";
- $rm_email->subject($subject);
- $rm_email->useAdminFrom= false;
+ $subject= $form->form_options->form_admin_ns_notification_sub;
+ if(empty($subject)) {
+ $subject = $params->form_name . " " . RM_UI_Strings::get('LABEL_NEWFORM_NOTIFICATION') . " ";
+ } else {
+ $subject = self::replace_submission_field_placeholders((string)$subject, $params, true);
+ $subject = wp_strip_all_tags($subject);
+ }
+ $rm_email->subject($subject);
+ $rm_email->useAdminFrom= false;
$from_email= $gopt->get_value_of('an_senders_email');
$from_email= trim((string)$from_email);
@@ -215,7 +219,7 @@
$page_id= $recovery_options['recovery_page'];
if(!empty($page_id)){
$recovery_link= get_permalink($page_id);
- $token= wp_generate_password(8,false);
+ $token= wp_generate_password(32,false);
update_user_meta($user_id,'rm_pass_token',$token);
$hours= $recovery_options['rec_link_expiry'];
if(!empty($hours)){
@@ -756,7 +760,7 @@
}
$recovery_link= get_permalink($page_id);
- $token= wp_generate_password(8,false );
+ $token= wp_generate_password(32,false );
update_user_meta($user->ID,'rm_pass_token',$token);
$hours= $recovery_options['rec_link_expiry'];
if(!empty($hours)){
@@ -793,7 +797,7 @@
return false;
}
- private static function replace_submission_field_placeholders($content, $params)
+ private static function replace_submission_field_placeholders($content, $params, $plain_text = false)
{
$submission_data = array();
if (!empty($params->db_data) && is_array($params->db_data)) {
@@ -811,7 +815,7 @@
continue;
}
- $value = self::format_submission_field_value($field_id, $field_data);
+ $value = self::format_submission_field_value($field_id, $field_data, $plain_text);
$field_placeholder = '{{' . $field_data->type . '_' . $field_id . '}}';
$content = str_replace($field_placeholder, $value, $content);
@@ -825,7 +829,7 @@
return $content;
}
- private static function format_submission_field_value($field_id, $field_data)
+ private static function format_submission_field_value($field_id, $field_data, $plain_text = false)
{
if (!isset($field_data->value) || is_null($field_data->value)) {
return '';
@@ -839,14 +843,18 @@
}
if (is_array($value)) {
- if (isset($value['rm_field_type']) && $value['rm_field_type'] == 'File') {
- unset($value['rm_field_type']);
- $links = '';
- foreach ($value as $attachment_id) {
- $links .= wp_get_attachment_link($attachment_id) . ' ';
- }
- return $links;
- }
+ if (isset($value['rm_field_type']) && $value['rm_field_type'] == 'File') {
+ unset($value['rm_field_type']);
+ $links = '';
+ foreach ($value as $attachment_id) {
+ if ($plain_text) {
+ $links .= wp_get_attachment_url($attachment_id) . ' ';
+ } else {
+ $links .= wp_get_attachment_link($attachment_id) . ' ';
+ }
+ }
+ return $links;
+ }
if (isset($value['rm_field_type']) && $value['rm_field_type'] == 'Address') {
unset($value['rm_field_type']);
@@ -858,9 +866,12 @@
return implode(', ', RM_Utilities::get_lable_for_option($field_id, $value));
}
- if ($field_data->type == 'URL' && isset($value['url'])) {
- return '<a href="' . esc_url($value['url']) . '">' . esc_html($value['url']) . '</a>';
- }
+ if ($field_data->type == 'URL' && isset($value['url'])) {
+ if ($plain_text) {
+ return $value['url'];
+ }
+ return '<a href="' . esc_url($value['url']) . '">' . esc_html($value['url']) . '</a>';
+ }
return implode(', ', $value);
}
@@ -869,6 +880,6 @@
return RM_Utilities::get_lable_for_option($field_id, $value);
}
- return nl2br($value);
- }
-}
+ return $plain_text ? $value : nl2br($value);
+ }
+}
--- a/custom-registration-form-builder-with-submission-manager/services/class_rm_front_form_service.php
+++ b/custom-registration-form-builder-with-submission-manager/services/class_rm_front_form_service.php
@@ -825,7 +825,11 @@
} elseif ($type === 'pm_user_avatar') {
$return = update_user_meta( $user_id, $type, $pr[0] );
} else {
- $return = update_user_meta( $user_id, $type, $pr );
+ $meta_key = is_string($type) ? sanitize_key($type) : '';
+ if (!$this->is_profile_meta_key_allowed($type, $meta_key)) {
+ continue;
+ }
+ $return = update_user_meta( $user_id, $meta_key, $pr );
}
}
if(!empty($name)){
@@ -834,6 +838,51 @@
return $return;
}
+ private function is_profile_meta_key_allowed($original_key, $sanitized_key) {
+ global $wpdb;
+
+ if (empty($sanitized_key) || $original_key !== $sanitized_key) {
+ return false;
+ }
+
+ $key = strtolower($sanitized_key);
+ $denied_exact = array(
+ 'capabilities',
+ 'user_level',
+ $wpdb->prefix . 'capabilities',
+ $wpdb->prefix . 'user_level',
+ 'session_tokens',
+ 'application_passwords',
+ 'rm_pass_token',
+ 'rm_pass_expiry_token'
+ );
+
+ if (in_array($key, array_map('strtolower', $denied_exact), true)) {
+ return false;
+ }
+
+ $denied_patterns = array(
+ '/(^|_)capabilities$/',
+ '/(^|_)user_level$/',
+ '/session/',
+ '/(^|_)auth(_|$)/',
+ '/auth_token/',
+ '/authentication/',
+ '/password/',
+ '/pass_token/',
+ '/reset/',
+ '/application_password/'
+ );
+
+ foreach ($denied_patterns as $pattern) {
+ if (preg_match($pattern, $key)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
public function set_properties(stdClass $options) {
if(defined('REGMAGIC_ADDON')) {
$addon_service = new RM_Front_Form_Service_Addon();
@@ -905,4 +954,4 @@
}
}
}
-}
No newline at end of file
+}
--- a/custom-registration-form-builder-with-submission-manager/services/class_rm_front_service.php
+++ b/custom-registration-form-builder-with-submission-manager/services/class_rm_front_service.php
@@ -11,7 +11,9 @@
*
* @author CMSHelplive
*/
-class RM_Front_Service extends RM_Services {
+class RM_Front_Service extends RM_Services {
+
+ private $authorized_front_user = null;
public function set_otp($email, $key = null) {
$response = new stdClass();
@@ -104,22 +106,26 @@
return false;
}
- public function is_authorized() {
- if (!is_user_logged_in() && isset($_COOKIE['rm_secure_otp'])) {
- $this->delete_front_user('10', 'm', true);
-
- $rm_user = $this->get('FRONT_USERS', array('otp_code' => $_COOKIE['rm_secure_otp']), array('%s'), 'row');
-
- if (empty($rm_user)) {
- $this->unset_auth_params();
- return false;
- } else {
- $this->update_last_activity();
- return true;
- }
- }
- return false;
- }
+ public function is_authorized() {
+ if (!is_user_logged_in() && isset($_COOKIE['rm_secure_otp'])) {
+ $this->delete_front_user('10', 'm', true);
+
+ $otp_code = sanitize_text_field(wp_unslash($_COOKIE['rm_secure_otp']));
+ $rm_user = $this->get('FRONT_USERS', array('otp_code' => $otp_code), array('%s'), 'row');
+
+ if (empty($rm_user)) {
+ $this->authorized_front_user = null;
+ $this->unset_auth_params();
+ return false;
+ } else {
+ $this->authorized_front_user = $rm_user;
+ $this->update_last_activity($otp_code);
+ return true;
+ }
+ }
+ $this->authorized_front_user = null;
+ return false;
+ }
public function generate_otp($email) {
$otp_code = wp_generate_password(15, false);
@@ -138,41 +144,58 @@
return $otp_code;
}
- public function set_auth_params($key, $email) {
- setcookie("rm_secure_otp", $key, time() + (3600), "/");
- setcookie("rm_autorized_otp", "true", time() + (3600), "/");
- setcookie("rm_autorized_email", $email, time() + (3600), "/");
- }
+ public function set_auth_params($key, $email) {
+ $expires = time() + (3600);
+ $this->set_front_cookie("rm_secure_otp", $key, $expires, true);
+ $this->set_front_cookie("rm_autorized_otp", "true", $expires, true);
+ $this->set_front_cookie("rm_autorized_email", $email, $expires, true);
+ }
public function delete_front_user($interval, $time_format, $by_last_activity = false) {
return RM_DBManager::delete_front_user($interval, $time_format, $by_last_activity);
}
- public function unset_auth_params() {
- setcookie("rm_secure_otp", '', time() - (3600), "/");
- setcookie("rm_autorized_otp", "true", time() - (3600), "/");
- setcookie("rm_autorized_email", '', time() - (3600), "/");
- }
-
- public function update_last_activity() {
- return RM_DBManager::update_last_activity();
- }
-
- public function get_user_email() {
-
- $user_email = null;
+ public function unset_auth_params() {
+ $expires = time() - (3600);
+ $this->set_front_cookie("rm_secure_otp", '', $expires, true);
+ $this->set_front_cookie("rm_autorized_otp", "true", $expires, true);
+ $this->set_front_cookie("rm_autorized_email", '', $expires, true);
+ }
+
+ public function update_last_activity($otp_code = null) {
+ return RM_DBManager::update_last_activity($otp_code);
+ }
+
+ public function get_user_email() {
+
+ $user_email = null;
if (is_user_logged_in()) {
- $user = wp_get_current_user();
- $user_email = isset($user->user_email) ? $user->user_email : null;
- } elseif (isset($_COOKIE['rm_autorized_email']) && $this->is_authorized()) {
- $user_email = $_COOKIE['rm_autorized_email'];
- }
-
-
- return $user_email;
- }
+ $user = wp_get_current_user();
+ $user_email = isset($user->user_email) ? $user->user_email : null;
+ } elseif ($this->is_authorized() && !empty($this->authorized_front_user->email)) {
+ $user_email = $this->authorized_front_user->email;
+ }
+
+
+ return $user_email;
+ }
+
+ private function set_front_cookie($name, $value, $expires, $http_only = true) {
+ if (PHP_VERSION_ID >= 70300) {
+ setcookie($name, $value, array(
+ 'expires' => $expires,
+ 'path' => '/',
+ 'secure' => is_ssl(),
+ 'httponly' => $http_only,
+ 'samesite' => 'Lax'
+ ));
+ return;
+ }
+
+ setcookie($name, $value, $expires, '/', '', is_ssl(), $http_only);
+ }
public function get_user_login_name() {
if(defined('REGMAGIC_ADDON')) {