<?php
	/* WebWall */
	define("ONLINE", 1);
	$root = dirname( dirname( dirname(__FILE__) ) );
	require_once "$root/core.php";
	checkuserloggedoff();
	define("SETTINGS_USERNAME", $engine_session->getuserdata(USER_USERNAME, "USERNAME"), true);
	define("SETTINGS_REALNAME", $engine_session->getuserdata(USER_USERNAME, "REAL_NAME"), true);
	define("SETTINGS_REALSURNAME", $engine_session->getuserdata(USER_USERNAME, "REAL_SURNAME"), true);
	define("SETTINGS_EMAIL", $engine_session->getuserdata(USER_USERNAME, "EMAIL"), true);
	define("SETTINGS_AVIEW", $engine_session->getuserdata(USER_USERNAME, "A_VIEW"), true);
	define("SETTINGS_PASS", $engine_session->getuserdata(USER_USERNAME, "PASS"), true);
	define("SETTINGS_FACEBOOK", $engine_session->getuserdata(USER_USERNAME, "FACEBOOK"), true);
	define("SETTINGS_TWITTER", $engine_session->getuserdata(USER_USERNAME, "TWITTER"), true);
	define("SETTINGS_GOOGLEPLUS", $engine_session->getuserdata(USER_USERNAME, "GOOGLEPLUS"), true);
	define("SETTINGS_VKONTAKTE", $engine_session->getuserdata(USER_USERNAME, "VKONTAKTE"), true);

	if($_SERVER['REQUEST_METHOD'] == "POST")
	{ 
		$update["name"] = text_filter($_POST["name"], 1);
		$update["password"] = text_filter(strtolower(($_POST["password"])), 1);
		$update["passwords"] = text_filter(strtolower(($_POST["password2"])), 1);
		$update["email"] = text_filter($_POST["email"], 1);
		$update["surname"] = text_filter($_POST["surname"], 1);
		$update["anonymous_view"] = text_filter($_POST["anonymous_view"], 1);
		$engine_session->updateusersettings($update["name"], $update["password"], $update["passwords"], $update["email"], $update["anonymous_view"], $update["surname"]); 
	}

	$template_session->loadhead($template_session->getlangval(102));
	$template_session->loadlogo(); 
	$template_session->loadmenu(); 
	$template_session->loadtpl("acc_profile");
	$template_session->loadtpl("footer");
	$template_session->loadend();
?>