public function get_links() { $this->Paging["count"] = Group::get_user_groups((int) $this->uid, TRUE); if ($this->block_type == 'usergroups') { $pub = 'public'; $usergroups = Group::get_user_groups((int) $this->uid, FALSE, 5, 1, 'created', 'DESC', $pub); } else { $usergroups = Group::get_user_groups((int) $this->uid, FALSE, 5, 1); } global $base_url, $current_theme_path; $ids = array(); if ($usergroups) { foreach ($usergroups as $groups) { $ids[] = array('gid' => $groups['gid'], 'access' => $groups['access']); } } $group_details = array(); for ($gr = 0; $gr < count($ids); $gr++) { $group = ContentCollection::load_collection((int) $ids[$gr]['gid'], $_SESSION['user']['id']); $group_tags = Tag::load_tags_for_content_collection($ids[$gr]['gid']); $member_exist = Group::member_exists($ids[$gr]['gid'], $_SESSION['user']['id']); $picture = $group->picture; $cnt = Group::get_member_count($group->collection_id); $group_details[$gr]['id'] = $group->collection_id; $group_details[$gr]['title'] = stripslashes($group->title); $desc = stripslashes($group->description); $desc = substr($desc, 0, 100); $group_details[$gr]['desc'] = $desc; $group_details[$gr]['picture'] = $picture; $group_details[$gr]['members'] = $cnt; $group_details[$gr]['access'] = $ids[$gr]['access']; } $links = $group_details; return $links; }
public function get_links() { $this->Paging["count"] = Group::get_user_groups((int) $this->uid, TRUE); $ids = array(); if ($this->usergroups) { foreach ($this->usergroups as $groups) { $ids[] = array('gid' => $groups['gid'], 'access' => $groups['access']); } } $group_details = array(); for ($gr = 0; $gr < count($ids); $gr++) { $group = ContentCollection::load_collection((int) $ids[$gr]['gid'], PA::$login_uid); $group_tags = Tag::load_tags_for_content_collection($ids[$gr]['gid']); $member_exist = Group::member_exists($ids[$gr]['gid'], PA::$login_uid); $picture = $group->picture; $cnt = Group::get_member_count($group->collection_id); $group_details[$gr]['id'] = $group->collection_id; $group_details[$gr]['title'] = stripslashes($group->title); $desc = stripslashes($group->description); $desc = substr($desc, 0, 100); $group_details[$gr]['desc'] = $desc; $group_details[$gr]['picture'] = $picture; $group_details[$gr]['members'] = $cnt; $group_details[$gr]['access'] = $ids[$gr]['access']; } return $group_details; }
function render() { $groups = Group::get_user_groups($_SESSION['user']['id'], FALSE, 'ALL'); for ($i = 0; $i < count($groups); $i++) { $this->user_groups[] = array('gid' => $groups[$i]['gid'], 'name' => stripslashes($groups[$i]['name'])); } $this->inner_HTML = $this->generate_inner_html(); $content = parent::render(); return $content; }
public function initializeModule($request_method, $request_data) { if (empty(PA::$login_uid)) { return 'skip'; } else { if ($this->page_id == PAGE_GROUP_INVITE) { $groups = Group::get_user_groups(PA::$login_uid, FALSE, 'ALL'); $user_groups = array(); $groups_count = count($groups); for ($i = 0; $i < $groups_count; $i++) { $user_groups[] = $groups[$i]['gid']; } $user_groups = array(); if (!empty($request_data['gid'])) { $this->collection_id_array = array($request_data['gid']); } else { if (!empty($user_groups)) { $this->collection_id_array = array(current($user_groups)); } } } } }
function setup_module($column, $module, $obj) { global $login_uid, $entered_people; switch ($column) { case 'middle': $obj->mode = PUB; $obj->uid = $login_uid; $obj->block_type = 'media_management'; if ($module == 'InvitationStatusModule') { $groups = Group::get_user_groups($login_uid, FALSE, 'ALL'); $user_groups = array(); for ($i = 0; $i < count($groups); $i++) { $user_groups[] = $groups[$i]['gid']; } if (!empty($_REQUEST['gid'])) { $obj->collection_id_array = array($_REQUEST['gid']); } else { $obj->collection_id_array = array($user_groups[0]); } } break; } }
function render_groups() { $page = 1; $group_state =& $this->state['groups']; $showing = $this->make_showing_link($group_state, "groups", ""); $facewall = ""; foreach (Group::get_user_groups($this->user->user_id, FALSE, $this->friends_per_page, $page) as $grp) { $facewall .= '<div id="group_'.$grp['gid'].'">'.$this->render_group_image($grp).'</div>'; } return <<<ENS <p>$showing</p> <div> $facewall <div style="clear: both"></div> </div> ENS; }
/** Purpose : this function is used to get navigation links for the whole page. Scope : public @param - it needs no direct input. But works only on the basis of current page initialized in __construct() @return - array of links **/ public function get_links($optional = NULL) { //initialization global $page_uid, $login_uid; if (isset($_SESSION['user']['id'])) { $extra = unserialize($this->network_info->extra); if (@$extra['reciprocated_relationship'] == NET_YES) { $status = APPROVED; } else { $status = FALSE; } $relations_ids = Relation::get_relations((int) $_SESSION['user']['id'], $status); $user_groups = Group::get_user_groups((int) $_SESSION['user']['id']); /* $gid isn't defined in this function, so the following call * will probably always return FALSE. To get rid of the warning * under E_ALL, I've replaced the following expression with * FALSE. Maybe $gid should be get_group_id()? */ $is_owner_of_group = FALSE; //Group::is_admin($gid,(int)$_SESSION['user']['id']) ; } if (isset($relations_ids) && sizeof($relations_ids)) { $this->set_friend_uid($relations_ids[0]); } if (isset($user_groups) && sizeof($user_groups)) { $this->users_first_group_id($user_groups[0]['gid']); } if ($login_uid) { $this->set_uid($login_uid); } else { $this->set_anonymous(); } $is_group_content = FALSE; if (@$_GET['gid']) { $this->set_group_id($_GET['gid']); } else { if ((FILE_FORUM_MESSAGES == $this->current_page || FILE_CONTENT == $this->current_page) && !empty($_REQUEST['ccid'])) { $this->set_group_id($_REQUEST['ccid']); $is_group_content = TRUE; } else { if (FILE_CONTENT == $this->current_page && !empty($_GET['cid'])) { try { $content_data = Content::load_content($_GET['cid'], $this->get_uid()); } catch (PAException $e) { if ($e->getCode() != CONTENT_NOT_FOUND) { throw $e; } } if (isset($content_data)) { if ($content_data->parent_collection_id > 0) { $content_collection_data = ContentCollection::load_collection($content_data->parent_collection_id, $this->get_uid()); if ($content_collection_data->type == GROUP_COLLECTION_TYPE) { $this->set_group_id($content_data->parent_collection_id); $is_group_content = TRUE; } } } } } } //test //$this->current_page='test.php'; // make links for current page $this->make_links(); $level_1 = $this->get_level_1(); $level_2 = $this->get_level_2(); $level_3 = NULL; $left_user_public_links = NULL; if (Network::is_admin($this->network_info->network_id, (int) @$_SESSION['user']['id'])) { $level_3 = $this->get_level_3('network'); } else { if (!$this->network_info && $_SESSION['user']['id'] == SUPERUSER) { $level_3 = $this->get_level_3('network'); } } $level_3 = NULL; switch ($this->current_page) { /*----------------------------------------------------*/ case FILE_HOMEPAGE: $level_3 = NULL; $level_2['highlight'] = 'home'; break; case FILE_LOGIN: $level_2['highlight'] = 'home'; break; case FILE_SEARCH_HOME: $level_2['highlight'] = 'search'; break; case FILE_TAG_SEARCH: $level_2['highlight'] = 'tag_search'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_USER: case FILE_USER_BLOG: if (!$page_uid && !$login_uid) { throw new PAException("", "Invalid page access"); } if ($page_uid) { //uid get variable set //these links are to be added in front $relation_already_exists_links = array('send_message' => array('caption' => 'Send a message', 'url' => $this->base_url . '/' . FILE_ADDMESSAGE . '?uid=' . $page_uid), 'change_relationship' => array('caption' => 'Change Relationship', 'url' => $this->base_url . '/' . FILE_EDIT_RELATIONS . '?uid=' . $page_uid . '&action=change'), 'delete_relationship' => array('caption' => 'Delete Relationship', 'url' => $this->base_url . '/' . FILE_EDIT_RELATIONS . '?action=delete&uid=' . $page_uid . '', 'extra' => ' onclick ="return delete_confirmation_msg(\'Are you sure you want to delete this Relationship?\') "'), 'send_testimonial' => array('caption' => 'Write Testimonial', 'url' => $this->base_url . '/' . FILE_WRITE_TESTIMONIAL . '?uid=' . $page_uid), 'user_comment' => array('caption' => 'Write Comment', 'url' => $this->base_url . '/' . FILE_WRITE_USER_COMMENT . '?uid=' . $page_uid)); $relation_does_not_exists_links = array('send_message' => array('caption' => 'Send a message', 'url' => $this->base_url . '/' . FILE_ADDMESSAGE . '?uid=' . $page_uid), 'make_connection' => array('caption' => 'Add a Relationship', 'url' => $this->base_url . '/' . FILE_EDIT_RELATIONS . '?uid=' . $page_uid . '&action=add'), 'send_testimonial' => array('caption' => 'Write Testimonial', 'url' => $this->base_url . '/' . FILE_WRITE_TESTIMONIAL . '?uid=' . $page_uid), 'user_comment' => array('caption' => 'Write Comment', 'url' => $this->base_url . '/' . FILE_WRITE_USER_COMMENT . '?uid=' . $page_uid)); if ($page_uid == $login_uid) { //login and get uid same means user's public page $level_2['highlight'] = 'user'; $level_3 = $this->get_level_3('user'); } else { // make left and right links //user's public page requires different link rendering if (!empty($relations_ids)) { if (in_array($page_uid, $relations_ids)) { $left_user_public_links = $relation_already_exists_links; } else { $left_user_public_links = $relation_does_not_exists_links; } } else { $left_user_public_links = $relation_does_not_exists_links; } } } else { //means user's private page $level_2['highlight'] = 'user'; $level_3 = $this->get_level_3('user'); $level_3['highlight'] = 'user_private'; } break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_PEOPLES: $level_2['highlight'] = 'people'; $level_3 = $this->get_level_3('people'); $level_3['highlight'] = 'find_people'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_VIEW_ALL_MEMBERS: if (@$_GET['gid']) { $level_2['highlight'] = 'groups'; $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific')); $level_3['highlight'] = 'group_members'; } else { $level_2['highlight'] = 'people'; if ($page_uid == $login_uid) { $level_3 = $this->get_level_3('people'); if (!empty($_GET['view_type']) && $_GET['view_type'] == 'relations') { $level_3['highlight'] = 'my_friends'; } else { if (!empty($_GET['view_type']) && $_GET['view_type'] == 'in_relations') { $level_3['highlight'] = 'people_who_call_me_friend'; } else { $level_3['highlight'] = 'find_people'; } } } } break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_INVITATION: $level_2['highlight'] = 'people'; $level_3 = $this->get_level_3('people'); $level_3['highlight'] = 'invite'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_UPLOAD_MEDIA: case FILE_MEDIA_GALLERY: if ($login_uid) { if (isset($_GET['view']) && 'friends' == $_GET['view']) { //user is viewing his friends gallery $level_2['highlight'] = 'people'; $level_3 = $this->get_level_3('people'); $level_3['highlight'] = 'friends_gallery'; } else { if ($page_uid != $login_uid && $page_uid != '') { //user is viewing his private page gallery $level_2['highlight'] = 'people'; } else { if ($page_uid == $login_uid || !$page_uid) { $level_2['highlight'] = 'user'; $level_3 = $this->get_level_3('user'); $level_3['highlight'] = 'my_gallery'; } } } } else { if (!empty($page_uid)) { // for anonymous user $level_2['highlight'] = 'people'; } } break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_CUSTOMIZE_UI: $level_2['highlight'] = 'user'; $level_3 = $this->get_level_3('user'); $level_3['highlight'] = 'customize_ui'; break; case FILE_USER_CALENDAR: $level_2['highlight'] = 'user'; $level_3 = $this->get_level_3('user'); $level_3['highlight'] = 'my_events'; break; case FILE_EDIT_PROFILE: $level_2['highlight'] = 'user'; $level_3 = $this->get_level_3('user'); $level_3['highlight'] = 'settings'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_EDIT_RELATIONS: $level_2['highlight'] = 'people'; $level_3 = $this->get_level_3('people'); $level_3['highlight'] = 'find_people'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_GROUPS_HOME: $level_2['highlight'] = 'groups'; $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'groups_general')); $level_3['highlight'] = 'find_groups'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_GROUPS_CATEGORY: $level_2['highlight'] = 'groups'; $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'groups_general')); $level_3['highlight'] = 'find_groups'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_ADDGROUP: $level_2['highlight'] = 'groups'; if (!empty($_GET['gid'])) { $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific')); $level_3['highlight'] = 'edit_group'; } else { $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'groups_general')); $level_3['highlight'] = 'create_group'; } break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_GROUP: $level_2['highlight'] = 'groups'; $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific')); $level_3['highlight'] = 'group_home'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_FORUM_MESSAGES: case FILE_FORUM_HOME: case FILE_CREATE_FORUM: $level_2['highlight'] = 'groups'; $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific')); $level_3['highlight'] = 'group_forum'; break; case FILE_GROUP_CALENDAR: $level_2['highlight'] = 'groups'; $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific')); $level_3['highlight'] = 'group_events'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_GROUP_INVITATION: $level_2['highlight'] = 'groups'; $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'groups_general')); $level_3['highlight'] = 'invite'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_GROUP_MEDIA_GALLERY: $level_2['highlight'] = 'groups'; $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific')); $level_3['highlight'] = 'group_gallery'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_EDIT_FORUM: case FILE_FORUM_MESSAGES: $level_2['highlight'] = 'groups'; $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific')); break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_WIDGET: $level_2['highlight'] = 'user'; $level_3 = $this->get_level_3('user'); $level_3['highlight'] = 'user_widgets'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_MYMESSAGE: case FILE_ADDMESSAGE: case FILE_VIEW_MESSAGE: $level_2['highlight'] = 'user'; $level_3 = $this->get_level_3('user'); $level_3['highlight'] = 'messages'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_POST_CONTENT: $level_2['highlight'] = 'user'; $level_3 = $this->get_level_3('user'); $level_3['highlight'] = 'create_post'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_CONTENT_MANAGEMENT: $level_2['highlight'] = 'user'; $level_3 = $this->get_level_3('user'); $level_3['highlight'] = 'manage_posts'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_ADDGROUP: $level_2['highlight'] = 'group'; if ($_GET['gid']) { $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific')); $level_3['highlight'] = 'edit_group'; } else { $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'groups_general')); $level_3['highlight'] = 'create_group'; } break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_GROUP_MODERATION: $level_2['highlight'] = 'groups'; $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific')); if ('members' == $_GET['view']) { $level_3['highlight'] = 'moderate_users'; } if ('content' == $_GET['view']) { $level_3['highlight'] = 'moderate_posts'; } if ('users' == $_GET['view']) { $level_3['highlight'] = 'moderate_membership_requests'; } break; case FILE_MANAGE_GROUP_CONTENTS: $level_1['highlight'] = 'networks_directory'; $level_2['highlight'] = 'groups'; $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific')); $level_3['highlight'] = 'manage_group_content'; break; case FILE_CUSTOMIZE_GROUP: $level_1['highlight'] = 'networks_directory'; $level_2['highlight'] = 'groups'; $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific')); $level_3['highlight'] = 'group_customize_ui'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_NETWORKS_HOME: case FILE_NETWORKS_CATEGORY: $level_1['highlight'] = 'networks_directory'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_NETWORK_USER_DEFAULTS: case FILE_RELATIONSHIP_SETTINGS: case FILE_EMAIL_NOTIFICATION: case FILE_MANAGE_TAKETOUR: case FILE_MANAGE_EMBLEM: case FILE_CONFIGURE_SPLASH_PAGE: case FILE_NETWORK_FEATURE: case FILE_NETWORK_CUSTOMIZE_UI_PAGE: case FILE_NETWORK_STATS: case FILE_NETWORK_LINKS: case FILE_NEW_USER_BY_ADMIN: case FILE_NETWORK_MANAGE_CONTENT: case FILE_MODULE_SELECTOR: case FILE_NETWORK_BULLETINS: case FILE_NETWORK_MANAGE_USER: case FILE_NETWORK_CALENDAR: case FILE_MANAGE_AD_CENTER: case FILE_MANAGE_GROUP_FORUM: case FILE_MANAGE_COMMENTS: case FILE_RANKING: case FILE_MISREPORTS: case FILE_ROLES: case FILE_ASSIGN_TASK: $level_2 = $this->get_level_3('network'); // $level_3 = $this->get_level_3('manage_network'); $level_1['highlight'] = 'configure_network'; $level_2['highlight'] = 'configure_network'; /* $level_3['highlight'] = 'manage_user'*/ break; case FILE_CREATENETWORK: $level_1['highlight'] = 'create_network'; $level_3['highlight'] = 'statistics'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_SHOWCONTENT: if ($_GET['gid']) { $level_2['highlight'] = groups; $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'groups_general')); } break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_LINKS_MANAGEMENT: $level_2['highlight'] = 'user'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_MEDIA_FULL_VIEW: if (!empty($_GET['gid'])) { $level_2['highlight'] = groups; $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific')); } else { $level_2['highlight'] = 'user'; $level_3 = $this->get_level_3('user'); } break; case FILE_REGISTER: $level_2['highlight'] = 'home'; break; case FILE_EDIT_MEDIA: $level_2['highlight'] = 'user'; $level_3 = $this->get_level_3('user'); $level_3['highlight'] = 'my_gallery'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_EDITNETWORK: case FILE_CONTENT: if ($is_group_content == TRUE) { if ($this->get_uid()) { $is_group_content = FALSE; $level_2['highlight'] = 'groups'; $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific')); $level_3['highlight'] = 'group_home'; } else { $is_group_content = FALSE; $level_2['highlight'] = 'groups'; $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'groups_general')); $level_3['highlight'] = 'group_home'; } } elseif (!empty($_GET['cid'])) { try { $content_data = Content::load_content($_GET['cid'], $this->get_uid()); if ($content_data->parent_collection_id != -1 && $content_data->parent_collection_id != 0) { $content_collection_data = ContentCollection::load_collection($content_data->parent_collection_id, $this->get_uid()); if ($content_collection_data->type == GROUP_COLLECTION_TYPE) { $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific')); } } else { $level_3 = $this->get_level_3('user'); } } catch (PAException $e) { } } break; /*----------------------------------------------------*/ } //--end of switch $menu = array('level_1' => $level_1, 'level_2' => $level_2, 'level_3' => $level_3, 'left_user_public_links' => $left_user_public_links); return $menu; }
//for rivers of people $activity_extra['info'] = $login_name . ' uploaded a video in album id = ' . $upload['album_id']; $activity_extra['content_id'] = $upload[4]; $extra = serialize($activity_extra); $object = $upload['album_id']; Activities::save(PA::$login_uid, $activity, $object, $extra); $ret_url = PA::$url . PA_ROUTE_MEDIA_GALLEY_VIDEOS . "/uid=" . PA::$login_uid . "&msg_id={$msg_id}" . $album; header("Location: " . $ret_url); exit; break; } } $setting_data = array('middle' => array('UploadMediaModule')); if (!empty($_GET['gid']) && $_GET['gid']) { // here we calculating the groups of that User $group_ids = Group::get_user_groups(PA::$login_uid); $group_ids_array = array(); if (!empty($group_ids)) { for ($i = 0; $i < count($group_ids); $i++) { $group_ids_array[] = $group_ids[$i]['gid']; } } if (!in_array($_GET['gid'], $group_ids_array)) { header("Location: " . PA::$url . PA_ROUTE_GROUP . "/gid=" . $_GET['gid'] . '&msg_id=13003'); exit; } } /* This function is a Callback function which initialize the value for the BLOCK MODULES */ function setup_module($column, $moduleName, $obj) { /* in this module we have to set user_id , group_id, as well as netwrok_id */
/** !! * This is called by the template to organize the feed based on the page type and * the type of feed. * * @param array $request_data Information to determine which group page it is on */ private function handleAJAX_sort($request_data) { $types = array('network', 'group', 'user_friends', 'user_public'); filter_all_post($request_data); if (isset($request_data['sort_by'])) { $this->selected = $request_data['sort_by']; $this->page_type = $types[$this->selected]; switch ($this->page_type) { case 'user_public': $this->subject = PA::$login_uid; break; case 'group': if (empty($request_data['gid'])) { if (PA::$login_uid) { $user_groups = Group::get_user_groups((int) PA::$login_uid, FALSE, 1, 1, 'created', 'DESC', 'public'); if (count($user_groups) > 0) { // echo "<pre>" . print_r($user_groups, 1) . "</pre>"; $this->subject = $user_groups[0]['gid']; } else { print '<div style="margin:8px">No Feeds</div>'; exit; } } else { print '<div style="margin:8px">No Feeds</div>'; exit; } } else { $this->subject = $request_data['gid']; } break; default: //by default network activity will be shown on all the pages. } $this->inner_HTML = $this->generate_inner_html(); print $this->inner_HTML; } exit; }
public function render() { $groups = Group::get_user_groups(PA::$login_uid, FALSE, 'ALL'); $groups_count = count($groups); for ($i = 0; $i < $groups_count; $i++) { $this->user_groups[] = array('gid' => $groups[$i]['gid'], 'name' => stripslashes($groups[$i]['name'])); } //getting the relations of user. $relations = Relation::get_relations(PA::$login_uid, APPROVED, PA::$network_info->network_id); $friends = array(); if (count($relations)) { foreach ($relations as $relation) { $User = new User(); $relation = (int) $relation; $User->load($relation); //$friends[] = array('id'=>$relation, 'login_name'=>$User->login_name); $friends[$User->display_name] = $User->login_name; } //key of the array will the login_name and value will be the login_id //sorting the array on the basis of login_name ksort($friends); } $this->user_friends = $friends; $this->inner_HTML = $this->generate_inner_html(); $content = parent::render(); return $content; }
$selected_role = null; $sel_role_id = !empty($_REQUEST['role_id']) ? $_REQUEST['role_id'] : null; $group_id = !empty($_REQUEST['gid']) && $_REQUEST['gid'] != '-1' ? $_REQUEST['gid'] : null; $user_id = (int) $_REQUEST['uid']; $roles_list = array(); $user_roles = array(); $user = new User(); $user->load($user_id); $role = new Roles(); $params = $group_id ? array('condition' => 'type = \'group\'', 'cnt' => false) : array('condition' => 'type <> \'null\'', 'cnt' => false); $all_roles = $role->get_multiple($params, DB_FETCHMODE_ASSOC); foreach ($all_roles as $a_role) { $roles_list[$a_role['id']] = $a_role['name']; } $user_groups = array(); $u_groups = Group::get_user_groups($user_id); if (count($u_groups) < 1) { $u_groups = Group::get_all_groups_for_admin(FALSE); foreach ($u_groups as $group) { $user_groups[$group['group_id']] = $group['title']; } } else { foreach ($u_groups as $group) { $user_groups[$group['gid']] = $group['name']; } } if ($group_id) { // show only Group roles $u_roles = Roles::get_user_roles($user_id, DB_FETCHMODE_ASSOC, array('type' => 'group', 'gid' => $group_id)); } else { // show network and user personal pages roles
//$contents[$i]['create_time'] = content_date($contents[$i]['changed']); $contents[$i]['trackback_url'] = "{$base_url}/pa_trackback.php?cid=" . $contents[$i]['content_id']; $tags = Tag::load_tags_for_content($contents[$i]['content_id']); if ($tags) { $t = array(); for ($j = 0; $j < count($tags); $j++) { $t_name = $tags[$j]['name']; $uid = $_SESSION['user']['id']; $t[] = "<a href=\"content_all.php?uid={$uid}&tag={$t_name}\">" . $tags[$j]['name'] . "</a>"; } $contents[$i]['tag_entry'] = "<b>Tags : </b>" . implode(", ", $t); } else { $contents[$i]['tag_entry'] = ""; } } $allgroups = Group::get_user_groups((int) $_SESSION['user']['id']); $heading = "My Recent Groups"; if (!$allgroups) { $error_msg = "Not a member of any group yet."; } if ($allgroups) { foreach ($allgroups as $groups) { $gids[] = $groups['gid']; } } $group_details = array(); for ($gr = 0; $gr < count($gids); $gr++) { $group = ContentCollection::load_collection($gids[$gr], $_SESSION['user']['id']); $group_tags = Tag::load_tags_for_content_collection($gids[$gr]); $member_exist = Group::member_exists($gids[$gr], $_SESSION['user']['id']); if ($group_tags) {
/** * function used to delete a group or groups. * @param $user_id and $group_id */ public function delete_user_groups($user_id, $group_id = NULL) { //getting user groups $group_users = Group::get_user_groups($user_id); if (count($group_users) > 0) { foreach ($group_users as $group) { $this->collection_id = $group['gid']; if ($group['access'] == OWNER) { //delete all data related to that group //deleting content posted by other users in that group $this->delete(); } else { if ($group['access'] == MEMBER) { $MessageBoard = new MessageBoard(); $MessageBoard->user_id = $user_id; $MessageBoard->delete_user_forums(); //voiding user membership $this->leave($user_id); } } } } }
} else { $uid = $_GET['uid']; } $user = new User(); if ($_SESSION['user']['id']) { $user_details = $user->load((int) $uid); } if ($user->picture) { $img_path = $base_url . "/files/" . $user->picture; } else { $img_path = $base_url . "/images/default.jpg"; } $output = ''; if ($_GET['uid']) { //get user's groups $usergroups = Group::get_user_groups((int) $_GET['uid']); $u = new User(); $u->load((int) $_GET['uid']); $heading = "{$u->first_name}'s Group(s)"; if ($usergroups) { foreach ($usergroups as $groups) { $ids[] = $groups['gid']; } } else { $error_msg = "You are not a member of any group yet."; } } elseif ($_GET['tag']) { $heading = 'Search Result'; $collection = Tag::get_associated_contentcollectionids($_GET['tag'], 1); if ($collection) { foreach ($collection as $groups) {
$html .= "</td>"; } $html .= "</tr>"; } $show_all_url = "{$base_url}/view_all_members.php?view_type=relations&uid={$user->user_id}"; $html .= "<tr>"; for ($i = 0; $i < $cols - 1; ++$i) { $html .= '<td style="background-color: white"></td>'; } $html .= "<td><a target=\"_blank\" href=\"{$show_all_url}\">show all</a></td></tr>"; $html .= "</table>"; break; case 'groups': $perpage = (int) $param; $html .= "<ul>"; $groups = Group::get_user_groups($user->user_id, FALSE, $param, $page); foreach ($groups as $g) { $html .= '<li><a target="_blank" href="' . $base_url . '/group.php?gid=' . $g['gid'] . '">' . htmlspecialchars($g['name']) . '</a></li>'; } $html .= "</ul>"; break; } } $html .= '<p><a target="_blank" href="' . $base_url . '/"><img border="0" src="' . $base_url . '/images/pa-on-white.png" width="141" height="27" /></a></p>'; $html .= "</div>"; } else { $html = "Error parsing URL ({$path})."; } function js_quote($html) { return "'" . str_replace("\n", "\\n", str_replace("'", "\\'", $html)) . "'";
function get_user_groups() { $groups = Group::get_user_groups($_SESSION['user']['id'], FALSE, 'ALL'); for ($i = 0; $i < count($groups); $i++) { if ($groups[$i]['access'] == 'owner') { $this->user_groups[] = array('gid' => $groups[$i]['gid'], 'name' => stripslashes($groups[$i]['name'])); } } return $groups; }
function peopleaggregator_getAlbums($args) { if (!empty($args['authToken'])) { $user = User::from_auth_token($args['authToken']); $display_user_id = $auth_user_id = $user->user_id; } else { $user = $display_user_id = $auth_user_id = NULL; } $context = $args['context']; $show_personal = $show_group = FALSE; if (preg_match("/^user:(\\d+)\$/", $context, $m)) { $show_personal = TRUE; $display_user_id = (int) $m[1]; } else { if (empty($user)) { throw new PAException(OPERATION_NOT_PERMITTED, "'user', 'group' and 'all' contexts are not allowed for anonymous users"); } switch ($context) { case 'user': $show_personal = TRUE; break; case 'group': $show_group = TRUE; break; case 'all': $show_personal = $show_group = TRUE; break; default: throw new PAException(INVALID_ID, "context argument must be 'all', 'user' or 'group'"); } } $albums_out = array(); if ($show_personal) { $types_seen = array(); // get personal albums $albums = Album::load_all($display_user_id); foreach ($albums as $album) { $types_seen[(int) $album['album_type_id']] = TRUE; $albums_out[] = array('id' => "user:{$display_user_id}:album:" . $album['collection_id'], 'title' => $album['description'], 'access' => $display_user_id == $auth_user_id ? "write" : "read", 'created' => $album['created'], 'type' => array(API::$album_type_from_id[(int) $album['album_type_id']])); } if ($display_user_id == $auth_user_id) { // We don't reliably create personal albums on user creation, so add them in here if necessary... foreach (array(IMAGE_ALBUM, AUDIO_ALBUM, VIDEO_ALBUM) as $alb_type) { if (!isset($types_seen[$alb_type])) { // insert default album for this type $albums_out[] = array('id' => "user:{$user->user_id}:album:default:" . API::$album_type_from_id[$alb_type], 'title' => PA::$config->default_album_titles[$alb_type], 'access' => "write", 'type' => array(API::$album_type_from_id[$alb_type])); } } } } if ($show_group) { // get group albums $groups = Group::get_user_groups($user->user_id, FALSE); foreach ($groups as $g) { $albums_out[] = array('id' => "group:" . $g['gid'], 'title' => $g['name'], 'access' => "write", 'type' => array("image", "audio", "video")); } } return array('success' => TRUE, 'albums' => $albums_out); }
function set_group_media_gallery() { global $login_uid; /* Retriving all the Groups of the User */ // Loading user's all groups (whom user is a member) $this->group_ids = Group::get_user_groups($login_uid); }
foreach ($add_assoc_user_errors as $n => $err) { echo "<br />{$err}"; } } ?> </div> <textarea id="assoc_users" name="assoc_users" rows="3" style="height:auto;width:180px;"><?php echo htmlspecialchars(@$_POST['assoc_users']); ?> </textarea> <br /> <input type="submit" name="add_assoc_users" value="Add" /> </div> </div> <?php $mygroups = Group::get_user_groups((int) PA::$login_user->user_id); if (count($mygroups)) { ?> <div class="field_medium_event"> <h4><label for="add_group"><?php echo __("Groups you are a member of"); ?> </label></h4> <div class="center"> <div class="field_text"> <?php if (count($add_assoc_group_errors)) { foreach ($add_assoc_group_errors as $n => $err) { echo "<br />{$err}"; } }
/** Purpose : this function is used to get navigation links for the whole page. Scope : public @param - it needs no direct input. But works only on the basis of current page initialized in __construct() @return - array of links **/ public function get_links($optional = NULL) { //initialization global $dynamic_page; if (isset($_SESSION['user']['id'])) { $extra = unserialize($this->network_info->extra); if (@$extra['reciprocated_relationship'] == NET_YES) { $status = APPROVED; } else { $status = FALSE; } $relations_ids = Relation::get_relations((int) $_SESSION['user']['id'], $status, PA::$network_info->network_id); $user_groups = Group::get_user_groups((int) $_SESSION['user']['id']); /* $gid isn't defined in this function, so the following call * will probably always return FALSE. To get rid of the warning * under E_ALL, I've replaced the following expression with * FALSE. Maybe $gid should be get_group_id()? */ $is_owner_of_group = FALSE; //Group::is_admin($gid,(int)$_SESSION['user']['id']) ; } if (isset($relations_ids) && sizeof($relations_ids)) { $this->set_friend_uid($relations_ids[0]); } if (isset($user_groups) && sizeof($user_groups)) { $this->users_first_group_id($user_groups[0]['gid']); } if (PA::$login_uid) { $this->set_uid(PA::$login_uid); } else { $this->set_anonymous(); } $is_group_content = FALSE; if (@$_GET['gid']) { $this->set_group_id($_GET['gid']); } else { if ((FILE_FORUM_MESSAGES == $this->current_page || FILE_CONTENT == $this->current_page) && !empty($_REQUEST['ccid']) && $_REQUEST['ccid'] > 0) { $this->set_group_id($_REQUEST['ccid']); $is_group_content = TRUE; } else { if (PAGE_PERMALINK == $this->current_page && !empty($_GET['cid'])) { try { $content_data = Content::load_content($_GET['cid'], $this->get_uid()); } catch (PAException $e) { if ($e->getCode() != CONTENT_NOT_FOUND) { throw $e; } } if (isset($content_data)) { if ($content_data->parent_collection_id > 0) { $content_collection_data = ContentCollection::load_collection($content_data->parent_collection_id, $this->get_uid()); if ($content_collection_data->type == GROUP_COLLECTION_TYPE) { $this->set_group_id($content_data->parent_collection_id); $is_group_content = TRUE; } } } } } } //test //$this->current_page='test.php'; // make links for current page $this->make_links(); $level_1 = $this->get_level_1(); $level_2 = $this->get_level_2(); $level_3 = NULL; $left_user_public_links = NULL; if (Network::is_admin($this->network_info->network_id, (int) @$_SESSION['user']['id'])) { $level_3 = $this->get_level_3('network'); } else { if (!$this->network_info && $_SESSION['user']['id'] == SUPERUSER) { $level_3 = $this->get_level_3('network'); } } $level_3 = NULL; switch ($this->current_page) { /*----------------------------------------------------*/ case PAGE_HOMEPAGE: $level_3 = NULL; $level_2['highlight'] = 'home'; break; case FILE_LOGIN: $level_2['highlight'] = 'home'; break; case PAGE_SEARCH: //fix by Zoran Hron: constants FILE_SEARCH_HOME and FILE_SHOWCONTENT points to the same value !!! if (!empty($_GET['gid'])) { $level_2['highlight'] = 'groups'; $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'groups_general')); } else { if (!empty($_GET['btn_searchContent'])) { $level_2['highlight'] = 'search'; } else { $level_3 = NULL; $level_2['highlight'] = 'home'; } } break; case FILE_TAG_SEARCH: $level_2['highlight'] = 'tag_search'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case PAGE_USER_PRIVATE: global $app; $app->setRequestParam('uid', PA::$login_uid, 'POST'); case PAGE_USER_PUBLIC: case PAGE_USER_PRIVATE: if (!PA::$page_uid && !PA::$login_uid) { throw new PAException("", "Invalid page access"); } if (PA::$page_uid) { //uid get variable set //these links are to be added in front $def_relations_term = 'Friend'; if (isset($extra['relationship_show_mode']['term'])) { $def_relations_term = $extra['relationship_show_mode']['term']; } $relation_already_exists_links = array('send_message' => array('caption' => __('Send a message'), 'url' => $this->base_url . PA_ROUTE_ADDMESSAGE . '/uid=' . PA::$page_uid), 'change_relationship' => array('caption' => __('Change Relation'), 'url' => $this->base_url . PA_ROUTE_EDIT_RELATIONS . '/uid=' . PA::$page_uid . '&do=change&action=EditRelation'), 'delete_relationship' => array('caption' => sprintf(__('Delete as %s'), __($def_relations_term)), 'url' => $this->base_url . PA_ROUTE_EDIT_RELATIONS . '/do=delete&uid=' . PA::$page_uid . '&action=EditRelation', 'extra' => ' onclick ="return delete_confirmation_msg(\'' . __('Are you sure you want to delete this Relationship?') . '\') "')); $relation_does_not_exists_links = array('send_message' => array('caption' => __('Send a message'), 'url' => $this->base_url . PA_ROUTE_ADDMESSAGE . '/uid=' . PA::$page_uid), 'make_connection' => array('caption' => sprintf(__('Add as %s'), __($def_relations_term)), 'url' => $this->base_url . PA_ROUTE_EDIT_RELATIONS . '/uid=' . PA::$page_uid . '&do=add&action=EditRelation')); if (PA::$page_uid == PA::$login_uid) { //login and get uid same means user's public page $level_2['highlight'] = 'user'; $level_3 = $this->get_level_3('user'); } else { // make left and right links //user's public page requires different link rendering if (!empty($relations_ids)) { if (in_array(PA::$page_uid, $relations_ids)) { $left_user_public_links = $relation_already_exists_links; } else { $left_user_public_links = $relation_does_not_exists_links; } } else { $left_user_public_links = $relation_does_not_exists_links; } } } else { //means user's private page $level_2['highlight'] = 'user'; $level_3 = $this->get_level_3('user'); $level_3['highlight'] = 'user_private'; } break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case PAGE_PEOPLES: $level_2['highlight'] = 'people'; $level_3 = $this->get_level_3('people'); $level_3['highlight'] = 'find_people'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case PAGE_FAMILY: case PAGE_FAMILY_EDIT: $level_3 = $this->get_level_3('family'); break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_VIEW_ALL_MEMBERS: if (@$_GET['gid']) { $level_2['highlight'] = 'groups'; $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific')); $level_3['highlight'] = 'group_members'; } else { $level_2['highlight'] = 'people'; if (PA::$page_uid == PA::$login_uid) { $level_3 = $this->get_level_3('people'); if (!empty($_GET['view_type']) && $_GET['view_type'] == 'relations') { $level_3['highlight'] = 'my_friends'; } else { if (!empty($_GET['view_type']) && $_GET['view_type'] == 'in_relations') { $level_3['highlight'] = 'people_who_call_me_friend'; } else { $level_3['highlight'] = 'find_people'; } } } } break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_INVITATION: $level_2['highlight'] = 'people'; $level_3 = $this->get_level_3('people'); $level_3['highlight'] = 'invite'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_UPLOAD_MEDIA: case PAGE_MEDIA_GALLERY: if (PA::$login_uid) { if (isset($_GET['view']) && 'groups_media' == $_GET['view']) { //user is viewing group gallery $level_2['highlight'] = 'groups'; $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific')); $level_3['highlight'] = 'group_gallery'; } else { if (isset($_GET['view']) && 'friends' == $_GET['view']) { //user is viewing his friends gallery $level_2['highlight'] = 'people'; $level_3 = $this->get_level_3('people'); $level_3['highlight'] = 'friends_gallery'; } else { if (PA::$page_uid != PA::$login_uid && PA::$page_uid != '') { //user is viewing his private page gallery $level_2['highlight'] = 'people'; } else { if (PA::$page_uid == PA::$login_uid || !PA::$page_uid) { $level_2['highlight'] = 'user'; $level_3 = $this->get_level_3('user'); $level_3['highlight'] = 'my_gallery'; } } } } } else { if (!empty(PA::$page_uid)) { // for anonymous user $level_2['highlight'] = 'people'; } } break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case PAGE_USER_CUSTOMIZE_UI: $level_2['highlight'] = 'user'; $level_3 = $this->get_level_3('user'); $level_3['highlight'] = 'customize_ui'; break; case FILE_USER_CALENDAR: $level_2['highlight'] = 'user'; $level_3 = $this->get_level_3('user'); $level_3['highlight'] = 'my_events'; break; case PAGE_EDIT_PROFILE: $level_2['highlight'] = 'user'; $level_3 = $this->get_level_3('user'); $level_3['highlight'] = 'settings'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_EDIT_RELATIONS: $level_2['highlight'] = 'people'; $level_3 = $this->get_level_3('people'); $level_3['highlight'] = 'find_people'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case PAGE_GROUPS_HOME: $level_2['highlight'] = 'groups'; $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'groups_general')); $level_3['highlight'] = 'find_groups'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_GROUPS_CATEGORY: $level_2['highlight'] = 'groups'; $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'groups_general')); $level_3['highlight'] = 'find_groups'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_ADDGROUP: $level_2['highlight'] = 'groups'; if (!empty($_GET['gid'])) { $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific')); $level_3['highlight'] = 'edit_group'; } else { $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'groups_general')); $level_3['highlight'] = 'create_group'; } break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case PAGE_GROUP: case PAGE_GROUP_AD_CENTER: case FILE_GROUP_MEDIA_GALLERY: case FILE_GROUP_CALENDAR: case FILE_GROUP_INVITATION: case PAGE_GROUP_THEME: case PAGE_GROUP_MODERATION: case FILE_MANAGE_GROUP_CONTENTS: $level_2['highlight'] = 'groups'; $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific')); break; case FILE_ADDGROUP: $level_2['highlight'] = 'group'; if ($_GET['gid']) { $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific')); $level_3['highlight'] = 'edit_group'; } else { $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'groups_general')); $level_3['highlight'] = 'create_group'; } break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_WIDGET: $level_2['highlight'] = 'user'; $level_3 = $this->get_level_3('user'); $level_3['highlight'] = 'user_widgets'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case PAGE_MESSAGE: case PAGE_ADDMESSAGE: case PAGE_VIEW_MESSAGE: $level_2['highlight'] = 'user'; $level_3 = $this->get_level_3('user'); $level_3['highlight'] = 'messages'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_POST_CONTENT: $level_2['highlight'] = 'user'; $level_3 = $this->get_level_3('user'); $level_3['highlight'] = 'create_post'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_CONTENT_MANAGEMENT: $level_2['highlight'] = 'user'; $level_3 = $this->get_level_3('user'); $level_3['highlight'] = 'manage_posts'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_NETWORKS_HOME: case FILE_NETWORKS_CATEGORY: $level_1['highlight'] = 'networks_directory'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_NETWORK_USER_DEFAULTS: case FILE_RELATIONSHIP_SETTINGS: case FILE_EMAIL_NOTIFICATION: case FILE_MANAGE_TAKETOUR: case FILE_MANAGE_EMBLEM: case FILE_CONFIGURE_SPLASH_PAGE: case FILE_NETWORK_FEATURE: case FILE_NETWORK_CUSTOMIZE_UI_PAGE: case FILE_NETWORK_STATS: case FILE_NETWORK_LINKS: case FILE_NEW_USER_BY_ADMIN: case FILE_NETWORK_MANAGE_CONTENT: case FILE_MODULE_SELECTOR: case FILE_NETWORK_BULLETINS: case FILE_NETWORK_MANAGE_USER: case FILE_NETWORK_CALENDAR: case FILE_MANAGE_AD_CENTER: case FILE_MANAGE_GROUP_FORUM: case FILE_MANAGE_COMMENTS: case FILE_RANKING: case FILE_MISREPORTS: case PAGE_ROLE_MANAGE: case FILE_ASSIGN_TASK: $level_2 = $this->get_level_3('network'); $level_1['highlight'] = 'configure_network'; $level_2['highlight'] = 'configure_network'; break; case FILE_CREATENETWORK: $level_1['highlight'] = 'create_network'; $level_3['highlight'] = 'statistics'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_SHOWCONTENT: // remark by Zoran Hron: this never will be executed because // constants FILE_SEARCH_HOME and FILE_SHOWCONTENT points to the same value !!! if (!empty($_GET['gid'])) { $level_2['highlight'] = 'groups'; $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'groups_general')); } break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_LINKS_MANAGEMENT: $level_2['highlight'] = 'user'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_MEDIA_FULL_VIEW: if (!empty($_GET['gid'])) { $level_2['highlight'] = 'groups'; $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific')); } else { $level_2['highlight'] = 'user'; $level_3 = $this->get_level_3('user'); } break; case FILE_REGISTER: $level_2['highlight'] = 'home'; break; case FILE_EDIT_MEDIA: $level_2['highlight'] = 'user'; $level_3 = $this->get_level_3('user'); $level_3['highlight'] = 'my_gallery'; break; /*----------------------------------------------------*/ /*----------------------------------------------------*/ case FILE_EDITNETWORK: case PAGE_PERMALINK: if ($is_group_content == TRUE) { if ($this->get_uid()) { $is_group_content = FALSE; $level_2['highlight'] = 'groups'; $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific')); $level_3['highlight'] = 'group_home'; } else { $is_group_content = FALSE; $level_2['highlight'] = 'groups'; $level_3 = $this->get_level_3(array('type' => 'groups', 'sub_type' => 'groups_general')); $level_3['highlight'] = 'group_home'; } } elseif (!empty($_GET['cid'])) { try { $content_data = Content::load_content($_GET['cid'], $this->get_uid()); if ($content_data->parent_collection_id != -1 && $content_data->parent_collection_id != 0) { $content_collection_data = ContentCollection::load_collection($content_data->parent_collection_id, $this->get_uid()); if ($content_collection_data->type == GROUP_COLLECTION_TYPE) { $this->get_level_3(array('type' => 'groups', 'sub_type' => 'group_specific')); } } else { $level_3 = $this->get_level_3('user'); } } catch (PAException $e) { } } break; default: break; } //--end of switch /* moved this code outside of the switch statement... we wabt this to run in any case, so that xml files can override default navigation! -Martin */ if (isset($dynamic_page) && !empty($dynamic_page->navigation_code)) { if (false == eval($dynamic_page->navigation_code . "return true;")) { echo "<b>Evaluation of navigation links code for page ID={$dynamic_page->page_name} failed" . "Please check your dynamic page configuration file. Page ID: {$dynamic_page->page_id}"; } } /* ------- */ $menu = array('level_1' => $level_1, 'level_2' => $level_2, 'level_3' => $level_3, 'left_user_public_links' => $left_user_public_links); // echo '<pre>'.print_r($menu,1).'</pre>'; return $menu; }
/** * function used to delete a group or groups. * @param $user_id and $group_id */ public function delete_user_groups($user_id, $group_id = NULL) { $network_owner_id = (int) PA::$network_info->owner_id; //getting user groups $all_user_groups = Group::get_user_groups($user_id); if (count($all_user_groups) > 0) { foreach ($all_user_groups as $group) { $this->collection_id = $group['gid']; if ($group['access'] == OWNER) { // assign new Battalion/UGCGroup owner Group::set_user_type($user_id, (int) $group['gid'], MEMBER); // only MEMBER can leave a group! $this->leave($user_id); if (Group::member_exists((int) $group['gid'], $network_owner_id)) { // network owner is already member of group Group::set_user_type($network_owner_id, (int) $group['gid'], OWNER); // transfer ownership to network owner } else { Group::set_group_owner($network_owner_id, (int) $group['gid']); // insert new group owner } $role_id = GROUP_ADMIN_ROLE; $role_extra = array('user' => false, 'network' => false, 'groups' => array((int) $group['gid'])); $role = array('role_id' => $role_id, 'extra' => serialize($role_extra)); $net_owner = new User(); $net_owner->load($network_owner_id); $net_owner->set_user_role(array($role)); } else { if ($group['access'] == MEMBER || $group['access'] == MODERATOR) { if ($group['access'] == MODERATOR) { Group::set_user_type($user_id, (int) $group['gid'], MEMBER); // only MEMBER can leave a group! } //voiding user membership $this->leave($user_id); } } } } }