]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/User.php
Merge pull request #8071 from nupplaphil/task/Lock_to_lock
[friendica.git] / src / Model / User.php
index 7ecf4a576c5405fdd16ce22f8a657e82e3400fe4..b2b60d43627421251d6501e27373dd7181296e88 100644 (file)
@@ -18,6 +18,7 @@ use Friendica\Core\Protocol;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
 use Friendica\Database\DBA;
+use Friendica\DI;
 use Friendica\Model\TwoFactor\AppSpecificPassword;
 use Friendica\Object\Image;
 use Friendica\Util\Crypto;
@@ -216,12 +217,12 @@ class User
                // Check if the returned data is valid, otherwise fix it. See issue #6122
 
                // Check for correct url and normalised nurl
-               $url = System::baseUrl() . '/profile/' . $r['nickname'];
+               $url = DI::baseUrl() . '/profile/' . $r['nickname'];
                $repair = ($r['url'] != $url) || ($r['nurl'] != Strings::normaliseLink($r['url']));
 
                if (!$repair) {
                        // Check if "addr" is present and correct
-                       $addr = $r['nickname'] . '@' . substr(System::baseUrl(), strpos(System::baseUrl(), '://') + 3);
+                       $addr = $r['nickname'] . '@' . substr(DI::baseUrl(), strpos(DI::baseUrl(), '://') + 3);
                        $repair = ($addr != $r['addr']);
                }
 
@@ -587,7 +588,6 @@ class User
         */
        public static function create(array $data)
        {
-               $a = \get_app();
                $return = ['user' => null, 'password' => ''];
 
                $using_invites = Config::get('system', 'invitation_only');
@@ -633,9 +633,9 @@ class User
                                $_SESSION['register'] = 1;
                                $_SESSION['openid'] = $openid_url;
 
-                               $openid = new LightOpenID($a->getHostName());
+                               $openid = new LightOpenID(DI::baseUrl()->getHostname());
                                $openid->identity = $openid_url;
-                               $openid->returnUrl = System::baseUrl() . '/openid';
+                               $openid->returnUrl = DI::baseUrl() . '/openid';
                                $openid->required = ['namePerson/friendly', 'contact/email', 'namePerson'];
                                $openid->optional = ['namePerson/first', 'media/image/aspect11', 'media/image/default'];
                                try {
@@ -782,8 +782,8 @@ class User
                $insert_result = DBA::insert('profile', [
                        'uid' => $uid,
                        'name' => $username,
-                       'photo' => System::baseUrl() . "/photo/profile/{$uid}.jpg",
-                       'thumb' => System::baseUrl() . "/photo/avatar/{$uid}.jpg",
+                       'photo' => DI::baseUrl() . "/photo/profile/{$uid}.jpg",
+                       'thumb' => DI::baseUrl() . "/photo/avatar/{$uid}.jpg",
                        'publish' => $publish,
                        'is-default' => 1,
                        'net-publish' => $netpublish,
@@ -916,6 +916,7 @@ class User
         *
         * It's here as a function because the mail is sent from different parts
         *
+        * @param L10n\L10n   $l10n     The used language
         * @param array  $user     User record array
         * @param string $sitename
         * @param string $siteurl
@@ -923,9 +924,9 @@ class User
         * @return NULL|boolean from notification() and email() inherited
         * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
-       public static function sendRegisterOpenEmail($user, $sitename, $siteurl, $password)
+       public static function sendRegisterOpenEmail(L10n\L10n $l10n, $user, $sitename, $siteurl, $password)
        {
-               $preamble = Strings::deindent(L10n::t(
+               $preamble = Strings::deindent($l10n->t(
                        '
                                Dear %1$s,
                                Thank you for registering at %2$s. Your account has been created.
@@ -933,7 +934,7 @@ class User
                        $user['username'],
                        $sitename
                ));
-               $body = Strings::deindent(L10n::t(
+               $body = Strings::deindent($l10n->t(
                        '
                        The login details are as follows: