1
1
Fork 0

Merge pull request #6325 from annando/always-magic

Always use magic on the same server
This commit is contained in:
Hypolite Petovan 2018-12-25 16:16:03 -05:00 committed by GitHub
commit a939581cf8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 6 deletions

View file

@ -436,7 +436,7 @@ function dfrn_poll_content(App $a)
switch ($direction) { switch ($direction) {
case -1: case -1:
if ($type === 'profile') { 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 { } else {
$sql_extra = sprintf(" AND `issued-id` = '%s' ", DBA::escape($dfrn_id)); $sql_extra = sprintf(" AND `issued-id` = '%s' ", DBA::escape($dfrn_id));
} }

View file

@ -83,14 +83,15 @@ function redir_init(App $a) {
// When the remote page does support OWA, then we enforce the use of it // When the remote page does support OWA, then we enforce the use of it
$basepath = Contact::getBasepath($contact_url); $basepath = Contact::getBasepath($contact_url);
$serverret = Network::curl($basepath . '/magic'); if ($basepath == System::baseUrl()) {
if ($serverret->isSuccess()) { $use_magic = true;
$contact['issued-id'] = ''; } else {
$contact['dfrn-id'] = ''; $serverret = Network::curl($basepath . '/magic');
$use_magic = $serverret->isSuccess();
} }
// Doing remote auth with dfrn. // 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']); $dfrn_id = $orig_id = (($contact['issued-id']) ? $contact['issued-id'] : $contact['dfrn-id']);
if ($contact['duplex'] && $contact['issued-id']) { if ($contact['duplex'] && $contact['issued-id']) {