3 * @file mod/removeme.php
7 use Friendica\Core\Renderer;
8 use Friendica\Database\DBA;
10 use Friendica\Model\User;
11 use Friendica\Util\Strings;
13 function removeme_post(App $a)
19 if (!empty($_SESSION['submanage'])) {
23 if (empty($_POST['qxz_password'])) {
27 if (empty($_POST['verify'])) {
31 if ($_POST['verify'] !== $_SESSION['remove_account_verify']) {
35 // send notification to admins so that they can clean um the backups
36 // send email to admins
37 $admin_mails = explode(",", str_replace(" ", "", DI::config()->get('config', 'admin_email')));
38 foreach ($admin_mails as $mail) {
39 $admin = DBA::selectFirst('user', ['uid', 'language', 'email', 'username'], ['email' => $mail]);
40 if (!DBA::isResult($admin)) {
44 $email = DI::emailer()
47 DI::l10n()->t('[Friendica System Notify]') . ' ' . DI::l10n()->t('User deleted their account'),
48 DI::l10n()->t('On your Friendica node an user deleted their account. Please ensure that their data is removed from the backups.'),
49 DI::l10n()->t('The user id is %d', local_user()))
51 ->withRecipient($admin['email'])
53 DI::emailer()->send($email);
56 if (User::getIdFromPasswordAuthentication($a->user, trim($_POST['qxz_password']))) {
57 User::remove($a->user['uid']);
59 unset($_SESSION['authenticated']);
60 unset($_SESSION['uid']);
61 DI::baseUrl()->redirect();
66 function removeme_content(App $a)
69 DI::baseUrl()->redirect();
72 $hash = Strings::getRandomHex();
74 require_once("mod/settings.php");
77 $_SESSION['remove_account_verify'] = $hash;
79 $tpl = Renderer::getMarkupTemplate('removeme.tpl');
80 $o = Renderer::replaceMacros($tpl, [
81 '$basedir' => DI::baseUrl()->get(),
83 '$title' => DI::l10n()->t('Remove My Account'),
84 '$desc' => DI::l10n()->t('This will completely remove your account. Once this has been done it is not recoverable.'),
85 '$passwd' => DI::l10n()->t('Please enter your password for verification:'),
86 '$submit' => DI::l10n()->t('Remove My Account')