Issue 14324: Sanitize profile input

This commit is contained in:
Michael 2024-07-28 04:34:44 +00:00
parent aae004d3d2
commit ef71840ddc
4 changed files with 38 additions and 6 deletions

View file

@ -1486,4 +1486,31 @@ function update_1566()
Profile::setResponsibleRelayContact($user['uid']);
}
DBA::close($users);
}
}
function update_1571()
{
$profiles = DBA::select('profile', ['uid', 'homepage', 'xmpp', 'matrix']);
while ($profile = DBA::fetch($profiles)) {
$homepage = str_replace(['<', '>', '"', ' '], '', $profile['homepage']);
$xmpp = str_replace(['<', '>', '"', ' '], '', $profile['xmpp']);
$matrix = str_replace(['<', '>', '"', ' '], '', $profile['matrix']);
$fields = [];
if ($homepage != $profile['homepage']) {
$fields['homepage'] = $homepage;
}
if ($xmpp != $profile['xmpp']) {
$fields['xmpp'] = $xmpp;
}
if ($matrix != $profile['matrix']) {
$fields['matrix'] = $matrix;
}
if (!empty($fields)) {
Profile::update($fields, $profile['uid']);
}
}
DBA::close($profiles);
return Update::SUCCESS;
}