X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fxrd.php;h=7b812a7f9d94610d804515ba2e454cdf855762b0;hb=4ad6a7f073c14c58a0acec2d5354a16433043b57;hp=f8e0a9c4098fdf98d8265b7f9f9733f5a30762af;hpb=4d21671f75e35e7c2880467dddc0936e8c718d8c;p=friendica.git diff --git a/mod/xrd.php b/mod/xrd.php index f8e0a9c409..7b812a7f9d 100644 --- a/mod/xrd.php +++ b/mod/xrd.php @@ -2,8 +2,7 @@ require_once('include/crypto.php'); -if(! function_exists('xrd_init')) { -function xrd_init(&$a) { +function xrd_init(App $a) { $uri = urldecode(notags(trim($_GET['uri']))); @@ -22,36 +21,35 @@ function xrd_init(&$a) { $r = q("SELECT * FROM `user` WHERE `nickname` = '%s' LIMIT 1", dbesc($name) ); - if(! count($r)) + if (! dbm::is_result($r)) { killme(); + } $salmon_key = salmon_key($r[0]['spubkey']); header('Access-Control-Allow-Origin: *'); header("Content-type: text/xml"); - if(get_config('system','diaspora_enabled')) { - $tpl = get_markup_template('xrd_diaspora.tpl'); - $dspr = replace_macros($tpl,array( - '$baseurl' => $a->get_baseurl(), - '$dspr_guid' => $r[0]['guid'], - '$dspr_key' => base64_encode(pemtorsa($r[0]['pubkey'])) - )); - } - else - $dspr = ''; + $tpl = get_markup_template('xrd_diaspora.tpl'); + $dspr = replace_macros($tpl,array( + '$baseurl' => App::get_baseurl(), + '$dspr_guid' => $r[0]['guid'], + '$dspr_key' => base64_encode(pemtorsa($r[0]['pubkey'])) + )); $tpl = get_markup_template('xrd_person.tpl'); - $profile_url = $a->get_baseurl().'/profile/'.$r[0]['nickname']; + $profile_url = App::get_baseurl().'/profile/'.$r[0]['nickname']; - if ($acct) + if ($acct) { $alias = $profile_url; + } else { $alias = 'acct:'.$r[0]['nickname'].'@'.$a->get_hostname(); - if ($a->get_path()) + if ($a->get_path()) { $alias .= '/'.$a->get_path(); + } } $o = replace_macros($tpl, array( @@ -59,17 +57,17 @@ function xrd_init(&$a) { '$accturi' => $uri, '$alias' => $alias, '$profile_url' => $profile_url, - '$hcard_url' => $a->get_baseurl() . '/hcard/' . $r[0]['nickname'], - '$atom' => $a->get_baseurl() . '/dfrn_poll/' . $r[0]['nickname'], - '$zot_post' => $a->get_baseurl() . '/post/' . $r[0]['nickname'], - '$poco_url' => $a->get_baseurl() . '/poco/' . $r[0]['nickname'], - '$photo' => $a->get_baseurl() . '/photo/profile/' . $r[0]['uid'] . '.jpg', + '$hcard_url' => App::get_baseurl() . '/hcard/' . $r[0]['nickname'], + '$atom' => App::get_baseurl() . '/dfrn_poll/' . $r[0]['nickname'], + '$zot_post' => App::get_baseurl() . '/post/' . $r[0]['nickname'], + '$poco_url' => App::get_baseurl() . '/poco/' . $r[0]['nickname'], + '$photo' => App::get_baseurl() . '/photo/profile/' . $r[0]['uid'] . '.jpg', '$dspr' => $dspr, - '$salmon' => $a->get_baseurl() . '/salmon/' . $r[0]['nickname'], - '$salmen' => $a->get_baseurl() . '/salmon/' . $r[0]['nickname'] . '/mention', - '$subscribe' => $a->get_baseurl() . '/follow?url={uri}', + '$salmon' => App::get_baseurl() . '/salmon/' . $r[0]['nickname'], + '$salmen' => App::get_baseurl() . '/salmon/' . $r[0]['nickname'] . '/mention', + '$subscribe' => App::get_baseurl() . '/follow?url={uri}', '$modexp' => 'data:application/magic-public-key,' . $salmon_key, - '$bigkey' => salmon_key($r[0]['pubkey']) + '$bigkey' => salmon_key($r[0]['pubkey']), )); @@ -78,5 +76,5 @@ function xrd_init(&$a) { echo $arr['xml']; killme(); -} + }