<?php
	/* WebWall */
	define("ADMIN", 1);
	require_once '../core.php';
	checkuserloggedoff();
	define("IN_TAB", "tab-[4]", true);
	define("THIS_USER", $engine_session->getusernamebyid($_GET["id"]));
	define("THIS_USER_ID", text_filter($_GET["id"], 1));
	$get["action"] = text_filter($_GET["act"], 1);
	$get["giftid"] = $_GET["giftid"];
	$type = text_filter($_POST["gifttype"], 1);
	$giftid = text_filter($_POST["giftid"], 1);
	$fromuser = text_filter($_POST["fromuser"], 1);
	$touser = text_filter($_POST["touser"], 1);
	$touserid = text_filter($_POST["touserid"], 1);
	$text = text_filter($_POST["text"], 1);
	
	if($get["action"] == "remove") 
	{ 
		$admin_session->removeusergift($get["giftid"], $_GET["userid"]); 
	}
	if($_SERVER['REQUEST_METHOD'] == "POST")
	{ 
		$admin_session->addusergift($giftid, $type, $fromuser, $touser, $text, $touserid);
	}

	if($engine_session->getuserrights("ADM") || $engine_session->getuserrights("MOD") && $engine_session->getuserrights("FREE_HM_ACCESS"))
	{
		$template_session->setparameter("serializeHmTabs", $admin_session->serializehmtabs(''.IN_TAB.''), true);
		$template_session->setparameter("getallgifts", $engine_session->getallgifts(), true);
		$template_session->setparameter("getusergifts", $admin_session->getusergifts(THIS_USER, $_GET["id"]), true);
		$template_session->loadhead($template_session->getlangval(817));
		$template_session->loadlogo(); 
		$template_session->loadmenu(); 
		if($engine_session->getuserrights("VIEW_RANKS"))
		{
			$template_session->loadtpl("hm_user_gifts");
		}
		else
		{
			$template_session->loadtpl("hm_permission");
		}
		$template_session->addline('<div id="footerspace"></div>');
		$template_session->addline("</div>");
		$template_session->addline("</div>"); 
		$template_session->loadtpl("footer");
		$template_session->loadend();
	}
	else
	{
		$engine_session->headerin();
	}
?>