<?php
/**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Contact;
+use Friendica\Model\GServer;
+use Friendica\Model\Post;
use Friendica\Protocol\ActivityNamespace;
use Friendica\Protocol\OStatus;
use Friendica\Protocol\Salmon;
Logger::log('new salmon ' . $xml, Logger::DATA);
- $nick = (($a->argc > 1) ? Strings::escapeTags(trim($a->argv[1])) : '');
+ $nick = ((DI::args()->getArgc() > 1) ? Strings::escapeTags(trim(DI::args()->getArgv()[1])) : '');
$importer = DBA::selectFirst('user', [], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]);
if (! DBA::isResult($importer)) {
intval($importer['uid'])
);
- if (!DBA::isResult($r)) {
- Logger::log('Author ' . $author_link . ' unknown to user ' . $importer['uid'] . '.');
-
- if (DI::pConfig()->get($importer['uid'], 'system', 'ostatus_autofriend')) {
- $result = Contact::createFromProbe($importer, $author_link);
-
- if ($result['success']) {
- $r = q("SELECT * FROM `contact` WHERE `network` = '%s' AND ( `url` = '%s' OR `alias` = '%s')
- AND `uid` = %d LIMIT 1",
- DBA::escape(Protocol::OSTATUS),
- DBA::escape($author_link),
- DBA::escape($author_link),
- intval($importer['uid'])
- );
- }
- }
+ if (!empty($r[0]['gsid'])) {
+ GServer::setProtocol($r[0]['gsid'], Post\DeliveryData::OSTATUS);
}
// Have we ignored the person?
// If so we can not accept this post.
- //if((DBA::isResult($r)) && (($r[0]['readonly']) || ($r[0]['rel'] == Contact::FOLLOWER) || ($r[0]['blocked']))) {
if (DBA::isResult($r) && $r[0]['blocked']) {
Logger::log('Ignoring this author.');
throw new \Friendica\Network\HTTPException\AcceptedException();