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