Skip to content

Commit 3612c3c

Browse files
committed
fix(answer): HTML entity decode for older textarea answers
1 parent 278c628 commit 3612c3c

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

install/update_dev.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
function plugin_formcreator_update_dev() {
4+
global $DB;
5+
6+
// decode html entities in name of questions
7+
$request = [
8+
'SELECT' => ['glpi_plugin_formcreator_answers.*'],
9+
'FROM' => 'glpi_plugin_formcreator_answers',
10+
'INNER JOIN' => ['glpi_plugin_formcreator_questions' => [
11+
'FKEY' => [
12+
'glpi_plugin_formcreator_answers' => 'plugin_formcreator_questions_id',
13+
'glpi_plugin_formcreator_questions' => 'id'
14+
]
15+
]],
16+
'WHERE' => ['fieldtype' => 'textarea']
17+
];
18+
foreach ($DB->request($request) as $row) {
19+
$answer = Toolbox::addslashes_deep(html_entity_decode($row['answer']));
20+
$id = $row['id'];
21+
$DB->query("UPDATE `glpi_plugin_formcreator_answers` SET `answer`='$answer' WHERE `id` = '$id'");
22+
}
23+
}

setup.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
global $CFG_GLPI;
33
// Version of the plugin
4-
define('PLUGIN_FORMCREATOR_VERSION', '2.6.0');
4+
define('PLUGIN_FORMCREATOR_VERSION', '2.6.0-dev');
55
// Schema version of this version
66
define('PLUGIN_FORMCREATOR_SCHEMA_VERSION', '2.6');
77

0 commit comments

Comments
 (0)