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