3 require_once("include/text.php");
6 function manage_post(&$a) {
12 $orig_record = $a->user;
14 if((x($_SESSION,'submanage')) && intval($_SESSION['submanage'])) {
15 $r = q("select * from user where uid = %d limit 1",
16 intval($_SESSION['submanage'])
19 $uid = intval($r[0]['uid']);
24 $r = q("select * from manage where uid = %d",
30 $identity = ((x($_POST['identity'])) ? intval($_POST['identity']) : 0);
37 if(count($submanage)) {
38 foreach($submanage as $m) {
39 if($identity == $m['mid']) {
40 $limited_id = $m['mid'];
47 $r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
52 $r = q("SELECT * FROM `user` WHERE `uid` = %d AND `email` = '%s' AND `password` = '%s' LIMIT 1",
54 dbesc($orig_record['email']),
55 dbesc($orig_record['password'])
62 unset($_SESSION['authenticated']);
63 unset($_SESSION['uid']);
64 unset($_SESSION['visitor_id']);
65 unset($_SESSION['administrator']);
66 unset($_SESSION['cid']);
67 unset($_SESSION['theme']);
68 unset($_SESSION['mobile-theme']);
69 unset($_SESSION['page_flags']);
70 unset($_SESSION['return_url']);
71 if(x($_SESSION,'submanage'))
72 unset($_SESSION['submanage']);
73 if(x($_SESSION,'sysmsg'))
74 unset($_SESSION['sysmsg']);
75 if(x($_SESSION,'sysmsg_info'))
76 unset($_SESSION['sysmsg_info']);
78 require_once('include/security.php');
79 authenticate_success($r[0],true,true);
82 $_SESSION['submanage'] = $original_id;
85 call_hooks('home_init',$ret);
87 goaway( $a->get_baseurl() . "/profile/" . $a->user['nickname'] );
93 function manage_content(&$a) {
96 notice( t('Permission denied.') . EOL);
100 $identities = $a->identities;
101 foreach($identities as $key=>$id) {
102 $identities[$key]['selected'] = (($id['nickname'] === $a->user['nickname']) ? ' selected="selected" ' : '');
105 $o = replace_macros(get_markup_template('manage.tpl'), array(
106 '$title' => t('Manage Identities and/or Pages'),
107 '$desc' => t('Toggle between different identities or community/group pages which share your account details or which you have been granted "manage" permissions'),
108 '$choose' => t('Select an identity to manage: '),
109 '$identities' => $identities,
110 '$submit' => t('Submit'),