<?php
	$id = (isset($_GET['id']) ? intval($_GET['id']) : 0 );
	$d = profile :: getUser($id);

	admin :: access(array('a'=>1));

	$level = admin :: getLevel($d);

	if(isset($_POST['cfms'])) {
		if(intval(@$_POST['access']) == ACCESS) {
		
			$online = ($d['vertification'] == 0 ? 1 : 0);
		  
			DB :: $pdo -> query("UPDATE `users` SET `vertification` = ? WHERE `id` = ? LIMIT 1;", array($online,$d['id']));
			system :: redirect("Успешно включено!", $thisLink."/?act=user/function&id={$d['id']}");
		} else { $errorP = "Вероятно вам подкинули данную ссылку."; }
	}
	$title = $l = "Панель управления - Функции ";
$lBack ="/admin/?act=user/info&amp;id=".$d['id']."";

require (CORE."head.php");
	echo "<div class=\"app-block\">";
	echo system :: touch(profile :: getLink($d),"
			<div class=\"post-l emotion-show\" data-emotions=\"".system::textOut($d['emotions'])."\">
				".profile :: userAvatar($d,0)."
			</div>
			<div class=\"post-c\">
				<div class=\"_name\">".profile :: getFullName($d, true)."</div>
				<div class=\"_gray\">Время на сайте: ".profile :: onlineTime($d['online_time'])."</div>
				<div class=\"_gray\">Дата регистрации: ".system :: times($d['first_time'])."</div>
				<div class=\"_gray\">Блокировок: ".$d['count_blocks']."</div>
			</div>
			"); 
	?>

		<div class="list">
		<div class="sw-block_"><div class="sw-cont sw-3">
			<div class="sw-item"><a href="/admin/?act=user/edit&amp;id=<?=$d['id']?>" class="sw-c">Редактирование</a></div>
			<div class="sw-item"><a href="/admin/?act=user/level&amp;id=<?=$d['id']?>" class="sw-c">Должность</a></div>
			<div class="sw-item"><a href="/admin/?act=user/function&amp;id=<?=$d['id']?>" class="sw-c sw-act">Функции</a></div>
		</div></div>
		</div>
	
	<form method="post" action="">
<div class="list _gray">Верификация</div>
		<div class="list _bg-blue">
			<div><label class="_gray _dbl">
				<input name="adm" type="radio" value="0"<?=($d['vertification'] == 0 ? "checked=\"checked\"" : '' )?> /> Выключена
			</label></div>
			<div><label class="_gray _dbl">
				<input name="adm" type="radio" value="1"<?=($d['vertification'] == 1 ? "checked=\"checked\"" : '' )?> /> Включена
			</label></div>
		
		</div>
		<input type="hidden" name="access" value="<?=ACCESS?>">
		<div class="_center list">
			<input type="submit" class="main-btn _w-100" name="cfms" value="Сохранить">
		</div>
	</form>
	<?php
	echo system :: back("/admin/?act=user/info&amp;id={$d['id']}","Информация", true);
	echo "</div>";
	require (CORE."foot.php");