X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FParseUrl.php;h=6620229cd16c78fcb6114d710d7d413ff70b493c;hb=3bca4fe2a64671d09e08346456cdfa6c12f996e9;hp=7138238d85965b9815196c0e5ae8aee86f8d9029;hpb=262ee2b0b1a62dfcf78eca01a741d3cecfb34a40;p=friendica.git diff --git a/src/Module/ParseUrl.php b/src/Module/ParseUrl.php index 7138238d85..6620229cd1 100644 --- a/src/Module/ParseUrl.php +++ b/src/Module/ParseUrl.php @@ -1,6 +1,6 @@ userSession = $userSession; + } + + protected function rawContent(array $request = []) { - if (!Session::isAuthenticated()) { + if (!$this->userSession->isAuthenticated()) { throw new \Friendica\Network\HTTPException\ForbiddenException(); } @@ -86,18 +100,17 @@ class ParseUrl extends BaseModule if ($arr['text']) { if ($format == 'json') { - System::jsonExit($arr['text']); + $this->jsonExit($arr['text']); } else { - echo $arr['text']; - exit(); + $this->httpExit($arr['text']); } } if ($format == 'json') { - $type = Util\ParseUrl::getContentType($url); + $siteinfo = Util\ParseUrl::getSiteinfoCached($url); - if (in_array($type, ['image', 'video', 'audio'])) { - switch ($type) { + if (in_array($siteinfo['type'], ['image', 'video', 'audio'])) { + switch ($siteinfo['type']) { case 'video': $content_type = 'video'; break; @@ -113,8 +126,6 @@ class ParseUrl extends BaseModule $ret['data'] = ['url' => $url]; $ret['success'] = true; } else { - $siteinfo = Util\ParseUrl::getSiteinfoCached($url); - unset($siteinfo['keywords']); $ret['data'] = $siteinfo; @@ -122,10 +133,9 @@ class ParseUrl extends BaseModule $ret['success'] = true; } - System::jsonExit($ret); + $this->jsonExit($ret); } else { - echo BBCode::embedURL($url, empty($_GET['noAttachment']), $title, $description, $_GET['tags'] ?? ''); - exit(); + $this->httpExit(BBCode::embedURL($url, empty($_GET['noAttachment']), $title, $description, $_GET['tags'] ?? '')); } } }