<?php $root=$_SERVER['DOCUMENT_ROOT'];$wroot=dirname($_SERVER['SCRIPT_NAME']);while((strlen($wroot)>1)&&(!file_exists($root.$wroot.'/main')))$wroot=dirname($wroot);if($wroot=='/')$wroot='';require_once($root.$wroot.'/main/app/App.php');
if (!$app->privileged('social')) $app->nopage('social');
else{
	$app->heads('Profile');
	$app->header();
	$user=$app->findUser($_GET['user']);
	$icon="/main/users/{$user['user']}/avatar.png";if (!file_exists($app->froot.$icon)) $icon="/main/assets/icons/anonymous.png";
?>

<section>
	<h1>USER PROFILE</h1>
	<article>
<?php if ($user!==false){ ?>
		<h1 class='article'><?php echo $user['user']; ?></h1>
		<?php echo "<img style='width:10rem;' src='{$app->wroot}$icon' />"; ?>
		<h3>(<?php echo $user['type']; ?>)</h3>
		<h5>Joined at <?php echo date('g:ia \o\n \t\h\e jS \of M Y',strtotime($user['date']));	?></h5>
<?php }else{ ?>
		<h1 class='article'>NO USER</h1>
		<h3>You are looking for the profile of a user who does not exist.</h3>
<?php } ?>
	</article>
</section>

<?php
	$app->footer();
	$app->tails();
}
?>
