Skip to content

Commit

Permalink
update changelog 8.1.17
Browse files Browse the repository at this point in the history
  • Loading branch information
zubairraeen committed Oct 9, 2023
2 parents 2994168 + 975954b commit 293fd3c
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 14 deletions.
8 changes: 7 additions & 1 deletion css/qsm-admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -1917,7 +1917,7 @@ td.scheduled_time_start {
.qsm-upgrade-box .qsm-upgrade-text {
font-size: 16px;
line-height: 22px;
text-align: justify;
text-align: left;
}
.qsm-upgrade-box .qsm-upgrade-read-icon {
display: flex;
Expand Down Expand Up @@ -1948,7 +1948,13 @@ td.scheduled_time_start {
}
.qsm-upgrade-chart img {
max-width: 100%;
width: 100%;
}

.admin_page_mlw_quiz_options .nav-tab-active:focus, .admin_page_mlw_quiz_options .nav-tab-active:focus:active, .admin_page_mlw_quiz_options .nav-tab-active:hover {
border: 1px solid #c3c4c7;
}

.qsm-popup-upgrade-warning,
.qsm-popup-upgrade-info {
display: flex;
Expand Down
14 changes: 8 additions & 6 deletions js/qsm-quiz.js
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,7 @@ function qmnInit() {
let $this = jQuery(this);
let value = $this.val();
let question_id = $this.attr('name').replace(/question/i, '');
let data = qsm_question_quick_result_js(question_id, value, '', qmn_quiz_data[key].enable_quick_correct_answer_info);
let data = qsm_question_quick_result_js(question_id, value, '', qmn_quiz_data[key].enable_quick_correct_answer_info,key);
if (data.success == 'correct') {
$this.parent().addClass("qmn_correct_answer");
} else if (data.success == 'incorrect') {
Expand Down Expand Up @@ -1612,7 +1612,7 @@ jQuery(function () {
function qsm_show_inline_result(quizID, question_id, value, $this, answer_type, $i_this, index = null) {
jQuery('.qsm-spinner-loader').remove();
addSpinnerLoader($this,$i_this);
let data = qsm_question_quick_result_js(question_id, value, answer_type, qmn_quiz_data[quizID].enable_quick_correct_answer_info);
let data = qsm_question_quick_result_js(question_id, value, answer_type, qmn_quiz_data[quizID].enable_quick_correct_answer_info,quizID);
$this.find('.quick-question-res-p').remove();
$this.find('.qsm-inline-correct-info').remove();
$this.find('.qmn_radio_answers').children().removeClass('data-correct-answer');
Expand Down Expand Up @@ -1826,7 +1826,7 @@ function checkMaxLength(obj){
let submit_status = true;
function qsm_submit_quiz_if_answer_wrong(question_id, value, $this, $quizForm, answer_type = '') {
let quiz_id = $quizForm.closest('.qmn_quiz_container').find('.qmn_quiz_id').val();
let data = qsm_question_quick_result_js(question_id, value, answer_type, qmn_quiz_data[quiz_id].enable_quick_correct_answer_info);
let data = qsm_question_quick_result_js(question_id, value, answer_type, qmn_quiz_data[quiz_id].enable_quick_correct_answer_info,quiz_id);
QSM.changes(data, question_id.replace(/\D/g, ""), quiz_id);
if (data.success == 'incorrect' && submit_status) {
$quizForm.closest('.qmn_quiz_container').find('[class*="Required"]').removeClass();
Expand All @@ -1837,9 +1837,11 @@ function qsm_submit_quiz_if_answer_wrong(question_id, value, $this, $quizForm, a
}
}

function qsm_question_quick_result_js(question_id, answer, answer_type = '', show_correct_info = '') {
if (typeof encryptedData !== 'undefined') {
let decryptedBytes = CryptoJS.AES.decrypt(encryptedData, encryptionKey);
function qsm_question_quick_result_js(question_id, answer, answer_type = '', show_correct_info = '',quiz_id='') {

if (typeof encryptedData[quiz_id] !== 'undefined') {

let decryptedBytes = CryptoJS.AES.decrypt(encryptedData[quiz_id], encryptionKey[quiz_id]);
let decryptedData = decryptedBytes.toString(CryptoJS.enc.Utf8);
let decrypt = JSON.parse(decryptedData);
question_id = typeof question_id !== 'undefined' ? parseInt(question_id) : 0;
Expand Down
2 changes: 1 addition & 1 deletion php/admin/admin-results-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ function qsm_results_overview_tab_content() {
?>
<tr>
<td><input type="checkbox" class="qmn_delete_checkbox" name="delete_results[]" value="<?php echo esc_attr( $quiz_infos[ $x ]->result_id ); ?>" /></td>
<td class="<?php echo apply_filters( 'qsm_results_quiz_name_class','', $quiz_infos[ $x ]->result_id ); ?>"><span style="font-size:16px;"><?php echo esc_html( $quiz_infos[ $x ]->quiz_name ); ?></span><div class="row-actions"><span style="color:green;font-size:16px;"><a href="admin.php?page=qsm_quiz_result_details&result_id=<?php echo esc_attr( $quiz_infos[ $x ]->result_id ); ?>"><?php esc_html_e( 'View', 'quiz-master-next' ); ?></a> | <a style="color: red;" class="delete_table_quiz_results_item" data-quiz-id="<?php echo esc_attr( $quiz_infos[ $x ]->result_id ); ?>" data-quiz-name="<?php echo esc_attr( $quiz_infos[ $x ]->quiz_name ); ?>" href='#'><?php esc_html_e( 'Delete', 'quiz-master-next' ); ?></a> | <a class="<?php echo esc_attr( $quiz_infos[ $x ]->proctor_report_class ); ?>" href='<?php echo esc_attr( $quiz_infos[ $x ]->proctor_report_link ); ?>'><?php esc_html_e( 'View Report', 'quiz-master-next' ); ?></a></span></div></td>
<td class="<?php echo apply_filters( 'qsm_results_quiz_name_class','', $quiz_infos[ $x ]->result_id ); ?>"><span style="font-size:16px;"><?php echo esc_html( $quiz_infos[ $x ]->quiz_name ); ?></span><div class="row-actions"><span style="color:green;font-size:16px;"><a href="admin.php?page=qsm_quiz_result_details&result_id=<?php echo esc_attr( $quiz_infos[ $x ]->result_id ); ?>"><?php esc_html_e( 'View Results', 'quiz-master-next' ); ?></a> | <a style="color: red;" class="delete_table_quiz_results_item" data-quiz-id="<?php echo esc_attr( $quiz_infos[ $x ]->result_id ); ?>" data-quiz-name="<?php echo esc_attr( $quiz_infos[ $x ]->quiz_name ); ?>" href='#'><?php esc_html_e( 'Delete', 'quiz-master-next' ); ?></a> | <a class="<?php echo esc_attr( $quiz_infos[ $x ]->proctor_report_class ); ?>" href='<?php echo esc_attr( $quiz_infos[ $x ]->proctor_report_link ); ?>'><?php esc_html_e( 'Proctor Reports', 'quiz-master-next' ); ?></a></span></div></td>
<?php
foreach ( $values as $k => $v ) {
if ( isset( $v['content'][ $x ] ) ) {
Expand Down
33 changes: 28 additions & 5 deletions php/classes/class-qmn-quiz-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -495,11 +495,30 @@ public function display_shortcode( $atts ) {
$encryption[ $question['question_id'] ]['correct_info_text'] = $mlwQuizMasterNext->pluginHelper->qsm_language_support( $encryption[ $question['question_id'] ]['correct_info_text'], "correctanswerinfo-{$question['question_id']}" );
}
if ( ( isset($qmn_json_data['end_quiz_if_wrong']) && 0 < $qmn_json_data['end_quiz_if_wrong'] ) || ( ! empty( $qmn_json_data['enable_quick_result_mc'] ) && 1 == $qmn_json_data['enable_quick_result_mc'] ) ) {
$quiz_id = $qmn_json_data['quiz_id'];
$qsm_inline_encrypt_js = '
var encryptionKey = "'.hash('sha256',time()).'";
var data = '.wp_json_encode($encryption).';
var jsonString = JSON.stringify(data);
var encryptedData = CryptoJS.AES.encrypt(jsonString, encryptionKey).toString();';
if (encryptionKey === undefined) {
var encryptionKey = {};
}
if (data === undefined) {
var data = {};
}
if (jsonString === undefined) {
var jsonString = {};
}
if (encryptedData === undefined) {
var encryptedData = {};
}
encryptionKey['.$quiz_id.'] = "'.hash('sha256',time().$quiz_id).'";
data['.$quiz_id.'] = '.wp_json_encode($encryption).';
jsonString['.$quiz_id.'] = JSON.stringify(data['.$quiz_id.']);
encryptedData['.$quiz_id.'] = CryptoJS.AES.encrypt(jsonString['.$quiz_id.'], encryptionKey['.$quiz_id.']).toString();';
wp_add_inline_script('qsm_encryption', $qsm_inline_encrypt_js, 'after');
}

Expand Down Expand Up @@ -709,7 +728,11 @@ public function load_questions( $quiz_id, $quiz_options, $is_quiz_page, $questio
if ( ! empty( $tq_ids ) && ! empty( (array_column(array_merge(...array_map('array_merge', $tq_ids)),'question_id')) ) ) {
$exclude_ids = implode(',', array_column(array_merge(...array_map('array_merge', $tq_ids)),'question_id') );
}
$tq_ids[] = $wpdb->get_results( "SELECT DISTINCT `question_id` FROM `{$wpdb->prefix}mlw_question_terms` WHERE `quiz_id` = $quiz_id AND `term_id` = $category AND `taxonomy`='qsm_category' AND question_id NOT IN ($exclude_ids) LIMIT $limit", ARRAY_A );
$category_order_sql = '';
if ( 1 == $quiz_options->randomness_order || 2 == $quiz_options->randomness_order ) {
$category_order_sql = 'ORDER BY rand()';
}
$tq_ids[] = $wpdb->get_results( "SELECT DISTINCT `question_id` FROM `{$wpdb->prefix}mlw_question_terms` WHERE `quiz_id` = $quiz_id AND `term_id` = $category AND `taxonomy`='qsm_category' AND question_id NOT IN ($exclude_ids) ".esc_sql( $category_order_sql )." LIMIT $limit", ARRAY_A );
}
$final_result = array_column(array_merge(...array_map('array_merge', $tq_ids)),'question_id');
if ( 1 == $quiz_options->randomness_order || 2 == $quiz_options->randomness_order ) {
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ This is usually a theme conflict. You can [checkout out our common conflict solu
* Feature: Added a new feature to accept shortcodes in the text set to display at the end of quizzes.
* Bug: Fixed issues with HTML tags in exported PDFs
* Bug: Fixed issues with HTML tags in question descriptions
* Bug: Fixed the behavior of questions marked as required.
* Bug: Fixed issue with the 'Required box' unchecking itself
* Bug: Patched a vulnerability related to draft quiz submissions

= 8.1.16 (September 20, 2023) =
Expand Down

0 comments on commit 293fd3c

Please sign in to comment.