X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModule%2FInvite.php;h=1ce9700697c6ae7e67b64fa44f1d2dbe9db24028;hb=69b7923df2beed71419bc38e61ca9755fad24b12;hp=cb944a3fd3d1b723dcd4b869b6b51d93bba4f02b;hpb=71820db023f769afa22a5f1362913b8e22199cf1;p=friendica.git diff --git a/src/Module/Invite.php b/src/Module/Invite.php index cb944a3fd3..1ce9700697 100644 --- a/src/Module/Invite.php +++ b/src/Module/Invite.php @@ -1,6 +1,6 @@ t('Permission denied.')); @@ -57,7 +58,7 @@ class Invite extends BaseModule $recipients = !empty($_POST['recipients']) ? explode("\n", $_POST['recipients']) : []; - $message = !empty($_POST['message']) ? Strings::escapeTags(trim($_POST['message'])) : ''; + $message = !empty($_POST['message']) ? Strings::escapeHtml(trim($_POST['message'])) : ''; $total = 0; $invitation_only = false; @@ -66,11 +67,13 @@ class Invite extends BaseModule if ($config->get('system', 'invitation_only')) { $invitation_only = true; $invites_remaining = DI::pConfig()->get(local_user(), 'system', 'invites_remaining'); - if ((!$invites_remaining) && (!is_site_admin())) { + if ((!$invites_remaining) && (!$app->isSiteAdmin())) { throw new HTTPException\ForbiddenException(); } } + $user = User::getById(local_user()); + foreach ($recipients as $recipient) { $recipient = trim($recipient); @@ -79,11 +82,11 @@ class Invite extends BaseModule continue; } - if ($invitation_only && ($invites_remaining || is_site_admin())) { + if ($invitation_only && ($invites_remaining || $app->isSiteAdmin())) { $code = Model\Register::createForInvitation(); $nmessage = str_replace('$invite_code', $code, $message); - if (!is_site_admin()) { + if (!$app->isSiteAdmin()) { $invites_remaining--; if ($invites_remaining >= 0) { DI::pConfig()->set(local_user(), 'system', 'invites_remaining', $invites_remaining); @@ -95,8 +98,7 @@ class Invite extends BaseModule $nmessage = $message; } - $additional_headers = 'From: ' . $app->user['email'] . "\n" - . 'Sender: ' . DI::emailer()->getSiteEmailAddress() . "\n" + $additional_headers = 'From: "' . $user['email'] . '" <' . DI::emailer()->getSiteEmailAddress() . ">\n" . 'Content-type: text/plain; charset=UTF-8' . "\n" . 'Content-transfer-encoding: 8bit'; @@ -119,10 +121,10 @@ class Invite extends BaseModule } } - notice(DI::l10n()->tt('%d message sent.', '%d messages sent.', $total)); + info(DI::l10n()->tt('%d message sent.', '%d messages sent.', $total)); } - public static function content(array $parameters = []) + protected function content(array $request = []): string { if (!local_user()) { throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.')); @@ -136,7 +138,7 @@ class Invite extends BaseModule if ($config->get('system', 'invitation_only')) { $inviteOnly = true; $x = DI::pConfig()->get(local_user(), 'system', 'invites_remaining'); - if ((!$x) && (!is_site_admin())) { + if ((!$x) && (!$app->isSiteAdmin())) { throw new HTTPException\ForbiddenException(DI::l10n()->t('You have no more invitations available')); } } @@ -169,7 +171,7 @@ class Invite extends BaseModule DI::l10n()->t('You are cordially invited to join me and other close friends on Friendica - and help us to create a better social web.') . "\r\n" . "\r\n" . $linkTxt . "\r\n" . "\r\n" . (($inviteOnly) ? DI::l10n()->t('You will need to supply this invitation code: $invite_code') . "\r\n" . "\r\n" : '') . DI::l10n()->t('Once you have registered, please connect with me via my profile page at:') - . "\r\n" . "\r\n" . DI::baseUrl()->get() . '/profile/' . $app->user['nickname'] + . "\r\n" . "\r\n" . DI::baseUrl()->get() . '/profile/' . $app->getLoggedInUserNickname() . "\r\n" . "\r\n" . DI::l10n()->t('For more information about the Friendica project and why we feel it is important, please visit http://friendi.ca') . "\r\n" . "\r\n", ], '$submit' => DI::l10n()->t('Submit')