]> git.mxchange.org Git - friendica.git/blob - mod/manage.php
add remove_user hook (it looks like dreamhost changed all my file permissions, this...
[friendica.git] / mod / manage.php
1 <?php
2
3
4 function manage_post(&$a) {
5
6         if(! local_user() || ! is_array($a->identities))
7                 return;
8
9         $identity = ((x($_POST['identity'])) ? intval($_POST['identity']) : 0);
10         if(! $identity)
11                 return;
12
13         $r = q("SELECT * FROM `user` WHERE `uid` = %d AND `email` = '%s' AND `password` = '%s' LIMIT 1",
14                 intval($identity),
15                 dbesc($a->user['email']),
16                 dbesc($a->user['password'])
17         );
18
19         if(! count($r))
20                 return;
21
22         unset($_SESSION['authenticated']);
23         unset($_SESSION['uid']);
24         unset($_SESSION['visitor_id']);
25         unset($_SESSION['administrator']);
26         unset($_SESSION['cid']);
27         unset($_SESSION['theme']);
28         unset($_SESSION['page_flags']);
29         unset($_SESSION['return_url']);
30
31
32         require_once('include/security.php');
33         authenticate_success($r[0],true,true);
34
35         goaway($a->get_baseurl() . '/profile/' . $a->user['nickname']);
36         // NOTREACHED
37 }
38
39
40
41 function manage_content(&$a) {
42
43         if(! local_user() || ! is_array($a->identities)) {
44                 notice( t('Permission denied.') . EOL);
45                 return;
46         }
47
48         $r = q("SELECT * FROM `user` WHERE `email` = '%s' AND `password` = '%s'",
49                 dbesc($a->user['email']),
50                 dbesc($a->user['password'])
51         );
52         if(! count($r))
53                 return;
54
55
56         $o = '<h3>' . t('Manage Identities and/or Pages') . '</h3>';
57
58         
59         $o .= '<div id="identity-manage-desc">' . t("\x28Toggle between different identities or community/group pages which share your account details.\x29") . '</div>';
60
61         $o .= '<div id="identity-manage-choose">' . t('Select an identity to manage: ') . '</div>';
62
63         $o .= '<div id="identity-selector-wrapper">' . "\r\n";
64         $o .= '<form action="manage" method="post" >' . "\r\n";
65         $o .= '<select name="identity" size="4">' . "\r\n";
66
67         foreach($r as $rr) {
68                 $selected = (($rr['nickname'] === $a->user['nickname']) ? ' selected="selected" ' : '');
69                 $o .= '<option ' . $selected . 'value="' . $rr['uid'] . '">' . $rr['username'] . ' (' . $rr['nickname'] . ')</option>' . "\r\n";
70         }
71
72         $o .= '</select>' . "\r\n";
73         $o .= '<div id="identity-select-break"></div>' . "\r\n";
74
75         $o .= '<input id="identity-submit" type="submit" name="submit" value="' . t('Submit') . '" /></div></form>' . "\r\n";
76
77         return $o;
78
79 }