4 function manage_post(&$a) {
10 $orig_record = $a->user;
12 if((x($_SESSION,'submanage')) && intval($_SESSION['submanage'])) {
13 $r = q("select * from user where uid = %d limit 1",
14 intval($_SESSION['submanage'])
17 $uid = intval($r[0]['uid']);
22 $r = q("select * from manage where uid = %d",
28 $identity = ((x($_POST['identity'])) ? intval($_POST['identity']) : 0);
35 if(count($submanage)) {
36 foreach($submanage as $m) {
37 if($identity == $m['mid']) {
38 $limited_id = $m['mid'];
45 $r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
50 $r = q("SELECT * FROM `user` WHERE `uid` = %d AND `email` = '%s' AND `password` = '%s' LIMIT 1",
52 dbesc($orig_record['email']),
53 dbesc($orig_record['password'])
60 unset($_SESSION['authenticated']);
61 unset($_SESSION['uid']);
62 unset($_SESSION['visitor_id']);
63 unset($_SESSION['administrator']);
64 unset($_SESSION['cid']);
65 unset($_SESSION['theme']);
66 unset($_SESSION['mobile-theme']);
67 unset($_SESSION['page_flags']);
68 unset($_SESSION['return_url']);
69 if(x($_SESSION,'submanage'))
70 unset($_SESSION['submanage']);
72 require_once('include/security.php');
73 authenticate_success($r[0],true,true);
76 $_SESSION['submanage'] = $original_id;
78 goaway($a->get_baseurl(true) . '/profile/' . $a->user['nickname']);
84 function manage_content(&$a) {
87 notice( t('Permission denied.') . EOL);
91 $o = '<h3>' . t('Manage Identities and/or Pages') . '</h3>';
94 $o .= '<div id="identity-manage-desc">' . t('Toggle between different identities or community/group pages which share your account details or which you have been granted "manage" permissions') . '</div>';
96 $o .= '<div id="identity-manage-choose">' . t('Select an identity to manage: ') . '</div>';
98 $o .= '<div id="identity-selector-wrapper">' . "\r\n";
99 $o .= '<form action="manage" method="post" >' . "\r\n";
100 $o .= '<select name="identity" size="4" onchange="this.form.submit();" >' . "\r\n";
102 foreach($a->identities as $rr) {
103 $selected = (($rr['nickname'] === $a->user['nickname']) ? ' selected="selected" ' : '');
104 $o .= '<option ' . $selected . 'value="' . $rr['uid'] . '">' . $rr['username'] . ' (' . $rr['nickname'] . ')</option>' . "\r\n";
107 $o .= '</select>' . "\r\n";
108 $o .= '<div id="identity-select-break"></div>' . "\r\n";
110 // $o .= '<input id="identity-submit" type="submit" name="submit" value="' . t('Submit') . '" />';
111 $o .= '</div></form>' . "\r\n";