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 = ""; } } } 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'; } $content_type = NULL; $content_type = get_content_type( $_GET['post_type'] ); //////////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) { $params['uid'] = (int)$_SESSION['user']['id']; $params['gid'] = (int)$_REQUEST['gid']; $params['group_name'] = $group->title; $params['network_name'] = $network_info->name; $params['group_member_count'] = Group::get_member_count((int)$_REQUEST['gid']); if($group->reg_type == $group->REG_MODERATED) { $group_top_mesg = "Your joining request has been submitted to the owner of \"".stripslashes($group->title)."\" group."; $params['is_mod'] = TRUE; } else { $params['is_mod'] = FALSE; $group_top_mesg = "You have joined the \"".stripslashes($group->title)."\" group successfully."; } auto_email_notification_members('someone_join_their_group', $params ); } } 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; $join_group_string = ''; if ($group->reg_type == REG_MODERATED) { // if it is a moderated group, then // join group string will change to request to join this group $join_group_string = "Request to join this group"; } 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; } $is_admin_member = FALSE; // set the default value to if (Group::is_admin((int)$_REQUEST['gid'], (int)$_SESSION['user']['id'])) { $is_admin_member = TRUE; $header->is_admin_member = TRUE; } $group_details['is_member'] = $is_member; $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, $group_top_mesg, $join_group_string; $obj->group_details = $group_details; $obj->join_this_group_string = $join_group_string; switch ($module) { case 'MembersFacewallModule': $obj->links = $users; $obj->gid = $_REQUEST['gid']; break; case 'ImagesModule' : $obj->block_type = 'Gallery'; $obj->page = 'grouppage'; $obj->title = 'Group Gallery'; break; case 'ShowContentModule': $gid = $_REQUEST['gid']; $group = ContentCollection::load_collection((int)$gid, $_SESSION['user']['id']); if ($_SESSION['user']['id']) { global $group_top_mesg; $is_member = Group::get_user_type((int)$_SESSION['user']['id'], (int)$gid); if ($group->reg_type == REG_INVITE && $is_member == NOT_A_MEMBER) { $group_top_mesg = MessagesHandler::get_message(9005); return "skip"; } } else { if ($group->reg_type == REG_INVITE) { $group_top_mesg = MessagesHandler::get_message(9005); return "skip"; } } case 'GroupForumModule': case 'GroupImageMediaModule': case 'GroupAudioMediaModule': case 'GroupVideoMediaModule': if ($module=='ShowContentModule') { $obj->type = 'group'; $obj->content_type = $content_type; $obj->gid = $_GET['gid']; $obj->message = $post_type_message[$post_type]; $obj->block_heading = 'Group Blog'; $obj->title = 'Group Blog'; // This message array is defined in config.inc $obj->Paging["page"] = $paging["page"]; $obj->Paging["show"] = 5; } if ($module=='GroupImageMediaModule' || ($module=='GroupAudioMediaModule') || ($module=='GroupVideoMediaModule')) {return 'skip'; $obj->type = 'group_media'; $obj->block_type = 'media_management'; $obj->error = $upload_array; } break; case 'RecentPostModule': $obj->type = 'group'; $obj->gid = $_GET['gid']; break; } $obj->mode = PUB; } $page = new PageRenderer("setup_module", PAGE_GROUP, "Group: ".$group->title, "container_three_column.tpl",'header_group.tpl',PRI,HOMEPAGE,$network_info); $page->header->set('author_id', $group->author_id); // Setting the Author ID in tier-two.tpl $page->header->set('is_admin_member', $is_admin_member); $page->header->set('group_name', $group->title); $page->header->set('group_access_type', $group_details['access_type']); $page->header->set('caption_image', $group->header_image); $page->header->set('desktop_image_action', $group->header_image_action); $page->header->set('display_header_image', $group->display_header_image); $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()); } $page->add_header_html($parameter); $theme_details = get_group_theme(@$_GET['gid']); if (is_array($theme_details['css_files'])) { foreach ($theme_details['css_files'] as $key => $value) { $page->add_header_css($value); } } $page->header->set('theme_details', $theme_details); echo $page->render(); ?>