Ahhh, the foreign characters always get me
The fix mainly consists of adding a "true" parameter at the end of the request_var function.
CATEGORIES
Code: Select all
--------------OPEN includes/acp/acp_quiz.php--------------------
-----------FIND----------------
// Now do the actual update, fix up the category name first.
$category = utf8_normalize_nfc( $db->sql_escape(request_var('category_name', '')) );
-------------REPLACE WITH-------------
// Now do the actual update, fix up the category name first.
$category = $db->sql_escape( utf8_normalize_nfc(request_var('category_name', '', true)) );
---------------FIND---------------
if( !check_form_key('uqm_category') )
{
trigger_error($user->lang['ACP_UQM_QUIZ_FORM_INVALID'] . adm_back_link(append_sid("{$phpbb_admin_path}index.$phpEx?i=quiz&t=add_category")));
}
$category = utf8_normalize_nfc( $db->sql_escape(request_var('category_name', '')) );
---------REPLACE WITH------------
if( !check_form_key('uqm_category') )
{
trigger_error($user->lang['ACP_UQM_QUIZ_FORM_INVALID'] . adm_back_link(append_sid("{$phpbb_admin_path}index.$phpEx?i=quiz&t=add_category")));
}
$category = $db->sql_escape( utf8_normalize_nfc(request_var('category_name', '', true)) );
EDIT: here are the fixes for adding/playing quizzes
Code: Select all
---OPEN quiz.php---
---FIND---
$check_correct = $quiz_configuration->check_correct_checked($current_questions); // see if the user has left any empty
$quiz_name = request_var('quiz_name', '');
---REPLACE WITH---
$check_correct = $quiz_configuration->check_correct_checked($current_questions); // see if the user has left any empty
$quiz_name = request_var('quiz_name', '', true);
----OPEN includes/quiz/quiz_question.php----
---FIND---
for($i = 0; $i < request_var('question_number', 0); $i++)
{
$question_name = request_var('question_name_' . $i, '');
$answers_name = request_var('answers_' . $i, '');
$multiples = explode("\n", $answers_name);
$correct = request_var('answer_' . $i, '');
---REPLACE WITH---
for($i = 0; $i < request_var('question_number', 0); $i++)
{
$question_name = request_var('question_name_' . $i, '', true);
$answers_name = request_var('answers_' . $i, '', true);
$multiples = explode("\n", $answers_name);
$correct = request_var('answer_' . $i, '', true);
Then run these SQL queries to convert the database tables to utf8_bin (by default they are collated in latin or something, which is another thing that will be rectified with UMIL...)
Code: Select all
----DATABASE----
ALTER DATABASE `phpbb_quiz` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
ALTER DATABASE `phpbb_quiz_categories` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
ALTER DATABASE `phpbb_quiz_questions` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
ALTER DATABASE `phpbb_quiz_statistics` DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
Edit 2: screenshots of foreign characters working + the quiz play once setting below. I also found a bug whereby if the "show answers" config setting is disabled, then no quiz statistics are stored - that's fixed now