use Friendica\Content\Text\BBCode;
use Friendica\Core\Logger;
use Friendica\Core\Protocol;
-use Friendica\Core\Renderer;
+use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
-use Friendica\Util\Strings;
-use Friendica\Util\XML;
+use Friendica\Util\DateTimeFormat;
function poco_init(App $a) {
if (intval(DI::config()->get('system', 'block_public')) || (DI::config()->get('system', 'block_local_dir'))) {
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::convertForUriId($contact['uri-id'], $contact['about']);
- DI::cache()->set("about:" . $contact['updated'] . ":" . $contact['nurl'], $about);
+ DI::cache()->set($cacheKey, $about);
}
// Non connected persons can only see the keywords of a Diaspora account
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();
- }
if ($format === 'json') {
- header('Content-type: application/json');
- echo json_encode($ret);
- exit();
+ System::jsonExit($ret);
} else {
- throw new \Friendica\Network\HTTPException\InternalServerErrorException();
+ throw new \Friendica\Network\HTTPException\UnsupportedMediaTypeException();
}
}