]> git.mxchange.org Git - friendica.git/blobdiff - mod/xrd.php
Merge pull request #6311 from annando/issue-6308
[friendica.git] / mod / xrd.php
index 921d48fe93708cddf1c66280207cadc5baf6734a..4b9b0ee8fb4e1931848b799cb07d5a86ec6b2dc7 100644 (file)
@@ -5,9 +5,11 @@
 
 use Friendica\App;
 use Friendica\Core\Addon;
+use Friendica\Core\Renderer;
 use Friendica\Core\System;
 use Friendica\Database\DBA;
 use Friendica\Protocol\Salmon;
+use Friendica\Util\Strings;
 
 function xrd_init(App $a)
 {
@@ -16,7 +18,7 @@ function xrd_init(App $a)
                        System::httpExit(404);
                }
 
-               $uri = urldecode(notags(trim($_GET['uri'])));
+               $uri = urldecode(Strings::escapeTags(trim($_GET['uri'])));
                if (defaults($_SERVER, 'HTTP_ACCEPT', '') == 'application/jrd+json') {
                        $mode = 'json';
                } else {
@@ -27,7 +29,7 @@ function xrd_init(App $a)
                        System::httpExit(404);
                }
 
-               $uri = urldecode(notags(trim($_GET['resource'])));
+               $uri = urldecode(Strings::escapeTags(trim($_GET['resource'])));
                if (defaults($_SERVER, 'HTTP_ACCEPT', '') == 'application/xrd+xml') {
                        $mode = 'xml';
                } else {
@@ -55,9 +57,9 @@ function xrd_init(App $a)
 
        $alias = str_replace('/profile/', '/~', $profile_url);
 
-       $addr = 'acct:'.$user['nickname'].'@'.$a->get_hostname();
-       if ($a->get_path()) {
-               $addr .= '/'.$a->get_path();
+       $addr = 'acct:'.$user['nickname'].'@'.$a->getHostName();
+       if ($a->getURLPath()) {
+               $addr .= '/'.$a->getURLPath();
        }
 
        if ($mode == 'xml') {
@@ -105,9 +107,9 @@ function xrd_xml($a, $uri, $alias, $profile_url, $r)
        header('Access-Control-Allow-Origin: *');
        header("Content-type: text/xml");
 
-       $tpl = get_markup_template('xrd_person.tpl');
+       $tpl = Renderer::getMarkupTemplate('xrd_person.tpl');
 
-       $o = replace_macros($tpl, [
+       $o = Renderer::replaceMacros($tpl, [
                '$nick'        => $r['nickname'],
                '$accturi'     => $uri,
                '$alias'       => $alias,