aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Xrd.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-10-09 19:46:27 +0000
committerMario <mario@mariovavti.com>2021-10-09 19:46:27 +0000
commit59940e7f053a1bb3fd0588e25d34b5235133dd2b (patch)
treedf571d4ef8575cfb371c54fc42ef147927d983f7 /Zotlabs/Module/Xrd.php
parent094536e6339eaba87cc0b372418a50b865fe0a97 (diff)
downloadvolse-hubzilla-59940e7f053a1bb3fd0588e25d34b5235133dd2b.tar.gz
volse-hubzilla-59940e7f053a1bb3fd0588e25d34b5235133dd2b.tar.bz2
volse-hubzilla-59940e7f053a1bb3fd0588e25d34b5235133dd2b.zip
make sure to not include removed channels in xrd or webfinger queries
Diffstat (limited to 'Zotlabs/Module/Xrd.php')
-rw-r--r--Zotlabs/Module/Xrd.php27
1 files changed, 13 insertions, 14 deletions
diff --git a/Zotlabs/Module/Xrd.php b/Zotlabs/Module/Xrd.php
index 21574eb8d..b7868c2cc 100644
--- a/Zotlabs/Module/Xrd.php
+++ b/Zotlabs/Module/Xrd.php
@@ -28,19 +28,18 @@ class Xrd extends \Zotlabs\Web\Controller {
$name = substr($local,0,strpos($local,'@'));
}
- $r = q("SELECT * FROM channel WHERE channel_address = '%s' LIMIT 1",
- dbesc($name)
- );
+ $r = channelx_by_nick($name);
+
if(! $r)
killme();
- $salmon_key = Keyutils::salmonKey($r[0]['channel_pubkey']);
+ $salmon_key = Keyutils::salmonKey($r['channel_pubkey']);
header('Access-Control-Allow-Origin: *');
header("Content-type: application/xrd+xml");
- $aliases = array('acct:' . channel_reddress($r[0]), z_root() . '/channel/' . $r[0]['channel_address'], z_root() . '/~' . $r[0]['channel_address']);
+ $aliases = array('acct:' . channel_reddress($r), z_root() . '/channel/' . $r['channel_address'], z_root() . '/~' . $r['channel_address']);
for($x = 0; $x < count($aliases); $x ++) {
if($aliases[$x] === $resource)
@@ -48,23 +47,23 @@ class Xrd extends \Zotlabs\Web\Controller {
}
$o = replace_macros(get_markup_template('xrd_person.tpl'), array(
- '$nick' => $r[0]['channel_address'],
+ '$nick' => $r['channel_address'],
'$accturi' => $resource,
'$subject' => $subject,
'$aliases' => $aliases,
- '$channel_url' => z_root() . '/channel/' . $r[0]['channel_address'],
- '$profile_url' => z_root() . '/channel/' . $r[0]['channel_address'],
- '$hcard_url' => z_root() . '/hcard/' . $r[0]['channel_address'],
- '$atom' => z_root() . '/ofeed/' . $r[0]['channel_address'],
- '$zot_post' => z_root() . '/post/' . $r[0]['channel_address'],
- '$poco_url' => z_root() . '/poco/' . $r[0]['channel_address'],
- '$photo' => z_root() . '/photo/profile/l/' . $r[0]['channel_id'],
+ '$channel_url' => z_root() . '/channel/' . $r['channel_address'],
+ '$profile_url' => z_root() . '/channel/' . $r['channel_address'],
+ '$hcard_url' => z_root() . '/hcard/' . $r['channel_address'],
+ '$atom' => z_root() . '/ofeed/' . $r['channel_address'],
+ '$zot_post' => z_root() . '/post/' . $r['channel_address'],
+ '$poco_url' => z_root() . '/poco/' . $r['channel_address'],
+ '$photo' => z_root() . '/photo/profile/l/' . $r['channel_id'],
'$modexp' => 'data:application/magic-public-key,' . $salmon_key,
'$subscribe' => z_root() . '/follow?f=&amp;url={uri}',
));
- $arr = array('user' => $r[0], 'xml' => $o);
+ $arr = array('user' => $r, 'xml' => $o);
call_hooks('personal_xrd', $arr);
echo $arr['xml'];