use Friendica\Core\Hook;
use Friendica\Core\Renderer;
use Friendica\Core\System;
-use Friendica\Database\DBA;
use Friendica\DI;
use Friendica\Model\Photo;
use Friendica\Model\User;
{
public static function rawContent(array $parameters = [])
{
- $app = DI::app();
-
// @TODO: Replace with parameter from router
- if ($app->argv[0] == 'xrd') {
+ if (DI::args()->getArgv()[0] == 'xrd') {
if (empty($_GET['uri'])) {
return;
}
$uri = urldecode(Strings::escapeTags(trim($_GET['uri'])));
- if (($_SERVER['HTTP_ACCEPT'] ?? '') == 'application/jrd+json') {
+ if (strpos($_SERVER['HTTP_ACCEPT'] ?? '', 'application/jrd+json') !== false) {
$mode = 'json';
} else {
$mode = 'xml';
}
$uri = urldecode(Strings::escapeTags(trim($_GET['resource'])));
- if (($_SERVER['HTTP_ACCEPT'] ?? '') == 'application/xrd+xml') {
+ if (strpos($_SERVER['HTTP_ACCEPT'] ?? '', 'application/xrd+xml') !== false) {
$mode = 'xml';
} else {
$mode = 'json';
'rel' => 'http://ostatus.org/schema/1.0/subscribe',
'template' => DI::baseUrl()->get() . '/follow?url={uri}',
],
+ [
+ 'rel' => ActivityNamespace::FEED,
+ 'type' => 'application/atom+xml',
+ 'href' => $owner['poll'] ?? DI::baseUrl()->get(),
+ ],
+ [
+ 'rel' => 'salmon',
+ 'href' => DI::baseUrl()->get() . '/salmon/' . $owner['nickname'],
+ ],
+ [
+ 'rel' => 'http://microformats.org/profile/hcard',
+ 'type' => 'text/html',
+ 'href' => DI::baseUrl()->get() . '/hcard/' . $owner['nickname'],
+ ],
+ [
+ 'rel' => 'http://joindiaspora.com/seed_location',
+ 'type' => 'text/html',
+ 'href' => DI::baseUrl()->get(),
+ ],
]
];
header('Access-Control-Allow-Origin: *');
{
$salmon_key = Salmon::salmonKey($owner['spubkey']);
- header('Access-Control-Allow-Origin: *');
- header('Content-type: application/json; charset=utf-8');
-
$json = [
'subject' => 'acct:' . $owner['addr'],
'aliases' => [
[
'rel' => 'http://webfinger.net/rel/avatar',
'type' => $avatar['type'],
- 'href' => $owner['photo'],
+ 'href' => User::getAvatarUrlForId($owner['uid']),
],
[
'rel' => 'http://joindiaspora.com/seed_location',
],
];
- echo json_encode($json);
- exit();
+ header('Access-Control-Allow-Origin: *');
+ System::jsonExit($json, 'application/jrd+json; charset=utf-8');
}
private static function printXML($alias, $baseURL, $user, $owner, $avatar)
'$hcard_url' => $baseURL . '/hcard/' . $owner['nickname'],
'$atom' => $owner['poll'],
'$poco_url' => $owner['poco'],
- '$photo' => $owner['photo'],
+ '$photo' => User::getAvatarUrlForId($owner['uid']),
'$type' => $avatar['type'],
'$salmon' => $baseURL . '/salmon/' . $owner['nickname'],
'$salmen' => $baseURL . '/salmon/' . $owner['nickname'] . '/mention',