mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-07 15:54:26 +02:00
Issue 14324: Sanitize profile input
This commit is contained in:
parent
aae004d3d2
commit
ef71840ddc
4 changed files with 38 additions and 6 deletions
29
update.php
29
update.php
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue