3 require_once('include/crypto.php');
5 function xrd_init(&$a) {
7 $uri = urldecode(notags(trim($_GET['uri'])));
9 if(substr($uri,0,4) === 'http')
10 $name = basename($uri);
12 $local = str_replace('acct:', '', $uri);
13 if(substr($local,0,2) == '//')
14 $local = substr($local,2);
16 $name = substr($local,0,strpos($local,'@'));
19 $r = q("SELECT * FROM `user` WHERE `nickname` = '%s' LIMIT 1",
25 $salmon_key = salmon_key($r[0]['spubkey']);
27 header('Access-Control-Allow-Origin: *');
28 header("Content-type: text/xml");
30 if(get_config('system','diaspora_enabled')) {
31 //$tpl = file_get_contents('view/xrd_diaspora.tpl');
32 $tpl = get_markup_template('xrd_diaspora.tpl');
33 $dspr = replace_macros($tpl,array(
34 '$baseurl' => $a->get_baseurl(),
35 '$dspr_guid' => $r[0]['guid'],
36 '$dspr_key' => base64_encode(pemtorsa($r[0]['pubkey']))
42 //$tpl = file_get_contents('view/xrd_person.tpl');
43 $tpl = get_markup_template('xrd_person.tpl');
45 $o = replace_macros($tpl, array(
46 '$nick' => $r[0]['nickname'],
48 '$profile_url' => $a->get_baseurl() . '/profile/' . $r[0]['nickname'],
49 '$hcard_url' => $a->get_baseurl() . '/hcard/' . $r[0]['nickname'],
50 '$atom' => $a->get_baseurl() . '/dfrn_poll/' . $r[0]['nickname'],
51 '$zot_post' => $a->get_baseurl() . '/post/' . $r[0]['nickname'],
52 '$poco_url' => $a->get_baseurl() . '/poco/' . $r[0]['nickname'],
53 '$photo' => $a->get_baseurl() . '/photo/profile/' . $r[0]['uid'] . '.jpg',
55 '$salmon' => $a->get_baseurl() . '/salmon/' . $r[0]['nickname'],
56 '$salmen' => $a->get_baseurl() . '/salmon/' . $r[0]['nickname'] . '/mention',
57 '$modexp' => 'data:application/magic-public-key,' . $salmon_key,
58 '$bigkey' => salmon_key($r[0]['pubkey'])
62 $arr = array('user' => $r[0], 'xml' => $o);
63 call_hooks('personal_xrd', $arr);