]> git.mxchange.org Git - friendica.git/blob - mod/hostxrd.php
Merge pull request #2149 from annando/issue-1921
[friendica.git] / mod / hostxrd.php
1 <?php
2
3 require_once('include/crypto.php');
4
5 function hostxrd_init(&$a) {
6         header('Access-Control-Allow-Origin: *');
7         header("Content-type: text/xml");
8         $pubkey = get_config('system','site_pubkey');
9
10         if(! $pubkey) {
11                 $res = new_keypair(1024);
12
13                 set_config('system','site_prvkey', $res['prvkey']);
14                 set_config('system','site_pubkey', $res['pubkey']);
15         }
16
17         //$tpl = file_get_contents('view/xrd_host.tpl');
18         /*echo str_replace(array(
19                 '$zhost','$zroot','$domain','$zot_post','$bigkey'),array($a->get_hostname(),z_root(),z_path(),z_root() . '/post', salmon_key(get_config('system','site_pubkey'))),$tpl);*/
20         $tpl = get_markup_template('xrd_host.tpl');
21         echo replace_macros($tpl, array(
22                 '$zhost' => $a->get_hostname(),
23                 '$zroot' => z_root(),
24                 '$domain' => z_path(),
25                 '$zot_post' => z_root() . '/post',
26                 '$bigkey' => salmon_key(get_config('system','site_pubkey')),
27         ));
28         session_write_close();
29         exit();
30
31 }