Fixing SQL error when receiving DFRN posts (#5527)
* Some more notices * Fixed nasty to find notice in DFRN and OStatus * And more notices ... * Yeah, some removed notices ... again ... * Fixing bad SQL query
This commit is contained in:
parent
a2cea16954
commit
1eb8f04274
3 changed files with 30 additions and 5 deletions
|
@ -212,7 +212,8 @@ function dfrn_dispatch_public($postdata)
|
|||
}
|
||||
|
||||
// We now have some contact, so we fetch it
|
||||
$importer = DBA::fetchFirst("SELECT *, `name` as `senderName`
|
||||
$importer = DBA::fetchFirst("SELECT *, `name` as `senderName`,
|
||||
0 AS `importer_uid`,
|
||||
'' AS `uprvkey`,
|
||||
'UTC' AS `timezone`,
|
||||
'' AS `nickname`,
|
||||
|
@ -225,8 +226,6 @@ function dfrn_dispatch_public($postdata)
|
|||
WHERE NOT `blocked` AND `id` = ? LIMIT 1",
|
||||
$contact['id']);
|
||||
|
||||
$importer['importer_uid'] = 0;
|
||||
|
||||
// This should never fail
|
||||
if (!DBA::isResult($importer)) {
|
||||
logger('Contact not found for address ' . $msg['author']);
|
||||
|
|
|
@ -54,10 +54,32 @@ function hovercard_content()
|
|||
$contact = [];
|
||||
// if it's the url containing https it should be converted to http
|
||||
$nurl = normalise_link(GContact::cleanContactUrl($profileurl));
|
||||
if ($nurl) {
|
||||
// Search for contact data
|
||||
if (!$nurl) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Search for contact data
|
||||
// Look if the local user has got the contact
|
||||
if (local_user()) {
|
||||
$contact = Contact::getDetailsByURL($nurl, local_user());
|
||||
}
|
||||
|
||||
// If not then check the global user
|
||||
if (!count($contact)) {
|
||||
$contact = Contact::getDetailsByURL($nurl);
|
||||
}
|
||||
|
||||
// Feeds url could have been destroyed through "cleanContactUrl", so we now use the original url
|
||||
if (!count($contact) && local_user()) {
|
||||
$nurl = normalise_link($profileurl);
|
||||
$contact = Contact::getDetailsByURL($nurl, local_user());
|
||||
}
|
||||
|
||||
if (!count($contact)) {
|
||||
$nurl = normalise_link($profileurl);
|
||||
$contact = Contact::getDetailsByURL($nurl);
|
||||
}
|
||||
|
||||
if (!count($contact)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1374,6 +1374,10 @@ class Diaspora
|
|||
$item = Item::selectFirst($fields, $condition);
|
||||
|
||||
if (!DBA::isResult($item)) {
|
||||
if (!isset($contact["url"])) {
|
||||
logger('Missing URL: ' . System::callstack() . ' - ' . json_encode($contact));
|
||||
}
|
||||
|
||||
$result = self::storeByGuid($guid, $contact["url"], $uid);
|
||||
|
||||
if (!$result) {
|
||||
|
|
Loading…
Reference in a new issue