Skip to content

Commit a621468

Browse files
committed
Merge remote-tracking branch 'origin/support/2.13.0' into support/2.14.0
2 parents 30be966 + bd0b1a3 commit a621468

6 files changed

Lines changed: 10 additions & 14 deletions

File tree

inc/abstracttarget.class.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,11 @@ protected function prepareTemplate($template, PluginFormcreatorFormAnswer $formA
217217
/**
218218
* Append fields data to input
219219
*
220-
* @param PluginFormcreatorFormanswer $formanswer the source formanswer
221220
* @param array $input data of the generated target
222-
* @return void
221+
* @param PluginFormcreatorFormanswer $formanswer the source formanswer
222+
* @return array
223223
*/
224-
protected function appendFieldsData(PluginFormcreatorFormanswer $formanswer, &$input): void {
224+
protected function appendFieldsData(array$input, PluginFormcreatorFormanswer $formanswer): array {
225225
global $DB;
226226

227227
//get all PluginFormcreatorAnswer
@@ -262,6 +262,8 @@ protected function appendFieldsData(PluginFormcreatorFormanswer $formanswer, &$i
262262
}
263263
$input['c_id'] = $blocks_field;
264264
}
265+
266+
return $input;
265267
}
266268

267269

inc/field/textfield.class.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,7 @@ public function getValueForDesign(): string {
109109
}
110110

111111
public function getValueForTargetText($domain, $richText): ?string {
112-
if ($richText) {
113-
return Sanitizer::encodeHtmlSpecialChars($this->value);
114-
}
115-
116-
return $this->value;
112+
return Sanitizer::encodeHtmlSpecialChars($this->value);
117113
}
118114

119115
public function moveUploads() {

inc/question.class.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,6 @@ public function getRenderedHtml($domain, $canEdit = true, ?PluginFormcreatorForm
308308
return '';
309309
}
310310

311-
$html = '';
312-
313311
$field = $this->getSubField();
314312
if (!$field->isPrerequisites()) {
315313
return '';
@@ -321,7 +319,7 @@ public function getRenderedHtml($domain, $canEdit = true, ?PluginFormcreatorForm
321319
$x = $this->fields['col'];
322320
$width = $this->fields['width'];
323321
$hiddenAttribute = $isVisible ? '' : 'hidden=""';
324-
$html .= '<div'
322+
$html = '<div'
325323
. ' gs-x="' . $x . '"'
326324
. ' gs-w="' . $width . '"'
327325
. ' data-itemtype="' . self::class . '"'

inc/targetticket.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ public function save(PluginFormcreatorFormAnswer $formanswer): ?CommonDBTM {
877877

878878
$data = $this->prepareUploadedFiles($data, $formanswer);
879879

880-
$this->appendFieldsData($formanswer, $data);
880+
$data = $this->appendFieldsData($data, $formanswer);
881881

882882
// Cleanup actors array
883883
$data = $this->cleanActors($data);

install/upgrade_to_2.13.6.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function migrateToRichText() {
7171

7272
foreach ($tables as $table => $fields) {
7373
$request = [
74-
'SELECT' => ['id'] + $fields,
74+
'SELECT' => array_merge(['id'], $fields),
7575
'FROM' => $table
7676
];
7777
foreach ($DB->request($request) as $row) {

tests/3-unit/GlpiPlugin/Formcreator/Field/TextField.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ public function providerGetValueForTargetText() {
401401
'question' => $this->getQuestion(),
402402
'value' => '"><img src=x onerror="alert(1337)" x=x>',
403403
'expected' => true,
404-
'expectedValue' => '"><img src=x onerror="alert(1337)" x=x>',
404+
'expectedValue' => '"&#62;&#60;img src=x onerror="alert(1337)" x=x&#62;',
405405
],
406406
];
407407
}

0 commit comments

Comments
 (0)