<?php
	/* WebWall */
	define("ADMIN", 1);
	require_once '../core.php';
	checkuserloggedoff();
	define("IN_TAB", "tab-[4]", true);
	$get["id"] = text_filter($_GET["id"], 1);
	$setUsername["ByID"] = $engine_session->getusernamebyid($get["id"]);
	define("UA_USERNAME", $setUsername["ByID"], true);
	$user = $engine_session->getuserdata(UA_USERNAME, "*");
	define("UA_USER_WEBSITE", $user['website'], true);
	define("UA_USER_LOCALIZATION", $user['localization'], true);
	define("UA_USER_BIO", $user['bio'], true);
	define("UA_USER_WA", $user['what_ask'], true);
	define("POINTS", $user['points'], true);
	$update_ua["website"] = text_filter($_POST["website"], 1);
	$update_ua["location"] = text_filter(ucfirst($_POST["location"]), 1);
	$update_ua["bio"] = text_filter(ucfirst($_POST["bio"]), 1);
	$update_ua["u_status"] = text_filter(ucfirst($_POST["u_status"]), 1);
	$update_ua["points"] = text_filter($_POST["points"], 1);

	if($_SERVER['REQUEST_METHOD'] == "POST")
	{ 
		$admin_session->updatehmup($get["id"], $update_ua["points"], $update_ua["website"], $update_ua["location"], $update_ua["bio"], $update_ua["u_status"]); 
	}

	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("UID", $get["id"], true);
		$template_session->loadhead($template_session->getlangval(337));
		$template_session->loadlogo(); 
		$template_session->loadmenu(); 
		if($engine_session->getuserrights("EDIT_USER_PROFILE"))
		{
			if($engine_session->profileuserexists(''.UA_USERNAME.'') != 0)
			{
				$template_session->loadtpl("hm_eup");
			}
			else
			{
				$template_session->addline("<div id='content'>");
				readparameter(serializehmtabs);
				$template_session->addline("<div class='clear'></div>");
				$template_session->addline('<h2>'.$template_session->getLang(396).'</h2>');
				$template_session->addline('<p>'.$template_session->getLang(397).'');
				$template_session->addline('</div>');
			}
		}
		else
		{
			$template_session->loadtpl("hm_permission");
		}
		$template_session->addline("</div>");
		$template_session->addline("</div>"); 
		$template_session->loadtpl("footer");
		$template_session->loadend();
	}
	else
	{
		$engine_session->headerin();
	}
?>