X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fpoco.php;h=73179a33f203bab06ab49f6b893471c3117a7b16;hb=805d6440e68233d75476c0d02d779987816a8439;hp=42b9af02a782bb59c8f11cb7f33af56722005e76;hpb=2a431b580f2e8f6a596e84175932e793678cde63;p=friendica.git diff --git a/mod/poco.php b/mod/poco.php index 42b9af02a7..73179a33f2 100644 --- a/mod/poco.php +++ b/mod/poco.php @@ -1,6 +1,6 @@ argc > 1) { + if (DI::args()->getArgc() > 1) { // Only the system mode is supported throw new \Friendica\Network\HTTPException\NotFoundException(); } @@ -121,10 +123,12 @@ function poco_init(App $a) { if (isset($contact['account-type'])) { $contact['contact-type'] = $contact['account-type']; } - $about = DI::cache()->get("about:" . $contact['updated'] . ":" . $contact['nurl']); + + $cacheKey = 'about:' . $contact['nick'] . ':' . DateTimeFormat::utc($contact['updated'], DateTimeFormat::ATOM); + $about = DI::cache()->get($cacheKey); if (is_null($about)) { - $about = BBCode::convert($contact['about'], false); - DI::cache()->set("about:" . $contact['updated'] . ":" . $contact['nurl'], $about); + $about = BBCode::convertForUriId($contact['uri-id'], $contact['about']); + DI::cache()->set($cacheKey, $about); } // Non connected persons can only see the keywords of a Diaspora account @@ -226,14 +230,10 @@ function poco_init(App $a) { Logger::info("End of poco"); if ($format === 'xml') { - header('Content-type: text/xml'); - echo Renderer::replaceMacros(Renderer::getMarkupTemplate('poco_xml.tpl'), XML::arrayEscape(['$response' => $ret])); - exit(); + System::httpExit(Renderer::replaceMacros(Renderer::getMarkupTemplate('poco_xml.tpl'), XML::arrayEscape(['$response' => $ret])), Response::TYPE_XML); } if ($format === 'json') { - header('Content-type: application/json'); - echo json_encode($ret); - exit(); + System::jsonExit($ret); } else { throw new \Friendica\Network\HTTPException\InternalServerErrorException(); }