Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions components/ILIAS/Survey/Editing/class.ilSurveyEditorGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
*
*********************************************************************/

declare(strict_types=1);

use ILIAS\Survey\Editing\EditManager;
use ILIAS\Survey\Editing\EditingGUIRequest;

Expand Down Expand Up @@ -48,6 +50,7 @@ class ilSurveyEditorGUI
protected ilObjSurveyGUI $parent_gui;
protected ilObjSurvey $object;
protected array $print_options;
protected \ilHtmlPurifierInterface $purifier;

public function __construct(ilObjSurveyGUI $a_parent_gui)
{
Expand All @@ -72,6 +75,7 @@ public function __construct(ilObjSurveyGUI $a_parent_gui)
$this->tpl = $tpl;

$this->ctrl->saveParameter($this, array("pgov", "pgov_pos"));
$this->purifier = new ilSvyStandardPurifier();

$this->print_options = array(
//0 => $this->lng->txt('none'),
Expand Down Expand Up @@ -962,6 +966,8 @@ protected function initHeadingForm(
$heading->setRows(10);
$heading->setCols(80);
$heading->setRequired(true);
$heading->usePurifier(true);
$heading->setPurifier($this->purifier);
$form->addItem($heading);

$insertbefore = new ilSelectInputGUI($this->lng->txt("insert"), "insertbefore");
Expand Down Expand Up @@ -1027,12 +1033,7 @@ public function saveHeadingObject(): void

$form = $this->initHeadingForm($q_id);
if ($form->checkInput()) {
$tags = ilObjAdvancedEditing::_getUsedHTMLTags("survey");
$purifier = new HTMLPurifier($tags);
$heading = $form->getInput("heading");

$heading = $purifier->purify($heading);

$heading = $this->purifier->purify($form->getInput("heading"));
$this->object->saveHeading($heading, $form->getInput("insertbefore"));
$this->ctrl->redirect($this, "questions");
}
Expand Down
19 changes: 11 additions & 8 deletions components/ILIAS/Survey/Settings/class.SettingsFormGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

namespace ILIAS\Survey\Settings;

use HTMLPurifier;
use ILIAS\Survey\InternalGUIService;
use ILIAS\Survey\Mode\UIModifier;
use ILIAS\Survey\InternalDomainService;
Expand All @@ -40,13 +39,15 @@ class SettingsFormGUI
protected \ILIAS\Survey\Mode\FeatureConfig $feature_config;
protected \ilRbacSystem $rbacsystem;
private \ilGlobalTemplateInterface $main_tpl;
protected \ilHtmlPurifierInterface $purifier;

public function __construct(
InternalGUIService $ui_service,
InternalDomainService $domain_service,
\ilObjectService $object_service,
\ilObjSurvey $survey,
UIModifier $modifier
UIModifier $modifier,
\ilHtmlPurifierInterface $purifier
) {
global $DIC;
$this->main_tpl = $DIC->ui()->mainTemplate();
Expand All @@ -59,6 +60,7 @@ public function __construct(
$this->domain_service = $domain_service;
$this->modifier = $modifier;
$this->feature_config = $this->domain_service->modeFeatureConfig($survey->getMode());
$this->purifier = $purifier;
}

public function checkForm(\ilPropertyFormGUI $form): bool
Expand Down Expand Up @@ -334,6 +336,9 @@ public function withBeforeStart(
$intro->setUseRte(true);
$intro->setRteTagSet("mini");
}
$intro->usePurifier(true);
$intro->setPurifier(new \ilSvyStandardPurifier());

$form->addItem($intro);

return $form;
Expand Down Expand Up @@ -452,6 +457,8 @@ public function withAfterEnd(
$finalstatement->setUseRte(true);
$finalstatement->setRteTagSet("mini");
}
$finalstatement->usePurifier(true);
$finalstatement->setPurifier(new \ilSvyStandardPurifier());
$form->addItem($finalstatement);

// mail notification
Expand Down Expand Up @@ -885,14 +892,10 @@ public function saveForm(
} else {
$survey->setEndDate("");
}
$tags = ilObjAdvancedEditing::_getUsedHTMLTags("survey");
$purifier = new HTMLPurifier($tags);
$introduction = $this->purifier->purify($form->getInput('introduction'));

$introduction = $form->getInput("introduction");
$introduction = $purifier->purify($introduction);
$survey->setIntroduction($introduction);
$outro = $form->getInput("outro");
$outro = $purifier->purify($outro);
$outro = $this->purifier->purify($form->getInput('outro'));
$survey->setOutro($outro);
$survey->setShowQuestionTitles((bool) $form->getInput("show_question_titles"));

Expand Down
7 changes: 4 additions & 3 deletions components/ILIAS/Survey/Settings/class.UIFactory.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

declare(strict_types=1);

/**
* This file is part of ILIAS, a powerful learning management system
* published by ILIAS open source e-Learning e.V.
Expand All @@ -18,6 +16,8 @@
*
*********************************************************************/

declare(strict_types=1);

namespace ILIAS\Survey\Settings;

use ILIAS\Survey\InternalGUIService;
Expand Down Expand Up @@ -48,7 +48,8 @@ public function __construct(
$this->domain_service,
$object_service,
$survey,
$mode_ui_modifier
$mode_ui_modifier,
new \ilSvyStandardPurifier()
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
*
*********************************************************************/

declare(strict_types=1);

use ILIAS\SurveyQuestionPool\Editing\EditingGUIRequest;
use ILIAS\SurveyQuestionPool\Editing\EditManager;
use ILIAS\LegalDocuments\HTMLPurifier;

/**
* Basic class for all survey question types
Expand All @@ -45,6 +46,7 @@ abstract class SurveyQuestionGUI
protected string $parent_url = "";
protected ilLogger $log;
public ?SurveyQuestion $object = null;
protected \ilHtmlPurifierInterface $purifier;

public function __construct($a_id = -1)
{
Expand Down Expand Up @@ -91,6 +93,7 @@ public function __construct($a_id = -1)
->editing();
$this->gui = $DIC->survey()->internal()->gui();
$this->domain = $DIC->survey()->internal()->domain();
$this->purifier = new ilSvyStandardPurifier();
}

abstract protected function initObject(): void;
Expand Down Expand Up @@ -265,6 +268,8 @@ protected function initEditForm(): ilPropertyFormGUI
$question->setUseRte(true);
$question->setRteTagSet("mini");
}
$question->usePurifier(true);
$question->setPurifier($this->purifier);
$form->addItem($question);

// obligatory
Expand Down Expand Up @@ -330,13 +335,10 @@ protected function saveForm(): bool
$this->object->setAuthor($form->getInput("author"));
$this->object->setDescription($form->getInput("description"));

$tags = ilObjAdvancedEditing::_getUsedHTMLTags("survey");
$purifier = new HTMLPurifier($tags);
$question = $form->getInput("question");

$question = $purifier->purify($question);
$this->object->setQuestiontext(
$this->purifier->purify($form->getInput("question"))
);

$this->object->setQuestiontext($question);
$this->object->setObligatory($form->getInput("obligatory"));

$this->importEditFormValues($form);
Expand Down
Loading