* @param array $activity Activity array
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
* @param array $activity Activity array
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
{
$item = Post::selectFirst(['uri', 'uri-id', 'thr-parent', 'gravity', 'post-type'], ['uri' => $activity['id']]);
if (!DBA::isResult($item)) {
{
$item = Post::selectFirst(['uri', 'uri-id', 'thr-parent', 'gravity', 'post-type'], ['uri' => $activity['id']]);
if (!DBA::isResult($item)) {
{
$event['summary'] = HTML::toBBCode($activity['name'] ?: $activity['summary']);
$event['desc'] = HTML::toBBCode($activity['content']);
{
$event['summary'] = HTML::toBBCode($activity['name'] ?: $activity['summary']);
$event['desc'] = HTML::toBBCode($activity['content']);
$content = Markdown::toBBCode($activity['content']);
} elseif (!empty($activity['mediatype']) && ($activity['mediatype'] == 'text/bbcode')) {
$item['title'] = $activity['name'];
$content = $activity['content'];
} else {
// By default assume "text/html"
$content = Markdown::toBBCode($activity['content']);
} elseif (!empty($activity['mediatype']) && ($activity['mediatype'] == 'text/bbcode')) {
$item['title'] = $activity['name'];
$content = $activity['content'];
} else {
// By default assume "text/html"
- $item['title'] = HTML::toBBCode($activity['name']);
- $content = HTML::toBBCode($activity['content']);
+ $item['title'] = HTML::toBBCode($activity['name'] ?? '');
+ $content = HTML::toBBCode($activity['content'] ?? '');
if (!empty($activity['languages'])) {
$item['language'] = self::processLanguages($activity['languages']);
}
if (!empty($activity['languages'])) {
$item['language'] = self::processLanguages($activity['languages']);
}
{
// The checks are split to improve the support when searching why a message was accepted.
if (count($activity['receiver']) != 1) {
{
// The checks are split to improve the support when searching why a message was accepted.
if (count($activity['receiver']) != 1) {
* @return int|bool New mail table row id or false on error
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
* @return int|bool New mail table row id or false on error
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
{
if (($item['gravity'] != GRAVITY_PARENT) && !DBA::exists('mail', ['uri' => $item['thr-parent'], 'uid' => $item['uid']])) {
Logger::info('Parent not found, mail will be discarded.', ['uid' => $item['uid'], 'uri' => $item['thr-parent']]);
{
if (($item['gravity'] != GRAVITY_PARENT) && !DBA::exists('mail', ['uri' => $item['thr-parent'], 'uid' => $item['uid']])) {
Logger::info('Parent not found, mail will be discarded.', ['uid' => $item['uid'], 'uri' => $item['thr-parent']]);
* @return string fetched message URL
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
* @return string fetched message URL
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
- public static function fetchMissingActivity(string $url, array $child = [], string $relay_actor = '', int $completion = Receiver::COMPLETION_MANUAL)
+ public static function fetchMissingActivity(string $url, array $child = [], string $relay_actor = '', int $completion = Receiver::COMPLETION_MANUAL): string
{
if (!empty($child['receiver'])) {
$uid = ActivityPub\Receiver::getFirstUserFromReceivers($child['receiver']);
{
if (!empty($child['receiver'])) {
$uid = ActivityPub\Receiver::getFirstUserFromReceivers($child['receiver']);
{
if (empty($activity['as:object'])) {
Logger::info('No object field in activity - accepted', ['id' => $id]);
{
if (empty($activity['as:object'])) {
Logger::info('No object field in activity - accepted', ['id' => $id]);
if (Post::exists(['uri-id' => $uriid])) {
Logger::info('Post is a reply to an existing post - accepted', ['id' => $id, 'uri-id' => $uriid, 'replyto' => $replyto]);
return true;
if (Post::exists(['uri-id' => $uriid])) {
Logger::info('Post is a reply to an existing post - accepted', ['id' => $id, 'uri-id' => $uriid, 'replyto' => $replyto]);
return true;
$attributed_to = JsonLD::fetchElement($activity['as:object'], 'as:attributedTo', '@id');
$authorid = Contact::getIdForURL($attributed_to);
$attributed_to = JsonLD::fetchElement($activity['as:object'], 'as:attributedTo', '@id');
$authorid = Contact::getIdForURL($attributed_to);
Contact::update(['hub-verify' => $activity['id'], 'protocol' => Protocol::ACTIVITYPUB], ['id' => $cid]);
}
Contact::update(['hub-verify' => $activity['id'], 'protocol' => Protocol::ACTIVITYPUB], ['id' => $cid]);
}
- $item = ['author-id' => Contact::getIdForURL($activity['actor']),
- 'author-link' => $activity['actor']];
+ $item = [
+ 'author-id' => Contact::getIdForURL($activity['actor']),
+ 'author-link' => $activity['actor'],
+ ];
{
if (empty($activity['object_id']) || empty($activity['actor'])) {
Logger::info('Empty object id or actor.');
{
if (empty($activity['object_id']) || empty($activity['actor'])) {
Logger::info('Empty object id or actor.');
{
$contact = DBA::selectFirst('contact', ['network', 'url'], ['id' => $cid]);
if (!DBA::isResult($contact) || in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN]) || Contact::isLocal($contact['url'])) {
{
$contact = DBA::selectFirst('contact', ['network', 'url'], ['id' => $cid]);
if (!DBA::isResult($contact) || in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN]) || Contact::isLocal($contact['url'])) {
{
$parent_terms = Tag::getByURIId($parent['uri-id'], [Tag::MENTION, Tag::IMPLICIT_MENTION, Tag::EXCLUSIVE_MENTION]);
{
$parent_terms = Tag::getByURIId($parent['uri-id'], [Tag::MENTION, Tag::IMPLICIT_MENTION, Tag::EXCLUSIVE_MENTION]);