]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Register.php
Fix user-contact rows not being updated in Contact\User::updateByContactUpdate
[friendica.git] / src / Module / Register.php
index 909e61a998688f6e4118140ced1f3ffbd3cdcaa7..609e86a919307e5b0aced0dd8f84c69acc6cdd45 100644 (file)
@@ -33,7 +33,6 @@ use Friendica\DI;
 use Friendica\Model;
 use Friendica\Model\User;
 use Friendica\Util\Proxy;
-use Friendica\Util\Strings;
 
 /**
  * @author Hypolite Petovan <hypolite@mrpetovan.com>
@@ -44,6 +43,16 @@ class Register extends BaseModule
        const APPROVE = 1;
        const OPEN    = 2;
 
+       /** @var Tos */
+       protected $tos;
+
+       public function __construct(Tos $tos, L10n $l10n, array $parameters = [])
+       {
+               parent::__construct($l10n, $parameters);
+
+               $this->tos = $tos;
+       }
+
        /**
         * Module GET method to display any content
         *
@@ -53,7 +62,7 @@ class Register extends BaseModule
         *
         * @return string
         */
-       public static function content(array $parameters = [])
+       public function content(): string
        {
                // logged in users can register others (people/pages/groups)
                // even with closed registrations, unless specifically prohibited by site policy.
@@ -129,8 +138,6 @@ class Register extends BaseModule
 
                $tpl = $arr['template'];
 
-               $tos = new Tos();
-
                $o = Renderer::replaceMacros($tpl, [
                        '$invitations'  => DI::config()->get('system', 'invitation_only'),
                        '$permonly'     => intval(DI::config()->get('config', 'register_policy')) === self::APPROVE,
@@ -164,7 +171,7 @@ class Register extends BaseModule
                        '$showtoslink'  => DI::config()->get('system', 'tosdisplay'),
                        '$tostext'      => DI::l10n()->t('Terms of Service'),
                        '$showprivstatement' => DI::config()->get('system', 'tosprivstatement'),
-                       '$privstatement'=> $tos->privacy_complete,
+                       '$privstatement'=> $this->tos->privacy_complete,
                        '$form_security_token' => BaseModule::getFormSecurityToken('register'),
                        '$explicit_content' => DI::config()->get('system', 'explicit_content', false),
                        '$explicit_content_note' => DI::l10n()->t('Note: This node explicitly contains adult content'),
@@ -182,7 +189,7 @@ class Register extends BaseModule
         * Extend this method if the module is supposed to process POST requests.
         * Doesn't display any content
         */
-       public static function post(array $parameters = [])
+       public function post()
        {
                BaseModule::checkFormSecurityTokenRedirectOnError('/register', 'register');