<?php

// -----------------------------------------------------------------------
// This file is part of aroundme
// 
// Copyright (C) 2003, 2005 Barnraiser
// http://www.barnraiser.org/
// info@barnraiser.org
// 
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option) any
// later version.
// 
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with program; see the file COPYING. If not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
// -----------------------------------------------------------------------

include_once "inc/header.inc.php";
$menu_section = "network"; //sets menu in default template


if (isset($_REQUEST['user_id'])) {
	$user_id = $_REQUEST['user_id'];
}
else {
	$user_id = $me['user_id'];
}

//setup social network
require_once($c_node['dir']['class_path'] . 'SocialNetwork.class.php');
$sn = new Socialnetwork($me['user_id'], $db, $c_node['node']['node_id'], $c_node['sn']['max_degree']);
$sn->relation_type_ids = $c_node['user']['relation_type'];
$sn->status_ids = $c_node['user']['status'];
$sn->tree = $_SESSION['s_social_network'];


//user details
$user->user_id = $user_id;
$degree_path = $sn->getDegree($user_id);


//we check that the user has not blocked me or if we have no relationship path
if (!$sn->checkUserBlocked($user_id)) {
	$page_name[0] = "err_not_in_sn";
	include "inc/footer.inc.php";
	exit;
}
else {

	//we get the profile id from the sn table
	if (!empty($degree_path)) {
	   $degree_profile = $user->getDegreeProfiles($degree_path['degree']);
	}
	
	if (!empty($degree_profile[0]['profile_id'])) {
		$user->profile_id = $degree_profile[0]['profile_id'];
	}
	
	$output_profile = $user->getProfile();

}


//setup file
$file->noimage = $c_node['file']['image']['thumb'][1]['noimage'];
$file->thumb = $c_node['file']['image']['thumb'][1]['name'];


//setup file
if (isset($output_profile['file_id'])) {
	$file->file_id = $output_profile['file_id'];
	$output_profile['image'] = $file->getFileRecord();
}
if (isset($output_profile) && empty($output_profile['image'])) {
	$output_profile['image']['file_title'] = "";
	$output_profile['image']['file'] = $file->noimage;
}


//append language setup
require_once($languageArrayPath . 'arr_user.lang.php');
require_once($languageArrayPath . 'arr_schedule.lang.php');


require_once($c_node['dir']['class_path'] . 'Statistic.class.php');
//setup statistics
$statistic = new Statistic($db, $c_acs['arr_section']['user'], $date);
$statistic->section_item_id = $user_id;
$statistic->user_id = $user_id;
$output_statistic = $statistic->getStatistics();

?>
