Skip to content

Commit

Permalink
fix(answer): HTML entity decode for older textarea answers
Browse files Browse the repository at this point in the history
  • Loading branch information
btry committed Dec 15, 2017
1 parent 278c628 commit 3612c3c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 23 additions & 0 deletions install/update_dev.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

function plugin_formcreator_update_dev() {
global $DB;

// decode html entities in name of questions
$request = [
'SELECT' => ['glpi_plugin_formcreator_answers.*'],
'FROM' => 'glpi_plugin_formcreator_answers',
'INNER JOIN' => ['glpi_plugin_formcreator_questions' => [
'FKEY' => [
'glpi_plugin_formcreator_answers' => 'plugin_formcreator_questions_id',
'glpi_plugin_formcreator_questions' => 'id'
]
]],
'WHERE' => ['fieldtype' => 'textarea']
];
foreach ($DB->request($request) as $row) {
$answer = Toolbox::addslashes_deep(html_entity_decode($row['answer']));
$id = $row['id'];
$DB->query("UPDATE `glpi_plugin_formcreator_answers` SET `answer`='$answer' WHERE `id` = '$id'");
}
}
2 changes: 1 addition & 1 deletion setup.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
global $CFG_GLPI;
// Version of the plugin
define('PLUGIN_FORMCREATOR_VERSION', '2.6.0');
define('PLUGIN_FORMCREATOR_VERSION', '2.6.0-dev');
// Schema version of this version
define('PLUGIN_FORMCREATOR_SCHEMA_VERSION', '2.6');

Expand Down

0 comments on commit 3612c3c

Please sign in to comment.