]> git.mxchange.org Git - friendica.git/blobdiff - mod/dfrn_notify.php
Issue 7285: Perform duplicate check for item URI also with AP
[friendica.git] / mod / dfrn_notify.php
index 1a9f98fa33103f8f411a9ebd6d12dca36bee812d..3f0ecba005e8e8333ee97dee626ff61c45dac13a 100644 (file)
@@ -16,11 +16,12 @@ use Friendica\Model\User;
 use Friendica\Protocol\DFRN;
 use Friendica\Protocol\Diaspora;
 use Friendica\Util\Strings;
+use Friendica\Util\Network;
 
 function dfrn_notify_post(App $a) {
        Logger::log(__function__, Logger::TRACE);
 
-       $postdata = file_get_contents('php://input');
+       $postdata = Network::postdata();
 
        if (empty($_POST) || !empty($postdata)) {
                $data = json_decode($postdata);
@@ -190,13 +191,13 @@ function dfrn_dispatch_public($postdata)
        }
 
        // Fetch the corresponding public contact
-       $contact = Contact::getDetailsByAddr($msg['author'], 0);
-       if (!$contact) {
+       $contact_id = Contact::getIdForURL($msg['author']);
+       if (empty($contact_id)) {
                Logger::log('Contact not found for address ' . $msg['author']);
                System::xmlExit(3, 'Contact ' . $msg['author'] . ' not found');
        }
 
-       $importer = DFRN::getImporter($contact['id']);
+       $importer = DFRN::getImporter($contact_id);
 
        // This should never fail
        if (empty($importer)) {