From: Michael Date: Sun, 24 May 2020 20:40:00 +0000 (+0000) Subject: Some more "baseurl" improvements X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=327cdf21ce96559a70b7cb535b324a9a632bb210;p=friendica.git Some more "baseurl" improvements --- diff --git a/src/Model/Contact.php b/src/Model/Contact.php index ee49d9b75c..3ddefdd0bf 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -1542,6 +1542,14 @@ class Contact return 0; } + if (!empty($data['baseurl'])) { + $data['baseurl'] = GServer::cleanURL($data['baseurl']); + } + + if (!empty($data['baseurl']) && empty($data['gsid'])) { + $data['gsid'] = GServer::getID($data['baseurl']); + } + if (!$contact_id && !empty($data['alias']) && ($data['alias'] != $url) && !$in_loop) { $contact_id = self::getIdForURL($data["alias"], $uid, true, $default, true); } @@ -1624,7 +1632,7 @@ class Contact } } } else { - $fields = ['url', 'nurl', 'addr', 'alias', 'name', 'nick', 'keywords', 'location', 'about', 'avatar-date', 'baseurl']; + $fields = ['url', 'nurl', 'addr', 'alias', 'name', 'nick', 'keywords', 'location', 'about', 'avatar-date', 'baseurl', 'gsid']; $contact = DBA::selectFirst('contact', $fields, ['id' => $contact_id]); // This condition should always be true @@ -1638,7 +1646,7 @@ class Contact 'updated' => DateTimeFormat::utcNow() ]; - $fields = ['addr', 'alias', 'name', 'nick', 'keywords', 'location', 'about', 'baseurl']; + $fields = ['addr', 'alias', 'name', 'nick', 'keywords', 'location', 'about', 'baseurl', 'gsid']; foreach ($fields as $field) { $updated[$field] = ($data[$field] ?? '') ?: $contact[$field]; diff --git a/src/Network/Probe.php b/src/Network/Probe.php index 4333196547..28f58c4676 100644 --- a/src/Network/Probe.php +++ b/src/Network/Probe.php @@ -436,9 +436,7 @@ class Probe $data['url'] = $uri; } - if (!empty($data['photo']) && !empty($data['baseurl'])) { - $data['baseurl'] = Network::getUrlMatch(Strings::normaliseLink($data['baseurl']), Strings::normaliseLink($data['photo'])); - } elseif (empty($data['photo'])) { + if (empty($data['photo'])) { $data['photo'] = DI::baseUrl() . '/images/person-300.jpg'; }