X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FParseUrl.php;h=8353cdf6d6713a9cb2bff393b8fcc98f36d7fcf0;hb=10f8631cd9423629d5189ae71d82964e4db18892;hp=afb54ea325b35936643e8e90e923a893c1da8fc5;hpb=e56a53647bd5469551bf4f9ef2df50a5dd16b943;p=friendica.git diff --git a/src/Module/ParseUrl.php b/src/Module/ParseUrl.php index afb54ea325..8353cdf6d6 100644 --- a/src/Module/ParseUrl.php +++ b/src/Module/ParseUrl.php @@ -21,19 +21,33 @@ namespace Friendica\Module; +use Friendica\App; use Friendica\BaseModule; use Friendica\Content\Text\BBCode; use Friendica\Core\Hook; -use Friendica\Core\Session; +use Friendica\Core\L10n; +use Friendica\Core\Session\Capability\IHandleUserSessions; use Friendica\Core\System; use Friendica\Network\HTTPException\BadRequestException; use Friendica\Util; +use Friendica\Util\Profiler; +use Psr\Log\LoggerInterface; class ParseUrl extends BaseModule { + /** @var IHandleUserSessions */ + protected $userSession; + + public function __construct(L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, IHandleUserSessions $userSession, $server, array $parameters = []) + { + parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters); + + $this->userSession = $userSession; + } + protected function rawContent(array $request = []) { - if (!Session::isAuthenticated()) { + if (!$this->userSession->isAuthenticated()) { throw new \Friendica\Network\HTTPException\ForbiddenException(); } @@ -88,8 +102,7 @@ class ParseUrl extends BaseModule if ($format == 'json') { System::jsonExit($arr['text']); } else { - echo $arr['text']; - exit(); + System::httpExit($arr['text']); } } @@ -122,8 +135,7 @@ class ParseUrl extends BaseModule System::jsonExit($ret); } else { - echo BBCode::embedURL($url, empty($_GET['noAttachment']), $title, $description, $_GET['tags'] ?? ''); - exit(); + System::httpExit(BBCode::embedURL($url, empty($_GET['noAttachment']), $title, $description, $_GET['tags'] ?? '')); } } }