Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.1 KiB

  1. <?php
  2. require_once('salmon.php');
  3. function xrd_content(&$a) {
  4. $uri = urldecode(notags(trim($_GET['uri'])));
  5. if(substr($uri,0,4) === 'http')
  6. $name = basename($uri);
  7. else {
  8. $local = str_replace('acct:', '', $uri);
  9. if(substr($local,0,2) == '//')
  10. $local = substr($local,2);
  11. $name = substr($local,0,strpos($local,'@'));
  12. }
  13. $r = q("SELECT * FROM `user` WHERE `nickname` = '%s' LIMIT 1",
  14. dbesc($name)
  15. );
  16. if(! count($r))
  17. killme();
  18. $salmon_key = salmon_key($r[0]['spubkey']);
  19. header("Content-type: text/xml");
  20. $tpl = load_view_file('view/xrd_person.tpl');
  21. $o = replace_macros($tpl, array(
  22. '$accturi' => $uri,
  23. '$profile_url' => $a->get_baseurl() . '/profile/' . $r[0]['nickname'],
  24. '$atom' => $a->get_baseurl() . '/dfrn_poll/' . $r[0]['nickname'],
  25. '$photo' => $a->get_baseurl() . '/photo/profile/' . $r[0]['uid'] . '.jpg',
  26. '$salmon' => $a->get_baseurl() . '/salmon/' . $r[0]['nickname'],
  27. '$salmen' => $a->get_baseurl() . '/salmon/' . $r[0]['nickname'] . '/mention',
  28. '$modexp' => 'data:application/magic-public-key,' . $salmon_key
  29. ));
  30. echo $o;
  31. killme();
  32. }