aboutsummaryrefslogtreecommitdiffstats
path: root/mod/xrd.php
diff options
context:
space:
mode:
authorPaolo Tacconi <p.tacconi@giunti.it>2016-04-15 09:22:27 +0200
committerPaolo Tacconi <p.tacconi@giunti.it>2016-04-15 09:22:27 +0200
commitc38c79d71c8ef70ef649f83e322f1984b75ee2dd (patch)
tree958fcd22f04546f40b6ac68bb58cfe1a1b1fb7f6 /mod/xrd.php
parent1806da0851dd5cf5978b19d12783ae3101a11257 (diff)
parent45a854762b451dafb882bc56efce054b64420627 (diff)
downloadvolse-hubzilla-c38c79d71c8ef70ef649f83e322f1984b75ee2dd.tar.gz
volse-hubzilla-c38c79d71c8ef70ef649f83e322f1984b75ee2dd.tar.bz2
volse-hubzilla-c38c79d71c8ef70ef649f83e322f1984b75ee2dd.zip
Merge branch 'redmatrix-master'
Diffstat (limited to 'mod/xrd.php')
-rw-r--r--mod/xrd.php40
1 files changed, 26 insertions, 14 deletions
diff --git a/mod/xrd.php b/mod/xrd.php
index a373f8bf5..463cda662 100644
--- a/mod/xrd.php
+++ b/mod/xrd.php
@@ -7,8 +7,12 @@ function xrd_init(&$a) {
$uri = urldecode(notags(trim($_GET['uri'])));
logger('xrd: ' . $uri,LOGGER_DEBUG);
- if(substr($uri,0,4) === 'http')
+ $resource = $uri;
+
+ if(substr($uri,0,4) === 'http') {
+ $uri = str_replace('~','',$uri);
$name = basename($uri);
+ }
else {
$local = str_replace('acct:', '', $uri);
if(substr($local,0,2) == '//')
@@ -24,8 +28,8 @@ function xrd_init(&$a) {
killme();
$dspr = replace_macros(get_markup_template('xrd_diaspora.tpl'),array(
- '$baseurl' => $a->get_baseurl(),
- '$dspr_guid' => $r[0]['channel_guid'] . str_replace('.','',$a->get_hostname()),
+ '$baseurl' => z_root(),
+ '$dspr_guid' => $r[0]['channel_guid'] . str_replace('.','',App::get_hostname()),
'$dspr_key' => base64_encode(pemtorsa($r[0]['channel_pubkey']))
));
@@ -35,22 +39,30 @@ function xrd_init(&$a) {
header("Content-type: application/xrd+xml");
- $tpl = get_markup_template('view/xrd_person.tpl');
+ $aliases = array('acct:' . $r[0]['channel_address'] . '@' . App::get_hostname(), z_root() . '/channel/' . $r[0]['channel_address'], z_root() . '/~' . $r[0]['channel_address']);
+
+ for($x = 0; $x < count($aliases); $x ++) {
+ if($aliases[$x] === $resource)
+ unset($aliases[$x]);
+ }
+
$o = replace_macros(get_markup_template('xrd_person.tpl'), array(
'$nick' => $r[0]['channel_address'],
- '$accturi' => $uri,
- '$profile_url' => $a->get_baseurl() . '/channel/' . $r[0]['channel_address'],
- '$hcard_url' => $a->get_baseurl() . '/hcard/' . $r[0]['channel_address'],
- '$atom' => $a->get_baseurl() . '/feed/' . $r[0]['channel_address'],
- '$zot_post' => $a->get_baseurl() . '/post/' . $r[0]['channel_address'],
- '$poco_url' => $a->get_baseurl() . '/poco/' . $r[0]['channel_address'],
- '$photo' => $a->get_baseurl() . '/photo/profile/l/' . $r[0]['channel_id'],
+ '$accturi' => $resource,
+ '$aliases' => $aliases,
+ '$profile_url' => z_root() . '/channel/' . $r[0]['channel_address'],
+ '$hcard_url' => z_root() . '/hcard/' . $r[0]['channel_address'],
+ '$atom' => z_root() . '/feed/' . $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'],
'$dspr' => $dspr,
-// '$salmon' => $a->get_baseurl() . '/salmon/' . $r[0]['channel_address'],
-// '$salmen' => $a->get_baseurl() . '/salmon/' . $r[0]['channel_address'] . '/mention',
+// '$salmon' => z_root() . '/salmon/' . $r[0]['channel_address'],
+// '$salmen' => z_root() . '/salmon/' . $r[0]['channel_address'] . '/mention',
'$modexp' => 'data:application/magic-public-key,' . $salmon_key,
-// '$bigkey' => salmon_key($r[0]['pubkey'])
+ '$subscribe' => z_root() . '/follow?url={uri}',
+ '$bigkey' => salmon_key($r[0]['channel_pubkey'])
));