X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FMagic.php;h=4cb3dc7328052df1f9fe89da9cb603b24c753267;hb=5f80180b47679a81433e084448b9df7d96648506;hp=441fe7f157a33c61609744422dd94385a2cbb3ae;hpb=c1f99c70b1c7d62120723f3b142e843ba25ab338;p=friendica.git diff --git a/src/Module/Magic.php b/src/Module/Magic.php index 441fe7f157..4cb3dc7328 100644 --- a/src/Module/Magic.php +++ b/src/Module/Magic.php @@ -32,18 +32,16 @@ class Magic extends BaseModule $dest = defaults($_REQUEST, 'dest', ''); $test = (!empty($_REQUEST['test']) ? intval($_REQUEST['test']) : 0); $owa = (!empty($_REQUEST['owa']) ? intval($_REQUEST['owa']) : 0); + $cid = 0; - // NOTE: I guess $dest isn't just the profile url (could be also - // other profile pages e.g. photo). We need to find a solution - // to be able to redirct to other pages than the contact profile. - $cid = Contact::getIdForURL($dest); - - if (!$cid && !empty($addr)) { + if (!empty($addr)) { $cid = Contact::getIdForURL($addr); + } elseif (!empty($dest)) { + $cid = Contact::getIdForURL($dest); } if (!$cid) { - Logger::log('No contact record found: ' . json_encode($_REQUEST), Logger::DEBUG); + Logger::info('No contact record found', $_REQUEST); // @TODO Finding a more elegant possibility to redirect to either internal or external URL $a->redirect($dest); } @@ -99,9 +97,9 @@ class Magic extends BaseModule } else { $token = $j['token']; } - $x = strpbrk($dest, '?&'); - $args = (($x) ? '&owt=' . $token : '?f=&owt=' . $token); + $args = (strpbrk($dest, '?&') ? '&' : '?') . 'owt=' . $token; + Logger::info('Redirecting', ['path' => $dest . $args]); System::externalRedirect($dest . $args); } }