]> git.mxchange.org Git - friendica.git/blob - mod/removeme.php
Merge pull request #3149 from annando/1601-new-diaspora-mention
[friendica.git] / mod / removeme.php
1 <?php
2
3 function removeme_post(App $a) {
4
5         if (! local_user()) {
6                 return;
7         }
8
9         if (x($_SESSION,'submanage') && intval($_SESSION['submanage'])) {
10                 return;
11         }
12
13         if ((! x($_POST,'qxz_password')) || (! strlen(trim($_POST['qxz_password'])))) {
14                 return;
15         }
16
17         if ((! x($_POST,'verify')) || (! strlen(trim($_POST['verify'])))) {
18                 return;
19         }
20
21         if ($_POST['verify'] !== $_SESSION['remove_account_verify']) {
22                 return;
23         }
24
25         $encrypted = hash('whirlpool',trim($_POST['qxz_password']));
26
27         if ((strlen($a->user['password'])) && ($encrypted === $a->user['password'])) {
28                 require_once('include/Contact.php');
29                 user_remove($a->user['uid']);
30                 // NOTREACHED
31         }
32
33 }
34
35 function removeme_content(App $a) {
36
37         if (! local_user()) {
38                 goaway(z_root());
39         }
40
41         $hash = random_string();
42
43         require_once("mod/settings.php");
44         settings_init($a);
45
46         $_SESSION['remove_account_verify'] = $hash;
47
48         $tpl = get_markup_template('removeme.tpl');
49         $o .= replace_macros($tpl, array(
50                 '$basedir' => App::get_baseurl(),
51                 '$hash' => $hash,
52                 '$title' => t('Remove My Account'),
53                 '$desc' => t('This will completely remove your account. Once this has been done it is not recoverable.'),
54                 '$passwd' => t('Please enter your password for verification:'),
55                 '$submit' => t('Remove My Account')
56         ));
57
58         return $o;
59
60 }