X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fdfrn_notify.php;h=3f0ecba005e8e8333ee97dee626ff61c45dac13a;hb=b2d685482928363ce86c3c0519c8ff39d0af43ca;hp=51576b3b4ec7dec6be551b53d9e5b75f8cd54128;hpb=5a3991d4f7bc929c1087d9275716fc1c8cc299a6;p=friendica.git diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index 51576b3b4e..3f0ecba005 100644 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -12,16 +12,16 @@ use Friendica\Core\Logger; use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Model\Contact; +use Friendica\Model\User; use Friendica\Protocol\DFRN; use Friendica\Protocol\Diaspora; use Friendica\Util\Strings; - -require_once 'include/items.php'; +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); @@ -30,7 +30,7 @@ function dfrn_notify_post(App $a) { $user = DBA::selectFirst('user', [], ['nickname' => $nick, 'account_expired' => false, 'account_removed' => false]); if (!DBA::isResult($user)) { - System::httpExit(500); + throw new \Friendica\Network\HTTPException\InternalServerErrorException(); } dfrn_dispatch_private($user, $postdata); } elseif (!dfrn_dispatch_public($postdata)) { @@ -191,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)) { @@ -255,7 +255,6 @@ function dfrn_notify_content(App $a) { */ $dfrn_id = Strings::escapeTags(trim($_GET['dfrn_id'])); - $dfrn_version = (float) $_GET['dfrn_version']; $rino_remote = (!empty($_GET['rino']) ? intval($_GET['rino']) : 0); $type = ""; $last_update = ""; @@ -283,7 +282,7 @@ function dfrn_notify_content(App $a) { $user = DBA::selectFirst('user', ['uid'], ['nickname' => $a->argv[1]]); if (!DBA::isResult($user)) { Logger::log('User not found for nickname ' . $a->argv[1]); - killme(); + exit(); } $condition = []; @@ -302,6 +301,7 @@ function dfrn_notify_content(App $a) { break; default: $status = 1; + $my_id = ''; break; } @@ -315,7 +315,7 @@ function dfrn_notify_content(App $a) { $importer = DFRN::getImporter($contact['id'], $user['uid']); if (empty($importer)) { Logger::log('No importer data found for user ' . $a->argv[1] . ' and contact ' . $dfrn_id); - killme(); + exit(); } Logger::log("Remote rino version: ".$rino_remote." for ".$importer["url"], Logger::DATA); @@ -354,7 +354,7 @@ function dfrn_notify_content(App $a) { $rino = $rino_remote; } - if (($importer['rel'] && ($importer['rel'] != Contact::SHARING)) || ($importer['page-flags'] == Contact::PAGE_COMMUNITY)) { + if (($importer['rel'] && ($importer['rel'] != Contact::SHARING)) || ($importer['page-flags'] == User::PAGE_FLAGS_COMMUNITY)) { $perm = 'rw'; } else { $perm = 'r'; @@ -372,6 +372,6 @@ function dfrn_notify_content(App $a) { . "\t" . '' . $challenge . '' . "\r\n" . '' . "\r\n"; - killme(); + exit(); } }