- /**
- * @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);
- }
-