3 require_once("include/text.php");
5 if(! function_exists('manage_post')) {
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'] );
92 if(! function_exists('manage_content')) {
93 function manage_content(&$a) {
96 notice( t('Permission denied.') . EOL);
100 if ($_GET['identity']) {
101 $_POST['identity'] = $_GET['identity'];
106 $identities = $a->identities;
108 //getting additinal information for each identity
109 foreach ($identities as $key=>$id) {
110 $thumb = q("SELECT `thumb` FROM `contact` WHERE `uid` = '%s' AND `self` = 1",
114 $identities[$key][thumb] = $thumb[0][thumb];
116 $identities[$key]['selected'] = (($id['nickname'] === $a->user['nickname']) ? true : false);
120 $r = q("SELECT DISTINCT(`parent`) FROM `notify` WHERE `uid` = %d AND NOT `seen` AND NOT (`type` IN (%d, %d))",
121 intval($id['uid']), intval(NOTIFY_INTRO), intval(NOTIFY_MAIL));
123 $notifications = sizeof($r);
125 $r = q("SELECT DISTINCT(`convid`) FROM `mail` WHERE `uid` = %d AND NOT `seen`",
128 $notifications = $notifications + sizeof($r);
130 $r = q("SELECT COUNT(*) AS `introductions` FROM `intro` WHERE NOT `blocked` AND NOT `ignore` AND `uid` = %d",
133 $notifications = $notifications + $r[0]["introductions"];
135 $identities[$key]['notifications'] = $notifications;
138 $o = replace_macros(get_markup_template('manage.tpl'), array(
139 '$title' => t('Manage Identities and/or Pages'),
140 '$desc' => t('Toggle between different identities or community/group pages which share your account details or which you have been granted "manage" permissions'),
141 '$choose' => t('Select an identity to manage: '),
142 '$identities' => $identities,
143 '$submit' => t('Submit'),