X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FMagic.php;h=85da8eb485150e19e057af3b8661258525539b12;hb=5367620467f690774966c77cf5049ace9e6552a8;hp=b04ea80c04bdd73f84ae90a4b515fa7f02c05dd5;hpb=f8c0f24e34e124ab782d5dcf3d2d658d70e19e5c;p=friendica.git diff --git a/src/Module/Magic.php b/src/Module/Magic.php index b04ea80c04..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; @@ -20,9 +38,9 @@ use Friendica\Util\Strings; */ class Magic extends BaseModule { - public static function init() + 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.