<?php
/*************************************************************************/

	if ($D->group->status==0 && $this->user->info->is_network_admin==0) $this->redirect('home');

	// If there is a user logged in, get ready a variable for use.
	$D->is_my_group = 0;
	$D->is_logged = 0;
	$D->ilikeme = 0;
	$D->posted_in = 2; // Post in a group
	$D->id_wall = $D->group->code;
	$D->membership = 0;
	
	$D->isGroup = 1;
	
	if ($this->user->is_logged) {
		$D->me = $this->user->info;
		$D->is_logged = 1;
		
		$D->is_my_group = ($D->group->idcreator == $this->user->id);
		
		$D->i_administrator_group = $this->user->if_admin_group($D->group->idgroup);
		
		$D->iammember = $this->user->if_iam_member_group($D->group->idgroup);
				
		$D->i_follow_him = $this->user->if_follow_group($D->group->idgroup);
		
		$D->membership = $this->user->membership($D->group->idgroup);

	}
/*************************************************************************/
	
	$D->nameGroup = $D->group->name_group;

/*************************************************************************/
	
	// We check if it is display the profile information
	$D->privacy = $D->group->privacy;
	$D->group_public = $D->group_closed = $D->group_secret = 0;
	$D->show_profile = 0;
	switch($D->privacy) {
		case 0:
			$D->show_profile = 1;
			$D->group_public = 1;
			break;
		case 1:
			$D->show_profile = 1;
			$D->group_closed = 1;
			break;
		case 2:
			$D->group_secret = 1;
			if ($D->iammember) {
				$D->show_profile = 1;
			}
			break;
	}

/*************************************************************************/

	$D->useraccesories = '';
	if ($this->user->is_logged) $userAleat = $this->network->getUserAleat(5);
	else $userAleat = $this->network->getUserAleat(5, 0, 0);
	
	foreach($userAleat as $oneUser) {
		$D->acc_name = (empty($oneUser->firstname) || empty($oneUser->lastname))?stripslashes($oneUser->username):(stripslashes($oneUser->firstname).' '.stripslashes($oneUser->lastname));
		$D->acc_codeuser = $oneUser->code;
		$D->acc_avatar = $oneUser->avatar;
		$D->acc_numfriends = $oneUser->num_friends;
		$D->acc_username = $oneUser->username;
		$D->useraccesories .= $this->load_template('__accessories-one-user.php', FALSE);
	}

	unset($userAleat, $oneUser);

/*************************************************************************/
	
	$D->i_am_network_admin = ( $this->user->is_logged && $this->user->info->is_network_admin );

/*************************************************************************/

	$D->adsProfile1 = trim($this->network->get_ads_basic('adsbasic1'));
	$D->adsProfile2 = trim($this->network->get_ads_basic('adsbasic2'));
	
	require_once('_load-ads.php');
	
/*************************************************************************/

	$D->site_keywords = $C->SITE_TITLE.', '.$C->SITE_KEYWORDS;
	$D->site_description = $C->SITE_TITLE.', '.$C->SITE_DESCRIPTION;

/*************************************************************************/

	$D->ApplyScrollInf = 1;

/*************************************************************************/
?>