<?
///Класс для вывода шапки и футера
class Body{				
///Переменные по умолчанию
	private $title="PHPage.Info - Социальная сеть мастеров!";
	private $description="Скрипты для создания сайтов, интернет-магазинов, хаки, модули, шаблоны для CMS. Помощь в создание и раскрутке сайтов, интернет-магазинов. Помощь в выборе хостинга, регистрация доменных имён. Бесплатный хостинг, дешевый хостинг, отзывы";
	private $keywords="Форум вебмастеров, скрипты, шаблоны, бесплатно, SEO оптимизация, услуги, хостинг, домены, помощь в раскрутке, бесплатная раскрутка, платный хостинг, бесплатный хостинг, IPB, хуки, компоненты, русификация, платные модули opencart бесплатно, модули prestashop";
///Задаем титл
	public function SetTitle($param) {
	return $this->title=$param;	
	}
///Задаем дискр
	public function SetDescription($param) {
	return $this->description=$param;	
	}	
///Задаем ключевые слова
	public function SetKeywords($param) {
	return $this->keywords=$param;	
	}
///Задаем шапку	
	public function GetHeader() {
	ob_start();
	global $b;
        $style = ($b['id']?$b['style']:'green');
	echo'<!DOCTYPE html>
	<html><head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>'.$this->title.'</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta name="description" content="'.$this->description.'" />
	<link rel="author" href="Dario430@yandex.ru" />
	<meta name="keywords" content="'.$this->keywords.'" />
	<link rel="shortcut icon" href="http://'.$_SERVER['HTTP_HOST'].'/images/favicon.ico" type="image/x-icon" />
        <link href="http://'.$_SERVER['HTTP_HOST'].'/assets/bower_components/animate.css/animate.min.css" rel="stylesheet">
        <link href="http://'.$_SERVER['HTTP_HOST'].'/assets/bower_components/material-design-iconic-font/dist/css/material-design-iconic-font.min.css" rel="stylesheet">
        <link href="http://'.$_SERVER['HTTP_HOST'].'/assets/bower_components/lightgallery/src/css/lightgallery.css" rel="stylesheet">
        <link href="http://'.$_SERVER['HTTP_HOST'].'/assets/bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.min.css" rel="stylesheet">
        <link href="http://'.$_SERVER['HTTP_HOST'].'/assets/bower_components/default/applications.css" rel="stylesheet">
        <script src="http://'.$_SERVER['HTTP_HOST'].'/assets/bower_components/jquery/dist/jquery-1.9.1.min.js"></script>';

        echo'
         </head><body>';
if ($b['sneg']==1) { 
echo'<script type="text/javascript">imageDir = "http://'.$_SERVER['HTTP_HOST'].'/assets/images/snow/";sflakesMax = 80;sflakesMaxActive = 80;svMaxX = 2;svMaxY = 1;ssnowStick = 1;ssnowCollect = 0;sfollowMouse = 1;sflakeBottom = 0;susePNG = 1;sflakeTypes = 5;sflakeWidth = 15;sflakeHeight = 15;</script><script type="text/javascript" src="http://'.$_SERVER['HTTP_HOST'].'/assets/js/cache/snow.js"></script>'; }

		echo'
            <header id="header" class="clearfix" data-spy="affix" data-offset-top="65">
              <ul class="header-inner">   
                <li class="logo">
                    <a href="/"><img src="/assets/img/logos2.png" alt=""></a>
                    <div id="menu-trigger"><i class="zmdi zmdi-menu"></i></div>
                </li>';
		if (isset($b)) {
$count_letter = DB::$dbs->querySingle("SELECT COUNT(id) FROM `letters` WHERE `idwho` = ? AND `read` = ?", [$b['id'],0]);
$notice = DB::$dbs->querySingle("SELECT COUNT(id) FROM jurnal WHERE user_id = ? AND type = ?", [$b['id'],1]);
if ($b['level'] >= 1) {
$count_compl = DB::$dbs->querySingle("SELECT COUNT(id) FROM `complaint` WHERE `read` = ?", [1]);
if (!empty($count_compl)) {
$vs = $vs + $count_compl;
}
}
if ($b['level'] > 4) {
$count_pay = DB::$dbs->querySingle("SELECT COUNT(id) FROM `pay` WHERE `type` = ?", [3]);
if (!empty($count_pay)) {
$vs = $vs + $count_pay;
}
}
if ($b['level'] > 4) {
$count_out = DB::$dbs->querySingle("SELECT COUNT(id) FROM `billing_out` WHERE `type` = ?", [0]);
if (!empty($count_out)) {
$vs = $vs + $count_out;
}
$ar = DB::$dbs->querySingle("SELECT COUNT(id) FROM `arbitage` WHERE `status` = ?", [1]);
if (!empty($ar)) {
$vs = $vs + $ar;
}
$supp = DB::$dbs->querySingle("SELECT COUNT(id) FROM `support` WHERE `type` = ?", [1]);
if (!empty($supp)) {
$vs = $vs + $supp;
}
}
if ($b['level']>2) {
$otzyv = DB::$dbs->querySingle("SELECT COUNT(id) FROM otzyvy WHERE activ = ?", [0]);
if (!empty($otzyv)) {
$vs = $vs + $otzyv;
}
}
if ($b['level']>3) {
$ked = DB::$dbs->querySingle("SELECT COUNT(id) FROM ked WHERE type = ?", [0]);
if (!empty($ked)) {
$vs = $vs + $ked;
}
$garant = DB::$dbs->querySingle("SELECT COUNT(id) FROM garant WHERE type = ?", [0]);
if (!empty($garant)) {
$vs = $vs + $garant;
}
}
if ($b['level'] >4) {
$rekl = DB ::$dbs->querySingle("SELECT COUNT(id) FROM billing_rekl WHERE type = ?",[0]);
if (!empty($rekl)) {
$vs = $vs + $rekl;
}
}
if ($b['level'] >= 3) {
$u = DB::$dbs->querySingle("SELECT COUNT(id) FROM blogger WHERE activ = ?", [1]);
if (!empty($u)) {
$vs = $vs + $u;
}
$count_files = DB::$dbs->querySingle("SELECT COUNT(id) FROM `downs` WHERE `mod` = ?", [1]);
if (!empty($count_files)) {
$vs = $vs + $count_files;
}
$codes = DB::$dbs -> query('SELECT `id` FROM `codes_code` WHERE `check` = "0"')  -> rowCount();
if (!empty($codes)) {
$vs = $vs + $codes;
}
}
                
                echo'<!-- Сообщения -->
                <li class="dropdown"><a href="/messages"><i class="zmdi zmdi-email"></i>
                        '; if (!empty($count_letter)) { echo'<i class="hi-count">'.$count_letter.'</i>'; } echo'</a></li>
                    
                <!-- Уведомления -->
                <li class="dropdown"><a href="/journal">
              <i class="zmdi zmdi-notifications"></i>'; if (!empty($notice)) { echo'<i class="hi-count">'.$notice.'</i>'; } echo'</a></li>';
                
                }
                if ($b == false) {  
                echo'<!-- Меню гостя-->
                <li class="pull-right dropdown"><a href="" data-toggle="dropdown">
                        <i class="zmdi zmdi-view-dashboard zmdi-hc-fw"></i></a>
                    <ul class="dropdown-menu">
                        <li><a href="/join">Создать аккаунт</a></li>
                        <li><a href="/login">Вход в аккаунт</a></li>
                        <li><a href="/recovery">Забыли пароль?</a></li>
                    </ul>
                </li>';} else {
                echo'<!-- Вывод приложений -->
                <li class="hidden-xs pull-right dropdown">
                    <a href="" data-toggle="dropdown">
                        <i class="zmdi zmdi-apps"></i>    
                    </a>
                    
                    <div class="dropdown-menu pull-right" id="launch-apps">
                        <div class="dropdown-header bg-teal">Наши приложения</div>
                        <div class="la-body">
                            <div class="lab-item"><a href="/birth" class="bg-red"><i class="zmdi zmdi-calendar"></i>
                                </a><small>Именники</small></div>
                            
                            <div class="lab-item"><a href="/downs" class="bg-green"><i class="zmdi zmdi-file-text"></i>
                                </a><small>Обменник</small></div>
                            
                            <div class="lab-item"><a href="/messages" class="bg-blue"><i class="zmdi zmdi-email"></i>
                                </a><small>Почта</small></div>
                            
                            <div class="lab-item"><a href="/support/" class="bg-orange"><i class="zmdi zmdi-trending-up"></i>
                                </a><small>Тикеты</small></div>
                            
                            <div class="lab-item"><a href="/news/" class="bg-cyan"><i class="zmdi zmdi-view-headline"></i>
                                </a><small>Новости</small></div>

                            <div class="lab-item"><a href="/gallery/" class="bg-teal"><i class="zmdi zmdi-image"></i>
                                </a><small>Галерея</small></div>
                        </div>
                    </div>
                </li>';}echo'
                <!-- Вывод времени -->
                <li class="pull-right">
                    <div id="time">
                        <span id="t-hours"></span>
                        <span id="t-min"></span>
                        <span id="t-sec"></span>
                    </div>
                </li>
            </ul>
        </header>
    
        <aside id="sidebar">
            
            <!--| Главное меню |-->
            <ul class="side-menu">';
if ($b == true) {echo'<li class="sm-sub sms-profile"><a class="clearfix" href="#">';
if (!empty($b['ava'])) {echo'<img src="/' . $b['ava'] . '" alt="">';} else {echo'<img src="/assets/img/4.jpg" alt="">';}
                        echo'<span class="f-11">
                            <span class="d-block">'.$b[ 'name' ].' '.$b[ 'family' ].'</span>
                            <small class="text-lowercase">'.$b[ 'nick' ].'</small>
                        </span></a>
                    <ul>
                        <li><a href="/users/' . $b['id'] . '">Моя страница</a></li>
                        <li><a href="/edit">Редактировать</a></li>
                        <li><a href="/setting">Настройки</a></li>
                        <li><a href="/logout">Выход</a></li>
                    </ul>
                </li>';
} else{
                echo'<li class="sm-sub sms-profile">
                    <a class="clearfix" href="#">
                        <img src="/assets/img/4.jpg" alt="">
                        <span class="f-11"><span class="d-block">Привет, Гость!</span>Пожалуйста, Войдите!</span></a><ul>
                        <li><a href="/join">Регистрация</a></li>
                        <li><a href="/login">Авторизация</a></li>
                        <li><a href="/recovery">Забыли пароль?</a></li>
                    </ul>
                </li>';
}

                echo'<li class="active"><a href="/"><i class="zmdi zmdi-home"></i><span>Главная</span></a></li>';

if ($b['level'] != 0) {echo'<li><a href="/administration"><i class="zmdi zmdi-widgets zmdi-hc-fw"></i><span> Панель управления '.(!empty($vs) ? '<span class="label label-primary">+'.$vs.'</span>':NULL).'</span></a></li>'; }
$d = date("d");
$last = DB::$dbs->querySingle("SELECT COUNT(id) FROM blogger WHERE vis = ?", [$d]);
$ft = DB :: $dbs -> querySingle ("SELECT COUNT(id) FROM `forum_topic`");
$fm = DB :: $dbs -> querySingle ("SELECT COUNT(id) FROM `forum_mess`");
$fff = $ft + $fm;

                     echo'<li><a href="/news/"><i class="zmdi zmdi-widgets"></i>
       <span>Новости ресурса <span class="label label-primary">'.DB :: $dbs -> querySingle ("SELECT COUNT(id) FROM `news`").'</span></span>
                    </a></li>
                <li class="sm-sub"><a href="#">
                        <i class="zmdi zmdi zmdi-view-list"></i>
                        <span>Свежие новости <span class="label label-primary">' . DB :: $dbs -> querySingle ("SELECT COUNT(id) FROM `gazeta_article`") . '</span></span>
                    </a><ul>
                        <li><a href="/allnews/search">Поиск статей</a></li>
                        <li><a href="/allnews/">Новые статьи</a></li>
                    </ul></li>
                <li><a href="/forum"><i class="zmdi zmdi-collection-text"></i><span>Наш форум <span class="label label-primary">' . $fff . '</span></span></a></li>';

                     echo'
                <li class="sm-sub"><a href="">
                        <i class="zmdi zmdi-swap-alt"></i>
                        <span>Наши модули <span class="label label-primary">4</span></span>
                    </a><ul>';
                        echo'<li><a href="/peoples">Пользователи ('.DB::$dbs -> querySingle ("SELECT COUNT(*) FROM `blogger`").')</a></li>
                        <li><a href="/birth">Именинники ('.DB::$dbs->querySingle("SELECT COUNT(id) FROM blogger WHERE birthday LIKE '". date('d.m.') ."%'").')</a></li>
                        <li><a href="/last">Нас посетили ('.$last.')</a></li>
                    </ul></li><li><a href="/downs">
                        <i class="zmdi zmdi-download"></i>
                        <span>Загруз-центр <span class="label label-primary">' . DB::$dbs -> querySingle ("SELECT COUNT(*) FROM `downs` WHERE `mod` = ?",[0]) . '</span></span></a></li>
                <li class="sm-sub">
                    <a href="#">
                        <i class="zmdi zmdi-image"></i>
                        <span>Фотогалерея <span class="label label-primary">' . DB :: $dbs -> querySingle ("SELECT COUNT(id) FROM `album_foto`") . '</span></span>
                    </a>
                    <ul>';
$sql = DB::$dbs->query("SELECT * FROM album_cat ORDER BY id ASC");
if ($sql->rowCount() == 0) {
err('Альбомов нет');
} else {
while($a = $sql -> fetch()) {
echo '<li><a href="/gallery/action.html?id='.$a['id'].'"> '.$a['name'].'</a></li>';
}
}

                    echo'</ul>
                </li>
                <li>
                    <a href="/lenta"><i class="zmdi zmdi-layers"></i>
                        <span>Лента новостей <span class="label label-primary">'. DB::$dbs -> querySingle("SELECT COUNT(id) FROM `lenta`").(empty($new_lenta) ? NULL : '/<b style="COLOR:red">'.$new_lenta.'</b>').'</span></span>
                    </a>
                </li>
                <li class="sm-sub sms-bottom">
                    <a href=""><i class="zmdi zmdi-collection-item"></i>
                        <span>Сервисы сайта <span class="label label-primary">2</span></span>
                    </a><ul>
                        <li><a href="/codes">Полезные коды</a></li>
                        <li><a href="/garants">Список гарантов</a></li>
                    </ul></li>
                <li>
                    <a href="/market">
                        <i class="zmdi zmdi-shopping-cart"></i>
    <span>Онлайн маркет <span class="label label-primary">' . DB::$dbs -> querySingle ("SELECT COUNT(*) FROM `magazin_file`") . '</span></span>
                    </a>
                </li>
<li class="active"><a href="/"><i class="zmdi zmdi-home"></i><span>Мы рекомендуем</span></a></li>';
echo'<li><a href="http://new.vk.com/phpage_info"><i class="zmdi zmdi-home"></i><span>Мы Вконтакте</span></a></li>';
/*
if ($_SERVER['PHP_SELF'] == '/index.php') {
echo '<li><span> ', printAdv('top') ,'</span></li>';
$random = DB ::$dbs->query("SELECT * FROM billing_rekl WHERE gde = ? AND type = ? ORDER BY RAND() DESC",['index',1]); #Рандомный вывод
if($random->rowCount() >0){
	echo '<div class="list-group-item media">';
while($r = $random->fetch()){
	echo '<li><a href="http://'.$r['url'].'"><i class="zmdi zmdi-home"></i> '.$r['name'].'</a></li>';
}
}
} elseif ($_SERVER['PHP_SELF'] != '/') {
echo '<li><span> ', printAdv('down') ,'</span></li>';
$random = DB ::$dbs->query("SELECT * FROM billing_rekl WHERE gde = ? AND type = ? ORDER BY RAND() DESC",['all',1]);
if($random->rowCount() >0){
	echo '<div class="list-group-item media">';
while($r = $random->fetch()){
	echo '<li><a href="http://'.$r['url'].'"><i class="zmdi zmdi-home"></i> '.$r['name'].'</a></li>';
}
}
}
*/
            echo'</ul></aside>';
          echo'<section id="content"><div class="container">';
/*
if (isset($b)) {
if ($b['activ'] == 1) {
$title= new Body;
echo'<div class="tile"><div class="t-header th-alt bg-teal"><div class="th-title"><i class="zmdi zmdi-widgets"></i><a href="/"style="text-decoration:none; color:white;"> Главная</a> :: Активация аккаунта</div></div></div>';
echo '<div class="t-header bg-ace"><div class="th-title"><p>Пожалуйста, подождите... Ваш запрос на регистрацию в очереди обрабатывается... </br>
Ваши регистрационные данные были отправлены на указанный адрес электронной почты.</p></div></div>';
$title->GetMenu();
$title->GetFooter();
die();
} elseif ($b['activ'] == 2) {
$title= new Body;
echo'<div class="tile"><div class="t-header th-alt bg-teal"><div class="th-title"><i class="zmdi zmdi-widgets"></i><a href="/"style="text-decoration:none; color:white;"> Главная</a> :: Активация аккаунта</div></div></div><div class="t-header bg-ace"><div class="th-title"><p>К сожалению, Ваша регистрация была отклонена.</p></div></div>';
$title->GetMenu();
$title->GetFooter();
die();
}
}
*/
	}
///Задаем меню				
	public function GetMenu() { 
?>
<script type='text/javascript'>(function(w,doc) {
if (!w.__utlWdgt ) {
    w.__utlWdgt = true;
    var d = doc, s = d.createElement('script'), g = 'getElementsByTagName';
    s.type = 'text/javascript'; s.charset='UTF-8'; s.async = true;
    s.src = ('https:' == w.location.protocol ? 'https' : 'http')  + '://w.uptolike.com/widgets/v1/uptolike.js';
    var h=d[g]('body')[0];
    h.appendChild(s);
}})(window,document);
</script><div data-background-alpha="0.0" data-buttons-color="#ffffff" data-counter-background-color="#ffffff" data-share-counter-size="12" data-top-button="false" data-share-counter-type="disable" data-share-style="11" data-mode="share" data-like-text-enable="false" data-hover-effect="rotate-cw" data-mobile-view="true" data-icon-color="#ffffff" data-orientation="fixed-right" data-text-color="#000000" data-share-shape="round" data-sn-ids="fb.vk.tw.ok.gp.mr." data-share-size="40" data-background-color="#ffffff" data-preview-mobile="false" data-mobile-sn-ids="fb.vk.tw.wh.ok.vb." data-pid="1532663" data-counter-background-alpha="1.0" data-following-enable="false" data-exclude-show-more="false" data-selection-enable="true" class="uptolike-buttons" ></div>
<?
if ($_SERVER['PHP_SELF']!='/index.php')echo'<div class="tile"><div class="t-header th-alt bg-teal"><div class="th-title"><i class="zmdi zmdi-home"></i><a href="/"style="text-decoration:none; color:white;"> На главную</a> :: <a href="№"onclick="history.back();return false;"style="text-decoration:none; color:white;">Вернуться назад</a></div></div></div>';
echo'</div></section>';
	 }

///Задаем ноги				
	public function GetFooter() {
        	global $b;
	echo'
        <footer id="footer">
            Все права защищены © 2016 '.homeurl.'
            <ul class="f-menu">
                <li><a href="/">Главная</a></li>
                <li><a href="/forum">Форум</a></li>
                <li><a href="/downs">Загрузки</a></li>
                <li><a href="/peoples">Пользователи</a></li>
                <li><a href="/support">Служба поддержки</a></li>
            </ul>
<!-- Rating@Mail.ru counter -->
<script type="text/javascript">
var _tmr = window._tmr || (window._tmr = []);
_tmr.push({id: "2786217", type: "pageView", start: (new Date()).getTime()});
(function (d, w, id) {
  if (d.getElementById(id)) return;
  var ts = d.createElement("script"); ts.type = "text/javascript"; ts.async = true; ts.id = id;
  ts.src = (d.location.protocol == "https:" ? "https:" : "http:") + "//top-fwz1.mail.ru/js/code.js";
  var f = function () {var s = d.getElementsByTagName("script")[0]; s.parentNode.insertBefore(ts, s);};
  if (w.opera == "[object Opera]") { d.addEventListener("DOMContentLoaded", f, false); } else { f(); }
})(document, window, "topmailru-code");
</script><noscript><div style="position:absolute;left:-10000px;">
<img src="//top-fwz1.mail.ru/counter?id=2786217;js=na" style="border:0;" height="1" width="1" alt="Рейтинг@Mail.ru" />
</div></noscript>
<!-- //Rating@Mail.ru counter -->
<a href="http://statok.net/go/12924"><img src="http://statok.net/imageOther/12924" alt="Statok.net" /></a>
<a href="http://monstop.ru/go/821"><img src="http://monstop.ru/imageOther/821" alt="Monstop.ru"/></a>
        </footer>
        
        <!-- Javascript Libraries -->
        <script src="/assets/bower_components/jquery/dist/jquery.min.js"></script>
        <script src="/assets/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
        <script src="/assets/bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.concat.min.js"></script>
        <script src="/assets/sparklines/jquery.sparkline.min.js"></script>
        <script src="/assets/bootstrap-growl/bootstrap-growl.min.js"></script>
        <script src="/assets/bower_components/moment/min/moment.min.js"></script>
                        
        <script src="/assets/js/functions.js"></script>';
        if ($b == false) {   
        echo'
        <script src="/assets/js/demo.js"></script>'; 
        }
        echo'
        <script src="/assets/js/interface.js"></script>
    </body>
</html>'; 
	}
///Задаем ноги				
	public function GalleryFooter() {
        	global $b;
	echo'
        <footer id="footer">
            Все права защищены © 2016 '.homeurl.'
            <ul class="f-menu">
                <li><a href="/">Главная</a></li>
                <li><a href="/forum">Форум</a></li>
                <li><a href="/downs">Загрузки</a></li>
                <li><a href="/peoples">Пользователи</a></li>
                <li><a href="/support">Служба поддержки</a></li>
            </ul>
<!-- Rating@Mail.ru counter -->
<script type="text/javascript">
var _tmr = window._tmr || (window._tmr = []);
_tmr.push({id: "2786217", type: "pageView", start: (new Date()).getTime()});
(function (d, w, id) {
  if (d.getElementById(id)) return;
  var ts = d.createElement("script"); ts.type = "text/javascript"; ts.async = true; ts.id = id;
  ts.src = (d.location.protocol == "https:" ? "https:" : "http:") + "//top-fwz1.mail.ru/js/code.js";
  var f = function () {var s = d.getElementsByTagName("script")[0]; s.parentNode.insertBefore(ts, s);};
  if (w.opera == "[object Opera]") { d.addEventListener("DOMContentLoaded", f, false); } else { f(); }
})(document, window, "topmailru-code");
</script><noscript><div style="position:absolute;left:-10000px;">
<img src="//top-fwz1.mail.ru/counter?id=2786217;js=na" style="border:0;" height="1" width="1" alt="Рейтинг@Mail.ru" />
</div></noscript>
<!-- //Rating@Mail.ru counter -->
<a href="http://statok.net/go/12924"><img src="http://statok.net/imageOther/12924" alt="Statok.net" /></a>
<a href="http://monstop.ru/go/821"><img src="http://monstop.ru/imageOther/821" alt="Monstop.ru"/></a>
        </footer>
        
        <!-- Javascript Libraries -->
        <script src="/assets/bower_components/jquery/dist/jquery.min.js"></script>
        <script src="/assets/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
        <script src="/assets/bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.concat.min.js"></script>
        <script src="/assets/bootstrap-growl/bootstrap-growl.min.js"></script>

        <!-- LightGallery + Plugins -->
        <script src="/assets/bower_components/lightgallery/src/js/lightgallery.js"></script>
        <script src="/assets/bower_components/lightgallery/src/js/lg-video.js"></script>
        <script src="/assets/bower_components/lightgallery/src/js/lg-fullscreen.js"></script>
        <script src="/assets/bower_components/lightgallery/src/js/lg-zoom.js"></script>
        <!-- End LightGallery -->
       
        <!--[if IE 9 ]>
            <script src="/assets/bower_components/jquery-placeholder/jquery.placeholder.min.js"></script>
        <![endif]-->

                        
        <script src="/assets/js/functions.js"></script>';
        if ($b == false) {   
        echo'
        <script src="/assets/js/demo.js"></script>'; 
        }
        echo'
        <script src="/assets/js/interface.js"></script>
    </body>
</html>'; 
	}
///Задаем шапку	
	public function GetProfHeader() {
	ob_start();
	global $b;
        $style = ($b['id']?$b['style']:'green');
	echo'<!DOCTYPE html>
	<html><head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>'.$this->title.'</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta name="description" content="'.$this->description.'" />
	<link rel="author" href="Dario430@yandex.ru" />
	<meta name="keywords" content="'.$this->keywords.'" />
	<link rel="shortcut icon" href="http://'.$_SERVER['HTTP_HOST'].'/images/favicon.ico" type="image/x-icon" />
        <link href="http://'.$_SERVER['HTTP_HOST'].'/assets/bower_components/animate.css/animate.min.css" rel="stylesheet">
        <link href="http://'.$_SERVER['HTTP_HOST'].'/assets/bower_components/material-design-iconic-font/dist/css/material-design-iconic-font.min.css" rel="stylesheet">
        <link href="http://'.$_SERVER['HTTP_HOST'].'/assets/bower_components/lightgallery/src/css/lightgallery.css" rel="stylesheet">
        <link href="http://'.$_SERVER['HTTP_HOST'].'/assets/bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.min.css" rel="stylesheet">
        <link href="http://'.$_SERVER['HTTP_HOST'].'/assets/bower_components/default/applications2.css" rel="stylesheet">
        <link href="http://'.$_SERVER['HTTP_HOST'].'/assets/global/plugins/bower_components/fontawesome/css/font-awesome.min.css" rel="stylesheet">
        <link href="http://'.$_SERVER['HTTP_HOST'].'/assets/admin/css/components.css" rel="stylesheet">
        <link href="http://'.$_SERVER['HTTP_HOST'].'/assets/admin/css/plugins.css" rel="stylesheet">
        <link href="http://'.$_SERVER['HTTP_HOST'].'/assets/admin/css/themes/default.theme.css" rel="stylesheet" id="theme">
        <script src="http://'.$_SERVER['HTTP_HOST'].'/assets/bower_components/jquery/dist/jquery-1.9.1.min.js"></script>';

        echo'
         </head><body>';
if ($b['sneg']==1) { 
echo'<script type="text/javascript">imageDir = "http://'.$_SERVER['HTTP_HOST'].'/assets/images/snow/";sflakesMax = 80;sflakesMaxActive = 80;svMaxX = 2;svMaxY = 1;ssnowStick = 1;ssnowCollect = 0;sfollowMouse = 1;sflakeBottom = 0;susePNG = 1;sflakeTypes = 5;sflakeWidth = 15;sflakeHeight = 15;</script><script type="text/javascript" src="http://'.$_SERVER['HTTP_HOST'].'/assets/js/cache/snow.js"></script>'; }

		echo'
            <header id="header" class="clearfix" data-spy="affix" data-offset-top="65">
              <ul class="header-inner">   
                <li class="logo">
                    <a href="/"><img src="/assets/img/logos2.png" alt=""></a>
                    <div id="menu-trigger"><i class="zmdi zmdi-menu"></i></div>
                </li>';
		if (isset($b)) {
$count_letter = DB::$dbs->querySingle("SELECT COUNT(id) FROM `letters` WHERE `idwho` = ? AND `read` = ?", [$b['id'],0]);
$notice = DB::$dbs->querySingle("SELECT COUNT(id) FROM jurnal WHERE user_id = ? AND type = ?", [$b['id'],1]);
if ($b['level'] >= 1) {
$count_compl = DB::$dbs->querySingle("SELECT COUNT(id) FROM `complaint` WHERE `read` = ?", [1]);
if (!empty($count_compl)) {
$vs = $vs + $count_compl;
}
}
if ($b['level'] > 4) {
$count_pay = DB::$dbs->querySingle("SELECT COUNT(id) FROM `pay` WHERE `type` = ?", [3]);
if (!empty($count_pay)) {
$vs = $vs + $count_pay;
}
}
if ($b['level'] > 4) {
$count_out = DB::$dbs->querySingle("SELECT COUNT(id) FROM `billing_out` WHERE `type` = ?", [0]);
if (!empty($count_out)) {
$vs = $vs + $count_out;
}
$ar = DB::$dbs->querySingle("SELECT COUNT(id) FROM `arbitage` WHERE `status` = ?", [1]);
if (!empty($ar)) {
$vs = $vs + $ar;
}
$supp = DB::$dbs->querySingle("SELECT COUNT(id) FROM `support` WHERE `type` = ?", [1]);
if (!empty($supp)) {
$vs = $vs + $supp;
}
}
if ($b['level']>2) {
$otzyv = DB::$dbs->querySingle("SELECT COUNT(id) FROM otzyvy WHERE activ = ?", [0]);
if (!empty($otzyv)) {
$vs = $vs + $otzyv;
}
}
if ($b['level']>3) {
$ked = DB::$dbs->querySingle("SELECT COUNT(id) FROM ked WHERE type = ?", [0]);
if (!empty($ked)) {
$vs = $vs + $ked;
}
$garant = DB::$dbs->querySingle("SELECT COUNT(id) FROM garant WHERE type = ?", [0]);
if (!empty($garant)) {
$vs = $vs + $garant;
}
}
if ($b['level'] >4) {
$rekl = DB ::$dbs->querySingle("SELECT COUNT(id) FROM billing_rekl WHERE type = ?",[0]);
if (!empty($rekl)) {
$vs = $vs + $rekl;
}
}
if ($b['level'] >= 3) {
$u = DB::$dbs->querySingle("SELECT COUNT(id) FROM blogger WHERE activ = ?", [1]);
if (!empty($u)) {
$vs = $vs + $u;
}
$count_files = DB::$dbs->querySingle("SELECT COUNT(id) FROM `downs` WHERE `mod` = ?", [1]);
if (!empty($count_files)) {
$vs = $vs + $count_files;
}
$codes = DB::$dbs -> query('SELECT `id` FROM `codes_code` WHERE `check` = "0"')  -> rowCount();
if (!empty($codes)) {
$vs = $vs + $codes;
}
}
                
                echo'<!-- Сообщения -->
                <li class="dropdown"><a href="/messages"><i class="zmdi zmdi-email"></i>
                        '; if (!empty($count_letter)) { echo'<i class="hi-count">'.$count_letter.'</i>'; } echo'</a></li>
                    
                <!-- Уведомления -->
                <li class="dropdown"><a href="/journal">
              <i class="zmdi zmdi-notifications"></i>'; if (!empty($notice)) { echo'<i class="hi-count">'.$notice.'</i>'; } echo'</a></li>';                }
                if ($b == false) {  
                echo'<!-- Меню гостя-->
                <li class="pull-right dropdown"><a href="" data-toggle="dropdown">
                        <i class="zmdi zmdi-view-dashboard zmdi-hc-fw"></i></a>
                    <ul class="dropdown-menu">
                        <li><a href="/join">Создать аккаунт</a></li>
                        <li><a href="/login">Вход в аккаунт</a></li>
                        <li><a href="/recovery">Забыли пароль?</a></li>
                    </ul>
                </li>';} else {
                echo'<!-- Вывод приложений -->
                <li class="hidden-xs pull-right dropdown">
                    <a href="" data-toggle="dropdown">
                        <i class="zmdi zmdi-apps"></i>    
                    </a>
                    
                    <div class="dropdown-menu pull-right" id="launch-apps">
                        <div class="dropdown-header bg-teal">Наши приложения</div>
                        <div class="la-body">
                            <div class="lab-item"><a href="/birth" class="bg-red"><i class="zmdi zmdi-calendar"></i>
                                </a><small>Именники</small></div>
                            
                            <div class="lab-item"><a href="/downs" class="bg-green"><i class="zmdi zmdi-file-text"></i>
                                </a><small>Обменник</small></div>
                            
                            <div class="lab-item"><a href="/messages" class="bg-blue"><i class="zmdi zmdi-email"></i>
                                </a><small>Почта</small></div>
                            
                            <div class="lab-item"><a href="/support/" class="bg-orange"><i class="zmdi zmdi-trending-up"></i>
                                </a><small>Тикеты</small></div>
                            
                            <div class="lab-item"><a href="/news/" class="bg-cyan"><i class="zmdi zmdi-view-headline"></i>
                                </a><small>Новости</small></div>

                            <div class="lab-item"><a href="/gallery/" class="bg-teal"><i class="zmdi zmdi-image"></i>
                                </a><small>Галерея</small></div>
                        </div>
                    </div>
                </li>';}echo'
                <!-- Вывод времени -->
                <li class="pull-right">
                    <div id="time">
                        <span id="t-hours"></span>
                        <span id="t-min"></span>
                        <span id="t-sec"></span>
                    </div>
                </li>
            </ul>
        </header>
    
        <aside id="sidebar">
            
            <!--| Главное меню |-->
            <ul class="side-menu">';
if ($b == true) {echo'<li class="sm-sub sms-profile"><a class="clearfix" href="#">';
if (!empty($b['ava'])) {echo'<img src="/' . $b['ava'] . '" alt="">';} else {echo'<img src="/assets/img/4.jpg" alt="">';}
                        echo'<span class="f-11">
                            <span class="d-block">'.$b[ 'name' ].' '.$b[ 'family' ].'</span>
                            <small class="text-lowercase">'.$b[ 'nick' ].'</small>
                        </span></a>
                    <ul>
                        <li><a href="/users/' . $b['id'] . '">Моя страница</a></li>
                        <li><a href="/edit">Редактировать</a></li>
                        <li><a href="/setting">Настройки</a></li>
                        <li><a href="/logout">Выход</a></li>
                    </ul>
                </li>';
} else{
                echo'<li class="sm-sub sms-profile">
                    <a class="clearfix" href="#">
                        <img src="/assets/img/4.jpg" alt="">
                        <span class="f-11"><span class="d-block">Привет, Гость!</span>Пожалуйста, Войдите!</span></a><ul>
                        <li><a href="/join">Регистрация</a></li>
                        <li><a href="/login">Авторизация</a></li>
                        <li><a href="/recovery">Забыли пароль?</a></li>
                    </ul>
                </li>';
}

                echo'<li class="active"><a href="/"><i class="zmdi zmdi-home"></i><span>Главная</span></a></li>';

if ($b['level'] != 0) {echo'<li><a href="/administration"><i class="zmdi zmdi-widgets zmdi-hc-fw"></i><span> Панель управления '.(!empty($vs) ? '<span class="label label-primary">+'.$vs.'</span>':NULL).'</span></a></li>'; }
$d = date("d");
$last = DB::$dbs->querySingle("SELECT COUNT(id) FROM blogger WHERE vis = ?", [$d]);
$ft = DB :: $dbs -> querySingle ("SELECT COUNT(id) FROM `forum_topic`");
$fm = DB :: $dbs -> querySingle ("SELECT COUNT(id) FROM `forum_mess`");
$fff = $ft + $fm;

                     echo'<li><a href="/news/"><i class="zmdi zmdi-widgets"></i>
       <span>Новости ресурса <span class="label label-primary">'.DB :: $dbs -> querySingle ("SELECT COUNT(id) FROM `news`").'</span></span>
                    </a></li>
                <li class="sm-sub"><a href="#">
                        <i class="zmdi zmdi zmdi-view-list"></i>
                        <span>Свежие новости <span class="label label-primary">' . DB :: $dbs -> querySingle ("SELECT COUNT(id) FROM `gazeta_article`") . '</span></span>
                    </a><ul>
                        <li><a href="/allnews/search">Поиск статей</a></li>
                        <li><a href="/allnews/">Новые статьи</a></li>
                    </ul></li>
                <li><a href="/forum"><i class="zmdi zmdi-collection-text"></i><span>Наш форум <span class="label label-primary">' . $fff . '</span></span></a></li>';

                     echo'
                <li class="sm-sub"><a href="">
                        <i class="zmdi zmdi-swap-alt"></i>
                        <span>Наши модули <span class="label label-primary">4</span></span>
                    </a><ul>';
                        echo'<li><a href="/peoples">Пользователи ('.DB::$dbs -> querySingle ("SELECT COUNT(*) FROM `blogger`").')</a></li>
                        <li><a href="/birth">Именинники ('.DB::$dbs->querySingle("SELECT COUNT(id) FROM blogger WHERE birthday LIKE '". date('d.m.') ."%'").')</a></li>
                        <li><a href="/last">Нас посетили ('.$last.')</a></li>
                    </ul></li><li><a href="/downs">
                        <i class="zmdi zmdi-download"></i>
                        <span>Загруз-центр <span class="label label-primary">' . DB::$dbs -> querySingle ("SELECT COUNT(*) FROM `downs` WHERE `mod` = ?",[0]) . '</span></span></a></li>
                <li class="sm-sub">
                    <a href="#">
                        <i class="zmdi zmdi-image"></i>
                        <span>Фотогалерея <span class="label label-primary">' . DB :: $dbs -> querySingle ("SELECT COUNT(id) FROM `album_foto`") . '</span></span>
                    </a>
                    <ul>';
$sql = DB::$dbs->query("SELECT * FROM album_cat ORDER BY id ASC");
if ($sql->rowCount() == 0) {
err('Альбомов нет');
} else {
while($a = $sql -> fetch()) {
echo '<li><a href="/gallery/action.html?id='.$a['id'].'"> '.$a['name'].'</a></li>';
}
}

                    echo'</ul>
                </li>
                <li>
                    <a href="/lenta"><i class="zmdi zmdi-layers"></i>
                        <span>Лента новостей <span class="label label-primary">'. DB::$dbs -> querySingle("SELECT COUNT(id) FROM `lenta`").(empty($new_lenta) ? NULL : '/<b style="COLOR:red">'.$new_lenta.'</b>').'</span></span>
                    </a>
                </li>
                <li class="sm-sub sms-bottom">
                    <a href=""><i class="zmdi zmdi-collection-item"></i>
                        <span>Сервисы сайта <span class="label label-primary">2</span></span>
                    </a><ul>
                        <li><a href="/codes">Полезные коды</a></li>
                        <li><a href="/garants">Список гарантов</a></li>
                    </ul></li>
                <li>
                    <a href="/market">
                        <i class="zmdi zmdi-shopping-cart"></i>
    <span>Онлайн маркет <span class="label label-primary">' . DB::$dbs -> querySingle ("SELECT COUNT(*) FROM `magazin_file`") . '</span></span>
                    </a>
                </li>
<li class="active"><a href="/"><i class="zmdi zmdi-home"></i><span>Мы рекомендуем</span></a></li>';
echo'<li><a href="http://new.vk.com/phpage_info"><i class="zmdi zmdi-home"></i><span>Мы Вконтакте</span></a></li>';
/*
if ($_SERVER['PHP_SELF'] == '/index.php') {
echo '<li><span> ', printAdv('top') ,'</span></li>';
$random = DB ::$dbs->query("SELECT * FROM billing_rekl WHERE gde = ? AND type = ? ORDER BY RAND() DESC",['index',1]); #Рандомный вывод
if($random->rowCount() >0){
	echo '<div class="list-group-item media">';
while($r = $random->fetch()){
	echo '<li><a href="http://'.$r['url'].'"><i class="zmdi zmdi-home"></i> '.$r['name'].'</a></li>';
}
}
} elseif ($_SERVER['PHP_SELF'] != '/') {
echo '<li><span> ', printAdv('down') ,'</span></li>';
$random = DB ::$dbs->query("SELECT * FROM billing_rekl WHERE gde = ? AND type = ? ORDER BY RAND() DESC",['all',1]);
if($random->rowCount() >0){
	echo '<div class="list-group-item media">';
while($r = $random->fetch()){
	echo '<li><a href="http://'.$r['url'].'"><i class="zmdi zmdi-home"></i> '.$r['name'].'</a></li>';
}
}
}
*/
            echo'</ul></aside>';
          echo'<section id="content"><div class="container">';
/*
if (isset($b)) {
if ($b['activ'] == 1) {
$title= new Body;
echo'<div class="tile"><div class="t-header th-alt bg-teal"><div class="th-title"><i class="zmdi zmdi-widgets"></i><a href="/"style="text-decoration:none; color:white;"> Главная</a> :: Активация аккаунта</div></div></div>';
echo '<div class="t-header bg-ace"><div class="th-title"><p>Пожалуйста, подождите... Ваш запрос на регистрацию в очереди обрабатывается... </br>
Ваши регистрационные данные были отправлены на указанный адрес электронной почты.</p></div></div>';
$title->GetMenu();
$title->GetFooter();
die();
} elseif ($b['activ'] == 2) {
$title= new Body;
echo'<div class="tile"><div class="t-header th-alt bg-teal"><div class="th-title"><i class="zmdi zmdi-widgets"></i><a href="/"style="text-decoration:none; color:white;"> Главная</a> :: Активация аккаунта</div></div></div><div class="t-header bg-ace"><div class="th-title"><p>К сожалению, Ваша регистрация была отклонена.</p></div></div>';
$title->GetMenu();
$title->GetFooter();
die();
}
}
	*/
}
}
?>