From 382e135d8cd8a471786a22cd07e50db9bf2ba5c5 Mon Sep 17 00:00:00 2001 From: PranavAwasthi Date: Tue, 15 Oct 2024 12:41:12 +0530 Subject: [PATCH 1/5] Fixed correct answer not showing with random match type in Fill in the blank question --- php/template-variables.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/php/template-variables.php b/php/template-variables.php index 564fe870..a0cfdead 100644 --- a/php/template-variables.php +++ b/php/template-variables.php @@ -1200,8 +1200,9 @@ function qsm_questions_answers_shortcode_to_text( $mlw_quiz_array, $qmn_question } else { $options[] = mb_strtoupper( htmlspecialchars_decode( $mlwQuizMasterNext->pluginHelper->qsm_language_support( $single_answer[0], 'answer-' . $answer['id'] . '-' . $key, 'QSM Answers' ), ENT_QUOTES ) ); } + $question_correct_fill_answer_text .= '(' . $key + 1 . ') ' . strval( $mlwQuizMasterNext->pluginHelper->qsm_language_support( $single_answer[0], 'answer-' . $answer['id'] . '-' . $key, 'QSM Answers' ) ) . ''; } - + $is_any_incorrect = false; if ( sizeof( $new_array_user_answer ) < sizeof( $total_answers ) ) { foreach ( $new_array_user_answer as $show_user_answer ) { if ( isset($answer['case_sensitive']) && 1 === intval( $answer['case_sensitive'] ) ) { @@ -1212,6 +1213,7 @@ function qsm_questions_answers_shortcode_to_text( $mlw_quiz_array, $qmn_question if ( false !== $key ) { $question_with_answer_text .= '' . htmlspecialchars_decode( $show_user_answer, ENT_QUOTES ) . ''; } else { + $is_any_incorrect = true; if ( '' === $show_user_answer ) { $show_user_answer = $quiz_options->no_answer_text; } @@ -1229,7 +1231,7 @@ function qsm_questions_answers_shortcode_to_text( $mlw_quiz_array, $qmn_question if ( false !== $key ) { $question_with_answer_text .= '' . $show_user_answer . ''; } else { - + $is_any_incorrect = true; if ( '' === $show_user_answer ) { $show_user_answer = $quiz_options->no_answer_text; } @@ -1237,6 +1239,7 @@ function qsm_questions_answers_shortcode_to_text( $mlw_quiz_array, $qmn_question } } } + $question_with_answer_text = $is_any_incorrect ? $question_with_answer_text . $question_correct_fill_answer_text : $question_with_answer_text; } } else { if ( 0 == $form_type && ( 0 == $quiz_system || 3 == $quiz_system ) ) { From b249ae9cdf35116ea2c02bf4a7d33612a6e3521c Mon Sep 17 00:00:00 2001 From: PranavAwasthi Date: Tue, 15 Oct 2024 12:47:31 +0530 Subject: [PATCH 2/5] Fixed sonar issue --- php/template-variables.php | 1 + 1 file changed, 1 insertion(+) diff --git a/php/template-variables.php b/php/template-variables.php index a0cfdead..5a561122 100644 --- a/php/template-variables.php +++ b/php/template-variables.php @@ -1194,6 +1194,7 @@ function qsm_questions_answers_shortcode_to_text( $mlw_quiz_array, $qmn_question } } else { $options = array(); + $question_correct_fill_answer_text = ''; foreach ( $total_answers as $key => $single_answer ) { if ( isset($answer['case_sensitive']) && 1 === intval( $answer['case_sensitive'] ) ) { $options[] = htmlspecialchars_decode( $mlwQuizMasterNext->pluginHelper->qsm_language_support( $single_answer[0], 'answer-' . $answer['id'] . '-' . $key, 'QSM Answers' ), ENT_QUOTES ); From 553cb974a3afe872a66be3f8af2a887ec62e6c18 Mon Sep 17 00:00:00 2001 From: Mohammad Zubair Ali Date: Tue, 15 Oct 2024 13:25:22 +0530 Subject: [PATCH 3/5] fixed Vulnerability report --- css/qsm-admin.css | 1 + php/classes/class-qsm-fields.php | 3 +++ php/shortcodes.php | 11 +++++------ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/css/qsm-admin.css b/css/qsm-admin.css index f15f72b6..6dc4748b 100644 --- a/css/qsm-admin.css +++ b/css/qsm-admin.css @@ -1378,6 +1378,7 @@ tr .qsm-opt-desc { #quiz_settings_wrapper .qsm-opt-desc { display: none !important; } +.qsm_page_qmn_global_settings .form-table td fieldset label, .qsm_tab_content .form-table td fieldset label { margin-right: 20px !important; width: 100%; diff --git a/php/classes/class-qsm-fields.php b/php/classes/class-qsm-fields.php index bd6b9a05..bc81b4c3 100644 --- a/php/classes/class-qsm-fields.php +++ b/php/classes/class-qsm-fields.php @@ -77,6 +77,9 @@ public static function generate_section( $fields, $section ) { case 'number': $sanitized_value = isset( $_POST[ $key ] ) ? intval( $_POST[ $key ] ) : ""; break; + case 'image': + $sanitized_value = isset( $_POST[ $key ] ) ? esc_url_raw( wp_unslash( $_POST[ $key ] ) ) : ""; + break; default: $sanitized_value = isset( $_POST[ $key ] ) ? sanitize_text_field( wp_unslash( $_POST[ $key ] ) ) : ""; break; diff --git a/php/shortcodes.php b/php/shortcodes.php index ef7e5a2a..45dad941 100644 --- a/php/shortcodes.php +++ b/php/shortcodes.php @@ -183,12 +183,11 @@ function qsm_generate_fb_header_metadata() { $sharing = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'facebook_sharing_text', '' ); $sharing = apply_filters( 'mlw_qmn_template_variable_results_page', $sharing, $results_array ); $default_fb_image = QSM_PLUGIN_URL . 'assets/icon-200x200.png'; - $get_fb_sharing_image = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'result_page_fb_image', '' ); - if ( empty( $get_fb_sharing_image ) ) { - $get_fb_sharing_image = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'result_page_fb_image', '' ); - } - if ( '' !== $get_fb_sharing_image && filter_var( $get_fb_sharing_image, FILTER_VALIDATE_URL ) ) { - $default_fb_image = $get_fb_sharing_image; + $fb_sharing_image_quiz_options = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_options', 'result_page_fb_image', '' ); + $fb_sharing_image_quiz_text = $mlwQuizMasterNext->pluginHelper->get_section_setting( 'quiz_text', 'result_page_fb_image', '' ); + $get_fb_sharing_image = ! empty($fb_sharing_image_quiz_options) ? $fb_sharing_image_quiz_options : $fb_sharing_image_quiz_text; + if ( ! empty($get_fb_sharing_image) && filter_var($get_fb_sharing_image, FILTER_VALIDATE_URL) ) { + $default_fb_image = esc_url($get_fb_sharing_image); } $post = $wp_query->get_queried_object(); $pagename = $post->post_title; From 34d3b5d343f212957b75f94644ee6e6c6a14663a Mon Sep 17 00:00:00 2001 From: Mohammad Zubair Ali Date: Tue, 15 Oct 2024 17:03:54 +0530 Subject: [PATCH 4/5] fixed fatal error with user role --- mlw_quizmaster2.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mlw_quizmaster2.php b/mlw_quizmaster2.php index ce63fc21..d3ed9218 100644 --- a/mlw_quizmaster2.php +++ b/mlw_quizmaster2.php @@ -756,11 +756,15 @@ public function qsm_add_user_capabilities() { ); $user = wp_get_current_user(); + if ( empty( $user->roles ) || ! is_array( $user->roles ) ) { + return; + } $roles = (array) $user->roles; $rolename = $roles[0]; - $role = get_role( $rolename ); - + if ( ! $role ) { + return; + } // Remove all capabilities first. foreach ( $administrator_capabilities as $cap ) { if ( $role->has_cap( $cap ) ) { From 81c2212e7a424af4a25f20a8bb49fb72fb306e52 Mon Sep 17 00:00:00 2001 From: Mohammad Zubair Ali Date: Wed, 16 Oct 2024 15:32:37 +0530 Subject: [PATCH 5/5] update changelog 9.2.1 --- mlw_quizmaster2.php | 4 ++-- readme.txt | 25 +++++++------------------ 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/mlw_quizmaster2.php b/mlw_quizmaster2.php index d3ed9218..2a6e8e6b 100644 --- a/mlw_quizmaster2.php +++ b/mlw_quizmaster2.php @@ -2,7 +2,7 @@ /** * Plugin Name: Quiz And Survey Master * Description: Easily and quickly add quizzes and surveys to your website. - * Version: 9.2.0 + * Version: 9.2.1 * Author: ExpressTech * Author URI: https://quizandsurveymaster.com/ * Plugin URI: https://expresstech.io/ @@ -43,7 +43,7 @@ class MLWQuizMasterNext { * @var string * @since 4.0.0 */ - public $version = '9.2.0'; + public $version = '9.2.1'; /** * QSM Alert Manager Object diff --git a/readme.txt b/readme.txt index e562030b..94243444 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: quiz, survey, test, exam, online assessment Requires at least: 4.9 Tested up to: 6.6 Requires PHP: 5.4 -Stable tag: 9.2.0 +Stable tag: 9.2.1 License: GPLv2 License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -35,22 +35,6 @@ This [WordPress quiz maker](https://quizandsurveymaster.com/free-quiz-maker-word ### DIVERSE RANGE OF QUESTIONS -Create quizzes, forms, or surveys with a variety of question types tailored to your specific goals: - -- **Multiple Choice**: Choose one correct answer option. -- **Multiple Response**: Select multiple correct answer options. -- **Dropdown**: Pick one correct answer from the dropdown menu options. -- **Short Answer**: Provide concise written responses. -- **Paragraph**: Write longer, detailed answers. -- **Fill in the Blank**: Complete sentences with the correct missing words. -- **Date**: Select a specific calendar date. -- **File Upload**: Attach images, PDFs, and documents. -- **Number**: Enter answers in numerical format. -- **Captcha**: Verify identity with anti-bot check. -- **Polar**: Answer by choosing a spot on the slider scale. -- **Opt-in**: Use the checkbox selection to give permission/agree to a text. - - Engage your audience effortlessly with our **interactive quiz builder**! Easily create tailored quizzes, forms, or surveys using diverse question types that align with your goals and make interaction fun. - **Multiple Choice**: Choose one correct answer option. @@ -66,7 +50,7 @@ Engage your audience effortlessly with our **interactive quiz builder**! Easily - **Polar**: Answer by choosing a spot on the slider scale. - **Opt-in**: Use the checkbox selection to give permission/agree to a text. -ADVANCED QUESTION TYPES +**ADVANCED QUESTION TYPES** QSM comes with some advanced question types in their pro plan; - **Matching Pairs** - Drag and drop answers vertically to match with the correct option. @@ -238,6 +222,11 @@ As a WordPress quiz maker, QSM is designed to be compatible with most other plug 18. Database == Changelog == += 9.2.1 ( October 16, 2024 ) = +* Bug: Resolved vulnerability issue with question settings +* Bug: Fixed issue with fill in the blanks question type while using random answers +* Bug: Fixed php warning with user permission function + = 9.2.0 ( October 07, 2024 ) = * Bug: Resolved HTML tag issue with the %USER_ANSWER% variable * Bug: Fixed the issue with contact form position settings