Quiz And Survey Master (Formerly Quiz Master Next) - Version 8.0.8

Version Description

(Dec 15, 2022) = * Bug: Fixed issue with short answer question type * Bug: Fixed security issues. * Bug: Fixed compatibility issues with php v7 or older

Download this release

Release Info

Developer expresstech
Plugin Icon 128x128 Quiz And Survey Master (Formerly Quiz Master Next)
Version 8.0.8
Comparing to
See all releases

Code changes from version 8.0.7 to 8.0.8

js/qsm-admin.js CHANGED
@@ -187,7 +187,7 @@ var QSMAdmin;
187
  jQuery('.qsm-custom-label-left-menu').removeClass('currentli_general');
188
  jQuery(this).addClass('current_general');
189
  jQuery(this).parent().addClass('currentli_general');
190
- jQuery('#' + text_id).show();
191
  jQuery('.qsm-text-main-wrap .qsm-text-tab-message-loader').show();
192
  jQuery.post(ajaxurl, { text_id: text_id, 'quiz_id': qsmTextTabObject.quiz_id, action: 'qsm_get_question_text_message' }, function (response) {
193
  var data = jQuery.parseJSON(response);
@@ -213,7 +213,7 @@ var QSMAdmin;
213
  jQuery('.qsm-custom-label-left-menu').removeClass('currentli_variable');
214
  jQuery(this).addClass('current_variable');
215
  jQuery(this).parent().addClass('currentli_variable');
216
- jQuery('#' + text_id).show();
217
  jQuery('.qsm-text-main-wrap .qsm-text-tab-message-loader').show();
218
  jQuery.post(ajaxurl, { text_id: text_id, 'quiz_id': qsmTextTabObject.quiz_id, action: 'qsm_get_question_text_message' }, function (response) {
219
  var data = jQuery.parseJSON(response);
@@ -234,9 +234,10 @@ var QSMAdmin;
234
  jQuery(document).on('click', '#qsm_save_text_message', function () {
235
  var $this = jQuery(this);
236
  $this.siblings('.spinner').addClass('is-active');
 
237
  var text_id = jQuery(".currentli_general .current_general").data('id');
238
  var message = wp.editor.getContent('qsm_question_text_message');
239
- jQuery.post(ajaxurl, { text_id: text_id, 'message': message, 'quiz_id': qsmTextTabObject.quiz_id, action: 'qsm_update_text_message' }, function (response) {
240
  var data = jQuery.parseJSON(response);
241
  if (data.success === true) {
242
  //Do nothing
@@ -248,9 +249,10 @@ var QSMAdmin;
248
  jQuery(document).on('click', '#qsm_save_text_message_variable', function () {
249
  var $this = jQuery(this);
250
  $this.siblings('.spinner').addClass('is-active');
 
251
  var text_id = jQuery(".currentli_variable .current_variable").data('id');
252
  var message = wp.editor.getContent('qsm_question_text_message_variable');
253
- jQuery.post(ajaxurl, { text_id: text_id, 'message': message, 'quiz_id': qsmTextTabObject.quiz_id, action: 'qsm_update_text_message' }, function (response) {
254
  var data = jQuery.parseJSON(response);
255
  if (data.success === true) {
256
  //Do nothing
@@ -1990,7 +1992,7 @@ var import_button;
1990
  if ($answer.find('.answer-correct').prop('checked')) {
1991
  correct = 1;
1992
  }
1993
-
1994
  var ansData = [answer, points, correct];
1995
  if (answerType == 'image') {
1996
  ansData.push(caption);
@@ -2000,7 +2002,7 @@ var import_button;
2000
  intcnt++
2001
  });
2002
  model.set('answers', answers);
2003
-
2004
  $('.questionElements .advanced-content > .qsm-row:not(.core-option)').each(function () {
2005
  if ($(this).find('input[type="text"]').length > 0) {
2006
  $($(this).find('input[type="text"]')).each(function () {
@@ -2022,7 +2024,7 @@ var import_button;
2022
  advanced_option[element_id] = multi_value;
2023
  }
2024
  });
2025
-
2026
  model.save({
2027
  quizID: quizID,
2028
  type: type,
@@ -2744,7 +2746,9 @@ var import_button;
2744
  if (13 == question_val) {
2745
  QSMQuestion.prepareEditPolarQuestion(question_val);
2746
  }
2747
- jQuery(document).trigger('qsm-change-answer-editor-after');
 
 
2748
  });
2749
 
2750
  // Adds event handlers for searching questions
187
  jQuery('.qsm-custom-label-left-menu').removeClass('currentli_general');
188
  jQuery(this).addClass('current_general');
189
  jQuery(this).parent().addClass('currentli_general');
190
+ jQuery('#' + text_id).show();
191
  jQuery('.qsm-text-main-wrap .qsm-text-tab-message-loader').show();
192
  jQuery.post(ajaxurl, { text_id: text_id, 'quiz_id': qsmTextTabObject.quiz_id, action: 'qsm_get_question_text_message' }, function (response) {
193
  var data = jQuery.parseJSON(response);
213
  jQuery('.qsm-custom-label-left-menu').removeClass('currentli_variable');
214
  jQuery(this).addClass('current_variable');
215
  jQuery(this).parent().addClass('currentli_variable');
216
+ jQuery('#' + text_id).show();
217
  jQuery('.qsm-text-main-wrap .qsm-text-tab-message-loader').show();
218
  jQuery.post(ajaxurl, { text_id: text_id, 'quiz_id': qsmTextTabObject.quiz_id, action: 'qsm_get_question_text_message' }, function (response) {
219
  var data = jQuery.parseJSON(response);
234
  jQuery(document).on('click', '#qsm_save_text_message', function () {
235
  var $this = jQuery(this);
236
  $this.siblings('.spinner').addClass('is-active');
237
+ var nonce = jQuery('#qsm_save_text_message_nonce').val();
238
  var text_id = jQuery(".currentli_general .current_general").data('id');
239
  var message = wp.editor.getContent('qsm_question_text_message');
240
+ jQuery.post(ajaxurl, { text_id: text_id, 'message': message, 'quiz_id': qsmTextTabObject.quiz_id, action: 'qsm_update_text_message', nonce: nonce }, function (response) {
241
  var data = jQuery.parseJSON(response);
242
  if (data.success === true) {
243
  //Do nothing
249
  jQuery(document).on('click', '#qsm_save_text_message_variable', function () {
250
  var $this = jQuery(this);
251
  $this.siblings('.spinner').addClass('is-active');
252
+ var nonce = jQuery('#qsm_save_text_message_nonce').val();
253
  var text_id = jQuery(".currentli_variable .current_variable").data('id');
254
  var message = wp.editor.getContent('qsm_question_text_message_variable');
255
+ jQuery.post(ajaxurl, { text_id: text_id, 'message': message, 'quiz_id': qsmTextTabObject.quiz_id, action: 'qsm_update_text_message', nonce: nonce }, function (response) {
256
  var data = jQuery.parseJSON(response);
257
  if (data.success === true) {
258
  //Do nothing
1992
  if ($answer.find('.answer-correct').prop('checked')) {
1993
  correct = 1;
1994
  }
1995
+
1996
  var ansData = [answer, points, correct];
1997
  if (answerType == 'image') {
1998
  ansData.push(caption);
2002
  intcnt++
2003
  });
2004
  model.set('answers', answers);
2005
+
2006
  $('.questionElements .advanced-content > .qsm-row:not(.core-option)').each(function () {
2007
  if ($(this).find('input[type="text"]').length > 0) {
2008
  $($(this).find('input[type="text"]')).each(function () {
2024
  advanced_option[element_id] = multi_value;
2025
  }
2026
  });
2027
+
2028
  model.save({
2029
  quizID: quizID,
2030
  type: type,
2746
  if (13 == question_val) {
2747
  QSMQuestion.prepareEditPolarQuestion(question_val);
2748
  }
2749
+ if (18 == question_val) {
2750
+ jQuery(document).trigger('qsm-change-answer-editor-after');
2751
+ }
2752
  });
2753
 
2754
  // Adds event handlers for searching questions
mlw_quizmaster2.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: Quiz And Survey Master
4
  * Description: Easily and quickly add quizzes and surveys to your website.
5
- * Version: 8.0.7
6
  * Author: ExpressTech
7
  * Author URI: https://quizandsurveymaster.com/
8
  * Plugin URI: https://expresstech.io/
@@ -43,7 +43,7 @@ class MLWQuizMasterNext {
43
  * @var string
44
  * @since 4.0.0
45
  */
46
- public $version = '8.0.7';
47
 
48
  /**
49
  * QSM Alert Manager Object
2
  /**
3
  * Plugin Name: Quiz And Survey Master
4
  * Description: Easily and quickly add quizzes and surveys to your website.
5
+ * Version: 8.0.8
6
  * Author: ExpressTech
7
  * Author URI: https://quizandsurveymaster.com/
8
  * Plugin URI: https://expresstech.io/
43
  * @var string
44
  * @since 4.0.0
45
  */
46
+ public $version = '8.0.8';
47
 
48
  /**
49
  * QSM Alert Manager Object
php/admin/options-page-text-tab.php CHANGED
@@ -70,7 +70,7 @@ function mlw_options_text_tab_content() {
70
  <?php
71
  if ( $editor_text_arr ) {
72
  foreach ( $editor_text_arr as $key => $single_editor_arr ) {
73
- if ( ! str_contains( $single_editor_arr['label'], '%' ) ) {
74
  $class_current_li = "";
75
  $class = "";
76
  if ( 0 == $key ) {
@@ -100,6 +100,7 @@ function mlw_options_text_tab_content() {
100
  ?>
101
  </div>
102
  <div class="save-text-changes">
 
103
  <button id="qsm_save_text_message" class="button button-primary"><?php esc_html_e( 'Save Text Message', 'quiz-master-next' ); ?></button>
104
  <span class="spinner" ></span>
105
  </div>
@@ -121,7 +122,7 @@ function mlw_options_text_tab_content() {
121
  <?php
122
  if ( $editor_text_arr ) {
123
  foreach ( $editor_text_arr as $key => $single_editor_arr ) {
124
- if ( str_contains( $single_editor_arr['label'], '%' ) ) {
125
  $class_current_li = "";
126
  $class = "";
127
  if ( 7 == $key ) {
@@ -151,6 +152,7 @@ function mlw_options_text_tab_content() {
151
  ?>
152
  </div>
153
  <div class="save-text-changes">
 
154
  <button id="qsm_save_text_message_variable" class="button button-primary">
155
  <?php esc_html_e( 'Save Text Message', 'quiz-master-next' ); ?></button>
156
  <span class="spinner" ></span>
@@ -254,21 +256,28 @@ add_action( 'wp_ajax_qsm_get_question_text_message', 'qsm_get_question_text_mess
254
  */
255
  function qsm_update_text_message() {
256
  global $mlwQuizMasterNext;
257
- $quiz_id = isset( $_POST['quiz_id'] ) ? intval( $_POST['quiz_id'] ) : 0;
258
- $text_id = isset( $_POST['text_id'] ) ? sanitize_text_field( wp_unslash( $_POST['text_id'] ) ) : '';
259
- $message = isset( $_POST['message'] ) ? wp_kses_post( wp_unslash( $_POST['message'] ) ) : '';
260
- $settings = $mlwQuizMasterNext->pluginHelper->get_quiz_setting( 'quiz_text' );
261
- $settings[ $text_id ] = $message;
262
- $results = $mlwQuizMasterNext->pluginHelper->update_quiz_setting( 'quiz_text', $settings );
263
- if ( false !== $results ) {
264
- do_action( 'qsm_saved_text_message', $quiz_id, $text_id, $message );
265
- $results = array(
266
- 'success' => true,
267
- );
268
- } else {
 
 
 
 
 
 
 
269
  $results = array(
270
  'success' => false,
271
- 'message' => __( 'There has been an error in this action. Please share this with the developer', 'quiz-master-next' ),
272
  );
273
  }
274
  echo wp_json_encode( $results );
70
  <?php
71
  if ( $editor_text_arr ) {
72
  foreach ( $editor_text_arr as $key => $single_editor_arr ) {
73
+ if ( ! strpos( $single_editor_arr['label'], '%', 1 ) ) {
74
  $class_current_li = "";
75
  $class = "";
76
  if ( 0 == $key ) {
100
  ?>
101
  </div>
102
  <div class="save-text-changes">
103
+ <?php wp_nonce_field( 'qsm_save_text_message_nonce', 'qsm_save_text_message_nonce' ); ?>
104
  <button id="qsm_save_text_message" class="button button-primary"><?php esc_html_e( 'Save Text Message', 'quiz-master-next' ); ?></button>
105
  <span class="spinner" ></span>
106
  </div>
122
  <?php
123
  if ( $editor_text_arr ) {
124
  foreach ( $editor_text_arr as $key => $single_editor_arr ) {
125
+ if ( strpos( $single_editor_arr['label'], '%', 1 ) ) {
126
  $class_current_li = "";
127
  $class = "";
128
  if ( 7 == $key ) {
152
  ?>
153
  </div>
154
  <div class="save-text-changes">
155
+ <?php wp_nonce_field( 'qsm_save_text_message_nonce', 'qsm_save_text_message_nonce' ); ?>
156
  <button id="qsm_save_text_message_variable" class="button button-primary">
157
  <?php esc_html_e( 'Save Text Message', 'quiz-master-next' ); ?></button>
158
  <span class="spinner" ></span>
256
  */
257
  function qsm_update_text_message() {
258
  global $mlwQuizMasterNext;
259
+ if ( isset( $_POST['nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['nonce'] ) ), 'qsm_save_text_message_nonce' ) ) {
260
+ $quiz_id = isset( $_POST['quiz_id'] ) ? intval( $_POST['quiz_id'] ) : 0;
261
+ $text_id = isset( $_POST['text_id'] ) ? sanitize_text_field( wp_unslash( $_POST['text_id'] ) ) : '';
262
+ $message = isset( $_POST['message'] ) ? wp_kses_post( wp_unslash( $_POST['message'] ) ) : '';
263
+ $settings = $mlwQuizMasterNext->pluginHelper->get_quiz_setting( 'quiz_text' );
264
+ $settings[ $text_id ] = $message;
265
+ $results = $mlwQuizMasterNext->pluginHelper->update_quiz_setting( 'quiz_text', $settings );
266
+ if ( false !== $results ) {
267
+ do_action( 'qsm_saved_text_message', $quiz_id, $text_id, $message );
268
+ $results = array(
269
+ 'success' => true,
270
+ );
271
+ } else {
272
+ $results = array(
273
+ 'success' => false,
274
+ 'message' => __( 'There has been an error in this action. Please share this with the developer', 'quiz-master-next' ),
275
+ );
276
+ }
277
+ }else {
278
  $results = array(
279
  'success' => false,
280
+ 'message' => __( 'Invalid request', 'quiz-master-next' ),
281
  );
282
  }
283
  echo wp_json_encode( $results );
php/template-variables.php CHANGED
@@ -1063,12 +1063,14 @@ function qsm_questions_answers_shortcode_to_text( $mlw_quiz_array, $qmn_question
1063
  if ( 'correct' === $answer['correct'] ) {
1064
  $question_with_answer_text .= '<span class="qsm-text-correct-option qsm-text-user-correct-answer">' . $user_given_answer . '</span>';
1065
  $do_show_wrong = false;
 
1066
  }
1067
  }
1068
  } else {
1069
  if ( isset( $single_answer[2] ) && 'correct' === $answer['correct'] ) {
1070
  $question_with_answer_text .= '<span class="qsm-text-correct-option">' . $mlwQuizMasterNext->pluginHelper->qsm_language_support( $single_answer[0], 'answer-' . $single_answer[0], 'QSM Answers' ) . '</span>';
1071
  $do_show_wrong = false;
 
1072
  }
1073
  }
1074
  }
1063
  if ( 'correct' === $answer['correct'] ) {
1064
  $question_with_answer_text .= '<span class="qsm-text-correct-option qsm-text-user-correct-answer">' . $user_given_answer . '</span>';
1065
  $do_show_wrong = false;
1066
+ break;
1067
  }
1068
  }
1069
  } else {
1070
  if ( isset( $single_answer[2] ) && 'correct' === $answer['correct'] ) {
1071
  $question_with_answer_text .= '<span class="qsm-text-correct-option">' . $mlwQuizMasterNext->pluginHelper->qsm_language_support( $single_answer[0], 'answer-' . $single_answer[0], 'QSM Answers' ) . '</span>';
1072
  $do_show_wrong = false;
1073
+ break;
1074
  }
1075
  }
1076
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: quiz, survey, lead, test, score, exam, questionnaire, question,wordpress q
4
  Requires at least: 4.9
5
  Tested up to: 6.0
6
  Requires PHP: 5.4
7
- Stable tag: 8.0.7
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -163,6 +163,11 @@ This is usually a theme conflict. You can [checkout out our common conflict solu
163
  18. Database
164
 
165
  == Changelog ==
 
 
 
 
 
166
  = 8.0.7 (Dec 05, 2022) =
167
  * Feature: Added option to show and hide Text/HTML question type on result page
168
  * Bug: Fixed block.js warnings
4
  Requires at least: 4.9
5
  Tested up to: 6.0
6
  Requires PHP: 5.4
7
+ Stable tag: 8.0.8
8
  License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
163
  18. Database
164
 
165
  == Changelog ==
166
+ = 8.0.8 (Dec 15, 2022) =
167
+ * Bug: Fixed issue with short answer question type
168
+ * Bug: Fixed security issues.
169
+ * Bug: Fixed compatibility issues with php v7 or older
170
+
171
  = 8.0.7 (Dec 05, 2022) =
172
  * Feature: Added option to show and hide Text/HTML question type on result page
173
  * Bug: Fixed block.js warnings