File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ public function isResyncIssuesRequired() {
4646 public function upgrade (Migration $ migration ) {
4747 $ this ->migration = $ migration ;
4848 $ this ->migrateToRichText ();
49+ $ this ->sanitizeConditions ();
4950 }
5051
5152 public function migrateToRichText () {
@@ -82,4 +83,24 @@ public function migrateToRichText() {
8283 }
8384 }
8485 }
86+
87+ /**
88+ * Conditions written in Formcreator < 2.13.0 are not sanitized.
89+ * With versions >= 2.13.0, comparisons require sanitization
90+ *
91+ * @return void
92+ */
93+ protected function sanitizeConditions () {
94+ global $ DB ;
95+
96+ $ table = 'glpi_plugin_formcreator_conditions ' ;
97+ $ request = $ DB ->request ([
98+ 'SELECT ' => ['id ' , 'show_value ' ],
99+ 'FROM ' => $ table ,
100+ ]);
101+ foreach ($ request as $ row ) {
102+ $ row ['show_value ' ] = Sanitizer::sanitize ($ row ['show_value ' ], true );
103+ $ DB ->update ($ table , $ row , ['id ' => $ row ['id ' ]]);
104+ }
105+ }
85106}
You can’t perform that action at this time.
0 commit comments