Skip to content

Commit

Permalink
Merge pull request #4553 from okaufman/ilias7_30658
Browse files Browse the repository at this point in the history
T&A: fix 30658
  • Loading branch information
mbecker-databay authored Jun 14, 2022
2 parents 116ab24 + bb5bc50 commit a4e49e4
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 a4e49e4

Please sign in to comment.