<?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_NAME", $user['real_name'], true);
	define("UA_USER_SURNAME", $user['real_surname'], true);
	define("UA_USER_EMAIL", $user['email'], true);
	$update_ua["name"] = text_filter(ucfirst($_POST["name"]), 1);
	$update_ua["surname"] = text_filter(ucfirst($_POST["surname"]), 1);
	$update_ua["email"] = text_filter($_POST["email"], 1);

	if($_SERVER['REQUEST_METHOD'] == "POST")
	{
		$admin_session->updatehmua($get["id"], $update_ua["name"], $update_ua["surname"], $update_ua["email"]); 
	}

	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(338));
		$template_session->loadlogo(); 
		$template_session->loadmenu(); 
		if($engine_session->getuserrights("EDIT_USER_ACCOUNT"))
		{
			if($engine_session->profileuserexists(''.UA_USERNAME.'') != 0)
			{
				$template_session->loadtpl("hm_eua");
			}
			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();
	}
?>