<?php
	/* WebWall */
	define("ONLINE", 1);
	$root = dirname( dirname( dirname(__FILE__) ) );
	require_once "$root/core.php";
	checkuserloggedoff();

	define("SETTINGS_WEBSITE", $engine_session->getuserdata(USER_USERNAME, "WEBSITE"), true);
	define("SETTINGS_LOCALIZATION", $engine_session->getuserdata(USER_USERNAME, "LOCALIZATION"), true);
	define("SETTINGS_BIO", $engine_session->getuserdata(USER_USERNAME, "BIO"), true);
	define("SETTINGS_USER_STATUS", $engine_session->getuserdata(USER_USERNAME, "USER_STATUS"), true);

	define("PHOTO_URL", $engine_session->getuserdata(''.USER_USERNAME.'', "PHOTO"), true);
	define("COVER_URL", $engine_session->getuserdata(''.USER_USERNAME.'', "COVER"), true);

	if($_SERVER['REQUEST_METHOD'] == "POST")
	{ 
		if($_POST['img']=='photo')
		{
			$photo_file = $_FILES["photo"];
			$engine_session->updateuserphoto($photo_file); 
		}
		else if($_POST['img']=='cover')
		{
			$photo_file = $_FILES["photo"];
			$engine_session->updateusercover($photo_file);
		}
		else if($_POST['img']=='none')
		{
			$update["website"] =  text_filter($_POST["website"], 1);
			$update["location"] =  text_filter(ucfirst($_POST["location"]), 1);
			$update["bio"] =  text_filter(ucfirst($_POST["bio"]), 1);
			$update["status"] =  text_filter(ucfirst($_POST["status"]), 1);
			$engine_session->updateuserprofile($update["website"], $update["location"], $update["bio"], $update["status"]);
		}
	}

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