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