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