mirror of
https://github.com/friendica/friendica
synced 2025-04-27 11:10:12 +00:00
The magic link is added at more places
This commit is contained in:
parent
fa7bed8929
commit
5c2b54009e
2 changed files with 26 additions and 1 deletions
|
@ -500,6 +500,8 @@ class Profile
|
|||
$p['photo'] = proxy_url($p['photo'], false, PROXY_SIZE_SMALL);
|
||||
}
|
||||
|
||||
$p['url'] = self::magicLink($p['url']);
|
||||
|
||||
$tpl = get_markup_template('profile_vcard.tpl');
|
||||
$o .= replace_macros($tpl, [
|
||||
'$profile' => $p,
|
||||
|
@ -1005,6 +1007,29 @@ class Profile
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns a magic link to authenticate remote visitors
|
||||
*
|
||||
* @param string $contact_url The address of the contact profile
|
||||
* @param integer $uid The user id, "local_user" is the default
|
||||
*
|
||||
* @return string with "redir" link
|
||||
*/
|
||||
public static function magicLink($contact_url, $uid = -1)
|
||||
{
|
||||
if ($uid == -1) {
|
||||
$uid = local_user();
|
||||
}
|
||||
$condition = ['pending' => false, 'uid' => $uid,
|
||||
'nurl' => normalise_link($contact_url),
|
||||
'network' => NETWORK_DFRN, 'self' => false];
|
||||
$contact = dba::selectFirst('contact', ['id'], $condition);
|
||||
if (DBM::is_result($contact)) {
|
||||
return System::baseUrl() . '/redir/' . $contact['id'];
|
||||
}
|
||||
return self::zrl($contact_url);
|
||||
}
|
||||
|
||||
public static function zrl($s, $force = false)
|
||||
{
|
||||
if (!strlen($s)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue