<?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\OAuth;
-use Friendica\Core\Logger;
use Friendica\Core\Renderer;
use Friendica\DI;
use Friendica\Module\BaseApi;
+use Friendica\Module\Special\HTTPException;
+use Psr\Http\Message\ResponseInterface;
/**
- * Dummy class for all currently unimplemented endpoints
+ * Acknowledgement of OAuth requests
*/
class Acknowledge extends BaseApi
{
- public static function post(array $parameters = [])
+ public function run(HTTPException $httpException, array $request = [], bool $scopecheck = true): ResponseInterface
+ {
+ return parent::run($httpException, $request, false);
+ }
+
+ protected function post(array $request = [])
{
DI::session()->set('oauth_acknowledge', true);
DI::app()->redirect(DI::session()->get('return_path'));
}
- public static function content(array $parameters = [])
+ protected function content(array $request = []): string
{
DI::session()->set('return_path', $_REQUEST['return_path'] ?? '');
- $tpl = Renderer::getMarkupTemplate('oauth_authorize.tpl');
- $o = Renderer::replaceMacros($tpl, [
- '$title' => DI::l10n()->t('Authorize application connection'),
- '$app' => ['name' => $_REQUEST['application'] ?? ''],
+ $o = Renderer::replaceMacros(Renderer::getMarkupTemplate('oauth_authorize.tpl'), [
+ '$title' => DI::l10n()->t('Authorize application connection'),
+ '$app' => ['name' => $_REQUEST['application'] ?? ''],
'$authorize' => DI::l10n()->t('Do you want to authorize this application to access your posts and contacts, and/or create new posts for you?'),
- '$yes' => DI::l10n()->t('Yes'),
- '$no' => DI::l10n()->t('No'),
+ '$yes' => DI::l10n()->t('Yes'),
+ '$no' => DI::l10n()->t('No'),
]);
return $o;