X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=inline;f=mod%2Fpubsub.php;h=bc284a4eb2f92e531bb926e53730b284672ffb8a;hb=61693419e8cf571a2ad26690423d356023badc2e;hp=11f92af6a5a828dc1ded4a2fa3f99508b5861fa4;hpb=aff99b32fd11aaf87f13248ed992712cf69d9a23;p=friendica.git diff --git a/mod/pubsub.php b/mod/pubsub.php index 11f92af6a5..bc284a4eb2 100644 --- a/mod/pubsub.php +++ b/mod/pubsub.php @@ -1,7 +1,9 @@ $nick, 'account_expired' => false, 'account_removed' => false]); - if (!DBM::is_result($owner)) { + $owner = DBA::selectFirst('user', ['uid'], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]); + if (!DBA::isResult($owner)) { logger('Local account not found: ' . $nick); hub_return(false, ''); } @@ -55,8 +57,8 @@ function pubsub_init(App $a) $condition['hub-verify'] = $hub_verify; } - $contact = dba::selectFirst('contact', ['id', 'poll'], $condition); - if (!DBM::is_result($contact)) { + $contact = DBA::selectFirst('contact', ['id', 'poll'], $condition); + if (!DBA::isResult($contact)) { logger('Contact ' . $contact_id . ' not found.'); hub_return(false, ''); } @@ -75,7 +77,7 @@ function pubsub_init(App $a) } if (!empty($hub_mode)) { - dba::update('contact', ['subhub' => $subscribe], ['id' => $contact['id']]); + DBA::update('contact', ['subhub' => $subscribe], ['id' => $contact['id']]); logger($hub_mode . ' success for contact ' . $contact_id . '.'); } hub_return(true, $hub_challenge); @@ -92,35 +94,35 @@ function pubsub_post(App $a) $nick = (($a->argc > 1) ? notags(trim($a->argv[1])) : ''); $contact_id = (($a->argc > 2) ? intval($a->argv[2]) : 0 ); - $importer = dba::selectFirst('user', [], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]); - if (!DBM::is_result($importer)) { + $importer = DBA::selectFirst('user', [], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]); + if (!DBA::isResult($importer)) { hub_post_return(); } $condition = ['id' => $contact_id, 'uid' => $importer['uid'], 'subhub' => true, 'blocked' => false]; - $contact = dba::selectFirst('contact', [], $condition); + $contact = DBA::selectFirst('contact', [], $condition); - if (!DBM::is_result($contact)) { + if (!DBA::isResult($contact)) { $author = OStatus::salmonAuthor($xml, $importer); if (!empty($author['contact-id'])) { $condition = ['id' => $author['contact-id'], 'uid' => $importer['uid'], 'subhub' => true, 'blocked' => false]; - $contact = dba::selectFirst('contact', [], $condition); + $contact = DBA::selectFirst('contact', [], $condition); logger('No record for ' . $nick .' with contact id ' . $contact_id . ' - using '.$author['contact-id'].' instead.'); } - if (!DBM::is_result($contact)) { + if (!DBA::isResult($contact)) { logger('Contact ' . $author["author-link"] . ' (' . $contact_id . ') for user ' . $nick . " wasn't found - ignored. XML: " . $xml); hub_post_return(); } } - if (!in_array($contact['rel'], [CONTACT_IS_SHARING, CONTACT_IS_FRIEND]) && ($contact['network'] != NETWORK_FEED)) { + if (!in_array($contact['rel'], [Contact::SHARING, Contact::FRIEND]) && ($contact['network'] != Protocol::FEED)) { logger('Contact ' . $contact['id'] . ' is not expected to share with us - ignored.'); hub_post_return(); } // We import feeds from OStatus, Friendica and ATOM/RSS. /// @todo Check if Friendica posts really arrive here - otherwise we can discard some stuff - if (!in_array($contact['network'], [NETWORK_OSTATUS, NETWORK_DFRN, NETWORK_FEED])) { + if (!in_array($contact['network'], [Protocol::OSTATUS, Protocol::DFRN, Protocol::FEED])) { hub_post_return(); } @@ -129,7 +131,7 @@ function pubsub_post(App $a) consume_feed($xml, $importer, $contact, $feedhub); // do it a second time for DFRN so that any children find their parents. - if ($contact['network'] === NETWORK_DFRN) { + if ($contact['network'] === Protocol::DFRN) { consume_feed($xml, $importer, $contact, $feedhub); }