Beispiel #1
0
<?
	require("include/main/DcWebManager.inc.php");
	require("include/main/DcFriendManager.inc.php");
	require("include/main/smartyInit.inc.php");
	require("include/main/DcUnitConverter.inc.php");
	require("include/main/DcLoginManager.inc.php");
	
	$lm = new DcLoginManager();
	$lm->checkLogin();

	//user logged in if we get to this point
	$uId = $lm->getLoggedUserId();	
	
	$fm = new DcFriendManager();
	//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;
		}
	}
		
	$smarty = smartyInit();

	$sId = $_GET['s'];
Beispiel #2
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();	
	
	$manager = new DcWebManager();
	$fm = new DcFriendManager();
		
	$form = "friendRequests.php";
	
	$friendId = $_GET['u'];
	$auth = $_GET['a'];
	
	if (!($friendId && $auth))
	{
		header("Location: ".$form);
	}
	else 
	{
		if ($auth == 1)
		{
			$fm->authorizeFriendRequest($userId, $friendId);
		}
		if ($auth == -1)
		{
			$fm->declineFriendRequest($userId, $friendId);
		}
Beispiel #3
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');
?>
Beispiel #4
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");		
	}