1
0
Fork 0

Merge pull request #4029 from annando/update-pubkey

Update the public key for public contacts if the key was empty before
This commit is contained in:
Hypolite Petovan 2017-12-07 07:54:59 -05:00 committed by GitHub
commit 70597eb67a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -694,7 +694,8 @@ class Contact extends BaseObject
self::updateAvatar($data["photo"], $uid, $contact_id); self::updateAvatar($data["photo"], $uid, $contact_id);
$contact = dba::select('contact', array('url', 'nurl', 'addr', 'alias', 'name', 'nick', 'keywords', 'location', 'about', 'avatar-date'), array('id' => $contact_id), array('limit' => 1)); $fields = array('url', 'nurl', 'addr', 'alias', 'name', 'nick', 'keywords', 'location', 'about', 'avatar-date', 'pubkey');
$contact = dba::select('contact', $fields, array('id' => $contact_id), array('limit' => 1));
// This condition should always be true // This condition should always be true
if (!DBM::is_result($contact)) { if (!DBM::is_result($contact)) {
@ -708,6 +709,13 @@ class Contact extends BaseObject
'name' => $data['name'], 'name' => $data['name'],
'nick' => $data['nick']); 'nick' => $data['nick']);
// Only fill the pubkey if it was empty before. We have to prevent identity theft.
if (!empty($contact['pubkey'])) {
unset($contact['pubkey']);
} else {
$updated['pubkey'] = $data['pubkey'];
}
if ($data['keywords'] != '') { if ($data['keywords'] != '') {
$updated['keywords'] = $data['keywords']; $updated['keywords'] = $data['keywords'];
} }