<?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 Objects extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
- if (empty(static::$parameters['guid'])) {
+ if (empty($this->parameters['guid'])) {
throw new HTTPException\BadRequestException();
}
DI::baseUrl()->redirect(str_replace('objects/', 'display/', DI::args()->getQueryString()));
}
- $itemuri = DBA::selectFirst('item-uri', ['id'], ['guid' => static::$parameters['guid']]);
+ $itemuri = DBA::selectFirst('item-uri', ['id'], ['guid' => $this->parameters['guid']]);
if (DBA::isResult($itemuri)) {
- Logger::info('Provided GUID found.', ['guid' => static::$parameters['guid'], 'uri-id' => $itemuri['id']]);
+ Logger::info('Provided GUID found.', ['guid' => $this->parameters['guid'], 'uri-id' => $itemuri['id']]);
} else {
// The item URI does not always contain the GUID. This means that we have to search the URL instead
$url = DI::baseUrl()->get() . '/' . DI::args()->getQueryString();
throw new HTTPException\NotFoundException();
}
- $etag = md5(static::$parameters['guid'] . '-' . $item['changed']);
+ $etag = md5($this->parameters['guid'] . '-' . $item['changed']);
$last_modified = $item['changed'];
Network::checkEtagModified($etag, $last_modified);
- if (empty(static::$parameters['activity']) && ($item['gravity'] != GRAVITY_ACTIVITY)) {
+ if (empty($this->parameters['activity']) && ($item['gravity'] != GRAVITY_ACTIVITY)) {
$activity = ActivityPub\Transmitter::createActivityFromItem($item['id'], true);
if (empty($activity['type'])) {
throw new HTTPException\NotFoundException();
$data = ['@context' => ActivityPub::CONTEXT];
$data = array_merge($data, $activity['object']);
- } elseif (empty(static::$parameters['activity']) || in_array(static::$parameters['activity'],
+ } elseif (empty($this->parameters['activity']) || in_array($this->parameters['activity'],
['Create', 'Announce', 'Update', 'Like', 'Dislike', 'Accept', 'Reject',
'TentativeAccept', 'Follow', 'Add'])) {
$data = ActivityPub\Transmitter::createActivityFromItem($item['id']);
if (empty($data)) {
throw new HTTPException\NotFoundException();
}
- if (!empty(static::$parameters['activity']) && (static::$parameters['activity'] != 'Create')) {
- $data['type'] = static::$parameters['activity'];
- $data['id'] = str_replace('/Create', '/' . static::$parameters['activity'], $data['id']);
+ if (!empty($this->parameters['activity']) && ($this->parameters['activity'] != 'Create')) {
+ $data['type'] = $this->parameters['activity'];
+ $data['id'] = str_replace('/Create', '/' . $this->parameters['activity'], $data['id']);
}
} else {
throw new HTTPException\NotFoundException();