author_id!=$_SESSION['user']['id']){ if(!empty($_GET["msg"])) { switch($_GET["msg"]) { case "blog": $group_top_mesg = "Your Blog Post has been sent for approval"; break; case "sbcontent": $group_top_mesg = "Your Post has been sent for approval"; break; default: $group_top_mesg = ""; } } } //p($_POST); if ($_POST['content_type'] == 'media') { /* Function for Filtering the POST data Array */ filter_all_post($_POST); $content_type = 'media'; require_once "$path_prefix/web/groupmedia_post.php"; } else if ( isset($_POST['submit']) && ($_POST['content_type'] != 'media') && (Group::member_exists((int)$_REQUEST['gid'], (int)$_SESSION['user']['id']))) { /* Function for Filtering the POST data Array */ filter_all_post($_POST); $error = FALSE; $msg = ''; $title = trim($_POST['title_form']); $body = trim($_POST['body']); if ( $title == '' ) { $error = TRUE; $msg .= "
Please specify title"; } if ( $body == '' ) { $error = TRUE; $msg .= "
Please enter contents"; } if ( !$error ) { $cat_obj = new MessageBoard(); $cat_obj->set_parent($parent_id,$parent_type); $cat_obj->title = $title; $cat_obj->body = $body; $cat_obj->user_id = $uid; if ( !$_POST['chk_allow_anonymous'] ) { $cat_obj->allow_anonymous = 0; } else { $cat_obj->allow_anonymous = 1; } try { $mid = $cat_obj->save(); } catch (PAException $e) { $msg = "Error occured in saving thread\n"; $msg .= "
".$e->message."
"; $error = TRUE; } } if ( $mid ) { if ($_GET['gid']) { header("Location: $base_url/forum_messages.php?mid=$mid&ccid=".$_GET['gid']); } exit; } } else if (isset($_POST['submit']) && ($_POST['content_type'] != 'media') && !(Group::member_exists((int)$_REQUEST['gid'], (int)$_SESSION['user']['id']))) { $group_top_mesg = "You are not a member of ".stripslashes($group->title)." group."; } if(!empty($_GET['post_type'])) { $post_type = $_GET['post_type']; } else { $post_type = 'all'; } if ($_GET['post_type'] == 'blog') { $content_type = BLOGPOST; } else if ($_GET['post_type'] == 'image') { $content_type = IMAGE; } else if ($_GET['post_type'] == 'audio') { $content_type = AUDIO; } else if ($_GET['post_type'] == 'video') { $content_type = VIDEO; } else if ($_GET['post_type'] == 'event') { $content_type = SBMICROCONTENT_EVENT; } else if ($_GET['post_type'] == 'review') { $content_type = SBMICROCONTENT_REVIEW; } else if ($_GET['post_type'] == 'group_showcase') { $content_type = SBMICROCONTENT_GROUP; } else if ($_GET['post_type'] == 'people_showcase') { $content_type = SBMICROCONTENT_PEOPLE; } else { $content_type = NULL; } //////////code for join or leave the group if($_GET['action'] == 'join' && $_SESSION['user']['id']) { if (!Group::member_exists((int)$_REQUEST['gid'], (int)$_SESSION['user']['id'])) { try { $x = $group->join((int)$_SESSION['user']['id'], $_SESSION['user']['email'],$group_invitation_id); } catch (PAException $e) { if ($e->code == GROUP_NOT_INVITED) { $group_top_mesg = $e->message; //header("Location: groups_home.php"); //exit; } $group_top_mesg = $e->message; } } else { $group_top_mesg = "You are already a member of \"".stripslashes($group->title)."\" ."; } if ($x) { if($group->reg_type == $group->REG_MODERATED) { $group_top_mesg = "Your joining request has been submitted to the owner of \"".stripslashes($group->title)."\" group."; } else { $group_top_mesg = "You have joined the \"".stripslashes($group->title)."\" group successfully."; } } } elseif ($_GET['action'] == 'leave' && $_SESSION['user']['id']) { if (Group::is_admin((int)$_REQUEST['gid'], (int)$_SESSION['user']['id'])) { $group_top_mesg = "You cant leave your own group"; }else if (Group::member_exists((int)$_REQUEST['gid'], (int)$_SESSION['user']['id'])) { try { $x = $group->leave((int)$_SESSION['user']['id']); } catch (PAException $e) { $group_top_mesg = "Operation failed (".$e->message."). Please try again"; } } else { $group_top_mesg = "You are not member of ".stripslashes($group->title)." group."; } if ($x) { $group_top_mesg = "You have left the \"".stripslashes($group->title)."\" group successfully."; } } elseif (($_GET['action'] == 'delete') && (($_POST['content_type'] != 'media'))) { if (Group::is_admin((int)$_REQUEST['gid'], (int)$_SESSION['user']['id'])) { $group->delete(); header("location:groups_home.php"); exit; } else if ($_POST['content_type'] == 'media') { $med_type = ucfirst($_POST['media_type']); $group_top_mesg = "Your $med_type file has been deleted."; } else { $group_top_mesg = "You dont have permissions to delete this group"; } } elseif (($_POST['submit'] || $_POST['submit_audio'] || $_POST['submit_video']) && ($_POST['content_type'] == 'media')) { $error_media = FALSE; $med_type = ucfirst($_POST['media_type']); if (!empty($upload_array)) { for($i=0; $iaccess_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)$_SESSION['user']['id'])){ $is_admin = TRUE; $header->is_admin = TRUE; } $members = $group->get_members($cnt=FALSE, 5, 1, 'created', 'DESC',FALSE); //$members = $group->get_members(); $group_details = array(); $group_details['collection_id'] = $group->collection_id; $group_details['type'] = $group->type; $group_details['author_id'] = $group->author_id; $user = new User(); $user->load((int)$group->author_id); $first_name = $user->first_name; $last_name = $user->last_name; $login_name = $user->login_name; $group_details['author_name'] = chop_string($login_name, 15); $group_details['author_picture'] = $user->picture; $group_details['title'] = $group->title; $group_details['description'] = $group->description; $group_details['is_active'] = $group->is_active; $group_details['picture'] = $group->picture; $group_details['desktop_picture'] = $group->desktop_picture; $group_details['created'] = date("F d, Y h:i A", $group->created); $group_details['changed'] = $group->changed; $group_details['category_id'] = $group->category_id; $cat_obj = new Category(); $cat_obj->set_category_id($group->category_id); $cat_obj->load(); $cat_name = stripslashes($cat_obj->name); $cat_description = stripslashes($cat_obj->description); $group_details['category_name'] = $cat_name; $group_details['category_description'] = $cat_description; $group_details['members'] = Group::get_member_count($gid); $group_details['access_type'] = $access_type; $group_details['is_admin'] = $is_admin; $group_tags = Tag::load_tags_for_content_collection((int)$group->collection_id); $group_details['tag_entry'] = Tag::tag_array_to_html($group_tags,1); //////////////////get details of group EOF if(is_array($members)){ $count = count($members); foreach ($members as $member) { $count_relations = Relation::get_relations($member['user_id']); $user = new User(); $user->load((int)$member['user_id']); $login_name = $user->login_name; $user_picture = $user->picture; $users_data[] = array('user_id'=>$member['user_id'],'picture'=>$user_picture,'login_name'=>$login_name,'no_of_relations'=>count($count_relations)); } $final_array = array('users_data'=>$users_data, 'total_users'=>$count); } $users = $final_array; //p($users); if (Group::member_exists((int)$group->collection_id, (int)$_SESSION['user']['id'])) { $is_member = TRUE; $header->is_member = TRUE; } $group_details['is_member'] = $is_member; if( $group->access_type == $group->ACCESS_PRIVATE && !$is_member ) { if (!empty($group_top_mesg)) { //$group_top_mesg.= "
You need to be a member of this group to view its content."; } else { $group_top_mesg = "You need to be a member of this group to view its content."; } } $show_content = TRUE; function setup_module($column, $module, $obj) { global $group_details, $users, $content_type, $request_info, $title, $body, $is_member, $paging, $msg, $access,$group, $upload_array, $post_type_message, $post_type; $obj->group_details = $group_details; switch ($module) { case 'MembersFacewallModule': $obj->members = $users; $obj->gid = $_REQUEST['gid']; break; case 'ShowContentModule': case 'GroupForumModule': case 'GroupImageMediaModule': case 'GroupAudioMediaModule': case 'GroupVideoMediaModule': if ($access==$group->ACCESS_PRIVATE) { if( $is_member == FALSE) { return "skip"; } } if ($module=='ShowContentModule') { $obj->type = 'group'; $obj->content_type = $content_type; $obj->gid = $_GET['gid']; $obj->message = $post_type_message[$post_type]; // This message array is defined in config.inc } if ($module=='GroupForumModule') { $obj->parent_id = $request_info['parent_id']; $obj->parent_name_hidden = $request_info['parent_name_hidden']; $obj->parent_type = $request_info['parent_type']; $obj->header_title = $request_info['header_title']; $obj->title_form = $title; $obj->group_access_type = $group->access_type; $obj->body = $body; $obj->is_member = $is_member; $obj->Paging["page"] = $paging["page"]; $obj->Paging["show"] = $paging["show"]; if ( $error ) { $obj->msg = $msg; } } if ($module=='GroupImageMediaModule' || ($module=='GroupAudioMediaModule') || ($module=='GroupVideoMediaModule')) { $obj->type = 'group_media'; $obj->block_type = 'media_management'; $obj->mode = PUB; $obj->error = $upload_array; } break; case 'RecentPostModule': if ($access==$group->ACCESS_PRIVATE) { if( $is_member == FALSE) { return "skip"; } } $obj->type = 'group'; $obj->gid = $_GET['gid']; break; } } $page = new PageRenderer("setup_module", PAGE_GROUP, "Group: ".$group->title, "groups.tpl",'header.tpl',PRI,HOMEPAGE,$network_info); $page->header->set('author_id', $group->author_id); // Setting the Author ID in tier-two.tpl $optional_parameters = "onload=\"$onload\""; $page->html_body_attributes = $optional_parameters; if ($show_options) { $page->header->show_options = TRUE; } //middle of group page if (!empty($group_top_mesg)) { //print $group_top_mesg; exit; $msg_tpl = & new Template(CURRENT_THEME_FSPATH."/display_message.tpl"); $msg_tpl->set('message', $group_top_mesg); $page->add_module("middle", "top", $msg_tpl->fetch()); } echo $page->render(); ?>