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;
+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);
$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)) {
}
// 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)) {
*/
$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 = "";
break;
default:
$status = 1;
+ $my_id = '';
break;
}
$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';