]> git.mxchange.org Git - friendica.git/blob - mod/removeme.php
Merge pull request #2172 from tobiasd/20151212-frosticons
[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 function removeme_content(&$a) {
31
32         if(! local_user())
33                 goaway(z_root());
34
35         $hash = random_string();
36
37         require_once("mod/settings.php");
38         settings_init($a);
39
40         $_SESSION['remove_account_verify'] = $hash;
41
42         $tpl = get_markup_template('removeme.tpl');
43         $o .= replace_macros($tpl, array(
44                 '$basedir' => $a->get_baseurl(),
45                 '$hash' => $hash,
46                 '$title' => t('Remove My Account'),
47                 '$desc' => t('This will completely remove your account. Once this has been done it is not recoverable.'),
48                 '$passwd' => t('Please enter your password for verification:'),
49                 '$submit' => t('Remove My Account')
50         ));
51
52         return $o;
53
54 }