function manage_content(&$a) { if (!local_user()) { notice(t('Permission denied.') . EOL); return; } if ($_GET['identity']) { $_POST['identity'] = $_GET['identity']; manage_post($a); return; } $identities = $a->identities; //getting additinal information for each identity foreach ($identities as $key => $id) { $thumb = q("SELECT `thumb` FROM `contact` WHERE `uid` = '%s' AND `self` = 1", dbesc($id['uid'])); $identities[$key][thumb] = $thumb[0][thumb]; $identities[$key]['selected'] = $id['nickname'] === $a->user['nickname'] ? true : false; $notifications = 0; $r = q("SELECT DISTINCT(`parent`) FROM `notify` WHERE `uid` = %d AND NOT `seen` AND NOT (`type` IN (%d, %d))", intval($id['uid']), intval(NOTIFY_INTRO), intval(NOTIFY_MAIL)); if ($r) { $notifications = sizeof($r); } $r = q("SELECT DISTINCT(`convid`) FROM `mail` WHERE `uid` = %d AND NOT `seen`", intval($id['uid'])); if ($r) { $notifications = $notifications + sizeof($r); } $r = q("SELECT COUNT(*) AS `introductions` FROM `intro` WHERE NOT `blocked` AND NOT `ignore` AND `uid` = %d", intval($id['uid'])); if ($r) { $notifications = $notifications + $r[0]["introductions"]; } $identities[$key]['notifications'] = $notifications; } $o = replace_macros(get_markup_template('manage.tpl'), array('$title' => t('Manage Identities and/or Pages'), '$desc' => t('Toggle between different identities or community/group pages which share your account details or which you have been granted "manage" permissions'), '$choose' => t('Select an identity to manage: '), '$identities' => $identities, '$submit' => t('Submit'))); return $o; }
$PAGE[PAGE_INTITLE] = ADMIN_TER_PROC_ADD; $PAGE[TXT_TITLE] = ADMIN_TER_PROC_ADD; $response[title] = ADMIN_TER_PROC_ADD_DONE; $response[text] = ADMIN_TER_PROC_ADD_DONE_TXT . "<br><br>" . make_button("ter_proc_view.php", ADMIN_TER_PROC_BACK_LIST); $thisform[Fields][send][content] = "submit||" . ADMIN_TER_PROC_ADD . "||"; } if ($_POST[form_id] == $thisform["name"]) { if (isset($_POST[form_page])) { $page = $_POST[form_page]; } else { $page = 1; } $error = check_form($thisform, $_POST, $page); //echo $error; if ($error == 1) { $manage = manage_post($thisform, $error, $_POST, $_GET[id]); } else { print draw_form($thisform, $module, $error, $_POST, $page); } if ($manage == 1) { //echo $thisform["name"];echo $manage; $page = $_POST[form_page] + 1; print draw_form($thisform, $module, $error, $_POST, $page); } elseif ($manage > 1) { print draw_response($response); } } else { print draw_form($thisform, $module, "", $result); } $PAGE[PAGE_CONTENT] = ob_get_contents(); ob_end_clean();