Remove dependency to App in Contact::createFromProbe

- Address https://github.com/friendica/friendica/issues/8473#issuecomment-641259906
This commit is contained in:
Hypolite Petovan 2020-06-10 10:36:42 -04:00
parent 5f18d27b0b
commit a5a7855d39
7 changed files with 32 additions and 33 deletions

View file

@ -42,15 +42,11 @@ function salmon_post(App $a, $xml = '') {
$nick = (($a->argc > 1) ? Strings::escapeTags(trim($a->argv[1])) : '');
$r = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1",
DBA::escape($nick)
);
if (! DBA::isResult($r)) {
$importer = DBA::selectFirst('user', [], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
if (! DBA::isResult($importer)) {
throw new \Friendica\Network\HTTPException\InternalServerErrorException();
}
$importer = $r[0];
// parse the xml
$dom = simplexml_load_string($xml,'SimpleXMLElement',0, ActivityNamespace::SALMON_ME);
@ -175,7 +171,7 @@ function salmon_post(App $a, $xml = '') {
Logger::log('Author ' . $author_link . ' unknown to user ' . $importer['uid'] . '.');
if (DI::pConfig()->get($importer['uid'], 'system', 'ostatus_autofriend')) {
$result = Contact::createFromProbe($importer['uid'], $author_link);
$result = Contact::createFromProbe($importer, $author_link);
if ($result['success']) {
$r = q("SELECT * FROM `contact` WHERE `network` = '%s' AND ( `url` = '%s' OR `alias` = '%s')