Skip to content

Commit

Permalink
fix 30658
Browse files Browse the repository at this point in the history
  • Loading branch information
okaufman committed May 16, 2022
1 parent 6c3f3e5 commit bb5bc50
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions Modules/TestQuestionPool/classes/class.assLongMenuGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ protected function writePostData($always = false)
public function writeQuestionSpecificPostData(ilPropertyFormGUI $form)
{
$this->object->setLongMenuTextValue(ilUtil::stripSlashesRecursive($_POST['longmenu_text']));
$this->object->setAnswers(json_decode(ilUtil::stripSlashesRecursive($_POST['hidden_text_files'])));
$this->object->setCorrectAnswers(json_decode(ilUtil::stripSlashesRecursive($_POST['hidden_correct_answers'])));
$this->object->setAnswers($this->trimArrayRecursive(json_decode(ilUtil::stripSlashesRecursive($_POST['hidden_text_files']))));
$this->object->setCorrectAnswers($this->trimArrayRecursive(json_decode(ilUtil::stripSlashesRecursive($_POST['hidden_correct_answers']))));
$this->object->setAnswerType(ilUtil::stripSlashesRecursive($_POST['long_menu_type']));
$this->object->setQuestion($_POST['question']);
$this->object->setLongMenuTextValue($_POST["longmenu_text"]);
Expand All @@ -101,6 +101,22 @@ public function writeQuestionSpecificPostData(ilPropertyFormGUI $form)
$this->saveTaxonomyAssignments();
}

protected function trimArrayRecursive(array $data)
{
if (is_array($data)) {
foreach ($data as $k => $v) {
if (is_array($v)) {
$data[$k] = $this->trimArrayRecursive($v);
} else {
$data[$k] = trim($v);
}
}
} else {
$data = trim($data);
}
return $data;
}

protected function editQuestion(ilPropertyFormGUI $form = null)
{
if ($form === null) {
Expand Down

0 comments on commit bb5bc50

Please sign in to comment.