<?php
/*
  if($thisPage != "ajax" && $thisPage != "activate" && isset($user['id']) && $user['act'] == 0)
	{
	require(MODULE."activate/index.php");  #Проверка на email [status: off]
	}  
*/
	
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru">
	<head>
	    <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"> 
        <title><?=(isset($title) ? $title : 'Vineti общения ' )?></title>
		<meta name="generator" content="<?=$config['META_GENERATOR']?>" />
		<meta name="keywords" content="<?=$config['META_KEYWORDS']?>" />
		<meta name="description" content="<?=$config['META_DESCRIPTION']?>" />
		<meta name="author" content="<?=$config['META_AUTHOR']?>" />
		<meta name="reply-to" content="<?=$config['META_REPLY_TO']?>" />
		<meta name="copyright" content="<?=$config['META_COPYRIGHT']?>" />
		<meta http-equiv="Cache-Control" content="no-cache">
        <link rel="shortcut icon" href="/template/icons/favicon.ico" type="image/x-icon">
        <link rel="stylesheet" href="/template/css/main.css?v=<?= filemtime(ROOT . 'template/css/main.css') ?>" type="text/css" />
		<link rel="stylesheet" href="/template/css/app.css?9" type="text/css" />
		<link rel="stylesheet" href="/template/css/SmileButton.css?v=9" type="text/css" />
		<link rel="stylesheet" href="/template/css/nprogress.css" type="text/css" />
		<link rel="stylesheet" href="/template/css/jquery.formstyler.css" type="text/css" />
		<link rel="stylesheet" href="/template/css/font-awesome.css">
		<link rel="stylesheet" href="/template/css/redesing.css">
		<link rel="stylesheet" href="/template/css/mailcss.css">
        <link rel="stylesheet" href="/template/css/slick.css">

		<!--<link rel="stylesheet" href="/template/css/ng.css">--> <!-- Нг стиль -->
	    <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
		<script src="/template/js/TimerVisibl.js?v=2" type="text/javascript"></script>
		<script type="text/javascript" src="/template/audio/js/mainAudio.js?v=<?= filemtime(ROOT . 'template/audio/js/mainAudio.js') ?>"></script>
		<script src="/template/js/main.js?v=<?= filemtime(ROOT . 'template/js/main.js') ?>" type="text/javascript"></script>
		<script src="/template/js/jquery.ajaxRequest.js?v=<?= filemtime(ROOT . 'template/js/jquery.ajaxRequest.js') ?>" type="text/javascript"></script>
		<script src="/template/js/main.ajaxRequest.js?v=<?= filemtime(ROOT . 'template/js/main.ajaxRequest.js') ?>" type="text/javascript"></script>
		<script src="/template/js/jquery.formstyler.min.js" type="text/javascript"></script>
		<script src="/template/js/SmileButton.js?v=<?= filemtime(ROOT . 'template/js/SmileButton.js') ?>" type="text/javascript"></script>
        <script src="/template/js/Stickers.js?v=<?= filemtime(ROOT . 'template/js/Stickers.js') ?>" type="text/javascript"></script>
        <script src="/template/js/nprogress.js?5" type="text/javascript"></script>


       <!-- <script src="/template/js/ng.js?v=filemtime(ROOT.'template/js/ng.js') " type="text/javascript"></script>  Нг js -->
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-113616641-1"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-113616641-1');
</script>


	<?php if(!AJAX) : ?>
       <script>
          var USER = {
          	'id': "<?=( isset($user['id']) ? $user['id'] : 0 )?>",
          	'Page': "<?=( isset($user['id']) ? profile :: getLink($user) : 0 )?>",
          	'time': "<?=time()?>",
          	'title': "<?=(isset($title) ? $title : 'Сайт')?>",
          	'name': "<?=(isset($user['id']) ? profile :: getName($user) : '' )?>",
          	'avatar': "<?=(isset($user['id']) ? profile :: getAvatar($user,'64/') : '' )?>",
          	'access' : "<?=ACCESS?>"
		};
		</script>
   		<?php endif; ?>

</head>
<body>

	<div id="scrollup" class=""></div>	
	<div class="top--pb"></div>
	<div id="top">
	    
		<div class="top--cont">
		    	
	<div class="top--r">
				<?php if(isset($user['id'])) { ?>
				
		 
		
				<a href="<?=profile :: getLink($user)?>">
				<div class="top--flex"><?=profile :: userAvatar($user,3)?> <span><?=profile :: getfirstname($user)?></span></div></a>
				<?php } ?>
			</div>
			<div class="top--flex">
			<div class="top--logo"><a href="/"><img src="/ko.png"></a></div>
			<div class="top--title"><?=(isset($l) ? (isset($lBack) ? "<a href=\"{$lBack}\">{$l}</a>" : "<span>".$l."</span>") : '' )?></div>
			</div>
		</div>
	</div>
	
	
	

<!--
<div id="garland" class="garland_1"><div id="nums_1">3</div></div> Нг Вывод -->




	<div id="container">
  
  <!-- Панель для Phone -->
    <div id="head">
		<table style="width: 100%;" cellspacing="0" cellpadding="0"><tbody><tr>
			<?php
			if(isset($user)) {
				
				?>

			<td class="head-td">
				<a href="/" onclick="UI.sidebarToggle(); return false;"><img src="/ko11.png" style="width:27px"></a>
			</td>
			
            <td class="head-td">
                <a href="/mail/">
                    <i class="fa fa-envelope fa-3x"></i>
                    <span id="update_msg_head_wap">
                        <?
                        $new_msg = DB::$pdo -> querySingle("SELECT COUNT(*) FROM `mail` AS m,
		        (SELECT MAX(id) AS id FROM `mail` WHERE `unlink` != :id AND (`id_kont` = :id) GROUP BY IF(`id_user` = :id, `id_kont`, `id_user`)) as max
		        WHERE m.id = max.id AND m.read = '0' AND (m.id_kont = :id) AND m.unlink != :id", array(':id'
		         => $user['id']));
                        $new_notice = DB::$pdo->querySingle("SELECT COUNT(id) FROM `notices` WHERE `id_user` = ? AND `read` = '0' LIMIT 1", [$user['id']]);
                        ?>
                            <span class="head-count" style="<?= ($new_msg > 0 ? '' : 'display:none')?>">
                                <?
                                if ($new_msg > 99)
                                {
                                    echo '99+';
                                } else {
                                    echo $new_msg;
                                }
                                ?>
                            </span>

                    </span>
                </a>
            </td>
			<td class="head-td">
				<a href="/notice?tab=2"><i class="fa fa-bell fa-3x "></i>
				<span id="update_notice_head_wap">

                            <span class="head-count" style="<?= ($new_notice > 0 ? '' : 'display:none')?>">
                                <?
                                if ($new_notice > 99)
                                {
                                    echo '99+';
                                } else {
                                    echo $new_notice;
                                }
                                ?>
                            </span>
				</span>
				</a>
			</td>
			<td class="head-td">
				<a href="<?=profile :: getLink($user)?>"><img src="<?=profile :: getAvatar($user,3)?>" style="width: 26px;border-radius: 50%;"/></a>
			</td>		
			<?php } else { ?>
			<td class="head-td">
				<a href="/"><img src="/template/icons/logo1.png" /></a>
			</td>
			<?php } ?>
		</tr></tbody></table>
	</div>

	<!-- THE END -->

<!-- Sidebar for vineti-->
	<div id="sidebar">
		<div class="sidebar-main">
			<div class="sidebar--links">
			<?php if(isset($user['id'])) { ?>
			<div>
                        <a href="/" class="sidebar--link">
                            <i class="fa fa-server fa-2x fa-mob"></i>
                            <div class="sidebar--text">
                                Главная 
                               
                            </div>
                        </a>
                    </div>
				 <div>
                        <a href="/mail/" class="sidebar--link">
                            <i class="fa fa-envelope fa-2x fa-mob"></i>
                            <div class="sidebar--text">
                                <?=language::text('mail', $language,'sidebar');?> 
                                <span id="update_msg_head_web" style="margin-left: 5px;">
                                    <div class="sidebar--count" style="<?= ($new_msg > 0 ? '' : 'display:none') ?>"><?echo $new_msg;?></div>
                                </span>
                            </div>
                        </a>
                    </div>
				 <div>
                     <a href="/notice?tab=2" class="sidebar--link">
                       <i class="fa fa-bell fa-2x fa-mob"></i>
                        <div class="sidebar--text">
                            <?=language::text('notice', $language,'sidebar');?>
                            <span id="update_notice_head_web" style="margin-left: 5px;">
                                <div class="sidebar--count" style="<?= ($new_notice > 0 ? '' : 'display:none') ?>"><?echo $new_notice;?></div>
                            </span>
                        </div>
                     </a>
				 </div>
				 
				 		 <div>
                     <a href="/news/" class="sidebar--link">
                       <i class="fa fa-newspaper-o fa-2x fa-mob"></i>
                        <div class="sidebar--text">
                         <?=language::text('news', $language,'sidebar');?>
                          
                        </div>
                     </a>
				 </div>
				 
				 

<div>
                     <a href="/audio" class="sidebar--link">
                        <i class="fa fa-music fa-2x fa-mob"></i>
                        <div class="sidebar--text">
                            <?=language::text('music', $language,'sidebar');?>
                            
                        </div>
                     </a>
				 </div>
				 <div id="lm_player" class="lm_player">
                     <div class="sidebar--link">
                        <div id="lm_audio" class="audio_item ai_current al_player">
                            <div class="ai_body">
                                <div class="ai_label">
                                    <div class="ai_title"></div>
                                    <span class="dividers"> – </span>
                                    <div class="ai_artist"></div>
                                </div>
                                <div>
                                    <div class="audio_prev" onclick="audio.prev();">
                                        <i class="icon"></i>
                                    </div>
                                    <div class="audio_play" onclick="audioplayer.playPause();">
                                        <i class="icon"></i>
                                    </div>
                                    <div class="audio_repeat" onclick="audio.repeat();">
                                        <i class="icon"></i>
                                    </div>
                                    <div class="audio_next" onclick="audio.next();">
                                        <i class="icon"></i>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                 </div>
				
				<?php  } else { ?>
				 <div><a href="/" class="sidebar--link">
				  <i class="fa fa-sign-in fa-2x fa-mob"></i>
				  	<div class="sidebar--text"><?=language::text('aut', $language,'sidebar');?> </div>
				 </a></div>
				 <div><a href="/signup" class="sidebar--link">
				 <i class="fa fa-user-plus fa-2x fa-mob"></i>
				  	<div class="sidebar--text"><?=language::text('reg', $language,'sidebar');?> </div>
				 </a></div>
				 <div><a href="/audio" class="sidebar--link">
				 <i class="fa fa-music fa-2x fa-mob"></i>
				  	<div class="sidebar--text"><?=language::text('music', $language,'sidebar');?> </div>
				 </a></div>
				  <div><a href="/info/" class="sidebar--link">
				<i class="fa fa-info-circle fa-2x fa-mob"></i>
				  	<div class="sidebar--text">Информация</div>
				 </a></div>
				<?php } ?>
			
				 <div class="sidebar--line"></div>

				 <div><a href="/arbour" class="sidebar--link">
				 <i class="fa fa-comments-o fa-2x fa-mob"></i>
				  	<div class="sidebar--text"><?=language::text('chat', $language,'sidebar');?></div>
				 </a></div>
				 <div><a href="/people?tab=2" class="sidebar--link">
				<i class="fa fa-users fa-2x fa-mob"></i>
				  	<div class="sidebar--text"><?=language::text('people', $language,'sidebar');?></div>
				 </a></div>
               
                  
                
			<?php if(isset($user['id'])) { ?>
			
			
		
			<div><a href="/groups" class="sidebar--link">
				<i class="fa fa-globe fa-2x fa-mob"></i>
				  	<div class="sidebar--text"><?=language::text('groups', $language,'sidebar');?></div>
				 </a></div>
		
		
		
			
			
			
				<?php if(admin :: getAccess($user,  array('a'=>3))) { ?> <div class="sidebar--line"></div>
					<div><a href="/admin" class="sidebar--link">
				<i class="fa fa-user-secret fa-2x fa-mob"></i>
				  	<div class="sidebar--text"><?=language::text('admin', $language,'sidebar');?></div>
				 </a></div>
<?}?>
			<?php if (isset($user['id']) && DB::$pdo -> querySingle("SELECT COUNT(*) FROM `bag_tracker_users` WHERE `id_user` = '".$user['id']."'") > 0){?> 
					<div><a href="/bag_tracker" class="sidebar--link">
				 	<i class="fa fa-bug fa-2x fa-mob"></i>
				  	<div class="sidebar--text"><?=language::text('bug', $language,'sidebar');?></div>
				 </a></div>

			<?}?>
<?php
if (DB::$pdo -> querySingle("SELECT COUNT(id) FROM `users` WHERE `info_b_d` = '".date('d')."' AND `info_b_m` = '".date('m')." LIMIT 1' ")){?>
	<div class="sidebar--line"></div>		
				 <div><div class="sidebar--link">
				<i class="fa fa-birthday-cake fa-2x fa-mob"></i>
				  	<div class="sidebar--text"><?=language::text('birthday', $language,'sidebar');?></div>
				  	

				  	
				 </div></div>
		
				 				  	  <?php
				  	  $sql = DB::$pdo->query("SELECT * FROM `users` WHERE `info_b_d` = '".date('d')."' AND `info_b_m` = '".date('m')." DESC LIMIT 5' ");

while($a = $sql -> Fetch()) {
    ?>

<a href="<?=profile :: getLink($a)?>" class="sidebar--link">
			
				  	<span style="
    color: #67676e;
    display:  block;
   
    padding-left: 7px;
    
"> <?=profile :: getFullName($a);?></span>
				 </a>




  
    
<?    
}}
				  	  
				  	  ?>
			
			
			
<div class="sidebar--line"></div>
				 <div><a href="/settings" class="sidebar--link">
				<i class="fa fa-gear fa-2x fa-mob"></i>
				  	<div class="sidebar--text"><?=language::text('settings', $language,'sidebar');?></div>
				 </a></div>
				 <div><a data-noajax="" href="/?logout=1&amp;access=<?=$user['access']?>" class="sidebar--link">
				 	<i class="fa fa-power-off fa-2x fa-mob"></i>
				  	<div class="sidebar--text"><?=language::text('exit', $language,'sidebar');?></div>
				 </a></div>


	


				<?php } ?>
				
				 <div class="sidebar--foot">
				 <?$lang_config = parse_ini_file(CORE.'languages/'.$language.'/config.ini');?>
	<a href="/language" style="color: #81898e;">Язык: <?echo $lang_config['name'];?></a><br>
				 	&copy; <?=$config['SITE_COPY']?>, <?=date("Y")?> <br />
				 	<a href="http://statok.net/go/19088"><img src="//statok.net/imageOther/19088" alt="Statok.net" /></a>
				 </div>

			</div>
		</div>
	</div>

<!-- THE END -->


<!-- Основа -->
<div id="main">
<?php
    if(isset($l)) {?>
	<?=(isset($lBack) ? "<a href=\"{$lBack}\" id=\"app-ajax-back\" style=\"text-decoration: none;\">" : '')?>
<div id="location">
	<?=$l?>
</div>
<?=(isset($lBack) ? "</a>" : '')?>
<?php
}
echo system :: notes();
?>
       