<?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
*
namespace Friendica\Module\DFRN;
use Friendica\BaseModule;
+use Friendica\Core\System;
+use Friendica\Model\User;
+use Friendica\Module\Response;
+use Friendica\Network\HTTPException;
use Friendica\Protocol\OStatus;
/**
*/
class Poll extends BaseModule
{
- public function rawContent()
+ protected function rawContent(array $request = [])
{
- header("Content-type: application/atom+xml");
- $last_update = $_GET['last_update'] ?? '';
- echo OStatus::feed($this->parameters['nickname'], $last_update, 10);
- exit();
+ $owner = User::getByNickname(
+ $this->parameters['nickname'] ?? '',
+ ['nickname', 'blocked', 'account_expired', 'account_removed']
+ );
+ if (!$owner || $owner['account_expired'] || $owner['account_removed']) {
+ throw new HTTPException\NotFoundException($this->t('User not found.'));
+ }
+
+ if ($owner['blocked']) {
+ throw new HTTPException\UnauthorizedException($this->t('Access to this profile has been restricted.'));
+ }
+
+ $last_update = $request['last_update'] ?? '';
+ System::httpExit(OStatus::feed($owner['nickname'], $last_update, 10) ?? '', Response::TYPE_ATOM);
}
}