<?php
	
	include_once __DIR__ . '/include/common.php';
	include_once __DIR__ . '/include/general_functions.php';
	include_once __DIR__ . '/include/utils.php';	
	include_once __DIR__ . '/include/user.php';
	
	if ( ! @$user)
			redirect('/');
	
	$params	=	[];
	
	if (isset ($_GET['id']))
	{
		
		$info	=	get_user(
			$_GET['id']
		);
		
		if ( ! $info)
			redirect('/');
		
	}
	else
	{
		
		$info	=	$user;
		
	}
	
	
	$params['title']	=	$info['id'] == $user['id'] ? 'Усиления' : sprintf(
		'Усиления %s',
		$info['login']
	);
	
	ob_start();
	
	include_once __DIR__ . '/include/header.php';
	
	?>
	
	<ul class='menu'>
		<li><img src='/images/icon/premium.png' alt='' /> <a href='/lab?act=premium'>Благославение</a><?=( ! premium_exists($info['id']) ? ' <span class="c_green">(+)</span>' : '')?></li>
		<li>
	<?php
		
		if (premium_exists($info['id']))
		{
			
			$timeleft	=	get_premium_timeleft($info['id']);
			
	?>
		<span class='c_blue'>Осталось:</span> <?=timeleft($timeleft)?></span>
	<?php
	
		}
		else
		{
	?>
		<span class='c_grey'>Благославение не активировано</span>
	<?php
		}
		
	?>
		</li>
		<li><img src='/images/icon/premium.png' alt='' /> <a href='/effshop'>Усиления персонажа</a><?=( ! eff_exists($info['id'], 10) && ! eff_exists($info['id'], 11) && ! eff_exists($user['id'], 12) ? ' <span class="c_green">(+)</span>' : '')?></li>
	<?php
		
		if (eff_exists($info['id'], 10) || eff_exists($info['id'], 11) || eff_exists($user['id'], 12))
		{
			
			if (eff_exists($info['id'], 10))
			{
				$timeleft	=	get_eff_timeleft($info['id'], 10);
	?>
		<li>
			<b>Основной эффект</b><br />
			<span class='c_blue'>Осталось:</span> <?=timeleft($timeleft)?>
		</li>
	<?php
			}
			
			if (eff_exists($info['id'], 11))
			{
				
				$timeleft	=	get_eff_timeleft($info['id'], 11);

	?>
		<li>
			<b>Боевой эффект</b><br />
			<span class='c_blue'>Осталось:</span> <?=timeleft($timeleft)?>
		</li>
	<?php
				
				
			}

			if (eff_exists($info['id'], 12))
			{
				$timeleft	=	get_eff_timeleft($info['id'], 12);
	
	?>
		<li>
			<b>Добывающий эффект</b><br />
			<span class='c_blue'>Осталось:</span> <?=timeleft($timeleft)?>
		</li>
	<?php

	
			}

	?>
	
	<?php
		}
		else
		{
	?>
		<li class='c_grey'>Эффекты не активны</span></li>
	<?php
		}
	?>
	</ul>
	
	<?php
	
	
	include_once __DIR__ . '/include/footer.php';
	
	setContentType('text/html; charset=UTF-8');
	render(
		__DIR__ . '/include/template.php',
		ob_get_clean(),
		$params
	);
	
	?>
	