From a565406b478971565f7e4398af4bccd46b882101 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 25 Dec 2018 19:43:57 +0000 Subject: [PATCH] Always usa magic on the same server --- mod/dfrn_poll.php | 2 +- mod/redir.php | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php index 001202d5e5..acc279be26 100644 --- a/mod/dfrn_poll.php +++ b/mod/dfrn_poll.php @@ -436,7 +436,7 @@ function dfrn_poll_content(App $a) switch ($direction) { case -1: if ($type === 'profile') { - $sql_extra = sprintf(" AND ( `dfrn-id` = '%s' OR `issued-id` = '%s' ) ", DBA::escape($dfrn_id), DBA::escape($dfrn_id)); + $sql_extra = sprintf(" AND (`dfrn-id` = '%s' OR `issued-id` = '%s') ", DBA::escape($dfrn_id), DBA::escape($dfrn_id)); } else { $sql_extra = sprintf(" AND `issued-id` = '%s' ", DBA::escape($dfrn_id)); } diff --git a/mod/redir.php b/mod/redir.php index f8dfa3ab9f..33b7d36f91 100644 --- a/mod/redir.php +++ b/mod/redir.php @@ -83,14 +83,15 @@ function redir_init(App $a) { // When the remote page does support OWA, then we enforce the use of it $basepath = Contact::getBasepath($contact_url); - $serverret = Network::curl($basepath . '/magic'); - if ($serverret->isSuccess()) { - $contact['issued-id'] = ''; - $contact['dfrn-id'] = ''; + if ($basepath == System::baseUrl()) { + $use_magic = true; + } else { + $serverret = Network::curl($basepath . '/magic'); + $use_magic = $serverret->isSuccess(); } // Doing remote auth with dfrn. - if (local_user() && (!empty($contact['dfrn-id']) || !empty($contact['issued-id'])) && empty($contact['pending'])) { + if (local_user() && !$use_magic && (!empty($contact['dfrn-id']) || !empty($contact['issued-id'])) && empty($contact['pending'])) { $dfrn_id = $orig_id = (($contact['issued-id']) ? $contact['issued-id'] : $contact['dfrn-id']); if ($contact['duplex'] && $contact['issued-id']) { -- 2.39.5