X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FMagic.php;h=85da8eb485150e19e057af3b8661258525539b12;hb=5367620467f690774966c77cf5049ace9e6552a8;hp=0f610d123c3c0b7a1a2dc9795f9f2c96ddc3b2f4;hpb=f2c31ef1c0e92208b58d22791fc72d0ad3e3d6ae;p=friendica.git diff --git a/src/Module/Magic.php b/src/Module/Magic.php index 0f610d123c..85da8eb485 100644 --- a/src/Module/Magic.php +++ b/src/Module/Magic.php @@ -1,13 +1,31 @@ . + * */ + namespace Friendica\Module; use Friendica\BaseModule; use Friendica\Core\Logger; use Friendica\Core\System; use Friendica\Database\DBA; +use Friendica\DI; use Friendica\Model\Contact; use Friendica\Util\HTTPSignature; use Friendica\Util\Network; @@ -22,7 +40,7 @@ class Magic extends BaseModule { public static function init(array $parameters = []) { - $a = self::getApp(); + $a = DI::app(); $ret = ['success' => false, 'url' => '', 'message' => '']; Logger::log('magic mdule: invoked', Logger::DEBUG); @@ -48,7 +66,7 @@ class Magic extends BaseModule $contact = DBA::selectFirst('contact', ['id', 'nurl', 'url'], ['id' => $cid]); // Redirect if the contact is already authenticated on this site. - if (!empty($a->contact) && array_key_exists('id', $a->contact) && strpos($contact['nurl'], Strings::normaliseLink(self::getApp()->getBaseURL())) !== false) { + if (!empty($a->contact) && array_key_exists('id', $a->contact) && strpos($contact['nurl'], Strings::normaliseLink(DI::baseUrl()->get())) !== false) { if ($test) { $ret['success'] = true; $ret['message'] .= 'Local site - you are already authenticated.' . EOL; @@ -79,7 +97,7 @@ class Magic extends BaseModule $headers = HTTPSignature::createSig( $headers, $user['prvkey'], - 'acct:' . $user['nickname'] . '@' . $a->getHostName() . ($a->getURLPath() ? '/' . $a->getURLPath() : '') + 'acct:' . $user['nickname'] . '@' . DI::baseUrl()->getHostname() . (DI::baseUrl()->getUrlPath() ? '/' . DI::baseUrl()->getUrlPath() : '') ); // Try to get an authentication token from the other instance.