mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-17 04:45:16 +02:00
The first queries are replaced with the new functions. More to come ...
This commit is contained in:
parent
1c38540f20
commit
2c11e91e65
8 changed files with 32 additions and 54 deletions
34
mod/xrd.php
34
mod/xrd.php
|
@ -20,14 +20,12 @@ function xrd_init(App $a) {
|
|||
$name = substr($local,0,strpos($local,'@'));
|
||||
}
|
||||
|
||||
$r = q("SELECT * FROM `user` WHERE `nickname` = '%s' LIMIT 1",
|
||||
dbesc($name)
|
||||
);
|
||||
$r = dba::select('user', array(), array('nickname' => $name), array('limit' => 1));
|
||||
if (! dbm::is_result($r)) {
|
||||
killme();
|
||||
}
|
||||
|
||||
$salmon_key = salmon_key($r[0]['spubkey']);
|
||||
$salmon_key = salmon_key($r['spubkey']);
|
||||
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header("Content-type: text/xml");
|
||||
|
@ -35,19 +33,19 @@ function xrd_init(App $a) {
|
|||
$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']))
|
||||
'$dspr_guid' => $r['guid'],
|
||||
'$dspr_key' => base64_encode(pemtorsa($r['pubkey']))
|
||||
));
|
||||
|
||||
$tpl = get_markup_template('xrd_person.tpl');
|
||||
|
||||
$profile_url = App::get_baseurl().'/profile/'.$r[0]['nickname'];
|
||||
$profile_url = App::get_baseurl().'/profile/'.$r['nickname'];
|
||||
|
||||
if ($acct) {
|
||||
$alias = $profile_url;
|
||||
}
|
||||
else {
|
||||
$alias = 'acct:'.$r[0]['nickname'].'@'.$a->get_hostname();
|
||||
$alias = 'acct:'.$r['nickname'].'@'.$a->get_hostname();
|
||||
|
||||
if ($a->get_path()) {
|
||||
$alias .= '/'.$a->get_path();
|
||||
|
@ -55,25 +53,25 @@ function xrd_init(App $a) {
|
|||
}
|
||||
|
||||
$o = replace_macros($tpl, array(
|
||||
'$nick' => $r[0]['nickname'],
|
||||
'$nick' => $r['nickname'],
|
||||
'$accturi' => $uri,
|
||||
'$alias' => $alias,
|
||||
'$profile_url' => $profile_url,
|
||||
'$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',
|
||||
'$hcard_url' => App::get_baseurl() . '/hcard/' . $r['nickname'],
|
||||
'$atom' => App::get_baseurl() . '/dfrn_poll/' . $r['nickname'],
|
||||
'$zot_post' => App::get_baseurl() . '/post/' . $r['nickname'],
|
||||
'$poco_url' => App::get_baseurl() . '/poco/' . $r['nickname'],
|
||||
'$photo' => App::get_baseurl() . '/photo/profile/' . $r['uid'] . '.jpg',
|
||||
'$dspr' => $dspr,
|
||||
'$salmon' => App::get_baseurl() . '/salmon/' . $r[0]['nickname'],
|
||||
'$salmen' => App::get_baseurl() . '/salmon/' . $r[0]['nickname'] . '/mention',
|
||||
'$salmon' => App::get_baseurl() . '/salmon/' . $r['nickname'],
|
||||
'$salmen' => App::get_baseurl() . '/salmon/' . $r['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['pubkey']),
|
||||
));
|
||||
|
||||
|
||||
$arr = array('user' => $r[0], 'xml' => $o);
|
||||
$arr = array('user' => $r, 'xml' => $o);
|
||||
call_hooks('personal_xrd', $arr);
|
||||
|
||||
echo $arr['xml'];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue