mirror of
https://github.com/friendica/friendica
synced 2024-11-10 07:42:53 +00:00
Better behaviour when contact wasn't found.
This commit is contained in:
parent
fb72871f66
commit
419a3ab2d3
1 changed files with 18 additions and 19 deletions
37
mod/item.php
37
mod/item.php
|
@ -128,28 +128,27 @@ function item_post(&$a) {
|
||||||
intval($parent_item['contact-id']),
|
intval($parent_item['contact-id']),
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
if(count($r)) {
|
if(count($r))
|
||||||
$parent_contact = $r[0];
|
$parent_contact = $r[0];
|
||||||
|
|
||||||
// If the contact id doesn't fit with the contact, then set the contact to null
|
// If the contact id doesn't fit with the contact, then set the contact to null
|
||||||
$thrparent = q("SELECT `author-link`, `network` FROM `item` WHERE `uri` = '%s' LIMIT 1", dbesc($thr_parent));
|
$thrparent = q("SELECT `author-link`, `network` FROM `item` WHERE `uri` = '%s' LIMIT 1", dbesc($thr_parent));
|
||||||
if (count($thrparent) AND ($thrparent[0]["network"] === NETWORK_OSTATUS)
|
if (count($thrparent) AND ($thrparent[0]["network"] === NETWORK_OSTATUS)
|
||||||
AND (normalise_link($parent_contact["url"]) != normalise_link($thrparent[0]["author-link"]))) {
|
AND (normalise_link($parent_contact["url"]) != normalise_link($thrparent[0]["author-link"]))) {
|
||||||
$parent_contact = null;
|
$parent_contact = null;
|
||||||
|
|
||||||
require_once("include/Scrape.php");
|
require_once("include/Scrape.php");
|
||||||
$probed_contact = probe_url($thrparent[0]["author-link"]);
|
$probed_contact = probe_url($thrparent[0]["author-link"]);
|
||||||
if ($probed_contact["network"] != NETWORK_FEED) {
|
if ($probed_contact["network"] != NETWORK_FEED) {
|
||||||
$parent_contact = $probed_contact;
|
$parent_contact = $probed_contact;
|
||||||
$parent_contact["nurl"] = normalise_link($probed_contact["url"]);
|
$parent_contact["nurl"] = normalise_link($probed_contact["url"]);
|
||||||
$parent_contact["thumb"] = $probed_contact["photo"];
|
$parent_contact["thumb"] = $probed_contact["photo"];
|
||||||
$parent_contact["micro"] = $probed_contact["photo"];
|
$parent_contact["micro"] = $probed_contact["photo"];
|
||||||
$parent_contact["addr"] = $probed_contact["addr"];
|
$parent_contact["addr"] = $probed_contact["addr"];
|
||||||
}
|
}
|
||||||
logger('parent contact: '.print_r($parent_contact, true), LOGGER_DEBUG);
|
logger('no contact found: '.print_r($thrparent, true), LOGGER_DEBUG);
|
||||||
} else
|
} else
|
||||||
logger('no contact found: '.print_r($thrparent, true), LOGGER_DEBUG);
|
logger('parent contact: '.print_r($parent_contact, true), LOGGER_DEBUG);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue