From f2feb260f7309597333d7c745ac3f9c49a634fe2 Mon Sep 17 00:00:00 2001 From: moodler Date: Wed, 29 Mar 2006 06:11:50 +0000 Subject: [PATCH] A fix for SC178. The match question is now encrypted slightly. --- mod/quiz/questiontypes/match/questiontype.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mod/quiz/questiontypes/match/questiontype.php b/mod/quiz/questiontypes/match/questiontype.php index cba2e20ea42..76a6126b48c 100644 --- a/mod/quiz/questiontypes/match/questiontype.php +++ b/mod/quiz/questiontypes/match/questiontype.php @@ -224,7 +224,7 @@ class quiz_match_qtype extends quiz_default_questiontype { echo ''; /// Drop-down list: - $menuname = $nameprefix.$subquestion->id; + $menuname = $nameprefix.rc4encrypt($subquestion->id); $response = isset($state->responses[$subquestion->id]) ? $state->responses[$subquestion->id] : '0'; if ($options->readonly @@ -256,6 +256,14 @@ class quiz_match_qtype extends quiz_default_questiontype { function grade_responses(&$question, &$state, $quiz) { $subquestions = $state->options->subquestions; + + foreach ($state->responses as $key => $value) { // Decrypt strings back to numbers + if ((string)(int)$key == (string)$key) { // Has been done before + continue; + } + unset($state->responses[$key]); + $state->responses[rc4decrypt($key)] = $value; + } $responses = &$state->responses; $answers = array();