/** * Enter description here... * * @param array $RecordSet * @return UserCollection */ private function doLoad($RecordSet) { $ContentCollection = new ContentCollection(); foreach ($RecordSet as $Row) { // i_ID, i_Menue_ID, i_Command_ID, s_Name, i_Option_ID, i_Group_ID $ContentCollection->add(new Content($Row['i_ID'], $Row['s_Name'], $Row['i_Position'], $Row['i_Menue_ID'], $Row['i_ContentGroup_ID'], $Row['i_View_ID'], $Row['i_Command_ID'])); } return $ContentCollection; }
function generate_group_links() { global $login_uid; // Getting all the information about that group $group_data = array(); $group_info = array(); $group_info['is_member'] = FALSE; $group_join_string = 'Join This Group'; $group_data = ContentCollection::load_collection($this->gid, NULL); // Calculating user's type if (!empty($login_uid)) { $usr_type = Group::get_user_type($login_uid, $this->gid); $group_info['is_member'] = $usr_type == MEMBER ? TRUE : FALSE; if ($usr_type == OWNER) { $group_info['is_admin'] = TRUE; $group_info['is_member'] = TRUE; } } if ($group_data->reg_type == REG_MODERATED) { $group_join_string = "Request to join this group"; } $group_info['title'] = $group_data->title; $group_info['description'] = $group_data->description; $group_info['picture'] = $group_data->picture; $group_info['collection_id'] = $group_data->collection_id; $group_info['join_str'] = $group_join_string; unset($group_data); return $group_info; }
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 initializeModule($request_method, $request_data) { global $paging; $this->Paging = $paging; if (!empty($this->shared_data['group_info'])) { $this->family = $this->shared_data['group_info']; $this->set_id = $this->family->collection_id; } else { if (!empty($request_data['gid'])) { $this->family = ContentCollection::load_collection((int) $request_data['gid']); $this->set_id = $request_data['gid']; } else { return 'skip'; } } if (!empty($request_data['action']) && $request_data['action'] == 'addChild') { $this->set_inner_template('add_child.tpl'); } else { if (!empty($request_data['view'])) { $this->view = $request_data['view']; if ($this->view == 'members') { $Pagination = new Pagination(); $Pagination->setPaging($this->Paging); $this->page_prev = $Pagination->getPreviousPage(); $this->page_next = $Pagination->getNextPage(); $this->page_links = $Pagination->getPageLinks(); $this->get_links(); $this->set_inner_template('center_inner_public.tpl'); $templ_vars = array('links' => $this->members_data, 'page_prev' => $this->page_prev, 'page_next' => $this->page_next, 'page_links' => $this->page_links, 'page_first' => $this->page_first, 'page_last' => $this->page_last, 'family_id' => $this->set_id, 'div_visible_for_moderation' => $this->view); $this->inner_HTML = $this->generate_inner_html($templ_vars); } } } }
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; }
public static function save_suggestion($cid, $uid, $title, $body, $track, $tags, $ccid = 0, $is_active = 1, $display_on = 0, $is_default_content = FALSE) { // global var $path_prefix has been removed - please, use PA::$path static variable $errors = array(); // ensure integers here $cid = (int) $cid; $uid = (int) $uid; $ccid = (int) $ccid; // if a new post, make one, otherwise load the existing one if ($cid) { $post = Content::load_content($cid, $uid); // ignore $ccid passed to function if the post already exists // - we don't allow users to move posts between // ContentCollections. $ccid = (int) $post->parent_collection_id; } else { $post = new Suggestion(); $post->author_id = $uid; if ($ccid) { $post->parent_collection_id = $ccid; } } if ($ccid && $ccid != -1) { $g = ContentCollection::load_collection($ccid, $uid); $g->assert_user_access($uid); } else { $g = NULL; } $post->title = $title; $post->body = $body; $post->allow_comments = 1; $post->is_active = $is_active; $post->display_on = $display_on; $post->trackbacks = ''; if ($track) { $post->trackbacks = implode(",", $track); } $post->is_default_content = $is_default_content; $post->save(); //if ($tags) { Tag::add_tags_to_content($post->content_id, $tags); //} if ($track) { foreach ($track as $t) { if (!$post->send_trackback($t)) { $errors[] = array("code" => "trackback_failed", "msg" => "Failed to send trackback", "url" => $t); } } } if ($g && !$cid) { // new post - post it to the group as well $g->post_content($post->content_id, $uid); } if (!$cid) { // add to suggestion queue automatically if not editing ModerationQueue::moderate_suggestion($post->content_id); } return array("cid" => (int) $post->content_id, "moderation_required" => $g ? $g->is_moderated == 1 && $g->author_id != $uid : FALSE, "errors" => $errors); }
function load_data($error_msg = '') { global $global_form_data; $array_tmp = array(); $this->categories = Category::build_root_list(); if (is_array($this->categories)) { foreach ($this->categories as $category) { $array_tmp[] = array('category_id' => $category->category_id, 'name' => $category->name); } $this->categories = $array_tmp; } if (!empty($error_msg)) { $this->error_msg = $error_msg; } if ($this->id == 0) { $this->title = 'Create Group'; } else { $this->title = 'Change Group Settings'; $group = ContentCollection::load_collection((int) $this->id, $_SESSION['user']['id']); $group_tags = Tag::load_tags_for_content_collection((int) $this->id); $this->collection_id = (int) $this->id; $this->groupname = stripslashes($group->title); $this->body = stripslashes($group->description); $this->access = $group->access_type; $this->reg_type = $group->reg_type; $this->is_moderated = $group->is_moderated; $this->group_category = $group->category_id; $this->display_header_image = $group->display_header_image; if (count($group_tags)) { foreach ($group_tags as $tag) { $out[] = $tag['name']; } $this->tag_entry = implode(', ', $out); } if ($group->picture) { $this->group_photo = $group->picture; $this->upfile = $group->picture; } if ($group->header_image) { $this->header_image = $group->header_image; $this->upfile = $group->picture; $this->header_image_action = $group->header_image_action; } } if (!empty($global_form_data['addgroup'])) { $this->collection_id = (int) $this->id; $this->groupname = $global_form_data['groupname']; $this->body = $global_form_data['groupdesc']; $this->access = @$global_form_data['groupaccess']; $this->reg_type = $global_form_data['reg_type']; $this->is_moderated = @$global_form_data['is_mod']; $this->group_category = $global_form_data['group_category']; $this->tag_entry = $global_form_data['group_tags']; $this->display_header_image = @$global_form_data['display_header_image']; } $this->tag_entry = str_replace('"', '"', @$this->tag_entry); return; }
public function generate_group_links() { $group_info = NULL; // Retrive the group details $group_data = ContentCollection::load_collection($this->gid, NULL); $group_info->category_name = $group_data->category_name; unset($user); unset($group_data); return $group_info; }
function render() { if ($this->view_type == 'all') { $this->Paging["count"] = Network::get_members(array('network_id' => $this->network_info->network_id, 'cnt' => TRUE)); $param = array('show' => $this->Paging["show"], 'page' => $this->Paging["page"], 'network_id' => $this->network_info->network_id); $users_info = Network::get_members($param); $this->links = $users_info['users_data']; } else { if ($this->view_type == 'relations' || $this->view_type == 'in_relations') { $extra = unserialize($this->network_info->extra); $this->reciprocated_relationship_set = FALSE; $this->relations = FALSE; if (@$extra['reciprocated_relationship'] == NET_YES) { $this->reciprocated_relationship_set = TRUE; $this->relations = TRUE; } $users_info = Relation::get_all_user_relations($this->uid, $no_of_relations = 0, FALSE, $this->Paging["show"], $this->Paging["page"], 'created', 'DESC', 'internal', null, PA::$network_info->network_id); $this->Paging["count"] = count($users_info); $this->title = __("View all "); if ($_SESSION['user']['id'] == $this->uid) { $this->title .= "my"; } else { $this->title .= $this->page_user . ' \'s'; } $this->title .= " friends"; $this->sub_title = $this->title; $this->links = $users_info; } } if ($this->gid) { $group = ContentCollection::load_collection((int) $this->gid, @PA::$login_uid); $this->Paging["count"] = $group->get_members(TRUE); $members = $group->get_members(FALSE, $this->Paging["show"], $this->Paging["page"]); $this->title = sprintf(__("View All %s Members"), __(PA::$group_noun)); if (is_array($members)) { foreach ($members as $member) { // load user info $user = new User(); $user->load((int) $member['user_id']); $u = array('user_id' => $user->user_id, 'user_id' => $user->user_id, 'first_name' => $user->first_name, 'last_name' => $user->last_name, 'display_name' => $user->display_name, 'email' => $user->email, 'picture' => $user->picture, 'login_name' => $user->login_name, 'created' => $user->created); if (!empty(PA::$config->useTypedGroups)) { require_once 'api/Entity/TypedGroupEntityRelation.php'; // see if we have a special relation of this user to the group list($relType, $u['membertype']) = TypedGroupEntityRelation::get_relation_to_group($member['user_id'], (int) $this->gid); } $tmp_arr[] = $u; } $this->links = $tmp_arr; } } $this->inner_HTML = $this->generate_inner_html(); $content = parent::render(); return $content; }
function generate_group_links() { $group_info = array(); // Retrive the group details $group_data = ContentCollection::load_collection($this->gid, NULL); $group_info['members'] = Group::get_member_count($this->gid); // Loading the Group owner $user = new User(); $user->load((int) $group_data->author_id); $group_info['created'] = date("F d, Y h:i A", $group_data->created); $group_info['author_picture'] = $user->picture; $group_info['author_name'] = $user->login_name; $group_info['category_name'] = $group_data->category_name; $group_info['access_type'] = $group_data->reg_type == $group_data->REG_OPEN ? ' Open' : ' Moderated'; unset($user); unset($group_data); return $group_info; }
private function get_families() { $userfamilies = TypedGroupEntityRelation::get_relation_for_user($this->uid, 'family'); $family_details = array(); foreach ($userfamilies as $i => $fam) { $group = ContentCollection::load_collection((int) $fam->object_id, PA::$login_uid); $member_exist = Group::member_exists((int) $fam->object_id, $this->uid); $picture = $group->picture; $cnt = Group::get_member_count($group->collection_id); $family_details[$i]['id'] = $group->collection_id; $family_details[$i]['title'] = stripslashes($group->title); $desc = stripslashes($group->description); $desc = substr($desc, 0, 100); $family_details[$i]['desc'] = $desc; $family_details[$i]['picture'] = $picture; $family_details[$i]['members'] = $cnt; $family_details[$i]['access'] = $group->access_type; } return $family_details; }
public static function load_for_group($group_id, $load_entity = true) { $result = Entity::search(array('entity_service' => 'typedGroup', 'entity_id' => $group_id)); $entity = NULL; if (!empty($result)) { $entity_result = $result[0]; if (empty($load_entity)) { return $entity_result; } $entity = Entity::load($entity_result['entity_service'], $entity_result['entity_type'], $entity_result['entity_id']); // load extra group info for logo and sloagan try { $group = ContentCollection::load_collection((int) $entity_result['entity_id']); $entity->attributes['name']['value'] = $group->title; $entity->attributes['logo']['value'] = $group->picture; $entity->attributes['slogan']['value'] = $group->description; } catch (PAException $e) { return NULL; } } return $entity; }
*/ /** This file is used to change the skin of the network. * Anonymous user can not access this page; */ $login_required = TRUE; //including necessary files $use_theme = 'Beta'; //TODO : Remove this when new UI is completely implemented. include "includes/page.php"; require_once "{$path_prefix}/web/includes/network.inc.php"; require_once "{$path_prefix}/web/group_functions.php"; global $login_uid; $msg = ''; $gid = (int) $_GET['gid']; if (!empty($gid)) { $group_data = ContentCollection::load_collection($gid, $login_uid); $is_admin = Group::is_admin($gid, $login_uid); } $type = @$_GET['type']; $page_id = PAGE_GROUP; $parameter .= js_includes('common.js '); if (!empty($_GET['msg_id'])) { $msg_id = $_GET['msg_id']; } if ($type == 'style') { // load all support code // these should eventually be collapsed into one file $parameter .= js_includes('iutil.js'); $parameter .= js_includes('json.js'); $parameter .= js_includes('idrag.js'); $parameter .= js_includes('isortables.js');
$show_media = new Video(); break; } $show_media->load($cid); // loading tags for media $tags_array = Tag::load_tags_for_content($show_media->content_id); $tags_string = ""; if (count($tags_array) > 0) { for ($counter = 0; $counter < count($tags_array); $counter++) { $tags_string .= $tags_array[$counter]['name'] . ", "; } $tags_string = substr($tags_string, 0, strlen($tags_string) - 2); } $show_media->tags = $tags_string; // loading content's contentcollection information $cc_info = ContentCollection::load_collection($show_media->parent_collection_id, $_SESSION['user']['id']); } } if ($uid == $_SESSION['user']['id']) { global $network_info; $extra = unserialize($network_info->extra); // for edit - group media if (isset($_POST['submit_group']) && $_POST['group_id']) { if ($_POST['media_type'] == 'image') { $module = 'Images'; $new_save = new Image(); if (isset($_POST['image_perm'])) { $new_save->file_perm = $_POST['image_perm']; } } else { if ($_POST['media_type'] == 'audio') {
} $setting_data = ModuleSetting::load_setting(PAGE_SHOWCONTENT, $uid); $user = new User(); if ($login_uid) { $user_details = $user->load((int) $uid); } $_REQUEST['ccid'] = @$_REQUEST['gid']; //get details of group if ($_REQUEST['ccid']) { $is_member = FALSE; $is_admin = FALSE; $content_access = TRUE; $is_invite = FALSE; //$gid = (int)$_REQUEST['gid']; gid changed to ccid $gid = (int) $_REQUEST['gid']; $group = ContentCollection::load_collection((int) $gid, $login_uid); $access = $group->access_type; if ($group->access_type == $group->ACCESS_PRIVATE) { $access_type = 'Private'; } else { $access_type = 'Public'; } if ($group->reg_type == $group->REG_OPEN) { $access_type .= ' Open'; } else { $access_type .= ' Moderated'; } if (Group::is_admin((int) $_REQUEST['gid'], (int) $login_uid)) { $is_admin = TRUE; } $members = $group->get_members();
/** * delete collection * @access private */ public function delete() { Logger::log("Enter: Group::delete()"); $res = Dal::query("DELETE FROM {groups_users} WHERE group_id = ?", array($this->collection_id)); $res = Dal::query("DELETE FROM {moderation_queue} WHERE collection_id = ?", array($this->collection_id)); // delete all forums in a group MessageBoard::delete_all_in_parent($this->collection_id, 'collection'); parent::delete(); Logger::log("Exit: Group::delete()"); }
$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"; } $is_member = FALSE; $is_admin = FALSE; $is_invite = FALSE; if ($_GET['gid']) { $group = ContentCollection::load_collection((int) $_GET['gid'], $_SESSION['user']['id']); $pending = array(); $accepted = array(); if (Group::member_exists((int) $group->collection_id, (int) $_SESSION['user']['id'])) { $is_member = TRUE; } if ($group->reg_type == $group->REG_INVITE and Group::member_exists((int) $group->collection_id, (int) $_SESSION['user']['id'])) { $is_invite = TRUE; } if (Group::is_admin((int) $group->collection_id, (int) $_SESSION['user']['id'])) { $is_admin = TRUE; if ($group->is_moderated || $group->reg_type == $group->REG_MODERATED) { $total_in_mod_queue = count($group->get_moderation_queue('content')) + count($group->get_moderation_queue('user')); } $invs = Invitation::get_all((int) $_SESSION['user']['id'], $group->collection_id); foreach ($invs as $i) {
private function handleGET_join($request_data) { require_once "api/Activities/Activities.php"; global $error_msg; if (PA::$login_uid && !empty($this->shared_data['group_info'])) { $group = $this->shared_data['group_info']; if (!Group::member_exists((int) $request_data['gid'], (int) PA::$login_uid)) { $user = PA::$login_user; $login_name = $user->login_name; $group_invitation_id = !empty($request_data['GInvID']) ? $request_data['GInvID'] : null; try { $user_joined = $group->join((int) PA::$login_uid, $user->email, $group_invitation_id); // for rivers of people $activity = 'group_joined'; //for rivers of people $activity_extra['info'] = $login_name . ' joined a new group'; $activity_extra['group_name'] = $group->title; $activity_extra['group_id'] = $request_data['gid']; $extra = serialize($activity_extra); $object = $request_data['gid']; Activities::save(PA::$login_uid, $activity, $object, $extra); if (!empty($group_invitation_id)) { // if group is joined through group invitation $Ginv = Invitation::load($group_invitation_id); $gid = $Ginv->inv_collection_id; $user_obj = new User(); $user_obj->load((int) $Ginv->user_id); $group = ContentCollection::load_collection((int) $gid, $Ginv->user_id); $user_type = Group::get_user_type($user_obj->user_id, $gid); if ($group->reg_type == REG_MODERATED && $user_type == OWNER) { $group->collection_id = $gid; $group->approve(PA::$login_uid, 'user'); } $user_accepting_ginv_obj = new User(); $user_accepting_ginv_obj->load((int) PA::$login_uid); $Ginv->inv_user_id = PA::$login_uid; PANotify::send("invite_accept_group", $user_obj, $user_accepting_ginv_obj, $Ginv); } } catch (PAException $e) { if ($e->code == GROUP_NOT_INVITED) { $error_msg = $e->message; // header("Location: groups_home.php"); // exit; } $error_msg = $e->message; } } else { $error_msg = sprintf(__("You are already a member of \"%s\""), stripslashes($group->title)); } if (@$user_joined) { // deal with TypedGroup Relations require_once "api/Entity/TypedGroupEntityRelation.php"; $uid = PA::$login_uid; $gid = $group->collection_id; $type = @$request_data['relation']; try { TypedGroupEntityRelation::set_relation($uid, $gid, $type); } catch (PAException $e) { $error_msg = $e->getMessage(); } $gid = (int) $request_data['gid']; if (!Group::member_exists($gid, (int) PA::$login_uid) && $group->reg_type == REG_MODERATED) { // if it is a manual join not an invited join $mail_type = 'group_join_request'; $error_msg = sprintf(__("Your request to join \"%s\" has been submitted to the owner of the group."), stripslashes($group->title)); } else { $mail_type = 'group_join'; $error_msg = sprintf(__("You have joined \"%s\" successfully."), stripslashes($group->title)); } PANotify::send($mail_type, $group, PA::$login_user, array()); if ($type == 'child') { // if user type == child remove LoginUser and GroupMember roles PA::$login_user->delete_user_role(); // then assign 'Child' role only $_extra = serialize(array('user' => false, 'network' => false, 'groups' => array($gid))); $user_roles[] = array('role_id' => CHILD_MEMBER_ROLE, 'extra' => $_extra); PA::$login_user->set_user_role($user_roles); } } } else { // redirect to login $msg = urlencode(__("You need to be logged in to join a group.")); header("Location: " . PA::$url . "/login.php?" . $msg . "&return=" . urlencode($_SERVER['REDIRECT_URL'] . '?' . @$_SERVER['REDIRECT_QUERY_STRING'])); } }
function initializeModule($request_method, $request_data) { $this->action = !empty($request_data['faction']) ? $request_data['faction'] : null; $this->module = !empty($request_data['module']) ? $request_data['module'] : null; $this->page = empty($request_data['page']) ? 1 : (int) $request_data['page']; $this->category = empty($request_data['category']) ? null : $request_data['category']; $this->criteria = array('network_id' => PA::$network_info->network_id); $this->categories = PointsEntity::get_cetegories(); $this->renderer->add_header_css('/' . PA::$theme_rel . '/points_directory.css'); $this->relType = 'guest'; if (!empty($request_data['fid']) || !empty($request_data['gid'])) { if (!empty($request_data['fid'])) { $this->criteria['family_id'] = $request_data['fid']; } else { if (!empty($request_data['gid'])) { $this->criteria['family_id'] = $request_data['gid']; } } $this->fid = !empty($this->criteria['family_id']) ? $this->criteria['family_id'] : null; list($relType, $relLabel) = TypedGroupEntityRelation::get_relation_to_group(PA::$login_uid, (int) $this->fid); if (empty($relType)) { $relType = 'member'; } $this->relType = $relType; $this->familly = ContentCollection::load_collection((int) $this->fid, PA::$login_uid); $this->fam_members = $this->get_familly_members($this->familly); $this->edit_perm = $this->check_edit_perm(); $this->sub_title = sprintf(__('%s Points'), $this->familly->title . ' Family'); // this string should be replaced with $family->name } if (!empty($request_data['uid'])) { $this->user_id = $request_data['uid']; $this->sub_title = sprintf(__('Points for %s'), PA::$user->display_name); $this->criteria['user_id'] = $request_data['uid']; } if (!empty($this->category)) { $this->sub_title = sprintf(__('Search results for \'%s\' Category'), $this->category); $this->criteria['category'] = $this->category; } switch ($this->page_id) { case PAGE_FAMILY: $this->url_base = PA::$url . PA_ROUTE_FAMILY . "?gid={$this->fid}"; break; case PAGE_FAMILY_DIRECTORY: $this->url_base = PA::$url . PA_ROUTE_FAMILY_DIRECTORY; break; case PAGE_POINTS_DIRECTORY: if (isset($this->fid)) { $this->url_base = PA::$url . PA_ROUTE_FAMILY . "?gid={$this->fid}"; } else { $this->url_base = PA::$url . PA_ROUTE_POINTS_DIRECTORY . "?uid={$this->user_id}"; } break; } if ($request_method == 'GET') { //echo "Action: " . $this->action . "Module: " . $this->module . "clname: " . $this->class_name; die(); if (!empty($this->action) && $this->module == $this->class_name) { switch ($this->action) { case 'newPoints': $this->view_mode = 'new'; $this->sub_title = __('Add Points'); $this->set_inner_template('edit_points_form.tpl.php'); $this->renderer->add_header_css('/' . PA::$theme_rel . '/modal.css'); $this->renderer->add_page_js('/' . PA::$theme_rel . '/javascript/forms.js'); $this->renderer->add_page_js('/' . PA::$theme_rel . '/javascript/jquery.validate.js'); $this->renderer->add_page_js('/' . PA::$theme_rel . '/javascript/attach_media_modal.js'); $this->renderer->add_page_js('/' . PA::$theme_rel . '/javascript/points_directory.js'); break; case 'editPoints': $this->view_mode = 'edit'; $this->sub_title = __('Edit Points'); $this->set_inner_template('edit_points_form.tpl.php'); $this->renderer->add_header_css('/' . PA::$theme_rel . '/modal.css'); $this->renderer->add_page_js('/' . PA::$theme_rel . '/javascript/forms.js'); $this->renderer->add_page_js('/' . PA::$theme_rel . '/javascript/jquery.validate.js'); $this->renderer->add_page_js('/' . PA::$theme_rel . '/javascript/attach_media_modal.js'); $this->renderer->add_page_js('/' . PA::$theme_rel . '/javascript/points_directory.js'); break; case 'deletePoints': $this->view_mode = 'list'; break; default: } } else { $this->view_mode = 'list'; $this->set_inner_template('center_inner_public.tpl.php'); $this->showPointsDirectory($request_data); } } }
<?php //anonymous user can not view this page; $login_required = FALSE; $use_theme = 'Beta'; //TODO : Remove this when new UI is completely implemented. //including necessary files include "includes/page.php"; include_once "{$path_prefix}/api/ModuleSetting/ModuleSetting.php"; include_once "{$path_prefix}/ext/Group/Group.php"; global $login_uid; $msg = ''; if (!empty($_GET['gid'])) { $gid = (int) $_GET['gid']; $group_data = ContentCollection::load_collection($gid, $_SESSION['user']['id']); $is_member = Group::member_exists($gid, $login_uid); $is_admin = Group::is_admin($gid, $login_uid); if ($group_data->reg_type == REG_INVITE && !$is_member && !$is_admin) { $msg = 9005; } } function setup_module($column, $module, $obj) { global $is_member, $is_admin, $group_data, $gid; $obj->gid = $gid; switch ($module) { case 'MembersFacewallModule': $group = new Group(); $group->collection_id = $gid; $group->is_active = ACTIVE; $members = $group->get_members($cnt = FALSE, 5, 1, 'created', 'DESC', FALSE);
function setup_module($column, $moduleName, $obj) { global $is_group_content, $group_details, $users, $gid, $content, $collection, $error_message, $media_gallery; if (!empty($group_details['collection_id'])) { // we are in a group $gid = (int) $group_details['collection_id']; $login_uid = @PA::$login_user->user_id; $group = ContentCollection::load_collection($gid, $login_uid); $member_type = Group::get_user_type($login_uid, $gid); if ($group->reg_type == REG_INVITE && $member_type == NOT_A_MEMBER) { $group_top_mesg = 9005; return "skip"; } } if ($group_details['access_type'] == 'Private Moderated' && $member_type == NOT_A_MEMBER) { $group_top_mesg = 9005; return "skip"; } switch ($moduleName) { case 'RecentCommentsModule': $obj->cid = $_REQUEST['cid']; $obj->block_type = HOMEPAGE; $obj->mode = PRI; break; case 'GroupAccessModule': $obj->group_details = $group_details; break; case 'MembersFacewallModule': $obj->group_details = $group_details; $obj->links = $group_details['users']; $obj->gid = $gid; $obj->mode = PRI; $obj->block_type = 'Homepage'; break; case 'EventCalendarSidebarModule': if ($is_group_content) { $obj->assoc_type = "group"; $obj->assoc_id = $gid; if (!isset($_GET['gid']) || $_GET['gid'] != $gid) { $_GET['gid'] = $gid; // make sure it get's passed so we can construct the right URLs } $obj->title = 'Group Events'; $is_member = Group::get_user_type((int) PA::$login_uid, $gid); if ($is_member == NOT_A_MEMBER) { $obj->may_edit = false; } else { $obj->may_edit = true; } } else { $obj->assoc_id = $content->author_id; // displaying the calendar for the AUTHOR of this content $obj->assoc_type = "user"; // this is the personal calendar if ((int) PA::$login_uid != $user->user_id) { $obj->may_edit = false; } else { $obj->may_edit = true; } } case 'PermalinkModule': if ($error_message == 9005 || $error_message == 1001) { return "skip"; } if ($group_details['skip_group_modules']) { return "skip"; } $obj->content_id = $_REQUEST['cid']; $obj->content = $content; break; case 'GroupStatsModule': $obj->group_details = $group_details; $obj->gid = $gid; $obj->block_type = 'GroupSideBlocks'; break; case 'RecentPostModule': if (@$collection->type == GROUP_COLLECTION_TYPE) { $obj->type = 'group'; $obj->gid = $collection->collection_id; } else { $obj->mode = PUB; $obj->type = 'permalink'; } break; case 'ImagesModule': $obj->page = $media_gallery; $obj->group_details = $group_details; break; } }
public static function add_default_media($user_id, $type = '', $network_info = NULL) { // global var $path_prefix has been removed - please, use PA::$path static variable require_once "api/CNUser/CNUser.php"; require_once "api/CNAlbum/CNAlbum.php"; require_once "api/CNImage/CNImage.php"; require_once "api/CNAudio/CNAudio.php"; require_once "api/CNVideo/CNVideo.php"; require_once "api/CNContentCollection/CNContentCollection.php"; //$extra contains networks extra information $extra = unserialize($network_info->extra); /** setting common variables according to media type */ if ($type == '') { $net_extra_ccid_str = $extra['user_defaults']['default_image_gallery']; $alb_type = IMAGE_ALBUM; $new_img = new CNImage(); } elseif ($type == '_audio') { $net_extra_ccid_str = $extra['user_defaults']['default_audio_gallery']; $alb_type = AUDIO_ALBUM; $new_img = new CNAudio(); } elseif ($type == '_video') { $net_extra_ccid_str = $extra['user_defaults']['default_video_gallery']; $alb_type = VIDEO_ALBUM; $new_img = new CNVideo(); } /** getting array of content collection from comma separated string */ if (!empty($net_extra_ccid_str)) { $net_extra_ccid = explode(',', $net_extra_ccid_str); /** setting all content collection variables */ if (count($net_extra_ccid) >= 1) { for ($i = 0; $i < count($net_extra_ccid); $i++) { $new_im_al = new Album($alb_type); $new_im_al_default = new Album($alb_type); $new_im_al->load((int) $net_extra_ccid[$i]); $content_collection_obj = new ContentCollection(); $content_collection_obj->collection_id = $new_im_al->collection_id; $contents = $content_collection_obj->get_contents_for_collection(); $new_im_al_default->title = $new_im_al->title; $new_im_al_default->description = $new_im_al->description; $new_im_al_default->author_id = $user_id; $new_im_al_default->type = 2; // FOR ALBUM, type is 2 $new_im_al_default->save(); /** Setting content variable */ for ($j = 0; $j < count($contents); $j++) { if ($contents[$j]['type'] != 7) { // If content is not a SB content if ($alb_type == IMAGE_ALBUM) { $new_img_default = new CNImage(); $new_img_default->type = IMAGE; } elseif ($alb_type == AUDIO_ALBUM) { $new_img_default = new CNAudio(); $new_img_default->type = AUDIO; } elseif ($alb_type == VIDEO_ALBUM) { $new_img_default = new CNVideo(); $new_img_default->type = VIDEO; } $new_img->load((int) $contents[$j]['content_id']); $new_img_default->file_name = $new_img->file_name; $new_img_default->file_perm = $new_img->file_perm; $new_img_default->title = $contents[$j]['title']; $new_img_default->body = $contents[$j]['body']; $tags = Tag::load_tags_for_content($contents[$j]['content_id']); $new_img_default->allow_comments = 1; $new_img_default->author_id = $user_id; $new_img_default->parent_collection_id = $new_im_al_default->collection_id; $new_img_default->save(); if (!empty($tags)) { $tag_array = array(); if (is_array($tags)) { for ($i = 0; $i < count($tags); $i++) { $tag_array[] = $tags[$i]['name']; } } Tag::add_tags_to_content($new_img_default->content_id, $tag_array); } } else { // If content is a SB content //TODO: handling of SB content if it is in media gallery. } } } } } }
private function can_delete_comment($params, $type) { $available_permiss = $this->get_available_permiss_by_type($params, $type); if (in_array('delete_comment', $available_permiss)) { return true; } if (!empty($params['comment_info'])) { $comment = $params['comment_info']; //array having the comment details if (isset($comment['user_id']) and $comment['user_id'] == $this->uid) { //Author of comment can delete the comment return true; } else { if (isset($comment['recipient_id']) and $comment['recipient_id'] == $this->uid) { return true; } } $content = Content::load_content((int) $comment['content_id'], $this->uid); if ($content->author_id == $this->uid) { //Author of the content can delete the comment. return true; } else { if ($content->parent_collection_id != -1) { // means content belongs to some collection $collection = ContentCollection::load_collection($content->parent_collection_id, $this->uid); if ($collection->author_id == $this->uid) { //If content on which comment has been posted belongs to some collection then author of that collection can delete the comment return true; } } } } return false; // return false in all the other cases }
function uihelper_get_group_style($gid) { if (empty($gid)) { return uihelper_get_network_style(); } global $page; $group_var = new Group(); $group_var->collection_id = $gid; $group_info = $group_var->get_group_theme_detail(); if (!empty($group_info['extra'])) { $extra = unserialize($group_info['extra']); } $css_array = get_group_theme($gid); $css_files = $css_array['css_files']; // setting the header image for the group header $group_info = ContentCollection::load_collection((int) $gid, PA::$login_uid); $page->header->set('caption_image', $group_info->header_image); $page->header->set('desktop_image_action', $group_info->header_image_action); $page->header->set('display_header_image', $group_info->display_header_image); $page->header->set('group_name', $group_info->title); $page->header->set('is_admin_member', 1); if ($css_array['header_image_allowed']) { $page->header->set('header_image_allowed', 1); } // Adding the Css files in the page if (is_array($css_files)) { foreach ($css_files as $key => $value) { $page->add_header_css($value); } } // adding inline css in the page if (!empty($extra['style']['newcss'])) { $css_data = '<style type="text/css">' . $extra['style']['newcss'] . '</style>'; $page->add_header_html($css_data); } }
/** 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; }
/** * loads array of all content, that are supposed to be moderated * for network operator control, network content management * @access public * @param array params * @param array conditions * @return array content */ public static function load_all_content_for_moderation($params = NULL, $conditions = NULL) { Logger::log("Enter: Content::load_all_content_for_moderation() | Args: \$params = {$params}, \$conditions = {$conditions}"); $sql = "SELECT CT.name AS content_name, C.content_id, C.collection_id, C.title, C.body, C.type, C.author_id, C.changed, C.created, C.is_active FROM {contents} AS C, {content_types} AS CT WHERE 1 AND CT.type_id = C.type"; if (is_array($conditions)) { foreach ($conditions as $field_name => $field_value) { $sql = $sql . ' AND ' . $field_name . ' = ' . $field_value; } } //paging variables if set $sort_by = $params['sort_by'] ? $params['sort_by'] : 'created'; $direction = $params['direction'] ? $params['direction'] : 'DESC'; $order_by = ' ORDER BY ' . $sort_by . ' ' . $direction; if ($params['page'] && $params['show'] && !$params['cnt']) { $start = ($params['page'] - 1) * $params['show']; $limit = ' LIMIT ' . $start . ',' . $params['show']; } else { $limit = ""; } $sql = $sql . $order_by . $limit; $res = Dal::query($sql); if ($params['cnt']) { if ($res->numRows() > 0) { return $res->numRows(); } } // preparing array, that is to be returned if ($res->numRows()) { $i = 0; while ($row = $res->fetchRow(DB_FETCHMODE_ASSOC)) { try { $author = new User(); $author->load((int) $row['author_id']); if ($row['collection_id'] != -1) { $var = new ContentCollection(); $var->load((int) $row['collection_id']); $collection['title'] = $var->title; $collection['type'] = $var->type; } else { $collection = array(); } $content_data[$i] = array('content_id' => $row['content_id'], 'title' => $row['title'], 'body' => $row['body'], 'author_id' => $row['author_id'], 'type' => $row['content_name'], 'changed' => $row['changed'], 'created' => date("j M Y H:i:s", $row['created']), 'type_name' => $row['name'], 'author_name' => $author->login_name, 'content_type_id' => $row['type'], 'parent_info' => $collection, 'is_active' => $row['is_active']); $i++; } catch (PAException $e) { // } } } Logger::log("Exit: Content::load_all_content_for_moderation()"); return $content_data; }
function route2groups() { global $user, $is_edit; $extra = unserialize(PA::$network_info->extra); $tags = preg_split('/\\s*,\\s*/', strtolower($_POST['tags'])); $tags = array_unique($tags); $net_owner = new User(); $net_owner->load((int) PA::$network_info->owner_id); $valid_post_types = array('BlogPost', 'Contribution', 'Suggestion'); $type = isset($_POST) && isset($_POST['blog_type']) && in_array($_POST['blog_type'], $valid_post_types) ? $_POST['blog_type'] : 'BlogPost'; //find tag entry $terms = array(); foreach ($tags as $term) { $tr = trim($term); if ($tr) { $terms[] = $tr; } } if (!empty($_POST['route_to_pa_home']) && $_POST['route_to_pa_home'] == 1) { $display_on_homepage = DISPLAY_ON_HOMEPAGE; //its zero } else { $display_on_homepage = NO_DISPLAY_ON_HOMEPAGE; //This will not show up on homepage - flag has opposite values } if (is_array($_POST['route_targets_group'])) { if (in_array(-2, $_POST['route_targets_group'])) { //-2 means Select none of group // no need to post in any group } elseif (in_array(-1, $_POST['route_targets_group'])) { //-1 means select all the groups // post in all the groups $group_array = explode(',', $_POST['Allgroups']); foreach ($group_array as $gid) { // post to all the groups $_group = Group::load_group_by_id((int) $gid); $login_required_str = null; if ($_group->access_type == ACCESS_PRIVATE) { $login_required_str = '&login_required=true'; } switch ($type) { case 'BlogPost': default: $res = BlogPost::save_blogpost(0, PA::$login_uid, $_POST['blog_title'], $_POST['description'], NULL, $terms, $gid, $is_active = 1, $display_on_homepage); break; case 'Contribution': $res = Contribution::save_contribution(0, PA::$login_uid, $_POST['blog_title'], $_POST['description'], NULL, $terms, $gid, $is_active = 1, $display_on_homepage); break; case 'Suggestion': $res = Suggetion::save_suggestion(0, PA::$login_uid, $_POST['blog_title'], $_POST['description'], NULL, $terms, $gid, $is_active = 1, $display_on_homepage); break; } $permalink_cid = $res['cid']; // NOTE: would this notification message be sent for each group ??? $content_obj = Content::load_content((int) $permalink_cid); PANotify::send("content_posted", PA::$network_info, $user, $content_obj); // notify network owner (maybe group owner would be better?) if ($display_on_homepage == DISPLAY_ON_HOMEPAGE) { PANotify::send("content_posted_to_comm_blog", PA::$network_info, $user, $content_obj); } //------- //for rivers of people $activity = 'group_post_a_blog'; $activity_extra['info'] = $user->first_name . 'posted a new blog'; $activity_extra['blog_name'] = $_POST["blog_title"]; $activity_extra['blog_id'] = $permalink_cid; $activity_extra['blog_url'] = PA::$url . PA_ROUTE_CONTENT . '/cid=' . $permalink_cid . $login_required_str; $extra = serialize($activity_extra); $object = $gid; // update status to unverified $group = ContentCollection::load_collection((int) $gid, PA::$login_uid); if ($group->reg_type == REG_MODERATED) { Network::moderate_network_content((int) $gid, $permalink_cid); } else { if ($extra['network_content_moderation'] == NET_YES && $is_edit == 0 && PA::$network_info->owner_id != $user->user_id) { Network::moderate_network_content($gid, $permalink_cid); } } if (!PA::is_moderated_content() && $group->reg_type != REG_MODERATED) { //Write to activity log only when moderation is off Activities::save($user->user_id, $activity, $object, $extra); } } } else { // post in selected groups foreach ($_POST['route_targets_group'] as $gid) { //only send to selected groups $_group = Group::load_group_by_id((int) $gid); $login_required_str = null; if ($_group->access_type == ACCESS_PRIVATE) { $login_required_str = '&login_required=true'; } switch ($type) { case 'BlogPost': default: $res = BlogPost::save_blogpost(0, PA::$login_uid, $_POST['blog_title'], $_POST['description'], NULL, $terms, $gid, $is_active = 1, $display_on_homepage); break; case 'Contribution': $res = Contribution::save_contribution(0, PA::$login_uid, $_POST['blog_title'], $_POST['description'], NULL, $terms, $gid, $is_active = 1, $display_on_homepage); break; case 'Suggestion': $res = Suggestion::save_suggestion(0, PA::$login_uid, $_POST['blog_title'], $_POST['description'], NULL, $terms, $gid, $is_active = 1, $display_on_homepage); break; } $permalink_cid = $res['cid']; $content_obj = Content::load_content((int) $permalink_cid); PANotify::send("content_posted", PA::$network_info, $user, $content_obj); // notify network owner (maybe group owner would be better?) if ($display_on_homepage == DISPLAY_ON_HOMEPAGE) { PANotify::send("content_posted_to_comm_blog", PA::$network_info, $user, $content_obj); } //for rivers of people $activity = 'group_post_a_blog'; $activity_extra['info'] = $user->first_name . 'posted a new blog'; $activity_extra['blog_name'] = $_POST["blog_title"]; $activity_extra['blog_id'] = $permalink_cid; $activity_extra['blog_url'] = PA::$url . PA_ROUTE_CONTENT . '/cid=' . $permalink_cid . $login_required_str; $extra = serialize($activity_extra); $object = $gid; // update status to unverified $group = ContentCollection::load_collection((int) $gid, PA::$login_uid); if ($group->reg_type == REG_MODERATED) { Network::moderate_network_content((int) $gid, $permalink_cid); } else { if ($extra['network_content_moderation'] == NET_YES && $is_edit == 0 && PA::$network_info->owner_id != $user->user_id) { Network::moderate_network_content($gid, $permalink_cid); } } if (!PA::is_moderated_content() && $group->reg_type != REG_MODERATED) { //Write to activity log only when moderation is off Activities::save($user->user_id, $activity, $object, $extra); } } } } return TRUE; }
function generate_inner_html() { global $login_uid; if (!isset($_GET['gid']) || empty($_GET['gid'])) { parent::set_vars(); $frnd_list = null; if (!empty($_GET['view'])) { $frnd_list = $this->friend_list; } $sb_audios = array(); $new_album = new Album(AUDIO_ALBUM); if ($this->album_id) { $new_album = new Album(); $new_album->album_type = AUDIO_ALBUM; $new_album->load((int) $this->album_id); $audio_data['album_id'] = $new_album->collection_id; $audio_data['album_name'] = $new_album->title; } else { $new_album->collection_id = $this->default_album_id; $audio_data['album_id'] = $this->default_album_id; $audio_data['album_name'] = $this->default_album_name; } $audio_ids = $new_album->get_contents_for_collection(); if (!empty($audio_ids)) { $k = 0; $ids = array(); for ($i = 0; $i < count($audio_ids); $i++) { if ($audio_ids[$i]['type'] != 7) { // Type 7 is for SB Content $ids[$i] = $audio_ids[$i]['content_id']; } else { $tags = Tag::load_tags_for_content($audio_ids[$i]['content_id']); $tags = show_tags($tags, null); //show_tags function is defined in uihelper.php $sb_audios[] = array('content_id' => $audio_ids[$i]['content_id'], 'title' => $audio_ids[$i]['title'], 'type' => $audio_ids[$i]['type'], 'created' => $audio_ids[$i]['created'], 'tags' => $tags); } } $new_audio = new Audio(); $data = $new_audio->load_many($ids, $this->uid, $login_uid); if (count($data) > 0) { foreach ($data as $d) { $audio_data[$k]['content_id'] = $d['content_id']; $audio_data[$k]['audio_file'] = $d['audio_file']; $audio_data[$k]['audio_caption'] = $d['audio_caption']; $audio_data[$k]['title'] = $d['title']; $audio_data[$k]['body'] = $d['body']; $audio_data[$k]['created'] = $d['created']; $audio_data[$k]['tags'] = $d['tags']; $audio_data[$k]['type'] = ""; $k++; } } // Merging Media Gallery content and SB Content for ($counter = 0; $counter < count($sb_audios); $counter++) { $audio_data[$k]['content_id'] = $sb_audios[$counter]['content_id']; $audio_data[$k]['title'] = $sb_audios[$counter]['title']; $audio_data[$k]['type'] = $sb_audios[$counter]['type']; $audio_data[$k]['image_caption'] = $sb_audios[$counter]['title']; $audio_data[$k]['created'] = $sb_audios[$counter]['created']; $audio_data[$k]['tags'] = $sb_audios[$counter]['tags']; $k++; } } if (!empty($_GET['view'])) { if (empty($frnd_list)) { $audio_data = NULL; } } $inner_template = NULL; switch ($this->mode) { default: $inner_template = dirname(__FILE__) . '/center_inner_public.tpl'; } $obj_inner_template =& new Template($inner_template); $obj_inner_template->set('links', $audio_data); $obj_inner_template->set('uid', $this->uid); $obj_inner_template->set('frnd_list', $frnd_list); $obj_inner_template->set('my_all_album', $this->my_all_album); $obj_inner_template->set('show_view', $this->show_view); $inner_html = $obj_inner_template->fetch(); return $inner_html; } else { parent::set_group_media_gallery(); //------------- Handling the Groups Media gallery ----------- $group = ContentCollection::load_collection((int) $_GET['gid'], $_SESSION['user']['id']); $audio_data = Audio::load_audios_for_collection_id($_GET['gid'], $limit = 0); $audio_data['album_id'] = $group->collection_id; $audio_data['album_name'] = $group->title; $inner_template = NULL; switch ($this->mode) { default: $inner_template = dirname(__FILE__) . '/center_inner_public_groups.tpl'; } $obj_inner_template =& new Template($inner_template); $obj_inner_template->set('links', $audio_data); $obj_inner_template->set('show_view', $this->show_view); $obj_inner_template->set('my_all_groups', $this->group_ids); $inner_html = $obj_inner_template->fetch(); return $inner_html; } }
/** 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; }
// for query count global $query_count_on_page; $query_count_on_page = 0; $show_media = NULL; $error_msg = NULL; if (!empty($_GET['cid'])) { if (!empty($_POST['rptabuse'])) { // if an abuse is reported require_once "web/includes/blocks/submit_abuse.php"; if (isset($_GET['err'])) { $error_msg = strip_tags(urldecode($_GET['err'])); } } $cid = $_GET['cid']; if ($content_info = Content::load_content($cid, $login_uid)) { $info = ContentCollection::get_collection_type($content_info->parent_collection_id); if ($content_info->type == 'Image') { $show_media = new Image(); } else { if ($content_info->type == 'Audio') { $show_media = new Audio(); } else { if ($content_info->type == 'TekVideo') { $show_media = new TekVideo(); } else { die("Content ID {$cid} is non-media (not image, audio, or video)"); } } } $show_media->load($cid); // loading tags for media