<?php
/**
- * @copyright Copyright (C) 2010-2021, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
use Friendica\BaseModule;
use Friendica\Core\Logger;
+use Friendica\Core\System;
use Friendica\DI;
use Friendica\Model\Attach as MAttach;
/**
* Return to user an attached file given the id
*/
- public static function rawContent()
+ protected function rawContent(array $request = [])
{
- $a = DI::app();
- if (empty(static::$parameters['item'])) {
+ if (empty($this->parameters['item'])) {
throw new \Friendica\Network\HTTPException\BadRequestException();
}
- $item_id = intval(static::$parameters['item']);
+ $item_id = intval($this->parameters['item']);
// Check for existence
$item = MAttach::exists(['id' => $item_id]);
throw new \Friendica\Network\HTTPException\NotFoundException(DI::l10n()->t('Item was not found.'));
}
- // Now we'll fetch the item, if we have enough permisson
+ // Now we'll fetch the item, if we have enough permission
$item = MAttach::getByIdWithPermission($item_id);
if ($item === false) {
throw new \Friendica\Network\HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.'));
}
echo $data;
- exit();
+ System::exit();
// NOTREACHED
}
}