<?php
/**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2022, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
use Friendica\Content\Feature;
use Friendica\Content\Text\BBCode;
-use Friendica\Core\Cache\Duration;
+use Friendica\Core\Cache\Enum\Duration;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
use Friendica\Core\System;
$permissionSets = DI::permissionSet()->selectByContactId($requester_id, $owner['uid']);
if (!empty($permissionSets)) {
$condition = ['psid' => array_merge($permissionSets->column('id'),
- [DI::permissionSet()->selectPublic($owner['uid'])])];
+ [DI::permissionSet()->selectPublicForUser($owner['uid'])])];
}
}
}
return [];
}
+ $permissions = [
+ 'to' => [],
+ 'cc' => [],
+ 'bto' => [],
+ 'bcc' => [],
+ ];
+
$activity = json_decode($conversation['source'], true);
$actor = JsonLD::fetchElement($activity, 'actor', 'id');
$urls = [];
foreach ($uriids as $uriid) {
- foreach (Post\Media::getByURIId($uriid, [Post\Media::DOCUMENT, Post\Media::TORRENT]) as $attachment) {
+ foreach (Post\Media::getByURIId($uriid, [Post\Media::AUDIO, Post\Media::IMAGE, Post\Media::VIDEO, Post\Media::DOCUMENT, Post\Media::TORRENT]) as $attachment) {
if (in_array($attachment['url'], $urls)) {
continue;
}
}
}
- if ($type != 'Note') {
- return $attachments;
- }
-
- foreach ($uriids as $uriid) {
- foreach (Post\Media::getByURIId($uriid, [Post\Media::AUDIO, Post\Media::IMAGE, Post\Media::VIDEO]) as $attachment) {
- if (in_array($attachment['url'], $urls)) {
- continue;
- }
- $urls[] = $attachment['url'];
-
- $attach = ['type' => 'Document',
- 'mediaType' => $attachment['mimetype'],
- 'url' => $attachment['url'],
- 'name' => $attachment['description']];
-
- if (!empty($attachment['height'])) {
- $attach['height'] = $attachment['height'];
- }
-
- if (!empty($attachment['width'])) {
- $attach['width'] = $attachment['width'];
- }
-
- if (!empty($attachment['preview'])) {
- $attach['image'] = $attachment['preview'];
- }
-
- $attachments[] = $attach;
- }
- // Currently deactivated, since it creates side effects on Mastodon and Pleroma.
- // It will be activated, once this cleared.
- /*
- foreach (Post\Media::getByURIId($uriid, [Post\Media::HTML]) as $attachment) {
- if (in_array($attachment['url'], $urls)) {
- continue;
- }
- $urls[] = $attachment['url'];
-
- $attachments[] = ['type' => 'Page',
- 'mediaType' => $attachment['mimetype'],
- 'url' => $attachment['url'],
- 'name' => $attachment['description']];
- }*/
- }
-
return $attachments;
}
{
$owner = User::getOwnerDataById($uid);
- $suggestion = DI::fsuggest()->getById($suggestion_id);
+ $suggestion = DI::fsuggest()->selectOneById($suggestion_id);
$data = ['@context' => ActivityPub::CONTEXT,
'id' => DI::baseUrl() . '/activity/' . System::createGUID(),
$signed = LDSignature::sign($data, $owner);
- Logger::log('Deliver profile deletion for user ' . $uid . ' to ' . $inbox . ' via ActivityPub', Logger::DEBUG);
+ Logger::info('Deliver profile deletion for user ' . $uid . ' to ' . $inbox . ' via ActivityPub');
return HTTPSignature::transmit($signed, $inbox, $uid);
}
$signed = LDSignature::sign($data, $owner);
- Logger::log('Deliver profile relocation for user ' . $uid . ' to ' . $inbox . ' via ActivityPub', Logger::DEBUG);
+ Logger::info('Deliver profile relocation for user ' . $uid . ' to ' . $inbox . ' via ActivityPub');
return HTTPSignature::transmit($signed, $inbox, $uid);
}
$signed = LDSignature::sign($data, $owner);
- Logger::log('Deliver profile deletion for user ' . $uid . ' to ' . $inbox . ' via ActivityPub', Logger::DEBUG);
+ Logger::info('Deliver profile deletion for user ' . $uid . ' to ' . $inbox . ' via ActivityPub');
return HTTPSignature::transmit($signed, $inbox, $uid);
}
$signed = LDSignature::sign($data, $owner);
- Logger::log('Deliver profile update for user ' . $uid . ' to ' . $inbox . ' via ActivityPub', Logger::DEBUG);
+ Logger::info('Deliver profile update for user ' . $uid . ' to ' . $inbox . ' via ActivityPub');
return HTTPSignature::transmit($signed, $inbox, $uid);
}
'instrument' => self::getService(),
'to' => [$profile['url']]];
- Logger::log('Sending activity ' . $activity . ' to ' . $target . ' for user ' . $uid, Logger::DEBUG);
+ Logger::info('Sending activity ' . $activity . ' to ' . $target . ' for user ' . $uid);
$signed = LDSignature::sign($data, $owner);
return HTTPSignature::transmit($signed, $profile['inbox'], $uid);
$condition = ['verb' => Activity::FOLLOW, 'uid' => 0, 'parent-uri' => $object,
'author-id' => Contact::getPublicIdByUserId($uid)];
if (Post::exists($condition)) {
- Logger::log('Follow for ' . $object . ' for user ' . $uid . ' does already exist.', Logger::DEBUG);
+ Logger::info('Follow for ' . $object . ' for user ' . $uid . ' does already exist.');
return false;
}
'instrument' => self::getService(),
'to' => [$profile['url']]];
- Logger::log('Sending follow ' . $object . ' to ' . $target . ' for user ' . $uid, Logger::DEBUG);
+ Logger::info('Sending follow ' . $object . ' to ' . $target . ' for user ' . $uid);
$signed = LDSignature::sign($data, $owner);
return HTTPSignature::transmit($signed, $profile['inbox'], $uid);
'instrument' => self::getService(),
'to' => [$profile['url']]];
- Logger::log('Sending undo to ' . $target . ' for user ' . $uid . ' with id ' . $id, Logger::DEBUG);
+ Logger::info('Sending undo to ' . $target . ' for user ' . $uid . ' with id ' . $id);
$signed = LDSignature::sign($data, $owner);
return HTTPSignature::transmit($signed, $profile['inbox'], $uid);