MDL-65552 user: escape idnumber and email in table_sql

This commit is contained in:
Marina Glancy
2021-03-03 23:14:37 +08:00
committed by Jun Pataleta
parent 7afca3b34a
commit 009b90a43b
6 changed files with 11 additions and 5 deletions
+6
View File
@@ -841,6 +841,12 @@ class flexible_table {
* build_table which calls this method.
*/
function other_cols($column, $row) {
if (isset($row->$column) && ($column === 'email' || $column === 'idnumber') &&
(!$this->is_downloading() || $this->export_class_instance()->supports_html())) {
// Columns email and idnumber may potentially contain malicious characters, escape them by default.
// This function will not be executed if the child class implements col_email() or col_idnumber().
return s($row->$column);
}
return NULL;
}