]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Admin/Users.php
Merge pull request #8272 from MrPetovan/bug/8254-regex-url-img
[friendica.git] / src / Module / Admin / Users.php
index 41ccb97528b2d83c068e339d3e88af48f8f0c768..fbaab1ded297b3277af484bcc29a1e0cfa7c61af 100644 (file)
@@ -1,19 +1,37 @@
 <?php
+/**
+ * @copyright Copyright (C) 2020, Friendica
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
 
 namespace Friendica\Module\Admin;
 
 use Friendica\Content\Pager;
-use Friendica\Core\Config;
 use Friendica\Core\Renderer;
 use Friendica\Database\DBA;
 use Friendica\DI;
 use Friendica\Model\Register;
 use Friendica\Model\User;
-use Friendica\Module\BaseAdminModule;
+use Friendica\Module\BaseAdmin;
 use Friendica\Util\Strings;
 use Friendica\Util\Temporal;
 
-class Users extends BaseAdminModule
+class Users extends BaseAdmin
 {
        public static function post(array $parameters = [])
        {
@@ -77,15 +95,13 @@ class Users extends BaseAdminModule
                        $preamble = sprintf($preamble, $user['username'], DI::config()->get('config', 'sitename'));
                        $body = sprintf($body, DI::baseUrl()->get(), $user['nickname'], $result['password'], DI::config()->get('config', 'sitename'));
 
-                       notification([
-                               'type'     => SYSTEM_EMAIL,
-                               'language' => $user['language'],
-                               'to_name'  => $user['username'],
-                               'to_email' => $user['email'],
-                               'uid'      => $user['uid'],
-                               'subject'  => DI::l10n()->t('Registration details for %s', DI::config()->get('config', 'sitename')),
-                               'preamble' => $preamble,
-                               'body'     => $body]);
+                       $email = DI::emailer()
+                               ->newSystemMail()
+                               ->withMessage(DI::l10n()->t('Registration details for %s', DI::config()->get('config', 'sitename')), $preamble, $body)
+                               ->forUser($user)
+                               ->withRecipient($user['email'])
+                               ->build();
+                       return DI::emailer()->send($email);
                }
 
                if (!empty($_POST['page_users_block'])) {