File tree 1 file changed +21
-0
lines changed
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ public function isResyncIssuesRequired() {
46
46
public function upgrade (Migration $ migration ) {
47
47
$ this ->migration = $ migration ;
48
48
$ this ->migrateToRichText ();
49
+ $ this ->sanitizeConditions ();
49
50
}
50
51
51
52
public function migrateToRichText () {
@@ -82,4 +83,24 @@ public function migrateToRichText() {
82
83
}
83
84
}
84
85
}
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
+ }
85
106
}
You can’t perform that action at this time.
0 commit comments