]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Register.php
Changes:
[friendica.git] / src / Module / Register.php
index b71fb777c593cc6bc38ec954a4f32a697a78639c..def750b3a8bb1bcb78d2739caf09a996bb42fd67 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2024, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -150,18 +150,18 @@ class Register extends BaseModule
                        '$invite_label' => DI::l10n()->t('Your invitation code: '),
                        '$invite_id'    => $invite_id,
                        '$regtitle'     => DI::l10n()->t('Registration'),
-                       '$registertext' => BBCode::convert(DI::config()->get('config', 'register_text', '')),
+                       '$registertext' => BBCode::convertForUriId(User::getSystemUriId(), DI::config()->get('config', 'register_text', '')),
                        '$fillwith'     => $fillwith,
                        '$fillext'      => $fillext,
                        '$oidlabel'     => $oidlabel,
                        '$openid'       => $openid_url,
-                       '$namelabel'    => DI::l10n()->t('Your Full Name (e.g. Joe Smith, real or real-looking): '),
+                       '$namelabel'    => DI::l10n()->t('Your Display Name (as you would like it to be displayed on this system'),
                        '$addrlabel'    => DI::l10n()->t('Your Email Address: (Initial information will be send there, so this has to be an existing address.)'),
                        '$addrlabel2'   => DI::l10n()->t('Please repeat your e-mail address:'),
                        '$ask_password' => $ask_password,
                        '$password1'    => ['password1', DI::l10n()->t('New Password:'), '', DI::l10n()->t('Leave empty for an auto generated password.')],
                        '$password2'    => ['confirm', DI::l10n()->t('Confirm:'), '', ''],
-                       '$nickdesc'     => DI::l10n()->t('Choose a profile nickname. This must begin with a text character. Your profile address on this site will then be "<strong>nickname@%s</strong>".', DI::baseUrl()->getHostname()),
+                       '$nickdesc'     => DI::l10n()->t('Choose a profile nickname. This must begin with a text character. Your profile address on this site will then be "<strong>nickname@%s</strong>".', DI::baseUrl()->getHost()),
                        '$nicklabel'    => DI::l10n()->t('Choose a nickname: '),
                        '$photo'        => $photo,
                        '$publish'      => $profile_publish,
@@ -169,7 +169,7 @@ class Register extends BaseModule
                        '$username'     => $username,
                        '$email'        => $email,
                        '$nickname'     => $nickname,
-                       '$sitename'     => DI::baseUrl()->getHostname(),
+                       '$sitename'     => DI::baseUrl()->getHost(),
                        '$importh'      => DI::l10n()->t('Import'),
                        '$importt'      => DI::l10n()->t('Import your profile to this friendica instance'),
                        '$showtoslink'  => DI::config()->get('system', 'tosdisplay'),
@@ -298,7 +298,7 @@ class Register extends BaseModule
 
                $user = $result['user'];
 
-               $base_url = DI::baseUrl()->get();
+               $base_url = (string)DI::baseUrl();
 
                if ($netpublish && intval(DI::config()->get('config', 'register_policy')) !== self::APPROVE) {
                        $url = $base_url . '/profile/' . $user['nickname'];
@@ -353,6 +353,7 @@ class Register extends BaseModule
                        }
                } elseif (intval(DI::config()->get('config', 'register_policy')) === self::APPROVE) {
                        if (!User::getAdminEmailList()) {
+                               $this->logger->critical('Registration policy is set to APPROVE but no admin email address has been set in config.admin_email');
                                DI::sysmsg()->addNotice(DI::l10n()->t('Your registration can not be processed.'));
                                DI::baseUrl()->redirect();
                        }
@@ -362,10 +363,17 @@ class Register extends BaseModule
                                DI::sysmsg()->addNotice(DI::l10n()->t('You have to leave a request note for the admin.')
                                        . DI::l10n()->t('Your registration can not be processed.'));
 
-                               DI::baseUrl()->redirect('register/');
+                               $this->baseUrl->redirect('register');
                        }
 
-                       Model\Register::createForApproval($user['uid'], DI::config()->get('system', 'language'), $_POST['permonlybox']);
+                       try {
+                               Model\Register::createForApproval($user['uid'], DI::config()->get('system', 'language'), $_POST['permonlybox']);
+                       } catch (\Throwable $e) {
+                               $this->logger->error('Unable to create a `register` record.', ['user' => $user]);
+                               DI::sysmsg()->addNotice(DI::l10n()->t('An internal error occured.')
+                                       . DI::l10n()->t('Your registration can not be processed.'));
+                               $this->baseUrl->redirect('register');
+                       }
 
                        // invite system
                        if ($using_invites && $invite_id) {
@@ -396,11 +404,11 @@ class Register extends BaseModule
                                'type'                      => Model\Notification\Type::SYSTEM,
                                'event'                     => $event,
                                'uid'                       => $admin['uid'],
-                               'link'                      => DI::baseUrl()->get(true) . '/moderation/users/',
+                               'link'                      => DI::baseUrl() . '/moderation/users/',
                                'source_name'               => $user['username'],
                                'source_mail'               => $user['email'],
                                'source_nick'               => $user['nickname'],
-                               'source_link'               => DI::baseUrl()->get(true) . '/moderation/users/',
+                               'source_link'               => DI::baseUrl() . '/moderation/users/',
                                'source_photo'              => User::getAvatarUrl($user, Proxy::SIZE_THUMB),
                                'show_in_notification_page' => false
                        ]);