<?

if ($urlPage == '/@') {
	Redirection('/');
}
$link = false;
if (isset($urlType[2])) {
	$link = $urlType[2];
}
$us = user::data($link, 'link');

if (!$link or !$us or is_numeric($link)) {
	$t->assign('link', $link);
	echo $t->fetch('user.view.notpage');
} else {
	$LinkCheck =  strpos($urlPage, 'user/view/') !== false;
	if ($LinkCheck) {
		Redirection('/@'. $us['link']);
	}
}

$us['login'] = output($us['login'],'html');

$us['avatar_big'] = "/files/avatars/big/{$us['avatar']}";
$us['avatar_min'] = "/files/avatars/mid/{$us['avatar']}";
$us['avatar_min'] = "/files/avatars/min/{$us['avatar']}";

$og_image = "{$set['http']}://{$system['urlHost']}/{$us['avatar_big']}";

$us['status'] = output($us['status'],'html');

$PageConfig = [
	'title' => 'Профиль - '. $us['login'],
	'keywords' => 'Профиль - '. $us['login'],
	'description' => $us['status'],	
	'og_image' => $og_image
];
PageConfig($PageConfig);

$us['news_count'] = $sql->rowCount("SELECT * FROM `news` WHERE `id_user` = '{$us['id']}' AND `act` = '1'");
$us['date_create'] = times::out($us['date_create']);
$us['date_last'] = times::out($us['date_last']);
$usernews = [];

$t->assign('usernews', $usernews);
$t->assign('us', $us);
echo $t->fetch('user.view');