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