<?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
*
*/
class Fetch extends BaseModule
{
- public static function rawContent(array $parameters = [])
+ protected function rawContent(array $request = [])
{
- if (empty($parameters['guid'])) {
+ if (empty($this->parameters['guid'])) {
throw new HTTPException\NotFoundException();
}
- $guid = $parameters['guid'];
+ $guid = $this->parameters['guid'];
// Fetch the item
- $fields = [
- 'uid', 'title', 'body', 'guid', 'contact-id', 'private', 'created', 'received', 'app', 'location', 'coord', 'network',
- 'event-id', 'resource-id', 'author-link', 'author-avatar', 'author-name', 'plink', 'owner-link', 'uri-id'
- ];
$condition = ['origin' => true, 'private' => [Item::PUBLIC, Item::UNLISTED], 'guid' => $guid,
'gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT], 'network' => [Protocol::DFRN, Protocol::DIASPORA]];
- $item = Post::selectFirst($fields, $condition);
+ $item = Post::selectFirst([], $condition);
if (empty($item)) {
$condition = ['guid' => $guid, 'network' => [Protocol::DFRN, Protocol::DIASPORA]];
$item = Post::selectFirst(['author-link'], $condition);
if ($item['gravity'] == GRAVITY_PARENT) {
$status = Diaspora::buildStatus($item, $user);
} else {
- $status = Diaspora::constructComment($item, $user);
+ $status = ['type' => 'comment', 'message' => Diaspora::createCommentSignature($item)];
}
$xml = Diaspora::buildPostXml($status["type"], $status["message"]);