2010-07-02 01:48:07 +02:00
|
|
|
<?php
|
2017-11-16 05:09:11 +01:00
|
|
|
/**
|
2024-01-02 21:57:26 +01:00
|
|
|
* @copyright Copyright (C) 2010-2024, the Friendica project
|
2020-02-09 16:18:46 +01:00
|
|
|
*
|
|
|
|
* @license GNU AGPL version 3 or any later version
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*
|
2017-11-16 05:09:11 +01:00
|
|
|
*/
|
2018-07-20 04:15:21 +02:00
|
|
|
|
2021-07-16 16:45:29 +02:00
|
|
|
namespace Friendica\Module\DFRN;
|
|
|
|
|
|
|
|
use Friendica\BaseModule;
|
2022-04-10 10:31:55 +02:00
|
|
|
use Friendica\Core\System;
|
2022-11-30 19:50:52 +01:00
|
|
|
use Friendica\Model\User;
|
2022-04-10 10:31:55 +02:00
|
|
|
use Friendica\Module\Response;
|
2022-11-30 19:50:52 +01:00
|
|
|
use Friendica\Network\HTTPException;
|
2017-11-16 05:09:11 +01:00
|
|
|
use Friendica\Protocol\OStatus;
|
2017-04-30 06:07:00 +02:00
|
|
|
|
2021-07-16 16:45:29 +02:00
|
|
|
/**
|
|
|
|
* DFRN Poll
|
|
|
|
*/
|
|
|
|
class Poll extends BaseModule
|
2017-12-30 04:12:18 +01:00
|
|
|
{
|
2021-11-20 15:38:03 +01:00
|
|
|
protected function rawContent(array $request = [])
|
2021-07-16 16:45:29 +02:00
|
|
|
{
|
2022-11-30 19:50:52 +01:00
|
|
|
$owner = User::getByNickname(
|
|
|
|
$this->parameters['nickname'] ?? '',
|
2023-01-11 22:55:32 +01:00
|
|
|
['nickname', 'blocked', 'account_expired', 'account_removed']
|
2022-11-30 19:50:52 +01:00
|
|
|
);
|
|
|
|
if (!$owner || $owner['account_expired'] || $owner['account_removed']) {
|
|
|
|
throw new HTTPException\NotFoundException($this->t('User not found.'));
|
|
|
|
}
|
|
|
|
|
2023-01-11 22:55:32 +01:00
|
|
|
if ($owner['blocked']) {
|
2022-11-30 19:50:52 +01:00
|
|
|
throw new HTTPException\UnauthorizedException($this->t('Access to this profile has been restricted.'));
|
|
|
|
}
|
|
|
|
|
2022-06-18 09:58:44 +02:00
|
|
|
$last_update = $request['last_update'] ?? '';
|
2023-09-21 18:35:55 +02:00
|
|
|
$this->httpExit(OStatus::feed($owner['nickname'], $last_update, 10) ?? '', Response::TYPE_ATOM);
|
2017-08-22 12:18:07 +02:00
|
|
|
}
|
2010-07-19 05:49:10 +02:00
|
|
|
}
|