Ejemplo n.º 1
0
	{
		if (!$fm->isFriend($uId, $u))	//trying to view someone elses profile
		{ 
			header("Location: day.php");
		}
		else 
		{
			$uId = $u;
		}
	}
		
	$smarty = smartyInit();

	$sId = $_GET['s'];

	$manager = new DcWebManager();
	$user = $manager->loadUser($uId);
	$s = $manager->getSession($sId);
	
	if (!$manager->isSessionOwnedByUser($sId, $uId))
	{
		//make sure session belongs to user
		$err[0] = "You do not have permission to view this session.";
		$smarty->assign('errors', $err );
		$smarty->display('error.tpl');
	}
	
	else 
	{
		$device = $manager->getDevice($s->deviceId);
		
Ejemplo n.º 2
0
<?
	require("include/main/DcWebManager.inc.php");
	require("include/main/smartyInit.inc.php");
	require("include/main/DcUnitConverter.inc.php");
	require("include/main/DcLoginManager.inc.php");
	require("include/main/DcFriendManager.inc.php");
	
	$lm = new DcLoginManager();
	$lm->checkLogin();
	$userId = $lm->getLoggedUserId();	
	$smarty = smartyInit();
	$manager = new DcWebManager();
	
	$fm = new DcFriendManager();
	$requests = $fm->getFriendRequests($userId);
	
	$users = array();
	for ($i=0; $i<count($requests); $i++)
	{
		$usr = $manager->loadUser($requests[$i]);
		array_push($users, $usr);
	}
	
	$smarty->assign('users', $users);	
	$smarty->display('friendRequests.tpl');
?>
Ejemplo n.º 3
0
		if (!$fm->isFriend($uId, $u))	//trying to view someone elses profile
		{ 
			header("Location: month.php");
		}
		else 
		{
			$uId = $u;
		}
	}
	
			
	$distUnit = "km";
	$timeUnit = "h";
	$velUnit = "km/h";
	
	$manager = new DcWebManager();
	$user = $manager->loadUser($uId);
	
	$smarty = smartyInit();
		
	$startStamp = $_GET['t'];	//the first day of the week. 
	if (!$startStamp)
		$startStamp = time();	//default to today
	
	$year = date("Y", $startStamp);
	$month = date("n", $startStamp);
	$day = date("j", $startStamp);
	$cal = new ActiveCalendar($year,$month);	
	if ($uId == $lm->getLoggedUserId()) 
		 $cal->enableDayLinks("day.php");
	$cal->enableMonthNav("month.php?u=".$uId);
Ejemplo n.º 4
0
	//handle friend param
	$u = $_GET['u'];
	if ($u)
	{
		if (!$fm->isFriend($uId, $u))	//trying to view someone elses profile
		{ 
			header("Location: day.php");
		}
		else 
		{
			$uId = $u;
		}
	}
	
	$numSessions = 10;
	$manager = new DcWebManager();
	$sessions = $manager->getLastSessions($uId, $numSessions);
	$user = $manager->loadUser($uId);
	$smarty = smartyInit();
	
	$convertedSessions = array();
	$distUnit = "km";
	$timeUnit = "h";
	$velUnit = $distUnit . "/" . $timeUnit;
	foreach ($sessions as $sess)
	{
		$s = DcUnitConverter::convertSession($sess, $distUnit, $timeUnit);
		array_push($convertedSessions, $s);
	}
	$sessions = $convertedSessions;
	
Ejemplo n.º 5
0
	if (!$usr)
	{
		$usr = $userId;	//current user profile
		$fullProfile = true;
	}
	else 
	{
		$fullProfile = false;	//no effect yet
		
		if (!$fm->isFriend($userId, $usr))	//trying to view someone elses profile
		{ 
			header("Location: profile.php");
		}
	}
		
	$manager = new DcWebManager();
	$user = $manager->loadUser($usr);
		
	$smarty = smartyInit();
	
	$distUnit = "km";
	$totalDist = $manager->getDistanceSince($usr, 0);
	$totalDist = DcUnitConverter::convertDistance($totalDist, $distUnit);
	$firstSession = $manager->getFirstSession($usr);
	$firstTime = $firstSession->startTime;
	$totalTime = $manager->getTotalTimeSince($usr, 0);
	$totalTime = formatHms(sec2hms($totalTime),1);

	if (!$firstTime) $firstTime = "n/a";
	
	$smarty->assign('distUnit', $distUnit);	
Ejemplo n.º 6
0
<?
	require("include/main/DcLoginManager.inc.php");
	require("include/main/DcWebManager.inc.php");
	
	$u = $_POST['username'];
	$p = $_POST['password'];
	
	$lm = new DcLoginManager();
	$manager = new DcWebManager();
	$v = $lm->validateUser($u, $p);
	
	if (!$v)
	{
		header("Location: login.php?e=1");
	}
	else 
	{
		$id = $manager->getUserId($u);
		$lm->loginUser($id);
		header("Location: profile.php");	//TODO: change to home
	}
	
?>
Ejemplo n.º 7
0
<?
	require("include/graph/jpgraph.php");
	require("include/graph/jpgraph_line.php");
	require("include/main/DcWebManager.inc.php");
	require("include/main/DcUnitConverter.inc.php");
	
	$sessId = $_GET['s'];
	if (!$sessId)
	{ 
		die();
	}

	$manager = new DcWebManager();
	$session = $manager->getSession($sessId);
	
	//TODO: make sure session belongs to user
	
	$session = DcUnitConverter::convertSession($session, "km", "h");
	$ydata = $session->velPoints;
	if (count($ydata) > 1)
	{
		// Create the graph. These two calls are always required
		$graph = new Graph(350,180,"auto");	
		$graph->SetScale("textlin");
		// Create the linear plot
		$lineplot=new LinePlot($ydata);
		$lineplot->SetColor("green");
		// Add the plot to the graph
		$graph->Add($lineplot);
		$title = new Text("Session Velocity");
		//$title->SetFont(FF_ARIAL);
Ejemplo n.º 8
0
<?
	require("include/main/DcWebManager.inc.php");
	require("include/main/DcLoginManager.inc.php");
	require("include/main/DcFriendManager.inc.php");
	
	$lm = new DcLoginManager();
	$lm->checkLogin();
	$userId = $lm->getLoggedUserId();	
	
	$form = "addFriend.php";
	
	$email = $_POST['email'];
	$manager = new DcWebManager();
	$fm = new DcFriendManager();
		
	if (! ($email))
	{
		header("Location: ".$form."?e=1");
	}
	else if (! $manager->getUserIdByEmail($email))
	{
		header("Location: ".$form."?e=2");
	}
	else 
	{
		$friendId = $manager->getUserIdByEmail($email);
		
		//TODO: not checking if already friends
		$fm->addFriendRequest($userId, $friendId);
		header("Location: friends.php");		
	}
Ejemplo n.º 9
0
<?
	include("include/main/DcWebManager.inc.php");

	//test loadUser
	$manager = new DcWebManager();
	$usr = $manager->loadUser(1);
	//print_r($usr);
	
	//test getUserId
	$id = $manager->getUserId("demo");
	//print $id;
	
	//test saveUser
	$usr->weight = 200;
	//$manager->saveUser($usr);
	
	//test getSessions & velocity points
	$sessions =	$manager->getSessions($id);
	$sess = $sessions[0];
	$pts = $sess->velPoints;
	//print_r($pts);
	
	//test getSessions with datetime limits
	$earlyDate = date("Y-m-d H:i:s");
	$lateDate =  date("Y-m-d H:i:s");
	$sessions =	$manager->getSessions($id, "", "");
	dump($sessions);
?>
Ejemplo n.º 10
0
	if (! ($userName && $password && password2 && 
		lastName && firstName && email && age && sex && 
		height && weight && displayName /*&& displayPicture */
		&& description))
	{
		header("Location: registerUser.php?e=1");
	}
	else if ($password != $password2)
	{
		header("Location: registerUser.php?e=2");
	}
	else 
	{
		$user = new DcUser("", $userName, $lastName, $firstName, 
			$email, $age, $sex, $height, $weight, 
			$displayName, $displayPicture, $description,"", $password);
		
		//TODO: make sure user doesnt exist with that username or email
		$manager = new DcWebManager();
		$manager->addUser($user);
		
		/* log the user in */
		$id = $manager->getUserId($userName);
		$lm = new DcLoginManager();
		$lm->loginUser($id);
		
		header("Location: profile.php");		
	}


?>